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? */
38 /* XXX This comment is just to make I_TERMIO and I_SGTTY visible to
39 metaconfig for future extension writers. We don't use them in POSIX.
40 (This is really sneaky :-) --AD
42 #if defined(I_TERMIOS)
50 #include <sys/types.h>
57 #if defined(__VMS) && !defined(__POSIX_SOURCE)
58 # include <libdef.h> /* LIB$_INVARG constant */
59 # include <lib$routines.h> /* prototype for lib$ediv() */
60 # include <starlet.h> /* prototype for sys$gettim() */
61 # if DECC_VERSION < 50000000
62 # define pid_t int /* old versions of DECC miss this in types.h */
65 # undef mkfifo /* #defined in perl.h */
66 # define mkfifo(a,b) (not_here("mkfifo"),-1)
67 # define tzset() not_here("tzset")
69 #if ((__VMS_VER >= 70000000) && (__DECC_VER >= 50200000)) || (__CRTL_VER >= 70000000)
70 # define HAS_TZNAME /* shows up in VMS 7.0 or Dec C 5.6 */
72 # endif /* __VMS_VER >= 70000000 or Dec C 5.6 */
74 /* The POSIX notion of ttyname() is better served by getname() under VMS */
75 static char ttnambuf[64];
76 # define ttyname(fd) (isatty(fd) > 0 ? getname(fd,ttnambuf,0) : NULL)
78 /* The non-POSIX CRTL times() has void return type, so we just get the
79 current time directly */
80 clock_t vms_times(struct tms *bufptr) {
82 /* Get wall time and convert to 10 ms intervals to
83 * produce the return value that the POSIX standard expects */
84 # if defined(__DECC) && defined (__ALPHA)
87 _ckvmssts(sys$gettim(&vmstime));
89 retval = vmstime & 0x7fffffff;
91 /* (Older hw or ccs don't have an atomic 64-bit type, so we
92 * juggle 32-bit ints (and a float) to produce a time_t result
93 * with minimal loss of information.) */
94 long int vmstime[2],remainder,divisor = 100000;
95 _ckvmssts(sys$gettim((unsigned long int *)vmstime));
96 vmstime[1] &= 0x7fff; /* prevent overflow in EDIV */
97 _ckvmssts(lib$ediv(&divisor,vmstime,(long int *)&retval,&remainder));
99 /* Fill in the struct tms using the CRTL routine . . .*/
100 times((tbuffer_t *)bufptr);
101 return (clock_t) retval;
103 # define times(t) vms_times(t)
106 # undef mkfifo /* #defined in perl.h */
107 # define mkfifo(a,b) not_here("mkfifo")
108 # define ttyname(a) (char*)not_here("ttyname")
109 # define sigset_t long
112 # define tzname _tzname
115 # define mode_t short
118 # define mode_t short
120 # define tzset() not_here("tzset")
122 # ifndef _POSIX_OPEN_MAX
123 # define _POSIX_OPEN_MAX FOPEN_MAX /* XXX bogus ? */
126 # define sigaction(a,b,c) not_here("sigaction")
127 # define sigpending(a) not_here("sigpending")
128 # define sigprocmask(a,b,c) not_here("sigprocmask")
129 # define sigsuspend(a) not_here("sigsuspend")
130 # define sigemptyset(a) not_here("sigemptyset")
131 # define sigaddset(a,b) not_here("sigaddset")
132 # define sigdelset(a,b) not_here("sigdelset")
133 # define sigfillset(a) not_here("sigfillset")
134 # define sigismember(a,b) not_here("sigismember")
137 # include <sys/times.h>
139 # include <sys/utsname.h>
141 # include <sys/wait.h>
149 typedef long SysRetLong;
150 typedef sigset_t* POSIX__SigSet;
151 typedef HV* POSIX__SigAction;
153 typedef struct termios* POSIX__Termios;
154 #else /* Define termios types to int, and call not_here for the functions.*/
155 #define POSIX__Termios int
159 #define cfgetispeed(x) not_here("cfgetispeed")
160 #define cfgetospeed(x) not_here("cfgetospeed")
161 #define tcdrain(x) not_here("tcdrain")
162 #define tcflush(x,y) not_here("tcflush")
163 #define tcsendbreak(x,y) not_here("tcsendbreak")
164 #define cfsetispeed(x,y) not_here("cfsetispeed")
165 #define cfsetospeed(x,y) not_here("cfsetospeed")
166 #define ctermid(x) (char *) not_here("ctermid")
167 #define tcflow(x,y) not_here("tcflow")
168 #define tcgetattr(x,y) not_here("tcgetattr")
169 #define tcsetattr(x,y,z) not_here("tcsetattr")
172 /* Possibly needed prototypes */
173 char *cuserid _((char *));
174 double strtod _((const char *, char **));
175 long strtol _((const char *, char **, int));
176 unsigned long strtoul _((const char *, char **, int));
179 #define cuserid(a) (char *) not_here("cuserid")
183 #define difftime(a,b) not_here("difftime")
186 #ifndef HAS_FPATHCONF
187 #define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
190 #define mktime(a) not_here("mktime")
193 #define nice(a) not_here("nice")
196 #define pathconf(f,n) (SysRetLong) not_here("pathconf")
199 #define sysconf(n) (SysRetLong) not_here("sysconf")
202 #define readlink(a,b,c) not_here("readlink")
205 #define setpgid(a,b) not_here("setpgid")
208 #define setsid() not_here("setsid")
211 #define strcoll(s1,s2) not_here("strcoll")
214 #define strtod(s1,s2) not_here("strtod")
217 #define strtol(s1,s2,b) not_here("strtol")
220 #define strtoul(s1,s2,b) not_here("strtoul")
223 #define strxfrm(s1,s2,n) not_here("strxfrm")
225 #ifndef HAS_TCGETPGRP
226 #define tcgetpgrp(a) not_here("tcgetpgrp")
228 #ifndef HAS_TCSETPGRP
229 #define tcsetpgrp(a,b) not_here("tcsetpgrp")
232 #define times(a) not_here("times")
235 #define uname(a) not_here("uname")
238 #define waitpid(a,b,c) not_here("waitpid")
243 #define mblen(a,b) not_here("mblen")
247 #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
250 #define mbtowc(pwc, s, n) not_here("mbtowc")
253 #define wcstombs(s, pwcs, n) not_here("wcstombs")
256 #define wctomb(s, wchar) not_here("wcstombs")
258 #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
259 /* If we don't have these functions, then we wouldn't have gotten a typedef
260 for wchar_t, the wide character type. Defining wchar_t allows the
261 functions referencing it to compile. Its actual type is then meaningless,
262 since without the above functions, all sections using it end up calling
263 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
269 #ifndef HAS_LOCALECONV
270 #define localeconv() not_here("localeconv")
275 extern char *tzname[];
278 char *tzname[] = { "" , "" };
281 /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX)
282 * fields for which we don't have Configure support yet:
283 * char *tm_zone; -- abbreviation of timezone name
284 * long tm_gmtoff; -- offset from GMT in seconds
285 * To workaround core dumps from the uninitialised tm_zone we get the
286 * system to give us a reasonable struct to copy. This fix means that
287 * strftime uses the tm_zone and tm_gmtoff values returned by
288 * localtime(time()). That should give the desired result most of the
289 * time. But probably not always!
291 * This is a temporary workaround to be removed once Configure
292 * support is added and NETaa14816 is considered in full.
293 * It does not address tzname aspects of NETaa14816.
296 # ifndef STRUCT_TM_HASZONE
297 # define STRUCT_TM_HAS_ZONE
301 #ifdef STRUCT_TM_HASZONE
303 init_tm(ptm) /* see mktime, strftime and asctime */
308 Copy(localtime(&now), ptm, 1, struct tm);
312 # define init_tm(ptm)
316 #ifdef HAS_LONG_DOUBLE
317 # if LONG_DOUBLESIZE > DOUBLESIZE
318 # undef HAS_LONG_DOUBLE /* XXX until we figure out how to use them */
322 #ifndef HAS_LONG_DOUBLE
337 croak("POSIX::%s not implemented on this architecture", s);
342 #ifdef HAS_LONG_DOUBLE
347 constant(char *name, int arg)
352 if (strEQ(name, "ARG_MAX"))
360 if (strEQ(name, "BUFSIZ"))
366 if (strEQ(name, "BRKINT"))
372 if (strEQ(name, "B9600"))
378 if (strEQ(name, "B19200"))
384 if (strEQ(name, "B38400"))
390 if (strEQ(name, "B0"))
396 if (strEQ(name, "B110"))
402 if (strEQ(name, "B1200"))
408 if (strEQ(name, "B134"))
414 if (strEQ(name, "B150"))
420 if (strEQ(name, "B1800"))
426 if (strEQ(name, "B200"))
432 if (strEQ(name, "B2400"))
438 if (strEQ(name, "B300"))
444 if (strEQ(name, "B4800"))
450 if (strEQ(name, "B50"))
456 if (strEQ(name, "B600"))
462 if (strEQ(name, "B75"))
470 if (strEQ(name, "CHAR_BIT"))
476 if (strEQ(name, "CHAR_MAX"))
482 if (strEQ(name, "CHAR_MIN"))
488 if (strEQ(name, "CHILD_MAX"))
494 if (strEQ(name, "CLK_TCK"))
500 if (strEQ(name, "CLOCAL"))
506 if (strEQ(name, "CLOCKS_PER_SEC"))
507 #ifdef CLOCKS_PER_SEC
508 return CLOCKS_PER_SEC;
512 if (strEQ(name, "CREAD"))
518 if (strEQ(name, "CS5"))
524 if (strEQ(name, "CS6"))
530 if (strEQ(name, "CS7"))
536 if (strEQ(name, "CS8"))
542 if (strEQ(name, "CSIZE"))
548 if (strEQ(name, "CSTOPB"))
556 if (strEQ(name, "DBL_MAX"))
562 if (strEQ(name, "DBL_MIN"))
568 if (strEQ(name, "DBL_DIG"))
574 if (strEQ(name, "DBL_EPSILON"))
580 if (strEQ(name, "DBL_MANT_DIG"))
586 if (strEQ(name, "DBL_MAX_10_EXP"))
587 #ifdef DBL_MAX_10_EXP
588 return DBL_MAX_10_EXP;
592 if (strEQ(name, "DBL_MAX_EXP"))
598 if (strEQ(name, "DBL_MIN_10_EXP"))
599 #ifdef DBL_MIN_10_EXP
600 return DBL_MIN_10_EXP;
604 if (strEQ(name, "DBL_MIN_EXP"))
614 if (strEQ(name, "EACCES"))
620 if (strEQ(name, "EADDRINUSE"))
626 if (strEQ(name, "EADDRNOTAVAIL"))
628 return EADDRNOTAVAIL;
632 if (strEQ(name, "EAFNOSUPPORT"))
638 if (strEQ(name, "EAGAIN"))
644 if (strEQ(name, "EALREADY"))
652 if (strEQ(name, "EBADF"))
658 if (strEQ(name, "EBUSY"))
666 if (strEQ(name, "ECHILD"))
672 if (strEQ(name, "ECHO"))
678 if (strEQ(name, "ECHOE"))
684 if (strEQ(name, "ECHOK"))
690 if (strEQ(name, "ECHONL"))
696 if (strEQ(name, "ECONNABORTED"))
702 if (strEQ(name, "ECONNREFUSED"))
708 if (strEQ(name, "ECONNRESET"))
716 if (strEQ(name, "EDEADLK"))
722 if (strEQ(name, "EDESTADDRREQ"))
728 if (strEQ(name, "EDOM"))
734 if (strEQ(name, "EDQUOT"))
742 if (strEQ(name, "EEXIST"))
750 if (strEQ(name, "EFAULT"))
756 if (strEQ(name, "EFBIG"))
764 if (strEQ(name, "EHOSTDOWN"))
770 if (strEQ(name, "EHOSTUNREACH"))
778 if (strEQ(name, "EINPROGRESS"))
784 if (strEQ(name, "EINTR"))
790 if (strEQ(name, "EINVAL"))
796 if (strEQ(name, "EIO"))
802 if (strEQ(name, "EISCONN"))
808 if (strEQ(name, "EISDIR"))
814 if (strEQ(name, "ELOOP"))
822 if (strEQ(name, "EMFILE"))
828 if (strEQ(name, "EMLINK"))
834 if (strEQ(name, "EMSGSIZE"))
842 if (strEQ(name, "ENETDOWN"))
848 if (strEQ(name, "ENETRESET"))
854 if (strEQ(name, "ENETUNREACH"))
860 if (strEQ(name, "ENOBUFS"))
866 if (strEQ(name, "ENOEXEC"))
872 if (strEQ(name, "ENOMEM"))
878 if (strEQ(name, "ENOPROTOOPT"))
884 if (strEQ(name, "ENOSPC"))
890 if (strEQ(name, "ENOTBLK"))
896 if (strEQ(name, "ENOTCONN"))
902 if (strEQ(name, "ENOTDIR"))
908 if (strEQ(name, "ENOTEMPTY"))
914 if (strEQ(name, "ENOTSOCK"))
920 if (strEQ(name, "ENOTTY"))
926 if (strEQ(name, "ENFILE"))
932 if (strEQ(name, "ENODEV"))
938 if (strEQ(name, "ENOENT"))
944 if (strEQ(name, "ENOLCK"))
950 if (strEQ(name, "ENOSYS"))
956 if (strEQ(name, "ENXIO"))
962 if (strEQ(name, "ENAMETOOLONG"))
970 if (strEQ(name, "EOF"))
976 if (strEQ(name, "EOPNOTSUPP"))
984 if (strEQ(name, "EPERM"))
990 if (strEQ(name, "EPFNOSUPPORT"))
996 if (strEQ(name, "EPIPE"))
1002 if (strEQ(name, "EPROCLIM"))
1008 if (strEQ(name, "EPROTONOSUPPORT"))
1009 #ifdef EPROTONOSUPPORT
1010 return EPROTONOSUPPORT;
1014 if (strEQ(name, "EPROTOTYPE"))
1022 if (strEQ(name, "ERANGE"))
1028 if (strEQ(name, "EREMOTE"))
1034 if (strEQ(name, "ERESTART"))
1040 if (strEQ(name, "EROFS"))
1048 if (strEQ(name, "ESHUTDOWN"))
1054 if (strEQ(name, "ESOCKTNOSUPPORT"))
1055 #ifdef ESOCKTNOSUPPORT
1056 return ESOCKTNOSUPPORT;
1060 if (strEQ(name, "ESPIPE"))
1066 if (strEQ(name, "ESRCH"))
1072 if (strEQ(name, "ESTALE"))
1080 if (strEQ(name, "ETIMEDOUT"))
1086 if (strEQ(name, "ETOOMANYREFS"))
1088 return ETOOMANYREFS;
1092 if (strEQ(name, "ETXTBSY"))
1100 if (strEQ(name, "EUSERS"))
1108 if (strEQ(name, "EWOULDBLOCK"))
1116 if (strEQ(name, "EXIT_FAILURE"))
1118 return EXIT_FAILURE;
1122 if (strEQ(name, "EXIT_SUCCESS"))
1124 return EXIT_SUCCESS;
1128 if (strEQ(name, "EXDEV"))
1136 if (strEQ(name, "E2BIG"))
1144 if (strnEQ(name, "FLT_", 4)) {
1145 if (strEQ(name, "FLT_MAX"))
1151 if (strEQ(name, "FLT_MIN"))
1157 if (strEQ(name, "FLT_ROUNDS"))
1163 if (strEQ(name, "FLT_DIG"))
1169 if (strEQ(name, "FLT_EPSILON"))
1175 if (strEQ(name, "FLT_MANT_DIG"))
1177 return FLT_MANT_DIG;
1181 if (strEQ(name, "FLT_MAX_10_EXP"))
1182 #ifdef FLT_MAX_10_EXP
1183 return FLT_MAX_10_EXP;
1187 if (strEQ(name, "FLT_MAX_EXP"))
1193 if (strEQ(name, "FLT_MIN_10_EXP"))
1194 #ifdef FLT_MIN_10_EXP
1195 return FLT_MIN_10_EXP;
1199 if (strEQ(name, "FLT_MIN_EXP"))
1205 if (strEQ(name, "FLT_RADIX"))
1213 if (strnEQ(name, "F_", 2)) {
1214 if (strEQ(name, "F_DUPFD"))
1220 if (strEQ(name, "F_GETFD"))
1226 if (strEQ(name, "F_GETFL"))
1232 if (strEQ(name, "F_GETLK"))
1238 if (strEQ(name, "F_OK"))
1244 if (strEQ(name, "F_RDLCK"))
1250 if (strEQ(name, "F_SETFD"))
1256 if (strEQ(name, "F_SETFL"))
1262 if (strEQ(name, "F_SETLK"))
1268 if (strEQ(name, "F_SETLKW"))
1274 if (strEQ(name, "F_UNLCK"))
1280 if (strEQ(name, "F_WRLCK"))
1288 if (strEQ(name, "FD_CLOEXEC"))
1294 if (strEQ(name, "FILENAME_MAX"))
1296 return FILENAME_MAX;
1302 if (strEQ(name, "HUGE_VAL"))
1308 if (strEQ(name, "HUPCL"))
1316 if (strEQ(name, "INT_MAX"))
1322 if (strEQ(name, "INT_MIN"))
1328 if (strEQ(name, "ICANON"))
1334 if (strEQ(name, "ICRNL"))
1340 if (strEQ(name, "IEXTEN"))
1346 if (strEQ(name, "IGNBRK"))
1352 if (strEQ(name, "IGNCR"))
1358 if (strEQ(name, "IGNPAR"))
1364 if (strEQ(name, "INLCR"))
1370 if (strEQ(name, "INPCK"))
1376 if (strEQ(name, "ISIG"))
1382 if (strEQ(name, "ISTRIP"))
1388 if (strEQ(name, "IXOFF"))
1394 if (strEQ(name, "IXON"))
1402 if (strnEQ(name, "LC_", 3)) {
1403 if (strEQ(name, "LC_ALL"))
1409 if (strEQ(name, "LC_COLLATE"))
1415 if (strEQ(name, "LC_CTYPE"))
1421 if (strEQ(name, "LC_MONETARY"))
1427 if (strEQ(name, "LC_NUMERIC"))
1433 if (strEQ(name, "LC_TIME"))
1441 if (strnEQ(name, "LDBL_", 5)) {
1442 if (strEQ(name, "LDBL_MAX"))
1448 if (strEQ(name, "LDBL_MIN"))
1454 if (strEQ(name, "LDBL_DIG"))
1460 if (strEQ(name, "LDBL_EPSILON"))
1462 return LDBL_EPSILON;
1466 if (strEQ(name, "LDBL_MANT_DIG"))
1467 #ifdef LDBL_MANT_DIG
1468 return LDBL_MANT_DIG;
1472 if (strEQ(name, "LDBL_MAX_10_EXP"))
1473 #ifdef LDBL_MAX_10_EXP
1474 return LDBL_MAX_10_EXP;
1478 if (strEQ(name, "LDBL_MAX_EXP"))
1480 return LDBL_MAX_EXP;
1484 if (strEQ(name, "LDBL_MIN_10_EXP"))
1485 #ifdef LDBL_MIN_10_EXP
1486 return LDBL_MIN_10_EXP;
1490 if (strEQ(name, "LDBL_MIN_EXP"))
1492 return LDBL_MIN_EXP;
1498 if (strnEQ(name, "L_", 2)) {
1499 if (strEQ(name, "L_ctermid"))
1505 if (strEQ(name, "L_cuserid"))
1511 if (strEQ(name, "L_tmpname"))
1519 if (strEQ(name, "LONG_MAX"))
1525 if (strEQ(name, "LONG_MIN"))
1531 if (strEQ(name, "LINK_MAX"))
1539 if (strEQ(name, "MAX_CANON"))
1545 if (strEQ(name, "MAX_INPUT"))
1551 if (strEQ(name, "MB_CUR_MAX"))
1557 if (strEQ(name, "MB_LEN_MAX"))
1565 if (strEQ(name, "NULL")) return 0;
1566 if (strEQ(name, "NAME_MAX"))
1572 if (strEQ(name, "NCCS"))
1578 if (strEQ(name, "NGROUPS_MAX"))
1584 if (strEQ(name, "NOFLSH"))
1592 if (strnEQ(name, "O_", 2)) {
1593 if (strEQ(name, "O_APPEND"))
1599 if (strEQ(name, "O_CREAT"))
1605 if (strEQ(name, "O_TRUNC"))
1611 if (strEQ(name, "O_RDONLY"))
1617 if (strEQ(name, "O_RDWR"))
1623 if (strEQ(name, "O_WRONLY"))
1629 if (strEQ(name, "O_EXCL"))
1635 if (strEQ(name, "O_NOCTTY"))
1641 if (strEQ(name, "O_NONBLOCK"))
1647 if (strEQ(name, "O_ACCMODE"))
1655 if (strEQ(name, "OPEN_MAX"))
1661 if (strEQ(name, "OPOST"))
1669 if (strEQ(name, "PATH_MAX"))
1675 if (strEQ(name, "PARENB"))
1681 if (strEQ(name, "PARMRK"))
1687 if (strEQ(name, "PARODD"))
1693 if (strEQ(name, "PIPE_BUF"))
1701 if (strEQ(name, "RAND_MAX"))
1707 if (strEQ(name, "R_OK"))
1715 if (strnEQ(name, "SIG", 3)) {
1716 if (name[3] == '_') {
1717 if (strEQ(name, "SIG_BLOCK"))
1724 if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
1727 if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
1730 if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
1732 if (strEQ(name, "SIG_SETMASK"))
1738 if (strEQ(name, "SIG_UNBLOCK"))
1746 if (strEQ(name, "SIGABRT"))
1752 if (strEQ(name, "SIGALRM"))
1758 if (strEQ(name, "SIGCHLD"))
1764 if (strEQ(name, "SIGCONT"))
1770 if (strEQ(name, "SIGFPE"))
1776 if (strEQ(name, "SIGHUP"))
1782 if (strEQ(name, "SIGILL"))
1788 if (strEQ(name, "SIGINT"))
1794 if (strEQ(name, "SIGKILL"))
1800 if (strEQ(name, "SIGPIPE"))
1806 if (strEQ(name, "SIGQUIT"))
1812 if (strEQ(name, "SIGSEGV"))
1818 if (strEQ(name, "SIGSTOP"))
1824 if (strEQ(name, "SIGTERM"))
1830 if (strEQ(name, "SIGTSTP"))
1836 if (strEQ(name, "SIGTTIN"))
1842 if (strEQ(name, "SIGTTOU"))
1848 if (strEQ(name, "SIGUSR1"))
1854 if (strEQ(name, "SIGUSR2"))
1862 if (name[1] == '_') {
1863 if (strEQ(name, "S_ISGID"))
1869 if (strEQ(name, "S_ISUID"))
1875 if (strEQ(name, "S_IRGRP"))
1881 if (strEQ(name, "S_IROTH"))
1887 if (strEQ(name, "S_IRUSR"))
1893 if (strEQ(name, "S_IRWXG"))
1899 if (strEQ(name, "S_IRWXO"))
1905 if (strEQ(name, "S_IRWXU"))
1911 if (strEQ(name, "S_IWGRP"))
1917 if (strEQ(name, "S_IWOTH"))
1923 if (strEQ(name, "S_IWUSR"))
1929 if (strEQ(name, "S_IXGRP"))
1935 if (strEQ(name, "S_IXOTH"))
1941 if (strEQ(name, "S_IXUSR"))
1947 errno = EAGAIN; /* the following aren't constants */
1949 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1952 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1955 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1958 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1961 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1965 if (strEQ(name, "SEEK_CUR"))
1971 if (strEQ(name, "SEEK_END"))
1977 if (strEQ(name, "SEEK_SET"))
1983 if (strEQ(name, "STREAM_MAX"))
1989 if (strEQ(name, "SHRT_MAX"))
1995 if (strEQ(name, "SHRT_MIN"))
2001 if (strnEQ(name, "SA_", 3)) {
2002 if (strEQ(name, "SA_NOCLDSTOP"))
2004 return SA_NOCLDSTOP;
2008 if (strEQ(name, "SA_NOCLDWAIT"))
2010 return SA_NOCLDWAIT;
2014 if (strEQ(name, "SA_NODEFER"))
2020 if (strEQ(name, "SA_ONSTACK"))
2026 if (strEQ(name, "SA_RESETHAND"))
2028 return SA_RESETHAND;
2032 if (strEQ(name, "SA_RESTART"))
2038 if (strEQ(name, "SA_SIGINFO"))
2046 if (strEQ(name, "SCHAR_MAX"))
2052 if (strEQ(name, "SCHAR_MIN"))
2058 if (strEQ(name, "SSIZE_MAX"))
2064 if (strEQ(name, "STDIN_FILENO"))
2066 return STDIN_FILENO;
2070 if (strEQ(name, "STDOUT_FILENO"))
2071 #ifdef STDOUT_FILENO
2072 return STDOUT_FILENO;
2076 if (strEQ(name, "STRERR_FILENO"))
2077 #ifdef STRERR_FILENO
2078 return STRERR_FILENO;
2084 if (strEQ(name, "TCIFLUSH"))
2090 if (strEQ(name, "TCIOFF"))
2096 if (strEQ(name, "TCIOFLUSH"))
2102 if (strEQ(name, "TCION"))
2108 if (strEQ(name, "TCOFLUSH"))
2114 if (strEQ(name, "TCOOFF"))
2120 if (strEQ(name, "TCOON"))
2126 if (strEQ(name, "TCSADRAIN"))
2132 if (strEQ(name, "TCSAFLUSH"))
2138 if (strEQ(name, "TCSANOW"))
2144 if (strEQ(name, "TMP_MAX"))
2150 if (strEQ(name, "TOSTOP"))
2156 if (strEQ(name, "TZNAME_MAX"))
2164 if (strEQ(name, "UCHAR_MAX"))
2170 if (strEQ(name, "UINT_MAX"))
2176 if (strEQ(name, "ULONG_MAX"))
2182 if (strEQ(name, "USHRT_MAX"))
2190 if (strEQ(name, "VEOF"))
2196 if (strEQ(name, "VEOL"))
2202 if (strEQ(name, "VERASE"))
2208 if (strEQ(name, "VINTR"))
2214 if (strEQ(name, "VKILL"))
2220 if (strEQ(name, "VMIN"))
2226 if (strEQ(name, "VQUIT"))
2232 if (strEQ(name, "VSTART"))
2238 if (strEQ(name, "VSTOP"))
2244 if (strEQ(name, "VSUSP"))
2250 if (strEQ(name, "VTIME"))
2258 if (strEQ(name, "W_OK"))
2264 if (strEQ(name, "WNOHANG"))
2270 if (strEQ(name, "WUNTRACED"))
2276 errno = EAGAIN; /* the following aren't constants */
2278 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2281 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2284 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2287 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2290 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2293 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2297 if (strEQ(name, "X_OK"))
2305 if (strnEQ(name, "_PC_", 4)) {
2306 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2307 #if defined(_PC_CHOWN_RESTRICTED) || HINT_SC_EXIST
2308 return _PC_CHOWN_RESTRICTED;
2312 if (strEQ(name, "_PC_LINK_MAX"))
2313 #if defined(_PC_LINK_MAX) || HINT_SC_EXIST
2314 return _PC_LINK_MAX;
2318 if (strEQ(name, "_PC_MAX_CANON"))
2319 #if defined(_PC_MAX_CANON) || HINT_SC_EXIST
2320 return _PC_MAX_CANON;
2324 if (strEQ(name, "_PC_MAX_INPUT"))
2325 #if defined(_PC_MAX_INPUT) || HINT_SC_EXIST
2326 return _PC_MAX_INPUT;
2330 if (strEQ(name, "_PC_NAME_MAX"))
2331 #if defined(_PC_NAME_MAX) || HINT_SC_EXIST
2332 return _PC_NAME_MAX;
2336 if (strEQ(name, "_PC_NO_TRUNC"))
2337 #if defined(_PC_NO_TRUNC) || HINT_SC_EXIST
2338 return _PC_NO_TRUNC;
2342 if (strEQ(name, "_PC_PATH_MAX"))
2343 #if defined(_PC_PATH_MAX) || HINT_SC_EXIST
2344 return _PC_PATH_MAX;
2348 if (strEQ(name, "_PC_PIPE_BUF"))
2349 #if defined(_PC_PIPE_BUF) || HINT_SC_EXIST
2350 return _PC_PIPE_BUF;
2354 if (strEQ(name, "_PC_VDISABLE"))
2355 #if defined(_PC_VDISABLE) || HINT_SC_EXIST
2356 return _PC_VDISABLE;
2362 if (strnEQ(name, "_POSIX_", 7)) {
2363 if (strEQ(name, "_POSIX_ARG_MAX"))
2364 #ifdef _POSIX_ARG_MAX
2365 return _POSIX_ARG_MAX;
2369 if (strEQ(name, "_POSIX_CHILD_MAX"))
2370 #ifdef _POSIX_CHILD_MAX
2371 return _POSIX_CHILD_MAX;
2375 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2376 #ifdef _POSIX_CHOWN_RESTRICTED
2377 return _POSIX_CHOWN_RESTRICTED;
2381 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2382 #ifdef _POSIX_JOB_CONTROL
2383 return _POSIX_JOB_CONTROL;
2387 if (strEQ(name, "_POSIX_LINK_MAX"))
2388 #ifdef _POSIX_LINK_MAX
2389 return _POSIX_LINK_MAX;
2393 if (strEQ(name, "_POSIX_MAX_CANON"))
2394 #ifdef _POSIX_MAX_CANON
2395 return _POSIX_MAX_CANON;
2399 if (strEQ(name, "_POSIX_MAX_INPUT"))
2400 #ifdef _POSIX_MAX_INPUT
2401 return _POSIX_MAX_INPUT;
2405 if (strEQ(name, "_POSIX_NAME_MAX"))
2406 #ifdef _POSIX_NAME_MAX
2407 return _POSIX_NAME_MAX;
2411 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2412 #ifdef _POSIX_NGROUPS_MAX
2413 return _POSIX_NGROUPS_MAX;
2417 if (strEQ(name, "_POSIX_NO_TRUNC"))
2418 #ifdef _POSIX_NO_TRUNC
2419 return _POSIX_NO_TRUNC;
2423 if (strEQ(name, "_POSIX_OPEN_MAX"))
2424 #ifdef _POSIX_OPEN_MAX
2425 return _POSIX_OPEN_MAX;
2429 if (strEQ(name, "_POSIX_PATH_MAX"))
2430 #ifdef _POSIX_PATH_MAX
2431 return _POSIX_PATH_MAX;
2435 if (strEQ(name, "_POSIX_PIPE_BUF"))
2436 #ifdef _POSIX_PIPE_BUF
2437 return _POSIX_PIPE_BUF;
2441 if (strEQ(name, "_POSIX_SAVED_IDS"))
2442 #ifdef _POSIX_SAVED_IDS
2443 return _POSIX_SAVED_IDS;
2447 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2448 #ifdef _POSIX_SSIZE_MAX
2449 return _POSIX_SSIZE_MAX;
2453 if (strEQ(name, "_POSIX_STREAM_MAX"))
2454 #ifdef _POSIX_STREAM_MAX
2455 return _POSIX_STREAM_MAX;
2459 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2460 #ifdef _POSIX_TZNAME_MAX
2461 return _POSIX_TZNAME_MAX;
2465 if (strEQ(name, "_POSIX_VDISABLE"))
2466 #ifdef _POSIX_VDISABLE
2467 return _POSIX_VDISABLE;
2471 if (strEQ(name, "_POSIX_VERSION"))
2472 #ifdef _POSIX_VERSION
2473 return _POSIX_VERSION;
2479 if (strnEQ(name, "_SC_", 4)) {
2480 if (strEQ(name, "_SC_ARG_MAX"))
2481 #if defined(_SC_ARG_MAX) || HINT_SC_EXIST
2486 if (strEQ(name, "_SC_CHILD_MAX"))
2487 #if defined(_SC_CHILD_MAX) || HINT_SC_EXIST
2488 return _SC_CHILD_MAX;
2492 if (strEQ(name, "_SC_CLK_TCK"))
2493 #if defined(_SC_CLK_TCK) || HINT_SC_EXIST
2498 if (strEQ(name, "_SC_JOB_CONTROL"))
2499 #if defined(_SC_JOB_CONTROL) || HINT_SC_EXIST
2500 return _SC_JOB_CONTROL;
2504 if (strEQ(name, "_SC_NGROUPS_MAX"))
2505 #if defined(_SC_NGROUPS_MAX) || HINT_SC_EXIST
2506 return _SC_NGROUPS_MAX;
2510 if (strEQ(name, "_SC_OPEN_MAX"))
2511 #if defined(_SC_OPEN_MAX) || HINT_SC_EXIST
2512 return _SC_OPEN_MAX;
2516 if (strEQ(name, "_SC_SAVED_IDS"))
2517 #if defined(_SC_SAVED_IDS) || HINT_SC_EXIST
2518 return _SC_SAVED_IDS;
2522 if (strEQ(name, "_SC_STREAM_MAX"))
2523 #if defined(_SC_STREAM_MAX) || HINT_SC_EXIST
2524 return _SC_STREAM_MAX;
2528 if (strEQ(name, "_SC_TZNAME_MAX"))
2529 #if defined(_SC_TZNAME_MAX) || HINT_SC_EXIST
2530 return _SC_TZNAME_MAX;
2534 if (strEQ(name, "_SC_VERSION"))
2535 #if defined(_SC_VERSION) || HINT_SC_EXIST
2551 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2554 new(packname = "POSIX::SigSet", ...)
2559 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2560 sigemptyset(RETVAL);
2561 for (i = 1; i < items; i++)
2562 sigaddset(RETVAL, SvIV(ST(i)));
2569 POSIX::SigSet sigset
2571 safefree((char *)sigset);
2574 sigaddset(sigset, sig)
2575 POSIX::SigSet sigset
2579 sigdelset(sigset, sig)
2580 POSIX::SigSet sigset
2585 POSIX::SigSet sigset
2589 POSIX::SigSet sigset
2592 sigismember(sigset, sig)
2593 POSIX::SigSet sigset
2597 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2600 new(packname = "POSIX::Termios", ...)
2605 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2607 not_here("termios");
2615 DESTROY(termios_ref)
2616 POSIX::Termios termios_ref
2619 safefree((char *)termios_ref);
2621 not_here("termios");
2625 getattr(termios_ref, fd = 0)
2626 POSIX::Termios termios_ref
2629 RETVAL = tcgetattr(fd, termios_ref);
2634 setattr(termios_ref, fd = 0, optional_actions = 0)
2635 POSIX::Termios termios_ref
2637 int optional_actions
2639 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2644 cfgetispeed(termios_ref)
2645 POSIX::Termios termios_ref
2648 cfgetospeed(termios_ref)
2649 POSIX::Termios termios_ref
2652 getiflag(termios_ref)
2653 POSIX::Termios termios_ref
2655 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2656 RETVAL = termios_ref->c_iflag;
2658 not_here("getiflag");
2665 getoflag(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_oflag;
2671 not_here("getoflag");
2678 getcflag(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_cflag;
2684 not_here("getcflag");
2691 getlflag(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_lflag;
2697 not_here("getlflag");
2704 getcc(termios_ref, ccix)
2705 POSIX::Termios termios_ref
2708 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2710 croak("Bad getcc subscript");
2711 RETVAL = termios_ref->c_cc[ccix];
2720 cfsetispeed(termios_ref, speed)
2721 POSIX::Termios termios_ref
2725 cfsetospeed(termios_ref, speed)
2726 POSIX::Termios termios_ref
2730 setiflag(termios_ref, iflag)
2731 POSIX::Termios termios_ref
2734 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2735 termios_ref->c_iflag = iflag;
2737 not_here("setiflag");
2741 setoflag(termios_ref, oflag)
2742 POSIX::Termios termios_ref
2745 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2746 termios_ref->c_oflag = oflag;
2748 not_here("setoflag");
2752 setcflag(termios_ref, cflag)
2753 POSIX::Termios termios_ref
2756 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2757 termios_ref->c_cflag = cflag;
2759 not_here("setcflag");
2763 setlflag(termios_ref, lflag)
2764 POSIX::Termios termios_ref
2767 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2768 termios_ref->c_lflag = lflag;
2770 not_here("setlflag");
2774 setcc(termios_ref, ccix, cc)
2775 POSIX::Termios termios_ref
2779 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2781 croak("Bad setcc subscript");
2782 termios_ref->c_cc[ccix] = cc;
2788 MODULE = POSIX PACKAGE = POSIX
2797 unsigned char * charstring
2799 unsigned char *s = charstring;
2800 unsigned char *e = s + na; /* "na" set by typemap side effect */
2801 for (RETVAL = 1; RETVAL && s < e; s++)
2809 unsigned char * charstring
2811 unsigned char *s = charstring;
2812 unsigned char *e = s + na; /* "na" set by typemap side effect */
2813 for (RETVAL = 1; RETVAL && s < e; s++)
2821 unsigned char * charstring
2823 unsigned char *s = charstring;
2824 unsigned char *e = s + na; /* "na" set by typemap side effect */
2825 for (RETVAL = 1; RETVAL && s < e; s++)
2833 unsigned char * charstring
2835 unsigned char *s = charstring;
2836 unsigned char *e = s + na; /* "na" set by typemap side effect */
2837 for (RETVAL = 1; RETVAL && s < e; s++)
2845 unsigned char * charstring
2847 unsigned char *s = charstring;
2848 unsigned char *e = s + na; /* "na" set by typemap side effect */
2849 for (RETVAL = 1; RETVAL && s < e; s++)
2857 unsigned char * charstring
2859 unsigned char *s = charstring;
2860 unsigned char *e = s + na; /* "na" set by typemap side effect */
2861 for (RETVAL = 1; RETVAL && s < e; s++)
2869 unsigned char * charstring
2871 unsigned char *s = charstring;
2872 unsigned char *e = s + na; /* "na" set by typemap side effect */
2873 for (RETVAL = 1; RETVAL && s < e; s++)
2881 unsigned char * charstring
2883 unsigned char *s = charstring;
2884 unsigned char *e = s + na; /* "na" set by typemap side effect */
2885 for (RETVAL = 1; RETVAL && s < e; s++)
2893 unsigned char * charstring
2895 unsigned char *s = charstring;
2896 unsigned char *e = s + na; /* "na" set by typemap side effect */
2897 for (RETVAL = 1; RETVAL && s < e; s++)
2905 unsigned char * charstring
2907 unsigned char *s = charstring;
2908 unsigned char *e = s + na; /* "na" set by typemap side effect */
2909 for (RETVAL = 1; RETVAL && s < e; s++)
2916 isxdigit(charstring)
2917 unsigned char * charstring
2919 unsigned char *s = charstring;
2920 unsigned char *e = s + na; /* "na" set by typemap side effect */
2921 for (RETVAL = 1; RETVAL && s < e; s++)
2928 open(filename, flags = O_RDONLY, mode = 0666)
2933 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2934 TAINT_PROPER("open");
2935 RETVAL = open(filename, flags, mode);
2943 #ifdef HAS_LOCALECONV
2944 struct lconv *lcbuf;
2946 SET_NUMERIC_LOCAL();
2947 if (lcbuf = localeconv()) {
2949 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2950 hv_store(RETVAL, "decimal_point", 13,
2951 newSVpv(lcbuf->decimal_point, 0), 0);
2952 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2953 hv_store(RETVAL, "thousands_sep", 13,
2954 newSVpv(lcbuf->thousands_sep, 0), 0);
2955 if (lcbuf->grouping && *lcbuf->grouping)
2956 hv_store(RETVAL, "grouping", 8,
2957 newSVpv(lcbuf->grouping, 0), 0);
2958 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2959 hv_store(RETVAL, "int_curr_symbol", 15,
2960 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2961 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2962 hv_store(RETVAL, "currency_symbol", 15,
2963 newSVpv(lcbuf->currency_symbol, 0), 0);
2964 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2965 hv_store(RETVAL, "mon_decimal_point", 17,
2966 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2967 #ifndef NO_LOCALECONV_MON_THOUSANDS_SEP
2968 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2969 hv_store(RETVAL, "mon_thousands_sep", 17,
2970 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2972 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2973 hv_store(RETVAL, "mon_grouping", 12,
2974 newSVpv(lcbuf->mon_grouping, 0), 0);
2975 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2976 hv_store(RETVAL, "positive_sign", 13,
2977 newSVpv(lcbuf->positive_sign, 0), 0);
2978 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2979 hv_store(RETVAL, "negative_sign", 13,
2980 newSVpv(lcbuf->negative_sign, 0), 0);
2982 if (lcbuf->int_frac_digits != CHAR_MAX)
2983 hv_store(RETVAL, "int_frac_digits", 15,
2984 newSViv(lcbuf->int_frac_digits), 0);
2985 if (lcbuf->frac_digits != CHAR_MAX)
2986 hv_store(RETVAL, "frac_digits", 11,
2987 newSViv(lcbuf->frac_digits), 0);
2988 if (lcbuf->p_cs_precedes != CHAR_MAX)
2989 hv_store(RETVAL, "p_cs_precedes", 13,
2990 newSViv(lcbuf->p_cs_precedes), 0);
2991 if (lcbuf->p_sep_by_space != CHAR_MAX)
2992 hv_store(RETVAL, "p_sep_by_space", 14,
2993 newSViv(lcbuf->p_sep_by_space), 0);
2994 if (lcbuf->n_cs_precedes != CHAR_MAX)
2995 hv_store(RETVAL, "n_cs_precedes", 13,
2996 newSViv(lcbuf->n_cs_precedes), 0);
2997 if (lcbuf->n_sep_by_space != CHAR_MAX)
2998 hv_store(RETVAL, "n_sep_by_space", 14,
2999 newSViv(lcbuf->n_sep_by_space), 0);
3000 if (lcbuf->p_sign_posn != CHAR_MAX)
3001 hv_store(RETVAL, "p_sign_posn", 11,
3002 newSViv(lcbuf->p_sign_posn), 0);
3003 if (lcbuf->n_sign_posn != CHAR_MAX)
3004 hv_store(RETVAL, "n_sign_posn", 11,
3005 newSViv(lcbuf->n_sign_posn), 0);
3008 localeconv(); /* A stub to call not_here(). */
3014 setlocale(category, locale = 0)
3018 RETVAL = setlocale(category, locale);
3020 #ifdef USE_LOCALE_CTYPE
3021 if (category == LC_CTYPE
3023 || category == LC_ALL
3029 if (category == LC_ALL)
3030 newctype = setlocale(LC_CTYPE, NULL);
3034 perl_new_ctype(newctype);
3036 #endif /* USE_LOCALE_CTYPE */
3037 #ifdef USE_LOCALE_COLLATE
3038 if (category == LC_COLLATE
3040 || category == LC_ALL
3046 if (category == LC_ALL)
3047 newcoll = setlocale(LC_COLLATE, NULL);
3051 perl_new_collate(newcoll);
3053 #endif /* USE_LOCALE_COLLATE */
3054 #ifdef USE_LOCALE_NUMERIC
3055 if (category == LC_NUMERIC
3057 || category == LC_ALL
3063 if (category == LC_ALL)
3064 newnum = setlocale(LC_NUMERIC, NULL);
3068 perl_new_numeric(newnum);
3070 #endif /* USE_LOCALE_NUMERIC */
3110 /* (We already know stack is long enough.) */
3111 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3112 PUSHs(sv_2mortal(newSViv(expvar)));
3128 /* (We already know stack is long enough.) */
3129 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3130 PUSHs(sv_2mortal(newSVnv(intvar)));
3145 sigaction(sig, action, oldaction = 0)
3147 POSIX::SigAction action
3148 POSIX::SigAction oldaction
3151 RETVAL = not_here("sigaction");
3153 # This code is really grody because we're trying to make the signal
3154 # interface look beautiful, which is hard.
3157 gv_fetchpv("SIG", TRUE, SVt_PVHV);
3160 struct sigaction act;
3161 struct sigaction oact;
3162 POSIX__SigSet sigset;
3164 SV** sigsvp = hv_fetch(GvHVn(siggv),
3166 strlen(sig_name[sig]),
3169 /* Remember old handler name if desired. */
3171 char *hand = SvPVx(*sigsvp, na);
3172 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
3173 sv_setpv(*svp, *hand ? hand : "DEFAULT");
3177 /* Vector new handler through %SIG. (We always use sighandler
3178 for the C signal handler, which reads %SIG to dispatch.) */
3179 svp = hv_fetch(action, "HANDLER", 7, FALSE);
3181 croak("Can't supply an action without a HANDLER");
3182 sv_setpv(*sigsvp, SvPV(*svp, na));
3183 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
3184 act.sa_handler = sighandler;
3186 /* Set up any desired mask. */
3187 svp = hv_fetch(action, "MASK", 4, FALSE);
3188 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
3190 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3191 sigset = (sigset_t*) tmp;
3192 act.sa_mask = *sigset;
3195 sigemptyset(& act.sa_mask);
3197 /* Set up any desired flags. */
3198 svp = hv_fetch(action, "FLAGS", 5, FALSE);
3199 act.sa_flags = svp ? SvIV(*svp) : 0;
3202 /* Now work around sigaction oddities */
3203 if (action && oldaction)
3204 RETVAL = sigaction(sig, & act, & oact);
3206 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3208 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3213 /* Get back the mask. */
3214 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
3215 if (sv_isa(*svp, "POSIX::SigSet")) {
3217 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3218 sigset = (sigset_t*) tmp;
3221 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
3222 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
3224 *sigset = oact.sa_mask;
3226 /* Get back the flags. */
3227 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
3228 sv_setiv(*svp, oact.sa_flags);
3237 POSIX::SigSet sigset
3240 sigprocmask(how, sigset, oldsigset = 0)
3242 POSIX::SigSet sigset
3243 POSIX::SigSet oldsigset
3246 sigsuspend(signal_mask)
3247 POSIX::SigSet signal_mask
3267 lseek(fd, offset, whence)
3280 if (pipe(fds) != -1) {
3282 PUSHs(sv_2mortal(newSViv(fds[0])));
3283 PUSHs(sv_2mortal(newSViv(fds[1])));
3287 read(fd, buffer, nbytes)
3289 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3293 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3296 SvCUR(sv_buffer) = RETVAL;
3297 SvPOK_only(sv_buffer);
3298 *SvEND(sv_buffer) = '\0';
3299 SvTAINTED_on(sv_buffer);
3315 tcsetpgrp(fd, pgrp_id)
3324 if (uname(&buf) >= 0) {
3326 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3327 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3328 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3329 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3330 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3333 uname((char *) 0); /* A stub to call not_here(). */
3337 write(fd, buffer, nbytes)
3355 mbstowcs(s, pwcs, n)
3367 wcstombs(s, pwcs, n)
3389 SET_NUMERIC_LOCAL();
3390 num = strtod(str, &unparsed);
3391 PUSHs(sv_2mortal(newSVnv(num)));
3392 if (GIMME == G_ARRAY) {
3395 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3401 strtol(str, base = 0)
3408 num = strtol(str, &unparsed, base);
3409 if (num >= IV_MIN && num <= IV_MAX)
3410 PUSHs(sv_2mortal(newSViv((IV)num)));
3412 PUSHs(sv_2mortal(newSVnv((double)num)));
3413 if (GIMME == G_ARRAY) {
3416 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3422 strtoul(str, base = 0)
3429 num = strtoul(str, &unparsed, base);
3431 PUSHs(sv_2mortal(newSViv((IV)num)));
3433 PUSHs(sv_2mortal(newSVnv((double)num)));
3434 if (GIMME == G_ARRAY) {
3437 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3449 char *p = SvPV(src,srclen);
3451 ST(0) = sv_2mortal(NEWSV(800,srclen));
3452 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3453 if (dstlen > srclen) {
3455 SvGROW(ST(0), dstlen);
3456 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3459 SvCUR(ST(0)) = dstlen;
3464 mkfifo(filename, mode)
3468 TAINT_PROPER("mkfifo");
3469 RETVAL = mkfifo(filename, mode);
3485 tcflush(fd, queue_selector)
3490 tcsendbreak(fd, duration)
3495 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3508 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3511 mytm.tm_hour = hour;
3512 mytm.tm_mday = mday;
3514 mytm.tm_year = year;
3515 mytm.tm_wday = wday;
3516 mytm.tm_yday = yday;
3517 mytm.tm_isdst = isdst;
3518 RETVAL = asctime(&mytm);
3535 realtime = times( &tms );
3537 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
3538 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
3539 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
3540 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) );
3541 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) );
3544 difftime(time1, time2)
3549 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3562 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3565 mytm.tm_hour = hour;
3566 mytm.tm_mday = mday;
3568 mytm.tm_year = year;
3569 mytm.tm_wday = wday;
3570 mytm.tm_yday = yday;
3571 mytm.tm_isdst = isdst;
3572 RETVAL = mktime(&mytm);
3578 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3594 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3597 mytm.tm_hour = hour;
3598 mytm.tm_mday = mday;
3600 mytm.tm_year = year;
3601 mytm.tm_wday = wday;
3602 mytm.tm_yday = yday;
3603 mytm.tm_isdst = isdst;
3604 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3605 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3615 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3616 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3619 access(filename, mode)
3637 pathconf(filename, name)