From: Jarkko Hietaniemi Date: Tue, 23 Jun 1998 00:01:02 +0000 (+0300) Subject: applied patch, moved #define mkfifo ... from perl.h to POSIX.xs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6990d9917c06c8c6c480c9c385d7d2ed536c8d24;p=p5sagit%2Fp5-mst-13.2.git applied patch, moved #define mkfifo ... from perl.h to POSIX.xs Message-Id: <199806222101.AAA16456@alpha.hut.fi> Subject: [PATCH] _67: somebody said POSIX::mknod? p4raw-id: //depot/perl@1199 --- diff --git a/Configure b/Configure index 8dd8d9a..ffd7e08 100755 --- a/Configure +++ b/Configure @@ -376,6 +376,7 @@ d_memmove='' d_memset='' d_mkdir='' d_mkfifo='' +d_mknod='' d_mktime='' d_msg='' d_msgctl='' @@ -589,6 +590,7 @@ plibpth='' xlibpth='' libs='' lns='' +devtype='' lseektype='' make_set_make='' d_mymalloc='' @@ -7397,6 +7399,10 @@ eval $inlibc set mkfifo d_mkfifo eval $inlibc +: see if mknod exists +set mknod d_mknod +eval $inlibc + : see if mktime exists set mktime d_mktime eval $inlibc @@ -9474,6 +9480,11 @@ EOM *) groupstype="$gidtype";; esac +: see what type is used for devices +rp="What is the type used for device numbers on this system?" +set dev_t devtype long stdio.h sys/types.h +eval $typedef_ask + : see what type lseek is declared as in the kernel rp="What is the type used for lseek's offset on this system?" set off_t lseektype long stdio.h sys/types.h @@ -11312,6 +11323,7 @@ d_memmove='$d_memmove' d_memset='$d_memset' d_mkdir='$d_mkdir' d_mkfifo='$d_mkfifo' +d_mknod='$d_mknod' d_mktime='$d_mktime' d_msg='$d_msg' d_msgctl='$d_msgctl' @@ -11433,6 +11445,7 @@ date='$date' db_hashtype='$db_hashtype' db_prefixtype='$db_prefixtype' defvoidused='$defvoidused' +devtype='$devtype' direntrytype='$direntrytype' dlext='$dlext' dlsrc='$dlsrc' diff --git a/config_h.SH b/config_h.SH index aedfa6d..7818792 100644 --- a/config_h.SH +++ b/config_h.SH @@ -428,6 +428,14 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #$d_mkfifo HAS_MKFIFO /**/ +/* HAS_MKNOD: + * This symbol, if defined, indicates that the mknod routine is + * available to create character and block special files. Otherwise, + * mknod should be able to do it for you. However, if mknod is there, + * mknod might require super-user privileges which mknod will not. + */ +#$d_mknod HAS_MKNOD /**/ + /* HAS_MKTIME: * This symbol, if defined, indicates that the mktime routine is * available. @@ -2025,6 +2033,13 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #define Gid_t $gidtype /* Type for getgid(), etc... */ +/* Dev_t: + * This symbol holds the type used to declare device numbers. + * It can be int, long, dev_t, etc... It may be necessary to include + * to get any typedef'ed information. + */ +#define Dev_t $devtype /* type */ + /* Off_t: * This symbol holds the type used to declare offsets in the kernel. * It can be int, long, off_t, etc... It may be necessary to include diff --git a/ext/POSIX/POSIX.pm b/ext/POSIX/POSIX.pm index 32010d6..b95249c 100644 --- a/ext/POSIX/POSIX.pm +++ b/ext/POSIX/POSIX.pm @@ -115,7 +115,7 @@ $VERSION = "1.02" ; sys_stat_h => [qw(S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISGID S_ISREG S_ISUID S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR - fstat mkfifo)], + fstat mkfifo mknod)], sys_times_h => [qw()], diff --git a/ext/POSIX/POSIX.pod b/ext/POSIX/POSIX.pod index 4726487..91ef781 100644 --- a/ext/POSIX/POSIX.pod +++ b/ext/POSIX/POSIX.pod @@ -660,6 +660,12 @@ This is similar to the C function C. Returns C on failure. +=item mknod + +This is similar to the C function C. + +Returns C on failure. + =item mktime Convert date/time info to a calendar time. diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 41c6ba3..568fbee 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -35,6 +35,7 @@ #ifdef I_STDDEF #include #endif + /* XXX This comment is just to make I_TERMIO and I_SGTTY visible to metaconfig for future extension writers. We don't use them in POSIX. (This is really sneaky :-) --AD @@ -62,8 +63,9 @@ # define pid_t int /* old versions of DECC miss this in types.h */ # endif -# undef mkfifo /* #defined in perl.h */ +# undef mkfifo # define mkfifo(a,b) (not_here("mkfifo"),-1) +# define mknod(a,b,c) (not_here("mknod"),-1) # define tzset() not_here("tzset") #if ((__VMS_VER >= 70000000) && (__DECC_VER >= 50200000)) || (__CRTL_VER >= 70000000) @@ -103,8 +105,9 @@ # define times(t) vms_times(t) #else #if defined (WIN32) -# undef mkfifo /* #defined in perl.h */ +# undef mkfifo # define mkfifo(a,b) not_here("mkfifo") +# define mknod(a,b,c) not_here("mknod") # define ttyname(a) (char*)not_here("ttyname") # define sigset_t long # define pid_t long @@ -133,6 +136,13 @@ # define sigfillset(a) not_here("sigfillset") # define sigismember(a,b) not_here("sigismember") #else + +# ifndef HAS_MKFIFO +# ifndef mkfifo +# define mkfifo(path, mode) (mknod((path), (mode) | S_IFIFO, 0)) +# endif +# endif /* !HAS_MKFIFO */ + # include # include # ifdef HAS_UNAME @@ -3473,6 +3483,17 @@ mkfifo(filename, mode) RETVAL SysRet +mknod(filename, mode, device) + char * filename + Mode_t mode + Dev_t device + CODE: + TAINT_PROPER("mknod"); + RETVAL = mknod(filename, mode, device); + OUTPUT: + RETVAL + +SysRet tcdrain(fd) int fd diff --git a/perl.h b/perl.h index f6d24d7..fb527f6 100644 --- a/perl.h +++ b/perl.h @@ -563,12 +563,6 @@ Free_t Perl_free _((Malloc_t where)); # undef HAS_STRERROR #endif -#ifndef HAS_MKFIFO -# ifndef mkfifo -# define mkfifo(path, mode) (mknod((path), (mode) | S_IFIFO, 0)) -# endif -#endif /* !HAS_MKFIFO */ - #include #ifdef HAS_SOCKET # ifdef I_NET_ERRNO