5 #define PERLIO_NOT_STDIO 1
9 #ifdef I_DIRENT /* XXX maybe better to just rely on perl.h? */
32 /* XXX This comment is just to make I_TERMIO and I_SGTTY visible to
33 metaconfig for future extension writers. We don't use them in POSIX.
34 (This is really sneaky :-) --AD
36 #if defined(I_TERMIOS)
44 #include <sys/types.h>
51 #if defined(__VMS) && !defined(__POSIX_SOURCE)
52 # include <libdef.h> /* LIB$_INVARG constant */
53 # include <lib$routines.h> /* prototype for lib$ediv() */
54 # include <starlet.h> /* prototype for sys$gettim() */
55 # if DECC_VERSION < 50000000
56 # define pid_t int /* old versions of DECC miss this in types.h */
59 # undef mkfifo /* #defined in perl.h */
60 # define mkfifo(a,b) (not_here("mkfifo"),-1)
61 # define tzset() not_here("tzset")
63 #if ((__VMS_VER >= 70000000) && (__DECC_VER >= 50200000)) || (__CRTL_VER >= 70000000)
64 # define HAS_TZNAME /* shows up in VMS 7.0 or Dec C 5.6 */
66 # endif /* __VMS_VER >= 70000000 or Dec C 5.6 */
68 /* The POSIX notion of ttyname() is better served by getname() under VMS */
69 static char ttnambuf[64];
70 # define ttyname(fd) (isatty(fd) > 0 ? getname(fd,ttnambuf,0) : NULL)
72 /* The non-POSIX CRTL times() has void return type, so we just get the
73 current time directly */
74 clock_t vms_times(struct tms *bufptr) {
76 /* Get wall time and convert to 10 ms intervals to
77 * produce the return value that the POSIX standard expects */
78 # if defined(__DECC) && defined (__ALPHA)
81 _ckvmssts(sys$gettim(&vmstime));
83 retval = vmstime & 0x7fffffff;
85 /* (Older hw or ccs don't have an atomic 64-bit type, so we
86 * juggle 32-bit ints (and a float) to produce a time_t result
87 * with minimal loss of information.) */
88 long int vmstime[2],remainder,divisor = 100000;
89 _ckvmssts(sys$gettim((unsigned long int *)vmstime));
90 vmstime[1] &= 0x7fff; /* prevent overflow in EDIV */
91 _ckvmssts(lib$ediv(&divisor,vmstime,(long int *)&retval,&remainder));
93 /* Fill in the struct tms using the CRTL routine . . .*/
94 times((tbuffer_t *)bufptr);
95 return (clock_t) retval;
97 # define times(t) vms_times(t)
100 # undef mkfifo /* #defined in perl.h */
101 # define mkfifo(a,b) not_here("mkfifo")
102 # define ttyname(a) not_here("ttyname")
103 # define sigset_t long
106 # define tzname _tzname
109 # define mode_t short
112 # define mode_t short
114 # define tzset() not_here("tzset")
116 # ifndef _POSIX_OPEN_MAX
117 # define _POSIX_OPEN_MAX FOPEN_MAX /* XXX bogus ? */
120 # define sigaction(a,b,c) not_here("sigaction")
121 # define sigpending(a) not_here("sigpending")
122 # define sigprocmask(a,b,c) not_here("sigprocmask")
123 # define sigsuspend(a) not_here("sigsuspend")
124 # define sigemptyset(a) not_here("sigemptyset")
125 # define sigaddset(a,b) not_here("sigaddset")
126 # define sigdelset(a,b) not_here("sigdelset")
127 # define sigfillset(a) not_here("sigfillset")
128 # define sigismember(a,b) not_here("sigismember")
131 # include <sys/times.h>
133 # include <sys/utsname.h>
135 # include <sys/wait.h>
143 typedef long SysRetLong;
144 typedef sigset_t* POSIX__SigSet;
145 typedef HV* POSIX__SigAction;
147 typedef struct termios* POSIX__Termios;
148 #else /* Define termios types to int, and call not_here for the functions.*/
149 #define POSIX__Termios int
153 #define cfgetispeed(x) not_here("cfgetispeed")
154 #define cfgetospeed(x) not_here("cfgetospeed")
155 #define tcdrain(x) not_here("tcdrain")
156 #define tcflush(x,y) not_here("tcflush")
157 #define tcsendbreak(x,y) not_here("tcsendbreak")
158 #define cfsetispeed(x,y) not_here("cfsetispeed")
159 #define cfsetospeed(x,y) not_here("cfsetospeed")
160 #define ctermid(x) (char *) not_here("ctermid")
161 #define tcflow(x,y) not_here("tcflow")
162 #define tcgetattr(x,y) not_here("tcgetattr")
163 #define tcsetattr(x,y,z) not_here("tcsetattr")
166 /* Possibly needed prototypes */
167 char *cuserid _((char *));
168 double strtod _((const char *, char **));
169 long strtol _((const char *, char **, int));
170 unsigned long strtoul _((const char *, char **, int));
173 #define cuserid(a) (char *) not_here("cuserid")
177 #define difftime(a,b) not_here("difftime")
180 #ifndef HAS_FPATHCONF
181 #define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
184 #define mktime(a) not_here("mktime")
187 #define nice(a) not_here("nice")
190 #define pathconf(f,n) (SysRetLong) not_here("pathconf")
193 #define sysconf(n) (SysRetLong) not_here("sysconf")
196 #define readlink(a,b,c) not_here("readlink")
199 #define setpgid(a,b) not_here("setpgid")
202 #define setsid() not_here("setsid")
205 #define strcoll(s1,s2) not_here("strcoll")
208 #define strtod(s1,s2) not_here("strtod")
211 #define strtol(s1,s2,b) not_here("strtol")
214 #define strtoul(s1,s2,b) not_here("strtoul")
217 #define strxfrm(s1,s2,n) not_here("strxfrm")
219 #ifndef HAS_TCGETPGRP
220 #define tcgetpgrp(a) not_here("tcgetpgrp")
222 #ifndef HAS_TCSETPGRP
223 #define tcsetpgrp(a,b) not_here("tcsetpgrp")
226 #define times(a) not_here("times")
229 #define uname(a) not_here("uname")
232 #define waitpid(a,b,c) not_here("waitpid")
237 #define mblen(a,b) not_here("mblen")
241 #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
244 #define mbtowc(pwc, s, n) not_here("mbtowc")
247 #define wcstombs(s, pwcs, n) not_here("wcstombs")
250 #define wctomb(s, wchar) not_here("wcstombs")
252 #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
253 /* If we don't have these functions, then we wouldn't have gotten a typedef
254 for wchar_t, the wide character type. Defining wchar_t allows the
255 functions referencing it to compile. Its actual type is then meaningless,
256 since without the above functions, all sections using it end up calling
257 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
263 #ifndef HAS_LOCALECONV
264 #define localeconv() not_here("localeconv")
269 extern char *tzname[];
272 char *tzname[] = { "" , "" };
275 /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX)
276 * fields for which we don't have Configure support yet:
277 * char *tm_zone; -- abbreviation of timezone name
278 * long tm_gmtoff; -- offset from GMT in seconds
279 * To workaround core dumps from the uninitialised tm_zone we get the
280 * system to give us a reasonable struct to copy. This fix means that
281 * strftime uses the tm_zone and tm_gmtoff values returned by
282 * localtime(time()). That should give the desired result most of the
283 * time. But probably not always!
285 * This is a temporary workaround to be removed once Configure
286 * support is added and NETaa14816 is considered in full.
287 * It does not address tzname aspects of NETaa14816.
290 # ifndef STRUCT_TM_HASZONE
291 # define STRUCT_TM_HAS_ZONE
295 #ifdef STRUCT_TM_HASZONE
297 init_tm(ptm) /* see mktime, strftime and asctime */
302 Copy(localtime(&now), ptm, 1, struct tm);
306 # define init_tm(ptm)
310 #ifdef HAS_LONG_DOUBLE
311 # if LONG_DOUBLESIZE > DOUBLESIZE
312 # undef HAS_LONG_DOUBLE /* XXX until we figure out how to use them */
316 #ifndef HAS_LONG_DOUBLE
331 croak("POSIX::%s not implemented on this architecture", s);
336 #ifdef HAS_LONG_DOUBLE
341 constant(char *name, int arg)
346 if (strEQ(name, "ARG_MAX"))
354 if (strEQ(name, "BUFSIZ"))
360 if (strEQ(name, "BRKINT"))
366 if (strEQ(name, "B9600"))
372 if (strEQ(name, "B19200"))
378 if (strEQ(name, "B38400"))
384 if (strEQ(name, "B0"))
390 if (strEQ(name, "B110"))
396 if (strEQ(name, "B1200"))
402 if (strEQ(name, "B134"))
408 if (strEQ(name, "B150"))
414 if (strEQ(name, "B1800"))
420 if (strEQ(name, "B200"))
426 if (strEQ(name, "B2400"))
432 if (strEQ(name, "B300"))
438 if (strEQ(name, "B4800"))
444 if (strEQ(name, "B50"))
450 if (strEQ(name, "B600"))
456 if (strEQ(name, "B75"))
464 if (strEQ(name, "CHAR_BIT"))
470 if (strEQ(name, "CHAR_MAX"))
476 if (strEQ(name, "CHAR_MIN"))
482 if (strEQ(name, "CHILD_MAX"))
488 if (strEQ(name, "CLK_TCK"))
494 if (strEQ(name, "CLOCAL"))
500 if (strEQ(name, "CLOCKS_PER_SEC"))
501 #ifdef CLOCKS_PER_SEC
502 return CLOCKS_PER_SEC;
506 if (strEQ(name, "CREAD"))
512 if (strEQ(name, "CS5"))
518 if (strEQ(name, "CS6"))
524 if (strEQ(name, "CS7"))
530 if (strEQ(name, "CS8"))
536 if (strEQ(name, "CSIZE"))
542 if (strEQ(name, "CSTOPB"))
550 if (strEQ(name, "DBL_MAX"))
556 if (strEQ(name, "DBL_MIN"))
562 if (strEQ(name, "DBL_DIG"))
568 if (strEQ(name, "DBL_EPSILON"))
574 if (strEQ(name, "DBL_MANT_DIG"))
580 if (strEQ(name, "DBL_MAX_10_EXP"))
581 #ifdef DBL_MAX_10_EXP
582 return DBL_MAX_10_EXP;
586 if (strEQ(name, "DBL_MAX_EXP"))
592 if (strEQ(name, "DBL_MIN_10_EXP"))
593 #ifdef DBL_MIN_10_EXP
594 return DBL_MIN_10_EXP;
598 if (strEQ(name, "DBL_MIN_EXP"))
608 if (strEQ(name, "EACCES"))
614 if (strEQ(name, "EADDRINUSE"))
620 if (strEQ(name, "EADDRNOTAVAIL"))
622 return EADDRNOTAVAIL;
626 if (strEQ(name, "EAFNOSUPPORT"))
632 if (strEQ(name, "EAGAIN"))
638 if (strEQ(name, "EALREADY"))
646 if (strEQ(name, "EBADF"))
652 if (strEQ(name, "EBUSY"))
660 if (strEQ(name, "ECHILD"))
666 if (strEQ(name, "ECHO"))
672 if (strEQ(name, "ECHOE"))
678 if (strEQ(name, "ECHOK"))
684 if (strEQ(name, "ECHONL"))
690 if (strEQ(name, "ECONNABORTED"))
696 if (strEQ(name, "ECONNREFUSED"))
702 if (strEQ(name, "ECONNRESET"))
710 if (strEQ(name, "EDEADLK"))
716 if (strEQ(name, "EDESTADDRREQ"))
722 if (strEQ(name, "EDOM"))
728 if (strEQ(name, "EDQUOT"))
736 if (strEQ(name, "EEXIST"))
744 if (strEQ(name, "EFAULT"))
750 if (strEQ(name, "EFBIG"))
758 if (strEQ(name, "EHOSTDOWN"))
764 if (strEQ(name, "EHOSTUNREACH"))
772 if (strEQ(name, "EINPROGRESS"))
778 if (strEQ(name, "EINTR"))
784 if (strEQ(name, "EINVAL"))
790 if (strEQ(name, "EIO"))
796 if (strEQ(name, "EISCONN"))
802 if (strEQ(name, "EISDIR"))
808 if (strEQ(name, "ELOOP"))
816 if (strEQ(name, "EMFILE"))
822 if (strEQ(name, "EMLINK"))
828 if (strEQ(name, "EMSGSIZE"))
836 if (strEQ(name, "ENETDOWN"))
842 if (strEQ(name, "ENETRESET"))
848 if (strEQ(name, "ENETUNREACH"))
854 if (strEQ(name, "ENOBUFS"))
860 if (strEQ(name, "ENOEXEC"))
866 if (strEQ(name, "ENOMEM"))
872 if (strEQ(name, "ENOPROTOOPT"))
878 if (strEQ(name, "ENOSPC"))
884 if (strEQ(name, "ENOTBLK"))
890 if (strEQ(name, "ENOTCONN"))
896 if (strEQ(name, "ENOTDIR"))
902 if (strEQ(name, "ENOTEMPTY"))
908 if (strEQ(name, "ENOTSOCK"))
914 if (strEQ(name, "ENOTTY"))
920 if (strEQ(name, "ENFILE"))
926 if (strEQ(name, "ENODEV"))
932 if (strEQ(name, "ENOENT"))
938 if (strEQ(name, "ENOLCK"))
944 if (strEQ(name, "ENOSYS"))
950 if (strEQ(name, "ENXIO"))
956 if (strEQ(name, "ENAMETOOLONG"))
964 if (strEQ(name, "EOF"))
970 if (strEQ(name, "EOPNOTSUPP"))
978 if (strEQ(name, "EPERM"))
984 if (strEQ(name, "EPFNOSUPPORT"))
990 if (strEQ(name, "EPIPE"))
996 if (strEQ(name, "EPROCLIM"))
1002 if (strEQ(name, "EPROTONOSUPPORT"))
1003 #ifdef EPROTONOSUPPORT
1004 return EPROTONOSUPPORT;
1008 if (strEQ(name, "EPROTOTYPE"))
1016 if (strEQ(name, "ERANGE"))
1022 if (strEQ(name, "EREMOTE"))
1028 if (strEQ(name, "ERESTART"))
1034 if (strEQ(name, "EROFS"))
1042 if (strEQ(name, "ESHUTDOWN"))
1048 if (strEQ(name, "ESOCKTNOSUPPORT"))
1049 #ifdef ESOCKTNOSUPPORT
1050 return ESOCKTNOSUPPORT;
1054 if (strEQ(name, "ESPIPE"))
1060 if (strEQ(name, "ESRCH"))
1066 if (strEQ(name, "ESTALE"))
1074 if (strEQ(name, "ETIMEDOUT"))
1080 if (strEQ(name, "ETOOMANYREFS"))
1082 return ETOOMANYREFS;
1086 if (strEQ(name, "ETXTBSY"))
1094 if (strEQ(name, "EUSERS"))
1102 if (strEQ(name, "EWOULDBLOCK"))
1110 if (strEQ(name, "EXIT_FAILURE"))
1112 return EXIT_FAILURE;
1116 if (strEQ(name, "EXIT_SUCCESS"))
1118 return EXIT_SUCCESS;
1122 if (strEQ(name, "EXDEV"))
1130 if (strEQ(name, "E2BIG"))
1138 if (strnEQ(name, "FLT_", 4)) {
1139 if (strEQ(name, "FLT_MAX"))
1145 if (strEQ(name, "FLT_MIN"))
1151 if (strEQ(name, "FLT_ROUNDS"))
1157 if (strEQ(name, "FLT_DIG"))
1163 if (strEQ(name, "FLT_EPSILON"))
1169 if (strEQ(name, "FLT_MANT_DIG"))
1171 return FLT_MANT_DIG;
1175 if (strEQ(name, "FLT_MAX_10_EXP"))
1176 #ifdef FLT_MAX_10_EXP
1177 return FLT_MAX_10_EXP;
1181 if (strEQ(name, "FLT_MAX_EXP"))
1187 if (strEQ(name, "FLT_MIN_10_EXP"))
1188 #ifdef FLT_MIN_10_EXP
1189 return FLT_MIN_10_EXP;
1193 if (strEQ(name, "FLT_MIN_EXP"))
1199 if (strEQ(name, "FLT_RADIX"))
1207 if (strnEQ(name, "F_", 2)) {
1208 if (strEQ(name, "F_DUPFD"))
1214 if (strEQ(name, "F_GETFD"))
1220 if (strEQ(name, "F_GETFL"))
1226 if (strEQ(name, "F_GETLK"))
1232 if (strEQ(name, "F_OK"))
1238 if (strEQ(name, "F_RDLCK"))
1244 if (strEQ(name, "F_SETFD"))
1250 if (strEQ(name, "F_SETFL"))
1256 if (strEQ(name, "F_SETLK"))
1262 if (strEQ(name, "F_SETLKW"))
1268 if (strEQ(name, "F_UNLCK"))
1274 if (strEQ(name, "F_WRLCK"))
1282 if (strEQ(name, "FD_CLOEXEC"))
1288 if (strEQ(name, "FILENAME_MAX"))
1290 return FILENAME_MAX;
1296 if (strEQ(name, "HUGE_VAL"))
1302 if (strEQ(name, "HUPCL"))
1310 if (strEQ(name, "INT_MAX"))
1316 if (strEQ(name, "INT_MIN"))
1322 if (strEQ(name, "ICANON"))
1328 if (strEQ(name, "ICRNL"))
1334 if (strEQ(name, "IEXTEN"))
1340 if (strEQ(name, "IGNBRK"))
1346 if (strEQ(name, "IGNCR"))
1352 if (strEQ(name, "IGNPAR"))
1358 if (strEQ(name, "INLCR"))
1364 if (strEQ(name, "INPCK"))
1370 if (strEQ(name, "ISIG"))
1376 if (strEQ(name, "ISTRIP"))
1382 if (strEQ(name, "IXOFF"))
1388 if (strEQ(name, "IXON"))
1396 if (strnEQ(name, "LC_", 3)) {
1397 if (strEQ(name, "LC_ALL"))
1403 if (strEQ(name, "LC_COLLATE"))
1409 if (strEQ(name, "LC_CTYPE"))
1415 if (strEQ(name, "LC_MONETARY"))
1421 if (strEQ(name, "LC_NUMERIC"))
1427 if (strEQ(name, "LC_TIME"))
1435 if (strnEQ(name, "LDBL_", 5)) {
1436 if (strEQ(name, "LDBL_MAX"))
1442 if (strEQ(name, "LDBL_MIN"))
1448 if (strEQ(name, "LDBL_DIG"))
1454 if (strEQ(name, "LDBL_EPSILON"))
1456 return LDBL_EPSILON;
1460 if (strEQ(name, "LDBL_MANT_DIG"))
1461 #ifdef LDBL_MANT_DIG
1462 return LDBL_MANT_DIG;
1466 if (strEQ(name, "LDBL_MAX_10_EXP"))
1467 #ifdef LDBL_MAX_10_EXP
1468 return LDBL_MAX_10_EXP;
1472 if (strEQ(name, "LDBL_MAX_EXP"))
1474 return LDBL_MAX_EXP;
1478 if (strEQ(name, "LDBL_MIN_10_EXP"))
1479 #ifdef LDBL_MIN_10_EXP
1480 return LDBL_MIN_10_EXP;
1484 if (strEQ(name, "LDBL_MIN_EXP"))
1486 return LDBL_MIN_EXP;
1492 if (strnEQ(name, "L_", 2)) {
1493 if (strEQ(name, "L_ctermid"))
1499 if (strEQ(name, "L_cuserid"))
1505 if (strEQ(name, "L_tmpname"))
1513 if (strEQ(name, "LONG_MAX"))
1519 if (strEQ(name, "LONG_MIN"))
1525 if (strEQ(name, "LINK_MAX"))
1533 if (strEQ(name, "MAX_CANON"))
1539 if (strEQ(name, "MAX_INPUT"))
1545 if (strEQ(name, "MB_CUR_MAX"))
1551 if (strEQ(name, "MB_LEN_MAX"))
1559 if (strEQ(name, "NULL")) return 0;
1560 if (strEQ(name, "NAME_MAX"))
1566 if (strEQ(name, "NCCS"))
1572 if (strEQ(name, "NGROUPS_MAX"))
1578 if (strEQ(name, "NOFLSH"))
1586 if (strnEQ(name, "O_", 2)) {
1587 if (strEQ(name, "O_APPEND"))
1593 if (strEQ(name, "O_CREAT"))
1599 if (strEQ(name, "O_TRUNC"))
1605 if (strEQ(name, "O_RDONLY"))
1611 if (strEQ(name, "O_RDWR"))
1617 if (strEQ(name, "O_WRONLY"))
1623 if (strEQ(name, "O_EXCL"))
1629 if (strEQ(name, "O_NOCTTY"))
1635 if (strEQ(name, "O_NONBLOCK"))
1641 if (strEQ(name, "O_ACCMODE"))
1649 if (strEQ(name, "OPEN_MAX"))
1655 if (strEQ(name, "OPOST"))
1663 if (strEQ(name, "PATH_MAX"))
1669 if (strEQ(name, "PARENB"))
1675 if (strEQ(name, "PARMRK"))
1681 if (strEQ(name, "PARODD"))
1687 if (strEQ(name, "PIPE_BUF"))
1695 if (strEQ(name, "RAND_MAX"))
1701 if (strEQ(name, "R_OK"))
1709 if (strnEQ(name, "SIG", 3)) {
1710 if (name[3] == '_') {
1711 if (strEQ(name, "SIG_BLOCK"))
1718 if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
1721 if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
1724 if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
1726 if (strEQ(name, "SIG_SETMASK"))
1732 if (strEQ(name, "SIG_UNBLOCK"))
1740 if (strEQ(name, "SIGABRT"))
1746 if (strEQ(name, "SIGALRM"))
1752 if (strEQ(name, "SIGCHLD"))
1758 if (strEQ(name, "SIGCONT"))
1764 if (strEQ(name, "SIGFPE"))
1770 if (strEQ(name, "SIGHUP"))
1776 if (strEQ(name, "SIGILL"))
1782 if (strEQ(name, "SIGINT"))
1788 if (strEQ(name, "SIGKILL"))
1794 if (strEQ(name, "SIGPIPE"))
1800 if (strEQ(name, "SIGQUIT"))
1806 if (strEQ(name, "SIGSEGV"))
1812 if (strEQ(name, "SIGSTOP"))
1818 if (strEQ(name, "SIGTERM"))
1824 if (strEQ(name, "SIGTSTP"))
1830 if (strEQ(name, "SIGTTIN"))
1836 if (strEQ(name, "SIGTTOU"))
1842 if (strEQ(name, "SIGUSR1"))
1848 if (strEQ(name, "SIGUSR2"))
1856 if (name[1] == '_') {
1857 if (strEQ(name, "S_ISGID"))
1863 if (strEQ(name, "S_ISUID"))
1869 if (strEQ(name, "S_IRGRP"))
1875 if (strEQ(name, "S_IROTH"))
1881 if (strEQ(name, "S_IRUSR"))
1887 if (strEQ(name, "S_IRWXG"))
1893 if (strEQ(name, "S_IRWXO"))
1899 if (strEQ(name, "S_IRWXU"))
1905 if (strEQ(name, "S_IWGRP"))
1911 if (strEQ(name, "S_IWOTH"))
1917 if (strEQ(name, "S_IWUSR"))
1923 if (strEQ(name, "S_IXGRP"))
1929 if (strEQ(name, "S_IXOTH"))
1935 if (strEQ(name, "S_IXUSR"))
1941 errno = EAGAIN; /* the following aren't constants */
1943 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1946 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1949 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1952 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1955 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1959 if (strEQ(name, "SEEK_CUR"))
1965 if (strEQ(name, "SEEK_END"))
1971 if (strEQ(name, "SEEK_SET"))
1977 if (strEQ(name, "STREAM_MAX"))
1983 if (strEQ(name, "SHRT_MAX"))
1989 if (strEQ(name, "SHRT_MIN"))
1995 if (strnEQ(name, "SA_", 3)) {
1996 if (strEQ(name, "SA_NOCLDSTOP"))
1998 return SA_NOCLDSTOP;
2002 if (strEQ(name, "SA_NOCLDWAIT"))
2004 return SA_NOCLDWAIT;
2008 if (strEQ(name, "SA_NODEFER"))
2014 if (strEQ(name, "SA_ONSTACK"))
2020 if (strEQ(name, "SA_RESETHAND"))
2022 return SA_RESETHAND;
2026 if (strEQ(name, "SA_RESTART"))
2032 if (strEQ(name, "SA_SIGINFO"))
2040 if (strEQ(name, "SCHAR_MAX"))
2046 if (strEQ(name, "SCHAR_MIN"))
2052 if (strEQ(name, "SSIZE_MAX"))
2058 if (strEQ(name, "STDIN_FILENO"))
2060 return STDIN_FILENO;
2064 if (strEQ(name, "STDOUT_FILENO"))
2065 #ifdef STDOUT_FILENO
2066 return STDOUT_FILENO;
2070 if (strEQ(name, "STRERR_FILENO"))
2071 #ifdef STRERR_FILENO
2072 return STRERR_FILENO;
2078 if (strEQ(name, "TCIFLUSH"))
2084 if (strEQ(name, "TCIOFF"))
2090 if (strEQ(name, "TCIOFLUSH"))
2096 if (strEQ(name, "TCION"))
2102 if (strEQ(name, "TCOFLUSH"))
2108 if (strEQ(name, "TCOOFF"))
2114 if (strEQ(name, "TCOON"))
2120 if (strEQ(name, "TCSADRAIN"))
2126 if (strEQ(name, "TCSAFLUSH"))
2132 if (strEQ(name, "TCSANOW"))
2138 if (strEQ(name, "TMP_MAX"))
2144 if (strEQ(name, "TOSTOP"))
2150 if (strEQ(name, "TZNAME_MAX"))
2158 if (strEQ(name, "UCHAR_MAX"))
2164 if (strEQ(name, "UINT_MAX"))
2170 if (strEQ(name, "ULONG_MAX"))
2176 if (strEQ(name, "USHRT_MAX"))
2184 if (strEQ(name, "VEOF"))
2190 if (strEQ(name, "VEOL"))
2196 if (strEQ(name, "VERASE"))
2202 if (strEQ(name, "VINTR"))
2208 if (strEQ(name, "VKILL"))
2214 if (strEQ(name, "VMIN"))
2220 if (strEQ(name, "VQUIT"))
2226 if (strEQ(name, "VSTART"))
2232 if (strEQ(name, "VSTOP"))
2238 if (strEQ(name, "VSUSP"))
2244 if (strEQ(name, "VTIME"))
2252 if (strEQ(name, "W_OK"))
2258 if (strEQ(name, "WNOHANG"))
2264 if (strEQ(name, "WUNTRACED"))
2270 errno = EAGAIN; /* the following aren't constants */
2272 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2275 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2278 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2281 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2284 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2287 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2291 if (strEQ(name, "X_OK"))
2299 if (strnEQ(name, "_PC_", 4)) {
2300 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2301 #if defined(_PC_CHOWN_RESTRICTED) || HINT_SC_EXIST
2302 return _PC_CHOWN_RESTRICTED;
2306 if (strEQ(name, "_PC_LINK_MAX"))
2307 #if defined(_PC_LINK_MAX) || HINT_SC_EXIST
2308 return _PC_LINK_MAX;
2312 if (strEQ(name, "_PC_MAX_CANON"))
2313 #if defined(_PC_MAX_CANON) || HINT_SC_EXIST
2314 return _PC_MAX_CANON;
2318 if (strEQ(name, "_PC_MAX_INPUT"))
2319 #if defined(_PC_MAX_INPUT) || HINT_SC_EXIST
2320 return _PC_MAX_INPUT;
2324 if (strEQ(name, "_PC_NAME_MAX"))
2325 #if defined(_PC_NAME_MAX) || HINT_SC_EXIST
2326 return _PC_NAME_MAX;
2330 if (strEQ(name, "_PC_NO_TRUNC"))
2331 #if defined(_PC_NO_TRUNC) || HINT_SC_EXIST
2332 return _PC_NO_TRUNC;
2336 if (strEQ(name, "_PC_PATH_MAX"))
2337 #if defined(_PC_PATH_MAX) || HINT_SC_EXIST
2338 return _PC_PATH_MAX;
2342 if (strEQ(name, "_PC_PIPE_BUF"))
2343 #if defined(_PC_PIPE_BUF) || HINT_SC_EXIST
2344 return _PC_PIPE_BUF;
2348 if (strEQ(name, "_PC_VDISABLE"))
2349 #if defined(_PC_VDISABLE) || HINT_SC_EXIST
2350 return _PC_VDISABLE;
2356 if (strnEQ(name, "_POSIX_", 7)) {
2357 if (strEQ(name, "_POSIX_ARG_MAX"))
2358 #ifdef _POSIX_ARG_MAX
2359 return _POSIX_ARG_MAX;
2363 if (strEQ(name, "_POSIX_CHILD_MAX"))
2364 #ifdef _POSIX_CHILD_MAX
2365 return _POSIX_CHILD_MAX;
2369 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2370 #ifdef _POSIX_CHOWN_RESTRICTED
2371 return _POSIX_CHOWN_RESTRICTED;
2375 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2376 #ifdef _POSIX_JOB_CONTROL
2377 return _POSIX_JOB_CONTROL;
2381 if (strEQ(name, "_POSIX_LINK_MAX"))
2382 #ifdef _POSIX_LINK_MAX
2383 return _POSIX_LINK_MAX;
2387 if (strEQ(name, "_POSIX_MAX_CANON"))
2388 #ifdef _POSIX_MAX_CANON
2389 return _POSIX_MAX_CANON;
2393 if (strEQ(name, "_POSIX_MAX_INPUT"))
2394 #ifdef _POSIX_MAX_INPUT
2395 return _POSIX_MAX_INPUT;
2399 if (strEQ(name, "_POSIX_NAME_MAX"))
2400 #ifdef _POSIX_NAME_MAX
2401 return _POSIX_NAME_MAX;
2405 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2406 #ifdef _POSIX_NGROUPS_MAX
2407 return _POSIX_NGROUPS_MAX;
2411 if (strEQ(name, "_POSIX_NO_TRUNC"))
2412 #ifdef _POSIX_NO_TRUNC
2413 return _POSIX_NO_TRUNC;
2417 if (strEQ(name, "_POSIX_OPEN_MAX"))
2418 #ifdef _POSIX_OPEN_MAX
2419 return _POSIX_OPEN_MAX;
2423 if (strEQ(name, "_POSIX_PATH_MAX"))
2424 #ifdef _POSIX_PATH_MAX
2425 return _POSIX_PATH_MAX;
2429 if (strEQ(name, "_POSIX_PIPE_BUF"))
2430 #ifdef _POSIX_PIPE_BUF
2431 return _POSIX_PIPE_BUF;
2435 if (strEQ(name, "_POSIX_SAVED_IDS"))
2436 #ifdef _POSIX_SAVED_IDS
2437 return _POSIX_SAVED_IDS;
2441 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2442 #ifdef _POSIX_SSIZE_MAX
2443 return _POSIX_SSIZE_MAX;
2447 if (strEQ(name, "_POSIX_STREAM_MAX"))
2448 #ifdef _POSIX_STREAM_MAX
2449 return _POSIX_STREAM_MAX;
2453 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2454 #ifdef _POSIX_TZNAME_MAX
2455 return _POSIX_TZNAME_MAX;
2459 if (strEQ(name, "_POSIX_VDISABLE"))
2460 #ifdef _POSIX_VDISABLE
2461 return _POSIX_VDISABLE;
2465 if (strEQ(name, "_POSIX_VERSION"))
2466 #ifdef _POSIX_VERSION
2467 return _POSIX_VERSION;
2473 if (strnEQ(name, "_SC_", 4)) {
2474 if (strEQ(name, "_SC_ARG_MAX"))
2475 #if defined(_SC_ARG_MAX) || HINT_SC_EXIST
2480 if (strEQ(name, "_SC_CHILD_MAX"))
2481 #if defined(_SC_CHILD_MAX) || HINT_SC_EXIST
2482 return _SC_CHILD_MAX;
2486 if (strEQ(name, "_SC_CLK_TCK"))
2487 #if defined(_SC_CLK_TCK) || HINT_SC_EXIST
2492 if (strEQ(name, "_SC_JOB_CONTROL"))
2493 #if defined(_SC_JOB_CONTROL) || HINT_SC_EXIST
2494 return _SC_JOB_CONTROL;
2498 if (strEQ(name, "_SC_NGROUPS_MAX"))
2499 #if defined(_SC_NGROUPS_MAX) || HINT_SC_EXIST
2500 return _SC_NGROUPS_MAX;
2504 if (strEQ(name, "_SC_OPEN_MAX"))
2505 #if defined(_SC_OPEN_MAX) || HINT_SC_EXIST
2506 return _SC_OPEN_MAX;
2510 if (strEQ(name, "_SC_SAVED_IDS"))
2511 #if defined(_SC_SAVED_IDS) || HINT_SC_EXIST
2512 return _SC_SAVED_IDS;
2516 if (strEQ(name, "_SC_STREAM_MAX"))
2517 #if defined(_SC_STREAM_MAX) || HINT_SC_EXIST
2518 return _SC_STREAM_MAX;
2522 if (strEQ(name, "_SC_TZNAME_MAX"))
2523 #if defined(_SC_TZNAME_MAX) || HINT_SC_EXIST
2524 return _SC_TZNAME_MAX;
2528 if (strEQ(name, "_SC_VERSION"))
2529 #if defined(_SC_VERSION) || HINT_SC_EXIST
2545 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2548 new(packname = "POSIX::SigSet", ...)
2553 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2554 sigemptyset(RETVAL);
2555 for (i = 1; i < items; i++)
2556 sigaddset(RETVAL, SvIV(ST(i)));
2563 POSIX::SigSet sigset
2565 safefree((char *)sigset);
2568 sigaddset(sigset, sig)
2569 POSIX::SigSet sigset
2573 sigdelset(sigset, sig)
2574 POSIX::SigSet sigset
2579 POSIX::SigSet sigset
2583 POSIX::SigSet sigset
2586 sigismember(sigset, sig)
2587 POSIX::SigSet sigset
2591 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2594 new(packname = "POSIX::Termios", ...)
2599 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2601 not_here("termios");
2609 DESTROY(termios_ref)
2610 POSIX::Termios termios_ref
2613 safefree((char *)termios_ref);
2615 not_here("termios");
2619 getattr(termios_ref, fd = 0)
2620 POSIX::Termios termios_ref
2623 RETVAL = tcgetattr(fd, termios_ref);
2628 setattr(termios_ref, fd = 0, optional_actions = 0)
2629 POSIX::Termios termios_ref
2631 int optional_actions
2633 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2638 cfgetispeed(termios_ref)
2639 POSIX::Termios termios_ref
2642 cfgetospeed(termios_ref)
2643 POSIX::Termios termios_ref
2646 getiflag(termios_ref)
2647 POSIX::Termios termios_ref
2649 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2650 RETVAL = termios_ref->c_iflag;
2652 not_here("getiflag");
2659 getoflag(termios_ref)
2660 POSIX::Termios termios_ref
2662 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2663 RETVAL = termios_ref->c_oflag;
2665 not_here("getoflag");
2672 getcflag(termios_ref)
2673 POSIX::Termios termios_ref
2675 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2676 RETVAL = termios_ref->c_cflag;
2678 not_here("getcflag");
2685 getlflag(termios_ref)
2686 POSIX::Termios termios_ref
2688 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2689 RETVAL = termios_ref->c_lflag;
2691 not_here("getlflag");
2698 getcc(termios_ref, ccix)
2699 POSIX::Termios termios_ref
2702 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2704 croak("Bad getcc subscript");
2705 RETVAL = termios_ref->c_cc[ccix];
2714 cfsetispeed(termios_ref, speed)
2715 POSIX::Termios termios_ref
2719 cfsetospeed(termios_ref, speed)
2720 POSIX::Termios termios_ref
2724 setiflag(termios_ref, iflag)
2725 POSIX::Termios termios_ref
2728 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2729 termios_ref->c_iflag = iflag;
2731 not_here("setiflag");
2735 setoflag(termios_ref, oflag)
2736 POSIX::Termios termios_ref
2739 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2740 termios_ref->c_oflag = oflag;
2742 not_here("setoflag");
2746 setcflag(termios_ref, cflag)
2747 POSIX::Termios termios_ref
2750 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2751 termios_ref->c_cflag = cflag;
2753 not_here("setcflag");
2757 setlflag(termios_ref, lflag)
2758 POSIX::Termios termios_ref
2761 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2762 termios_ref->c_lflag = lflag;
2764 not_here("setlflag");
2768 setcc(termios_ref, ccix, cc)
2769 POSIX::Termios termios_ref
2773 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2775 croak("Bad setcc subscript");
2776 termios_ref->c_cc[ccix] = cc;
2782 MODULE = POSIX PACKAGE = POSIX
2791 unsigned char * charstring
2793 unsigned char *s = charstring;
2794 unsigned char *e = s + na; /* "na" set by typemap side effect */
2795 for (RETVAL = 1; RETVAL && s < e; s++)
2803 unsigned char * charstring
2805 unsigned char *s = charstring;
2806 unsigned char *e = s + na; /* "na" set by typemap side effect */
2807 for (RETVAL = 1; RETVAL && s < e; s++)
2815 unsigned char * charstring
2817 unsigned char *s = charstring;
2818 unsigned char *e = s + na; /* "na" set by typemap side effect */
2819 for (RETVAL = 1; RETVAL && s < e; s++)
2827 unsigned char * charstring
2829 unsigned char *s = charstring;
2830 unsigned char *e = s + na; /* "na" set by typemap side effect */
2831 for (RETVAL = 1; RETVAL && s < e; s++)
2839 unsigned char * charstring
2841 unsigned char *s = charstring;
2842 unsigned char *e = s + na; /* "na" set by typemap side effect */
2843 for (RETVAL = 1; RETVAL && s < e; s++)
2851 unsigned char * charstring
2853 unsigned char *s = charstring;
2854 unsigned char *e = s + na; /* "na" set by typemap side effect */
2855 for (RETVAL = 1; RETVAL && s < e; s++)
2863 unsigned char * charstring
2865 unsigned char *s = charstring;
2866 unsigned char *e = s + na; /* "na" set by typemap side effect */
2867 for (RETVAL = 1; RETVAL && s < e; s++)
2875 unsigned char * charstring
2877 unsigned char *s = charstring;
2878 unsigned char *e = s + na; /* "na" set by typemap side effect */
2879 for (RETVAL = 1; RETVAL && s < e; s++)
2887 unsigned char * charstring
2889 unsigned char *s = charstring;
2890 unsigned char *e = s + na; /* "na" set by typemap side effect */
2891 for (RETVAL = 1; RETVAL && s < e; s++)
2899 unsigned char * charstring
2901 unsigned char *s = charstring;
2902 unsigned char *e = s + na; /* "na" set by typemap side effect */
2903 for (RETVAL = 1; RETVAL && s < e; s++)
2910 isxdigit(charstring)
2911 unsigned char * charstring
2913 unsigned char *s = charstring;
2914 unsigned char *e = s + na; /* "na" set by typemap side effect */
2915 for (RETVAL = 1; RETVAL && s < e; s++)
2922 open(filename, flags = O_RDONLY, mode = 0666)
2927 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2928 TAINT_PROPER("open");
2929 RETVAL = open(filename, flags, mode);
2937 #ifdef HAS_LOCALECONV
2938 struct lconv *lcbuf;
2940 SET_NUMERIC_LOCAL();
2941 if (lcbuf = localeconv()) {
2943 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2944 hv_store(RETVAL, "decimal_point", 13,
2945 newSVpv(lcbuf->decimal_point, 0), 0);
2946 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2947 hv_store(RETVAL, "thousands_sep", 13,
2948 newSVpv(lcbuf->thousands_sep, 0), 0);
2949 if (lcbuf->grouping && *lcbuf->grouping)
2950 hv_store(RETVAL, "grouping", 8,
2951 newSVpv(lcbuf->grouping, 0), 0);
2952 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2953 hv_store(RETVAL, "int_curr_symbol", 15,
2954 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2955 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2956 hv_store(RETVAL, "currency_symbol", 15,
2957 newSVpv(lcbuf->currency_symbol, 0), 0);
2958 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2959 hv_store(RETVAL, "mon_decimal_point", 17,
2960 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2961 #ifndef NO_LOCALECONV_MON_THOUSANDS_SEP
2962 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2963 hv_store(RETVAL, "mon_thousands_sep", 17,
2964 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2966 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2967 hv_store(RETVAL, "mon_grouping", 12,
2968 newSVpv(lcbuf->mon_grouping, 0), 0);
2969 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2970 hv_store(RETVAL, "positive_sign", 13,
2971 newSVpv(lcbuf->positive_sign, 0), 0);
2972 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2973 hv_store(RETVAL, "negative_sign", 13,
2974 newSVpv(lcbuf->negative_sign, 0), 0);
2976 if (lcbuf->int_frac_digits != CHAR_MAX)
2977 hv_store(RETVAL, "int_frac_digits", 15,
2978 newSViv(lcbuf->int_frac_digits), 0);
2979 if (lcbuf->frac_digits != CHAR_MAX)
2980 hv_store(RETVAL, "frac_digits", 11,
2981 newSViv(lcbuf->frac_digits), 0);
2982 if (lcbuf->p_cs_precedes != CHAR_MAX)
2983 hv_store(RETVAL, "p_cs_precedes", 13,
2984 newSViv(lcbuf->p_cs_precedes), 0);
2985 if (lcbuf->p_sep_by_space != CHAR_MAX)
2986 hv_store(RETVAL, "p_sep_by_space", 14,
2987 newSViv(lcbuf->p_sep_by_space), 0);
2988 if (lcbuf->n_cs_precedes != CHAR_MAX)
2989 hv_store(RETVAL, "n_cs_precedes", 13,
2990 newSViv(lcbuf->n_cs_precedes), 0);
2991 if (lcbuf->n_sep_by_space != CHAR_MAX)
2992 hv_store(RETVAL, "n_sep_by_space", 14,
2993 newSViv(lcbuf->n_sep_by_space), 0);
2994 if (lcbuf->p_sign_posn != CHAR_MAX)
2995 hv_store(RETVAL, "p_sign_posn", 11,
2996 newSViv(lcbuf->p_sign_posn), 0);
2997 if (lcbuf->n_sign_posn != CHAR_MAX)
2998 hv_store(RETVAL, "n_sign_posn", 11,
2999 newSViv(lcbuf->n_sign_posn), 0);
3002 localeconv(); /* A stub to call not_here(). */
3008 setlocale(category, locale = 0)
3012 RETVAL = setlocale(category, locale);
3014 #ifdef USE_LOCALE_CTYPE
3015 if (category == LC_CTYPE
3017 || category == LC_ALL
3023 if (category == LC_ALL)
3024 newctype = setlocale(LC_CTYPE, NULL);
3028 perl_new_ctype(newctype);
3030 #endif /* USE_LOCALE_CTYPE */
3031 #ifdef USE_LOCALE_COLLATE
3032 if (category == LC_COLLATE
3034 || category == LC_ALL
3040 if (category == LC_ALL)
3041 newcoll = setlocale(LC_COLLATE, NULL);
3045 perl_new_collate(newcoll);
3047 #endif /* USE_LOCALE_COLLATE */
3048 #ifdef USE_LOCALE_NUMERIC
3049 if (category == LC_NUMERIC
3051 || category == LC_ALL
3057 if (category == LC_ALL)
3058 newnum = setlocale(LC_NUMERIC, NULL);
3062 perl_new_numeric(newnum);
3064 #endif /* USE_LOCALE_NUMERIC */
3104 /* (We already know stack is long enough.) */
3105 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3106 PUSHs(sv_2mortal(newSViv(expvar)));
3122 /* (We already know stack is long enough.) */
3123 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3124 PUSHs(sv_2mortal(newSVnv(intvar)));
3139 sigaction(sig, action, oldaction = 0)
3141 POSIX::SigAction action
3142 POSIX::SigAction oldaction
3145 RETVAL = not_here("sigaction");
3147 # This code is really grody because we're trying to make the signal
3148 # interface look beautiful, which is hard.
3151 gv_fetchpv("SIG", TRUE, SVt_PVHV);
3154 struct sigaction act;
3155 struct sigaction oact;
3156 POSIX__SigSet sigset;
3158 SV** sigsvp = hv_fetch(GvHVn(siggv),
3160 strlen(sig_name[sig]),
3163 /* Remember old handler name if desired. */
3165 char *hand = SvPVx(*sigsvp, na);
3166 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
3167 sv_setpv(*svp, *hand ? hand : "DEFAULT");
3171 /* Vector new handler through %SIG. (We always use sighandler
3172 for the C signal handler, which reads %SIG to dispatch.) */
3173 svp = hv_fetch(action, "HANDLER", 7, FALSE);
3175 croak("Can't supply an action without a HANDLER");
3176 sv_setpv(*sigsvp, SvPV(*svp, na));
3177 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
3178 act.sa_handler = sighandler;
3180 /* Set up any desired mask. */
3181 svp = hv_fetch(action, "MASK", 4, FALSE);
3182 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
3184 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3185 sigset = (sigset_t*) tmp;
3186 act.sa_mask = *sigset;
3189 sigemptyset(& act.sa_mask);
3191 /* Set up any desired flags. */
3192 svp = hv_fetch(action, "FLAGS", 5, FALSE);
3193 act.sa_flags = svp ? SvIV(*svp) : 0;
3196 /* Now work around sigaction oddities */
3197 if (action && oldaction)
3198 RETVAL = sigaction(sig, & act, & oact);
3200 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3202 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3207 /* Get back the mask. */
3208 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
3209 if (sv_isa(*svp, "POSIX::SigSet")) {
3211 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3212 sigset = (sigset_t*) tmp;
3215 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
3216 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
3218 *sigset = oact.sa_mask;
3220 /* Get back the flags. */
3221 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
3222 sv_setiv(*svp, oact.sa_flags);
3231 POSIX::SigSet sigset
3234 sigprocmask(how, sigset, oldsigset = 0)
3236 POSIX::SigSet sigset
3237 POSIX::SigSet oldsigset
3240 sigsuspend(signal_mask)
3241 POSIX::SigSet signal_mask
3261 lseek(fd, offset, whence)
3274 if (pipe(fds) != -1) {
3276 PUSHs(sv_2mortal(newSViv(fds[0])));
3277 PUSHs(sv_2mortal(newSViv(fds[1])));
3281 read(fd, buffer, nbytes)
3283 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3287 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3290 SvCUR(sv_buffer) = RETVAL;
3291 SvPOK_only(sv_buffer);
3292 *SvEND(sv_buffer) = '\0';
3293 SvTAINTED_on(sv_buffer);
3309 tcsetpgrp(fd, pgrp_id)
3318 if (uname(&buf) >= 0) {
3320 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3321 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3322 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3323 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3324 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3327 uname((char *) 0); /* A stub to call not_here(). */
3331 write(fd, buffer, nbytes)
3349 mbstowcs(s, pwcs, n)
3361 wcstombs(s, pwcs, n)
3383 SET_NUMERIC_LOCAL();
3384 num = strtod(str, &unparsed);
3385 PUSHs(sv_2mortal(newSVnv(num)));
3386 if (GIMME == G_ARRAY) {
3389 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3395 strtol(str, base = 0)
3402 num = strtol(str, &unparsed, base);
3403 if (num >= IV_MIN && num <= IV_MAX)
3404 PUSHs(sv_2mortal(newSViv((IV)num)));
3406 PUSHs(sv_2mortal(newSVnv((double)num)));
3407 if (GIMME == G_ARRAY) {
3410 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3416 strtoul(str, base = 0)
3423 num = strtoul(str, &unparsed, base);
3425 PUSHs(sv_2mortal(newSViv((IV)num)));
3427 PUSHs(sv_2mortal(newSVnv((double)num)));
3428 if (GIMME == G_ARRAY) {
3431 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3443 char *p = SvPV(src,srclen);
3445 ST(0) = sv_2mortal(NEWSV(800,srclen));
3446 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3447 if (dstlen > srclen) {
3449 SvGROW(ST(0), dstlen);
3450 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3453 SvCUR(ST(0)) = dstlen;
3458 mkfifo(filename, mode)
3462 TAINT_PROPER("mkfifo");
3463 RETVAL = mkfifo(filename, mode);
3479 tcflush(fd, queue_selector)
3484 tcsendbreak(fd, duration)
3489 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3502 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3505 mytm.tm_hour = hour;
3506 mytm.tm_mday = mday;
3508 mytm.tm_year = year;
3509 mytm.tm_wday = wday;
3510 mytm.tm_yday = yday;
3511 mytm.tm_isdst = isdst;
3512 RETVAL = asctime(&mytm);
3529 realtime = times( &tms );
3531 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
3532 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
3533 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
3534 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) );
3535 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) );
3538 difftime(time1, time2)
3543 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3556 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3559 mytm.tm_hour = hour;
3560 mytm.tm_mday = mday;
3562 mytm.tm_year = year;
3563 mytm.tm_wday = wday;
3564 mytm.tm_yday = yday;
3565 mytm.tm_isdst = isdst;
3566 RETVAL = mktime(&mytm);
3572 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3588 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3591 mytm.tm_hour = hour;
3592 mytm.tm_mday = mday;
3594 mytm.tm_year = year;
3595 mytm.tm_wday = wday;
3596 mytm.tm_yday = yday;
3597 mytm.tm_isdst = isdst;
3598 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3599 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3609 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3610 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3613 access(filename, mode)
3631 pathconf(filename, name)