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>
47 #include <unistd.h> /* see hints/sunos_4_1.sh */
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
111 # define sigaction(a,b,c) not_here("sigaction")
112 # define sigpending(a) not_here("sigpending")
113 # define sigprocmask(a,b,c) not_here("sigprocmask")
114 # define sigsuspend(a) not_here("sigsuspend")
115 # define sigemptyset(a) not_here("sigemptyset")
116 # define sigaddset(a,b) not_here("sigaddset")
117 # define sigdelset(a,b) not_here("sigdelset")
118 # define sigfillset(a) not_here("sigfillset")
119 # define sigismember(a,b) not_here("sigismember")
122 # include <sys/times.h>
124 # include <sys/utsname.h>
126 # include <sys/wait.h>
134 typedef long SysRetLong;
135 typedef sigset_t* POSIX__SigSet;
136 typedef HV* POSIX__SigAction;
138 typedef struct termios* POSIX__Termios;
139 #else /* Define termios types to int, and call not_here for the functions.*/
140 #define POSIX__Termios int
144 #define cfgetispeed(x) not_here("cfgetispeed")
145 #define cfgetospeed(x) not_here("cfgetospeed")
146 #define tcdrain(x) not_here("tcdrain")
147 #define tcflush(x,y) not_here("tcflush")
148 #define tcsendbreak(x,y) not_here("tcsendbreak")
149 #define cfsetispeed(x,y) not_here("cfsetispeed")
150 #define cfsetospeed(x,y) not_here("cfsetospeed")
151 #define ctermid(x) (char *) not_here("ctermid")
152 #define tcflow(x,y) not_here("tcflow")
153 #define tcgetattr(x,y) not_here("tcgetattr")
154 #define tcsetattr(x,y,z) not_here("tcsetattr")
157 /* Possibly needed prototypes */
158 char *cuserid _((char *));
159 double strtod _((const char *, char **));
160 long strtol _((const char *, char **, int));
161 unsigned long strtoul _((const char *, char **, int));
164 #define cuserid(a) (char *) not_here("cuserid")
168 #define difftime(a,b) not_here("difftime")
171 #ifndef HAS_FPATHCONF
172 #define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
175 #define mktime(a) not_here("mktime")
178 #define nice(a) not_here("nice")
181 #define pathconf(f,n) (SysRetLong) not_here("pathconf")
184 #define sysconf(n) (SysRetLong) not_here("sysconf")
187 #define readlink(a,b,c) not_here("readlink")
190 #define setpgid(a,b) not_here("setpgid")
193 #define setsid() not_here("setsid")
196 #define strcoll(s1,s2) not_here("strcoll")
199 #define strtod(s1,s2) not_here("strtod")
202 #define strtol(s1,s2,b) not_here("strtol")
205 #define strtoul(s1,s2,b) not_here("strtoul")
208 #define strxfrm(s1,s2,n) not_here("strxfrm")
210 #ifndef HAS_TCGETPGRP
211 #define tcgetpgrp(a) not_here("tcgetpgrp")
213 #ifndef HAS_TCSETPGRP
214 #define tcsetpgrp(a,b) not_here("tcsetpgrp")
217 #define times(a) not_here("times")
220 #define uname(a) not_here("uname")
223 #define waitpid(a,b,c) not_here("waitpid")
228 #define mblen(a,b) not_here("mblen")
232 #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
235 #define mbtowc(pwc, s, n) not_here("mbtowc")
238 #define wcstombs(s, pwcs, n) not_here("wcstombs")
241 #define wctomb(s, wchar) not_here("wcstombs")
243 #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
244 /* If we don't have these functions, then we wouldn't have gotten a typedef
245 for wchar_t, the wide character type. Defining wchar_t allows the
246 functions referencing it to compile. Its actual type is then meaningless,
247 since without the above functions, all sections using it end up calling
248 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
254 #ifndef HAS_LOCALECONV
255 #define localeconv() not_here("localeconv")
260 extern char *tzname[];
262 char *tzname[] = { "" , "" };
266 /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX)
267 * fields for which we don't have Configure support yet:
268 * char *tm_zone; -- abbreviation of timezone name
269 * long tm_gmtoff; -- offset from GMT in seconds
270 * To workaround core dumps from the uninitialised tm_zone we get the
271 * system to give us a reasonable struct to copy. This fix means that
272 * strftime uses the tm_zone and tm_gmtoff values returned by
273 * localtime(time()). That should give the desired result most of the
274 * time. But probably not always!
276 * This is a temporary workaround to be removed once Configure
277 * support is added and NETaa14816 is considered in full.
278 * It does not address tzname aspects of NETaa14816.
281 # ifndef STRUCT_TM_HASZONE
282 # define STRUCT_TM_HAS_ZONE
286 #ifdef STRUCT_TM_HASZONE
288 init_tm(ptm) /* see mktime, strftime and asctime */
293 Copy(localtime(&now), ptm, 1, struct tm);
297 # define init_tm(ptm)
301 #ifdef HAS_LONG_DOUBLE
302 # if LONG_DOUBLESIZE > DOUBLESIZE
303 # undef HAS_LONG_DOUBLE /* XXX until we figure out how to use them */
307 #ifndef HAS_LONG_DOUBLE
322 croak("POSIX::%s not implemented on this architecture", s);
327 #ifdef HAS_LONG_DOUBLE
332 constant(char *name, int arg)
337 if (strEQ(name, "ARG_MAX"))
345 if (strEQ(name, "BUFSIZ"))
351 if (strEQ(name, "BRKINT"))
357 if (strEQ(name, "B9600"))
363 if (strEQ(name, "B19200"))
369 if (strEQ(name, "B38400"))
375 if (strEQ(name, "B0"))
381 if (strEQ(name, "B110"))
387 if (strEQ(name, "B1200"))
393 if (strEQ(name, "B134"))
399 if (strEQ(name, "B150"))
405 if (strEQ(name, "B1800"))
411 if (strEQ(name, "B200"))
417 if (strEQ(name, "B2400"))
423 if (strEQ(name, "B300"))
429 if (strEQ(name, "B4800"))
435 if (strEQ(name, "B50"))
441 if (strEQ(name, "B600"))
447 if (strEQ(name, "B75"))
455 if (strEQ(name, "CHAR_BIT"))
461 if (strEQ(name, "CHAR_MAX"))
467 if (strEQ(name, "CHAR_MIN"))
473 if (strEQ(name, "CHILD_MAX"))
479 if (strEQ(name, "CLK_TCK"))
485 if (strEQ(name, "CLOCAL"))
491 if (strEQ(name, "CLOCKS_PER_SEC"))
492 #ifdef CLOCKS_PER_SEC
493 return CLOCKS_PER_SEC;
497 if (strEQ(name, "CREAD"))
503 if (strEQ(name, "CS5"))
509 if (strEQ(name, "CS6"))
515 if (strEQ(name, "CS7"))
521 if (strEQ(name, "CS8"))
527 if (strEQ(name, "CSIZE"))
533 if (strEQ(name, "CSTOPB"))
541 if (strEQ(name, "DBL_MAX"))
547 if (strEQ(name, "DBL_MIN"))
553 if (strEQ(name, "DBL_DIG"))
559 if (strEQ(name, "DBL_EPSILON"))
565 if (strEQ(name, "DBL_MANT_DIG"))
571 if (strEQ(name, "DBL_MAX_10_EXP"))
572 #ifdef DBL_MAX_10_EXP
573 return DBL_MAX_10_EXP;
577 if (strEQ(name, "DBL_MAX_EXP"))
583 if (strEQ(name, "DBL_MIN_10_EXP"))
584 #ifdef DBL_MIN_10_EXP
585 return DBL_MIN_10_EXP;
589 if (strEQ(name, "DBL_MIN_EXP"))
599 if (strEQ(name, "EACCES"))
605 if (strEQ(name, "EADDRINUSE"))
611 if (strEQ(name, "EADDRNOTAVAIL"))
613 return EADDRNOTAVAIL;
617 if (strEQ(name, "EAFNOSUPPORT"))
623 if (strEQ(name, "EAGAIN"))
629 if (strEQ(name, "EALREADY"))
637 if (strEQ(name, "EBADF"))
643 if (strEQ(name, "EBUSY"))
651 if (strEQ(name, "ECHILD"))
657 if (strEQ(name, "ECHO"))
663 if (strEQ(name, "ECHOE"))
669 if (strEQ(name, "ECHOK"))
675 if (strEQ(name, "ECHONL"))
681 if (strEQ(name, "ECONNABORTED"))
687 if (strEQ(name, "ECONNREFUSED"))
693 if (strEQ(name, "ECONNRESET"))
701 if (strEQ(name, "EDEADLK"))
707 if (strEQ(name, "EDESTADDRREQ"))
713 if (strEQ(name, "EDOM"))
719 if (strEQ(name, "EDQUOT"))
727 if (strEQ(name, "EEXIST"))
735 if (strEQ(name, "EFAULT"))
741 if (strEQ(name, "EFBIG"))
749 if (strEQ(name, "EHOSTDOWN"))
755 if (strEQ(name, "EHOSTUNREACH"))
763 if (strEQ(name, "EINPROGRESS"))
769 if (strEQ(name, "EINTR"))
775 if (strEQ(name, "EINVAL"))
781 if (strEQ(name, "EIO"))
787 if (strEQ(name, "EISCONN"))
793 if (strEQ(name, "EISDIR"))
799 if (strEQ(name, "ELOOP"))
807 if (strEQ(name, "EMFILE"))
813 if (strEQ(name, "EMLINK"))
819 if (strEQ(name, "EMSGSIZE"))
827 if (strEQ(name, "ENETDOWN"))
833 if (strEQ(name, "ENETRESET"))
839 if (strEQ(name, "ENETUNREACH"))
845 if (strEQ(name, "ENOBUFS"))
851 if (strEQ(name, "ENOEXEC"))
857 if (strEQ(name, "ENOMEM"))
863 if (strEQ(name, "ENOPROTOOPT"))
869 if (strEQ(name, "ENOSPC"))
875 if (strEQ(name, "ENOTBLK"))
881 if (strEQ(name, "ENOTCONN"))
887 if (strEQ(name, "ENOTDIR"))
893 if (strEQ(name, "ENOTEMPTY"))
899 if (strEQ(name, "ENOTSOCK"))
905 if (strEQ(name, "ENOTTY"))
911 if (strEQ(name, "ENFILE"))
917 if (strEQ(name, "ENODEV"))
923 if (strEQ(name, "ENOENT"))
929 if (strEQ(name, "ENOLCK"))
935 if (strEQ(name, "ENOSYS"))
941 if (strEQ(name, "ENXIO"))
947 if (strEQ(name, "ENAMETOOLONG"))
955 if (strEQ(name, "EOF"))
961 if (strEQ(name, "EOPNOTSUPP"))
969 if (strEQ(name, "EPERM"))
975 if (strEQ(name, "EPFNOSUPPORT"))
981 if (strEQ(name, "EPIPE"))
987 if (strEQ(name, "EPROCLIM"))
993 if (strEQ(name, "EPROTONOSUPPORT"))
994 #ifdef EPROTONOSUPPORT
995 return EPROTONOSUPPORT;
999 if (strEQ(name, "EPROTOTYPE"))
1007 if (strEQ(name, "ERANGE"))
1013 if (strEQ(name, "EREMOTE"))
1019 if (strEQ(name, "ERESTART"))
1025 if (strEQ(name, "EROFS"))
1033 if (strEQ(name, "ESHUTDOWN"))
1039 if (strEQ(name, "ESOCKTNOSUPPORT"))
1040 #ifdef ESOCKTNOSUPPORT
1041 return ESOCKTNOSUPPORT;
1045 if (strEQ(name, "ESPIPE"))
1051 if (strEQ(name, "ESRCH"))
1057 if (strEQ(name, "ESTALE"))
1065 if (strEQ(name, "ETIMEDOUT"))
1071 if (strEQ(name, "ETOOMANYREFS"))
1073 return ETOOMANYREFS;
1077 if (strEQ(name, "ETXTBSY"))
1085 if (strEQ(name, "EUSERS"))
1093 if (strEQ(name, "EWOULDBLOCK"))
1101 if (strEQ(name, "EXIT_FAILURE"))
1103 return EXIT_FAILURE;
1107 if (strEQ(name, "EXIT_SUCCESS"))
1109 return EXIT_SUCCESS;
1113 if (strEQ(name, "EXDEV"))
1121 if (strEQ(name, "E2BIG"))
1129 if (strnEQ(name, "FLT_", 4)) {
1130 if (strEQ(name, "FLT_MAX"))
1136 if (strEQ(name, "FLT_MIN"))
1142 if (strEQ(name, "FLT_ROUNDS"))
1148 if (strEQ(name, "FLT_DIG"))
1154 if (strEQ(name, "FLT_EPSILON"))
1160 if (strEQ(name, "FLT_MANT_DIG"))
1162 return FLT_MANT_DIG;
1166 if (strEQ(name, "FLT_MAX_10_EXP"))
1167 #ifdef FLT_MAX_10_EXP
1168 return FLT_MAX_10_EXP;
1172 if (strEQ(name, "FLT_MAX_EXP"))
1178 if (strEQ(name, "FLT_MIN_10_EXP"))
1179 #ifdef FLT_MIN_10_EXP
1180 return FLT_MIN_10_EXP;
1184 if (strEQ(name, "FLT_MIN_EXP"))
1190 if (strEQ(name, "FLT_RADIX"))
1198 if (strnEQ(name, "F_", 2)) {
1199 if (strEQ(name, "F_DUPFD"))
1205 if (strEQ(name, "F_GETFD"))
1211 if (strEQ(name, "F_GETFL"))
1217 if (strEQ(name, "F_GETLK"))
1223 if (strEQ(name, "F_OK"))
1229 if (strEQ(name, "F_RDLCK"))
1235 if (strEQ(name, "F_SETFD"))
1241 if (strEQ(name, "F_SETFL"))
1247 if (strEQ(name, "F_SETLK"))
1253 if (strEQ(name, "F_SETLKW"))
1259 if (strEQ(name, "F_UNLCK"))
1265 if (strEQ(name, "F_WRLCK"))
1273 if (strEQ(name, "FD_CLOEXEC"))
1279 if (strEQ(name, "FILENAME_MAX"))
1281 return FILENAME_MAX;
1287 if (strEQ(name, "HUGE_VAL"))
1293 if (strEQ(name, "HUPCL"))
1301 if (strEQ(name, "INT_MAX"))
1307 if (strEQ(name, "INT_MIN"))
1313 if (strEQ(name, "ICANON"))
1319 if (strEQ(name, "ICRNL"))
1325 if (strEQ(name, "IEXTEN"))
1331 if (strEQ(name, "IGNBRK"))
1337 if (strEQ(name, "IGNCR"))
1343 if (strEQ(name, "IGNPAR"))
1349 if (strEQ(name, "INLCR"))
1355 if (strEQ(name, "INPCK"))
1361 if (strEQ(name, "ISIG"))
1367 if (strEQ(name, "ISTRIP"))
1373 if (strEQ(name, "IXOFF"))
1379 if (strEQ(name, "IXON"))
1387 if (strnEQ(name, "LC_", 3)) {
1388 if (strEQ(name, "LC_ALL"))
1394 if (strEQ(name, "LC_COLLATE"))
1400 if (strEQ(name, "LC_CTYPE"))
1406 if (strEQ(name, "LC_MONETARY"))
1412 if (strEQ(name, "LC_NUMERIC"))
1418 if (strEQ(name, "LC_TIME"))
1426 if (strnEQ(name, "LDBL_", 5)) {
1427 if (strEQ(name, "LDBL_MAX"))
1433 if (strEQ(name, "LDBL_MIN"))
1439 if (strEQ(name, "LDBL_DIG"))
1445 if (strEQ(name, "LDBL_EPSILON"))
1447 return LDBL_EPSILON;
1451 if (strEQ(name, "LDBL_MANT_DIG"))
1452 #ifdef LDBL_MANT_DIG
1453 return LDBL_MANT_DIG;
1457 if (strEQ(name, "LDBL_MAX_10_EXP"))
1458 #ifdef LDBL_MAX_10_EXP
1459 return LDBL_MAX_10_EXP;
1463 if (strEQ(name, "LDBL_MAX_EXP"))
1465 return LDBL_MAX_EXP;
1469 if (strEQ(name, "LDBL_MIN_10_EXP"))
1470 #ifdef LDBL_MIN_10_EXP
1471 return LDBL_MIN_10_EXP;
1475 if (strEQ(name, "LDBL_MIN_EXP"))
1477 return LDBL_MIN_EXP;
1483 if (strnEQ(name, "L_", 2)) {
1484 if (strEQ(name, "L_ctermid"))
1490 if (strEQ(name, "L_cuserid"))
1496 if (strEQ(name, "L_tmpname"))
1504 if (strEQ(name, "LONG_MAX"))
1510 if (strEQ(name, "LONG_MIN"))
1516 if (strEQ(name, "LINK_MAX"))
1524 if (strEQ(name, "MAX_CANON"))
1530 if (strEQ(name, "MAX_INPUT"))
1536 if (strEQ(name, "MB_CUR_MAX"))
1542 if (strEQ(name, "MB_LEN_MAX"))
1550 if (strEQ(name, "NULL")) return 0;
1551 if (strEQ(name, "NAME_MAX"))
1557 if (strEQ(name, "NCCS"))
1563 if (strEQ(name, "NGROUPS_MAX"))
1569 if (strEQ(name, "NOFLSH"))
1577 if (strnEQ(name, "O_", 2)) {
1578 if (strEQ(name, "O_APPEND"))
1584 if (strEQ(name, "O_CREAT"))
1590 if (strEQ(name, "O_TRUNC"))
1596 if (strEQ(name, "O_RDONLY"))
1602 if (strEQ(name, "O_RDWR"))
1608 if (strEQ(name, "O_WRONLY"))
1614 if (strEQ(name, "O_EXCL"))
1620 if (strEQ(name, "O_NOCTTY"))
1626 if (strEQ(name, "O_NONBLOCK"))
1632 if (strEQ(name, "O_ACCMODE"))
1640 if (strEQ(name, "OPEN_MAX"))
1646 if (strEQ(name, "OPOST"))
1654 if (strEQ(name, "PATH_MAX"))
1660 if (strEQ(name, "PARENB"))
1666 if (strEQ(name, "PARMRK"))
1672 if (strEQ(name, "PARODD"))
1678 if (strEQ(name, "PIPE_BUF"))
1686 if (strEQ(name, "RAND_MAX"))
1692 if (strEQ(name, "R_OK"))
1700 if (strnEQ(name, "SIG", 3)) {
1701 if (name[3] == '_') {
1702 if (strEQ(name, "SIG_BLOCK"))
1709 if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
1712 if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
1715 if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
1717 if (strEQ(name, "SIG_SETMASK"))
1723 if (strEQ(name, "SIG_UNBLOCK"))
1731 if (strEQ(name, "SIGABRT"))
1737 if (strEQ(name, "SIGALRM"))
1743 if (strEQ(name, "SIGCHLD"))
1749 if (strEQ(name, "SIGCONT"))
1755 if (strEQ(name, "SIGFPE"))
1761 if (strEQ(name, "SIGHUP"))
1767 if (strEQ(name, "SIGILL"))
1773 if (strEQ(name, "SIGINT"))
1779 if (strEQ(name, "SIGKILL"))
1785 if (strEQ(name, "SIGPIPE"))
1791 if (strEQ(name, "SIGQUIT"))
1797 if (strEQ(name, "SIGSEGV"))
1803 if (strEQ(name, "SIGSTOP"))
1809 if (strEQ(name, "SIGTERM"))
1815 if (strEQ(name, "SIGTSTP"))
1821 if (strEQ(name, "SIGTTIN"))
1827 if (strEQ(name, "SIGTTOU"))
1833 if (strEQ(name, "SIGUSR1"))
1839 if (strEQ(name, "SIGUSR2"))
1847 if (name[1] == '_') {
1848 if (strEQ(name, "S_ISGID"))
1854 if (strEQ(name, "S_ISUID"))
1860 if (strEQ(name, "S_IRGRP"))
1866 if (strEQ(name, "S_IROTH"))
1872 if (strEQ(name, "S_IRUSR"))
1878 if (strEQ(name, "S_IRWXG"))
1884 if (strEQ(name, "S_IRWXO"))
1890 if (strEQ(name, "S_IRWXU"))
1896 if (strEQ(name, "S_IWGRP"))
1902 if (strEQ(name, "S_IWOTH"))
1908 if (strEQ(name, "S_IWUSR"))
1914 if (strEQ(name, "S_IXGRP"))
1920 if (strEQ(name, "S_IXOTH"))
1926 if (strEQ(name, "S_IXUSR"))
1932 errno = EAGAIN; /* the following aren't constants */
1934 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1937 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1940 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1943 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1946 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1950 if (strEQ(name, "SEEK_CUR"))
1956 if (strEQ(name, "SEEK_END"))
1962 if (strEQ(name, "SEEK_SET"))
1968 if (strEQ(name, "STREAM_MAX"))
1974 if (strEQ(name, "SHRT_MAX"))
1980 if (strEQ(name, "SHRT_MIN"))
1986 if (strnEQ(name, "SA_", 3)) {
1987 if (strEQ(name, "SA_NOCLDSTOP"))
1989 return SA_NOCLDSTOP;
1993 if (strEQ(name, "SA_NOCLDWAIT"))
1995 return SA_NOCLDWAIT;
1999 if (strEQ(name, "SA_NODEFER"))
2005 if (strEQ(name, "SA_ONSTACK"))
2011 if (strEQ(name, "SA_RESETHAND"))
2013 return SA_RESETHAND;
2017 if (strEQ(name, "SA_RESTART"))
2023 if (strEQ(name, "SA_SIGINFO"))
2031 if (strEQ(name, "SCHAR_MAX"))
2037 if (strEQ(name, "SCHAR_MIN"))
2043 if (strEQ(name, "SSIZE_MAX"))
2049 if (strEQ(name, "STDIN_FILENO"))
2051 return STDIN_FILENO;
2055 if (strEQ(name, "STDOUT_FILENO"))
2056 #ifdef STDOUT_FILENO
2057 return STDOUT_FILENO;
2061 if (strEQ(name, "STRERR_FILENO"))
2062 #ifdef STRERR_FILENO
2063 return STRERR_FILENO;
2069 if (strEQ(name, "TCIFLUSH"))
2075 if (strEQ(name, "TCIOFF"))
2081 if (strEQ(name, "TCIOFLUSH"))
2087 if (strEQ(name, "TCION"))
2093 if (strEQ(name, "TCOFLUSH"))
2099 if (strEQ(name, "TCOOFF"))
2105 if (strEQ(name, "TCOON"))
2111 if (strEQ(name, "TCSADRAIN"))
2117 if (strEQ(name, "TCSAFLUSH"))
2123 if (strEQ(name, "TCSANOW"))
2129 if (strEQ(name, "TMP_MAX"))
2135 if (strEQ(name, "TOSTOP"))
2141 if (strEQ(name, "TZNAME_MAX"))
2149 if (strEQ(name, "UCHAR_MAX"))
2155 if (strEQ(name, "UINT_MAX"))
2161 if (strEQ(name, "ULONG_MAX"))
2167 if (strEQ(name, "USHRT_MAX"))
2175 if (strEQ(name, "VEOF"))
2181 if (strEQ(name, "VEOL"))
2187 if (strEQ(name, "VERASE"))
2193 if (strEQ(name, "VINTR"))
2199 if (strEQ(name, "VKILL"))
2205 if (strEQ(name, "VMIN"))
2211 if (strEQ(name, "VQUIT"))
2217 if (strEQ(name, "VSTART"))
2223 if (strEQ(name, "VSTOP"))
2229 if (strEQ(name, "VSUSP"))
2235 if (strEQ(name, "VTIME"))
2243 if (strEQ(name, "W_OK"))
2249 if (strEQ(name, "WNOHANG"))
2255 if (strEQ(name, "WUNTRACED"))
2261 errno = EAGAIN; /* the following aren't constants */
2263 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2266 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2269 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2272 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2275 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2278 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2282 if (strEQ(name, "X_OK"))
2290 if (strnEQ(name, "_PC_", 4)) {
2291 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2292 #if defined(_PC_CHOWN_RESTRICTED) || HINT_SC_EXIST
2293 return _PC_CHOWN_RESTRICTED;
2297 if (strEQ(name, "_PC_LINK_MAX"))
2298 #if defined(_PC_LINK_MAX) || HINT_SC_EXIST
2299 return _PC_LINK_MAX;
2303 if (strEQ(name, "_PC_MAX_CANON"))
2304 #if defined(_PC_MAX_CANON) || HINT_SC_EXIST
2305 return _PC_MAX_CANON;
2309 if (strEQ(name, "_PC_MAX_INPUT"))
2310 #if defined(_PC_MAX_INPUT) || HINT_SC_EXIST
2311 return _PC_MAX_INPUT;
2315 if (strEQ(name, "_PC_NAME_MAX"))
2316 #if defined(_PC_NAME_MAX) || HINT_SC_EXIST
2317 return _PC_NAME_MAX;
2321 if (strEQ(name, "_PC_NO_TRUNC"))
2322 #if defined(_PC_NO_TRUNC) || HINT_SC_EXIST
2323 return _PC_NO_TRUNC;
2327 if (strEQ(name, "_PC_PATH_MAX"))
2328 #if defined(_PC_PATH_MAX) || HINT_SC_EXIST
2329 return _PC_PATH_MAX;
2333 if (strEQ(name, "_PC_PIPE_BUF"))
2334 #if defined(_PC_PIPE_BUF) || HINT_SC_EXIST
2335 return _PC_PIPE_BUF;
2339 if (strEQ(name, "_PC_VDISABLE"))
2340 #if defined(_PC_VDISABLE) || HINT_SC_EXIST
2341 return _PC_VDISABLE;
2347 if (strnEQ(name, "_POSIX_", 7)) {
2348 if (strEQ(name, "_POSIX_ARG_MAX"))
2349 #ifdef _POSIX_ARG_MAX
2350 return _POSIX_ARG_MAX;
2354 if (strEQ(name, "_POSIX_CHILD_MAX"))
2355 #ifdef _POSIX_CHILD_MAX
2356 return _POSIX_CHILD_MAX;
2360 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2361 #ifdef _POSIX_CHOWN_RESTRICTED
2362 return _POSIX_CHOWN_RESTRICTED;
2366 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2367 #ifdef _POSIX_JOB_CONTROL
2368 return _POSIX_JOB_CONTROL;
2372 if (strEQ(name, "_POSIX_LINK_MAX"))
2373 #ifdef _POSIX_LINK_MAX
2374 return _POSIX_LINK_MAX;
2378 if (strEQ(name, "_POSIX_MAX_CANON"))
2379 #ifdef _POSIX_MAX_CANON
2380 return _POSIX_MAX_CANON;
2384 if (strEQ(name, "_POSIX_MAX_INPUT"))
2385 #ifdef _POSIX_MAX_INPUT
2386 return _POSIX_MAX_INPUT;
2390 if (strEQ(name, "_POSIX_NAME_MAX"))
2391 #ifdef _POSIX_NAME_MAX
2392 return _POSIX_NAME_MAX;
2396 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2397 #ifdef _POSIX_NGROUPS_MAX
2398 return _POSIX_NGROUPS_MAX;
2402 if (strEQ(name, "_POSIX_NO_TRUNC"))
2403 #ifdef _POSIX_NO_TRUNC
2404 return _POSIX_NO_TRUNC;
2408 if (strEQ(name, "_POSIX_OPEN_MAX"))
2409 #ifdef _POSIX_OPEN_MAX
2410 return _POSIX_OPEN_MAX;
2414 if (strEQ(name, "_POSIX_PATH_MAX"))
2415 #ifdef _POSIX_PATH_MAX
2416 return _POSIX_PATH_MAX;
2420 if (strEQ(name, "_POSIX_PIPE_BUF"))
2421 #ifdef _POSIX_PIPE_BUF
2422 return _POSIX_PIPE_BUF;
2426 if (strEQ(name, "_POSIX_SAVED_IDS"))
2427 #ifdef _POSIX_SAVED_IDS
2428 return _POSIX_SAVED_IDS;
2432 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2433 #ifdef _POSIX_SSIZE_MAX
2434 return _POSIX_SSIZE_MAX;
2438 if (strEQ(name, "_POSIX_STREAM_MAX"))
2439 #ifdef _POSIX_STREAM_MAX
2440 return _POSIX_STREAM_MAX;
2444 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2445 #ifdef _POSIX_TZNAME_MAX
2446 return _POSIX_TZNAME_MAX;
2450 if (strEQ(name, "_POSIX_VDISABLE"))
2451 #ifdef _POSIX_VDISABLE
2452 return _POSIX_VDISABLE;
2456 if (strEQ(name, "_POSIX_VERSION"))
2457 #ifdef _POSIX_VERSION
2458 return _POSIX_VERSION;
2464 if (strnEQ(name, "_SC_", 4)) {
2465 if (strEQ(name, "_SC_ARG_MAX"))
2466 #if defined(_SC_ARG_MAX) || HINT_SC_EXIST
2471 if (strEQ(name, "_SC_CHILD_MAX"))
2472 #if defined(_SC_CHILD_MAX) || HINT_SC_EXIST
2473 return _SC_CHILD_MAX;
2477 if (strEQ(name, "_SC_CLK_TCK"))
2478 #if defined(_SC_CLK_TCK) || HINT_SC_EXIST
2483 if (strEQ(name, "_SC_JOB_CONTROL"))
2484 #if defined(_SC_JOB_CONTROL) || HINT_SC_EXIST
2485 return _SC_JOB_CONTROL;
2489 if (strEQ(name, "_SC_NGROUPS_MAX"))
2490 #if defined(_SC_NGROUPS_MAX) || HINT_SC_EXIST
2491 return _SC_NGROUPS_MAX;
2495 if (strEQ(name, "_SC_OPEN_MAX"))
2496 #if defined(_SC_OPEN_MAX) || HINT_SC_EXIST
2497 return _SC_OPEN_MAX;
2501 if (strEQ(name, "_SC_SAVED_IDS"))
2502 #if defined(_SC_SAVED_IDS) || HINT_SC_EXIST
2503 return _SC_SAVED_IDS;
2507 if (strEQ(name, "_SC_STREAM_MAX"))
2508 #if defined(_SC_STREAM_MAX) || HINT_SC_EXIST
2509 return _SC_STREAM_MAX;
2513 if (strEQ(name, "_SC_TZNAME_MAX"))
2514 #if defined(_SC_TZNAME_MAX) || HINT_SC_EXIST
2515 return _SC_TZNAME_MAX;
2519 if (strEQ(name, "_SC_VERSION"))
2520 #if defined(_SC_VERSION) || HINT_SC_EXIST
2536 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2539 new(packname = "POSIX::SigSet", ...)
2544 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2545 sigemptyset(RETVAL);
2546 for (i = 1; i < items; i++)
2547 sigaddset(RETVAL, SvIV(ST(i)));
2554 POSIX::SigSet sigset
2556 safefree((char *)sigset);
2559 sigaddset(sigset, sig)
2560 POSIX::SigSet sigset
2564 sigdelset(sigset, sig)
2565 POSIX::SigSet sigset
2570 POSIX::SigSet sigset
2574 POSIX::SigSet sigset
2577 sigismember(sigset, sig)
2578 POSIX::SigSet sigset
2582 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2585 new(packname = "POSIX::Termios", ...)
2590 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2592 not_here("termios");
2600 DESTROY(termios_ref)
2601 POSIX::Termios termios_ref
2604 safefree((char *)termios_ref);
2606 not_here("termios");
2610 getattr(termios_ref, fd = 0)
2611 POSIX::Termios termios_ref
2614 RETVAL = tcgetattr(fd, termios_ref);
2619 setattr(termios_ref, fd = 0, optional_actions = 0)
2620 POSIX::Termios termios_ref
2622 int optional_actions
2624 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2629 cfgetispeed(termios_ref)
2630 POSIX::Termios termios_ref
2633 cfgetospeed(termios_ref)
2634 POSIX::Termios termios_ref
2637 getiflag(termios_ref)
2638 POSIX::Termios termios_ref
2640 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2641 RETVAL = termios_ref->c_iflag;
2643 not_here("getiflag");
2650 getoflag(termios_ref)
2651 POSIX::Termios termios_ref
2653 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2654 RETVAL = termios_ref->c_oflag;
2656 not_here("getoflag");
2663 getcflag(termios_ref)
2664 POSIX::Termios termios_ref
2666 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2667 RETVAL = termios_ref->c_cflag;
2669 not_here("getcflag");
2676 getlflag(termios_ref)
2677 POSIX::Termios termios_ref
2679 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2680 RETVAL = termios_ref->c_lflag;
2682 not_here("getlflag");
2689 getcc(termios_ref, ccix)
2690 POSIX::Termios termios_ref
2693 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2695 croak("Bad getcc subscript");
2696 RETVAL = termios_ref->c_cc[ccix];
2705 cfsetispeed(termios_ref, speed)
2706 POSIX::Termios termios_ref
2710 cfsetospeed(termios_ref, speed)
2711 POSIX::Termios termios_ref
2715 setiflag(termios_ref, iflag)
2716 POSIX::Termios termios_ref
2719 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2720 termios_ref->c_iflag = iflag;
2722 not_here("setiflag");
2726 setoflag(termios_ref, oflag)
2727 POSIX::Termios termios_ref
2730 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2731 termios_ref->c_oflag = oflag;
2733 not_here("setoflag");
2737 setcflag(termios_ref, cflag)
2738 POSIX::Termios termios_ref
2741 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2742 termios_ref->c_cflag = cflag;
2744 not_here("setcflag");
2748 setlflag(termios_ref, lflag)
2749 POSIX::Termios termios_ref
2752 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2753 termios_ref->c_lflag = lflag;
2755 not_here("setlflag");
2759 setcc(termios_ref, ccix, cc)
2760 POSIX::Termios termios_ref
2764 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2766 croak("Bad setcc subscript");
2767 termios_ref->c_cc[ccix] = cc;
2773 MODULE = POSIX PACKAGE = POSIX
2782 unsigned char * charstring
2784 unsigned char *s = charstring;
2785 unsigned char *e = s + na; /* "na" set by typemap side effect */
2786 for (RETVAL = 1; RETVAL && s < e; s++)
2794 unsigned char * charstring
2796 unsigned char *s = charstring;
2797 unsigned char *e = s + na; /* "na" set by typemap side effect */
2798 for (RETVAL = 1; RETVAL && s < e; s++)
2806 unsigned char * charstring
2808 unsigned char *s = charstring;
2809 unsigned char *e = s + na; /* "na" set by typemap side effect */
2810 for (RETVAL = 1; RETVAL && s < e; s++)
2818 unsigned char * charstring
2820 unsigned char *s = charstring;
2821 unsigned char *e = s + na; /* "na" set by typemap side effect */
2822 for (RETVAL = 1; RETVAL && s < e; s++)
2830 unsigned char * charstring
2832 unsigned char *s = charstring;
2833 unsigned char *e = s + na; /* "na" set by typemap side effect */
2834 for (RETVAL = 1; RETVAL && s < e; s++)
2842 unsigned char * charstring
2844 unsigned char *s = charstring;
2845 unsigned char *e = s + na; /* "na" set by typemap side effect */
2846 for (RETVAL = 1; RETVAL && s < e; s++)
2854 unsigned char * charstring
2856 unsigned char *s = charstring;
2857 unsigned char *e = s + na; /* "na" set by typemap side effect */
2858 for (RETVAL = 1; RETVAL && s < e; s++)
2866 unsigned char * charstring
2868 unsigned char *s = charstring;
2869 unsigned char *e = s + na; /* "na" set by typemap side effect */
2870 for (RETVAL = 1; RETVAL && s < e; s++)
2878 unsigned char * charstring
2880 unsigned char *s = charstring;
2881 unsigned char *e = s + na; /* "na" set by typemap side effect */
2882 for (RETVAL = 1; RETVAL && s < e; s++)
2890 unsigned char * charstring
2892 unsigned char *s = charstring;
2893 unsigned char *e = s + na; /* "na" set by typemap side effect */
2894 for (RETVAL = 1; RETVAL && s < e; s++)
2901 isxdigit(charstring)
2902 unsigned char * charstring
2904 unsigned char *s = charstring;
2905 unsigned char *e = s + na; /* "na" set by typemap side effect */
2906 for (RETVAL = 1; RETVAL && s < e; s++)
2913 open(filename, flags = O_RDONLY, mode = 0666)
2918 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2919 TAINT_PROPER("open");
2920 RETVAL = open(filename, flags, mode);
2928 #ifdef HAS_LOCALECONV
2929 struct lconv *lcbuf;
2931 SET_NUMERIC_LOCAL();
2932 if (lcbuf = localeconv()) {
2934 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2935 hv_store(RETVAL, "decimal_point", 13,
2936 newSVpv(lcbuf->decimal_point, 0), 0);
2937 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2938 hv_store(RETVAL, "thousands_sep", 13,
2939 newSVpv(lcbuf->thousands_sep, 0), 0);
2940 if (lcbuf->grouping && *lcbuf->grouping)
2941 hv_store(RETVAL, "grouping", 8,
2942 newSVpv(lcbuf->grouping, 0), 0);
2943 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2944 hv_store(RETVAL, "int_curr_symbol", 15,
2945 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2946 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2947 hv_store(RETVAL, "currency_symbol", 15,
2948 newSVpv(lcbuf->currency_symbol, 0), 0);
2949 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2950 hv_store(RETVAL, "mon_decimal_point", 17,
2951 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2952 #ifndef NO_LOCALECONV_MON_THOUSANDS_SEP
2953 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2954 hv_store(RETVAL, "mon_thousands_sep", 17,
2955 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2957 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2958 hv_store(RETVAL, "mon_grouping", 12,
2959 newSVpv(lcbuf->mon_grouping, 0), 0);
2960 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2961 hv_store(RETVAL, "positive_sign", 13,
2962 newSVpv(lcbuf->positive_sign, 0), 0);
2963 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2964 hv_store(RETVAL, "negative_sign", 13,
2965 newSVpv(lcbuf->negative_sign, 0), 0);
2967 if (lcbuf->int_frac_digits != CHAR_MAX)
2968 hv_store(RETVAL, "int_frac_digits", 15,
2969 newSViv(lcbuf->int_frac_digits), 0);
2970 if (lcbuf->frac_digits != CHAR_MAX)
2971 hv_store(RETVAL, "frac_digits", 11,
2972 newSViv(lcbuf->frac_digits), 0);
2973 if (lcbuf->p_cs_precedes != CHAR_MAX)
2974 hv_store(RETVAL, "p_cs_precedes", 13,
2975 newSViv(lcbuf->p_cs_precedes), 0);
2976 if (lcbuf->p_sep_by_space != CHAR_MAX)
2977 hv_store(RETVAL, "p_sep_by_space", 14,
2978 newSViv(lcbuf->p_sep_by_space), 0);
2979 if (lcbuf->n_cs_precedes != CHAR_MAX)
2980 hv_store(RETVAL, "n_cs_precedes", 13,
2981 newSViv(lcbuf->n_cs_precedes), 0);
2982 if (lcbuf->n_sep_by_space != CHAR_MAX)
2983 hv_store(RETVAL, "n_sep_by_space", 14,
2984 newSViv(lcbuf->n_sep_by_space), 0);
2985 if (lcbuf->p_sign_posn != CHAR_MAX)
2986 hv_store(RETVAL, "p_sign_posn", 11,
2987 newSViv(lcbuf->p_sign_posn), 0);
2988 if (lcbuf->n_sign_posn != CHAR_MAX)
2989 hv_store(RETVAL, "n_sign_posn", 11,
2990 newSViv(lcbuf->n_sign_posn), 0);
2993 localeconv(); /* A stub to call not_here(). */
2999 setlocale(category, locale = 0)
3003 RETVAL = setlocale(category, locale);
3005 #ifdef USE_LOCALE_CTYPE
3006 if (category == LC_CTYPE
3008 || category == LC_ALL
3014 if (category == LC_ALL)
3015 newctype = setlocale(LC_CTYPE, NULL);
3019 perl_new_ctype(newctype);
3021 #endif /* USE_LOCALE_CTYPE */
3022 #ifdef USE_LOCALE_COLLATE
3023 if (category == LC_COLLATE
3025 || category == LC_ALL
3031 if (category == LC_ALL)
3032 newcoll = setlocale(LC_COLLATE, NULL);
3036 perl_new_collate(newcoll);
3038 #endif /* USE_LOCALE_COLLATE */
3039 #ifdef USE_LOCALE_NUMERIC
3040 if (category == LC_NUMERIC
3042 || category == LC_ALL
3048 if (category == LC_ALL)
3049 newnum = setlocale(LC_NUMERIC, NULL);
3053 perl_new_numeric(newnum);
3055 #endif /* USE_LOCALE_NUMERIC */
3095 /* (We already know stack is long enough.) */
3096 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3097 PUSHs(sv_2mortal(newSViv(expvar)));
3113 /* (We already know stack is long enough.) */
3114 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3115 PUSHs(sv_2mortal(newSVnv(intvar)));
3130 sigaction(sig, action, oldaction = 0)
3132 POSIX::SigAction action
3133 POSIX::SigAction oldaction
3136 RETVAL = not_here("sigaction");
3138 # This code is really grody because we're trying to make the signal
3139 # interface look beautiful, which is hard.
3142 gv_fetchpv("SIG", TRUE, SVt_PVHV);
3145 struct sigaction act;
3146 struct sigaction oact;
3147 POSIX__SigSet sigset;
3149 SV** sigsvp = hv_fetch(GvHVn(siggv),
3151 strlen(sig_name[sig]),
3154 /* Remember old handler name if desired. */
3156 char *hand = SvPVx(*sigsvp, na);
3157 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
3158 sv_setpv(*svp, *hand ? hand : "DEFAULT");
3162 /* Vector new handler through %SIG. (We always use sighandler
3163 for the C signal handler, which reads %SIG to dispatch.) */
3164 svp = hv_fetch(action, "HANDLER", 7, FALSE);
3166 croak("Can't supply an action without a HANDLER");
3167 sv_setpv(*sigsvp, SvPV(*svp, na));
3168 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
3169 act.sa_handler = sighandler;
3171 /* Set up any desired mask. */
3172 svp = hv_fetch(action, "MASK", 4, FALSE);
3173 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
3175 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3176 sigset = (sigset_t*) tmp;
3177 act.sa_mask = *sigset;
3180 sigemptyset(& act.sa_mask);
3182 /* Set up any desired flags. */
3183 svp = hv_fetch(action, "FLAGS", 5, FALSE);
3184 act.sa_flags = svp ? SvIV(*svp) : 0;
3187 /* Now work around sigaction oddities */
3188 if (action && oldaction)
3189 RETVAL = sigaction(sig, & act, & oact);
3191 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3193 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3198 /* Get back the mask. */
3199 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
3200 if (sv_isa(*svp, "POSIX::SigSet")) {
3202 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3203 sigset = (sigset_t*) tmp;
3206 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
3207 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
3209 *sigset = oact.sa_mask;
3211 /* Get back the flags. */
3212 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
3213 sv_setiv(*svp, oact.sa_flags);
3222 POSIX::SigSet sigset
3225 sigprocmask(how, sigset, oldsigset = 0)
3227 POSIX::SigSet sigset
3228 POSIX::SigSet oldsigset
3231 sigsuspend(signal_mask)
3232 POSIX::SigSet signal_mask
3252 lseek(fd, offset, whence)
3265 if (pipe(fds) != -1) {
3267 PUSHs(sv_2mortal(newSViv(fds[0])));
3268 PUSHs(sv_2mortal(newSViv(fds[1])));
3272 read(fd, buffer, nbytes)
3274 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3278 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3281 SvCUR(sv_buffer) = RETVAL;
3282 SvPOK_only(sv_buffer);
3283 *SvEND(sv_buffer) = '\0';
3284 SvTAINTED_on(sv_buffer);
3300 tcsetpgrp(fd, pgrp_id)
3309 if (uname(&buf) >= 0) {
3311 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3312 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3313 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3314 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3315 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3318 uname((char *) 0); /* A stub to call not_here(). */
3322 write(fd, buffer, nbytes)
3340 mbstowcs(s, pwcs, n)
3352 wcstombs(s, pwcs, n)
3374 SET_NUMERIC_LOCAL();
3375 num = strtod(str, &unparsed);
3376 PUSHs(sv_2mortal(newSVnv(num)));
3377 if (GIMME == G_ARRAY) {
3380 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3386 strtol(str, base = 0)
3393 num = strtol(str, &unparsed, base);
3394 if (num >= IV_MIN && num <= IV_MAX)
3395 PUSHs(sv_2mortal(newSViv((IV)num)));
3397 PUSHs(sv_2mortal(newSVnv((double)num)));
3398 if (GIMME == G_ARRAY) {
3401 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3407 strtoul(str, base = 0)
3414 num = strtoul(str, &unparsed, base);
3416 PUSHs(sv_2mortal(newSViv((IV)num)));
3418 PUSHs(sv_2mortal(newSVnv((double)num)));
3419 if (GIMME == G_ARRAY) {
3422 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3434 char *p = SvPV(src,srclen);
3436 ST(0) = sv_2mortal(NEWSV(800,srclen));
3437 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3438 if (dstlen > srclen) {
3440 SvGROW(ST(0), dstlen);
3441 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3444 SvCUR(ST(0)) = dstlen;
3449 mkfifo(filename, mode)
3453 TAINT_PROPER("mkfifo");
3454 RETVAL = mkfifo(filename, mode);
3470 tcflush(fd, queue_selector)
3475 tcsendbreak(fd, duration)
3480 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3493 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3496 mytm.tm_hour = hour;
3497 mytm.tm_mday = mday;
3499 mytm.tm_year = year;
3500 mytm.tm_wday = wday;
3501 mytm.tm_yday = yday;
3502 mytm.tm_isdst = isdst;
3503 RETVAL = asctime(&mytm);
3520 realtime = times( &tms );
3522 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
3523 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
3524 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
3525 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) );
3526 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) );
3529 difftime(time1, time2)
3534 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3547 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3550 mytm.tm_hour = hour;
3551 mytm.tm_mday = mday;
3553 mytm.tm_year = year;
3554 mytm.tm_wday = wday;
3555 mytm.tm_yday = yday;
3556 mytm.tm_isdst = isdst;
3557 RETVAL = mktime(&mytm);
3563 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3579 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3582 mytm.tm_hour = hour;
3583 mytm.tm_mday = mday;
3585 mytm.tm_year = year;
3586 mytm.tm_wday = wday;
3587 mytm.tm_yday = yday;
3588 mytm.tm_isdst = isdst;
3589 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3590 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3600 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3601 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3604 access(filename, mode)
3622 pathconf(filename, name)