5 #define PERLIO_NOT_STDIO 1
8 #ifdef PERL_OBJECT /* XXX _very_ temporary hacks */
12 # define open PerlLIO_open3
14 # define TAINT_PROPER(a)
17 #ifdef I_DIRENT /* XXX maybe better to just rely on perl.h? */
40 /* XXX This comment is just to make I_TERMIO and I_SGTTY visible to
41 metaconfig for future extension writers. We don't use them in POSIX.
42 (This is really sneaky :-) --AD
44 #if defined(I_TERMIOS)
52 #include <sys/types.h>
59 #if defined(__VMS) && !defined(__POSIX_SOURCE)
60 # include <libdef.h> /* LIB$_INVARG constant */
61 # include <lib$routines.h> /* prototype for lib$ediv() */
62 # include <starlet.h> /* prototype for sys$gettim() */
63 # if DECC_VERSION < 50000000
64 # define pid_t int /* old versions of DECC miss this in types.h */
68 # define mkfifo(a,b) (not_here("mkfifo"),-1)
69 # define tzset() not_here("tzset")
71 #if ((__VMS_VER >= 70000000) && (__DECC_VER >= 50200000)) || (__CRTL_VER >= 70000000)
72 # define HAS_TZNAME /* shows up in VMS 7.0 or Dec C 5.6 */
74 # endif /* __VMS_VER >= 70000000 or Dec C 5.6 */
76 /* The POSIX notion of ttyname() is better served by getname() under VMS */
77 static char ttnambuf[64];
78 # define ttyname(fd) (isatty(fd) > 0 ? getname(fd,ttnambuf,0) : NULL)
80 /* The non-POSIX CRTL times() has void return type, so we just get the
81 current time directly */
82 clock_t vms_times(struct tms *PL_bufptr) {
84 /* Get wall time and convert to 10 ms intervals to
85 * produce the return value that the POSIX standard expects */
86 # if defined(__DECC) && defined (__ALPHA)
89 _ckvmssts(sys$gettim(&vmstime));
91 retval = vmstime & 0x7fffffff;
93 /* (Older hw or ccs don't have an atomic 64-bit type, so we
94 * juggle 32-bit ints (and a float) to produce a time_t result
95 * with minimal loss of information.) */
96 long int vmstime[2],remainder,divisor = 100000;
97 _ckvmssts(sys$gettim((unsigned long int *)vmstime));
98 vmstime[1] &= 0x7fff; /* prevent overflow in EDIV */
99 _ckvmssts(lib$ediv(&divisor,vmstime,(long int *)&retval,&remainder));
101 /* Fill in the struct tms using the CRTL routine . . .*/
102 times((tbuffer_t *)PL_bufptr);
103 return (clock_t) retval;
105 # define times(t) vms_times(t)
109 # define mkfifo(a,b) not_here("mkfifo")
110 # define ttyname(a) (char*)not_here("ttyname")
111 # define sigset_t long
114 # define tzname _tzname
117 # define mode_t short
120 # define mode_t short
122 # define tzset() not_here("tzset")
124 # ifndef _POSIX_OPEN_MAX
125 # define _POSIX_OPEN_MAX FOPEN_MAX /* XXX bogus ? */
128 # define sigaction(a,b,c) not_here("sigaction")
129 # define sigpending(a) not_here("sigpending")
130 # define sigprocmask(a,b,c) not_here("sigprocmask")
131 # define sigsuspend(a) not_here("sigsuspend")
132 # define sigemptyset(a) not_here("sigemptyset")
133 # define sigaddset(a,b) not_here("sigaddset")
134 # define sigdelset(a,b) not_here("sigdelset")
135 # define sigfillset(a) not_here("sigfillset")
136 # define sigismember(a,b) not_here("sigismember")
141 # define mkfifo(path, mode) (mknod((path), (mode) | S_IFIFO, 0))
143 # endif /* !HAS_MKFIFO */
146 # include <sys/times.h>
148 # include <sys/utsname.h>
150 # include <sys/wait.h>
158 typedef long SysRetLong;
159 typedef sigset_t* POSIX__SigSet;
160 typedef HV* POSIX__SigAction;
162 typedef struct termios* POSIX__Termios;
163 #else /* Define termios types to int, and call not_here for the functions.*/
164 #define POSIX__Termios int
168 #define cfgetispeed(x) not_here("cfgetispeed")
169 #define cfgetospeed(x) not_here("cfgetospeed")
170 #define tcdrain(x) not_here("tcdrain")
171 #define tcflush(x,y) not_here("tcflush")
172 #define tcsendbreak(x,y) not_here("tcsendbreak")
173 #define cfsetispeed(x,y) not_here("cfsetispeed")
174 #define cfsetospeed(x,y) not_here("cfsetospeed")
175 #define ctermid(x) (char *) not_here("ctermid")
176 #define tcflow(x,y) not_here("tcflow")
177 #define tcgetattr(x,y) not_here("tcgetattr")
178 #define tcsetattr(x,y,z) not_here("tcsetattr")
181 /* Possibly needed prototypes */
182 char *cuserid _((char *));
183 double strtod _((const char *, char **));
184 long strtol _((const char *, char **, int));
185 unsigned long strtoul _((const char *, char **, int));
188 #define cuserid(a) (char *) not_here("cuserid")
192 #define difftime(a,b) not_here("difftime")
195 #ifndef HAS_FPATHCONF
196 #define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
199 #define mktime(a) not_here("mktime")
202 #define nice(a) not_here("nice")
205 #define pathconf(f,n) (SysRetLong) not_here("pathconf")
208 #define sysconf(n) (SysRetLong) not_here("sysconf")
211 #define readlink(a,b,c) not_here("readlink")
214 #define setpgid(a,b) not_here("setpgid")
217 #define setsid() not_here("setsid")
220 #define strcoll(s1,s2) not_here("strcoll")
223 #define strtod(s1,s2) not_here("strtod")
226 #define strtol(s1,s2,b) not_here("strtol")
229 #define strtoul(s1,s2,b) not_here("strtoul")
232 #define strxfrm(s1,s2,n) not_here("strxfrm")
234 #ifndef HAS_TCGETPGRP
235 #define tcgetpgrp(a) not_here("tcgetpgrp")
237 #ifndef HAS_TCSETPGRP
238 #define tcsetpgrp(a,b) not_here("tcsetpgrp")
241 #define times(a) not_here("times")
244 #define uname(a) not_here("uname")
247 #define waitpid(a,b,c) not_here("waitpid")
252 #define mblen(a,b) not_here("mblen")
256 #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
259 #define mbtowc(pwc, s, n) not_here("mbtowc")
262 #define wcstombs(s, pwcs, n) not_here("wcstombs")
265 #define wctomb(s, wchar) not_here("wcstombs")
267 #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
268 /* If we don't have these functions, then we wouldn't have gotten a typedef
269 for wchar_t, the wide character type. Defining wchar_t allows the
270 functions referencing it to compile. Its actual type is then meaningless,
271 since without the above functions, all sections using it end up calling
272 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
278 #ifndef HAS_LOCALECONV
279 #define localeconv() not_here("localeconv")
284 extern char *tzname[];
287 #if !defined(WIN32) || (defined(__MINGW32__) && !defined(tzname))
288 char *tzname[] = { "" , "" };
292 /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX)
293 * fields for which we don't have Configure support yet:
294 * char *tm_zone; -- abbreviation of timezone name
295 * long tm_gmtoff; -- offset from GMT in seconds
296 * To workaround core dumps from the uninitialised tm_zone we get the
297 * system to give us a reasonable struct to copy. This fix means that
298 * strftime uses the tm_zone and tm_gmtoff values returned by
299 * localtime(time()). That should give the desired result most of the
300 * time. But probably not always!
302 * This is a temporary workaround to be removed once Configure
303 * support is added and NETaa14816 is considered in full.
304 * It does not address tzname aspects of NETaa14816.
307 # ifndef STRUCT_TM_HASZONE
308 # define STRUCT_TM_HAS_ZONE
312 #ifdef STRUCT_TM_HASZONE
314 init_tm(ptm) /* see mktime, strftime and asctime */
319 Copy(localtime(&now), ptm, 1, struct tm);
323 # define init_tm(ptm)
327 #ifdef HAS_LONG_DOUBLE
328 # if LONG_DOUBLESIZE > DOUBLESIZE
329 # undef HAS_LONG_DOUBLE /* XXX until we figure out how to use them */
333 #ifndef HAS_LONG_DOUBLE
348 croak("POSIX::%s not implemented on this architecture", s);
353 #ifdef HAS_LONG_DOUBLE
358 constant(char *name, int arg)
363 if (strEQ(name, "ARG_MAX"))
371 if (strEQ(name, "BUFSIZ"))
377 if (strEQ(name, "BRKINT"))
383 if (strEQ(name, "B9600"))
389 if (strEQ(name, "B19200"))
395 if (strEQ(name, "B38400"))
401 if (strEQ(name, "B0"))
407 if (strEQ(name, "B110"))
413 if (strEQ(name, "B1200"))
419 if (strEQ(name, "B134"))
425 if (strEQ(name, "B150"))
431 if (strEQ(name, "B1800"))
437 if (strEQ(name, "B200"))
443 if (strEQ(name, "B2400"))
449 if (strEQ(name, "B300"))
455 if (strEQ(name, "B4800"))
461 if (strEQ(name, "B50"))
467 if (strEQ(name, "B600"))
473 if (strEQ(name, "B75"))
481 if (strEQ(name, "CHAR_BIT"))
487 if (strEQ(name, "CHAR_MAX"))
493 if (strEQ(name, "CHAR_MIN"))
499 if (strEQ(name, "CHILD_MAX"))
505 if (strEQ(name, "CLK_TCK"))
511 if (strEQ(name, "CLOCAL"))
517 if (strEQ(name, "CLOCKS_PER_SEC"))
518 #ifdef CLOCKS_PER_SEC
519 return CLOCKS_PER_SEC;
523 if (strEQ(name, "CREAD"))
529 if (strEQ(name, "CS5"))
535 if (strEQ(name, "CS6"))
541 if (strEQ(name, "CS7"))
547 if (strEQ(name, "CS8"))
553 if (strEQ(name, "CSIZE"))
559 if (strEQ(name, "CSTOPB"))
567 if (strEQ(name, "DBL_MAX"))
573 if (strEQ(name, "DBL_MIN"))
579 if (strEQ(name, "DBL_DIG"))
585 if (strEQ(name, "DBL_EPSILON"))
591 if (strEQ(name, "DBL_MANT_DIG"))
597 if (strEQ(name, "DBL_MAX_10_EXP"))
598 #ifdef DBL_MAX_10_EXP
599 return DBL_MAX_10_EXP;
603 if (strEQ(name, "DBL_MAX_EXP"))
609 if (strEQ(name, "DBL_MIN_10_EXP"))
610 #ifdef DBL_MIN_10_EXP
611 return DBL_MIN_10_EXP;
615 if (strEQ(name, "DBL_MIN_EXP"))
625 if (strEQ(name, "EACCES"))
631 if (strEQ(name, "EADDRINUSE"))
637 if (strEQ(name, "EADDRNOTAVAIL"))
639 return EADDRNOTAVAIL;
643 if (strEQ(name, "EAFNOSUPPORT"))
649 if (strEQ(name, "EAGAIN"))
655 if (strEQ(name, "EALREADY"))
663 if (strEQ(name, "EBADF"))
669 if (strEQ(name, "EBUSY"))
677 if (strEQ(name, "ECHILD"))
683 if (strEQ(name, "ECHO"))
689 if (strEQ(name, "ECHOE"))
695 if (strEQ(name, "ECHOK"))
701 if (strEQ(name, "ECHONL"))
707 if (strEQ(name, "ECONNABORTED"))
713 if (strEQ(name, "ECONNREFUSED"))
719 if (strEQ(name, "ECONNRESET"))
727 if (strEQ(name, "EDEADLK"))
733 if (strEQ(name, "EDESTADDRREQ"))
739 if (strEQ(name, "EDOM"))
745 if (strEQ(name, "EDQUOT"))
753 if (strEQ(name, "EEXIST"))
761 if (strEQ(name, "EFAULT"))
767 if (strEQ(name, "EFBIG"))
775 if (strEQ(name, "EHOSTDOWN"))
781 if (strEQ(name, "EHOSTUNREACH"))
789 if (strEQ(name, "EINPROGRESS"))
795 if (strEQ(name, "EINTR"))
801 if (strEQ(name, "EINVAL"))
807 if (strEQ(name, "EIO"))
813 if (strEQ(name, "EISCONN"))
819 if (strEQ(name, "EISDIR"))
825 if (strEQ(name, "ELOOP"))
833 if (strEQ(name, "EMFILE"))
839 if (strEQ(name, "EMLINK"))
845 if (strEQ(name, "EMSGSIZE"))
853 if (strEQ(name, "ENETDOWN"))
859 if (strEQ(name, "ENETRESET"))
865 if (strEQ(name, "ENETUNREACH"))
871 if (strEQ(name, "ENOBUFS"))
877 if (strEQ(name, "ENOEXEC"))
883 if (strEQ(name, "ENOMEM"))
889 if (strEQ(name, "ENOPROTOOPT"))
895 if (strEQ(name, "ENOSPC"))
901 if (strEQ(name, "ENOTBLK"))
907 if (strEQ(name, "ENOTCONN"))
913 if (strEQ(name, "ENOTDIR"))
919 if (strEQ(name, "ENOTEMPTY"))
925 if (strEQ(name, "ENOTSOCK"))
931 if (strEQ(name, "ENOTTY"))
937 if (strEQ(name, "ENFILE"))
943 if (strEQ(name, "ENODEV"))
949 if (strEQ(name, "ENOENT"))
955 if (strEQ(name, "ENOLCK"))
961 if (strEQ(name, "ENOSYS"))
967 if (strEQ(name, "ENXIO"))
973 if (strEQ(name, "ENAMETOOLONG"))
981 if (strEQ(name, "EOF"))
987 if (strEQ(name, "EOPNOTSUPP"))
995 if (strEQ(name, "EPERM"))
1001 if (strEQ(name, "EPFNOSUPPORT"))
1003 return EPFNOSUPPORT;
1007 if (strEQ(name, "EPIPE"))
1013 if (strEQ(name, "EPROCLIM"))
1019 if (strEQ(name, "EPROTONOSUPPORT"))
1020 #ifdef EPROTONOSUPPORT
1021 return EPROTONOSUPPORT;
1025 if (strEQ(name, "EPROTOTYPE"))
1033 if (strEQ(name, "ERANGE"))
1039 if (strEQ(name, "EREMOTE"))
1045 if (strEQ(name, "ERESTART"))
1051 if (strEQ(name, "EROFS"))
1059 if (strEQ(name, "ESHUTDOWN"))
1065 if (strEQ(name, "ESOCKTNOSUPPORT"))
1066 #ifdef ESOCKTNOSUPPORT
1067 return ESOCKTNOSUPPORT;
1071 if (strEQ(name, "ESPIPE"))
1077 if (strEQ(name, "ESRCH"))
1083 if (strEQ(name, "ESTALE"))
1091 if (strEQ(name, "ETIMEDOUT"))
1097 if (strEQ(name, "ETOOMANYREFS"))
1099 return ETOOMANYREFS;
1103 if (strEQ(name, "ETXTBSY"))
1111 if (strEQ(name, "EUSERS"))
1119 if (strEQ(name, "EWOULDBLOCK"))
1127 if (strEQ(name, "EXIT_FAILURE"))
1129 return EXIT_FAILURE;
1133 if (strEQ(name, "EXIT_SUCCESS"))
1135 return EXIT_SUCCESS;
1139 if (strEQ(name, "EXDEV"))
1147 if (strEQ(name, "E2BIG"))
1155 if (strnEQ(name, "FLT_", 4)) {
1156 if (strEQ(name, "FLT_MAX"))
1162 if (strEQ(name, "FLT_MIN"))
1168 if (strEQ(name, "FLT_ROUNDS"))
1174 if (strEQ(name, "FLT_DIG"))
1180 if (strEQ(name, "FLT_EPSILON"))
1186 if (strEQ(name, "FLT_MANT_DIG"))
1188 return FLT_MANT_DIG;
1192 if (strEQ(name, "FLT_MAX_10_EXP"))
1193 #ifdef FLT_MAX_10_EXP
1194 return FLT_MAX_10_EXP;
1198 if (strEQ(name, "FLT_MAX_EXP"))
1204 if (strEQ(name, "FLT_MIN_10_EXP"))
1205 #ifdef FLT_MIN_10_EXP
1206 return FLT_MIN_10_EXP;
1210 if (strEQ(name, "FLT_MIN_EXP"))
1216 if (strEQ(name, "FLT_RADIX"))
1224 if (strnEQ(name, "F_", 2)) {
1225 if (strEQ(name, "F_DUPFD"))
1231 if (strEQ(name, "F_GETFD"))
1237 if (strEQ(name, "F_GETFL"))
1243 if (strEQ(name, "F_GETLK"))
1249 if (strEQ(name, "F_OK"))
1255 if (strEQ(name, "F_RDLCK"))
1261 if (strEQ(name, "F_SETFD"))
1267 if (strEQ(name, "F_SETFL"))
1273 if (strEQ(name, "F_SETLK"))
1279 if (strEQ(name, "F_SETLKW"))
1285 if (strEQ(name, "F_UNLCK"))
1291 if (strEQ(name, "F_WRLCK"))
1299 if (strEQ(name, "FD_CLOEXEC"))
1305 if (strEQ(name, "FILENAME_MAX"))
1307 return FILENAME_MAX;
1313 if (strEQ(name, "HUGE_VAL"))
1319 if (strEQ(name, "HUPCL"))
1327 if (strEQ(name, "INT_MAX"))
1333 if (strEQ(name, "INT_MIN"))
1339 if (strEQ(name, "ICANON"))
1345 if (strEQ(name, "ICRNL"))
1351 if (strEQ(name, "IEXTEN"))
1357 if (strEQ(name, "IGNBRK"))
1363 if (strEQ(name, "IGNCR"))
1369 if (strEQ(name, "IGNPAR"))
1375 if (strEQ(name, "INLCR"))
1381 if (strEQ(name, "INPCK"))
1387 if (strEQ(name, "ISIG"))
1393 if (strEQ(name, "ISTRIP"))
1399 if (strEQ(name, "IXOFF"))
1405 if (strEQ(name, "IXON"))
1413 if (strnEQ(name, "LC_", 3)) {
1414 if (strEQ(name, "LC_ALL"))
1420 if (strEQ(name, "LC_COLLATE"))
1426 if (strEQ(name, "LC_CTYPE"))
1432 if (strEQ(name, "LC_MONETARY"))
1438 if (strEQ(name, "LC_NUMERIC"))
1444 if (strEQ(name, "LC_TIME"))
1452 if (strnEQ(name, "LDBL_", 5)) {
1453 if (strEQ(name, "LDBL_MAX"))
1459 if (strEQ(name, "LDBL_MIN"))
1465 if (strEQ(name, "LDBL_DIG"))
1471 if (strEQ(name, "LDBL_EPSILON"))
1473 return LDBL_EPSILON;
1477 if (strEQ(name, "LDBL_MANT_DIG"))
1478 #ifdef LDBL_MANT_DIG
1479 return LDBL_MANT_DIG;
1483 if (strEQ(name, "LDBL_MAX_10_EXP"))
1484 #ifdef LDBL_MAX_10_EXP
1485 return LDBL_MAX_10_EXP;
1489 if (strEQ(name, "LDBL_MAX_EXP"))
1491 return LDBL_MAX_EXP;
1495 if (strEQ(name, "LDBL_MIN_10_EXP"))
1496 #ifdef LDBL_MIN_10_EXP
1497 return LDBL_MIN_10_EXP;
1501 if (strEQ(name, "LDBL_MIN_EXP"))
1503 return LDBL_MIN_EXP;
1509 if (strnEQ(name, "L_", 2)) {
1510 if (strEQ(name, "L_ctermid"))
1516 if (strEQ(name, "L_cuserid"))
1522 if (strEQ(name, "L_tmpname"))
1530 if (strEQ(name, "LONG_MAX"))
1536 if (strEQ(name, "LONG_MIN"))
1542 if (strEQ(name, "LINK_MAX"))
1550 if (strEQ(name, "MAX_CANON"))
1556 if (strEQ(name, "MAX_INPUT"))
1562 if (strEQ(name, "MB_CUR_MAX"))
1568 if (strEQ(name, "MB_LEN_MAX"))
1576 if (strEQ(name, "NULL")) return 0;
1577 if (strEQ(name, "NAME_MAX"))
1583 if (strEQ(name, "NCCS"))
1589 if (strEQ(name, "NGROUPS_MAX"))
1595 if (strEQ(name, "NOFLSH"))
1603 if (strnEQ(name, "O_", 2)) {
1604 if (strEQ(name, "O_APPEND"))
1610 if (strEQ(name, "O_CREAT"))
1616 if (strEQ(name, "O_TRUNC"))
1622 if (strEQ(name, "O_RDONLY"))
1628 if (strEQ(name, "O_RDWR"))
1634 if (strEQ(name, "O_WRONLY"))
1640 if (strEQ(name, "O_EXCL"))
1646 if (strEQ(name, "O_NOCTTY"))
1652 if (strEQ(name, "O_NONBLOCK"))
1658 if (strEQ(name, "O_ACCMODE"))
1666 if (strEQ(name, "OPEN_MAX"))
1672 if (strEQ(name, "OPOST"))
1680 if (strEQ(name, "PATH_MAX"))
1686 if (strEQ(name, "PARENB"))
1692 if (strEQ(name, "PARMRK"))
1698 if (strEQ(name, "PARODD"))
1704 if (strEQ(name, "PIPE_BUF"))
1712 if (strEQ(name, "RAND_MAX"))
1718 if (strEQ(name, "R_OK"))
1726 if (strnEQ(name, "SIG", 3)) {
1727 if (name[3] == '_') {
1728 if (strEQ(name, "SIG_BLOCK"))
1735 if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
1738 if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
1741 if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
1743 if (strEQ(name, "SIG_SETMASK"))
1749 if (strEQ(name, "SIG_UNBLOCK"))
1757 if (strEQ(name, "SIGABRT"))
1763 if (strEQ(name, "SIGALRM"))
1769 if (strEQ(name, "SIGCHLD"))
1775 if (strEQ(name, "SIGCONT"))
1781 if (strEQ(name, "SIGFPE"))
1787 if (strEQ(name, "SIGHUP"))
1793 if (strEQ(name, "SIGILL"))
1799 if (strEQ(name, "SIGINT"))
1805 if (strEQ(name, "SIGKILL"))
1811 if (strEQ(name, "SIGPIPE"))
1817 if (strEQ(name, "SIGQUIT"))
1823 if (strEQ(name, "SIGSEGV"))
1829 if (strEQ(name, "SIGSTOP"))
1835 if (strEQ(name, "SIGTERM"))
1841 if (strEQ(name, "SIGTSTP"))
1847 if (strEQ(name, "SIGTTIN"))
1853 if (strEQ(name, "SIGTTOU"))
1859 if (strEQ(name, "SIGUSR1"))
1865 if (strEQ(name, "SIGUSR2"))
1873 if (name[1] == '_') {
1874 if (strEQ(name, "S_ISGID"))
1880 if (strEQ(name, "S_ISUID"))
1886 if (strEQ(name, "S_IRGRP"))
1892 if (strEQ(name, "S_IROTH"))
1898 if (strEQ(name, "S_IRUSR"))
1904 if (strEQ(name, "S_IRWXG"))
1910 if (strEQ(name, "S_IRWXO"))
1916 if (strEQ(name, "S_IRWXU"))
1922 if (strEQ(name, "S_IWGRP"))
1928 if (strEQ(name, "S_IWOTH"))
1934 if (strEQ(name, "S_IWUSR"))
1940 if (strEQ(name, "S_IXGRP"))
1946 if (strEQ(name, "S_IXOTH"))
1952 if (strEQ(name, "S_IXUSR"))
1958 errno = EAGAIN; /* the following aren't constants */
1960 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1963 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1966 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1969 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1972 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1976 if (strEQ(name, "SEEK_CUR"))
1982 if (strEQ(name, "SEEK_END"))
1988 if (strEQ(name, "SEEK_SET"))
1994 if (strEQ(name, "STREAM_MAX"))
2000 if (strEQ(name, "SHRT_MAX"))
2006 if (strEQ(name, "SHRT_MIN"))
2012 if (strnEQ(name, "SA_", 3)) {
2013 if (strEQ(name, "SA_NOCLDSTOP"))
2015 return SA_NOCLDSTOP;
2019 if (strEQ(name, "SA_NOCLDWAIT"))
2021 return SA_NOCLDWAIT;
2025 if (strEQ(name, "SA_NODEFER"))
2031 if (strEQ(name, "SA_ONSTACK"))
2037 if (strEQ(name, "SA_RESETHAND"))
2039 return SA_RESETHAND;
2043 if (strEQ(name, "SA_RESTART"))
2049 if (strEQ(name, "SA_SIGINFO"))
2057 if (strEQ(name, "SCHAR_MAX"))
2063 if (strEQ(name, "SCHAR_MIN"))
2069 if (strEQ(name, "SSIZE_MAX"))
2075 if (strEQ(name, "STDIN_FILENO"))
2077 return STDIN_FILENO;
2081 if (strEQ(name, "STDOUT_FILENO"))
2082 #ifdef STDOUT_FILENO
2083 return STDOUT_FILENO;
2087 if (strEQ(name, "STRERR_FILENO"))
2088 #ifdef STRERR_FILENO
2089 return STRERR_FILENO;
2095 if (strEQ(name, "TCIFLUSH"))
2101 if (strEQ(name, "TCIOFF"))
2107 if (strEQ(name, "TCIOFLUSH"))
2113 if (strEQ(name, "TCION"))
2119 if (strEQ(name, "TCOFLUSH"))
2125 if (strEQ(name, "TCOOFF"))
2131 if (strEQ(name, "TCOON"))
2137 if (strEQ(name, "TCSADRAIN"))
2143 if (strEQ(name, "TCSAFLUSH"))
2149 if (strEQ(name, "TCSANOW"))
2155 if (strEQ(name, "TMP_MAX"))
2161 if (strEQ(name, "TOSTOP"))
2167 if (strEQ(name, "TZNAME_MAX"))
2175 if (strEQ(name, "UCHAR_MAX"))
2181 if (strEQ(name, "UINT_MAX"))
2187 if (strEQ(name, "ULONG_MAX"))
2193 if (strEQ(name, "USHRT_MAX"))
2201 if (strEQ(name, "VEOF"))
2207 if (strEQ(name, "VEOL"))
2213 if (strEQ(name, "VERASE"))
2219 if (strEQ(name, "VINTR"))
2225 if (strEQ(name, "VKILL"))
2231 if (strEQ(name, "VMIN"))
2237 if (strEQ(name, "VQUIT"))
2243 if (strEQ(name, "VSTART"))
2249 if (strEQ(name, "VSTOP"))
2255 if (strEQ(name, "VSUSP"))
2261 if (strEQ(name, "VTIME"))
2269 if (strEQ(name, "W_OK"))
2275 if (strEQ(name, "WNOHANG"))
2281 if (strEQ(name, "WUNTRACED"))
2287 errno = EAGAIN; /* the following aren't constants */
2289 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2292 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2295 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2298 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2301 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2304 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2308 if (strEQ(name, "X_OK"))
2316 if (strnEQ(name, "_PC_", 4)) {
2317 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2318 #if defined(_PC_CHOWN_RESTRICTED) || HINT_SC_EXIST
2319 return _PC_CHOWN_RESTRICTED;
2323 if (strEQ(name, "_PC_LINK_MAX"))
2324 #if defined(_PC_LINK_MAX) || HINT_SC_EXIST
2325 return _PC_LINK_MAX;
2329 if (strEQ(name, "_PC_MAX_CANON"))
2330 #if defined(_PC_MAX_CANON) || HINT_SC_EXIST
2331 return _PC_MAX_CANON;
2335 if (strEQ(name, "_PC_MAX_INPUT"))
2336 #if defined(_PC_MAX_INPUT) || HINT_SC_EXIST
2337 return _PC_MAX_INPUT;
2341 if (strEQ(name, "_PC_NAME_MAX"))
2342 #if defined(_PC_NAME_MAX) || HINT_SC_EXIST
2343 return _PC_NAME_MAX;
2347 if (strEQ(name, "_PC_NO_TRUNC"))
2348 #if defined(_PC_NO_TRUNC) || HINT_SC_EXIST
2349 return _PC_NO_TRUNC;
2353 if (strEQ(name, "_PC_PATH_MAX"))
2354 #if defined(_PC_PATH_MAX) || HINT_SC_EXIST
2355 return _PC_PATH_MAX;
2359 if (strEQ(name, "_PC_PIPE_BUF"))
2360 #if defined(_PC_PIPE_BUF) || HINT_SC_EXIST
2361 return _PC_PIPE_BUF;
2365 if (strEQ(name, "_PC_VDISABLE"))
2366 #if defined(_PC_VDISABLE) || HINT_SC_EXIST
2367 return _PC_VDISABLE;
2373 if (strnEQ(name, "_POSIX_", 7)) {
2374 if (strEQ(name, "_POSIX_ARG_MAX"))
2375 #ifdef _POSIX_ARG_MAX
2376 return _POSIX_ARG_MAX;
2380 if (strEQ(name, "_POSIX_CHILD_MAX"))
2381 #ifdef _POSIX_CHILD_MAX
2382 return _POSIX_CHILD_MAX;
2386 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2387 #ifdef _POSIX_CHOWN_RESTRICTED
2388 return _POSIX_CHOWN_RESTRICTED;
2392 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2393 #ifdef _POSIX_JOB_CONTROL
2394 return _POSIX_JOB_CONTROL;
2398 if (strEQ(name, "_POSIX_LINK_MAX"))
2399 #ifdef _POSIX_LINK_MAX
2400 return _POSIX_LINK_MAX;
2404 if (strEQ(name, "_POSIX_MAX_CANON"))
2405 #ifdef _POSIX_MAX_CANON
2406 return _POSIX_MAX_CANON;
2410 if (strEQ(name, "_POSIX_MAX_INPUT"))
2411 #ifdef _POSIX_MAX_INPUT
2412 return _POSIX_MAX_INPUT;
2416 if (strEQ(name, "_POSIX_NAME_MAX"))
2417 #ifdef _POSIX_NAME_MAX
2418 return _POSIX_NAME_MAX;
2422 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2423 #ifdef _POSIX_NGROUPS_MAX
2424 return _POSIX_NGROUPS_MAX;
2428 if (strEQ(name, "_POSIX_NO_TRUNC"))
2429 #ifdef _POSIX_NO_TRUNC
2430 return _POSIX_NO_TRUNC;
2434 if (strEQ(name, "_POSIX_OPEN_MAX"))
2435 #ifdef _POSIX_OPEN_MAX
2436 return _POSIX_OPEN_MAX;
2440 if (strEQ(name, "_POSIX_PATH_MAX"))
2441 #ifdef _POSIX_PATH_MAX
2442 return _POSIX_PATH_MAX;
2446 if (strEQ(name, "_POSIX_PIPE_BUF"))
2447 #ifdef _POSIX_PIPE_BUF
2448 return _POSIX_PIPE_BUF;
2452 if (strEQ(name, "_POSIX_SAVED_IDS"))
2453 #ifdef _POSIX_SAVED_IDS
2454 return _POSIX_SAVED_IDS;
2458 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2459 #ifdef _POSIX_SSIZE_MAX
2460 return _POSIX_SSIZE_MAX;
2464 if (strEQ(name, "_POSIX_STREAM_MAX"))
2465 #ifdef _POSIX_STREAM_MAX
2466 return _POSIX_STREAM_MAX;
2470 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2471 #ifdef _POSIX_TZNAME_MAX
2472 return _POSIX_TZNAME_MAX;
2476 if (strEQ(name, "_POSIX_VDISABLE"))
2477 #ifdef _POSIX_VDISABLE
2478 return _POSIX_VDISABLE;
2482 if (strEQ(name, "_POSIX_VERSION"))
2483 #ifdef _POSIX_VERSION
2484 return _POSIX_VERSION;
2490 if (strnEQ(name, "_SC_", 4)) {
2491 if (strEQ(name, "_SC_ARG_MAX"))
2492 #if defined(_SC_ARG_MAX) || HINT_SC_EXIST
2497 if (strEQ(name, "_SC_CHILD_MAX"))
2498 #if defined(_SC_CHILD_MAX) || HINT_SC_EXIST
2499 return _SC_CHILD_MAX;
2503 if (strEQ(name, "_SC_CLK_TCK"))
2504 #if defined(_SC_CLK_TCK) || HINT_SC_EXIST
2509 if (strEQ(name, "_SC_JOB_CONTROL"))
2510 #if defined(_SC_JOB_CONTROL) || HINT_SC_EXIST
2511 return _SC_JOB_CONTROL;
2515 if (strEQ(name, "_SC_NGROUPS_MAX"))
2516 #if defined(_SC_NGROUPS_MAX) || HINT_SC_EXIST
2517 return _SC_NGROUPS_MAX;
2521 if (strEQ(name, "_SC_OPEN_MAX"))
2522 #if defined(_SC_OPEN_MAX) || HINT_SC_EXIST
2523 return _SC_OPEN_MAX;
2527 if (strEQ(name, "_SC_SAVED_IDS"))
2528 #if defined(_SC_SAVED_IDS) || HINT_SC_EXIST
2529 return _SC_SAVED_IDS;
2533 if (strEQ(name, "_SC_STREAM_MAX"))
2534 #if defined(_SC_STREAM_MAX) || HINT_SC_EXIST
2535 return _SC_STREAM_MAX;
2539 if (strEQ(name, "_SC_TZNAME_MAX"))
2540 #if defined(_SC_TZNAME_MAX) || HINT_SC_EXIST
2541 return _SC_TZNAME_MAX;
2545 if (strEQ(name, "_SC_VERSION"))
2546 #if defined(_SC_VERSION) || HINT_SC_EXIST
2562 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2565 new(packname = "POSIX::SigSet", ...)
2570 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2571 sigemptyset(RETVAL);
2572 for (i = 1; i < items; i++)
2573 sigaddset(RETVAL, SvIV(ST(i)));
2580 POSIX::SigSet sigset
2582 safefree((char *)sigset);
2585 sigaddset(sigset, sig)
2586 POSIX::SigSet sigset
2590 sigdelset(sigset, sig)
2591 POSIX::SigSet sigset
2596 POSIX::SigSet sigset
2600 POSIX::SigSet sigset
2603 sigismember(sigset, sig)
2604 POSIX::SigSet sigset
2608 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2611 new(packname = "POSIX::Termios", ...)
2616 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2618 not_here("termios");
2626 DESTROY(termios_ref)
2627 POSIX::Termios termios_ref
2630 safefree((char *)termios_ref);
2632 not_here("termios");
2636 getattr(termios_ref, fd = 0)
2637 POSIX::Termios termios_ref
2640 RETVAL = tcgetattr(fd, termios_ref);
2645 setattr(termios_ref, fd = 0, optional_actions = 0)
2646 POSIX::Termios termios_ref
2648 int optional_actions
2650 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2655 cfgetispeed(termios_ref)
2656 POSIX::Termios termios_ref
2659 cfgetospeed(termios_ref)
2660 POSIX::Termios termios_ref
2663 getiflag(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_iflag;
2669 not_here("getiflag");
2676 getoflag(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_oflag;
2682 not_here("getoflag");
2689 getcflag(termios_ref)
2690 POSIX::Termios termios_ref
2692 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2693 RETVAL = termios_ref->c_cflag;
2695 not_here("getcflag");
2702 getlflag(termios_ref)
2703 POSIX::Termios termios_ref
2705 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2706 RETVAL = termios_ref->c_lflag;
2708 not_here("getlflag");
2715 getcc(termios_ref, ccix)
2716 POSIX::Termios termios_ref
2719 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2721 croak("Bad getcc subscript");
2722 RETVAL = termios_ref->c_cc[ccix];
2731 cfsetispeed(termios_ref, speed)
2732 POSIX::Termios termios_ref
2736 cfsetospeed(termios_ref, speed)
2737 POSIX::Termios termios_ref
2741 setiflag(termios_ref, iflag)
2742 POSIX::Termios termios_ref
2745 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2746 termios_ref->c_iflag = iflag;
2748 not_here("setiflag");
2752 setoflag(termios_ref, oflag)
2753 POSIX::Termios termios_ref
2756 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2757 termios_ref->c_oflag = oflag;
2759 not_here("setoflag");
2763 setcflag(termios_ref, cflag)
2764 POSIX::Termios termios_ref
2767 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2768 termios_ref->c_cflag = cflag;
2770 not_here("setcflag");
2774 setlflag(termios_ref, lflag)
2775 POSIX::Termios termios_ref
2778 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2779 termios_ref->c_lflag = lflag;
2781 not_here("setlflag");
2785 setcc(termios_ref, ccix, cc)
2786 POSIX::Termios termios_ref
2790 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2792 croak("Bad setcc subscript");
2793 termios_ref->c_cc[ccix] = cc;
2799 MODULE = POSIX PACKAGE = POSIX
2808 unsigned char * charstring
2810 unsigned char *s = charstring;
2811 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2812 for (RETVAL = 1; RETVAL && s < e; s++)
2820 unsigned char * charstring
2822 unsigned char *s = charstring;
2823 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2824 for (RETVAL = 1; RETVAL && s < e; s++)
2832 unsigned char * charstring
2834 unsigned char *s = charstring;
2835 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2836 for (RETVAL = 1; RETVAL && s < e; s++)
2844 unsigned char * charstring
2846 unsigned char *s = charstring;
2847 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2848 for (RETVAL = 1; RETVAL && s < e; s++)
2856 unsigned char * charstring
2858 unsigned char *s = charstring;
2859 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2860 for (RETVAL = 1; RETVAL && s < e; s++)
2868 unsigned char * charstring
2870 unsigned char *s = charstring;
2871 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2872 for (RETVAL = 1; RETVAL && s < e; s++)
2880 unsigned char * charstring
2882 unsigned char *s = charstring;
2883 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2884 for (RETVAL = 1; RETVAL && s < e; s++)
2892 unsigned char * charstring
2894 unsigned char *s = charstring;
2895 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2896 for (RETVAL = 1; RETVAL && s < e; s++)
2904 unsigned char * charstring
2906 unsigned char *s = charstring;
2907 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2908 for (RETVAL = 1; RETVAL && s < e; s++)
2916 unsigned char * charstring
2918 unsigned char *s = charstring;
2919 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2920 for (RETVAL = 1; RETVAL && s < e; s++)
2927 isxdigit(charstring)
2928 unsigned char * charstring
2930 unsigned char *s = charstring;
2931 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2932 for (RETVAL = 1; RETVAL && s < e; s++)
2939 open(filename, flags = O_RDONLY, mode = 0666)
2944 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2945 TAINT_PROPER("open");
2946 RETVAL = open(filename, flags, mode);
2954 #ifdef HAS_LOCALECONV
2955 struct lconv *lcbuf;
2957 SET_NUMERIC_LOCAL();
2958 if (lcbuf = localeconv()) {
2960 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2961 hv_store(RETVAL, "decimal_point", 13,
2962 newSVpv(lcbuf->decimal_point, 0), 0);
2963 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2964 hv_store(RETVAL, "thousands_sep", 13,
2965 newSVpv(lcbuf->thousands_sep, 0), 0);
2966 #ifndef NO_LOCALECONV_GROUPING
2967 if (lcbuf->grouping && *lcbuf->grouping)
2968 hv_store(RETVAL, "grouping", 8,
2969 newSVpv(lcbuf->grouping, 0), 0);
2971 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2972 hv_store(RETVAL, "int_curr_symbol", 15,
2973 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2974 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2975 hv_store(RETVAL, "currency_symbol", 15,
2976 newSVpv(lcbuf->currency_symbol, 0), 0);
2977 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2978 hv_store(RETVAL, "mon_decimal_point", 17,
2979 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2980 #ifndef NO_LOCALECONV_MON_THOUSANDS_SEP
2981 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2982 hv_store(RETVAL, "mon_thousands_sep", 17,
2983 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2985 #ifndef NO_LOCALECONV_MON_GROUPING
2986 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2987 hv_store(RETVAL, "mon_grouping", 12,
2988 newSVpv(lcbuf->mon_grouping, 0), 0);
2990 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2991 hv_store(RETVAL, "positive_sign", 13,
2992 newSVpv(lcbuf->positive_sign, 0), 0);
2993 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2994 hv_store(RETVAL, "negative_sign", 13,
2995 newSVpv(lcbuf->negative_sign, 0), 0);
2997 if (lcbuf->int_frac_digits != CHAR_MAX)
2998 hv_store(RETVAL, "int_frac_digits", 15,
2999 newSViv(lcbuf->int_frac_digits), 0);
3000 if (lcbuf->frac_digits != CHAR_MAX)
3001 hv_store(RETVAL, "frac_digits", 11,
3002 newSViv(lcbuf->frac_digits), 0);
3003 if (lcbuf->p_cs_precedes != CHAR_MAX)
3004 hv_store(RETVAL, "p_cs_precedes", 13,
3005 newSViv(lcbuf->p_cs_precedes), 0);
3006 if (lcbuf->p_sep_by_space != CHAR_MAX)
3007 hv_store(RETVAL, "p_sep_by_space", 14,
3008 newSViv(lcbuf->p_sep_by_space), 0);
3009 if (lcbuf->n_cs_precedes != CHAR_MAX)
3010 hv_store(RETVAL, "n_cs_precedes", 13,
3011 newSViv(lcbuf->n_cs_precedes), 0);
3012 if (lcbuf->n_sep_by_space != CHAR_MAX)
3013 hv_store(RETVAL, "n_sep_by_space", 14,
3014 newSViv(lcbuf->n_sep_by_space), 0);
3015 if (lcbuf->p_sign_posn != CHAR_MAX)
3016 hv_store(RETVAL, "p_sign_posn", 11,
3017 newSViv(lcbuf->p_sign_posn), 0);
3018 if (lcbuf->n_sign_posn != CHAR_MAX)
3019 hv_store(RETVAL, "n_sign_posn", 11,
3020 newSViv(lcbuf->n_sign_posn), 0);
3023 localeconv(); /* A stub to call not_here(). */
3029 setlocale(category, locale = 0)
3033 RETVAL = setlocale(category, locale);
3035 #ifdef USE_LOCALE_CTYPE
3036 if (category == LC_CTYPE
3038 || category == LC_ALL
3044 if (category == LC_ALL)
3045 newctype = setlocale(LC_CTYPE, NULL);
3049 perl_new_ctype(newctype);
3051 #endif /* USE_LOCALE_CTYPE */
3052 #ifdef USE_LOCALE_COLLATE
3053 if (category == LC_COLLATE
3055 || category == LC_ALL
3061 if (category == LC_ALL)
3062 newcoll = setlocale(LC_COLLATE, NULL);
3066 perl_new_collate(newcoll);
3068 #endif /* USE_LOCALE_COLLATE */
3069 #ifdef USE_LOCALE_NUMERIC
3070 if (category == LC_NUMERIC
3072 || category == LC_ALL
3078 if (category == LC_ALL)
3079 newnum = setlocale(LC_NUMERIC, NULL);
3083 perl_new_numeric(newnum);
3085 #endif /* USE_LOCALE_NUMERIC */
3125 /* (We already know stack is long enough.) */
3126 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3127 PUSHs(sv_2mortal(newSViv(expvar)));
3143 /* (We already know stack is long enough.) */
3144 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3145 PUSHs(sv_2mortal(newSVnv(intvar)));
3160 sigaction(sig, action, oldaction = 0)
3162 POSIX::SigAction action
3163 POSIX::SigAction oldaction
3166 RETVAL = not_here("sigaction");
3168 # This code is really grody because we're trying to make the signal
3169 # interface look beautiful, which is hard.
3172 gv_fetchpv("SIG", TRUE, SVt_PVHV);
3175 struct sigaction act;
3176 struct sigaction oact;
3177 POSIX__SigSet sigset;
3179 SV** sigsvp = hv_fetch(GvHVn(PL_siggv),
3181 strlen(sig_name[sig]),
3184 /* Remember old handler name if desired. */
3186 char *hand = SvPVx(*sigsvp, PL_na);
3187 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
3188 sv_setpv(*svp, *hand ? hand : "DEFAULT");
3192 /* Vector new handler through %SIG. (We always use sighandler
3193 for the C signal handler, which reads %SIG to dispatch.) */
3194 svp = hv_fetch(action, "HANDLER", 7, FALSE);
3196 croak("Can't supply an action without a HANDLER");
3197 sv_setpv(*sigsvp, SvPV(*svp, PL_na));
3198 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
3199 act.sa_handler = sighandler;
3201 /* Set up any desired mask. */
3202 svp = hv_fetch(action, "MASK", 4, FALSE);
3203 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
3205 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3206 sigset = (sigset_t*) tmp;
3207 act.sa_mask = *sigset;
3210 sigemptyset(& act.sa_mask);
3212 /* Set up any desired flags. */
3213 svp = hv_fetch(action, "FLAGS", 5, FALSE);
3214 act.sa_flags = svp ? SvIV(*svp) : 0;
3217 /* Now work around sigaction oddities */
3218 if (action && oldaction)
3219 RETVAL = sigaction(sig, & act, & oact);
3221 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3223 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3228 /* Get back the mask. */
3229 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
3230 if (sv_isa(*svp, "POSIX::SigSet")) {
3232 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3233 sigset = (sigset_t*) tmp;
3236 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
3237 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
3239 *sigset = oact.sa_mask;
3241 /* Get back the flags. */
3242 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
3243 sv_setiv(*svp, oact.sa_flags);
3252 POSIX::SigSet sigset
3255 sigprocmask(how, sigset, oldsigset = 0)
3257 POSIX::SigSet sigset
3258 POSIX::SigSet oldsigset
3261 sigsuspend(signal_mask)
3262 POSIX::SigSet signal_mask
3282 lseek(fd, offset, whence)
3295 if (pipe(fds) != -1) {
3297 PUSHs(sv_2mortal(newSViv(fds[0])));
3298 PUSHs(sv_2mortal(newSViv(fds[1])));
3302 read(fd, buffer, nbytes)
3304 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3308 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3311 SvCUR(sv_buffer) = RETVAL;
3312 SvPOK_only(sv_buffer);
3313 *SvEND(sv_buffer) = '\0';
3314 SvTAINTED_on(sv_buffer);
3330 tcsetpgrp(fd, pgrp_id)
3339 if (uname(&buf) >= 0) {
3341 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3342 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3343 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3344 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3345 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3348 uname((char *) 0); /* A stub to call not_here(). */
3352 write(fd, buffer, nbytes)
3370 mbstowcs(s, pwcs, n)
3382 wcstombs(s, pwcs, n)
3404 SET_NUMERIC_LOCAL();
3405 num = strtod(str, &unparsed);
3406 PUSHs(sv_2mortal(newSVnv(num)));
3407 if (GIMME == G_ARRAY) {
3410 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3412 PUSHs(&PL_sv_undef);
3416 strtol(str, base = 0)
3423 num = strtol(str, &unparsed, base);
3424 if (num >= IV_MIN && num <= IV_MAX)
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))));
3433 PUSHs(&PL_sv_undef);
3437 strtoul(str, base = 0)
3444 num = strtoul(str, &unparsed, base);
3446 PUSHs(sv_2mortal(newSViv((IV)num)));
3448 PUSHs(sv_2mortal(newSVnv((double)num)));
3449 if (GIMME == G_ARRAY) {
3452 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3454 PUSHs(&PL_sv_undef);
3464 char *p = SvPV(src,srclen);
3466 ST(0) = sv_2mortal(NEWSV(800,srclen));
3467 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3468 if (dstlen > srclen) {
3470 SvGROW(ST(0), dstlen);
3471 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3474 SvCUR(ST(0)) = dstlen;
3479 mkfifo(filename, mode)
3483 TAINT_PROPER("mkfifo");
3484 RETVAL = mkfifo(filename, mode);
3500 tcflush(fd, queue_selector)
3505 tcsendbreak(fd, duration)
3510 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3523 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3526 mytm.tm_hour = hour;
3527 mytm.tm_mday = mday;
3529 mytm.tm_year = year;
3530 mytm.tm_wday = wday;
3531 mytm.tm_yday = yday;
3532 mytm.tm_isdst = isdst;
3533 RETVAL = asctime(&mytm);
3550 realtime = times( &tms );
3552 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
3553 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
3554 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
3555 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) );
3556 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) );
3559 difftime(time1, time2)
3564 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3577 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3580 mytm.tm_hour = hour;
3581 mytm.tm_mday = mday;
3583 mytm.tm_year = year;
3584 mytm.tm_wday = wday;
3585 mytm.tm_yday = yday;
3586 mytm.tm_isdst = isdst;
3587 RETVAL = mktime(&mytm);
3593 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3609 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3612 mytm.tm_hour = hour;
3613 mytm.tm_mday = mday;
3615 mytm.tm_year = year;
3616 mytm.tm_wday = wday;
3617 mytm.tm_yday = yday;
3618 mytm.tm_isdst = isdst;
3619 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3620 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3630 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3631 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3634 access(filename, mode)
3652 pathconf(filename, name)