From eb35bb0b351f55459fdfce7198e8756e37141dff Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 3 Jul 2011 21:56:59 +0000 Subject: * include/ruby/intern.h, thread_pthread.c (rb_reserved_fd_p, RB_RESERVED_FD_P): added. This C API is to limit to access fds which are used by RubyVM internal. In this version of CRuby, return 1 if fd is communication pipe. If your application needs to close all file descriptors to preent resource leak, skip internal fds using this C API. We also define a macro RB_RESERVED_FD_P(fd). So you can write #ifndef RB_RESERVED_FD_P #define RB_RESERVED_FD_P(fd) 0 #endif for Ruby 1.9.2 or previous version to write compatible extensions. See [ruby-core:37727] * thread_win32.c (rb_reserved_fd_p): added (return 0 for any fds). * io.c (rb_io_initialize): raise ArgumentError if given fd is reserved by Ruby. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/intern.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/ruby') diff --git a/include/ruby/intern.h b/include/ruby/intern.h index c8b0e1af57..da1c036740 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -482,6 +482,8 @@ void rb_write_error(const char*); void rb_write_error2(const char*, long); void rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds); int rb_pipe(int *pipes); +int rb_reserved_fd_p(int fd); +#define RB_RESERVED_FD_P(fd) rb_reserved_fd_p(fd) /* marshal.c */ VALUE rb_marshal_dump(VALUE, VALUE); VALUE rb_marshal_load(VALUE); -- cgit v1.2.3