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"))
827 if (strEQ(name, "ELOOP"))
835 if (strEQ(name, "EMFILE"))
841 if (strEQ(name, "EMLINK"))
847 if (strEQ(name, "EMSGSIZE"))
855 if (strEQ(name, "ENETDOWN"))
861 if (strEQ(name, "ENETRESET"))
867 if (strEQ(name, "ENETUNREACH"))
873 if (strEQ(name, "ENOBUFS"))
879 if (strEQ(name, "ENOEXEC"))
885 if (strEQ(name, "ENOMEM"))
891 if (strEQ(name, "ENOPROTOOPT"))
897 if (strEQ(name, "ENOSPC"))
903 if (strEQ(name, "ENOTBLK"))
909 if (strEQ(name, "ENOTCONN"))
915 if (strEQ(name, "ENOTDIR"))
921 if (strEQ(name, "ENOTEMPTY"))
927 if (strEQ(name, "ENOTSOCK"))
933 if (strEQ(name, "ENOTTY"))
939 if (strEQ(name, "ENFILE"))
945 if (strEQ(name, "ENODEV"))
951 if (strEQ(name, "ENOENT"))
957 if (strEQ(name, "ENOLCK"))
963 if (strEQ(name, "ENOSYS"))
969 if (strEQ(name, "ENXIO"))
975 if (strEQ(name, "ENAMETOOLONG"))
983 if (strEQ(name, "EOF"))
989 if (strEQ(name, "EOPNOTSUPP"))
997 if (strEQ(name, "EPERM"))
1003 if (strEQ(name, "EPFNOSUPPORT"))
1005 return EPFNOSUPPORT;
1009 if (strEQ(name, "EPIPE"))
1015 if (strEQ(name, "EPROCLIM"))
1021 if (strEQ(name, "EPROTONOSUPPORT"))
1022 #ifdef EPROTONOSUPPORT
1023 return EPROTONOSUPPORT;
1027 if (strEQ(name, "EPROTOTYPE"))
1035 if (strEQ(name, "ERANGE"))
1041 if (strEQ(name, "EREMOTE"))
1047 if (strEQ(name, "ERESTART"))
1053 if (strEQ(name, "EROFS"))
1061 if (strEQ(name, "ESHUTDOWN"))
1067 if (strEQ(name, "ESOCKTNOSUPPORT"))
1068 #ifdef ESOCKTNOSUPPORT
1069 return ESOCKTNOSUPPORT;
1073 if (strEQ(name, "ESPIPE"))
1079 if (strEQ(name, "ESRCH"))
1085 if (strEQ(name, "ESTALE"))
1093 if (strEQ(name, "ETIMEDOUT"))
1099 if (strEQ(name, "ETOOMANYREFS"))
1101 return ETOOMANYREFS;
1105 if (strEQ(name, "ETXTBSY"))
1113 if (strEQ(name, "EUSERS"))
1121 if (strEQ(name, "EWOULDBLOCK"))
1129 if (strEQ(name, "EXIT_FAILURE"))
1131 return EXIT_FAILURE;
1135 if (strEQ(name, "EXIT_SUCCESS"))
1137 return EXIT_SUCCESS;
1141 if (strEQ(name, "EXDEV"))
1149 if (strEQ(name, "E2BIG"))
1157 if (strnEQ(name, "FLT_", 4)) {
1158 if (strEQ(name, "FLT_MAX"))
1164 if (strEQ(name, "FLT_MIN"))
1170 if (strEQ(name, "FLT_ROUNDS"))
1176 if (strEQ(name, "FLT_DIG"))
1182 if (strEQ(name, "FLT_EPSILON"))
1188 if (strEQ(name, "FLT_MANT_DIG"))
1190 return FLT_MANT_DIG;
1194 if (strEQ(name, "FLT_MAX_10_EXP"))
1195 #ifdef FLT_MAX_10_EXP
1196 return FLT_MAX_10_EXP;
1200 if (strEQ(name, "FLT_MAX_EXP"))
1206 if (strEQ(name, "FLT_MIN_10_EXP"))
1207 #ifdef FLT_MIN_10_EXP
1208 return FLT_MIN_10_EXP;
1212 if (strEQ(name, "FLT_MIN_EXP"))
1218 if (strEQ(name, "FLT_RADIX"))
1226 if (strnEQ(name, "F_", 2)) {
1227 if (strEQ(name, "F_DUPFD"))
1233 if (strEQ(name, "F_GETFD"))
1239 if (strEQ(name, "F_GETFL"))
1245 if (strEQ(name, "F_GETLK"))
1251 if (strEQ(name, "F_OK"))
1257 if (strEQ(name, "F_RDLCK"))
1263 if (strEQ(name, "F_SETFD"))
1269 if (strEQ(name, "F_SETFL"))
1275 if (strEQ(name, "F_SETLK"))
1281 if (strEQ(name, "F_SETLKW"))
1287 if (strEQ(name, "F_UNLCK"))
1293 if (strEQ(name, "F_WRLCK"))
1301 if (strEQ(name, "FD_CLOEXEC"))
1307 if (strEQ(name, "FILENAME_MAX"))
1309 return FILENAME_MAX;
1315 if (strEQ(name, "HUGE_VAL"))
1321 if (strEQ(name, "HUPCL"))
1329 if (strEQ(name, "INT_MAX"))
1335 if (strEQ(name, "INT_MIN"))
1341 if (strEQ(name, "ICANON"))
1347 if (strEQ(name, "ICRNL"))
1353 if (strEQ(name, "IEXTEN"))
1359 if (strEQ(name, "IGNBRK"))
1365 if (strEQ(name, "IGNCR"))
1371 if (strEQ(name, "IGNPAR"))
1377 if (strEQ(name, "INLCR"))
1383 if (strEQ(name, "INPCK"))
1389 if (strEQ(name, "ISIG"))
1395 if (strEQ(name, "ISTRIP"))
1401 if (strEQ(name, "IXOFF"))
1407 if (strEQ(name, "IXON"))
1415 if (strnEQ(name, "LC_", 3)) {
1416 if (strEQ(name, "LC_ALL"))
1422 if (strEQ(name, "LC_COLLATE"))
1428 if (strEQ(name, "LC_CTYPE"))
1434 if (strEQ(name, "LC_MONETARY"))
1440 if (strEQ(name, "LC_NUMERIC"))
1446 if (strEQ(name, "LC_TIME"))
1454 if (strnEQ(name, "LDBL_", 5)) {
1455 if (strEQ(name, "LDBL_MAX"))
1461 if (strEQ(name, "LDBL_MIN"))
1467 if (strEQ(name, "LDBL_DIG"))
1473 if (strEQ(name, "LDBL_EPSILON"))
1475 return LDBL_EPSILON;
1479 if (strEQ(name, "LDBL_MANT_DIG"))
1480 #ifdef LDBL_MANT_DIG
1481 return LDBL_MANT_DIG;
1485 if (strEQ(name, "LDBL_MAX_10_EXP"))
1486 #ifdef LDBL_MAX_10_EXP
1487 return LDBL_MAX_10_EXP;
1491 if (strEQ(name, "LDBL_MAX_EXP"))
1493 return LDBL_MAX_EXP;
1497 if (strEQ(name, "LDBL_MIN_10_EXP"))
1498 #ifdef LDBL_MIN_10_EXP
1499 return LDBL_MIN_10_EXP;
1503 if (strEQ(name, "LDBL_MIN_EXP"))
1505 return LDBL_MIN_EXP;
1511 if (strnEQ(name, "L_", 2)) {
1512 if (strEQ(name, "L_ctermid"))
1518 if (strEQ(name, "L_cuserid"))
1524 if (strEQ(name, "L_tmpname"))
1532 if (strEQ(name, "LONG_MAX"))
1538 if (strEQ(name, "LONG_MIN"))
1544 if (strEQ(name, "LINK_MAX"))
1552 if (strEQ(name, "MAX_CANON"))
1558 if (strEQ(name, "MAX_INPUT"))
1564 if (strEQ(name, "MB_CUR_MAX"))
1570 if (strEQ(name, "MB_LEN_MAX"))
1578 if (strEQ(name, "NULL")) return 0;
1579 if (strEQ(name, "NAME_MAX"))
1585 if (strEQ(name, "NCCS"))
1591 if (strEQ(name, "NGROUPS_MAX"))
1597 if (strEQ(name, "NOFLSH"))
1605 if (strnEQ(name, "O_", 2)) {
1606 if (strEQ(name, "O_APPEND"))
1612 if (strEQ(name, "O_CREAT"))
1618 if (strEQ(name, "O_TRUNC"))
1624 if (strEQ(name, "O_RDONLY"))
1630 if (strEQ(name, "O_RDWR"))
1636 if (strEQ(name, "O_WRONLY"))
1642 if (strEQ(name, "O_EXCL"))
1648 if (strEQ(name, "O_NOCTTY"))
1654 if (strEQ(name, "O_NONBLOCK"))
1660 if (strEQ(name, "O_ACCMODE"))
1668 if (strEQ(name, "OPEN_MAX"))
1674 if (strEQ(name, "OPOST"))
1682 if (strEQ(name, "PATH_MAX"))
1688 if (strEQ(name, "PARENB"))
1694 if (strEQ(name, "PARMRK"))
1700 if (strEQ(name, "PARODD"))
1706 if (strEQ(name, "PIPE_BUF"))
1714 if (strEQ(name, "RAND_MAX"))
1720 if (strEQ(name, "R_OK"))
1728 if (strnEQ(name, "SIG", 3)) {
1729 if (name[3] == '_') {
1730 if (strEQ(name, "SIG_BLOCK"))
1737 if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
1740 if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
1743 if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
1745 if (strEQ(name, "SIG_SETMASK"))
1751 if (strEQ(name, "SIG_UNBLOCK"))
1759 if (strEQ(name, "SIGABRT"))
1765 if (strEQ(name, "SIGALRM"))
1771 if (strEQ(name, "SIGCHLD"))
1777 if (strEQ(name, "SIGCONT"))
1783 if (strEQ(name, "SIGFPE"))
1789 if (strEQ(name, "SIGHUP"))
1795 if (strEQ(name, "SIGILL"))
1801 if (strEQ(name, "SIGINT"))
1807 if (strEQ(name, "SIGKILL"))
1813 if (strEQ(name, "SIGPIPE"))
1819 if (strEQ(name, "SIGQUIT"))
1825 if (strEQ(name, "SIGSEGV"))
1831 if (strEQ(name, "SIGSTOP"))
1837 if (strEQ(name, "SIGTERM"))
1843 if (strEQ(name, "SIGTSTP"))
1849 if (strEQ(name, "SIGTTIN"))
1855 if (strEQ(name, "SIGTTOU"))
1861 if (strEQ(name, "SIGUSR1"))
1867 if (strEQ(name, "SIGUSR2"))
1875 if (name[1] == '_') {
1876 if (strEQ(name, "S_ISGID"))
1882 if (strEQ(name, "S_ISUID"))
1888 if (strEQ(name, "S_IRGRP"))
1894 if (strEQ(name, "S_IROTH"))
1900 if (strEQ(name, "S_IRUSR"))
1906 if (strEQ(name, "S_IRWXG"))
1912 if (strEQ(name, "S_IRWXO"))
1918 if (strEQ(name, "S_IRWXU"))
1924 if (strEQ(name, "S_IWGRP"))
1930 if (strEQ(name, "S_IWOTH"))
1936 if (strEQ(name, "S_IWUSR"))
1942 if (strEQ(name, "S_IXGRP"))
1948 if (strEQ(name, "S_IXOTH"))
1954 if (strEQ(name, "S_IXUSR"))
1960 errno = EAGAIN; /* the following aren't constants */
1962 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1965 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1968 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1971 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1974 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1978 if (strEQ(name, "SEEK_CUR"))
1984 if (strEQ(name, "SEEK_END"))
1990 if (strEQ(name, "SEEK_SET"))
1996 if (strEQ(name, "STREAM_MAX"))
2002 if (strEQ(name, "SHRT_MAX"))
2008 if (strEQ(name, "SHRT_MIN"))
2014 if (strnEQ(name, "SA_", 3)) {
2015 if (strEQ(name, "SA_NOCLDSTOP"))
2017 return SA_NOCLDSTOP;
2021 if (strEQ(name, "SA_NOCLDWAIT"))
2023 return SA_NOCLDWAIT;
2027 if (strEQ(name, "SA_NODEFER"))
2033 if (strEQ(name, "SA_ONSTACK"))
2039 if (strEQ(name, "SA_RESETHAND"))
2041 return SA_RESETHAND;
2045 if (strEQ(name, "SA_RESTART"))
2051 if (strEQ(name, "SA_SIGINFO"))
2059 if (strEQ(name, "SCHAR_MAX"))
2065 if (strEQ(name, "SCHAR_MIN"))
2071 if (strEQ(name, "SSIZE_MAX"))
2077 if (strEQ(name, "STDIN_FILENO"))
2079 return STDIN_FILENO;
2083 if (strEQ(name, "STDOUT_FILENO"))
2084 #ifdef STDOUT_FILENO
2085 return STDOUT_FILENO;
2089 if (strEQ(name, "STRERR_FILENO"))
2090 #ifdef STRERR_FILENO
2091 return STRERR_FILENO;
2097 if (strEQ(name, "TCIFLUSH"))
2103 if (strEQ(name, "TCIOFF"))
2109 if (strEQ(name, "TCIOFLUSH"))
2115 if (strEQ(name, "TCION"))
2121 if (strEQ(name, "TCOFLUSH"))
2127 if (strEQ(name, "TCOOFF"))
2133 if (strEQ(name, "TCOON"))
2139 if (strEQ(name, "TCSADRAIN"))
2145 if (strEQ(name, "TCSAFLUSH"))
2151 if (strEQ(name, "TCSANOW"))
2157 if (strEQ(name, "TMP_MAX"))
2163 if (strEQ(name, "TOSTOP"))
2169 if (strEQ(name, "TZNAME_MAX"))
2177 if (strEQ(name, "UCHAR_MAX"))
2183 if (strEQ(name, "UINT_MAX"))
2189 if (strEQ(name, "ULONG_MAX"))
2195 if (strEQ(name, "USHRT_MAX"))
2203 if (strEQ(name, "VEOF"))
2209 if (strEQ(name, "VEOL"))
2215 if (strEQ(name, "VERASE"))
2221 if (strEQ(name, "VINTR"))
2227 if (strEQ(name, "VKILL"))
2233 if (strEQ(name, "VMIN"))
2239 if (strEQ(name, "VQUIT"))
2245 if (strEQ(name, "VSTART"))
2251 if (strEQ(name, "VSTOP"))
2257 if (strEQ(name, "VSUSP"))
2263 if (strEQ(name, "VTIME"))
2271 if (strEQ(name, "W_OK"))
2277 if (strEQ(name, "WNOHANG"))
2283 if (strEQ(name, "WUNTRACED"))
2289 errno = EAGAIN; /* the following aren't constants */
2291 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2294 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2297 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2300 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2303 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2306 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2310 if (strEQ(name, "X_OK"))
2318 if (strnEQ(name, "_PC_", 4)) {
2319 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2320 #if defined(_PC_CHOWN_RESTRICTED) || HINT_SC_EXIST
2321 return _PC_CHOWN_RESTRICTED;
2325 if (strEQ(name, "_PC_LINK_MAX"))
2326 #if defined(_PC_LINK_MAX) || HINT_SC_EXIST
2327 return _PC_LINK_MAX;
2331 if (strEQ(name, "_PC_MAX_CANON"))
2332 #if defined(_PC_MAX_CANON) || HINT_SC_EXIST
2333 return _PC_MAX_CANON;
2337 if (strEQ(name, "_PC_MAX_INPUT"))
2338 #if defined(_PC_MAX_INPUT) || HINT_SC_EXIST
2339 return _PC_MAX_INPUT;
2343 if (strEQ(name, "_PC_NAME_MAX"))
2344 #if defined(_PC_NAME_MAX) || HINT_SC_EXIST
2345 return _PC_NAME_MAX;
2349 if (strEQ(name, "_PC_NO_TRUNC"))
2350 #if defined(_PC_NO_TRUNC) || HINT_SC_EXIST
2351 return _PC_NO_TRUNC;
2355 if (strEQ(name, "_PC_PATH_MAX"))
2356 #if defined(_PC_PATH_MAX) || HINT_SC_EXIST
2357 return _PC_PATH_MAX;
2361 if (strEQ(name, "_PC_PIPE_BUF"))
2362 #if defined(_PC_PIPE_BUF) || HINT_SC_EXIST
2363 return _PC_PIPE_BUF;
2367 if (strEQ(name, "_PC_VDISABLE"))
2368 #if defined(_PC_VDISABLE) || HINT_SC_EXIST
2369 return _PC_VDISABLE;
2375 if (strnEQ(name, "_POSIX_", 7)) {
2376 if (strEQ(name, "_POSIX_ARG_MAX"))
2377 #ifdef _POSIX_ARG_MAX
2378 return _POSIX_ARG_MAX;
2382 if (strEQ(name, "_POSIX_CHILD_MAX"))
2383 #ifdef _POSIX_CHILD_MAX
2384 return _POSIX_CHILD_MAX;
2388 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2389 #ifdef _POSIX_CHOWN_RESTRICTED
2390 return _POSIX_CHOWN_RESTRICTED;
2394 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2395 #ifdef _POSIX_JOB_CONTROL
2396 return _POSIX_JOB_CONTROL;
2400 if (strEQ(name, "_POSIX_LINK_MAX"))
2401 #ifdef _POSIX_LINK_MAX
2402 return _POSIX_LINK_MAX;
2406 if (strEQ(name, "_POSIX_MAX_CANON"))
2407 #ifdef _POSIX_MAX_CANON
2408 return _POSIX_MAX_CANON;
2412 if (strEQ(name, "_POSIX_MAX_INPUT"))
2413 #ifdef _POSIX_MAX_INPUT
2414 return _POSIX_MAX_INPUT;
2418 if (strEQ(name, "_POSIX_NAME_MAX"))
2419 #ifdef _POSIX_NAME_MAX
2420 return _POSIX_NAME_MAX;
2424 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2425 #ifdef _POSIX_NGROUPS_MAX
2426 return _POSIX_NGROUPS_MAX;
2430 if (strEQ(name, "_POSIX_NO_TRUNC"))
2431 #ifdef _POSIX_NO_TRUNC
2432 return _POSIX_NO_TRUNC;
2436 if (strEQ(name, "_POSIX_OPEN_MAX"))
2437 #ifdef _POSIX_OPEN_MAX
2438 return _POSIX_OPEN_MAX;
2442 if (strEQ(name, "_POSIX_PATH_MAX"))
2443 #ifdef _POSIX_PATH_MAX
2444 return _POSIX_PATH_MAX;
2448 if (strEQ(name, "_POSIX_PIPE_BUF"))
2449 #ifdef _POSIX_PIPE_BUF
2450 return _POSIX_PIPE_BUF;
2454 if (strEQ(name, "_POSIX_SAVED_IDS"))
2455 #ifdef _POSIX_SAVED_IDS
2456 return _POSIX_SAVED_IDS;
2460 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2461 #ifdef _POSIX_SSIZE_MAX
2462 return _POSIX_SSIZE_MAX;
2466 if (strEQ(name, "_POSIX_STREAM_MAX"))
2467 #ifdef _POSIX_STREAM_MAX
2468 return _POSIX_STREAM_MAX;
2472 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2473 #ifdef _POSIX_TZNAME_MAX
2474 return _POSIX_TZNAME_MAX;
2478 if (strEQ(name, "_POSIX_VDISABLE"))
2479 #ifdef _POSIX_VDISABLE
2480 return _POSIX_VDISABLE;
2484 if (strEQ(name, "_POSIX_VERSION"))
2485 #ifdef _POSIX_VERSION
2486 return _POSIX_VERSION;
2492 if (strnEQ(name, "_SC_", 4)) {
2493 if (strEQ(name, "_SC_ARG_MAX"))
2494 #if defined(_SC_ARG_MAX) || HINT_SC_EXIST
2499 if (strEQ(name, "_SC_CHILD_MAX"))
2500 #if defined(_SC_CHILD_MAX) || HINT_SC_EXIST
2501 return _SC_CHILD_MAX;
2505 if (strEQ(name, "_SC_CLK_TCK"))
2506 #if defined(_SC_CLK_TCK) || HINT_SC_EXIST
2511 if (strEQ(name, "_SC_JOB_CONTROL"))
2512 #if defined(_SC_JOB_CONTROL) || HINT_SC_EXIST
2513 return _SC_JOB_CONTROL;
2517 if (strEQ(name, "_SC_NGROUPS_MAX"))
2518 #if defined(_SC_NGROUPS_MAX) || HINT_SC_EXIST
2519 return _SC_NGROUPS_MAX;
2523 if (strEQ(name, "_SC_OPEN_MAX"))
2524 #if defined(_SC_OPEN_MAX) || HINT_SC_EXIST
2525 return _SC_OPEN_MAX;
2529 if (strEQ(name, "_SC_SAVED_IDS"))
2530 #if defined(_SC_SAVED_IDS) || HINT_SC_EXIST
2531 return _SC_SAVED_IDS;
2535 if (strEQ(name, "_SC_STREAM_MAX"))
2536 #if defined(_SC_STREAM_MAX) || HINT_SC_EXIST
2537 return _SC_STREAM_MAX;
2541 if (strEQ(name, "_SC_TZNAME_MAX"))
2542 #if defined(_SC_TZNAME_MAX) || HINT_SC_EXIST
2543 return _SC_TZNAME_MAX;
2547 if (strEQ(name, "_SC_VERSION"))
2548 #if defined(_SC_VERSION) || HINT_SC_EXIST
2564 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2567 new(packname = "POSIX::SigSet", ...)
2572 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2573 sigemptyset(RETVAL);
2574 for (i = 1; i < items; i++)
2575 sigaddset(RETVAL, SvIV(ST(i)));
2582 POSIX::SigSet sigset
2584 safefree((char *)sigset);
2587 sigaddset(sigset, sig)
2588 POSIX::SigSet sigset
2592 sigdelset(sigset, sig)
2593 POSIX::SigSet sigset
2598 POSIX::SigSet sigset
2602 POSIX::SigSet sigset
2605 sigismember(sigset, sig)
2606 POSIX::SigSet sigset
2610 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2613 new(packname = "POSIX::Termios", ...)
2618 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2620 not_here("termios");
2628 DESTROY(termios_ref)
2629 POSIX::Termios termios_ref
2632 safefree((char *)termios_ref);
2634 not_here("termios");
2638 getattr(termios_ref, fd = 0)
2639 POSIX::Termios termios_ref
2642 RETVAL = tcgetattr(fd, termios_ref);
2647 setattr(termios_ref, fd = 0, optional_actions = 0)
2648 POSIX::Termios termios_ref
2650 int optional_actions
2652 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2657 cfgetispeed(termios_ref)
2658 POSIX::Termios termios_ref
2661 cfgetospeed(termios_ref)
2662 POSIX::Termios termios_ref
2665 getiflag(termios_ref)
2666 POSIX::Termios termios_ref
2668 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2669 RETVAL = termios_ref->c_iflag;
2671 not_here("getiflag");
2678 getoflag(termios_ref)
2679 POSIX::Termios termios_ref
2681 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2682 RETVAL = termios_ref->c_oflag;
2684 not_here("getoflag");
2691 getcflag(termios_ref)
2692 POSIX::Termios termios_ref
2694 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2695 RETVAL = termios_ref->c_cflag;
2697 not_here("getcflag");
2704 getlflag(termios_ref)
2705 POSIX::Termios termios_ref
2707 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2708 RETVAL = termios_ref->c_lflag;
2710 not_here("getlflag");
2717 getcc(termios_ref, ccix)
2718 POSIX::Termios termios_ref
2721 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2723 croak("Bad getcc subscript");
2724 RETVAL = termios_ref->c_cc[ccix];
2733 cfsetispeed(termios_ref, speed)
2734 POSIX::Termios termios_ref
2738 cfsetospeed(termios_ref, speed)
2739 POSIX::Termios termios_ref
2743 setiflag(termios_ref, iflag)
2744 POSIX::Termios termios_ref
2747 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2748 termios_ref->c_iflag = iflag;
2750 not_here("setiflag");
2754 setoflag(termios_ref, oflag)
2755 POSIX::Termios termios_ref
2758 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2759 termios_ref->c_oflag = oflag;
2761 not_here("setoflag");
2765 setcflag(termios_ref, cflag)
2766 POSIX::Termios termios_ref
2769 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2770 termios_ref->c_cflag = cflag;
2772 not_here("setcflag");
2776 setlflag(termios_ref, lflag)
2777 POSIX::Termios termios_ref
2780 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2781 termios_ref->c_lflag = lflag;
2783 not_here("setlflag");
2787 setcc(termios_ref, ccix, cc)
2788 POSIX::Termios termios_ref
2792 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2794 croak("Bad setcc subscript");
2795 termios_ref->c_cc[ccix] = cc;
2801 MODULE = POSIX PACKAGE = POSIX
2810 unsigned char * charstring
2812 unsigned char *s = charstring;
2813 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2814 for (RETVAL = 1; RETVAL && s < e; s++)
2822 unsigned char * charstring
2824 unsigned char *s = charstring;
2825 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2826 for (RETVAL = 1; RETVAL && s < e; s++)
2834 unsigned char * charstring
2836 unsigned char *s = charstring;
2837 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2838 for (RETVAL = 1; RETVAL && s < e; s++)
2846 unsigned char * charstring
2848 unsigned char *s = charstring;
2849 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2850 for (RETVAL = 1; RETVAL && s < e; s++)
2858 unsigned char * charstring
2860 unsigned char *s = charstring;
2861 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2862 for (RETVAL = 1; RETVAL && s < e; s++)
2870 unsigned char * charstring
2872 unsigned char *s = charstring;
2873 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2874 for (RETVAL = 1; RETVAL && s < e; s++)
2882 unsigned char * charstring
2884 unsigned char *s = charstring;
2885 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2886 for (RETVAL = 1; RETVAL && s < e; s++)
2894 unsigned char * charstring
2896 unsigned char *s = charstring;
2897 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2898 for (RETVAL = 1; RETVAL && s < e; s++)
2906 unsigned char * charstring
2908 unsigned char *s = charstring;
2909 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2910 for (RETVAL = 1; RETVAL && s < e; s++)
2918 unsigned char * charstring
2920 unsigned char *s = charstring;
2921 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2922 for (RETVAL = 1; RETVAL && s < e; s++)
2929 isxdigit(charstring)
2930 unsigned char * charstring
2932 unsigned char *s = charstring;
2933 unsigned char *e = s + PL_na; /* "PL_na" set by typemap side effect */
2934 for (RETVAL = 1; RETVAL && s < e; s++)
2941 open(filename, flags = O_RDONLY, mode = 0666)
2946 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2947 TAINT_PROPER("open");
2948 RETVAL = open(filename, flags, mode);
2956 #ifdef HAS_LOCALECONV
2957 struct lconv *lcbuf;
2959 if (lcbuf = localeconv()) {
2961 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2962 hv_store(RETVAL, "decimal_point", 13,
2963 newSVpv(lcbuf->decimal_point, 0), 0);
2964 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2965 hv_store(RETVAL, "thousands_sep", 13,
2966 newSVpv(lcbuf->thousands_sep, 0), 0);
2967 #ifndef NO_LOCALECONV_GROUPING
2968 if (lcbuf->grouping && *lcbuf->grouping)
2969 hv_store(RETVAL, "grouping", 8,
2970 newSVpv(lcbuf->grouping, 0), 0);
2972 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2973 hv_store(RETVAL, "int_curr_symbol", 15,
2974 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2975 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2976 hv_store(RETVAL, "currency_symbol", 15,
2977 newSVpv(lcbuf->currency_symbol, 0), 0);
2978 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2979 hv_store(RETVAL, "mon_decimal_point", 17,
2980 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2981 #ifndef NO_LOCALECONV_MON_THOUSANDS_SEP
2982 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2983 hv_store(RETVAL, "mon_thousands_sep", 17,
2984 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2986 #ifndef NO_LOCALECONV_MON_GROUPING
2987 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2988 hv_store(RETVAL, "mon_grouping", 12,
2989 newSVpv(lcbuf->mon_grouping, 0), 0);
2991 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2992 hv_store(RETVAL, "positive_sign", 13,
2993 newSVpv(lcbuf->positive_sign, 0), 0);
2994 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2995 hv_store(RETVAL, "negative_sign", 13,
2996 newSVpv(lcbuf->negative_sign, 0), 0);
2998 if (lcbuf->int_frac_digits != CHAR_MAX)
2999 hv_store(RETVAL, "int_frac_digits", 15,
3000 newSViv(lcbuf->int_frac_digits), 0);
3001 if (lcbuf->frac_digits != CHAR_MAX)
3002 hv_store(RETVAL, "frac_digits", 11,
3003 newSViv(lcbuf->frac_digits), 0);
3004 if (lcbuf->p_cs_precedes != CHAR_MAX)
3005 hv_store(RETVAL, "p_cs_precedes", 13,
3006 newSViv(lcbuf->p_cs_precedes), 0);
3007 if (lcbuf->p_sep_by_space != CHAR_MAX)
3008 hv_store(RETVAL, "p_sep_by_space", 14,
3009 newSViv(lcbuf->p_sep_by_space), 0);
3010 if (lcbuf->n_cs_precedes != CHAR_MAX)
3011 hv_store(RETVAL, "n_cs_precedes", 13,
3012 newSViv(lcbuf->n_cs_precedes), 0);
3013 if (lcbuf->n_sep_by_space != CHAR_MAX)
3014 hv_store(RETVAL, "n_sep_by_space", 14,
3015 newSViv(lcbuf->n_sep_by_space), 0);
3016 if (lcbuf->p_sign_posn != CHAR_MAX)
3017 hv_store(RETVAL, "p_sign_posn", 11,
3018 newSViv(lcbuf->p_sign_posn), 0);
3019 if (lcbuf->n_sign_posn != CHAR_MAX)
3020 hv_store(RETVAL, "n_sign_posn", 11,
3021 newSViv(lcbuf->n_sign_posn), 0);
3024 localeconv(); /* A stub to call not_here(). */
3030 setlocale(category, locale = 0)
3034 RETVAL = setlocale(category, locale);
3036 #ifdef USE_LOCALE_CTYPE
3037 if (category == LC_CTYPE
3039 || category == LC_ALL
3045 if (category == LC_ALL)
3046 newctype = setlocale(LC_CTYPE, NULL);
3050 perl_new_ctype(newctype);
3052 #endif /* USE_LOCALE_CTYPE */
3053 #ifdef USE_LOCALE_COLLATE
3054 if (category == LC_COLLATE
3056 || category == LC_ALL
3062 if (category == LC_ALL)
3063 newcoll = setlocale(LC_COLLATE, NULL);
3067 perl_new_collate(newcoll);
3069 #endif /* USE_LOCALE_COLLATE */
3070 #ifdef USE_LOCALE_NUMERIC
3071 if (category == LC_NUMERIC
3073 || category == LC_ALL
3079 if (category == LC_ALL)
3080 newnum = setlocale(LC_NUMERIC, NULL);
3084 perl_new_numeric(newnum);
3086 #endif /* USE_LOCALE_NUMERIC */
3126 /* (We already know stack is long enough.) */
3127 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3128 PUSHs(sv_2mortal(newSViv(expvar)));
3144 /* (We already know stack is long enough.) */
3145 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3146 PUSHs(sv_2mortal(newSVnv(intvar)));
3161 sigaction(sig, action, oldaction = 0)
3163 POSIX::SigAction action
3164 POSIX::SigAction oldaction
3167 RETVAL = not_here("sigaction");
3169 # This code is really grody because we're trying to make the signal
3170 # interface look beautiful, which is hard.
3173 gv_fetchpv("SIG", TRUE, SVt_PVHV);
3176 struct sigaction act;
3177 struct sigaction oact;
3178 POSIX__SigSet sigset;
3180 SV** sigsvp = hv_fetch(GvHVn(PL_siggv),
3182 strlen(sig_name[sig]),
3185 /* Remember old handler name if desired. */
3187 char *hand = SvPVx(*sigsvp, PL_na);
3188 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
3189 sv_setpv(*svp, *hand ? hand : "DEFAULT");
3193 /* Vector new handler through %SIG. (We always use sighandler
3194 for the C signal handler, which reads %SIG to dispatch.) */
3195 svp = hv_fetch(action, "HANDLER", 7, FALSE);
3197 croak("Can't supply an action without a HANDLER");
3198 sv_setpv(*sigsvp, SvPV(*svp, PL_na));
3199 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
3200 act.sa_handler = sighandler;
3202 /* Set up any desired mask. */
3203 svp = hv_fetch(action, "MASK", 4, FALSE);
3204 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
3206 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3207 sigset = (sigset_t*) tmp;
3208 act.sa_mask = *sigset;
3211 sigemptyset(& act.sa_mask);
3213 /* Set up any desired flags. */
3214 svp = hv_fetch(action, "FLAGS", 5, FALSE);
3215 act.sa_flags = svp ? SvIV(*svp) : 0;
3218 /* Now work around sigaction oddities */
3219 if (action && oldaction)
3220 RETVAL = sigaction(sig, & act, & oact);
3222 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3224 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3229 /* Get back the mask. */
3230 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
3231 if (sv_isa(*svp, "POSIX::SigSet")) {
3233 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3234 sigset = (sigset_t*) tmp;
3237 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
3238 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
3240 *sigset = oact.sa_mask;
3242 /* Get back the flags. */
3243 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
3244 sv_setiv(*svp, oact.sa_flags);
3253 POSIX::SigSet sigset
3256 sigprocmask(how, sigset, oldsigset = 0)
3258 POSIX::SigSet sigset
3259 POSIX::SigSet oldsigset
3262 sigsuspend(signal_mask)
3263 POSIX::SigSet signal_mask
3283 lseek(fd, offset, whence)
3296 if (pipe(fds) != -1) {
3298 PUSHs(sv_2mortal(newSViv(fds[0])));
3299 PUSHs(sv_2mortal(newSViv(fds[1])));
3303 read(fd, buffer, nbytes)
3305 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3309 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3312 SvCUR(sv_buffer) = RETVAL;
3313 SvPOK_only(sv_buffer);
3314 *SvEND(sv_buffer) = '\0';
3315 SvTAINTED_on(sv_buffer);
3331 tcsetpgrp(fd, pgrp_id)
3340 if (uname(&buf) >= 0) {
3342 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3343 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3344 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3345 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3346 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3349 uname((char *) 0); /* A stub to call not_here(). */
3353 write(fd, buffer, nbytes)
3371 mbstowcs(s, pwcs, n)
3383 wcstombs(s, pwcs, n)
3405 SET_NUMERIC_LOCAL();
3406 num = strtod(str, &unparsed);
3407 PUSHs(sv_2mortal(newSVnv(num)));
3408 if (GIMME == G_ARRAY) {
3411 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3413 PUSHs(&PL_sv_undef);
3417 strtol(str, base = 0)
3424 num = strtol(str, &unparsed, base);
3425 if (num >= IV_MIN && num <= IV_MAX)
3426 PUSHs(sv_2mortal(newSViv((IV)num)));
3428 PUSHs(sv_2mortal(newSVnv((double)num)));
3429 if (GIMME == G_ARRAY) {
3432 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3434 PUSHs(&PL_sv_undef);
3438 strtoul(str, base = 0)
3445 num = strtoul(str, &unparsed, base);
3447 PUSHs(sv_2mortal(newSViv((IV)num)));
3449 PUSHs(sv_2mortal(newSVnv((double)num)));
3450 if (GIMME == G_ARRAY) {
3453 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3455 PUSHs(&PL_sv_undef);
3465 char *p = SvPV(src,srclen);
3467 ST(0) = sv_2mortal(NEWSV(800,srclen));
3468 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3469 if (dstlen > srclen) {
3471 SvGROW(ST(0), dstlen);
3472 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3475 SvCUR(ST(0)) = dstlen;
3480 mkfifo(filename, mode)
3484 TAINT_PROPER("mkfifo");
3485 RETVAL = mkfifo(filename, mode);
3501 tcflush(fd, queue_selector)
3506 tcsendbreak(fd, duration)
3511 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3524 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3527 mytm.tm_hour = hour;
3528 mytm.tm_mday = mday;
3530 mytm.tm_year = year;
3531 mytm.tm_wday = wday;
3532 mytm.tm_yday = yday;
3533 mytm.tm_isdst = isdst;
3534 RETVAL = asctime(&mytm);
3551 realtime = times( &tms );
3553 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
3554 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
3555 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
3556 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) );
3557 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) );
3560 difftime(time1, time2)
3565 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3578 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3581 mytm.tm_hour = hour;
3582 mytm.tm_mday = mday;
3584 mytm.tm_year = year;
3585 mytm.tm_wday = wday;
3586 mytm.tm_yday = yday;
3587 mytm.tm_isdst = isdst;
3588 RETVAL = mktime(&mytm);
3594 strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)
3610 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3613 mytm.tm_hour = hour;
3614 mytm.tm_mday = mday;
3616 mytm.tm_year = year;
3617 mytm.tm_wday = wday;
3618 mytm.tm_yday = yday;
3619 mytm.tm_isdst = isdst;
3620 (void) mktime(&mytm);
3621 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3622 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3632 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3633 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3636 access(filename, mode)
3654 pathconf(filename, name)