platform/shared/ruby/missing/flock.c in rhodes-5.5.18 vs platform/shared/ruby/missing/flock.c in rhodes-6.0.11

- old
+ new

@@ -1,11 +1,12 @@ #include "ruby/config.h" +#include "ruby/ruby.h" #if defined _WIN32 -#elif defined HAVE_FCNTL && defined HAVE_FCNTL_H +#elif defined HAVE_FCNTL && defined HAVE_FCNTL_H && !defined(__native_client__) -/* These are the flock() constants. Since this sytems doesn't have +/* These are the flock() constants. Since this systems doesn't have flock(), the values of the constants are probably not available. */ # ifndef LOCK_SH # define LOCK_SH 1 # endif @@ -25,11 +26,11 @@ int flock(int fd, int operation) { struct flock lock; - + switch (operation & ~LOCK_NB) { case LOCK_SH: lock.l_type = F_RDLCK; break; case LOCK_EX: @@ -42,11 +43,11 @@ errno = EINVAL; return -1; } lock.l_whence = SEEK_SET; lock.l_start = lock.l_len = 0L; - + return fcntl(fd, (operation & LOCK_NB) ? F_SETLK : F_SETLKW, &lock); } #elif defined(HAVE_LOCKF) @@ -70,10 +71,10 @@ # endif # ifndef F_TEST # define F_TEST 3 /* Test a region for other processes locks */ # endif -/* These are the flock() constants. Since this sytems doesn't have +/* These are the flock() constants. Since this systems doesn't have flock(), the values of the constants are probably not available. */ # ifndef LOCK_SH # define LOCK_SH 1 # endif