summaryrefslogtreecommitdiff
path: root/ext/Fcntl
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1999-08-06 11:59:11 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1999-08-06 11:59:11 +0000
commitac88732c4568487a2aa5fbad75ba393744f616ba (patch)
tree8c44694f4995889f7a081e602ea5fb2048612ea6 /ext/Fcntl
parent0638735429cd9f405fe3527971d0275cbbe212d8 (diff)
downloadperl-ac88732c4568487a2aa5fbad75ba393744f616ba.tar.gz
More Fcntl constants. (This process really needs
to be automated, at least partly, see the Errno extension.) Now also the SEEK_ constants are available via the Fcntl. Yes, this is redundant (IO::Seekable and POSIX supply them already), but now Fcntl is a one-stop shopping mall for all your file-related constants. p4raw-id: //depot/cfgperl@3929
Diffstat (limited to 'ext/Fcntl')
-rw-r--r--ext/Fcntl/Fcntl.pm27
-rw-r--r--ext/Fcntl/Fcntl.xs144
2 files changed, 169 insertions, 2 deletions
diff --git a/ext/Fcntl/Fcntl.pm b/ext/Fcntl/Fcntl.pm
index 0f70840075..699ee4a517 100644
--- a/ext/Fcntl/Fcntl.pm
+++ b/ext/Fcntl/Fcntl.pm
@@ -53,15 +53,28 @@ $VERSION = "1.03";
@EXPORT =
qw(
FD_CLOEXEC
+ F_ALLOCSP
+ F_ALLOCSP64
+ F_COMPAT
+ F_DUP2FD
F_DUPFD
F_EXLCK
+ F_FREESP
+ F_FREESP64
+ F_FSYNC
+ F_FSYNC64
F_GETFD
F_GETFL
F_GETLK
F_GETLK64
F_GETOWN
+ F_NODNY
F_POSIX
+ F_RDACC
+ F_RDDNY
F_RDLCK
+ F_RWACC
+ F_RWDNY
F_SETFD
F_SETFL
F_SETLK
@@ -69,8 +82,12 @@ $VERSION = "1.03";
F_SETLKW
F_SETLKW64
F_SETOWN
+ F_SHARE
F_SHLCK
F_UNLCK
+ F_UNSHARE
+ F_WRACC
+ F_WRDNY
F_WRLCK
O_ACCMODE
O_APPEND
@@ -93,6 +110,9 @@ $VERSION = "1.03";
O_TEXT
O_TRUNC
O_WRONLY
+ SEEK_SET
+ SEEK_CUR
+ SEEK_END
);
# Other items we are prepared to export if requested
@@ -101,9 +121,12 @@ $VERSION = "1.03";
FASYNC
FCREAT
FDEFER
+ FDSYNC
FEXCL
+ FLARGEFILE
FNDELAY
FNONBLOCK
+ FRSYNC
FSYNC
FTRUNC
LOCK_EX
@@ -114,8 +137,8 @@ $VERSION = "1.03";
# 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)],
+ 'Fcompat' => [qw(FAPPEND FASYNC FCREAT FDEFER FDSYNC FEXCL FLARGEFILE
+ FNDELAY FNONBLOCK FRSYNC FSYNC FTRUNC)],
);
sub AUTOLOAD {
diff --git a/ext/Fcntl/Fcntl.xs b/ext/Fcntl/Fcntl.xs
index bc16cc9645..0dab7f17e4 100644
--- a/ext/Fcntl/Fcntl.xs
+++ b/ext/Fcntl/Fcntl.xs
@@ -15,6 +15,10 @@
#endif
#endif
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+
/* This comment is a kludge to get metaconfig to see the symbols
VAL_O_NONBLOCK
VAL_EAGAIN
@@ -43,6 +47,30 @@ constant(char *name, int arg)
switch (*name) {
case 'F':
if (strnEQ(name, "F_", 2)) {
+ if (strEQ(name, "F_ALLOCSP"))
+#ifdef F_ALLOCSP
+ return F_ALLOCSP;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "F_ALLOCSP64"))
+#ifdef F_ALLOCSP64
+ return F_ALLOCSP64;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "F_COMPAT"))
+#ifdef F_COMPAT
+ return F_COMPAT;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "F_DUP2FD"))
+#ifdef F_DUP2FD
+ return F_DUP2FD;
+#else
+ goto not_there;
+#endif
if (strEQ(name, "F_DUPFD"))
#ifdef F_DUPFD
return F_DUPFD;
@@ -55,6 +83,30 @@ constant(char *name, int arg)
#else
goto not_there;
#endif
+ if (strEQ(name, "F_FREESP"))
+#ifdef F_FREESP
+ return F_FREESP;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "F_FREESP64"))
+#ifdef F_FREESP64
+ return F_FREESP64;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "F_FSYNC"))
+#ifdef F_FSYNC
+ return F_FSYNC;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "F_FSYNC64"))
+#ifdef F_FSYNC64
+ return F_FSYNC64;
+#else
+ goto not_there;
+#endif
if (strEQ(name, "F_GETFD"))
#ifdef F_GETFD
return F_GETFD;
@@ -85,18 +137,48 @@ constant(char *name, int arg)
#else
goto not_there;
#endif
+ if (strEQ(name, "F_NODNY"))
+#ifdef F_NODNY
+ return F_NODNY;
+#else
+ goto not_there;
+#endif
if (strEQ(name, "F_POSIX"))
#ifdef F_POSIX
return F_POSIX;
#else
goto not_there;
#endif
+ if (strEQ(name, "F_RDACC"))
+#ifdef F_RDACC
+ return F_RDACC;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "F_RDDNY"))
+#ifdef F_RDDNY
+ return F_RDDNY;
+#else
+ goto not_there;
+#endif
if (strEQ(name, "F_RDLCK"))
#ifdef F_RDLCK
return F_RDLCK;
#else
goto not_there;
#endif
+ if (strEQ(name, "F_RWACC"))
+#ifdef F_RWACC
+ return F_RWACC;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "F_RWDNY"))
+#ifdef F_RWDNY
+ return F_RWDNY;
+#else
+ goto not_there;
+#endif
if (strEQ(name, "F_SETFD"))
#ifdef F_SETFD
return F_SETFD;
@@ -139,6 +221,12 @@ constant(char *name, int arg)
#else
goto not_there;
#endif
+ if (strEQ(name, "F_SHARE"))
+#ifdef F_SHARE
+ return F_SHARE;
+#else
+ goto not_there;
+#endif
if (strEQ(name, "F_SHLCK"))
#ifdef F_SHLCK
return F_SHLCK;
@@ -151,6 +239,24 @@ constant(char *name, int arg)
#else
goto not_there;
#endif
+ if (strEQ(name, "F_UNSHARE"))
+#ifdef F_UNSHARE
+ return F_UNSHARE;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "F_WRACC"))
+#ifdef F_WRACC
+ return F_WRACC;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "F_WRDNY"))
+#ifdef F_WRDNY
+ return F_WRDNY;
+#else
+ goto not_there;
+#endif
if (strEQ(name, "F_WRLCK"))
#ifdef F_WRLCK
return F_WRLCK;
@@ -190,12 +296,24 @@ constant(char *name, int arg)
#else
goto not_there;
#endif
+ if (strEQ(name, "FDSYNC"))
+#ifdef FDSYNC
+ return FDSYNC;
+#else
+ goto not_there;
+#endif
if (strEQ(name, "FEXCL"))
#ifdef FEXCL
return FEXCL;
#else
goto not_there;
#endif
+ if (strEQ(name, "FLARGEFILE"))
+#ifdef FLARGEFILE
+ return FLARGEFILE;
+#else
+ goto not_there;
+#endif
if (strEQ(name, "FNDELAY"))
#ifdef FNDELAY
return FNDELAY;
@@ -208,6 +326,12 @@ constant(char *name, int arg)
#else
goto not_there;
#endif
+ if (strEQ(name, "FRSYNC"))
+#ifdef FRSYNC
+ return FRSYNC;
+#else
+ goto not_there;
+#endif
if (strEQ(name, "FSYNC"))
#ifdef FSYNC
return FSYNC;
@@ -383,6 +507,26 @@ constant(char *name, int arg)
} else
goto not_there;
break;
+ case 'S':
+ if (strEQ(name, "SEEK_CUR"))
+#ifdef SEEK_CUR
+ return SEEK_CUR;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "SEEK_END"))
+#ifdef SEEK_END
+ return SEEK_END;
+#else
+ goto not_there;
+#endif
+ if (strEQ(name, "SEEK_SET"))
+#ifdef SEEK_SET
+ return SEEK_SET;
+#else
+ goto not_there;
+#endif
+ break;
}
errno = EINVAL;
return 0;