summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-07 08:12:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-07 08:12:32 +0000
commitf64949e2764a95e86a3851c07273f88aaac2fc7b (patch)
treefc68bacfedbdac03a111c286cba1715878ee6e81 /io.c
parentf69dff0ed11bea690e4b60f1ce9f7221a363fa46 (diff)
* io.c (Init_IO): added rdocs for constants.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/io.c b/io.c
index 8ce11234e6..3391bea4d0 100644
--- a/io.c
+++ b/io.c
@@ -6451,6 +6451,7 @@ rb_file_initialize(int argc, VALUE *argv, VALUE io)
return io;
}
+/* :nodoc: */
static VALUE
rb_io_s_new(int argc, VALUE *argv, VALUE klass)
{
@@ -6519,6 +6520,7 @@ argf_alloc(VALUE klass)
#undef rb_argv
+/* :nodoc: */
static VALUE
argf_initialize(VALUE argf, VALUE argv)
{
@@ -6528,6 +6530,7 @@ argf_initialize(VALUE argf, VALUE argv)
return argf;
}
+/* :nodoc: */
static VALUE
argf_initialize_copy(VALUE argf, VALUE orig)
{
@@ -9868,28 +9871,36 @@ Init_IO(void)
rb_define_method(rb_cFile, "initialize", rb_file_initialize, -1);
+ /* open for reading only */
rb_file_const("RDONLY", INT2FIX(O_RDONLY));
+ /* open for writing only */
rb_file_const("WRONLY", INT2FIX(O_WRONLY));
+ /* open for reading and writing */
rb_file_const("RDWR", INT2FIX(O_RDWR));
+ /* append on each write */
rb_file_const("APPEND", INT2FIX(O_APPEND));
+ /* create file if it does not exist */
rb_file_const("CREAT", INT2FIX(O_CREAT));
+ /* error if CREAT and the file exists */
rb_file_const("EXCL", INT2FIX(O_EXCL));
#if defined(O_NDELAY) || defined(O_NONBLOCK)
-# ifdef O_NONBLOCK
+# ifndef O_NONBLOCK
+# define O_NONBLOCK O_NDELAY
+# endif
+ /* do not block on open or for data to become available */
rb_file_const("NONBLOCK", INT2FIX(O_NONBLOCK));
-# else
- rb_file_const("NONBLOCK", INT2FIX(O_NDELAY));
-# endif
#endif
+ /* truncate size to 0 */
rb_file_const("TRUNC", INT2FIX(O_TRUNC));
#ifdef O_NOCTTY
+ /* not to make opened IO the controling terminal device */
rb_file_const("NOCTTY", INT2FIX(O_NOCTTY));
#endif
-#ifdef O_BINARY
- rb_file_const("BINARY", INT2FIX(O_BINARY));
-#else
- rb_file_const("BINARY", INT2FIX(0));
+#ifndef O_BINARY
+# define O_BINARY 0
#endif
+ /* disable line code conversion and make ASCII-8BIT */
+ rb_file_const("BINARY", INT2FIX(O_BINARY));
#ifdef O_SYNC
rb_file_const("SYNC", INT2FIX(O_SYNC));
#endif
@@ -9900,9 +9911,11 @@ Init_IO(void)
rb_file_const("RSYNC", INT2FIX(O_RSYNC));
#endif
#ifdef O_NOFOLLOW
+ /* do not follow symlinks */
rb_file_const("NOFOLLOW", INT2FIX(O_NOFOLLOW)); /* FreeBSD, Linux */
#endif
#ifdef O_NOATIME
+ /* do not change atime */
rb_file_const("NOATIME", INT2FIX(O_NOATIME)); /* Linux */
#endif