diff options
-rw-r--r-- | ext/Fcntl/Fcntl.pm | 63 | ||||
-rw-r--r-- | ext/Fcntl/Fcntl.xs | 150 |
2 files changed, 141 insertions, 72 deletions
diff --git a/ext/Fcntl/Fcntl.pm b/ext/Fcntl/Fcntl.pm index ab19670af7..f1edb8ed79 100644 --- a/ext/Fcntl/Fcntl.pm +++ b/ext/Fcntl/Fcntl.pm @@ -52,27 +52,66 @@ $VERSION = "1.03"; # (move infrequently used names to @EXPORT_OK below) @EXPORT = qw( - F_DUPFD F_GETFD F_GETLK F_SETFD F_GETFL F_SETFL F_SETLK F_SETLKW - FD_CLOEXEC F_RDLCK F_UNLCK F_WRLCK F_POSIX - O_CREAT O_EXCL O_NOCTTY O_TRUNC - O_APPEND O_NONBLOCK - O_NDELAY O_DEFER - O_RDONLY O_RDWR O_WRONLY - O_BINARY O_TEXT - O_EXLOCK O_SHLOCK O_ASYNC O_DSYNC O_RSYNC O_SYNC - F_SETOWN F_GETOWN + FD_CLOEXEC + F_DUPFD + F_EXLCK + F_GETFD + F_GETFL + F_GETLK + F_GETOWN + F_POSIX + F_RDLCK + F_SETFD + F_SETFL + F_SETLK + F_SETLKW + F_SETOWN + F_SHLCK + F_UNLCK + F_WRLCK + O_ACCMODE + O_APPEND + O_ASYNC + O_BINARY + O_CREAT + O_DEFER + O_DSYNC + O_EXCL + O_EXLOCK + O_NDELAY + O_NOCTTY + O_NONBLOCK + O_RDONLY + O_RDWR + O_RSYNC + O_SHLOCK + O_SYNC + O_TEXT + O_TRUNC + O_WRONLY ); # Other items we are prepared to export if requested @EXPORT_OK = qw( - LOCK_SH LOCK_EX LOCK_NB LOCK_UN - FAPPEND FASYNC FCREAT FDEFER FEXCL FNDELAY FNONBLOCK FSYNC FTRUNC + FAPPEND + FASYNC + FCREAT + FDEFER + FEXCL + FNDELAY + FNONBLOCK + FSYNC + FTRUNC + LOCK_EX + LOCK_NB + LOCK_SH + LOCK_UN ); # Named groups of exports %EXPORT_TAGS = ( 'flock' => [qw(LOCK_SH LOCK_EX LOCK_NB LOCK_UN)], 'Fcompat' => [qw(FAPPEND FASYNC FCREAT FDEFER FEXCL - FNDELAY FNONBLOCK FSYNC FTRUNC)], + FNDELAY FNONBLOCK FSYNC FTRUNC)], ); sub AUTOLOAD { diff --git a/ext/Fcntl/Fcntl.xs b/ext/Fcntl/Fcntl.xs index 251f3f4176..18a175f1c6 100644 --- a/ext/Fcntl/Fcntl.xs +++ b/ext/Fcntl/Fcntl.xs @@ -42,12 +42,24 @@ constant(char *name, int arg) #else goto not_there; #endif + if (strEQ(name, "F_EXLCK")) +#ifdef F_EXLCK + return F_EXLCK; +#else + goto not_there; +#endif if (strEQ(name, "F_GETFD")) #ifdef F_GETFD return F_GETFD; #else goto not_there; #endif + if (strEQ(name, "F_GETFL")) +#ifdef F_GETFL + return F_GETFL; +#else + goto not_there; +#endif if (strEQ(name, "F_GETLK")) #ifdef F_GETLK return F_GETLK; @@ -60,21 +72,21 @@ constant(char *name, int arg) #else goto not_there; #endif - if (strEQ(name, "F_SETFD")) -#ifdef F_SETFD - return F_SETFD; + if (strEQ(name, "F_POSIX")) +#ifdef F_POSIX + return F_POSIX; #else goto not_there; #endif - if (strEQ(name, "F_GETFL")) -#ifdef F_GETFL - return F_GETFL; + if (strEQ(name, "F_RDLCK")) +#ifdef F_RDLCK + return F_RDLCK; #else goto not_there; #endif - if (strEQ(name, "F_POSIX")) -#ifdef F_POSIX - return F_POSIX; + if (strEQ(name, "F_SETFD")) +#ifdef F_SETFD + return F_SETFD; #else goto not_there; #endif @@ -102,9 +114,9 @@ constant(char *name, int arg) #else goto not_there; #endif - if (strEQ(name, "F_RDLCK")) -#ifdef F_RDLCK - return F_RDLCK; + if (strEQ(name, "F_SHLCK")) +#ifdef F_SHLCK + return F_SHLCK; #else goto not_there; #endif @@ -147,6 +159,12 @@ constant(char *name, int arg) #else goto not_there; #endif + if (strEQ(name, "FDEFER")) +#ifdef FDEFER + return FDEFER; +#else + goto not_there; +#endif if (strEQ(name, "FEXCL")) #ifdef FEXCL return FEXCL; @@ -211,33 +229,69 @@ constant(char *name, int arg) break; case 'O': if (strnEQ(name, "O_", 2)) { + if (strEQ(name, "O_ACCMODE")) +#ifdef O_ACCMODE + return O_ACCMODE; +#else + goto not_there; +#endif + if (strEQ(name, "O_APPEND")) +#ifdef O_APPEND + return O_APPEND; +#else + goto not_there; +#endif + if (strEQ(name, "O_ASYNC")) +#ifdef O_ASYNC + return O_ASYNC; +#else + goto not_there; +#endif + if (strEQ(name, "O_BINARY")) +#ifdef O_BINARY + return O_BINARY; +#else + goto not_there; +#endif if (strEQ(name, "O_CREAT")) #ifdef O_CREAT return O_CREAT; #else goto not_there; #endif + if (strEQ(name, "O_DEFER")) +#ifdef O_DEFER + return O_DEFER; +#else + goto not_there; +#endif + if (strEQ(name, "O_DSYNC")) +#ifdef O_DSYNC + return O_DSYNC; +#else + goto not_there; +#endif if (strEQ(name, "O_EXCL")) #ifdef O_EXCL return O_EXCL; #else goto not_there; #endif - if (strEQ(name, "O_NOCTTY")) -#ifdef O_NOCTTY - return O_NOCTTY; + if (strEQ(name, "O_EXLOCK")) +#ifdef O_EXLOCK + return O_EXLOCK; #else goto not_there; #endif - if (strEQ(name, "O_TRUNC")) -#ifdef O_TRUNC - return O_TRUNC; + if (strEQ(name, "O_NDELAY")) +#ifdef O_NDELAY + return O_NDELAY; #else goto not_there; #endif - if (strEQ(name, "O_APPEND")) -#ifdef O_APPEND - return O_APPEND; + if (strEQ(name, "O_NOCTTY")) +#ifdef O_NOCTTY + return O_NOCTTY; #else goto not_there; #endif @@ -247,12 +301,6 @@ constant(char *name, int arg) #else goto not_there; #endif - if (strEQ(name, "O_NDELAY")) -#ifdef O_NDELAY - return O_NDELAY; -#else - goto not_there; -#endif if (strEQ(name, "O_RDONLY")) #ifdef O_RDONLY return O_RDONLY; @@ -265,21 +313,9 @@ constant(char *name, int arg) #else goto not_there; #endif - if (strEQ(name, "O_WRONLY")) -#ifdef O_WRONLY - return O_WRONLY; -#else - goto not_there; -#endif - if (strEQ(name, "O_BINARY")) -#ifdef O_BINARY - return O_BINARY; -#else - goto not_there; -#endif - if (strEQ(name, "O_EXLOCK")) -#ifdef O_EXLOCK - return O_EXLOCK; + if (strEQ(name, "O_RSYNC")) +#ifdef O_RSYNC + return O_RSYNC; #else goto not_there; #endif @@ -289,33 +325,27 @@ constant(char *name, int arg) #else goto not_there; #endif - if (strEQ(name, "O_ASYNC")) -#ifdef O_ASYNC - return O_ASYNC; -#else - goto not_there; -#endif - if (strEQ(name, "O_DSYNC")) -#ifdef O_DSYNC - return O_DSYNC; + if (strEQ(name, "O_SYNC")) +#ifdef O_SYNC + return O_SYNC; #else goto not_there; #endif - if (strEQ(name, "O_RSYNC")) -#ifdef O_RSYNC - return O_RSYNC; + if (strEQ(name, "O_TEXT")) +#ifdef O_TEXT + return O_TEXT; #else goto not_there; #endif - if (strEQ(name, "O_SYNC")) -#ifdef O_SYNC - return O_SYNC; + if (strEQ(name, "O_TRUNC")) +#ifdef O_TRUNC + return O_TRUNC; #else goto not_there; #endif - if (strEQ(name, "O_DEFER")) -#ifdef O_DEFER - return O_DEFER; + if (strEQ(name, "O_WRONLY")) +#ifdef O_WRONLY + return O_WRONLY; #else goto not_there; #endif |