5 #define PERLIO_NOT_STDIO 1
9 #ifdef I_DIRENT /* XXX maybe better to just rely on perl.h? */
32 /* XXX This comment is just to make I_TERMIO and I_SGTTY visible to
33 metaconfig for future extension writers. We don't use them in POSIX.
34 (This is really sneaky :-) --AD
36 #if defined(I_TERMIOS)
44 #include <sys/types.h>
47 #include <unistd.h> /* see hints/sunos_4_1.sh */
51 #if defined(__VMS) && !defined(__POSIX_SOURCE)
52 # include <libdef.h> /* LIB$_INVARG constant */
53 # include <lib$routines.h> /* prototype for lib$ediv() */
54 # include <starlet.h> /* prototype for sys$gettim() */
55 # if DECC_VERSION < 50000000
56 # define pid_t int /* old versions of DECC miss this in types.h */
59 # undef mkfifo /* #defined in perl.h */
60 # define mkfifo(a,b) (not_here("mkfifo"),-1)
61 # define tzset() not_here("tzset")
63 #if ((__VMS_VER >= 70000000) && (__DECC_VER >= 50200000)) || (__CRTL_VER >= 70000000)
64 # define HAS_TZNAME /* shows up in VMS 7.0 or Dec C 5.6 */
66 # endif /* __VMS_VER >= 70000000 or Dec C 5.6 */
68 /* The POSIX notion of ttyname() is better served by getname() under VMS */
69 static char ttnambuf[64];
70 # define ttyname(fd) (isatty(fd) > 0 ? getname(fd,ttnambuf,0) : NULL)
72 /* The non-POSIX CRTL times() has void return type, so we just get the
73 current time directly */
74 clock_t vms_times(struct tms *bufptr) {
76 /* Get wall time and convert to 10 ms intervals to
77 * produce the return value that the POSIX standard expects */
78 # if defined(__DECC) && defined (__ALPHA)
81 _ckvmssts(sys$gettim(&vmstime));
83 retval = vmstime & 0x7fffffff;
85 /* (Older hw or ccs don't have an atomic 64-bit type, so we
86 * juggle 32-bit ints (and a float) to produce a time_t result
87 * with minimal loss of information.) */
88 long int vmstime[2],remainder,divisor = 100000;
89 _ckvmssts(sys$gettim((unsigned long int *)vmstime));
90 vmstime[1] &= 0x7fff; /* prevent overflow in EDIV */
91 _ckvmssts(lib$ediv(&divisor,vmstime,(long int *)&retval,&remainder));
93 /* Fill in the struct tms using the CRTL routine . . .*/
94 times((tbuffer_t *)bufptr);
95 return (clock_t) retval;
97 # define times(t) vms_times(t)
100 # undef mkfifo /* #defined in perl.h */
101 # define mkfifo(a,b) not_here("mkfifo")
102 # define ttyname(a) not_here("ttyname")
103 # define sigset_t long
106 # define tzname _tzname
109 # define mode_t short
112 # define mode_t short
113 # define tzset() not_here("tzset")
115 # define sigaction(a,b,c) not_here("sigaction")
116 # define sigpending(a) not_here("sigpending")
117 # define sigprocmask(a,b,c) not_here("sigprocmask")
118 # define sigsuspend(a) not_here("sigsuspend")
119 # define sigemptyset(a) not_here("sigemptyset")
120 # define sigaddset(a,b) not_here("sigaddset")
121 # define sigdelset(a,b) not_here("sigdelset")
122 # define sigfillset(a) not_here("sigfillset")
123 # define sigismember(a,b) not_here("sigismember")
126 # include <sys/times.h>
128 # include <sys/utsname.h>
130 # include <sys/wait.h>
138 typedef long SysRetLong;
139 typedef sigset_t* POSIX__SigSet;
140 typedef HV* POSIX__SigAction;
142 typedef struct termios* POSIX__Termios;
143 #else /* Define termios types to int, and call not_here for the functions.*/
144 #define POSIX__Termios int
148 #define cfgetispeed(x) not_here("cfgetispeed")
149 #define cfgetospeed(x) not_here("cfgetospeed")
150 #define tcdrain(x) not_here("tcdrain")
151 #define tcflush(x,y) not_here("tcflush")
152 #define tcsendbreak(x,y) not_here("tcsendbreak")
153 #define cfsetispeed(x,y) not_here("cfsetispeed")
154 #define cfsetospeed(x,y) not_here("cfsetospeed")
155 #define ctermid(x) (char *) not_here("ctermid")
156 #define tcflow(x,y) not_here("tcflow")
157 #define tcgetattr(x,y) not_here("tcgetattr")
158 #define tcsetattr(x,y,z) not_here("tcsetattr")
161 /* Possibly needed prototypes */
162 char *cuserid _((char *));
163 double strtod _((const char *, char **));
164 long strtol _((const char *, char **, int));
165 unsigned long strtoul _((const char *, char **, int));
168 #define cuserid(a) (char *) not_here("cuserid")
172 #define difftime(a,b) not_here("difftime")
175 #ifndef HAS_FPATHCONF
176 #define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
179 #define mktime(a) not_here("mktime")
182 #define nice(a) not_here("nice")
185 #define pathconf(f,n) (SysRetLong) not_here("pathconf")
188 #define sysconf(n) (SysRetLong) not_here("sysconf")
191 #define readlink(a,b,c) not_here("readlink")
194 #define setpgid(a,b) not_here("setpgid")
197 #define setsid() not_here("setsid")
200 #define strcoll(s1,s2) not_here("strcoll")
203 #define strtod(s1,s2) not_here("strtod")
206 #define strtol(s1,s2,b) not_here("strtol")
209 #define strtoul(s1,s2,b) not_here("strtoul")
212 #define strxfrm(s1,s2,n) not_here("strxfrm")
214 #ifndef HAS_TCGETPGRP
215 #define tcgetpgrp(a) not_here("tcgetpgrp")
217 #ifndef HAS_TCSETPGRP
218 #define tcsetpgrp(a,b) not_here("tcsetpgrp")
221 #define times(a) not_here("times")
224 #define uname(a) not_here("uname")
227 #define waitpid(a,b,c) not_here("waitpid")
232 #define mblen(a,b) not_here("mblen")
236 #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
239 #define mbtowc(pwc, s, n) not_here("mbtowc")
242 #define wcstombs(s, pwcs, n) not_here("wcstombs")
245 #define wctomb(s, wchar) not_here("wcstombs")
247 #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
248 /* If we don't have these functions, then we wouldn't have gotten a typedef
249 for wchar_t, the wide character type. Defining wchar_t allows the
250 functions referencing it to compile. Its actual type is then meaningless,
251 since without the above functions, all sections using it end up calling
252 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
258 #ifndef HAS_LOCALECONV
259 #define localeconv() not_here("localeconv")
264 extern char *tzname[];
267 char *tzname[] = { "" , "" };
270 /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX)
271 * fields for which we don't have Configure support yet:
272 * char *tm_zone; -- abbreviation of timezone name
273 * long tm_gmtoff; -- offset from GMT in seconds
274 * To workaround core dumps from the uninitialised tm_zone we get the
275 * system to give us a reasonable struct to copy. This fix means that
276 * strftime uses the tm_zone and tm_gmtoff values returned by
277 * localtime(time()). That should give the desired result most of the
278 * time. But probably not always!
280 * This is a temporary workaround to be removed once Configure
281 * support is added and NETaa14816 is considered in full.
282 * It does not address tzname aspects of NETaa14816.
285 # ifndef STRUCT_TM_HASZONE
286 # define STRUCT_TM_HAS_ZONE
290 #ifdef STRUCT_TM_HASZONE
292 init_tm(ptm) /* see mktime, strftime and asctime */
297 Copy(localtime(&now), ptm, 1, struct tm);
301 # define init_tm(ptm)
305 #ifdef HAS_LONG_DOUBLE
306 # if LONG_DOUBLESIZE > DOUBLESIZE
307 # undef HAS_LONG_DOUBLE /* XXX until we figure out how to use them */
311 #ifndef HAS_LONG_DOUBLE
326 croak("POSIX::%s not implemented on this architecture", s);
331 #ifdef HAS_LONG_DOUBLE
336 constant(char *name, int arg)
341 if (strEQ(name, "ARG_MAX"))
349 if (strEQ(name, "BUFSIZ"))
355 if (strEQ(name, "BRKINT"))
361 if (strEQ(name, "B9600"))
367 if (strEQ(name, "B19200"))
373 if (strEQ(name, "B38400"))
379 if (strEQ(name, "B0"))
385 if (strEQ(name, "B110"))
391 if (strEQ(name, "B1200"))
397 if (strEQ(name, "B134"))
403 if (strEQ(name, "B150"))
409 if (strEQ(name, "B1800"))
415 if (strEQ(name, "B200"))
421 if (strEQ(name, "B2400"))
427 if (strEQ(name, "B300"))
433 if (strEQ(name, "B4800"))
439 if (strEQ(name, "B50"))
445 if (strEQ(name, "B600"))
451 if (strEQ(name, "B75"))
459 if (strEQ(name, "CHAR_BIT"))
465 if (strEQ(name, "CHAR_MAX"))
471 if (strEQ(name, "CHAR_MIN"))
477 if (strEQ(name, "CHILD_MAX"))
483 if (strEQ(name, "CLK_TCK"))
489 if (strEQ(name, "CLOCAL"))
495 if (strEQ(name, "CLOCKS_PER_SEC"))
496 #ifdef CLOCKS_PER_SEC
497 return CLOCKS_PER_SEC;
501 if (strEQ(name, "CREAD"))
507 if (strEQ(name, "CS5"))
513 if (strEQ(name, "CS6"))
519 if (strEQ(name, "CS7"))
525 if (strEQ(name, "CS8"))
531 if (strEQ(name, "CSIZE"))
537 if (strEQ(name, "CSTOPB"))
545 if (strEQ(name, "DBL_MAX"))
551 if (strEQ(name, "DBL_MIN"))
557 if (strEQ(name, "DBL_DIG"))
563 if (strEQ(name, "DBL_EPSILON"))
569 if (strEQ(name, "DBL_MANT_DIG"))
575 if (strEQ(name, "DBL_MAX_10_EXP"))
576 #ifdef DBL_MAX_10_EXP
577 return DBL_MAX_10_EXP;
581 if (strEQ(name, "DBL_MAX_EXP"))
587 if (strEQ(name, "DBL_MIN_10_EXP"))
588 #ifdef DBL_MIN_10_EXP
589 return DBL_MIN_10_EXP;
593 if (strEQ(name, "DBL_MIN_EXP"))
603 if (strEQ(name, "EACCES"))
609 if (strEQ(name, "EADDRINUSE"))
615 if (strEQ(name, "EADDRNOTAVAIL"))
617 return EADDRNOTAVAIL;
621 if (strEQ(name, "EAFNOSUPPORT"))
627 if (strEQ(name, "EAGAIN"))
633 if (strEQ(name, "EALREADY"))
641 if (strEQ(name, "EBADF"))
647 if (strEQ(name, "EBUSY"))
655 if (strEQ(name, "ECHILD"))
661 if (strEQ(name, "ECHO"))
667 if (strEQ(name, "ECHOE"))
673 if (strEQ(name, "ECHOK"))
679 if (strEQ(name, "ECHONL"))
685 if (strEQ(name, "ECONNABORTED"))
691 if (strEQ(name, "ECONNREFUSED"))
697 if (strEQ(name, "ECONNRESET"))
705 if (strEQ(name, "EDEADLK"))
711 if (strEQ(name, "EDESTADDRREQ"))
717 if (strEQ(name, "EDOM"))
723 if (strEQ(name, "EDQUOT"))
731 if (strEQ(name, "EEXIST"))
739 if (strEQ(name, "EFAULT"))
745 if (strEQ(name, "EFBIG"))
753 if (strEQ(name, "EHOSTDOWN"))
759 if (strEQ(name, "EHOSTUNREACH"))
767 if (strEQ(name, "EINPROGRESS"))
773 if (strEQ(name, "EINTR"))
779 if (strEQ(name, "EINVAL"))
785 if (strEQ(name, "EIO"))
791 if (strEQ(name, "EISCONN"))
797 if (strEQ(name, "EISDIR"))
803 if (strEQ(name, "ELOOP"))
811 if (strEQ(name, "EMFILE"))
817 if (strEQ(name, "EMLINK"))
823 if (strEQ(name, "EMSGSIZE"))
831 if (strEQ(name, "ENETDOWN"))
837 if (strEQ(name, "ENETRESET"))
843 if (strEQ(name, "ENETUNREACH"))
849 if (strEQ(name, "ENOBUFS"))
855 if (strEQ(name, "ENOEXEC"))
861 if (strEQ(name, "ENOMEM"))
867 if (strEQ(name, "ENOPROTOOPT"))
873 if (strEQ(name, "ENOSPC"))
879 if (strEQ(name, "ENOTBLK"))
885 if (strEQ(name, "ENOTCONN"))
891 if (strEQ(name, "ENOTDIR"))
897 if (strEQ(name, "ENOTEMPTY"))
903 if (strEQ(name, "ENOTSOCK"))
909 if (strEQ(name, "ENOTTY"))
915 if (strEQ(name, "ENFILE"))
921 if (strEQ(name, "ENODEV"))
927 if (strEQ(name, "ENOENT"))
933 if (strEQ(name, "ENOLCK"))
939 if (strEQ(name, "ENOSYS"))
945 if (strEQ(name, "ENXIO"))
951 if (strEQ(name, "ENAMETOOLONG"))
959 if (strEQ(name, "EOF"))
965 if (strEQ(name, "EOPNOTSUPP"))
973 if (strEQ(name, "EPERM"))
979 if (strEQ(name, "EPFNOSUPPORT"))
985 if (strEQ(name, "EPIPE"))
991 if (strEQ(name, "EPROCLIM"))
997 if (strEQ(name, "EPROTONOSUPPORT"))
998 #ifdef EPROTONOSUPPORT
999 return EPROTONOSUPPORT;
1003 if (strEQ(name, "EPROTOTYPE"))
1011 if (strEQ(name, "ERANGE"))
1017 if (strEQ(name, "EREMOTE"))
1023 if (strEQ(name, "ERESTART"))
1029 if (strEQ(name, "EROFS"))
1037 if (strEQ(name, "ESHUTDOWN"))
1043 if (strEQ(name, "ESOCKTNOSUPPORT"))
1044 #ifdef ESOCKTNOSUPPORT
1045 return ESOCKTNOSUPPORT;
1049 if (strEQ(name, "ESPIPE"))
1055 if (strEQ(name, "ESRCH"))
1061 if (strEQ(name, "ESTALE"))
1069 if (strEQ(name, "ETIMEDOUT"))
1075 if (strEQ(name, "ETOOMANYREFS"))
1077 return ETOOMANYREFS;
1081 if (strEQ(name, "ETXTBSY"))
1089 if (strEQ(name, "EUSERS"))
1097 if (strEQ(name, "EWOULDBLOCK"))
1105 if (strEQ(name, "EXIT_FAILURE"))
1107 return EXIT_FAILURE;
1111 if (strEQ(name, "EXIT_SUCCESS"))
1113 return EXIT_SUCCESS;
1117 if (strEQ(name, "EXDEV"))
1125 if (strEQ(name, "E2BIG"))
1133 if (strnEQ(name, "FLT_", 4)) {
1134 if (strEQ(name, "FLT_MAX"))
1140 if (strEQ(name, "FLT_MIN"))
1146 if (strEQ(name, "FLT_ROUNDS"))
1152 if (strEQ(name, "FLT_DIG"))
1158 if (strEQ(name, "FLT_EPSILON"))
1164 if (strEQ(name, "FLT_MANT_DIG"))
1166 return FLT_MANT_DIG;
1170 if (strEQ(name, "FLT_MAX_10_EXP"))
1171 #ifdef FLT_MAX_10_EXP
1172 return FLT_MAX_10_EXP;
1176 if (strEQ(name, "FLT_MAX_EXP"))
1182 if (strEQ(name, "FLT_MIN_10_EXP"))
1183 #ifdef FLT_MIN_10_EXP
1184 return FLT_MIN_10_EXP;
1188 if (strEQ(name, "FLT_MIN_EXP"))
1194 if (strEQ(name, "FLT_RADIX"))
1202 if (strnEQ(name, "F_", 2)) {
1203 if (strEQ(name, "F_DUPFD"))
1209 if (strEQ(name, "F_GETFD"))
1215 if (strEQ(name, "F_GETFL"))
1221 if (strEQ(name, "F_GETLK"))
1227 if (strEQ(name, "F_OK"))
1233 if (strEQ(name, "F_RDLCK"))
1239 if (strEQ(name, "F_SETFD"))
1245 if (strEQ(name, "F_SETFL"))
1251 if (strEQ(name, "F_SETLK"))
1257 if (strEQ(name, "F_SETLKW"))
1263 if (strEQ(name, "F_UNLCK"))
1269 if (strEQ(name, "F_WRLCK"))
1277 if (strEQ(name, "FD_CLOEXEC"))
1283 if (strEQ(name, "FILENAME_MAX"))
1285 return FILENAME_MAX;
1291 if (strEQ(name, "HUGE_VAL"))
1297 if (strEQ(name, "HUPCL"))
1305 if (strEQ(name, "INT_MAX"))
1311 if (strEQ(name, "INT_MIN"))
1317 if (strEQ(name, "ICANON"))
1323 if (strEQ(name, "ICRNL"))
1329 if (strEQ(name, "IEXTEN"))
1335 if (strEQ(name, "IGNBRK"))
1341 if (strEQ(name, "IGNCR"))
1347 if (strEQ(name, "IGNPAR"))
1353 if (strEQ(name, "INLCR"))
1359 if (strEQ(name, "INPCK"))
1365 if (strEQ(name, "ISIG"))
1371 if (strEQ(name, "ISTRIP"))
1377 if (strEQ(name, "IXOFF"))
1383 if (strEQ(name, "IXON"))
1391 if (strnEQ(name, "LC_", 3)) {
1392 if (strEQ(name, "LC_ALL"))
1398 if (strEQ(name, "LC_COLLATE"))
1404 if (strEQ(name, "LC_CTYPE"))
1410 if (strEQ(name, "LC_MONETARY"))
1416 if (strEQ(name, "LC_NUMERIC"))
1422 if (strEQ(name, "LC_TIME"))
1430 if (strnEQ(name, "LDBL_", 5)) {
1431 if (strEQ(name, "LDBL_MAX"))
1437 if (strEQ(name, "LDBL_MIN"))
1443 if (strEQ(name, "LDBL_DIG"))
1449 if (strEQ(name, "LDBL_EPSILON"))
1451 return LDBL_EPSILON;
1455 if (strEQ(name, "LDBL_MANT_DIG"))
1456 #ifdef LDBL_MANT_DIG
1457 return LDBL_MANT_DIG;
1461 if (strEQ(name, "LDBL_MAX_10_EXP"))
1462 #ifdef LDBL_MAX_10_EXP
1463 return LDBL_MAX_10_EXP;
1467 if (strEQ(name, "LDBL_MAX_EXP"))
1469 return LDBL_MAX_EXP;
1473 if (strEQ(name, "LDBL_MIN_10_EXP"))
1474 #ifdef LDBL_MIN_10_EXP
1475 return LDBL_MIN_10_EXP;
1479 if (strEQ(name, "LDBL_MIN_EXP"))
1481 return LDBL_MIN_EXP;
1487 if (strnEQ(name, "L_", 2)) {
1488 if (strEQ(name, "L_ctermid"))
1494 if (strEQ(name, "L_cuserid"))
1500 if (strEQ(name, "L_tmpname"))
1508 if (strEQ(name, "LONG_MAX"))
1514 if (strEQ(name, "LONG_MIN"))
1520 if (strEQ(name, "LINK_MAX"))
1528 if (strEQ(name, "MAX_CANON"))
1534 if (strEQ(name, "MAX_INPUT"))
1540 if (strEQ(name, "MB_CUR_MAX"))
1546 if (strEQ(name, "MB_LEN_MAX"))
1554 if (strEQ(name, "NULL")) return 0;
1555 if (strEQ(name, "NAME_MAX"))
1561 if (strEQ(name, "NCCS"))
1567 if (strEQ(name, "NGROUPS_MAX"))
1573 if (strEQ(name, "NOFLSH"))
1581 if (strnEQ(name, "O_", 2)) {
1582 if (strEQ(name, "O_APPEND"))
1588 if (strEQ(name, "O_CREAT"))
1594 if (strEQ(name, "O_TRUNC"))
1600 if (strEQ(name, "O_RDONLY"))
1606 if (strEQ(name, "O_RDWR"))
1612 if (strEQ(name, "O_WRONLY"))
1618 if (strEQ(name, "O_EXCL"))
1624 if (strEQ(name, "O_NOCTTY"))
1630 if (strEQ(name, "O_NONBLOCK"))
1636 if (strEQ(name, "O_ACCMODE"))
1644 if (strEQ(name, "OPEN_MAX"))
1650 if (strEQ(name, "OPOST"))
1658 if (strEQ(name, "PATH_MAX"))
1664 if (strEQ(name, "PARENB"))
1670 if (strEQ(name, "PARMRK"))
1676 if (strEQ(name, "PARODD"))
1682 if (strEQ(name, "PIPE_BUF"))
1690 if (strEQ(name, "RAND_MAX"))
1696 if (strEQ(name, "R_OK"))
1704 if (strnEQ(name, "SIG", 3)) {
1705 if (name[3] == '_') {
1706 if (strEQ(name, "SIG_BLOCK"))
1713 if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
1716 if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
1719 if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
1721 if (strEQ(name, "SIG_SETMASK"))
1727 if (strEQ(name, "SIG_UNBLOCK"))
1735 if (strEQ(name, "SIGABRT"))
1741 if (strEQ(name, "SIGALRM"))
1747 if (strEQ(name, "SIGCHLD"))
1753 if (strEQ(name, "SIGCONT"))
1759 if (strEQ(name, "SIGFPE"))
1765 if (strEQ(name, "SIGHUP"))
1771 if (strEQ(name, "SIGILL"))
1777 if (strEQ(name, "SIGINT"))
1783 if (strEQ(name, "SIGKILL"))
1789 if (strEQ(name, "SIGPIPE"))
1795 if (strEQ(name, "SIGQUIT"))
1801 if (strEQ(name, "SIGSEGV"))
1807 if (strEQ(name, "SIGSTOP"))
1813 if (strEQ(name, "SIGTERM"))
1819 if (strEQ(name, "SIGTSTP"))
1825 if (strEQ(name, "SIGTTIN"))
1831 if (strEQ(name, "SIGTTOU"))
1837 if (strEQ(name, "SIGUSR1"))
1843 if (strEQ(name, "SIGUSR2"))
1851 if (name[1] == '_') {
1852 if (strEQ(name, "S_ISGID"))
1858 if (strEQ(name, "S_ISUID"))
1864 if (strEQ(name, "S_IRGRP"))
1870 if (strEQ(name, "S_IROTH"))
1876 if (strEQ(name, "S_IRUSR"))
1882 if (strEQ(name, "S_IRWXG"))
1888 if (strEQ(name, "S_IRWXO"))
1894 if (strEQ(name, "S_IRWXU"))
1900 if (strEQ(name, "S_IWGRP"))
1906 if (strEQ(name, "S_IWOTH"))
1912 if (strEQ(name, "S_IWUSR"))
1918 if (strEQ(name, "S_IXGRP"))
1924 if (strEQ(name, "S_IXOTH"))
1930 if (strEQ(name, "S_IXUSR"))
1936 errno = EAGAIN; /* the following aren't constants */
1938 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1941 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1944 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1947 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1950 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1954 if (strEQ(name, "SEEK_CUR"))
1960 if (strEQ(name, "SEEK_END"))
1966 if (strEQ(name, "SEEK_SET"))
1972 if (strEQ(name, "STREAM_MAX"))
1978 if (strEQ(name, "SHRT_MAX"))
1984 if (strEQ(name, "SHRT_MIN"))
1990 if (strnEQ(name, "SA_", 3)) {
1991 if (strEQ(name, "SA_NOCLDSTOP"))
1993 return SA_NOCLDSTOP;
1997 if (strEQ(name, "SA_NOCLDWAIT"))
1999 return SA_NOCLDWAIT;
2003 if (strEQ(name, "SA_NODEFER"))
2009 if (strEQ(name, "SA_ONSTACK"))
2015 if (strEQ(name, "SA_RESETHAND"))
2017 return SA_RESETHAND;
2021 if (strEQ(name, "SA_RESTART"))
2027 if (strEQ(name, "SA_SIGINFO"))
2035 if (strEQ(name, "SCHAR_MAX"))
2041 if (strEQ(name, "SCHAR_MIN"))
2047 if (strEQ(name, "SSIZE_MAX"))
2053 if (strEQ(name, "STDIN_FILENO"))
2055 return STDIN_FILENO;
2059 if (strEQ(name, "STDOUT_FILENO"))
2060 #ifdef STDOUT_FILENO
2061 return STDOUT_FILENO;
2065 if (strEQ(name, "STRERR_FILENO"))
2066 #ifdef STRERR_FILENO
2067 return STRERR_FILENO;
2073 if (strEQ(name, "TCIFLUSH"))
2079 if (strEQ(name, "TCIOFF"))
2085 if (strEQ(name, "TCIOFLUSH"))
2091 if (strEQ(name, "TCION"))
2097 if (strEQ(name, "TCOFLUSH"))
2103 if (strEQ(name, "TCOOFF"))
2109 if (strEQ(name, "TCOON"))
2115 if (strEQ(name, "TCSADRAIN"))
2121 if (strEQ(name, "TCSAFLUSH"))
2127 if (strEQ(name, "TCSANOW"))
2133 if (strEQ(name, "TMP_MAX"))
2139 if (strEQ(name, "TOSTOP"))
2145 if (strEQ(name, "TZNAME_MAX"))
2153 if (strEQ(name, "UCHAR_MAX"))
2159 if (strEQ(name, "UINT_MAX"))
2165 if (strEQ(name, "ULONG_MAX"))
2171 if (strEQ(name, "USHRT_MAX"))
2179 if (strEQ(name, "VEOF"))
2185 if (strEQ(name, "VEOL"))
2191 if (strEQ(name, "VERASE"))
2197 if (strEQ(name, "VINTR"))
2203 if (strEQ(name, "VKILL"))
2209 if (strEQ(name, "VMIN"))
2215 if (strEQ(name, "VQUIT"))
2221 if (strEQ(name, "VSTART"))
2227 if (strEQ(name, "VSTOP"))
2233 if (strEQ(name, "VSUSP"))
2239 if (strEQ(name, "VTIME"))
2247 if (strEQ(name, "W_OK"))
2253 if (strEQ(name, "WNOHANG"))
2259 if (strEQ(name, "WUNTRACED"))
2265 errno = EAGAIN; /* the following aren't constants */
2267 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2270 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2273 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2276 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2279 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2282 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2286 if (strEQ(name, "X_OK"))
2294 if (strnEQ(name, "_PC_", 4)) {
2295 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2296 #if defined(_PC_CHOWN_RESTRICTED) || HINT_SC_EXIST
2297 return _PC_CHOWN_RESTRICTED;
2301 if (strEQ(name, "_PC_LINK_MAX"))
2302 #if defined(_PC_LINK_MAX) || HINT_SC_EXIST
2303 return _PC_LINK_MAX;
2307 if (strEQ(name, "_PC_MAX_CANON"))
2308 #if defined(_PC_MAX_CANON) || HINT_SC_EXIST
2309 return _PC_MAX_CANON;
2313 if (strEQ(name, "_PC_MAX_INPUT"))
2314 #if defined(_PC_MAX_INPUT) || HINT_SC_EXIST
2315 return _PC_MAX_INPUT;
2319 if (strEQ(name, "_PC_NAME_MAX"))
2320 #if defined(_PC_NAME_MAX) || HINT_SC_EXIST
2321 return _PC_NAME_MAX;
2325 if (strEQ(name, "_PC_NO_TRUNC"))
2326 #if defined(_PC_NO_TRUNC) || HINT_SC_EXIST
2327 return _PC_NO_TRUNC;
2331 if (strEQ(name, "_PC_PATH_MAX"))
2332 #if defined(_PC_PATH_MAX) || HINT_SC_EXIST
2333 return _PC_PATH_MAX;
2337 if (strEQ(name, "_PC_PIPE_BUF"))
2338 #if defined(_PC_PIPE_BUF) || HINT_SC_EXIST
2339 return _PC_PIPE_BUF;
2343 if (strEQ(name, "_PC_VDISABLE"))
2344 #if defined(_PC_VDISABLE) || HINT_SC_EXIST
2345 return _PC_VDISABLE;
2351 if (strnEQ(name, "_POSIX_", 7)) {
2352 if (strEQ(name, "_POSIX_ARG_MAX"))
2353 #ifdef _POSIX_ARG_MAX
2354 return _POSIX_ARG_MAX;
2358 if (strEQ(name, "_POSIX_CHILD_MAX"))
2359 #ifdef _POSIX_CHILD_MAX
2360 return _POSIX_CHILD_MAX;
2364 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2365 #ifdef _POSIX_CHOWN_RESTRICTED
2366 return _POSIX_CHOWN_RESTRICTED;
2370 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2371 #ifdef _POSIX_JOB_CONTROL
2372 return _POSIX_JOB_CONTROL;
2376 if (strEQ(name, "_POSIX_LINK_MAX"))
2377 #ifdef _POSIX_LINK_MAX
2378 return _POSIX_LINK_MAX;
2382 if (strEQ(name, "_POSIX_MAX_CANON"))
2383 #ifdef _POSIX_MAX_CANON
2384 return _POSIX_MAX_CANON;
2388 if (strEQ(name, "_POSIX_MAX_INPUT"))
2389 #ifdef _POSIX_MAX_INPUT
2390 return _POSIX_MAX_INPUT;
2394 if (strEQ(name, "_POSIX_NAME_MAX"))
2395 #ifdef _POSIX_NAME_MAX
2396 return _POSIX_NAME_MAX;
2400 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2401 #ifdef _POSIX_NGROUPS_MAX
2402 return _POSIX_NGROUPS_MAX;
2406 if (strEQ(name, "_POSIX_NO_TRUNC"))
2407 #ifdef _POSIX_NO_TRUNC
2408 return _POSIX_NO_TRUNC;
2412 if (strEQ(name, "_POSIX_OPEN_MAX"))
2413 #ifdef _POSIX_OPEN_MAX
2414 return _POSIX_OPEN_MAX;
2418 if (strEQ(name, "_POSIX_PATH_MAX"))
2419 #ifdef _POSIX_PATH_MAX
2420 return _POSIX_PATH_MAX;
2424 if (strEQ(name, "_POSIX_PIPE_BUF"))
2425 #ifdef _POSIX_PIPE_BUF
2426 return _POSIX_PIPE_BUF;
2430 if (strEQ(name, "_POSIX_SAVED_IDS"))
2431 #ifdef _POSIX_SAVED_IDS
2432 return _POSIX_SAVED_IDS;
2436 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2437 #ifdef _POSIX_SSIZE_MAX
2438 return _POSIX_SSIZE_MAX;
2442 if (strEQ(name, "_POSIX_STREAM_MAX"))
2443 #ifdef _POSIX_STREAM_MAX
2444 return _POSIX_STREAM_MAX;
2448 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2449 #ifdef _POSIX_TZNAME_MAX
2450 return _POSIX_TZNAME_MAX;
2454 if (strEQ(name, "_POSIX_VDISABLE"))
2455 #ifdef _POSIX_VDISABLE
2456 return _POSIX_VDISABLE;
2460 if (strEQ(name, "_POSIX_VERSION"))
2461 #ifdef _POSIX_VERSION
2462 return _POSIX_VERSION;
2468 if (strnEQ(name, "_SC_", 4)) {
2469 if (strEQ(name, "_SC_ARG_MAX"))
2470 #if defined(_SC_ARG_MAX) || HINT_SC_EXIST
2475 if (strEQ(name, "_SC_CHILD_MAX"))
2476 #if defined(_SC_CHILD_MAX) || HINT_SC_EXIST
2477 return _SC_CHILD_MAX;
2481 if (strEQ(name, "_SC_CLK_TCK"))
2482 #if defined(_SC_CLK_TCK) || HINT_SC_EXIST
2487 if (strEQ(name, "_SC_JOB_CONTROL"))
2488 #if defined(_SC_JOB_CONTROL) || HINT_SC_EXIST
2489 return _SC_JOB_CONTROL;
2493 if (strEQ(name, "_SC_NGROUPS_MAX"))
2494 #if defined(_SC_NGROUPS_MAX) || HINT_SC_EXIST
2495 return _SC_NGROUPS_MAX;
2499 if (strEQ(name, "_SC_OPEN_MAX"))
2500 #if defined(_SC_OPEN_MAX) || HINT_SC_EXIST
2501 return _SC_OPEN_MAX;
2505 if (strEQ(name, "_SC_SAVED_IDS"))
2506 #if defined(_SC_SAVED_IDS) || HINT_SC_EXIST
2507 return _SC_SAVED_IDS;
2511 if (strEQ(name, "_SC_STREAM_MAX"))
2512 #if defined(_SC_STREAM_MAX) || HINT_SC_EXIST
2513 return _SC_STREAM_MAX;
2517 if (strEQ(name, "_SC_TZNAME_MAX"))
2518 #if defined(_SC_TZNAME_MAX) || HINT_SC_EXIST
2519 return _SC_TZNAME_MAX;
2523 if (strEQ(name, "_SC_VERSION"))
2524 #if defined(_SC_VERSION) || HINT_SC_EXIST
2540 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2543 new(packname = "POSIX::SigSet", ...)
2548 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2549 sigemptyset(RETVAL);
2550 for (i = 1; i < items; i++)
2551 sigaddset(RETVAL, SvIV(ST(i)));
2558 POSIX::SigSet sigset
2560 safefree((char *)sigset);
2563 sigaddset(sigset, sig)
2564 POSIX::SigSet sigset
2568 sigdelset(sigset, sig)
2569 POSIX::SigSet sigset
2574 POSIX::SigSet sigset
2578 POSIX::SigSet sigset
2581 sigismember(sigset, sig)
2582 POSIX::SigSet sigset
2586 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2589 new(packname = "POSIX::Termios", ...)
2594 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2596 not_here("termios");
2604 DESTROY(termios_ref)
2605 POSIX::Termios termios_ref
2608 safefree((char *)termios_ref);
2610 not_here("termios");
2614 getattr(termios_ref, fd = 0)
2615 POSIX::Termios termios_ref
2618 RETVAL = tcgetattr(fd, termios_ref);
2623 setattr(termios_ref, fd = 0, optional_actions = 0)
2624 POSIX::Termios termios_ref
2626 int optional_actions
2628 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2633 cfgetispeed(termios_ref)
2634 POSIX::Termios termios_ref
2637 cfgetospeed(termios_ref)
2638 POSIX::Termios termios_ref
2641 getiflag(termios_ref)
2642 POSIX::Termios termios_ref
2644 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2645 RETVAL = termios_ref->c_iflag;
2647 not_here("getiflag");
2654 getoflag(termios_ref)
2655 POSIX::Termios termios_ref
2657 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2658 RETVAL = termios_ref->c_oflag;
2660 not_here("getoflag");
2667 getcflag(termios_ref)
2668 POSIX::Termios termios_ref
2670 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2671 RETVAL = termios_ref->c_cflag;
2673 not_here("getcflag");
2680 getlflag(termios_ref)
2681 POSIX::Termios termios_ref
2683 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2684 RETVAL = termios_ref->c_lflag;
2686 not_here("getlflag");
2693 getcc(termios_ref, ccix)
2694 POSIX::Termios termios_ref
2697 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2699 croak("Bad getcc subscript");
2700 RETVAL = termios_ref->c_cc[ccix];
2709 cfsetispeed(termios_ref, speed)
2710 POSIX::Termios termios_ref
2714 cfsetospeed(termios_ref, speed)
2715 POSIX::Termios termios_ref
2719 setiflag(termios_ref, iflag)
2720 POSIX::Termios termios_ref
2723 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2724 termios_ref->c_iflag = iflag;
2726 not_here("setiflag");
2730 setoflag(termios_ref, oflag)
2731 POSIX::Termios termios_ref
2734 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2735 termios_ref->c_oflag = oflag;
2737 not_here("setoflag");
2741 setcflag(termios_ref, cflag)
2742 POSIX::Termios termios_ref
2745 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2746 termios_ref->c_cflag = cflag;
2748 not_here("setcflag");
2752 setlflag(termios_ref, lflag)
2753 POSIX::Termios termios_ref
2756 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2757 termios_ref->c_lflag = lflag;
2759 not_here("setlflag");
2763 setcc(termios_ref, ccix, cc)
2764 POSIX::Termios termios_ref
2768 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2770 croak("Bad setcc subscript");
2771 termios_ref->c_cc[ccix] = cc;
2777 MODULE = POSIX PACKAGE = POSIX
2786 unsigned char * charstring
2788 unsigned char *s = charstring;
2789 unsigned char *e = s + na; /* "na" set by typemap side effect */
2790 for (RETVAL = 1; RETVAL && s < e; s++)
2798 unsigned char * charstring
2800 unsigned char *s = charstring;
2801 unsigned char *e = s + na; /* "na" set by typemap side effect */
2802 for (RETVAL = 1; RETVAL && s < e; s++)
2810 unsigned char * charstring
2812 unsigned char *s = charstring;
2813 unsigned char *e = s + na; /* "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 + na; /* "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 + na; /* "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 + na; /* "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 + na; /* "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 + na; /* "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 + na; /* "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 + na; /* "na" set by typemap side effect */
2898 for (RETVAL = 1; RETVAL && s < e; s++)
2905 isxdigit(charstring)
2906 unsigned char * charstring
2908 unsigned char *s = charstring;
2909 unsigned char *e = s + na; /* "na" set by typemap side effect */
2910 for (RETVAL = 1; RETVAL && s < e; s++)
2917 open(filename, flags = O_RDONLY, mode = 0666)
2922 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2923 TAINT_PROPER("open");
2924 RETVAL = open(filename, flags, mode);
2932 #ifdef HAS_LOCALECONV
2933 struct lconv *lcbuf;
2935 SET_NUMERIC_LOCAL();
2936 if (lcbuf = localeconv()) {
2938 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2939 hv_store(RETVAL, "decimal_point", 13,
2940 newSVpv(lcbuf->decimal_point, 0), 0);
2941 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2942 hv_store(RETVAL, "thousands_sep", 13,
2943 newSVpv(lcbuf->thousands_sep, 0), 0);
2944 if (lcbuf->grouping && *lcbuf->grouping)
2945 hv_store(RETVAL, "grouping", 8,
2946 newSVpv(lcbuf->grouping, 0), 0);
2947 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2948 hv_store(RETVAL, "int_curr_symbol", 15,
2949 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2950 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2951 hv_store(RETVAL, "currency_symbol", 15,
2952 newSVpv(lcbuf->currency_symbol, 0), 0);
2953 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2954 hv_store(RETVAL, "mon_decimal_point", 17,
2955 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2956 #ifndef NO_LOCALECONV_MON_THOUSANDS_SEP
2957 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2958 hv_store(RETVAL, "mon_thousands_sep", 17,
2959 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2961 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2962 hv_store(RETVAL, "mon_grouping", 12,
2963 newSVpv(lcbuf->mon_grouping, 0), 0);
2964 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2965 hv_store(RETVAL, "positive_sign", 13,
2966 newSVpv(lcbuf->positive_sign, 0), 0);
2967 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2968 hv_store(RETVAL, "negative_sign", 13,
2969 newSVpv(lcbuf->negative_sign, 0), 0);
2971 if (lcbuf->int_frac_digits != CHAR_MAX)
2972 hv_store(RETVAL, "int_frac_digits", 15,
2973 newSViv(lcbuf->int_frac_digits), 0);
2974 if (lcbuf->frac_digits != CHAR_MAX)
2975 hv_store(RETVAL, "frac_digits", 11,
2976 newSViv(lcbuf->frac_digits), 0);
2977 if (lcbuf->p_cs_precedes != CHAR_MAX)
2978 hv_store(RETVAL, "p_cs_precedes", 13,
2979 newSViv(lcbuf->p_cs_precedes), 0);
2980 if (lcbuf->p_sep_by_space != CHAR_MAX)
2981 hv_store(RETVAL, "p_sep_by_space", 14,
2982 newSViv(lcbuf->p_sep_by_space), 0);
2983 if (lcbuf->n_cs_precedes != CHAR_MAX)
2984 hv_store(RETVAL, "n_cs_precedes", 13,
2985 newSViv(lcbuf->n_cs_precedes), 0);
2986 if (lcbuf->n_sep_by_space != CHAR_MAX)
2987 hv_store(RETVAL, "n_sep_by_space", 14,
2988 newSViv(lcbuf->n_sep_by_space), 0);
2989 if (lcbuf->p_sign_posn != CHAR_MAX)
2990 hv_store(RETVAL, "p_sign_posn", 11,
2991 newSViv(lcbuf->p_sign_posn), 0);
2992 if (lcbuf->n_sign_posn != CHAR_MAX)
2993 hv_store(RETVAL, "n_sign_posn", 11,
2994 newSViv(lcbuf->n_sign_posn), 0);
2997 localeconv(); /* A stub to call not_here(). */
3003 setlocale(category, locale = 0)
3007 RETVAL = setlocale(category, locale);
3009 #ifdef USE_LOCALE_CTYPE
3010 if (category == LC_CTYPE
3012 || category == LC_ALL
3018 if (category == LC_ALL)
3019 newctype = setlocale(LC_CTYPE, NULL);
3023 perl_new_ctype(newctype);
3025 #endif /* USE_LOCALE_CTYPE */
3026 #ifdef USE_LOCALE_COLLATE
3027 if (category == LC_COLLATE
3029 || category == LC_ALL
3035 if (category == LC_ALL)
3036 newcoll = setlocale(LC_COLLATE, NULL);
3040 perl_new_collate(newcoll);
3042 #endif /* USE_LOCALE_COLLATE */
3043 #ifdef USE_LOCALE_NUMERIC
3044 if (category == LC_NUMERIC
3046 || category == LC_ALL
3052 if (category == LC_ALL)
3053 newnum = setlocale(LC_NUMERIC, NULL);
3057 perl_new_numeric(newnum);
3059 #endif /* USE_LOCALE_NUMERIC */
3099 /* (We already know stack is long enough.) */
3100 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3101 PUSHs(sv_2mortal(newSViv(expvar)));
3117 /* (We already know stack is long enough.) */
3118 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3119 PUSHs(sv_2mortal(newSVnv(intvar)));
3134 sigaction(sig, action, oldaction = 0)
3136 POSIX::SigAction action
3137 POSIX::SigAction oldaction
3140 RETVAL = not_here("sigaction");
3142 # This code is really grody because we're trying to make the signal
3143 # interface look beautiful, which is hard.
3146 gv_fetchpv("SIG", TRUE, SVt_PVHV);
3149 struct sigaction act;
3150 struct sigaction oact;
3151 POSIX__SigSet sigset;
3153 SV** sigsvp = hv_fetch(GvHVn(siggv),
3155 strlen(sig_name[sig]),
3158 /* Remember old handler name if desired. */
3160 char *hand = SvPVx(*sigsvp, na);
3161 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
3162 sv_setpv(*svp, *hand ? hand : "DEFAULT");
3166 /* Vector new handler through %SIG. (We always use sighandler
3167 for the C signal handler, which reads %SIG to dispatch.) */
3168 svp = hv_fetch(action, "HANDLER", 7, FALSE);
3170 croak("Can't supply an action without a HANDLER");
3171 sv_setpv(*sigsvp, SvPV(*svp, na));
3172 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
3173 act.sa_handler = sighandler;
3175 /* Set up any desired mask. */
3176 svp = hv_fetch(action, "MASK", 4, FALSE);
3177 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
3179 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3180 sigset = (sigset_t*) tmp;
3181 act.sa_mask = *sigset;
3184 sigemptyset(& act.sa_mask);
3186 /* Set up any desired flags. */
3187 svp = hv_fetch(action, "FLAGS", 5, FALSE);
3188 act.sa_flags = svp ? SvIV(*svp) : 0;
3191 /* Now work around sigaction oddities */
3192 if (action && oldaction)
3193 RETVAL = sigaction(sig, & act, & oact);
3195 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3197 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3202 /* Get back the mask. */
3203 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
3204 if (sv_isa(*svp, "POSIX::SigSet")) {
3206 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3207 sigset = (sigset_t*) tmp;
3210 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
3211 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
3213 *sigset = oact.sa_mask;
3215 /* Get back the flags. */
3216 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
3217 sv_setiv(*svp, oact.sa_flags);
3226 POSIX::SigSet sigset
3229 sigprocmask(how, sigset, oldsigset = 0)
3231 POSIX::SigSet sigset
3232 POSIX::SigSet oldsigset
3235 sigsuspend(signal_mask)
3236 POSIX::SigSet signal_mask
3256 lseek(fd, offset, whence)
3269 if (pipe(fds) != -1) {
3271 PUSHs(sv_2mortal(newSViv(fds[0])));
3272 PUSHs(sv_2mortal(newSViv(fds[1])));
3276 read(fd, buffer, nbytes)
3278 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3282 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3285 SvCUR(sv_buffer) = RETVAL;
3286 SvPOK_only(sv_buffer);
3287 *SvEND(sv_buffer) = '\0';
3288 SvTAINTED_on(sv_buffer);
3304 tcsetpgrp(fd, pgrp_id)
3313 if (uname(&buf) >= 0) {
3315 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3316 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3317 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3318 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3319 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3322 uname((char *) 0); /* A stub to call not_here(). */
3326 write(fd, buffer, nbytes)
3344 mbstowcs(s, pwcs, n)
3356 wcstombs(s, pwcs, n)
3378 SET_NUMERIC_LOCAL();
3379 num = strtod(str, &unparsed);
3380 PUSHs(sv_2mortal(newSVnv(num)));
3381 if (GIMME == G_ARRAY) {
3384 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3390 strtol(str, base = 0)
3397 num = strtol(str, &unparsed, base);
3398 if (num >= IV_MIN && num <= IV_MAX)
3399 PUSHs(sv_2mortal(newSViv((IV)num)));
3401 PUSHs(sv_2mortal(newSVnv((double)num)));
3402 if (GIMME == G_ARRAY) {
3405 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3411 strtoul(str, base = 0)
3418 num = strtoul(str, &unparsed, base);
3420 PUSHs(sv_2mortal(newSViv((IV)num)));
3422 PUSHs(sv_2mortal(newSVnv((double)num)));
3423 if (GIMME == G_ARRAY) {
3426 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3438 char *p = SvPV(src,srclen);
3440 ST(0) = sv_2mortal(NEWSV(800,srclen));
3441 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3442 if (dstlen > srclen) {
3444 SvGROW(ST(0), dstlen);
3445 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3448 SvCUR(ST(0)) = dstlen;
3453 mkfifo(filename, mode)
3457 TAINT_PROPER("mkfifo");
3458 RETVAL = mkfifo(filename, mode);
3474 tcflush(fd, queue_selector)
3479 tcsendbreak(fd, duration)
3484 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3497 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3500 mytm.tm_hour = hour;
3501 mytm.tm_mday = mday;
3503 mytm.tm_year = year;
3504 mytm.tm_wday = wday;
3505 mytm.tm_yday = yday;
3506 mytm.tm_isdst = isdst;
3507 RETVAL = asctime(&mytm);
3524 realtime = times( &tms );
3526 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
3527 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
3528 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
3529 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) );
3530 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) );
3533 difftime(time1, time2)
3538 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3551 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3554 mytm.tm_hour = hour;
3555 mytm.tm_mday = mday;
3557 mytm.tm_year = year;
3558 mytm.tm_wday = wday;
3559 mytm.tm_yday = yday;
3560 mytm.tm_isdst = isdst;
3561 RETVAL = mktime(&mytm);
3567 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3583 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3586 mytm.tm_hour = hour;
3587 mytm.tm_mday = mday;
3589 mytm.tm_year = year;
3590 mytm.tm_wday = wday;
3591 mytm.tm_yday = yday;
3592 mytm.tm_isdst = isdst;
3593 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3594 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3604 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3605 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3608 access(filename, mode)
3626 pathconf(filename, name)