5 #define PERLIO_NOT_STDIO 1
12 # define TAINT_PROPER(a) /* XXX hack */
15 #ifdef I_DIRENT /* XXX maybe better to just rely on perl.h? */
38 /* XXX This comment is just to make I_TERMIO and I_SGTTY visible to
39 metaconfig for future extension writers. We don't use them in POSIX.
40 (This is really sneaky :-) --AD
42 #if defined(I_TERMIOS)
50 #include <sys/types.h>
53 #include <unistd.h> /* see hints/sunos_4_1.sh */
57 #if defined(__VMS) && !defined(__POSIX_SOURCE)
58 # include <libdef.h> /* LIB$_INVARG constant */
59 # include <lib$routines.h> /* prototype for lib$ediv() */
60 # include <starlet.h> /* prototype for sys$gettim() */
61 # if DECC_VERSION < 50000000
62 # define pid_t int /* old versions of DECC miss this in types.h */
65 # undef mkfifo /* #defined in perl.h */
66 # define mkfifo(a,b) (not_here("mkfifo"),-1)
67 # define tzset() not_here("tzset")
69 #if ((__VMS_VER >= 70000000) && (__DECC_VER >= 50200000)) || (__CRTL_VER >= 70000000)
70 # define HAS_TZNAME /* shows up in VMS 7.0 or Dec C 5.6 */
72 # endif /* __VMS_VER >= 70000000 or Dec C 5.6 */
74 /* The POSIX notion of ttyname() is better served by getname() under VMS */
75 static char ttnambuf[64];
76 # define ttyname(fd) (isatty(fd) > 0 ? getname(fd,ttnambuf,0) : NULL)
78 /* The non-POSIX CRTL times() has void return type, so we just get the
79 current time directly */
80 clock_t vms_times(struct tms *bufptr) {
82 /* Get wall time and convert to 10 ms intervals to
83 * produce the return value that the POSIX standard expects */
84 # if defined(__DECC) && defined (__ALPHA)
87 _ckvmssts(sys$gettim(&vmstime));
89 retval = vmstime & 0x7fffffff;
91 /* (Older hw or ccs don't have an atomic 64-bit type, so we
92 * juggle 32-bit ints (and a float) to produce a time_t result
93 * with minimal loss of information.) */
94 long int vmstime[2],remainder,divisor = 100000;
95 _ckvmssts(sys$gettim((unsigned long int *)vmstime));
96 vmstime[1] &= 0x7fff; /* prevent overflow in EDIV */
97 _ckvmssts(lib$ediv(&divisor,vmstime,(long int *)&retval,&remainder));
99 /* Fill in the struct tms using the CRTL routine . . .*/
100 times((tbuffer_t *)bufptr);
101 return (clock_t) retval;
103 # define times(t) vms_times(t)
106 # undef mkfifo /* #defined in perl.h */
107 # define mkfifo(a,b) not_here("mkfifo")
108 # define ttyname(a) (char*)not_here("ttyname")
109 # define sigset_t long
112 # define tzname _tzname
115 # define mode_t short
117 # define sigaction(a,b,c) not_here("sigaction")
118 # define sigpending(a) not_here("sigpending")
119 # define sigprocmask(a,b,c) not_here("sigprocmask")
120 # define sigsuspend(a) not_here("sigsuspend")
121 # define sigemptyset(a) not_here("sigemptyset")
122 # define sigaddset(a,b) not_here("sigaddset")
123 # define sigdelset(a,b) not_here("sigdelset")
124 # define sigfillset(a) not_here("sigfillset")
125 # define sigismember(a,b) not_here("sigismember")
128 # include <sys/times.h>
130 # include <sys/utsname.h>
132 # include <sys/wait.h>
140 typedef long SysRetLong;
141 typedef sigset_t* POSIX__SigSet;
142 typedef HV* POSIX__SigAction;
144 typedef struct termios* POSIX__Termios;
145 #else /* Define termios types to int, and call not_here for the functions.*/
146 #define POSIX__Termios int
150 #define cfgetispeed(x) not_here("cfgetispeed")
151 #define cfgetospeed(x) not_here("cfgetospeed")
152 #define tcdrain(x) not_here("tcdrain")
153 #define tcflush(x,y) not_here("tcflush")
154 #define tcsendbreak(x,y) not_here("tcsendbreak")
155 #define cfsetispeed(x,y) not_here("cfsetispeed")
156 #define cfsetospeed(x,y) not_here("cfsetospeed")
157 #define ctermid(x) (char *) not_here("ctermid")
158 #define tcflow(x,y) not_here("tcflow")
159 #define tcgetattr(x,y) not_here("tcgetattr")
160 #define tcsetattr(x,y,z) not_here("tcsetattr")
163 /* Possibly needed prototypes */
164 char *cuserid _((char *));
165 double strtod _((const char *, char **));
166 long strtol _((const char *, char **, int));
167 unsigned long strtoul _((const char *, char **, int));
170 #define cuserid(a) (char *) not_here("cuserid")
174 #define difftime(a,b) not_here("difftime")
177 #ifndef HAS_FPATHCONF
178 #define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
181 #define mktime(a) not_here("mktime")
184 #define nice(a) not_here("nice")
187 #define pathconf(f,n) (SysRetLong) not_here("pathconf")
190 #define sysconf(n) (SysRetLong) not_here("sysconf")
193 #define readlink(a,b,c) not_here("readlink")
196 #define setpgid(a,b) not_here("setpgid")
199 #define setsid() not_here("setsid")
202 #define strcoll(s1,s2) not_here("strcoll")
205 #define strtod(s1,s2) not_here("strtod")
208 #define strtol(s1,s2,b) not_here("strtol")
211 #define strtoul(s1,s2,b) not_here("strtoul")
214 #define strxfrm(s1,s2,n) not_here("strxfrm")
216 #ifndef HAS_TCGETPGRP
217 #define tcgetpgrp(a) not_here("tcgetpgrp")
219 #ifndef HAS_TCSETPGRP
220 #define tcsetpgrp(a,b) not_here("tcsetpgrp")
223 #define times(a) not_here("times")
226 #define uname(a) not_here("uname")
229 #define waitpid(a,b,c) not_here("waitpid")
234 #define mblen(a,b) not_here("mblen")
238 #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
241 #define mbtowc(pwc, s, n) not_here("mbtowc")
244 #define wcstombs(s, pwcs, n) not_here("wcstombs")
247 #define wctomb(s, wchar) not_here("wcstombs")
249 #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
250 /* If we don't have these functions, then we wouldn't have gotten a typedef
251 for wchar_t, the wide character type. Defining wchar_t allows the
252 functions referencing it to compile. Its actual type is then meaningless,
253 since without the above functions, all sections using it end up calling
254 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
260 #ifndef HAS_LOCALECONV
261 #define localeconv() not_here("localeconv")
266 extern char *tzname[];
268 char *tzname[] = { "" , "" };
272 /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX)
273 * fields for which we don't have Configure support yet:
274 * char *tm_zone; -- abbreviation of timezone name
275 * long tm_gmtoff; -- offset from GMT in seconds
276 * To workaround core dumps from the uninitialised tm_zone we get the
277 * system to give us a reasonable struct to copy. This fix means that
278 * strftime uses the tm_zone and tm_gmtoff values returned by
279 * localtime(time()). That should give the desired result most of the
280 * time. But probably not always!
282 * This is a temporary workaround to be removed once Configure
283 * support is added and NETaa14816 is considered in full.
284 * It does not address tzname aspects of NETaa14816.
287 # ifndef STRUCT_TM_HASZONE
288 # define STRUCT_TM_HAS_ZONE
292 #ifdef STRUCT_TM_HASZONE
294 init_tm(ptm) /* see mktime, strftime and asctime */
299 Copy(localtime(&now), ptm, 1, struct tm);
303 # define init_tm(ptm)
307 #ifdef HAS_LONG_DOUBLE
308 # if LONG_DOUBLESIZE > DOUBLESIZE
309 # undef HAS_LONG_DOUBLE /* XXX until we figure out how to use them */
313 #ifndef HAS_LONG_DOUBLE
328 croak("POSIX::%s not implemented on this architecture", s);
333 #ifdef HAS_LONG_DOUBLE
338 constant(char *name, int arg)
343 if (strEQ(name, "ARG_MAX"))
351 if (strEQ(name, "BUFSIZ"))
357 if (strEQ(name, "BRKINT"))
363 if (strEQ(name, "B9600"))
369 if (strEQ(name, "B19200"))
375 if (strEQ(name, "B38400"))
381 if (strEQ(name, "B0"))
387 if (strEQ(name, "B110"))
393 if (strEQ(name, "B1200"))
399 if (strEQ(name, "B134"))
405 if (strEQ(name, "B150"))
411 if (strEQ(name, "B1800"))
417 if (strEQ(name, "B200"))
423 if (strEQ(name, "B2400"))
429 if (strEQ(name, "B300"))
435 if (strEQ(name, "B4800"))
441 if (strEQ(name, "B50"))
447 if (strEQ(name, "B600"))
453 if (strEQ(name, "B75"))
461 if (strEQ(name, "CHAR_BIT"))
467 if (strEQ(name, "CHAR_MAX"))
473 if (strEQ(name, "CHAR_MIN"))
479 if (strEQ(name, "CHILD_MAX"))
485 if (strEQ(name, "CLK_TCK"))
491 if (strEQ(name, "CLOCAL"))
497 if (strEQ(name, "CLOCKS_PER_SEC"))
498 #ifdef CLOCKS_PER_SEC
499 return CLOCKS_PER_SEC;
503 if (strEQ(name, "CREAD"))
509 if (strEQ(name, "CS5"))
515 if (strEQ(name, "CS6"))
521 if (strEQ(name, "CS7"))
527 if (strEQ(name, "CS8"))
533 if (strEQ(name, "CSIZE"))
539 if (strEQ(name, "CSTOPB"))
547 if (strEQ(name, "DBL_MAX"))
553 if (strEQ(name, "DBL_MIN"))
559 if (strEQ(name, "DBL_DIG"))
565 if (strEQ(name, "DBL_EPSILON"))
571 if (strEQ(name, "DBL_MANT_DIG"))
577 if (strEQ(name, "DBL_MAX_10_EXP"))
578 #ifdef DBL_MAX_10_EXP
579 return DBL_MAX_10_EXP;
583 if (strEQ(name, "DBL_MAX_EXP"))
589 if (strEQ(name, "DBL_MIN_10_EXP"))
590 #ifdef DBL_MIN_10_EXP
591 return DBL_MIN_10_EXP;
595 if (strEQ(name, "DBL_MIN_EXP"))
605 if (strEQ(name, "EACCES"))
611 if (strEQ(name, "EADDRINUSE"))
617 if (strEQ(name, "EADDRNOTAVAIL"))
619 return EADDRNOTAVAIL;
623 if (strEQ(name, "EAFNOSUPPORT"))
629 if (strEQ(name, "EAGAIN"))
635 if (strEQ(name, "EALREADY"))
643 if (strEQ(name, "EBADF"))
649 if (strEQ(name, "EBUSY"))
657 if (strEQ(name, "ECHILD"))
663 if (strEQ(name, "ECHO"))
669 if (strEQ(name, "ECHOE"))
675 if (strEQ(name, "ECHOK"))
681 if (strEQ(name, "ECHONL"))
687 if (strEQ(name, "ECONNABORTED"))
693 if (strEQ(name, "ECONNREFUSED"))
699 if (strEQ(name, "ECONNRESET"))
707 if (strEQ(name, "EDEADLK"))
713 if (strEQ(name, "EDESTADDRREQ"))
719 if (strEQ(name, "EDOM"))
725 if (strEQ(name, "EDQUOT"))
733 if (strEQ(name, "EEXIST"))
741 if (strEQ(name, "EFAULT"))
747 if (strEQ(name, "EFBIG"))
755 if (strEQ(name, "EHOSTDOWN"))
761 if (strEQ(name, "EHOSTUNREACH"))
769 if (strEQ(name, "EINPROGRESS"))
775 if (strEQ(name, "EINTR"))
781 if (strEQ(name, "EINVAL"))
787 if (strEQ(name, "EIO"))
793 if (strEQ(name, "EISCONN"))
799 if (strEQ(name, "EISDIR"))
805 if (strEQ(name, "ELOOP"))
813 if (strEQ(name, "EMFILE"))
819 if (strEQ(name, "EMLINK"))
825 if (strEQ(name, "EMSGSIZE"))
833 if (strEQ(name, "ENETDOWN"))
839 if (strEQ(name, "ENETRESET"))
845 if (strEQ(name, "ENETUNREACH"))
851 if (strEQ(name, "ENOBUFS"))
857 if (strEQ(name, "ENOEXEC"))
863 if (strEQ(name, "ENOMEM"))
869 if (strEQ(name, "ENOPROTOOPT"))
875 if (strEQ(name, "ENOSPC"))
881 if (strEQ(name, "ENOTBLK"))
887 if (strEQ(name, "ENOTCONN"))
893 if (strEQ(name, "ENOTDIR"))
899 if (strEQ(name, "ENOTEMPTY"))
905 if (strEQ(name, "ENOTSOCK"))
911 if (strEQ(name, "ENOTTY"))
917 if (strEQ(name, "ENFILE"))
923 if (strEQ(name, "ENODEV"))
929 if (strEQ(name, "ENOENT"))
935 if (strEQ(name, "ENOLCK"))
941 if (strEQ(name, "ENOSYS"))
947 if (strEQ(name, "ENXIO"))
953 if (strEQ(name, "ENAMETOOLONG"))
961 if (strEQ(name, "EOF"))
967 if (strEQ(name, "EOPNOTSUPP"))
975 if (strEQ(name, "EPERM"))
981 if (strEQ(name, "EPFNOSUPPORT"))
987 if (strEQ(name, "EPIPE"))
993 if (strEQ(name, "EPROCLIM"))
999 if (strEQ(name, "EPROTONOSUPPORT"))
1000 #ifdef EPROTONOSUPPORT
1001 return EPROTONOSUPPORT;
1005 if (strEQ(name, "EPROTOTYPE"))
1013 if (strEQ(name, "ERANGE"))
1019 if (strEQ(name, "EREMOTE"))
1025 if (strEQ(name, "ERESTART"))
1031 if (strEQ(name, "EROFS"))
1039 if (strEQ(name, "ESHUTDOWN"))
1045 if (strEQ(name, "ESOCKTNOSUPPORT"))
1046 #ifdef ESOCKTNOSUPPORT
1047 return ESOCKTNOSUPPORT;
1051 if (strEQ(name, "ESPIPE"))
1057 if (strEQ(name, "ESRCH"))
1063 if (strEQ(name, "ESTALE"))
1071 if (strEQ(name, "ETIMEDOUT"))
1077 if (strEQ(name, "ETOOMANYREFS"))
1079 return ETOOMANYREFS;
1083 if (strEQ(name, "ETXTBSY"))
1091 if (strEQ(name, "EUSERS"))
1099 if (strEQ(name, "EWOULDBLOCK"))
1107 if (strEQ(name, "EXIT_FAILURE"))
1109 return EXIT_FAILURE;
1113 if (strEQ(name, "EXIT_SUCCESS"))
1115 return EXIT_SUCCESS;
1119 if (strEQ(name, "EXDEV"))
1127 if (strEQ(name, "E2BIG"))
1135 if (strnEQ(name, "FLT_", 4)) {
1136 if (strEQ(name, "FLT_MAX"))
1142 if (strEQ(name, "FLT_MIN"))
1148 if (strEQ(name, "FLT_ROUNDS"))
1154 if (strEQ(name, "FLT_DIG"))
1160 if (strEQ(name, "FLT_EPSILON"))
1166 if (strEQ(name, "FLT_MANT_DIG"))
1168 return FLT_MANT_DIG;
1172 if (strEQ(name, "FLT_MAX_10_EXP"))
1173 #ifdef FLT_MAX_10_EXP
1174 return FLT_MAX_10_EXP;
1178 if (strEQ(name, "FLT_MAX_EXP"))
1184 if (strEQ(name, "FLT_MIN_10_EXP"))
1185 #ifdef FLT_MIN_10_EXP
1186 return FLT_MIN_10_EXP;
1190 if (strEQ(name, "FLT_MIN_EXP"))
1196 if (strEQ(name, "FLT_RADIX"))
1204 if (strnEQ(name, "F_", 2)) {
1205 if (strEQ(name, "F_DUPFD"))
1211 if (strEQ(name, "F_GETFD"))
1217 if (strEQ(name, "F_GETFL"))
1223 if (strEQ(name, "F_GETLK"))
1229 if (strEQ(name, "F_OK"))
1235 if (strEQ(name, "F_RDLCK"))
1241 if (strEQ(name, "F_SETFD"))
1247 if (strEQ(name, "F_SETFL"))
1253 if (strEQ(name, "F_SETLK"))
1259 if (strEQ(name, "F_SETLKW"))
1265 if (strEQ(name, "F_UNLCK"))
1271 if (strEQ(name, "F_WRLCK"))
1279 if (strEQ(name, "FD_CLOEXEC"))
1285 if (strEQ(name, "FILENAME_MAX"))
1287 return FILENAME_MAX;
1293 if (strEQ(name, "HUGE_VAL"))
1299 if (strEQ(name, "HUPCL"))
1307 if (strEQ(name, "INT_MAX"))
1313 if (strEQ(name, "INT_MIN"))
1319 if (strEQ(name, "ICANON"))
1325 if (strEQ(name, "ICRNL"))
1331 if (strEQ(name, "IEXTEN"))
1337 if (strEQ(name, "IGNBRK"))
1343 if (strEQ(name, "IGNCR"))
1349 if (strEQ(name, "IGNPAR"))
1355 if (strEQ(name, "INLCR"))
1361 if (strEQ(name, "INPCK"))
1367 if (strEQ(name, "ISIG"))
1373 if (strEQ(name, "ISTRIP"))
1379 if (strEQ(name, "IXOFF"))
1385 if (strEQ(name, "IXON"))
1393 if (strnEQ(name, "LC_", 3)) {
1394 if (strEQ(name, "LC_ALL"))
1400 if (strEQ(name, "LC_COLLATE"))
1406 if (strEQ(name, "LC_CTYPE"))
1412 if (strEQ(name, "LC_MONETARY"))
1418 if (strEQ(name, "LC_NUMERIC"))
1424 if (strEQ(name, "LC_TIME"))
1432 if (strnEQ(name, "LDBL_", 5)) {
1433 if (strEQ(name, "LDBL_MAX"))
1439 if (strEQ(name, "LDBL_MIN"))
1445 if (strEQ(name, "LDBL_DIG"))
1451 if (strEQ(name, "LDBL_EPSILON"))
1453 return LDBL_EPSILON;
1457 if (strEQ(name, "LDBL_MANT_DIG"))
1458 #ifdef LDBL_MANT_DIG
1459 return LDBL_MANT_DIG;
1463 if (strEQ(name, "LDBL_MAX_10_EXP"))
1464 #ifdef LDBL_MAX_10_EXP
1465 return LDBL_MAX_10_EXP;
1469 if (strEQ(name, "LDBL_MAX_EXP"))
1471 return LDBL_MAX_EXP;
1475 if (strEQ(name, "LDBL_MIN_10_EXP"))
1476 #ifdef LDBL_MIN_10_EXP
1477 return LDBL_MIN_10_EXP;
1481 if (strEQ(name, "LDBL_MIN_EXP"))
1483 return LDBL_MIN_EXP;
1489 if (strnEQ(name, "L_", 2)) {
1490 if (strEQ(name, "L_ctermid"))
1496 if (strEQ(name, "L_cuserid"))
1502 if (strEQ(name, "L_tmpname"))
1510 if (strEQ(name, "LONG_MAX"))
1516 if (strEQ(name, "LONG_MIN"))
1522 if (strEQ(name, "LINK_MAX"))
1530 if (strEQ(name, "MAX_CANON"))
1536 if (strEQ(name, "MAX_INPUT"))
1542 if (strEQ(name, "MB_CUR_MAX"))
1548 if (strEQ(name, "MB_LEN_MAX"))
1556 if (strEQ(name, "NULL")) return 0;
1557 if (strEQ(name, "NAME_MAX"))
1563 if (strEQ(name, "NCCS"))
1569 if (strEQ(name, "NGROUPS_MAX"))
1575 if (strEQ(name, "NOFLSH"))
1583 if (strnEQ(name, "O_", 2)) {
1584 if (strEQ(name, "O_APPEND"))
1590 if (strEQ(name, "O_CREAT"))
1596 if (strEQ(name, "O_TRUNC"))
1602 if (strEQ(name, "O_RDONLY"))
1608 if (strEQ(name, "O_RDWR"))
1614 if (strEQ(name, "O_WRONLY"))
1620 if (strEQ(name, "O_EXCL"))
1626 if (strEQ(name, "O_NOCTTY"))
1632 if (strEQ(name, "O_NONBLOCK"))
1638 if (strEQ(name, "O_ACCMODE"))
1646 if (strEQ(name, "OPEN_MAX"))
1652 if (strEQ(name, "OPOST"))
1660 if (strEQ(name, "PATH_MAX"))
1666 if (strEQ(name, "PARENB"))
1672 if (strEQ(name, "PARMRK"))
1678 if (strEQ(name, "PARODD"))
1684 if (strEQ(name, "PIPE_BUF"))
1692 if (strEQ(name, "RAND_MAX"))
1698 if (strEQ(name, "R_OK"))
1706 if (strnEQ(name, "SIG", 3)) {
1707 if (name[3] == '_') {
1708 if (strEQ(name, "SIG_BLOCK"))
1715 if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
1718 if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
1721 if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
1723 if (strEQ(name, "SIG_SETMASK"))
1729 if (strEQ(name, "SIG_UNBLOCK"))
1737 if (strEQ(name, "SIGABRT"))
1743 if (strEQ(name, "SIGALRM"))
1749 if (strEQ(name, "SIGCHLD"))
1755 if (strEQ(name, "SIGCONT"))
1761 if (strEQ(name, "SIGFPE"))
1767 if (strEQ(name, "SIGHUP"))
1773 if (strEQ(name, "SIGILL"))
1779 if (strEQ(name, "SIGINT"))
1785 if (strEQ(name, "SIGKILL"))
1791 if (strEQ(name, "SIGPIPE"))
1797 if (strEQ(name, "SIGQUIT"))
1803 if (strEQ(name, "SIGSEGV"))
1809 if (strEQ(name, "SIGSTOP"))
1815 if (strEQ(name, "SIGTERM"))
1821 if (strEQ(name, "SIGTSTP"))
1827 if (strEQ(name, "SIGTTIN"))
1833 if (strEQ(name, "SIGTTOU"))
1839 if (strEQ(name, "SIGUSR1"))
1845 if (strEQ(name, "SIGUSR2"))
1853 if (name[1] == '_') {
1854 if (strEQ(name, "S_ISGID"))
1860 if (strEQ(name, "S_ISUID"))
1866 if (strEQ(name, "S_IRGRP"))
1872 if (strEQ(name, "S_IROTH"))
1878 if (strEQ(name, "S_IRUSR"))
1884 if (strEQ(name, "S_IRWXG"))
1890 if (strEQ(name, "S_IRWXO"))
1896 if (strEQ(name, "S_IRWXU"))
1902 if (strEQ(name, "S_IWGRP"))
1908 if (strEQ(name, "S_IWOTH"))
1914 if (strEQ(name, "S_IWUSR"))
1920 if (strEQ(name, "S_IXGRP"))
1926 if (strEQ(name, "S_IXOTH"))
1932 if (strEQ(name, "S_IXUSR"))
1938 errno = EAGAIN; /* the following aren't constants */
1940 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1943 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1946 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1949 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1952 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1956 if (strEQ(name, "SEEK_CUR"))
1962 if (strEQ(name, "SEEK_END"))
1968 if (strEQ(name, "SEEK_SET"))
1974 if (strEQ(name, "STREAM_MAX"))
1980 if (strEQ(name, "SHRT_MAX"))
1986 if (strEQ(name, "SHRT_MIN"))
1992 if (strnEQ(name, "SA_", 3)) {
1993 if (strEQ(name, "SA_NOCLDSTOP"))
1995 return SA_NOCLDSTOP;
1999 if (strEQ(name, "SA_NOCLDWAIT"))
2001 return SA_NOCLDWAIT;
2005 if (strEQ(name, "SA_NODEFER"))
2011 if (strEQ(name, "SA_ONSTACK"))
2017 if (strEQ(name, "SA_RESETHAND"))
2019 return SA_RESETHAND;
2023 if (strEQ(name, "SA_RESTART"))
2029 if (strEQ(name, "SA_SIGINFO"))
2037 if (strEQ(name, "SCHAR_MAX"))
2043 if (strEQ(name, "SCHAR_MIN"))
2049 if (strEQ(name, "SSIZE_MAX"))
2055 if (strEQ(name, "STDIN_FILENO"))
2057 return STDIN_FILENO;
2061 if (strEQ(name, "STDOUT_FILENO"))
2062 #ifdef STDOUT_FILENO
2063 return STDOUT_FILENO;
2067 if (strEQ(name, "STRERR_FILENO"))
2068 #ifdef STRERR_FILENO
2069 return STRERR_FILENO;
2075 if (strEQ(name, "TCIFLUSH"))
2081 if (strEQ(name, "TCIOFF"))
2087 if (strEQ(name, "TCIOFLUSH"))
2093 if (strEQ(name, "TCION"))
2099 if (strEQ(name, "TCOFLUSH"))
2105 if (strEQ(name, "TCOOFF"))
2111 if (strEQ(name, "TCOON"))
2117 if (strEQ(name, "TCSADRAIN"))
2123 if (strEQ(name, "TCSAFLUSH"))
2129 if (strEQ(name, "TCSANOW"))
2135 if (strEQ(name, "TMP_MAX"))
2141 if (strEQ(name, "TOSTOP"))
2147 if (strEQ(name, "TZNAME_MAX"))
2155 if (strEQ(name, "UCHAR_MAX"))
2161 if (strEQ(name, "UINT_MAX"))
2167 if (strEQ(name, "ULONG_MAX"))
2173 if (strEQ(name, "USHRT_MAX"))
2181 if (strEQ(name, "VEOF"))
2187 if (strEQ(name, "VEOL"))
2193 if (strEQ(name, "VERASE"))
2199 if (strEQ(name, "VINTR"))
2205 if (strEQ(name, "VKILL"))
2211 if (strEQ(name, "VMIN"))
2217 if (strEQ(name, "VQUIT"))
2223 if (strEQ(name, "VSTART"))
2229 if (strEQ(name, "VSTOP"))
2235 if (strEQ(name, "VSUSP"))
2241 if (strEQ(name, "VTIME"))
2249 if (strEQ(name, "W_OK"))
2255 if (strEQ(name, "WNOHANG"))
2261 if (strEQ(name, "WUNTRACED"))
2267 errno = EAGAIN; /* the following aren't constants */
2269 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2272 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2275 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2278 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2281 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2284 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2288 if (strEQ(name, "X_OK"))
2296 if (strnEQ(name, "_PC_", 4)) {
2297 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2298 #if defined(_PC_CHOWN_RESTRICTED) || HINT_SC_EXIST
2299 return _PC_CHOWN_RESTRICTED;
2303 if (strEQ(name, "_PC_LINK_MAX"))
2304 #if defined(_PC_LINK_MAX) || HINT_SC_EXIST
2305 return _PC_LINK_MAX;
2309 if (strEQ(name, "_PC_MAX_CANON"))
2310 #if defined(_PC_MAX_CANON) || HINT_SC_EXIST
2311 return _PC_MAX_CANON;
2315 if (strEQ(name, "_PC_MAX_INPUT"))
2316 #if defined(_PC_MAX_INPUT) || HINT_SC_EXIST
2317 return _PC_MAX_INPUT;
2321 if (strEQ(name, "_PC_NAME_MAX"))
2322 #if defined(_PC_NAME_MAX) || HINT_SC_EXIST
2323 return _PC_NAME_MAX;
2327 if (strEQ(name, "_PC_NO_TRUNC"))
2328 #if defined(_PC_NO_TRUNC) || HINT_SC_EXIST
2329 return _PC_NO_TRUNC;
2333 if (strEQ(name, "_PC_PATH_MAX"))
2334 #if defined(_PC_PATH_MAX) || HINT_SC_EXIST
2335 return _PC_PATH_MAX;
2339 if (strEQ(name, "_PC_PIPE_BUF"))
2340 #if defined(_PC_PIPE_BUF) || HINT_SC_EXIST
2341 return _PC_PIPE_BUF;
2345 if (strEQ(name, "_PC_VDISABLE"))
2346 #if defined(_PC_VDISABLE) || HINT_SC_EXIST
2347 return _PC_VDISABLE;
2353 if (strnEQ(name, "_POSIX_", 7)) {
2354 if (strEQ(name, "_POSIX_ARG_MAX"))
2355 #ifdef _POSIX_ARG_MAX
2356 return _POSIX_ARG_MAX;
2360 if (strEQ(name, "_POSIX_CHILD_MAX"))
2361 #ifdef _POSIX_CHILD_MAX
2362 return _POSIX_CHILD_MAX;
2366 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2367 #ifdef _POSIX_CHOWN_RESTRICTED
2368 return _POSIX_CHOWN_RESTRICTED;
2372 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2373 #ifdef _POSIX_JOB_CONTROL
2374 return _POSIX_JOB_CONTROL;
2378 if (strEQ(name, "_POSIX_LINK_MAX"))
2379 #ifdef _POSIX_LINK_MAX
2380 return _POSIX_LINK_MAX;
2384 if (strEQ(name, "_POSIX_MAX_CANON"))
2385 #ifdef _POSIX_MAX_CANON
2386 return _POSIX_MAX_CANON;
2390 if (strEQ(name, "_POSIX_MAX_INPUT"))
2391 #ifdef _POSIX_MAX_INPUT
2392 return _POSIX_MAX_INPUT;
2396 if (strEQ(name, "_POSIX_NAME_MAX"))
2397 #ifdef _POSIX_NAME_MAX
2398 return _POSIX_NAME_MAX;
2402 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2403 #ifdef _POSIX_NGROUPS_MAX
2404 return _POSIX_NGROUPS_MAX;
2408 if (strEQ(name, "_POSIX_NO_TRUNC"))
2409 #ifdef _POSIX_NO_TRUNC
2410 return _POSIX_NO_TRUNC;
2414 if (strEQ(name, "_POSIX_OPEN_MAX"))
2415 #ifdef _POSIX_OPEN_MAX
2416 return _POSIX_OPEN_MAX;
2420 if (strEQ(name, "_POSIX_PATH_MAX"))
2421 #ifdef _POSIX_PATH_MAX
2422 return _POSIX_PATH_MAX;
2426 if (strEQ(name, "_POSIX_PIPE_BUF"))
2427 #ifdef _POSIX_PIPE_BUF
2428 return _POSIX_PIPE_BUF;
2432 if (strEQ(name, "_POSIX_SAVED_IDS"))
2433 #ifdef _POSIX_SAVED_IDS
2434 return _POSIX_SAVED_IDS;
2438 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2439 #ifdef _POSIX_SSIZE_MAX
2440 return _POSIX_SSIZE_MAX;
2444 if (strEQ(name, "_POSIX_STREAM_MAX"))
2445 #ifdef _POSIX_STREAM_MAX
2446 return _POSIX_STREAM_MAX;
2450 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2451 #ifdef _POSIX_TZNAME_MAX
2452 return _POSIX_TZNAME_MAX;
2456 if (strEQ(name, "_POSIX_VDISABLE"))
2457 #ifdef _POSIX_VDISABLE
2458 return _POSIX_VDISABLE;
2462 if (strEQ(name, "_POSIX_VERSION"))
2463 #ifdef _POSIX_VERSION
2464 return _POSIX_VERSION;
2470 if (strnEQ(name, "_SC_", 4)) {
2471 if (strEQ(name, "_SC_ARG_MAX"))
2472 #if defined(_SC_ARG_MAX) || HINT_SC_EXIST
2477 if (strEQ(name, "_SC_CHILD_MAX"))
2478 #if defined(_SC_CHILD_MAX) || HINT_SC_EXIST
2479 return _SC_CHILD_MAX;
2483 if (strEQ(name, "_SC_CLK_TCK"))
2484 #if defined(_SC_CLK_TCK) || HINT_SC_EXIST
2489 if (strEQ(name, "_SC_JOB_CONTROL"))
2490 #if defined(_SC_JOB_CONTROL) || HINT_SC_EXIST
2491 return _SC_JOB_CONTROL;
2495 if (strEQ(name, "_SC_NGROUPS_MAX"))
2496 #if defined(_SC_NGROUPS_MAX) || HINT_SC_EXIST
2497 return _SC_NGROUPS_MAX;
2501 if (strEQ(name, "_SC_OPEN_MAX"))
2502 #if defined(_SC_OPEN_MAX) || HINT_SC_EXIST
2503 return _SC_OPEN_MAX;
2507 if (strEQ(name, "_SC_SAVED_IDS"))
2508 #if defined(_SC_SAVED_IDS) || HINT_SC_EXIST
2509 return _SC_SAVED_IDS;
2513 if (strEQ(name, "_SC_STREAM_MAX"))
2514 #if defined(_SC_STREAM_MAX) || HINT_SC_EXIST
2515 return _SC_STREAM_MAX;
2519 if (strEQ(name, "_SC_TZNAME_MAX"))
2520 #if defined(_SC_TZNAME_MAX) || HINT_SC_EXIST
2521 return _SC_TZNAME_MAX;
2525 if (strEQ(name, "_SC_VERSION"))
2526 #if defined(_SC_VERSION) || HINT_SC_EXIST
2542 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2545 new(packname = "POSIX::SigSet", ...)
2550 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2551 sigemptyset(RETVAL);
2552 for (i = 1; i < items; i++)
2553 sigaddset(RETVAL, SvIV(ST(i)));
2560 POSIX::SigSet sigset
2562 safefree((char *)sigset);
2565 sigaddset(sigset, sig)
2566 POSIX::SigSet sigset
2570 sigdelset(sigset, sig)
2571 POSIX::SigSet sigset
2576 POSIX::SigSet sigset
2580 POSIX::SigSet sigset
2583 sigismember(sigset, sig)
2584 POSIX::SigSet sigset
2588 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2591 new(packname = "POSIX::Termios", ...)
2596 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2598 not_here("termios");
2606 DESTROY(termios_ref)
2607 POSIX::Termios termios_ref
2610 safefree((char *)termios_ref);
2612 not_here("termios");
2616 getattr(termios_ref, fd = 0)
2617 POSIX::Termios termios_ref
2620 RETVAL = tcgetattr(fd, termios_ref);
2625 setattr(termios_ref, fd = 0, optional_actions = 0)
2626 POSIX::Termios termios_ref
2628 int optional_actions
2630 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2635 cfgetispeed(termios_ref)
2636 POSIX::Termios termios_ref
2639 cfgetospeed(termios_ref)
2640 POSIX::Termios termios_ref
2643 getiflag(termios_ref)
2644 POSIX::Termios termios_ref
2646 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2647 RETVAL = termios_ref->c_iflag;
2649 not_here("getiflag");
2656 getoflag(termios_ref)
2657 POSIX::Termios termios_ref
2659 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2660 RETVAL = termios_ref->c_oflag;
2662 not_here("getoflag");
2669 getcflag(termios_ref)
2670 POSIX::Termios termios_ref
2672 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2673 RETVAL = termios_ref->c_cflag;
2675 not_here("getcflag");
2682 getlflag(termios_ref)
2683 POSIX::Termios termios_ref
2685 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2686 RETVAL = termios_ref->c_lflag;
2688 not_here("getlflag");
2695 getcc(termios_ref, ccix)
2696 POSIX::Termios termios_ref
2699 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2701 croak("Bad getcc subscript");
2702 RETVAL = termios_ref->c_cc[ccix];
2711 cfsetispeed(termios_ref, speed)
2712 POSIX::Termios termios_ref
2716 cfsetospeed(termios_ref, speed)
2717 POSIX::Termios termios_ref
2721 setiflag(termios_ref, iflag)
2722 POSIX::Termios termios_ref
2725 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2726 termios_ref->c_iflag = iflag;
2728 not_here("setiflag");
2732 setoflag(termios_ref, oflag)
2733 POSIX::Termios termios_ref
2736 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2737 termios_ref->c_oflag = oflag;
2739 not_here("setoflag");
2743 setcflag(termios_ref, cflag)
2744 POSIX::Termios termios_ref
2747 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2748 termios_ref->c_cflag = cflag;
2750 not_here("setcflag");
2754 setlflag(termios_ref, lflag)
2755 POSIX::Termios termios_ref
2758 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2759 termios_ref->c_lflag = lflag;
2761 not_here("setlflag");
2765 setcc(termios_ref, ccix, cc)
2766 POSIX::Termios termios_ref
2770 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2772 croak("Bad setcc subscript");
2773 termios_ref->c_cc[ccix] = cc;
2779 MODULE = POSIX PACKAGE = POSIX
2788 unsigned char * charstring
2790 unsigned char *s = charstring;
2791 unsigned char *e = s + na; /* "na" set by typemap side effect */
2792 for (RETVAL = 1; RETVAL && s < e; s++)
2800 unsigned char * charstring
2802 unsigned char *s = charstring;
2803 unsigned char *e = s + na; /* "na" set by typemap side effect */
2804 for (RETVAL = 1; RETVAL && s < e; s++)
2812 unsigned char * charstring
2814 unsigned char *s = charstring;
2815 unsigned char *e = s + na; /* "na" set by typemap side effect */
2816 for (RETVAL = 1; RETVAL && s < e; s++)
2824 unsigned char * charstring
2826 unsigned char *s = charstring;
2827 unsigned char *e = s + na; /* "na" set by typemap side effect */
2828 for (RETVAL = 1; RETVAL && s < e; s++)
2836 unsigned char * charstring
2838 unsigned char *s = charstring;
2839 unsigned char *e = s + na; /* "na" set by typemap side effect */
2840 for (RETVAL = 1; RETVAL && s < e; s++)
2848 unsigned char * charstring
2850 unsigned char *s = charstring;
2851 unsigned char *e = s + na; /* "na" set by typemap side effect */
2852 for (RETVAL = 1; RETVAL && s < e; s++)
2860 unsigned char * charstring
2862 unsigned char *s = charstring;
2863 unsigned char *e = s + na; /* "na" set by typemap side effect */
2864 for (RETVAL = 1; RETVAL && s < e; s++)
2872 unsigned char * charstring
2874 unsigned char *s = charstring;
2875 unsigned char *e = s + na; /* "na" set by typemap side effect */
2876 for (RETVAL = 1; RETVAL && s < e; s++)
2884 unsigned char * charstring
2886 unsigned char *s = charstring;
2887 unsigned char *e = s + na; /* "na" set by typemap side effect */
2888 for (RETVAL = 1; RETVAL && s < e; s++)
2896 unsigned char * charstring
2898 unsigned char *s = charstring;
2899 unsigned char *e = s + na; /* "na" set by typemap side effect */
2900 for (RETVAL = 1; RETVAL && s < e; s++)
2907 isxdigit(charstring)
2908 unsigned char * charstring
2910 unsigned char *s = charstring;
2911 unsigned char *e = s + na; /* "na" set by typemap side effect */
2912 for (RETVAL = 1; RETVAL && s < e; s++)
2919 open(filename, flags = O_RDONLY, mode = 0666)
2924 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2925 TAINT_PROPER("open");
2926 RETVAL = open(filename, flags, mode);
2934 #ifdef HAS_LOCALECONV
2935 struct lconv *lcbuf;
2937 SET_NUMERIC_LOCAL();
2938 if (lcbuf = localeconv()) {
2940 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2941 hv_store(RETVAL, "decimal_point", 13,
2942 newSVpv(lcbuf->decimal_point, 0), 0);
2943 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2944 hv_store(RETVAL, "thousands_sep", 13,
2945 newSVpv(lcbuf->thousands_sep, 0), 0);
2946 if (lcbuf->grouping && *lcbuf->grouping)
2947 hv_store(RETVAL, "grouping", 8,
2948 newSVpv(lcbuf->grouping, 0), 0);
2949 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2950 hv_store(RETVAL, "int_curr_symbol", 15,
2951 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2952 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2953 hv_store(RETVAL, "currency_symbol", 15,
2954 newSVpv(lcbuf->currency_symbol, 0), 0);
2955 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2956 hv_store(RETVAL, "mon_decimal_point", 17,
2957 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2958 #ifndef NO_LOCALECONV_MON_THOUSANDS_SEP
2959 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2960 hv_store(RETVAL, "mon_thousands_sep", 17,
2961 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2963 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2964 hv_store(RETVAL, "mon_grouping", 12,
2965 newSVpv(lcbuf->mon_grouping, 0), 0);
2966 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2967 hv_store(RETVAL, "positive_sign", 13,
2968 newSVpv(lcbuf->positive_sign, 0), 0);
2969 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2970 hv_store(RETVAL, "negative_sign", 13,
2971 newSVpv(lcbuf->negative_sign, 0), 0);
2973 if (lcbuf->int_frac_digits != CHAR_MAX)
2974 hv_store(RETVAL, "int_frac_digits", 15,
2975 newSViv(lcbuf->int_frac_digits), 0);
2976 if (lcbuf->frac_digits != CHAR_MAX)
2977 hv_store(RETVAL, "frac_digits", 11,
2978 newSViv(lcbuf->frac_digits), 0);
2979 if (lcbuf->p_cs_precedes != CHAR_MAX)
2980 hv_store(RETVAL, "p_cs_precedes", 13,
2981 newSViv(lcbuf->p_cs_precedes), 0);
2982 if (lcbuf->p_sep_by_space != CHAR_MAX)
2983 hv_store(RETVAL, "p_sep_by_space", 14,
2984 newSViv(lcbuf->p_sep_by_space), 0);
2985 if (lcbuf->n_cs_precedes != CHAR_MAX)
2986 hv_store(RETVAL, "n_cs_precedes", 13,
2987 newSViv(lcbuf->n_cs_precedes), 0);
2988 if (lcbuf->n_sep_by_space != CHAR_MAX)
2989 hv_store(RETVAL, "n_sep_by_space", 14,
2990 newSViv(lcbuf->n_sep_by_space), 0);
2991 if (lcbuf->p_sign_posn != CHAR_MAX)
2992 hv_store(RETVAL, "p_sign_posn", 11,
2993 newSViv(lcbuf->p_sign_posn), 0);
2994 if (lcbuf->n_sign_posn != CHAR_MAX)
2995 hv_store(RETVAL, "n_sign_posn", 11,
2996 newSViv(lcbuf->n_sign_posn), 0);
2999 localeconv(); /* A stub to call not_here(). */
3005 setlocale(category, locale = 0)
3009 RETVAL = setlocale(category, locale);
3011 #ifdef USE_LOCALE_CTYPE
3012 if (category == LC_CTYPE
3014 || category == LC_ALL
3020 if (category == LC_ALL)
3021 newctype = setlocale(LC_CTYPE, NULL);
3025 perl_new_ctype(newctype);
3027 #endif /* USE_LOCALE_CTYPE */
3028 #ifdef USE_LOCALE_COLLATE
3029 if (category == LC_COLLATE
3031 || category == LC_ALL
3037 if (category == LC_ALL)
3038 newcoll = setlocale(LC_COLLATE, NULL);
3042 perl_new_collate(newcoll);
3044 #endif /* USE_LOCALE_COLLATE */
3045 #ifdef USE_LOCALE_NUMERIC
3046 if (category == LC_NUMERIC
3048 || category == LC_ALL
3054 if (category == LC_ALL)
3055 newnum = setlocale(LC_NUMERIC, NULL);
3059 perl_new_numeric(newnum);
3061 #endif /* USE_LOCALE_NUMERIC */
3101 /* (We already know stack is long enough.) */
3102 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3103 PUSHs(sv_2mortal(newSViv(expvar)));
3119 /* (We already know stack is long enough.) */
3120 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3121 PUSHs(sv_2mortal(newSVnv(intvar)));
3136 sigaction(sig, action, oldaction = 0)
3138 POSIX::SigAction action
3139 POSIX::SigAction oldaction
3142 RETVAL = not_here("sigaction");
3144 # This code is really grody because we're trying to make the signal
3145 # interface look beautiful, which is hard.
3148 gv_fetchpv("SIG", TRUE, SVt_PVHV);
3151 struct sigaction act;
3152 struct sigaction oact;
3153 POSIX__SigSet sigset;
3155 SV** sigsvp = hv_fetch(GvHVn(siggv),
3157 strlen(sig_name[sig]),
3160 /* Remember old handler name if desired. */
3162 char *hand = SvPVx(*sigsvp, na);
3163 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
3164 sv_setpv(*svp, *hand ? hand : "DEFAULT");
3168 /* Vector new handler through %SIG. (We always use sighandler
3169 for the C signal handler, which reads %SIG to dispatch.) */
3170 svp = hv_fetch(action, "HANDLER", 7, FALSE);
3172 croak("Can't supply an action without a HANDLER");
3173 sv_setpv(*sigsvp, SvPV(*svp, na));
3174 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
3175 act.sa_handler = sighandler;
3177 /* Set up any desired mask. */
3178 svp = hv_fetch(action, "MASK", 4, FALSE);
3179 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
3181 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3182 sigset = (sigset_t*) tmp;
3183 act.sa_mask = *sigset;
3186 sigemptyset(& act.sa_mask);
3188 /* Set up any desired flags. */
3189 svp = hv_fetch(action, "FLAGS", 5, FALSE);
3190 act.sa_flags = svp ? SvIV(*svp) : 0;
3193 /* Now work around sigaction oddities */
3194 if (action && oldaction)
3195 RETVAL = sigaction(sig, & act, & oact);
3197 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3199 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3204 /* Get back the mask. */
3205 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
3206 if (sv_isa(*svp, "POSIX::SigSet")) {
3208 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3209 sigset = (sigset_t*) tmp;
3212 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
3213 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
3215 *sigset = oact.sa_mask;
3217 /* Get back the flags. */
3218 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
3219 sv_setiv(*svp, oact.sa_flags);
3228 POSIX::SigSet sigset
3231 sigprocmask(how, sigset, oldsigset = 0)
3233 POSIX::SigSet sigset
3234 POSIX::SigSet oldsigset
3237 sigsuspend(signal_mask)
3238 POSIX::SigSet signal_mask
3258 lseek(fd, offset, whence)
3271 if (pipe(fds) != -1) {
3273 PUSHs(sv_2mortal(newSViv(fds[0])));
3274 PUSHs(sv_2mortal(newSViv(fds[1])));
3278 read(fd, buffer, nbytes)
3280 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3284 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3287 SvCUR(sv_buffer) = RETVAL;
3288 SvPOK_only(sv_buffer);
3289 *SvEND(sv_buffer) = '\0';
3290 SvTAINTED_on(sv_buffer);
3306 tcsetpgrp(fd, pgrp_id)
3315 if (uname(&buf) >= 0) {
3317 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3318 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3319 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3320 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3321 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3324 uname((char *) 0); /* A stub to call not_here(). */
3328 write(fd, buffer, nbytes)
3346 mbstowcs(s, pwcs, n)
3358 wcstombs(s, pwcs, n)
3380 SET_NUMERIC_LOCAL();
3381 num = strtod(str, &unparsed);
3382 PUSHs(sv_2mortal(newSVnv(num)));
3383 if (GIMME == G_ARRAY) {
3386 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3392 strtol(str, base = 0)
3399 num = strtol(str, &unparsed, base);
3400 if (num >= IV_MIN && num <= IV_MAX)
3401 PUSHs(sv_2mortal(newSViv((IV)num)));
3403 PUSHs(sv_2mortal(newSVnv((double)num)));
3404 if (GIMME == G_ARRAY) {
3407 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3413 strtoul(str, base = 0)
3420 num = strtoul(str, &unparsed, base);
3422 PUSHs(sv_2mortal(newSViv((IV)num)));
3424 PUSHs(sv_2mortal(newSVnv((double)num)));
3425 if (GIMME == G_ARRAY) {
3428 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3440 char *p = SvPV(src,srclen);
3442 ST(0) = sv_2mortal(NEWSV(800,srclen));
3443 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3444 if (dstlen > srclen) {
3446 SvGROW(ST(0), dstlen);
3447 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3450 SvCUR(ST(0)) = dstlen;
3455 mkfifo(filename, mode)
3459 TAINT_PROPER("mkfifo");
3460 RETVAL = mkfifo(filename, mode);
3476 tcflush(fd, queue_selector)
3481 tcsendbreak(fd, duration)
3486 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3499 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3502 mytm.tm_hour = hour;
3503 mytm.tm_mday = mday;
3505 mytm.tm_year = year;
3506 mytm.tm_wday = wday;
3507 mytm.tm_yday = yday;
3508 mytm.tm_isdst = isdst;
3509 RETVAL = asctime(&mytm);
3526 realtime = times( &tms );
3528 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
3529 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
3530 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
3531 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) );
3532 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) );
3535 difftime(time1, time2)
3540 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3553 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3556 mytm.tm_hour = hour;
3557 mytm.tm_mday = mday;
3559 mytm.tm_year = year;
3560 mytm.tm_wday = wday;
3561 mytm.tm_yday = yday;
3562 mytm.tm_isdst = isdst;
3563 RETVAL = mktime(&mytm);
3569 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3585 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3588 mytm.tm_hour = hour;
3589 mytm.tm_mday = mday;
3591 mytm.tm_year = year;
3592 mytm.tm_wday = wday;
3593 mytm.tm_yday = yday;
3594 mytm.tm_isdst = isdst;
3595 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3596 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3606 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3607 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3610 access(filename, mode)
3628 pathconf(filename, name)