2 #define PERLIO_NOT_STDIO 1
6 #ifdef I_DIRENT /* XXX maybe better to just rely on perl.h? */
29 /* XXX This comment is just to make I_TERMIO and I_SGTTY visible to
30 metaconfig for future extension writers. We don't use them in POSIX.
31 (This is really sneaky :-) --AD
33 #if defined(I_TERMIOS)
41 #include <sys/types.h>
43 #include <unistd.h> /* see hints/sunos_4_1.sh */
46 #if defined(__VMS) && !defined(__POSIX_SOURCE)
47 # include <libdef.h> /* LIB$_INVARG constant */
48 # include <lib$routines.h> /* prototype for lib$ediv() */
49 # include <starlet.h> /* prototype for sys$gettim() */
50 # if DECC_VERSION < 50000000
51 # define pid_t int /* old versions of DECC miss this in types.h */
54 # undef mkfifo /* #defined in perl.h */
55 # define mkfifo(a,b) (not_here("mkfifo"),-1)
56 # define tzset() not_here("tzset")
58 #if ((__VMS_VER >= 70000000) && (__DECC_VER >= 50200000)) || (__CRTL_VER >= 70000000)
59 # define HAS_TZNAME /* shows up in VMS 7.0 or Dec C 5.6 */
61 # endif /* __VMS_VER >= 70000000 or Dec C 5.6 */
63 /* The POSIX notion of ttyname() is better served by getname() under VMS */
64 static char ttnambuf[64];
65 # define ttyname(fd) (isatty(fd) > 0 ? getname(fd,ttnambuf,0) : NULL)
67 /* The non-POSIX CRTL times() has void return type, so we just get the
68 current time directly */
69 clock_t vms_times(struct tms *bufptr) {
71 /* Get wall time and convert to 10 ms intervals to
72 * produce the return value that the POSIX standard expects */
73 # if defined(__DECC) && defined (__ALPHA)
76 _ckvmssts(sys$gettim(&vmstime));
78 retval = vmstime & 0x7fffffff;
80 /* (Older hw or ccs don't have an atomic 64-bit type, so we
81 * juggle 32-bit ints (and a float) to produce a time_t result
82 * with minimal loss of information.) */
83 long int vmstime[2],remainder,divisor = 100000;
84 _ckvmssts(sys$gettim((unsigned long int *)vmstime));
85 vmstime[1] &= 0x7fff; /* prevent overflow in EDIV */
86 _ckvmssts(lib$ediv(&divisor,vmstime,(long int *)&retval,&remainder));
88 /* Fill in the struct tms using the CRTL routine . . .*/
89 times((tbuffer_t *)bufptr);
90 return (clock_t) retval;
92 # define times(t) vms_times(t)
95 # include <sys/times.h>
97 # include <sys/utsname.h>
99 # include <sys/wait.h>
106 typedef long SysRetLong;
107 typedef sigset_t* POSIX__SigSet;
108 typedef HV* POSIX__SigAction;
110 typedef struct termios* POSIX__Termios;
111 #else /* Define termios types to int, and call not_here for the functions.*/
112 #define POSIX__Termios int
116 #define cfgetispeed(x) not_here("cfgetispeed")
117 #define cfgetospeed(x) not_here("cfgetospeed")
118 #define tcdrain(x) not_here("tcdrain")
119 #define tcflush(x,y) not_here("tcflush")
120 #define tcsendbreak(x,y) not_here("tcsendbreak")
121 #define cfsetispeed(x,y) not_here("cfsetispeed")
122 #define cfsetospeed(x,y) not_here("cfsetospeed")
123 #define ctermid(x) (char *) not_here("ctermid")
124 #define tcflow(x,y) not_here("tcflow")
125 #define tcgetattr(x,y) not_here("tcgetattr")
126 #define tcsetattr(x,y,z) not_here("tcsetattr")
129 /* Possibly needed prototypes */
130 char *cuserid _((char *));
131 double strtod _((const char *, char **));
132 long strtol _((const char *, char **, int));
133 unsigned long strtoul _((const char *, char **, int));
136 #define cuserid(a) (char *) not_here("cuserid")
140 #define difftime(a,b) not_here("difftime")
143 #ifndef HAS_FPATHCONF
144 #define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
147 #define mktime(a) not_here("mktime")
150 #define nice(a) not_here("nice")
153 #define pathconf(f,n) (SysRetLong) not_here("pathconf")
156 #define sysconf(n) (SysRetLong) not_here("sysconf")
159 #define readlink(a,b,c) not_here("readlink")
162 #define setpgid(a,b) not_here("setpgid")
165 #define setsid() not_here("setsid")
168 #define strcoll(s1,s2) not_here("strcoll")
171 #define strtod(s1,s2) not_here("strtod")
174 #define strtol(s1,s2,b) not_here("strtol")
177 #define strtoul(s1,s2,b) not_here("strtoul")
180 #define strxfrm(s1,s2,n) not_here("strxfrm")
182 #ifndef HAS_TCGETPGRP
183 #define tcgetpgrp(a) not_here("tcgetpgrp")
185 #ifndef HAS_TCSETPGRP
186 #define tcsetpgrp(a,b) not_here("tcsetpgrp")
189 #define times(a) not_here("times")
192 #define uname(a) not_here("uname")
195 #define waitpid(a,b,c) not_here("waitpid")
200 #define mblen(a,b) not_here("mblen")
204 #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
207 #define mbtowc(pwc, s, n) not_here("mbtowc")
210 #define wcstombs(s, pwcs, n) not_here("wcstombs")
213 #define wctomb(s, wchar) not_here("wcstombs")
215 #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
216 /* If we don't have these functions, then we wouldn't have gotten a typedef
217 for wchar_t, the wide character type. Defining wchar_t allows the
218 functions referencing it to compile. Its actual type is then meaningless,
219 since without the above functions, all sections using it end up calling
220 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
226 #ifndef HAS_LOCALECONV
227 #define localeconv() not_here("localeconv")
231 extern char *tzname[];
233 char *tzname[] = { "" , "" };
236 /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX)
237 * fields for which we don't have Configure support yet:
238 * char *tm_zone; -- abbreviation of timezone name
239 * long tm_gmtoff; -- offset from GMT in seconds
240 * To workaround core dumps from the uninitialised tm_zone we get the
241 * system to give us a reasonable struct to copy. This fix means that
242 * strftime uses the tm_zone and tm_gmtoff values returned by
243 * localtime(time()). That should give the desired result most of the
244 * time. But probably not always!
246 * This is a temporary workaround to be removed once Configure
247 * support is added and NETaa14816 is considered in full.
248 * It does not address tzname aspects of NETaa14816.
251 # ifndef STRUCT_TM_HASZONE
252 # define STRUCT_TM_HAS_ZONE
256 #ifdef STRUCT_TM_HASZONE
258 init_tm(ptm) /* see mktime, strftime and asctime */
263 Copy(localtime(&now), ptm, 1, struct tm);
267 # define init_tm(ptm)
271 #ifndef HAS_LONG_DOUBLE /* XXX What to do about long doubles? */
286 croak("POSIX::%s not implemented on this architecture", s);
291 constant(char *name, int arg)
296 if (strEQ(name, "ARG_MAX"))
304 if (strEQ(name, "BUFSIZ"))
310 if (strEQ(name, "BRKINT"))
316 if (strEQ(name, "B9600"))
322 if (strEQ(name, "B19200"))
328 if (strEQ(name, "B38400"))
334 if (strEQ(name, "B0"))
340 if (strEQ(name, "B110"))
346 if (strEQ(name, "B1200"))
352 if (strEQ(name, "B134"))
358 if (strEQ(name, "B150"))
364 if (strEQ(name, "B1800"))
370 if (strEQ(name, "B200"))
376 if (strEQ(name, "B2400"))
382 if (strEQ(name, "B300"))
388 if (strEQ(name, "B4800"))
394 if (strEQ(name, "B50"))
400 if (strEQ(name, "B600"))
406 if (strEQ(name, "B75"))
414 if (strEQ(name, "CHAR_BIT"))
420 if (strEQ(name, "CHAR_MAX"))
426 if (strEQ(name, "CHAR_MIN"))
432 if (strEQ(name, "CHILD_MAX"))
438 if (strEQ(name, "CLK_TCK"))
444 if (strEQ(name, "CLOCAL"))
450 if (strEQ(name, "CLOCKS_PER_SEC"))
451 #ifdef CLOCKS_PER_SEC
452 return CLOCKS_PER_SEC;
456 if (strEQ(name, "CREAD"))
462 if (strEQ(name, "CS5"))
468 if (strEQ(name, "CS6"))
474 if (strEQ(name, "CS7"))
480 if (strEQ(name, "CS8"))
486 if (strEQ(name, "CSIZE"))
492 if (strEQ(name, "CSTOPB"))
500 if (strEQ(name, "DBL_MAX"))
506 if (strEQ(name, "DBL_MIN"))
512 if (strEQ(name, "DBL_DIG"))
518 if (strEQ(name, "DBL_EPSILON"))
524 if (strEQ(name, "DBL_MANT_DIG"))
530 if (strEQ(name, "DBL_MAX_10_EXP"))
531 #ifdef DBL_MAX_10_EXP
532 return DBL_MAX_10_EXP;
536 if (strEQ(name, "DBL_MAX_EXP"))
542 if (strEQ(name, "DBL_MIN_10_EXP"))
543 #ifdef DBL_MIN_10_EXP
544 return DBL_MIN_10_EXP;
548 if (strEQ(name, "DBL_MIN_EXP"))
558 if (strEQ(name, "EACCES"))
564 if (strEQ(name, "EADDRINUSE"))
570 if (strEQ(name, "EADDRNOTAVAIL"))
572 return EADDRNOTAVAIL;
576 if (strEQ(name, "EAFNOSUPPORT"))
582 if (strEQ(name, "EAGAIN"))
588 if (strEQ(name, "EALREADY"))
596 if (strEQ(name, "EBADF"))
602 if (strEQ(name, "EBUSY"))
610 if (strEQ(name, "ECHILD"))
616 if (strEQ(name, "ECHO"))
622 if (strEQ(name, "ECHOE"))
628 if (strEQ(name, "ECHOK"))
634 if (strEQ(name, "ECHONL"))
640 if (strEQ(name, "ECONNABORTED"))
646 if (strEQ(name, "ECONNREFUSED"))
652 if (strEQ(name, "ECONNRESET"))
660 if (strEQ(name, "EDEADLK"))
666 if (strEQ(name, "EDESTADDRREQ"))
672 if (strEQ(name, "EDOM"))
678 if (strEQ(name, "EDQUOT"))
686 if (strEQ(name, "EEXIST"))
694 if (strEQ(name, "EFAULT"))
700 if (strEQ(name, "EFBIG"))
708 if (strEQ(name, "EHOSTDOWN"))
714 if (strEQ(name, "EHOSTUNREACH"))
722 if (strEQ(name, "EINPROGRESS"))
728 if (strEQ(name, "EINTR"))
734 if (strEQ(name, "EINVAL"))
740 if (strEQ(name, "EIO"))
746 if (strEQ(name, "EISCONN"))
752 if (strEQ(name, "EISDIR"))
758 if (strEQ(name, "ELOOP"))
766 if (strEQ(name, "EMFILE"))
772 if (strEQ(name, "EMLINK"))
778 if (strEQ(name, "EMSGSIZE"))
786 if (strEQ(name, "ENETDOWN"))
792 if (strEQ(name, "ENETRESET"))
798 if (strEQ(name, "ENETUNREACH"))
804 if (strEQ(name, "ENOBUFS"))
810 if (strEQ(name, "ENOEXEC"))
816 if (strEQ(name, "ENOMEM"))
822 if (strEQ(name, "ENOPROTOOPT"))
828 if (strEQ(name, "ENOSPC"))
834 if (strEQ(name, "ENOTBLK"))
840 if (strEQ(name, "ENOTCONN"))
846 if (strEQ(name, "ENOTDIR"))
852 if (strEQ(name, "ENOTEMPTY"))
858 if (strEQ(name, "ENOTSOCK"))
864 if (strEQ(name, "ENOTTY"))
870 if (strEQ(name, "ENFILE"))
876 if (strEQ(name, "ENODEV"))
882 if (strEQ(name, "ENOENT"))
888 if (strEQ(name, "ENOLCK"))
894 if (strEQ(name, "ENOSYS"))
900 if (strEQ(name, "ENXIO"))
906 if (strEQ(name, "ENAMETOOLONG"))
914 if (strEQ(name, "EOF"))
920 if (strEQ(name, "EOPNOTSUPP"))
928 if (strEQ(name, "EPERM"))
934 if (strEQ(name, "EPFNOSUPPORT"))
940 if (strEQ(name, "EPIPE"))
946 if (strEQ(name, "EPROCLIM"))
952 if (strEQ(name, "EPROTONOSUPPORT"))
953 #ifdef EPROTONOSUPPORT
954 return EPROTONOSUPPORT;
958 if (strEQ(name, "EPROTOTYPE"))
966 if (strEQ(name, "ERANGE"))
972 if (strEQ(name, "EREMOTE"))
978 if (strEQ(name, "ERESTART"))
984 if (strEQ(name, "EROFS"))
992 if (strEQ(name, "ESHUTDOWN"))
998 if (strEQ(name, "ESOCKTNOSUPPORT"))
999 #ifdef ESOCKTNOSUPPORT
1000 return ESOCKTNOSUPPORT;
1004 if (strEQ(name, "ESPIPE"))
1010 if (strEQ(name, "ESRCH"))
1016 if (strEQ(name, "ESTALE"))
1024 if (strEQ(name, "ETIMEDOUT"))
1030 if (strEQ(name, "ETOOMANYREFS"))
1032 return ETOOMANYREFS;
1036 if (strEQ(name, "ETXTBSY"))
1044 if (strEQ(name, "EUSERS"))
1052 if (strEQ(name, "EWOULDBLOCK"))
1060 if (strEQ(name, "EXIT_FAILURE"))
1062 return EXIT_FAILURE;
1066 if (strEQ(name, "EXIT_SUCCESS"))
1068 return EXIT_SUCCESS;
1072 if (strEQ(name, "EXDEV"))
1080 if (strEQ(name, "E2BIG"))
1088 if (strnEQ(name, "FLT_", 4)) {
1089 if (strEQ(name, "FLT_MAX"))
1095 if (strEQ(name, "FLT_MIN"))
1101 if (strEQ(name, "FLT_ROUNDS"))
1107 if (strEQ(name, "FLT_DIG"))
1113 if (strEQ(name, "FLT_EPSILON"))
1119 if (strEQ(name, "FLT_MANT_DIG"))
1121 return FLT_MANT_DIG;
1125 if (strEQ(name, "FLT_MAX_10_EXP"))
1126 #ifdef FLT_MAX_10_EXP
1127 return FLT_MAX_10_EXP;
1131 if (strEQ(name, "FLT_MAX_EXP"))
1137 if (strEQ(name, "FLT_MIN_10_EXP"))
1138 #ifdef FLT_MIN_10_EXP
1139 return FLT_MIN_10_EXP;
1143 if (strEQ(name, "FLT_MIN_EXP"))
1149 if (strEQ(name, "FLT_RADIX"))
1157 if (strnEQ(name, "F_", 2)) {
1158 if (strEQ(name, "F_DUPFD"))
1164 if (strEQ(name, "F_GETFD"))
1170 if (strEQ(name, "F_GETFL"))
1176 if (strEQ(name, "F_GETLK"))
1182 if (strEQ(name, "F_OK"))
1188 if (strEQ(name, "F_RDLCK"))
1194 if (strEQ(name, "F_SETFD"))
1200 if (strEQ(name, "F_SETFL"))
1206 if (strEQ(name, "F_SETLK"))
1212 if (strEQ(name, "F_SETLKW"))
1218 if (strEQ(name, "F_UNLCK"))
1224 if (strEQ(name, "F_WRLCK"))
1232 if (strEQ(name, "FD_CLOEXEC"))
1238 if (strEQ(name, "FILENAME_MAX"))
1240 return FILENAME_MAX;
1246 if (strEQ(name, "HUGE_VAL"))
1252 if (strEQ(name, "HUPCL"))
1260 if (strEQ(name, "INT_MAX"))
1266 if (strEQ(name, "INT_MIN"))
1272 if (strEQ(name, "ICANON"))
1278 if (strEQ(name, "ICRNL"))
1284 if (strEQ(name, "IEXTEN"))
1290 if (strEQ(name, "IGNBRK"))
1296 if (strEQ(name, "IGNCR"))
1302 if (strEQ(name, "IGNPAR"))
1308 if (strEQ(name, "INLCR"))
1314 if (strEQ(name, "INPCK"))
1320 if (strEQ(name, "ISIG"))
1326 if (strEQ(name, "ISTRIP"))
1332 if (strEQ(name, "IXOFF"))
1338 if (strEQ(name, "IXON"))
1346 if (strnEQ(name, "LC_", 3)) {
1347 if (strEQ(name, "LC_ALL"))
1353 if (strEQ(name, "LC_COLLATE"))
1359 if (strEQ(name, "LC_CTYPE"))
1365 if (strEQ(name, "LC_MONETARY"))
1371 if (strEQ(name, "LC_NUMERIC"))
1377 if (strEQ(name, "LC_TIME"))
1385 if (strnEQ(name, "LDBL_", 5)) {
1386 if (strEQ(name, "LDBL_MAX"))
1392 if (strEQ(name, "LDBL_MIN"))
1398 if (strEQ(name, "LDBL_DIG"))
1404 if (strEQ(name, "LDBL_EPSILON"))
1406 return LDBL_EPSILON;
1410 if (strEQ(name, "LDBL_MANT_DIG"))
1411 #ifdef LDBL_MANT_DIG
1412 return LDBL_MANT_DIG;
1416 if (strEQ(name, "LDBL_MAX_10_EXP"))
1417 #ifdef LDBL_MAX_10_EXP
1418 return LDBL_MAX_10_EXP;
1422 if (strEQ(name, "LDBL_MAX_EXP"))
1424 return LDBL_MAX_EXP;
1428 if (strEQ(name, "LDBL_MIN_10_EXP"))
1429 #ifdef LDBL_MIN_10_EXP
1430 return LDBL_MIN_10_EXP;
1434 if (strEQ(name, "LDBL_MIN_EXP"))
1436 return LDBL_MIN_EXP;
1442 if (strnEQ(name, "L_", 2)) {
1443 if (strEQ(name, "L_ctermid"))
1449 if (strEQ(name, "L_cuserid"))
1455 if (strEQ(name, "L_tmpname"))
1463 if (strEQ(name, "LONG_MAX"))
1469 if (strEQ(name, "LONG_MIN"))
1475 if (strEQ(name, "LINK_MAX"))
1483 if (strEQ(name, "MAX_CANON"))
1489 if (strEQ(name, "MAX_INPUT"))
1495 if (strEQ(name, "MB_CUR_MAX"))
1501 if (strEQ(name, "MB_LEN_MAX"))
1509 if (strEQ(name, "NULL")) return 0;
1510 if (strEQ(name, "NAME_MAX"))
1516 if (strEQ(name, "NCCS"))
1522 if (strEQ(name, "NGROUPS_MAX"))
1528 if (strEQ(name, "NOFLSH"))
1536 if (strnEQ(name, "O_", 2)) {
1537 if (strEQ(name, "O_APPEND"))
1543 if (strEQ(name, "O_CREAT"))
1549 if (strEQ(name, "O_TRUNC"))
1555 if (strEQ(name, "O_RDONLY"))
1561 if (strEQ(name, "O_RDWR"))
1567 if (strEQ(name, "O_WRONLY"))
1573 if (strEQ(name, "O_EXCL"))
1579 if (strEQ(name, "O_NOCTTY"))
1585 if (strEQ(name, "O_NONBLOCK"))
1591 if (strEQ(name, "O_ACCMODE"))
1599 if (strEQ(name, "OPEN_MAX"))
1605 if (strEQ(name, "OPOST"))
1613 if (strEQ(name, "PATH_MAX"))
1619 if (strEQ(name, "PARENB"))
1625 if (strEQ(name, "PARMRK"))
1631 if (strEQ(name, "PARODD"))
1637 if (strEQ(name, "PIPE_BUF"))
1645 if (strEQ(name, "RAND_MAX"))
1651 if (strEQ(name, "R_OK"))
1659 if (strnEQ(name, "SIG", 3)) {
1660 if (name[3] == '_') {
1661 if (strEQ(name, "SIG_BLOCK"))
1668 if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
1671 if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
1674 if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
1676 if (strEQ(name, "SIG_SETMASK"))
1682 if (strEQ(name, "SIG_UNBLOCK"))
1690 if (strEQ(name, "SIGABRT"))
1696 if (strEQ(name, "SIGALRM"))
1702 if (strEQ(name, "SIGCHLD"))
1708 if (strEQ(name, "SIGCONT"))
1714 if (strEQ(name, "SIGFPE"))
1720 if (strEQ(name, "SIGHUP"))
1726 if (strEQ(name, "SIGILL"))
1732 if (strEQ(name, "SIGINT"))
1738 if (strEQ(name, "SIGKILL"))
1744 if (strEQ(name, "SIGPIPE"))
1750 if (strEQ(name, "SIGQUIT"))
1756 if (strEQ(name, "SIGSEGV"))
1762 if (strEQ(name, "SIGSTOP"))
1768 if (strEQ(name, "SIGTERM"))
1774 if (strEQ(name, "SIGTSTP"))
1780 if (strEQ(name, "SIGTTIN"))
1786 if (strEQ(name, "SIGTTOU"))
1792 if (strEQ(name, "SIGUSR1"))
1798 if (strEQ(name, "SIGUSR2"))
1806 if (name[1] == '_') {
1807 if (strEQ(name, "S_ISGID"))
1813 if (strEQ(name, "S_ISUID"))
1819 if (strEQ(name, "S_IRGRP"))
1825 if (strEQ(name, "S_IROTH"))
1831 if (strEQ(name, "S_IRUSR"))
1837 if (strEQ(name, "S_IRWXG"))
1843 if (strEQ(name, "S_IRWXO"))
1849 if (strEQ(name, "S_IRWXU"))
1855 if (strEQ(name, "S_IWGRP"))
1861 if (strEQ(name, "S_IWOTH"))
1867 if (strEQ(name, "S_IWUSR"))
1873 if (strEQ(name, "S_IXGRP"))
1879 if (strEQ(name, "S_IXOTH"))
1885 if (strEQ(name, "S_IXUSR"))
1891 errno = EAGAIN; /* the following aren't constants */
1893 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1896 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1899 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1902 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1905 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1909 if (strEQ(name, "SEEK_CUR"))
1915 if (strEQ(name, "SEEK_END"))
1921 if (strEQ(name, "SEEK_SET"))
1927 if (strEQ(name, "STREAM_MAX"))
1933 if (strEQ(name, "SHRT_MAX"))
1939 if (strEQ(name, "SHRT_MIN"))
1945 if (strnEQ(name, "SA_", 3)) {
1946 if (strEQ(name, "SA_NOCLDSTOP"))
1948 return SA_NOCLDSTOP;
1952 if (strEQ(name, "SA_NOCLDWAIT"))
1954 return SA_NOCLDWAIT;
1958 if (strEQ(name, "SA_NODEFER"))
1964 if (strEQ(name, "SA_ONSTACK"))
1970 if (strEQ(name, "SA_RESETHAND"))
1972 return SA_RESETHAND;
1976 if (strEQ(name, "SA_RESTART"))
1982 if (strEQ(name, "SA_SIGINFO"))
1990 if (strEQ(name, "SCHAR_MAX"))
1996 if (strEQ(name, "SCHAR_MIN"))
2002 if (strEQ(name, "SSIZE_MAX"))
2008 if (strEQ(name, "STDIN_FILENO"))
2010 return STDIN_FILENO;
2014 if (strEQ(name, "STDOUT_FILENO"))
2015 #ifdef STDOUT_FILENO
2016 return STDOUT_FILENO;
2020 if (strEQ(name, "STRERR_FILENO"))
2021 #ifdef STRERR_FILENO
2022 return STRERR_FILENO;
2028 if (strEQ(name, "TCIFLUSH"))
2034 if (strEQ(name, "TCIOFF"))
2040 if (strEQ(name, "TCIOFLUSH"))
2046 if (strEQ(name, "TCION"))
2052 if (strEQ(name, "TCOFLUSH"))
2058 if (strEQ(name, "TCOOFF"))
2064 if (strEQ(name, "TCOON"))
2070 if (strEQ(name, "TCSADRAIN"))
2076 if (strEQ(name, "TCSAFLUSH"))
2082 if (strEQ(name, "TCSANOW"))
2088 if (strEQ(name, "TMP_MAX"))
2094 if (strEQ(name, "TOSTOP"))
2100 if (strEQ(name, "TZNAME_MAX"))
2108 if (strEQ(name, "UCHAR_MAX"))
2114 if (strEQ(name, "UINT_MAX"))
2120 if (strEQ(name, "ULONG_MAX"))
2126 if (strEQ(name, "USHRT_MAX"))
2134 if (strEQ(name, "VEOF"))
2140 if (strEQ(name, "VEOL"))
2146 if (strEQ(name, "VERASE"))
2152 if (strEQ(name, "VINTR"))
2158 if (strEQ(name, "VKILL"))
2164 if (strEQ(name, "VMIN"))
2170 if (strEQ(name, "VQUIT"))
2176 if (strEQ(name, "VSTART"))
2182 if (strEQ(name, "VSTOP"))
2188 if (strEQ(name, "VSUSP"))
2194 if (strEQ(name, "VTIME"))
2202 if (strEQ(name, "W_OK"))
2208 if (strEQ(name, "WNOHANG"))
2214 if (strEQ(name, "WUNTRACED"))
2220 errno = EAGAIN; /* the following aren't constants */
2222 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2225 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2228 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2231 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2234 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2237 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2241 if (strEQ(name, "X_OK"))
2249 if (strnEQ(name, "_PC_", 4)) {
2250 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2251 #ifdef _PC_CHOWN_RESTRICTED
2252 return _PC_CHOWN_RESTRICTED;
2256 if (strEQ(name, "_PC_LINK_MAX"))
2258 return _PC_LINK_MAX;
2262 if (strEQ(name, "_PC_MAX_CANON"))
2263 #ifdef _PC_MAX_CANON
2264 return _PC_MAX_CANON;
2268 if (strEQ(name, "_PC_MAX_INPUT"))
2269 #ifdef _PC_MAX_INPUT
2270 return _PC_MAX_INPUT;
2274 if (strEQ(name, "_PC_NAME_MAX"))
2276 return _PC_NAME_MAX;
2280 if (strEQ(name, "_PC_NO_TRUNC"))
2282 return _PC_NO_TRUNC;
2286 if (strEQ(name, "_PC_PATH_MAX"))
2288 return _PC_PATH_MAX;
2292 if (strEQ(name, "_PC_PIPE_BUF"))
2294 return _PC_PIPE_BUF;
2298 if (strEQ(name, "_PC_VDISABLE"))
2300 return _PC_VDISABLE;
2306 if (strnEQ(name, "_POSIX_", 7)) {
2307 if (strEQ(name, "_POSIX_ARG_MAX"))
2308 #ifdef _POSIX_ARG_MAX
2309 return _POSIX_ARG_MAX;
2313 if (strEQ(name, "_POSIX_CHILD_MAX"))
2314 #ifdef _POSIX_CHILD_MAX
2315 return _POSIX_CHILD_MAX;
2319 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2320 #ifdef _POSIX_CHOWN_RESTRICTED
2321 return _POSIX_CHOWN_RESTRICTED;
2325 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2326 #ifdef _POSIX_JOB_CONTROL
2327 return _POSIX_JOB_CONTROL;
2331 if (strEQ(name, "_POSIX_LINK_MAX"))
2332 #ifdef _POSIX_LINK_MAX
2333 return _POSIX_LINK_MAX;
2337 if (strEQ(name, "_POSIX_MAX_CANON"))
2338 #ifdef _POSIX_MAX_CANON
2339 return _POSIX_MAX_CANON;
2343 if (strEQ(name, "_POSIX_MAX_INPUT"))
2344 #ifdef _POSIX_MAX_INPUT
2345 return _POSIX_MAX_INPUT;
2349 if (strEQ(name, "_POSIX_NAME_MAX"))
2350 #ifdef _POSIX_NAME_MAX
2351 return _POSIX_NAME_MAX;
2355 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2356 #ifdef _POSIX_NGROUPS_MAX
2357 return _POSIX_NGROUPS_MAX;
2361 if (strEQ(name, "_POSIX_NO_TRUNC"))
2362 #ifdef _POSIX_NO_TRUNC
2363 return _POSIX_NO_TRUNC;
2367 if (strEQ(name, "_POSIX_OPEN_MAX"))
2368 #ifdef _POSIX_OPEN_MAX
2369 return _POSIX_OPEN_MAX;
2373 if (strEQ(name, "_POSIX_PATH_MAX"))
2374 #ifdef _POSIX_PATH_MAX
2375 return _POSIX_PATH_MAX;
2379 if (strEQ(name, "_POSIX_PIPE_BUF"))
2380 #ifdef _POSIX_PIPE_BUF
2381 return _POSIX_PIPE_BUF;
2385 if (strEQ(name, "_POSIX_SAVED_IDS"))
2386 #ifdef _POSIX_SAVED_IDS
2387 return _POSIX_SAVED_IDS;
2391 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2392 #ifdef _POSIX_SSIZE_MAX
2393 return _POSIX_SSIZE_MAX;
2397 if (strEQ(name, "_POSIX_STREAM_MAX"))
2398 #ifdef _POSIX_STREAM_MAX
2399 return _POSIX_STREAM_MAX;
2403 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2404 #ifdef _POSIX_TZNAME_MAX
2405 return _POSIX_TZNAME_MAX;
2409 if (strEQ(name, "_POSIX_VDISABLE"))
2410 #ifdef _POSIX_VDISABLE
2411 return _POSIX_VDISABLE;
2415 if (strEQ(name, "_POSIX_VERSION"))
2416 #ifdef _POSIX_VERSION
2417 return _POSIX_VERSION;
2423 if (strnEQ(name, "_SC_", 4)) {
2424 if (strEQ(name, "_SC_ARG_MAX"))
2430 if (strEQ(name, "_SC_CHILD_MAX"))
2431 #ifdef _SC_CHILD_MAX
2432 return _SC_CHILD_MAX;
2436 if (strEQ(name, "_SC_CLK_TCK"))
2442 if (strEQ(name, "_SC_JOB_CONTROL"))
2443 #ifdef _SC_JOB_CONTROL
2444 return _SC_JOB_CONTROL;
2448 if (strEQ(name, "_SC_NGROUPS_MAX"))
2449 #ifdef _SC_NGROUPS_MAX
2450 return _SC_NGROUPS_MAX;
2454 if (strEQ(name, "_SC_OPEN_MAX"))
2456 return _SC_OPEN_MAX;
2460 if (strEQ(name, "_SC_SAVED_IDS"))
2461 #ifdef _SC_SAVED_IDS
2462 return _SC_SAVED_IDS;
2466 if (strEQ(name, "_SC_STREAM_MAX"))
2467 #ifdef _SC_STREAM_MAX
2468 return _SC_STREAM_MAX;
2472 if (strEQ(name, "_SC_TZNAME_MAX"))
2473 #ifdef _SC_TZNAME_MAX
2474 return _SC_TZNAME_MAX;
2478 if (strEQ(name, "_SC_VERSION"))
2495 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2498 new(packname = "POSIX::SigSet", ...)
2503 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2504 sigemptyset(RETVAL);
2505 for (i = 1; i < items; i++)
2506 sigaddset(RETVAL, SvIV(ST(i)));
2513 POSIX::SigSet sigset
2515 safefree((char *)sigset);
2518 sigaddset(sigset, sig)
2519 POSIX::SigSet sigset
2523 sigdelset(sigset, sig)
2524 POSIX::SigSet sigset
2529 POSIX::SigSet sigset
2533 POSIX::SigSet sigset
2536 sigismember(sigset, sig)
2537 POSIX::SigSet sigset
2541 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2544 new(packname = "POSIX::Termios", ...)
2549 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2551 not_here("termios");
2558 DESTROY(termios_ref)
2559 POSIX::Termios termios_ref
2562 safefree((char *)termios_ref);
2564 not_here("termios");
2568 getattr(termios_ref, fd = 0)
2569 POSIX::Termios termios_ref
2572 RETVAL = tcgetattr(fd, termios_ref);
2577 setattr(termios_ref, fd = 0, optional_actions = 0)
2578 POSIX::Termios termios_ref
2580 int optional_actions
2582 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2587 cfgetispeed(termios_ref)
2588 POSIX::Termios termios_ref
2591 cfgetospeed(termios_ref)
2592 POSIX::Termios termios_ref
2595 getiflag(termios_ref)
2596 POSIX::Termios termios_ref
2598 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2599 RETVAL = termios_ref->c_iflag;
2601 not_here("getiflag");
2607 getoflag(termios_ref)
2608 POSIX::Termios termios_ref
2610 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2611 RETVAL = termios_ref->c_oflag;
2613 not_here("getoflag");
2619 getcflag(termios_ref)
2620 POSIX::Termios termios_ref
2622 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2623 RETVAL = termios_ref->c_cflag;
2625 not_here("getcflag");
2631 getlflag(termios_ref)
2632 POSIX::Termios termios_ref
2634 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2635 RETVAL = termios_ref->c_lflag;
2637 not_here("getlflag");
2643 getcc(termios_ref, ccix)
2644 POSIX::Termios termios_ref
2647 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2649 croak("Bad getcc subscript");
2650 RETVAL = termios_ref->c_cc[ccix];
2658 cfsetispeed(termios_ref, speed)
2659 POSIX::Termios termios_ref
2663 cfsetospeed(termios_ref, speed)
2664 POSIX::Termios termios_ref
2668 setiflag(termios_ref, iflag)
2669 POSIX::Termios termios_ref
2672 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2673 termios_ref->c_iflag = iflag;
2675 not_here("setiflag");
2679 setoflag(termios_ref, oflag)
2680 POSIX::Termios termios_ref
2683 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2684 termios_ref->c_oflag = oflag;
2686 not_here("setoflag");
2690 setcflag(termios_ref, cflag)
2691 POSIX::Termios termios_ref
2694 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2695 termios_ref->c_cflag = cflag;
2697 not_here("setcflag");
2701 setlflag(termios_ref, lflag)
2702 POSIX::Termios termios_ref
2705 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2706 termios_ref->c_lflag = lflag;
2708 not_here("setlflag");
2712 setcc(termios_ref, ccix, cc)
2713 POSIX::Termios termios_ref
2717 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2719 croak("Bad setcc subscript");
2720 termios_ref->c_cc[ccix] = cc;
2726 MODULE = POSIX PACKAGE = POSIX
2735 unsigned char * charstring
2737 unsigned char *s = charstring;
2738 unsigned char *e = s + na; /* "na" set by typemap side effect */
2739 for (RETVAL = 1; RETVAL && s < e; s++)
2747 unsigned char * charstring
2749 unsigned char *s = charstring;
2750 unsigned char *e = s + na; /* "na" set by typemap side effect */
2751 for (RETVAL = 1; RETVAL && s < e; s++)
2759 unsigned char * charstring
2761 unsigned char *s = charstring;
2762 unsigned char *e = s + na; /* "na" set by typemap side effect */
2763 for (RETVAL = 1; RETVAL && s < e; s++)
2771 unsigned char * charstring
2773 unsigned char *s = charstring;
2774 unsigned char *e = s + na; /* "na" set by typemap side effect */
2775 for (RETVAL = 1; RETVAL && s < e; s++)
2783 unsigned char * charstring
2785 unsigned char *s = charstring;
2786 unsigned char *e = s + na; /* "na" set by typemap side effect */
2787 for (RETVAL = 1; RETVAL && s < e; s++)
2795 unsigned char * charstring
2797 unsigned char *s = charstring;
2798 unsigned char *e = s + na; /* "na" set by typemap side effect */
2799 for (RETVAL = 1; RETVAL && s < e; s++)
2807 unsigned char * charstring
2809 unsigned char *s = charstring;
2810 unsigned char *e = s + na; /* "na" set by typemap side effect */
2811 for (RETVAL = 1; RETVAL && s < e; s++)
2819 unsigned char * charstring
2821 unsigned char *s = charstring;
2822 unsigned char *e = s + na; /* "na" set by typemap side effect */
2823 for (RETVAL = 1; RETVAL && s < e; s++)
2831 unsigned char * charstring
2833 unsigned char *s = charstring;
2834 unsigned char *e = s + na; /* "na" set by typemap side effect */
2835 for (RETVAL = 1; RETVAL && s < e; s++)
2843 unsigned char * charstring
2845 unsigned char *s = charstring;
2846 unsigned char *e = s + na; /* "na" set by typemap side effect */
2847 for (RETVAL = 1; RETVAL && s < e; s++)
2854 isxdigit(charstring)
2855 unsigned char * charstring
2857 unsigned char *s = charstring;
2858 unsigned char *e = s + na; /* "na" set by typemap side effect */
2859 for (RETVAL = 1; RETVAL && s < e; s++)
2866 open(filename, flags = O_RDONLY, mode = 0666)
2871 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2872 TAINT_PROPER("open");
2873 RETVAL = open(filename, flags, mode);
2881 #ifdef HAS_LOCALECONV
2882 struct lconv *lcbuf;
2884 SET_NUMERIC_LOCAL();
2885 if (lcbuf = localeconv()) {
2887 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2888 hv_store(RETVAL, "decimal_point", 13,
2889 newSVpv(lcbuf->decimal_point, 0), 0);
2890 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2891 hv_store(RETVAL, "thousands_sep", 13,
2892 newSVpv(lcbuf->thousands_sep, 0), 0);
2893 if (lcbuf->grouping && *lcbuf->grouping)
2894 hv_store(RETVAL, "grouping", 8,
2895 newSVpv(lcbuf->grouping, 0), 0);
2896 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2897 hv_store(RETVAL, "int_curr_symbol", 15,
2898 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2899 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2900 hv_store(RETVAL, "currency_symbol", 15,
2901 newSVpv(lcbuf->currency_symbol, 0), 0);
2902 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2903 hv_store(RETVAL, "mon_decimal_point", 17,
2904 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2905 #ifndef NO_LOCALECONV_MON_THOUSANDS_SEP
2906 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2907 hv_store(RETVAL, "mon_thousands_sep", 17,
2908 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2910 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2911 hv_store(RETVAL, "mon_grouping", 12,
2912 newSVpv(lcbuf->mon_grouping, 0), 0);
2913 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2914 hv_store(RETVAL, "positive_sign", 13,
2915 newSVpv(lcbuf->positive_sign, 0), 0);
2916 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2917 hv_store(RETVAL, "negative_sign", 13,
2918 newSVpv(lcbuf->negative_sign, 0), 0);
2920 if (lcbuf->int_frac_digits != CHAR_MAX)
2921 hv_store(RETVAL, "int_frac_digits", 15,
2922 newSViv(lcbuf->int_frac_digits), 0);
2923 if (lcbuf->frac_digits != CHAR_MAX)
2924 hv_store(RETVAL, "frac_digits", 11,
2925 newSViv(lcbuf->frac_digits), 0);
2926 if (lcbuf->p_cs_precedes != CHAR_MAX)
2927 hv_store(RETVAL, "p_cs_precedes", 13,
2928 newSViv(lcbuf->p_cs_precedes), 0);
2929 if (lcbuf->p_sep_by_space != CHAR_MAX)
2930 hv_store(RETVAL, "p_sep_by_space", 14,
2931 newSViv(lcbuf->p_sep_by_space), 0);
2932 if (lcbuf->n_cs_precedes != CHAR_MAX)
2933 hv_store(RETVAL, "n_cs_precedes", 13,
2934 newSViv(lcbuf->n_cs_precedes), 0);
2935 if (lcbuf->n_sep_by_space != CHAR_MAX)
2936 hv_store(RETVAL, "n_sep_by_space", 14,
2937 newSViv(lcbuf->n_sep_by_space), 0);
2938 if (lcbuf->p_sign_posn != CHAR_MAX)
2939 hv_store(RETVAL, "p_sign_posn", 11,
2940 newSViv(lcbuf->p_sign_posn), 0);
2941 if (lcbuf->n_sign_posn != CHAR_MAX)
2942 hv_store(RETVAL, "n_sign_posn", 11,
2943 newSViv(lcbuf->n_sign_posn), 0);
2946 localeconv(); /* A stub to call not_here(). */
2952 setlocale(category, locale = 0)
2956 RETVAL = setlocale(category, locale);
2958 #ifdef USE_LOCALE_CTYPE
2959 if (category == LC_CTYPE
2961 || category == LC_ALL
2967 if (category == LC_ALL)
2968 newctype = setlocale(LC_CTYPE, NULL);
2972 perl_new_ctype(newctype);
2974 #endif /* USE_LOCALE_CTYPE */
2975 #ifdef USE_LOCALE_COLLATE
2976 if (category == LC_COLLATE
2978 || category == LC_ALL
2984 if (category == LC_ALL)
2985 newcoll = setlocale(LC_COLLATE, NULL);
2989 perl_new_collate(newcoll);
2991 #endif /* USE_LOCALE_COLLATE */
2992 #ifdef USE_LOCALE_NUMERIC
2993 if (category == LC_NUMERIC
2995 || category == LC_ALL
3001 if (category == LC_ALL)
3002 newnum = setlocale(LC_NUMERIC, NULL);
3006 perl_new_numeric(newnum);
3008 #endif /* USE_LOCALE_NUMERIC */
3048 /* (We already know stack is long enough.) */
3049 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3050 PUSHs(sv_2mortal(newSViv(expvar)));
3066 /* (We already know stack is long enough.) */
3067 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3068 PUSHs(sv_2mortal(newSVnv(intvar)));
3083 sigaction(sig, action, oldaction = 0)
3085 POSIX::SigAction action
3086 POSIX::SigAction oldaction
3089 # This code is really grody because we're trying to make the signal
3090 # interface look beautiful, which is hard.
3093 gv_fetchpv("SIG", TRUE, SVt_PVHV);
3096 struct sigaction act;
3097 struct sigaction oact;
3098 POSIX__SigSet sigset;
3100 SV** sigsvp = hv_fetch(GvHVn(siggv),
3102 strlen(sig_name[sig]),
3105 /* Remember old handler name if desired. */
3107 char *hand = SvPVx(*sigsvp, na);
3108 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
3109 sv_setpv(*svp, *hand ? hand : "DEFAULT");
3113 /* Vector new handler through %SIG. (We always use sighandler
3114 for the C signal handler, which reads %SIG to dispatch.) */
3115 svp = hv_fetch(action, "HANDLER", 7, FALSE);
3117 croak("Can't supply an action without a HANDLER");
3118 sv_setpv(*sigsvp, SvPV(*svp, na));
3119 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
3120 act.sa_handler = sighandler;
3122 /* Set up any desired mask. */
3123 svp = hv_fetch(action, "MASK", 4, FALSE);
3124 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
3126 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3127 sigset = (sigset_t*) tmp;
3128 act.sa_mask = *sigset;
3131 sigemptyset(& act.sa_mask);
3133 /* Set up any desired flags. */
3134 svp = hv_fetch(action, "FLAGS", 5, FALSE);
3135 act.sa_flags = svp ? SvIV(*svp) : 0;
3138 /* Now work around sigaction oddities */
3139 if (action && oldaction)
3140 RETVAL = sigaction(sig, & act, & oact);
3142 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3144 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3149 /* Get back the mask. */
3150 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
3151 if (sv_isa(*svp, "POSIX::SigSet")) {
3153 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3154 sigset = (sigset_t*) tmp;
3157 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
3158 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
3160 *sigset = oact.sa_mask;
3162 /* Get back the flags. */
3163 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
3164 sv_setiv(*svp, oact.sa_flags);
3172 POSIX::SigSet sigset
3175 sigprocmask(how, sigset, oldsigset = 0)
3177 POSIX::SigSet sigset
3178 POSIX::SigSet oldsigset
3181 sigsuspend(signal_mask)
3182 POSIX::SigSet signal_mask
3202 lseek(fd, offset, whence)
3215 if (pipe(fds) != -1) {
3217 PUSHs(sv_2mortal(newSViv(fds[0])));
3218 PUSHs(sv_2mortal(newSViv(fds[1])));
3222 read(fd, buffer, nbytes)
3224 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3228 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3231 SvCUR(sv_buffer) = RETVAL;
3232 SvPOK_only(sv_buffer);
3233 *SvEND(sv_buffer) = '\0';
3234 SvTAINTED_on(sv_buffer);
3250 tcsetpgrp(fd, pgrp_id)
3259 if (uname(&buf) >= 0) {
3261 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3262 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3263 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3264 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3265 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3268 uname((char *) 0); /* A stub to call not_here(). */
3272 write(fd, buffer, nbytes)
3290 mbstowcs(s, pwcs, n)
3302 wcstombs(s, pwcs, n)
3324 SET_NUMERIC_LOCAL();
3325 num = strtod(str, &unparsed);
3326 PUSHs(sv_2mortal(newSVnv(num)));
3327 if (GIMME == G_ARRAY) {
3330 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3336 strtol(str, base = 0)
3343 num = strtol(str, &unparsed, base);
3344 if (num >= IV_MIN && num <= IV_MAX)
3345 PUSHs(sv_2mortal(newSViv((IV)num)));
3347 PUSHs(sv_2mortal(newSVnv((double)num)));
3348 if (GIMME == G_ARRAY) {
3351 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3357 strtoul(str, base = 0)
3364 num = strtoul(str, &unparsed, base);
3366 PUSHs(sv_2mortal(newSViv((IV)num)));
3368 PUSHs(sv_2mortal(newSVnv((double)num)));
3369 if (GIMME == G_ARRAY) {
3372 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3384 char *p = SvPV(src,srclen);
3386 ST(0) = sv_2mortal(NEWSV(800,srclen));
3387 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3388 if (dstlen > srclen) {
3390 SvGROW(ST(0), dstlen);
3391 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3394 SvCUR(ST(0)) = dstlen;
3399 mkfifo(filename, mode)
3403 TAINT_PROPER("mkfifo");
3404 RETVAL = mkfifo(filename, mode);
3420 tcflush(fd, queue_selector)
3425 tcsendbreak(fd, duration)
3430 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3443 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3446 mytm.tm_hour = hour;
3447 mytm.tm_mday = mday;
3449 mytm.tm_year = year;
3450 mytm.tm_wday = wday;
3451 mytm.tm_yday = yday;
3452 mytm.tm_isdst = isdst;
3453 RETVAL = asctime(&mytm);
3470 realtime = times( &tms );
3472 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
3473 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
3474 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
3475 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) );
3476 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) );
3479 difftime(time1, time2)
3484 mktime(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 = mktime(&mytm);
3513 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3529 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3532 mytm.tm_hour = hour;
3533 mytm.tm_mday = mday;
3535 mytm.tm_year = year;
3536 mytm.tm_wday = wday;
3537 mytm.tm_yday = yday;
3538 mytm.tm_isdst = isdst;
3539 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3540 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3550 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3551 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3554 access(filename, mode)
3572 pathconf(filename, name)