summaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-16 16:58:06 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-16 16:58:06 +0000
commit99dd4c5285690ae9d33a62eebae99253901f714c (patch)
tree4a78ab16c0142d94ed7d1be9d20eceaa68eeee7f /io.c
parent0ec558603bf0ac08d023122c01c6150090728b6d (diff)
downloadruby-99dd4c5285690ae9d33a62eebae99253901f714c.tar.gz
ruby-99dd4c5285690ae9d33a62eebae99253901f714c.tar.xz
ruby-99dd4c5285690ae9d33a62eebae99253901f714c.zip
* node.h (rb_notimplement_body_p): declared.
* vm_method.c (Init_eval_method): suppress a warning. * io.c (rb_io_fsync): use rb_f_notimplement if not implemented. (rb_io_close_on_exec_p): ditto. (rb_io_set_close_on_exec): ditto. (rb_io_fcntl): ditto. (rb_f_syscall): ditto. * dir.c (dir_tell): ditto. (dir_seek): ditto. (dir_s_chroot): ditto. * process.c (proc_getpgrp): ditto. (proc_setpgrp): ditto. (proc_getpgid): ditto. (proc_setpgid): ditto. (proc_setsid): ditto. (proc_getpriority): ditto. (proc_setpriority): ditto. (proc_getrlimit): ditto. (proc_setrlimit): ditto. (p_sys_setuid): ditto. (p_sys_setruid): ditto. (p_sys_seteuid): ditto. (p_sys_setreuid): ditto. (p_sys_setresuid): ditto. (p_sys_setgid): ditto. (p_sys_setrgid): ditto. (p_sys_setegid): ditto. (p_sys_setregid): ditto. (p_sys_setreuid): ditto. (p_sys_setresgid): ditto. (p_sys_issetugid): ditto. (proc_getgroups): ditto. (proc_setgroups): ditto. (proc_initgroups): ditto. (proc_daemon): ditto. (rb_proc_times): ditto. * file.c (rb_file_s_lchown): ditto. (rb_file_s_link): ditto. (rb_file_s_symlink): ditto. (rb_file_s_readlink): ditto. (rb_file_s_truncate): ditto. (rb_file_truncate): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/io.c b/io.c
index ddfb5e0f4..00250b4d9 100644
--- a/io.c
+++ b/io.c
@@ -1282,6 +1282,7 @@ rb_io_set_sync(VALUE io, VALUE sync)
return sync;
}
+#ifdef HAVE_FSYNC
/*
* call-seq:
* ios.fsync => 0 or nil
@@ -1297,7 +1298,6 @@ rb_io_set_sync(VALUE io, VALUE sync)
static VALUE
rb_io_fsync(VALUE io)
{
-#ifdef HAVE_FSYNC
rb_io_t *fptr;
io = GetWriteIO(io);
@@ -1308,11 +1308,10 @@ rb_io_fsync(VALUE io)
if (fsync(fptr->fd) < 0)
rb_sys_fail_path(fptr->pathv);
return INT2FIX(0);
+}
#else
- rb_notimplement();
- return Qnil; /* not reached */
+#define rb_io_fsync rb_f_notimplement
#endif
-}
/*
* call-seq:
@@ -3024,6 +3023,7 @@ rb_io_isatty(VALUE io)
return Qtrue;
}
+#if defined(HAVE_FCNTL) && defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC)
/*
* call-seq:
* ios.close_on_exec? => true or false
@@ -3041,7 +3041,6 @@ rb_io_isatty(VALUE io)
static VALUE
rb_io_close_on_exec_p(VALUE io)
{
-#if defined(HAVE_FCNTL) && defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC)
rb_io_t *fptr;
VALUE write_io;
int fd, ret;
@@ -3061,12 +3060,12 @@ rb_io_close_on_exec_p(VALUE io)
if (!(ret & FD_CLOEXEC)) return Qfalse;
}
return Qtrue;
+}
#else
- rb_notimplement();
- return Qnil; /* not reached */
+#define rb_io_close_on_exec_p rb_f_notimplement
#endif
-}
+#if defined(HAVE_FCNTL) && defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC)
/*
* call-seq:
* ios.close_on_exec = bool => true or false
@@ -3082,7 +3081,6 @@ rb_io_close_on_exec_p(VALUE io)
static VALUE
rb_io_set_close_on_exec(VALUE io, VALUE arg)
{
-#if defined(HAVE_FCNTL) && defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC)
int flag = RTEST(arg) ? FD_CLOEXEC : 0;
rb_io_t *fptr;
VALUE write_io;
@@ -3111,11 +3109,11 @@ rb_io_set_close_on_exec(VALUE io, VALUE arg)
if (ret == -1) rb_sys_fail_path(fptr->pathv);
}
}
-#else
- rb_notimplement();
-#endif
return Qnil;
}
+#else
+#define rb_io_set_close_on_exec rb_f_notimplement
+#endif
#define FMODE_PREP (1<<16)
#define IS_PREP_STDIO(f) ((f)->mode & FMODE_PREP)
@@ -6937,6 +6935,7 @@ rb_io_ioctl(int argc, VALUE *argv, VALUE io)
return rb_io_ctl(io, req, arg, 1);
}
+#ifdef HAVE_FCNTL
/*
* call-seq:
* ios.fcntl(integer_cmd, arg) => integer
@@ -6953,17 +6952,16 @@ rb_io_ioctl(int argc, VALUE *argv, VALUE io)
static VALUE
rb_io_fcntl(int argc, VALUE *argv, VALUE io)
{
-#ifdef HAVE_FCNTL
VALUE req, arg;
rb_scan_args(argc, argv, "11", &req, &arg);
return rb_io_ctl(io, req, arg, 0);
+}
#else
- rb_notimplement();
- return Qnil; /* not reached */
+#define rb_io_fcntl rb_f_notimplement
#endif
-}
+#if defined(HAVE_SYSCALL) && !defined(__CHECKER__)
/*
* call-seq:
* syscall(fixnum [, args...]) => integer
@@ -6986,7 +6984,6 @@ rb_io_fcntl(int argc, VALUE *argv, VALUE io)
static VALUE
rb_f_syscall(int argc, VALUE *argv)
{
-#if defined(HAVE_SYSCALL) && !defined(__CHECKER__)
#ifdef atarist
unsigned long arg[14]; /* yes, we really need that many ! */
#else
@@ -7078,11 +7075,10 @@ rb_f_syscall(int argc, VALUE *argv)
if (retval < 0) rb_sys_fail(0);
return INT2NUM(retval);
+}
#else
- rb_notimplement();
- return Qnil; /* not reached */
+#define rb_f_syscall rb_f_notimplement
#endif
-}
static VALUE
io_new_instance(VALUE args)