diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-11 13:33:14 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-11 13:33:14 +0000 |
commit | 57bc5eaf2f9b44ad8321fecf6dfa45d82a50c580 (patch) | |
tree | 4a5e3e0cf3656e829ad4c830586e13ec57f92cc3 /file.c | |
parent | 3fedb5128f33390959cfcd97a624b33b0f22f372 (diff) | |
download | ruby-57bc5eaf2f9b44ad8321fecf6dfa45d82a50c580.tar.gz |
Fixes build failures on Portable Native Client.
Note: Some of the fixes are for newlib in general but not NaCl-specific.
* include/ruby/intern.h (rb_fd_select): declare struct timeval, or the
struct gets local to the function in C99.
* file.c (#include): add nacl/stat.h for PNaCl.
(utimes): added a declaration for PNaCl.
(stat_atimespec): stat::st_atimensec is long long but
timespec::tv_nsec is long in PNaCl.
(stat_mtimespec, stat_ctimespec): ditto.
(rb_group_member): disable getgroups unless HAVE_GETGROUPS.
(eaccess): unify the fallback to generic defined(USE_GETEUID).
* io.c: include sys/time.h for struct timeval.
(rb_close_before_exec): nothing we can do if F_GETFD is not
available.
(ioctl): pnacl newlib actually doesn't have ioctl.
* process.c (maxgroups): it is used iff
defined(_SC_NGROUPS_MAX) || defined(NGROUPS_MAX) but not
defined(HAVE_GETGROUPS) || defined(HAVE_SETGROUPS).
(obj2gid): fail unless the object is a Fixnum if getgrnam is not
available.
(disable_child_handler_fork_child): sigaction is not available in
PNaCl newlib.
* configure.in (warnflags, strict_warnflags): avoid -ansi for strlcpy.
(rb_cv_gcc_atomic_builtins): also check
__atomic_or_etch because it is used in ruby_atomic.h.
(rb_cv_gcc_sync_builtins): ditto.
(HAVE_GETGRNAM): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -22,6 +22,7 @@ #ifdef __APPLE__ #include <CoreFoundation/CFString.h> #endif +#include <sys/time.h> #include "ruby/ruby.h" #include "ruby/io.h" @@ -69,7 +70,6 @@ int flock(int, int); # include "nacl/unistd.h" #endif - #ifdef HAVE_SYS_MKDEV_H #include <sys/mkdev.h> #endif @@ -720,7 +720,7 @@ stat_atimespec(struct stat *st) #elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC) ts.tv_nsec = st->st_atimespec.tv_nsec; #elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC) - ts.tv_nsec = st->st_atimensec; + ts.tv_nsec = (long)st->st_atimensec; #else ts.tv_nsec = 0; #endif @@ -744,7 +744,7 @@ stat_mtimespec(struct stat *st) #elif defined(HAVE_STRUCT_STAT_ST_MTIMESPEC) ts.tv_nsec = st->st_mtimespec.tv_nsec; #elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC) - ts.tv_nsec = st->st_mtimensec; + ts.tv_nsec = (long)st->st_mtimensec; #else ts.tv_nsec = 0; #endif @@ -768,7 +768,7 @@ stat_ctimespec(struct stat *st) #elif defined(HAVE_STRUCT_STAT_ST_CTIMESPEC) ts.tv_nsec = st->st_ctimespec.tv_nsec; #elif defined(HAVE_STRUCT_STAT_ST_CTIMENSEC) - ts.tv_nsec = st->st_ctimensec; + ts.tv_nsec = (long)st->st_ctimensec; #else ts.tv_nsec = 0; #endif @@ -1138,7 +1138,7 @@ rb_file_lstat(VALUE obj) static int rb_group_member(GETGROUPS_T gid) { -#ifdef _WIN32 +#if defined(_WIN32) || !defined(HAVE_GETGROUPS) return FALSE; #else int rv = FALSE; @@ -1195,7 +1195,8 @@ rb_group_member(GETGROUPS_T gid) // overridden by nacl_io. // TODO(sbc): Remove this once eaccess() is wired up correctly // in NaCl. -#define eaccess access +# undef HAVE_EACCESS +# undef USE_GETEUID #endif #ifndef HAVE_EACCESS |