5 #define PERLIO_NOT_STDIO 1
8 #ifdef PERL_OBJECT /* XXX _very_ temporary hacks */
11 # define open PerlLIO_open3
13 # define TAINT_PROPER(a)
16 #ifdef I_DIRENT /* XXX maybe better to just rely on perl.h? */
39 /* XXX This comment is just to make I_TERMIO and I_SGTTY visible to
40 metaconfig for future extension writers. We don't use them in POSIX.
41 (This is really sneaky :-) --AD
43 #if defined(I_TERMIOS)
51 #include <sys/types.h>
54 #include <unistd.h> /* see hints/sunos_4_1.sh */
58 #if defined(__VMS) && !defined(__POSIX_SOURCE)
59 # include <libdef.h> /* LIB$_INVARG constant */
60 # include <lib$routines.h> /* prototype for lib$ediv() */
61 # include <starlet.h> /* prototype for sys$gettim() */
62 # if DECC_VERSION < 50000000
63 # define pid_t int /* old versions of DECC miss this in types.h */
66 # undef mkfifo /* #defined in perl.h */
67 # define mkfifo(a,b) (not_here("mkfifo"),-1)
68 # define tzset() not_here("tzset")
70 #if ((__VMS_VER >= 70000000) && (__DECC_VER >= 50200000)) || (__CRTL_VER >= 70000000)
71 # define HAS_TZNAME /* shows up in VMS 7.0 or Dec C 5.6 */
73 # endif /* __VMS_VER >= 70000000 or Dec C 5.6 */
75 /* The POSIX notion of ttyname() is better served by getname() under VMS */
76 static char ttnambuf[64];
77 # define ttyname(fd) (isatty(fd) > 0 ? getname(fd,ttnambuf,0) : NULL)
79 /* The non-POSIX CRTL times() has void return type, so we just get the
80 current time directly */
81 clock_t vms_times(struct tms *bufptr) {
83 /* Get wall time and convert to 10 ms intervals to
84 * produce the return value that the POSIX standard expects */
85 # if defined(__DECC) && defined (__ALPHA)
88 _ckvmssts(sys$gettim(&vmstime));
90 retval = vmstime & 0x7fffffff;
92 /* (Older hw or ccs don't have an atomic 64-bit type, so we
93 * juggle 32-bit ints (and a float) to produce a time_t result
94 * with minimal loss of information.) */
95 long int vmstime[2],remainder,divisor = 100000;
96 _ckvmssts(sys$gettim((unsigned long int *)vmstime));
97 vmstime[1] &= 0x7fff; /* prevent overflow in EDIV */
98 _ckvmssts(lib$ediv(&divisor,vmstime,(long int *)&retval,&remainder));
100 /* Fill in the struct tms using the CRTL routine . . .*/
101 times((tbuffer_t *)bufptr);
102 return (clock_t) retval;
104 # define times(t) vms_times(t)
107 # undef mkfifo /* #defined in perl.h */
108 # define mkfifo(a,b) not_here("mkfifo")
109 # define ttyname(a) (char*)not_here("ttyname")
110 # define sigset_t long
113 # define tzname _tzname
116 # define mode_t short
118 # define sigaction(a,b,c) not_here("sigaction")
119 # define sigpending(a) not_here("sigpending")
120 # define sigprocmask(a,b,c) not_here("sigprocmask")
121 # define sigsuspend(a) not_here("sigsuspend")
122 # define sigemptyset(a) not_here("sigemptyset")
123 # define sigaddset(a,b) not_here("sigaddset")
124 # define sigdelset(a,b) not_here("sigdelset")
125 # define sigfillset(a) not_here("sigfillset")
126 # define sigismember(a,b) not_here("sigismember")
129 # include <sys/times.h>
131 # include <sys/utsname.h>
133 # include <sys/wait.h>
141 typedef long SysRetLong;
142 typedef sigset_t* POSIX__SigSet;
143 typedef HV* POSIX__SigAction;
145 typedef struct termios* POSIX__Termios;
146 #else /* Define termios types to int, and call not_here for the functions.*/
147 #define POSIX__Termios int
151 #define cfgetispeed(x) not_here("cfgetispeed")
152 #define cfgetospeed(x) not_here("cfgetospeed")
153 #define tcdrain(x) not_here("tcdrain")
154 #define tcflush(x,y) not_here("tcflush")
155 #define tcsendbreak(x,y) not_here("tcsendbreak")
156 #define cfsetispeed(x,y) not_here("cfsetispeed")
157 #define cfsetospeed(x,y) not_here("cfsetospeed")
158 #define ctermid(x) (char *) not_here("ctermid")
159 #define tcflow(x,y) not_here("tcflow")
160 #define tcgetattr(x,y) not_here("tcgetattr")
161 #define tcsetattr(x,y,z) not_here("tcsetattr")
164 /* Possibly needed prototypes */
165 char *cuserid _((char *));
166 double strtod _((const char *, char **));
167 long strtol _((const char *, char **, int));
168 unsigned long strtoul _((const char *, char **, int));
171 #define cuserid(a) (char *) not_here("cuserid")
175 #define difftime(a,b) not_here("difftime")
178 #ifndef HAS_FPATHCONF
179 #define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
182 #define mktime(a) not_here("mktime")
185 #define nice(a) not_here("nice")
188 #define pathconf(f,n) (SysRetLong) not_here("pathconf")
191 #define sysconf(n) (SysRetLong) not_here("sysconf")
194 #define readlink(a,b,c) not_here("readlink")
197 #define setpgid(a,b) not_here("setpgid")
200 #define setsid() not_here("setsid")
203 #define strcoll(s1,s2) not_here("strcoll")
206 #define strtod(s1,s2) not_here("strtod")
209 #define strtol(s1,s2,b) not_here("strtol")
212 #define strtoul(s1,s2,b) not_here("strtoul")
215 #define strxfrm(s1,s2,n) not_here("strxfrm")
217 #ifndef HAS_TCGETPGRP
218 #define tcgetpgrp(a) not_here("tcgetpgrp")
220 #ifndef HAS_TCSETPGRP
221 #define tcsetpgrp(a,b) not_here("tcsetpgrp")
224 #define times(a) not_here("times")
227 #define uname(a) not_here("uname")
230 #define waitpid(a,b,c) not_here("waitpid")
235 #define mblen(a,b) not_here("mblen")
239 #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
242 #define mbtowc(pwc, s, n) not_here("mbtowc")
245 #define wcstombs(s, pwcs, n) not_here("wcstombs")
248 #define wctomb(s, wchar) not_here("wcstombs")
250 #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
251 /* If we don't have these functions, then we wouldn't have gotten a typedef
252 for wchar_t, the wide character type. Defining wchar_t allows the
253 functions referencing it to compile. Its actual type is then meaningless,
254 since without the above functions, all sections using it end up calling
255 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
261 #ifndef HAS_LOCALECONV
262 #define localeconv() not_here("localeconv")
267 extern char *tzname[];
269 char *tzname[] = { "" , "" };
273 /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX)
274 * fields for which we don't have Configure support yet:
275 * char *tm_zone; -- abbreviation of timezone name
276 * long tm_gmtoff; -- offset from GMT in seconds
277 * To workaround core dumps from the uninitialised tm_zone we get the
278 * system to give us a reasonable struct to copy. This fix means that
279 * strftime uses the tm_zone and tm_gmtoff values returned by
280 * localtime(time()). That should give the desired result most of the
281 * time. But probably not always!
283 * This is a temporary workaround to be removed once Configure
284 * support is added and NETaa14816 is considered in full.
285 * It does not address tzname aspects of NETaa14816.
288 # ifndef STRUCT_TM_HASZONE
289 # define STRUCT_TM_HAS_ZONE
293 #ifdef STRUCT_TM_HASZONE
295 init_tm(ptm) /* see mktime, strftime and asctime */
300 Copy(localtime(&now), ptm, 1, struct tm);
304 # define init_tm(ptm)
308 #ifdef HAS_LONG_DOUBLE
309 # if LONG_DOUBLESIZE > DOUBLESIZE
310 # undef HAS_LONG_DOUBLE /* XXX until we figure out how to use them */
314 #ifndef HAS_LONG_DOUBLE
329 croak("POSIX::%s not implemented on this architecture", s);
334 #ifdef HAS_LONG_DOUBLE
339 constant(char *name, int arg)
344 if (strEQ(name, "ARG_MAX"))
352 if (strEQ(name, "BUFSIZ"))
358 if (strEQ(name, "BRKINT"))
364 if (strEQ(name, "B9600"))
370 if (strEQ(name, "B19200"))
376 if (strEQ(name, "B38400"))
382 if (strEQ(name, "B0"))
388 if (strEQ(name, "B110"))
394 if (strEQ(name, "B1200"))
400 if (strEQ(name, "B134"))
406 if (strEQ(name, "B150"))
412 if (strEQ(name, "B1800"))
418 if (strEQ(name, "B200"))
424 if (strEQ(name, "B2400"))
430 if (strEQ(name, "B300"))
436 if (strEQ(name, "B4800"))
442 if (strEQ(name, "B50"))
448 if (strEQ(name, "B600"))
454 if (strEQ(name, "B75"))
462 if (strEQ(name, "CHAR_BIT"))
468 if (strEQ(name, "CHAR_MAX"))
474 if (strEQ(name, "CHAR_MIN"))
480 if (strEQ(name, "CHILD_MAX"))
486 if (strEQ(name, "CLK_TCK"))
492 if (strEQ(name, "CLOCAL"))
498 if (strEQ(name, "CLOCKS_PER_SEC"))
499 #ifdef CLOCKS_PER_SEC
500 return CLOCKS_PER_SEC;
504 if (strEQ(name, "CREAD"))
510 if (strEQ(name, "CS5"))
516 if (strEQ(name, "CS6"))
522 if (strEQ(name, "CS7"))
528 if (strEQ(name, "CS8"))
534 if (strEQ(name, "CSIZE"))
540 if (strEQ(name, "CSTOPB"))
548 if (strEQ(name, "DBL_MAX"))
554 if (strEQ(name, "DBL_MIN"))
560 if (strEQ(name, "DBL_DIG"))
566 if (strEQ(name, "DBL_EPSILON"))
572 if (strEQ(name, "DBL_MANT_DIG"))
578 if (strEQ(name, "DBL_MAX_10_EXP"))
579 #ifdef DBL_MAX_10_EXP
580 return DBL_MAX_10_EXP;
584 if (strEQ(name, "DBL_MAX_EXP"))
590 if (strEQ(name, "DBL_MIN_10_EXP"))
591 #ifdef DBL_MIN_10_EXP
592 return DBL_MIN_10_EXP;
596 if (strEQ(name, "DBL_MIN_EXP"))
606 if (strEQ(name, "EACCES"))
612 if (strEQ(name, "EADDRINUSE"))
618 if (strEQ(name, "EADDRNOTAVAIL"))
620 return EADDRNOTAVAIL;
624 if (strEQ(name, "EAFNOSUPPORT"))
630 if (strEQ(name, "EAGAIN"))
636 if (strEQ(name, "EALREADY"))
644 if (strEQ(name, "EBADF"))
650 if (strEQ(name, "EBUSY"))
658 if (strEQ(name, "ECHILD"))
664 if (strEQ(name, "ECHO"))
670 if (strEQ(name, "ECHOE"))
676 if (strEQ(name, "ECHOK"))
682 if (strEQ(name, "ECHONL"))
688 if (strEQ(name, "ECONNABORTED"))
694 if (strEQ(name, "ECONNREFUSED"))
700 if (strEQ(name, "ECONNRESET"))
708 if (strEQ(name, "EDEADLK"))
714 if (strEQ(name, "EDESTADDRREQ"))
720 if (strEQ(name, "EDOM"))
726 if (strEQ(name, "EDQUOT"))
734 if (strEQ(name, "EEXIST"))
742 if (strEQ(name, "EFAULT"))
748 if (strEQ(name, "EFBIG"))
756 if (strEQ(name, "EHOSTDOWN"))
762 if (strEQ(name, "EHOSTUNREACH"))
770 if (strEQ(name, "EINPROGRESS"))
776 if (strEQ(name, "EINTR"))
782 if (strEQ(name, "EINVAL"))
788 if (strEQ(name, "EIO"))
794 if (strEQ(name, "EISCONN"))
800 if (strEQ(name, "EISDIR"))
806 if (strEQ(name, "ELOOP"))
814 if (strEQ(name, "EMFILE"))
820 if (strEQ(name, "EMLINK"))
826 if (strEQ(name, "EMSGSIZE"))
834 if (strEQ(name, "ENETDOWN"))
840 if (strEQ(name, "ENETRESET"))
846 if (strEQ(name, "ENETUNREACH"))
852 if (strEQ(name, "ENOBUFS"))
858 if (strEQ(name, "ENOEXEC"))
864 if (strEQ(name, "ENOMEM"))
870 if (strEQ(name, "ENOPROTOOPT"))
876 if (strEQ(name, "ENOSPC"))
882 if (strEQ(name, "ENOTBLK"))
888 if (strEQ(name, "ENOTCONN"))
894 if (strEQ(name, "ENOTDIR"))
900 if (strEQ(name, "ENOTEMPTY"))
906 if (strEQ(name, "ENOTSOCK"))
912 if (strEQ(name, "ENOTTY"))
918 if (strEQ(name, "ENFILE"))
924 if (strEQ(name, "ENODEV"))
930 if (strEQ(name, "ENOENT"))
936 if (strEQ(name, "ENOLCK"))
942 if (strEQ(name, "ENOSYS"))
948 if (strEQ(name, "ENXIO"))
954 if (strEQ(name, "ENAMETOOLONG"))
962 if (strEQ(name, "EOF"))
968 if (strEQ(name, "EOPNOTSUPP"))
976 if (strEQ(name, "EPERM"))
982 if (strEQ(name, "EPFNOSUPPORT"))
988 if (strEQ(name, "EPIPE"))
994 if (strEQ(name, "EPROCLIM"))
1000 if (strEQ(name, "EPROTONOSUPPORT"))
1001 #ifdef EPROTONOSUPPORT
1002 return EPROTONOSUPPORT;
1006 if (strEQ(name, "EPROTOTYPE"))
1014 if (strEQ(name, "ERANGE"))
1020 if (strEQ(name, "EREMOTE"))
1026 if (strEQ(name, "ERESTART"))
1032 if (strEQ(name, "EROFS"))
1040 if (strEQ(name, "ESHUTDOWN"))
1046 if (strEQ(name, "ESOCKTNOSUPPORT"))
1047 #ifdef ESOCKTNOSUPPORT
1048 return ESOCKTNOSUPPORT;
1052 if (strEQ(name, "ESPIPE"))
1058 if (strEQ(name, "ESRCH"))
1064 if (strEQ(name, "ESTALE"))
1072 if (strEQ(name, "ETIMEDOUT"))
1078 if (strEQ(name, "ETOOMANYREFS"))
1080 return ETOOMANYREFS;
1084 if (strEQ(name, "ETXTBSY"))
1092 if (strEQ(name, "EUSERS"))
1100 if (strEQ(name, "EWOULDBLOCK"))
1108 if (strEQ(name, "EXIT_FAILURE"))
1110 return EXIT_FAILURE;
1114 if (strEQ(name, "EXIT_SUCCESS"))
1116 return EXIT_SUCCESS;
1120 if (strEQ(name, "EXDEV"))
1128 if (strEQ(name, "E2BIG"))
1136 if (strnEQ(name, "FLT_", 4)) {
1137 if (strEQ(name, "FLT_MAX"))
1143 if (strEQ(name, "FLT_MIN"))
1149 if (strEQ(name, "FLT_ROUNDS"))
1155 if (strEQ(name, "FLT_DIG"))
1161 if (strEQ(name, "FLT_EPSILON"))
1167 if (strEQ(name, "FLT_MANT_DIG"))
1169 return FLT_MANT_DIG;
1173 if (strEQ(name, "FLT_MAX_10_EXP"))
1174 #ifdef FLT_MAX_10_EXP
1175 return FLT_MAX_10_EXP;
1179 if (strEQ(name, "FLT_MAX_EXP"))
1185 if (strEQ(name, "FLT_MIN_10_EXP"))
1186 #ifdef FLT_MIN_10_EXP
1187 return FLT_MIN_10_EXP;
1191 if (strEQ(name, "FLT_MIN_EXP"))
1197 if (strEQ(name, "FLT_RADIX"))
1205 if (strnEQ(name, "F_", 2)) {
1206 if (strEQ(name, "F_DUPFD"))
1212 if (strEQ(name, "F_GETFD"))
1218 if (strEQ(name, "F_GETFL"))
1224 if (strEQ(name, "F_GETLK"))
1230 if (strEQ(name, "F_OK"))
1236 if (strEQ(name, "F_RDLCK"))
1242 if (strEQ(name, "F_SETFD"))
1248 if (strEQ(name, "F_SETFL"))
1254 if (strEQ(name, "F_SETLK"))
1260 if (strEQ(name, "F_SETLKW"))
1266 if (strEQ(name, "F_UNLCK"))
1272 if (strEQ(name, "F_WRLCK"))
1280 if (strEQ(name, "FD_CLOEXEC"))
1286 if (strEQ(name, "FILENAME_MAX"))
1288 return FILENAME_MAX;
1294 if (strEQ(name, "HUGE_VAL"))
1300 if (strEQ(name, "HUPCL"))
1308 if (strEQ(name, "INT_MAX"))
1314 if (strEQ(name, "INT_MIN"))
1320 if (strEQ(name, "ICANON"))
1326 if (strEQ(name, "ICRNL"))
1332 if (strEQ(name, "IEXTEN"))
1338 if (strEQ(name, "IGNBRK"))
1344 if (strEQ(name, "IGNCR"))
1350 if (strEQ(name, "IGNPAR"))
1356 if (strEQ(name, "INLCR"))
1362 if (strEQ(name, "INPCK"))
1368 if (strEQ(name, "ISIG"))
1374 if (strEQ(name, "ISTRIP"))
1380 if (strEQ(name, "IXOFF"))
1386 if (strEQ(name, "IXON"))
1394 if (strnEQ(name, "LC_", 3)) {
1395 if (strEQ(name, "LC_ALL"))
1401 if (strEQ(name, "LC_COLLATE"))
1407 if (strEQ(name, "LC_CTYPE"))
1413 if (strEQ(name, "LC_MONETARY"))
1419 if (strEQ(name, "LC_NUMERIC"))
1425 if (strEQ(name, "LC_TIME"))
1433 if (strnEQ(name, "LDBL_", 5)) {
1434 if (strEQ(name, "LDBL_MAX"))
1440 if (strEQ(name, "LDBL_MIN"))
1446 if (strEQ(name, "LDBL_DIG"))
1452 if (strEQ(name, "LDBL_EPSILON"))
1454 return LDBL_EPSILON;
1458 if (strEQ(name, "LDBL_MANT_DIG"))
1459 #ifdef LDBL_MANT_DIG
1460 return LDBL_MANT_DIG;
1464 if (strEQ(name, "LDBL_MAX_10_EXP"))
1465 #ifdef LDBL_MAX_10_EXP
1466 return LDBL_MAX_10_EXP;
1470 if (strEQ(name, "LDBL_MAX_EXP"))
1472 return LDBL_MAX_EXP;
1476 if (strEQ(name, "LDBL_MIN_10_EXP"))
1477 #ifdef LDBL_MIN_10_EXP
1478 return LDBL_MIN_10_EXP;
1482 if (strEQ(name, "LDBL_MIN_EXP"))
1484 return LDBL_MIN_EXP;
1490 if (strnEQ(name, "L_", 2)) {
1491 if (strEQ(name, "L_ctermid"))
1497 if (strEQ(name, "L_cuserid"))
1503 if (strEQ(name, "L_tmpname"))
1511 if (strEQ(name, "LONG_MAX"))
1517 if (strEQ(name, "LONG_MIN"))
1523 if (strEQ(name, "LINK_MAX"))
1531 if (strEQ(name, "MAX_CANON"))
1537 if (strEQ(name, "MAX_INPUT"))
1543 if (strEQ(name, "MB_CUR_MAX"))
1549 if (strEQ(name, "MB_LEN_MAX"))
1557 if (strEQ(name, "NULL")) return 0;
1558 if (strEQ(name, "NAME_MAX"))
1564 if (strEQ(name, "NCCS"))
1570 if (strEQ(name, "NGROUPS_MAX"))
1576 if (strEQ(name, "NOFLSH"))
1584 if (strnEQ(name, "O_", 2)) {
1585 if (strEQ(name, "O_APPEND"))
1591 if (strEQ(name, "O_CREAT"))
1597 if (strEQ(name, "O_TRUNC"))
1603 if (strEQ(name, "O_RDONLY"))
1609 if (strEQ(name, "O_RDWR"))
1615 if (strEQ(name, "O_WRONLY"))
1621 if (strEQ(name, "O_EXCL"))
1627 if (strEQ(name, "O_NOCTTY"))
1633 if (strEQ(name, "O_NONBLOCK"))
1639 if (strEQ(name, "O_ACCMODE"))
1647 if (strEQ(name, "OPEN_MAX"))
1653 if (strEQ(name, "OPOST"))
1661 if (strEQ(name, "PATH_MAX"))
1667 if (strEQ(name, "PARENB"))
1673 if (strEQ(name, "PARMRK"))
1679 if (strEQ(name, "PARODD"))
1685 if (strEQ(name, "PIPE_BUF"))
1693 if (strEQ(name, "RAND_MAX"))
1699 if (strEQ(name, "R_OK"))
1707 if (strnEQ(name, "SIG", 3)) {
1708 if (name[3] == '_') {
1709 if (strEQ(name, "SIG_BLOCK"))
1716 if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
1719 if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
1722 if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
1724 if (strEQ(name, "SIG_SETMASK"))
1730 if (strEQ(name, "SIG_UNBLOCK"))
1738 if (strEQ(name, "SIGABRT"))
1744 if (strEQ(name, "SIGALRM"))
1750 if (strEQ(name, "SIGCHLD"))
1756 if (strEQ(name, "SIGCONT"))
1762 if (strEQ(name, "SIGFPE"))
1768 if (strEQ(name, "SIGHUP"))
1774 if (strEQ(name, "SIGILL"))
1780 if (strEQ(name, "SIGINT"))
1786 if (strEQ(name, "SIGKILL"))
1792 if (strEQ(name, "SIGPIPE"))
1798 if (strEQ(name, "SIGQUIT"))
1804 if (strEQ(name, "SIGSEGV"))
1810 if (strEQ(name, "SIGSTOP"))
1816 if (strEQ(name, "SIGTERM"))
1822 if (strEQ(name, "SIGTSTP"))
1828 if (strEQ(name, "SIGTTIN"))
1834 if (strEQ(name, "SIGTTOU"))
1840 if (strEQ(name, "SIGUSR1"))
1846 if (strEQ(name, "SIGUSR2"))
1854 if (name[1] == '_') {
1855 if (strEQ(name, "S_ISGID"))
1861 if (strEQ(name, "S_ISUID"))
1867 if (strEQ(name, "S_IRGRP"))
1873 if (strEQ(name, "S_IROTH"))
1879 if (strEQ(name, "S_IRUSR"))
1885 if (strEQ(name, "S_IRWXG"))
1891 if (strEQ(name, "S_IRWXO"))
1897 if (strEQ(name, "S_IRWXU"))
1903 if (strEQ(name, "S_IWGRP"))
1909 if (strEQ(name, "S_IWOTH"))
1915 if (strEQ(name, "S_IWUSR"))
1921 if (strEQ(name, "S_IXGRP"))
1927 if (strEQ(name, "S_IXOTH"))
1933 if (strEQ(name, "S_IXUSR"))
1939 errno = EAGAIN; /* the following aren't constants */
1941 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1944 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1947 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1950 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1953 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1957 if (strEQ(name, "SEEK_CUR"))
1963 if (strEQ(name, "SEEK_END"))
1969 if (strEQ(name, "SEEK_SET"))
1975 if (strEQ(name, "STREAM_MAX"))
1981 if (strEQ(name, "SHRT_MAX"))
1987 if (strEQ(name, "SHRT_MIN"))
1993 if (strnEQ(name, "SA_", 3)) {
1994 if (strEQ(name, "SA_NOCLDSTOP"))
1996 return SA_NOCLDSTOP;
2000 if (strEQ(name, "SA_NOCLDWAIT"))
2002 return SA_NOCLDWAIT;
2006 if (strEQ(name, "SA_NODEFER"))
2012 if (strEQ(name, "SA_ONSTACK"))
2018 if (strEQ(name, "SA_RESETHAND"))
2020 return SA_RESETHAND;
2024 if (strEQ(name, "SA_RESTART"))
2030 if (strEQ(name, "SA_SIGINFO"))
2038 if (strEQ(name, "SCHAR_MAX"))
2044 if (strEQ(name, "SCHAR_MIN"))
2050 if (strEQ(name, "SSIZE_MAX"))
2056 if (strEQ(name, "STDIN_FILENO"))
2058 return STDIN_FILENO;
2062 if (strEQ(name, "STDOUT_FILENO"))
2063 #ifdef STDOUT_FILENO
2064 return STDOUT_FILENO;
2068 if (strEQ(name, "STRERR_FILENO"))
2069 #ifdef STRERR_FILENO
2070 return STRERR_FILENO;
2076 if (strEQ(name, "TCIFLUSH"))
2082 if (strEQ(name, "TCIOFF"))
2088 if (strEQ(name, "TCIOFLUSH"))
2094 if (strEQ(name, "TCION"))
2100 if (strEQ(name, "TCOFLUSH"))
2106 if (strEQ(name, "TCOOFF"))
2112 if (strEQ(name, "TCOON"))
2118 if (strEQ(name, "TCSADRAIN"))
2124 if (strEQ(name, "TCSAFLUSH"))
2130 if (strEQ(name, "TCSANOW"))
2136 if (strEQ(name, "TMP_MAX"))
2142 if (strEQ(name, "TOSTOP"))
2148 if (strEQ(name, "TZNAME_MAX"))
2156 if (strEQ(name, "UCHAR_MAX"))
2162 if (strEQ(name, "UINT_MAX"))
2168 if (strEQ(name, "ULONG_MAX"))
2174 if (strEQ(name, "USHRT_MAX"))
2182 if (strEQ(name, "VEOF"))
2188 if (strEQ(name, "VEOL"))
2194 if (strEQ(name, "VERASE"))
2200 if (strEQ(name, "VINTR"))
2206 if (strEQ(name, "VKILL"))
2212 if (strEQ(name, "VMIN"))
2218 if (strEQ(name, "VQUIT"))
2224 if (strEQ(name, "VSTART"))
2230 if (strEQ(name, "VSTOP"))
2236 if (strEQ(name, "VSUSP"))
2242 if (strEQ(name, "VTIME"))
2250 if (strEQ(name, "W_OK"))
2256 if (strEQ(name, "WNOHANG"))
2262 if (strEQ(name, "WUNTRACED"))
2268 errno = EAGAIN; /* the following aren't constants */
2270 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2273 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2276 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2279 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2282 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2285 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2289 if (strEQ(name, "X_OK"))
2297 if (strnEQ(name, "_PC_", 4)) {
2298 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2299 #if defined(_PC_CHOWN_RESTRICTED) || HINT_SC_EXIST
2300 return _PC_CHOWN_RESTRICTED;
2304 if (strEQ(name, "_PC_LINK_MAX"))
2305 #if defined(_PC_LINK_MAX) || HINT_SC_EXIST
2306 return _PC_LINK_MAX;
2310 if (strEQ(name, "_PC_MAX_CANON"))
2311 #if defined(_PC_MAX_CANON) || HINT_SC_EXIST
2312 return _PC_MAX_CANON;
2316 if (strEQ(name, "_PC_MAX_INPUT"))
2317 #if defined(_PC_MAX_INPUT) || HINT_SC_EXIST
2318 return _PC_MAX_INPUT;
2322 if (strEQ(name, "_PC_NAME_MAX"))
2323 #if defined(_PC_NAME_MAX) || HINT_SC_EXIST
2324 return _PC_NAME_MAX;
2328 if (strEQ(name, "_PC_NO_TRUNC"))
2329 #if defined(_PC_NO_TRUNC) || HINT_SC_EXIST
2330 return _PC_NO_TRUNC;
2334 if (strEQ(name, "_PC_PATH_MAX"))
2335 #if defined(_PC_PATH_MAX) || HINT_SC_EXIST
2336 return _PC_PATH_MAX;
2340 if (strEQ(name, "_PC_PIPE_BUF"))
2341 #if defined(_PC_PIPE_BUF) || HINT_SC_EXIST
2342 return _PC_PIPE_BUF;
2346 if (strEQ(name, "_PC_VDISABLE"))
2347 #if defined(_PC_VDISABLE) || HINT_SC_EXIST
2348 return _PC_VDISABLE;
2354 if (strnEQ(name, "_POSIX_", 7)) {
2355 if (strEQ(name, "_POSIX_ARG_MAX"))
2356 #ifdef _POSIX_ARG_MAX
2357 return _POSIX_ARG_MAX;
2361 if (strEQ(name, "_POSIX_CHILD_MAX"))
2362 #ifdef _POSIX_CHILD_MAX
2363 return _POSIX_CHILD_MAX;
2367 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2368 #ifdef _POSIX_CHOWN_RESTRICTED
2369 return _POSIX_CHOWN_RESTRICTED;
2373 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2374 #ifdef _POSIX_JOB_CONTROL
2375 return _POSIX_JOB_CONTROL;
2379 if (strEQ(name, "_POSIX_LINK_MAX"))
2380 #ifdef _POSIX_LINK_MAX
2381 return _POSIX_LINK_MAX;
2385 if (strEQ(name, "_POSIX_MAX_CANON"))
2386 #ifdef _POSIX_MAX_CANON
2387 return _POSIX_MAX_CANON;
2391 if (strEQ(name, "_POSIX_MAX_INPUT"))
2392 #ifdef _POSIX_MAX_INPUT
2393 return _POSIX_MAX_INPUT;
2397 if (strEQ(name, "_POSIX_NAME_MAX"))
2398 #ifdef _POSIX_NAME_MAX
2399 return _POSIX_NAME_MAX;
2403 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2404 #ifdef _POSIX_NGROUPS_MAX
2405 return _POSIX_NGROUPS_MAX;
2409 if (strEQ(name, "_POSIX_NO_TRUNC"))
2410 #ifdef _POSIX_NO_TRUNC
2411 return _POSIX_NO_TRUNC;
2415 if (strEQ(name, "_POSIX_OPEN_MAX"))
2416 #ifdef _POSIX_OPEN_MAX
2417 return _POSIX_OPEN_MAX;
2421 if (strEQ(name, "_POSIX_PATH_MAX"))
2422 #ifdef _POSIX_PATH_MAX
2423 return _POSIX_PATH_MAX;
2427 if (strEQ(name, "_POSIX_PIPE_BUF"))
2428 #ifdef _POSIX_PIPE_BUF
2429 return _POSIX_PIPE_BUF;
2433 if (strEQ(name, "_POSIX_SAVED_IDS"))
2434 #ifdef _POSIX_SAVED_IDS
2435 return _POSIX_SAVED_IDS;
2439 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2440 #ifdef _POSIX_SSIZE_MAX
2441 return _POSIX_SSIZE_MAX;
2445 if (strEQ(name, "_POSIX_STREAM_MAX"))
2446 #ifdef _POSIX_STREAM_MAX
2447 return _POSIX_STREAM_MAX;
2451 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2452 #ifdef _POSIX_TZNAME_MAX
2453 return _POSIX_TZNAME_MAX;
2457 if (strEQ(name, "_POSIX_VDISABLE"))
2458 #ifdef _POSIX_VDISABLE
2459 return _POSIX_VDISABLE;
2463 if (strEQ(name, "_POSIX_VERSION"))
2464 #ifdef _POSIX_VERSION
2465 return _POSIX_VERSION;
2471 if (strnEQ(name, "_SC_", 4)) {
2472 if (strEQ(name, "_SC_ARG_MAX"))
2473 #if defined(_SC_ARG_MAX) || HINT_SC_EXIST
2478 if (strEQ(name, "_SC_CHILD_MAX"))
2479 #if defined(_SC_CHILD_MAX) || HINT_SC_EXIST
2480 return _SC_CHILD_MAX;
2484 if (strEQ(name, "_SC_CLK_TCK"))
2485 #if defined(_SC_CLK_TCK) || HINT_SC_EXIST
2490 if (strEQ(name, "_SC_JOB_CONTROL"))
2491 #if defined(_SC_JOB_CONTROL) || HINT_SC_EXIST
2492 return _SC_JOB_CONTROL;
2496 if (strEQ(name, "_SC_NGROUPS_MAX"))
2497 #if defined(_SC_NGROUPS_MAX) || HINT_SC_EXIST
2498 return _SC_NGROUPS_MAX;
2502 if (strEQ(name, "_SC_OPEN_MAX"))
2503 #if defined(_SC_OPEN_MAX) || HINT_SC_EXIST
2504 return _SC_OPEN_MAX;
2508 if (strEQ(name, "_SC_SAVED_IDS"))
2509 #if defined(_SC_SAVED_IDS) || HINT_SC_EXIST
2510 return _SC_SAVED_IDS;
2514 if (strEQ(name, "_SC_STREAM_MAX"))
2515 #if defined(_SC_STREAM_MAX) || HINT_SC_EXIST
2516 return _SC_STREAM_MAX;
2520 if (strEQ(name, "_SC_TZNAME_MAX"))
2521 #if defined(_SC_TZNAME_MAX) || HINT_SC_EXIST
2522 return _SC_TZNAME_MAX;
2526 if (strEQ(name, "_SC_VERSION"))
2527 #if defined(_SC_VERSION) || HINT_SC_EXIST
2543 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2546 new(packname = "POSIX::SigSet", ...)
2551 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2552 sigemptyset(RETVAL);
2553 for (i = 1; i < items; i++)
2554 sigaddset(RETVAL, SvIV(ST(i)));
2561 POSIX::SigSet sigset
2563 safefree((char *)sigset);
2566 sigaddset(sigset, sig)
2567 POSIX::SigSet sigset
2571 sigdelset(sigset, sig)
2572 POSIX::SigSet sigset
2577 POSIX::SigSet sigset
2581 POSIX::SigSet sigset
2584 sigismember(sigset, sig)
2585 POSIX::SigSet sigset
2589 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2592 new(packname = "POSIX::Termios", ...)
2597 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2599 not_here("termios");
2607 DESTROY(termios_ref)
2608 POSIX::Termios termios_ref
2611 safefree((char *)termios_ref);
2613 not_here("termios");
2617 getattr(termios_ref, fd = 0)
2618 POSIX::Termios termios_ref
2621 RETVAL = tcgetattr(fd, termios_ref);
2626 setattr(termios_ref, fd = 0, optional_actions = 0)
2627 POSIX::Termios termios_ref
2629 int optional_actions
2631 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2636 cfgetispeed(termios_ref)
2637 POSIX::Termios termios_ref
2640 cfgetospeed(termios_ref)
2641 POSIX::Termios termios_ref
2644 getiflag(termios_ref)
2645 POSIX::Termios termios_ref
2647 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2648 RETVAL = termios_ref->c_iflag;
2650 not_here("getiflag");
2657 getoflag(termios_ref)
2658 POSIX::Termios termios_ref
2660 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2661 RETVAL = termios_ref->c_oflag;
2663 not_here("getoflag");
2670 getcflag(termios_ref)
2671 POSIX::Termios termios_ref
2673 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2674 RETVAL = termios_ref->c_cflag;
2676 not_here("getcflag");
2683 getlflag(termios_ref)
2684 POSIX::Termios termios_ref
2686 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2687 RETVAL = termios_ref->c_lflag;
2689 not_here("getlflag");
2696 getcc(termios_ref, ccix)
2697 POSIX::Termios termios_ref
2700 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2702 croak("Bad getcc subscript");
2703 RETVAL = termios_ref->c_cc[ccix];
2712 cfsetispeed(termios_ref, speed)
2713 POSIX::Termios termios_ref
2717 cfsetospeed(termios_ref, speed)
2718 POSIX::Termios termios_ref
2722 setiflag(termios_ref, iflag)
2723 POSIX::Termios termios_ref
2726 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2727 termios_ref->c_iflag = iflag;
2729 not_here("setiflag");
2733 setoflag(termios_ref, oflag)
2734 POSIX::Termios termios_ref
2737 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2738 termios_ref->c_oflag = oflag;
2740 not_here("setoflag");
2744 setcflag(termios_ref, cflag)
2745 POSIX::Termios termios_ref
2748 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2749 termios_ref->c_cflag = cflag;
2751 not_here("setcflag");
2755 setlflag(termios_ref, lflag)
2756 POSIX::Termios termios_ref
2759 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2760 termios_ref->c_lflag = lflag;
2762 not_here("setlflag");
2766 setcc(termios_ref, ccix, cc)
2767 POSIX::Termios termios_ref
2771 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2773 croak("Bad setcc subscript");
2774 termios_ref->c_cc[ccix] = cc;
2780 MODULE = POSIX PACKAGE = POSIX
2789 unsigned char * charstring
2791 unsigned char *s = charstring;
2792 unsigned char *e = s + na; /* "na" set by typemap side effect */
2793 for (RETVAL = 1; RETVAL && s < e; s++)
2801 unsigned char * charstring
2803 unsigned char *s = charstring;
2804 unsigned char *e = s + na; /* "na" set by typemap side effect */
2805 for (RETVAL = 1; RETVAL && s < e; s++)
2813 unsigned char * charstring
2815 unsigned char *s = charstring;
2816 unsigned char *e = s + na; /* "na" set by typemap side effect */
2817 for (RETVAL = 1; RETVAL && s < e; s++)
2825 unsigned char * charstring
2827 unsigned char *s = charstring;
2828 unsigned char *e = s + na; /* "na" set by typemap side effect */
2829 for (RETVAL = 1; RETVAL && s < e; s++)
2837 unsigned char * charstring
2839 unsigned char *s = charstring;
2840 unsigned char *e = s + na; /* "na" set by typemap side effect */
2841 for (RETVAL = 1; RETVAL && s < e; s++)
2849 unsigned char * charstring
2851 unsigned char *s = charstring;
2852 unsigned char *e = s + na; /* "na" set by typemap side effect */
2853 for (RETVAL = 1; RETVAL && s < e; s++)
2861 unsigned char * charstring
2863 unsigned char *s = charstring;
2864 unsigned char *e = s + na; /* "na" set by typemap side effect */
2865 for (RETVAL = 1; RETVAL && s < e; s++)
2873 unsigned char * charstring
2875 unsigned char *s = charstring;
2876 unsigned char *e = s + na; /* "na" set by typemap side effect */
2877 for (RETVAL = 1; RETVAL && s < e; s++)
2885 unsigned char * charstring
2887 unsigned char *s = charstring;
2888 unsigned char *e = s + na; /* "na" set by typemap side effect */
2889 for (RETVAL = 1; RETVAL && s < e; s++)
2897 unsigned char * charstring
2899 unsigned char *s = charstring;
2900 unsigned char *e = s + na; /* "na" set by typemap side effect */
2901 for (RETVAL = 1; RETVAL && s < e; s++)
2908 isxdigit(charstring)
2909 unsigned char * charstring
2911 unsigned char *s = charstring;
2912 unsigned char *e = s + na; /* "na" set by typemap side effect */
2913 for (RETVAL = 1; RETVAL && s < e; s++)
2920 open(filename, flags = O_RDONLY, mode = 0666)
2925 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2926 TAINT_PROPER("open");
2927 RETVAL = open(filename, flags, mode);
2935 #ifdef HAS_LOCALECONV
2936 struct lconv *lcbuf;
2938 SET_NUMERIC_LOCAL();
2939 if (lcbuf = localeconv()) {
2941 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2942 hv_store(RETVAL, "decimal_point", 13,
2943 newSVpv(lcbuf->decimal_point, 0), 0);
2944 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2945 hv_store(RETVAL, "thousands_sep", 13,
2946 newSVpv(lcbuf->thousands_sep, 0), 0);
2947 if (lcbuf->grouping && *lcbuf->grouping)
2948 hv_store(RETVAL, "grouping", 8,
2949 newSVpv(lcbuf->grouping, 0), 0);
2950 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2951 hv_store(RETVAL, "int_curr_symbol", 15,
2952 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2953 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2954 hv_store(RETVAL, "currency_symbol", 15,
2955 newSVpv(lcbuf->currency_symbol, 0), 0);
2956 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2957 hv_store(RETVAL, "mon_decimal_point", 17,
2958 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2959 #ifndef NO_LOCALECONV_MON_THOUSANDS_SEP
2960 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2961 hv_store(RETVAL, "mon_thousands_sep", 17,
2962 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2964 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2965 hv_store(RETVAL, "mon_grouping", 12,
2966 newSVpv(lcbuf->mon_grouping, 0), 0);
2967 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2968 hv_store(RETVAL, "positive_sign", 13,
2969 newSVpv(lcbuf->positive_sign, 0), 0);
2970 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2971 hv_store(RETVAL, "negative_sign", 13,
2972 newSVpv(lcbuf->negative_sign, 0), 0);
2974 if (lcbuf->int_frac_digits != CHAR_MAX)
2975 hv_store(RETVAL, "int_frac_digits", 15,
2976 newSViv(lcbuf->int_frac_digits), 0);
2977 if (lcbuf->frac_digits != CHAR_MAX)
2978 hv_store(RETVAL, "frac_digits", 11,
2979 newSViv(lcbuf->frac_digits), 0);
2980 if (lcbuf->p_cs_precedes != CHAR_MAX)
2981 hv_store(RETVAL, "p_cs_precedes", 13,
2982 newSViv(lcbuf->p_cs_precedes), 0);
2983 if (lcbuf->p_sep_by_space != CHAR_MAX)
2984 hv_store(RETVAL, "p_sep_by_space", 14,
2985 newSViv(lcbuf->p_sep_by_space), 0);
2986 if (lcbuf->n_cs_precedes != CHAR_MAX)
2987 hv_store(RETVAL, "n_cs_precedes", 13,
2988 newSViv(lcbuf->n_cs_precedes), 0);
2989 if (lcbuf->n_sep_by_space != CHAR_MAX)
2990 hv_store(RETVAL, "n_sep_by_space", 14,
2991 newSViv(lcbuf->n_sep_by_space), 0);
2992 if (lcbuf->p_sign_posn != CHAR_MAX)
2993 hv_store(RETVAL, "p_sign_posn", 11,
2994 newSViv(lcbuf->p_sign_posn), 0);
2995 if (lcbuf->n_sign_posn != CHAR_MAX)
2996 hv_store(RETVAL, "n_sign_posn", 11,
2997 newSViv(lcbuf->n_sign_posn), 0);
3000 localeconv(); /* A stub to call not_here(). */
3006 setlocale(category, locale = 0)
3010 RETVAL = setlocale(category, locale);
3012 #ifdef USE_LOCALE_CTYPE
3013 if (category == LC_CTYPE
3015 || category == LC_ALL
3021 if (category == LC_ALL)
3022 newctype = setlocale(LC_CTYPE, NULL);
3026 perl_new_ctype(newctype);
3028 #endif /* USE_LOCALE_CTYPE */
3029 #ifdef USE_LOCALE_COLLATE
3030 if (category == LC_COLLATE
3032 || category == LC_ALL
3038 if (category == LC_ALL)
3039 newcoll = setlocale(LC_COLLATE, NULL);
3043 perl_new_collate(newcoll);
3045 #endif /* USE_LOCALE_COLLATE */
3046 #ifdef USE_LOCALE_NUMERIC
3047 if (category == LC_NUMERIC
3049 || category == LC_ALL
3055 if (category == LC_ALL)
3056 newnum = setlocale(LC_NUMERIC, NULL);
3060 perl_new_numeric(newnum);
3062 #endif /* USE_LOCALE_NUMERIC */
3102 /* (We already know stack is long enough.) */
3103 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3104 PUSHs(sv_2mortal(newSViv(expvar)));
3120 /* (We already know stack is long enough.) */
3121 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3122 PUSHs(sv_2mortal(newSVnv(intvar)));
3137 sigaction(sig, action, oldaction = 0)
3139 POSIX::SigAction action
3140 POSIX::SigAction oldaction
3143 RETVAL = not_here("sigaction");
3145 # This code is really grody because we're trying to make the signal
3146 # interface look beautiful, which is hard.
3149 gv_fetchpv("SIG", TRUE, SVt_PVHV);
3152 struct sigaction act;
3153 struct sigaction oact;
3154 POSIX__SigSet sigset;
3156 SV** sigsvp = hv_fetch(GvHVn(siggv),
3158 strlen(sig_name[sig]),
3161 /* Remember old handler name if desired. */
3163 char *hand = SvPVx(*sigsvp, na);
3164 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
3165 sv_setpv(*svp, *hand ? hand : "DEFAULT");
3169 /* Vector new handler through %SIG. (We always use sighandler
3170 for the C signal handler, which reads %SIG to dispatch.) */
3171 svp = hv_fetch(action, "HANDLER", 7, FALSE);
3173 croak("Can't supply an action without a HANDLER");
3174 sv_setpv(*sigsvp, SvPV(*svp, na));
3175 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
3176 act.sa_handler = sighandler;
3178 /* Set up any desired mask. */
3179 svp = hv_fetch(action, "MASK", 4, FALSE);
3180 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
3182 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3183 sigset = (sigset_t*) tmp;
3184 act.sa_mask = *sigset;
3187 sigemptyset(& act.sa_mask);
3189 /* Set up any desired flags. */
3190 svp = hv_fetch(action, "FLAGS", 5, FALSE);
3191 act.sa_flags = svp ? SvIV(*svp) : 0;
3194 /* Now work around sigaction oddities */
3195 if (action && oldaction)
3196 RETVAL = sigaction(sig, & act, & oact);
3198 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3200 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3205 /* Get back the mask. */
3206 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
3207 if (sv_isa(*svp, "POSIX::SigSet")) {
3209 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3210 sigset = (sigset_t*) tmp;
3213 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
3214 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
3216 *sigset = oact.sa_mask;
3218 /* Get back the flags. */
3219 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
3220 sv_setiv(*svp, oact.sa_flags);
3229 POSIX::SigSet sigset
3232 sigprocmask(how, sigset, oldsigset = 0)
3234 POSIX::SigSet sigset
3235 POSIX::SigSet oldsigset
3238 sigsuspend(signal_mask)
3239 POSIX::SigSet signal_mask
3259 lseek(fd, offset, whence)
3272 if (pipe(fds) != -1) {
3274 PUSHs(sv_2mortal(newSViv(fds[0])));
3275 PUSHs(sv_2mortal(newSViv(fds[1])));
3279 read(fd, buffer, nbytes)
3281 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3285 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3288 SvCUR(sv_buffer) = RETVAL;
3289 SvPOK_only(sv_buffer);
3290 *SvEND(sv_buffer) = '\0';
3291 SvTAINTED_on(sv_buffer);
3307 tcsetpgrp(fd, pgrp_id)
3316 if (uname(&buf) >= 0) {
3318 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3319 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3320 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3321 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3322 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3325 uname((char *) 0); /* A stub to call not_here(). */
3329 write(fd, buffer, nbytes)
3347 mbstowcs(s, pwcs, n)
3359 wcstombs(s, pwcs, n)
3381 SET_NUMERIC_LOCAL();
3382 num = strtod(str, &unparsed);
3383 PUSHs(sv_2mortal(newSVnv(num)));
3384 if (GIMME == G_ARRAY) {
3387 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3393 strtol(str, base = 0)
3400 num = strtol(str, &unparsed, base);
3401 if (num >= IV_MIN && num <= IV_MAX)
3402 PUSHs(sv_2mortal(newSViv((IV)num)));
3404 PUSHs(sv_2mortal(newSVnv((double)num)));
3405 if (GIMME == G_ARRAY) {
3408 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3414 strtoul(str, base = 0)
3421 num = strtoul(str, &unparsed, base);
3423 PUSHs(sv_2mortal(newSViv((IV)num)));
3425 PUSHs(sv_2mortal(newSVnv((double)num)));
3426 if (GIMME == G_ARRAY) {
3429 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3441 char *p = SvPV(src,srclen);
3443 ST(0) = sv_2mortal(NEWSV(800,srclen));
3444 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3445 if (dstlen > srclen) {
3447 SvGROW(ST(0), dstlen);
3448 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3451 SvCUR(ST(0)) = dstlen;
3456 mkfifo(filename, mode)
3460 TAINT_PROPER("mkfifo");
3461 RETVAL = mkfifo(filename, mode);
3477 tcflush(fd, queue_selector)
3482 tcsendbreak(fd, duration)
3487 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3500 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3503 mytm.tm_hour = hour;
3504 mytm.tm_mday = mday;
3506 mytm.tm_year = year;
3507 mytm.tm_wday = wday;
3508 mytm.tm_yday = yday;
3509 mytm.tm_isdst = isdst;
3510 RETVAL = asctime(&mytm);
3527 realtime = times( &tms );
3529 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
3530 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
3531 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
3532 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) );
3533 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) );
3536 difftime(time1, time2)
3541 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3554 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3557 mytm.tm_hour = hour;
3558 mytm.tm_mday = mday;
3560 mytm.tm_year = year;
3561 mytm.tm_wday = wday;
3562 mytm.tm_yday = yday;
3563 mytm.tm_isdst = isdst;
3564 RETVAL = mktime(&mytm);
3570 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3586 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3589 mytm.tm_hour = hour;
3590 mytm.tm_mday = mday;
3592 mytm.tm_year = year;
3593 mytm.tm_wday = wday;
3594 mytm.tm_yday = yday;
3595 mytm.tm_isdst = isdst;
3596 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3597 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3607 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3608 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3611 access(filename, mode)
3629 pathconf(filename, name)