diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-11-16 18:42:47 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-11-17 18:03:38 -0800 |
commit | a40c1d4b30253c68d7997324bcebceb68018bc37 (patch) | |
tree | 41ef2996715028396103e5729b4077b7c8a29a74 | |
parent | be3672501ecde716dae723e887d4a9e4d731240c (diff) | |
download | kgio-a40c1d4b30253c68d7997324bcebceb68018bc37.tar.gz |
There's no reason for SOCK_NONBLOCK with Ruby, and SOCK_CLOEXEC has always been on-by-default with accept() wrappers.
-rw-r--r-- | ext/kgio/accept.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/ext/kgio/accept.c b/ext/kgio/accept.c index f78d0fe..f8a073f 100644 --- a/ext/kgio/accept.c +++ b/ext/kgio/accept.c @@ -283,12 +283,11 @@ static VALUE addr_bang(VALUE io) * An optional +klass+ argument may be specified to override the * Kgio::Socket-class on a successful return value. * - * An optional +flags+ argument may also be specifed to override the - * value of +Kgio.accept_cloexec+ and +Kgio.accept_nonblock+. +flags+ - * is a bitmask that may contain any combination of: + * An optional +flags+ argument may also be specified. + * +flags+ is a bitmask that may contain any combination of: * - * - Kgio::SOCK_CLOEXEC - close-on-exec flag - * - Kgio::SOCK_NONBLOCK - non-blocking flag + * - Kgio::SOCK_CLOEXEC - close-on-exec flag (enabled by default) + * - Kgio::SOCK_NONBLOCK - non-blocking flag (unimportant) */ static VALUE tcp_tryaccept(int argc, VALUE *argv, VALUE self) { @@ -320,12 +319,11 @@ static VALUE tcp_tryaccept(int argc, VALUE *argv, VALUE self) * An optional +klass+ argument may be specified to override the * Kgio::Socket-class on a successful return value. * - * An optional +flags+ argument may also be specifed to override the - * value of +Kgio.accept_cloexec+ and +Kgio.accept_nonblock+. +flags+ - * is a bitmask that may contain any combination of: + * An optional +flags+ argument may also be specified. + * +flags+ is a bitmask that may contain any combination of: * - * - Kgio::SOCK_CLOEXEC - close-on-exec flag - * - Kgio::SOCK_NONBLOCK - non-blocking flag + * - Kgio::SOCK_CLOEXEC - close-on-exec flag (enabled by default) + * - Kgio::SOCK_NONBLOCK - non-blocking flag (unimportant) */ static VALUE tcp_accept(int argc, VALUE *argv, VALUE self) { @@ -354,12 +352,11 @@ static VALUE tcp_accept(int argc, VALUE *argv, VALUE self) * An optional +klass+ argument may be specified to override the * Kgio::Socket-class on a successful return value. * - * An optional +flags+ argument may also be specifed to override the - * value of +Kgio.accept_cloexec+ and +Kgio.accept_nonblock+. +flags+ - * is a bitmask that may contain any combination of: + * An optional +flags+ argument may also be specified. + * +flags+ is a bitmask that may contain any combination of: * - * - Kgio::SOCK_CLOEXEC - close-on-exec flag - * - Kgio::SOCK_NONBLOCK - non-blocking flag + * - Kgio::SOCK_CLOEXEC - close-on-exec flag (enabled by default) + * - Kgio::SOCK_NONBLOCK - non-blocking flag (unimportant) */ static VALUE unix_tryaccept(int argc, VALUE *argv, VALUE self) { @@ -389,12 +386,11 @@ static VALUE unix_tryaccept(int argc, VALUE *argv, VALUE self) * An optional +klass+ argument may be specified to override the * Kgio::Socket-class on a successful return value. * - * An optional +flags+ argument may also be specifed to override the - * value of +Kgio.accept_cloexec+ and +Kgio.accept_nonblock+. +flags+ - * is a bitmask that may contain any combination of: + * An optional +flags+ argument may also be specified. + * +flags+ is a bitmask that may contain any combination of: * - * - Kgio::SOCK_CLOEXEC - close-on-exec flag - * - Kgio::SOCK_NONBLOCK - non-blocking flag + * - Kgio::SOCK_CLOEXEC - close-on-exec flag (enabled by default) + * - Kgio::SOCK_NONBLOCK - non-blocking flag (unimportant) */ static VALUE unix_accept(int argc, VALUE *argv, VALUE self) { @@ -511,14 +507,18 @@ void init_kgio_accept(void) VALUE mKgio = rb_define_module("Kgio"); /* - * this maps to the SOCK_NONBLOCK constant in Linux for setting - * the non-blocking flag on newly accepted sockets. + * Maps to the SOCK_NONBLOCK constant in Linux for setting + * the non-blocking flag on newly accepted sockets. This is + * usually unnecessary as sockets are made non-blocking + * whenever non-blocking methods are used. */ rb_define_const(mKgio, "SOCK_NONBLOCK", INT2NUM(SOCK_NONBLOCK)); /* - * this maps to the SOCK_CLOEXEC constant in Linux for setting - * the close-on-exec flag on newly accepted descriptors. + * Maps to the SOCK_CLOEXEC constant in Linux for setting + * the close-on-exec flag on newly accepted descriptors. This + * is enabled by default, and there is usually no reason to + * disable close-on-exec for accepted sockets. */ rb_define_const(mKgio, "SOCK_CLOEXEC", INT2NUM(SOCK_CLOEXEC)); |