diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-17 02:48:59 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-17 02:48:59 +0000 |
commit | 76bc2d1ed7f13fb329c33f48756ea3c24c59a6ea (patch) | |
tree | 3ec93c5eb45d0bc6e6eb53d2efebd2f8c0c8ee3d /io.c | |
parent | 0a7aada5d18441b437f5e406a991d963b3613d9a (diff) |
Imports Ruby's port to NativeClient (a.k.a NaCl).
Patch by Google Inc. [ruby-core:45073].
* configure.in (RUBY_NACL): New M4 func to configure variables for
NaCl.
(RUBY_NACL_CHECK_PEPPER_TYPES): New M4 func to check the old names
of Pepper interface types.
(BTESTRUBY): New variable to specify which ruby should be run on
"make btest". NaCl can run the built binary by sel_ldr, but it need
rbconfig.rb. So this variable is distinguished from $MINIRUBY.
* thread_pthread.c: Disabled some features on NaCl.
* io.c: ditto.
* process.c: ditto.
* signal.c: ditto.
* file.c: ditto.
* missing/flock.c: ditto.
* nacl/pepper_main.c: An example implementation of Pepper application
that embeds Ruby.
* nacl/example.html: An example of web page that uses the Pepper
application.
* nacl/nacl-config.rb: Detects variants of NaCl SDK.
* nacl/GNUmakefile.in: Makefile template for NaCl specific build
process.
* nacl/package.rb: script for packaging a NaCl-Ruby embedding
application.
* nacl/reate_nmf.rb: Wrapper script of create_nmf.py
* dln.c (dln_load): Added a hack to call on NaCl.
* util.c (ruby_getcwd): Path to the current directort is not available
on NaCl.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 30 |
1 files changed, 20 insertions, 10 deletions
@@ -28,7 +28,9 @@ #if defined HAVE_NET_SOCKET_H # include <net/socket.h> #elif defined HAVE_SYS_SOCKET_H -# include <sys/socket.h> +# ifndef __native_client__ +# include <sys/socket.h> +# endif #endif #if defined(__BOW__) || defined(__CYGWIN__) || defined(_WIN32) || defined(__EMX__) || defined(__BEOS__) || defined(__HAIKU__) @@ -47,6 +49,9 @@ #if defined(HAVE_SYS_IOCTL_H) && !defined(_WIN32) #include <sys/ioctl.h> #endif +#if defined(__native_client__) && defined(NACL_NEWLIB) +# include "nacl/ioctl.h" +#endif #if defined(HAVE_FCNTL_H) || defined(_WIN32) #include <fcntl.h> #elif defined(HAVE_SYS_FCNTL_H) @@ -161,7 +166,7 @@ void rb_maygvl_fd_fix_cloexec(int fd) { /* MinGW don't have F_GETFD and FD_CLOEXEC. [ruby-core:40281] */ -#ifdef F_GETFD +#if defined(F_GETFD) && !defined(__native_client__) int flags, flags2, ret; flags = fcntl(fd, F_GETFD); /* should not fail except EBADF. */ if (flags == -1) { @@ -187,7 +192,6 @@ rb_fd_fix_cloexec(int fd) if (max_file_descriptor < fd) max_file_descriptor = fd; } - int rb_cloexec_open(const char *pathname, int flags, mode_t mode) { @@ -1502,6 +1506,7 @@ rb_io_set_pos(VALUE io, VALUE offset) static void clear_readconv(rb_io_t *fptr); +#if defined(HAVE_FSYNC) || !defined(_WIN32) /* * call-seq: * ios.rewind -> 0 @@ -1540,6 +1545,7 @@ rb_io_rewind(VALUE io) return INT2FIX(0); } +#endif static int io_fillbuf(rb_io_t *fptr) @@ -1629,6 +1635,7 @@ rb_io_eof(VALUE io) return Qfalse; } +#ifdef HAVE_FSYNC /* * call-seq: * ios.sync -> true or false @@ -1683,8 +1690,6 @@ rb_io_set_sync(VALUE io, VALUE sync) return sync; } -#ifdef HAVE_FSYNC - /* * call-seq: * ios.fsync -> 0 or nil @@ -1709,14 +1714,19 @@ rb_io_fsync(VALUE io) if (io_fflush(fptr) < 0) rb_sys_fail(0); -#ifndef _WIN32 /* already called in io_fflush() */ +# ifndef _WIN32 /* already called in io_fflush() */ if ((int)rb_thread_io_blocking_region(nogvl_fsync, fptr, fptr->fd) < 0) rb_sys_fail_path(fptr->pathv); -#endif +# endif return INT2FIX(0); } #else -#define rb_io_fsync rb_f_notimplement +# define rb_io_fsync rb_f_notimplement +# define rb_io_sync rb_f_notimplement +static VALUE rb_io_set_sync(VALUE io, VALUE sync) { + rb_notimplement(); + /* NEVER REACHED */ return Qundef; +} #endif #ifdef HAVE_FDATASYNC @@ -8200,10 +8210,10 @@ rb_f_select(int argc, VALUE *argv, VALUE obj) #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) typedef unsigned long ioctl_req_t; - #define NUM2IOCTLREQ(num) NUM2ULONG(num) +# define NUM2IOCTLREQ(num) NUM2ULONG(num) #else typedef int ioctl_req_t; - #define NUM2IOCTLREQ(num) NUM2INT(num) +# define NUM2IOCTLREQ(num) NUM2INT(num) #endif struct ioctl_arg { |