summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-05 10:16:11 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-05 10:16:11 +0000
commit5b13036fce91d8970448e565e4319939b27cdc00 (patch)
tree795da0fa6da9b42bf3e6e5d8517c59a92a012e00 /io.c
parentff3b2cb1cef59787bcb125baeeef78a23e83e78a (diff)
* process.c: add comments about async-signal-safe.
* io.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/io.c b/io.c
index 90e2657b3d..3d4fe54848 100644
--- a/io.c
+++ b/io.c
@@ -5421,6 +5421,7 @@ linux_get_maxfd(void)
}
#endif
+/* This function should be async-signal-safe. */
void
rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds)
{
@@ -5428,7 +5429,7 @@ rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds)
int max = max_file_descriptor;
#ifdef F_MAXFD
/* F_MAXFD is available since NetBSD 2.0. */
- ret = fcntl(0, F_MAXFD);
+ ret = fcntl(0, F_MAXFD); /* async-signal-safe */
if (ret != -1)
maxhint = max = ret;
#elif defined(__linux__)
@@ -5441,15 +5442,15 @@ rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds)
max = maxhint;
for (fd = lowfd; fd <= max; fd++) {
if (!NIL_P(noclose_fds) &&
- RTEST(rb_hash_lookup(noclose_fds, INT2FIX(fd))))
+ RTEST(rb_hash_lookup(noclose_fds, INT2FIX(fd)))) /* async-signal-safe */
continue;
#ifdef FD_CLOEXEC
- ret = fcntl(fd, F_GETFD);
+ ret = fcntl(fd, F_GETFD); /* async-signal-safe */
if (ret != -1 && !(ret & FD_CLOEXEC)) {
- fcntl(fd, F_SETFD, ret|FD_CLOEXEC);
+ fcntl(fd, F_SETFD, ret|FD_CLOEXEC); /* async-signal-safe */
}
#else
- ret = close(fd);
+ ret = close(fd); /* async-signal-safe */
#endif
#define CONTIGUOUS_CLOSED_FDS 20
if (ret != -1) {