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 #ifdef HAS_LONG_DOUBLE
272 # if LONG_DOUBLESIZE > DOUBLESIZE
273 # undef HAS_LONG_DOUBLE /* XXX until we figure out how to use them */
277 #ifndef HAS_LONG_DOUBLE
292 croak("POSIX::%s not implemented on this architecture", s);
297 #ifdef HAS_LONG_DOUBLE
302 constant(char *name, int arg)
307 if (strEQ(name, "ARG_MAX"))
315 if (strEQ(name, "BUFSIZ"))
321 if (strEQ(name, "BRKINT"))
327 if (strEQ(name, "B9600"))
333 if (strEQ(name, "B19200"))
339 if (strEQ(name, "B38400"))
345 if (strEQ(name, "B0"))
351 if (strEQ(name, "B110"))
357 if (strEQ(name, "B1200"))
363 if (strEQ(name, "B134"))
369 if (strEQ(name, "B150"))
375 if (strEQ(name, "B1800"))
381 if (strEQ(name, "B200"))
387 if (strEQ(name, "B2400"))
393 if (strEQ(name, "B300"))
399 if (strEQ(name, "B4800"))
405 if (strEQ(name, "B50"))
411 if (strEQ(name, "B600"))
417 if (strEQ(name, "B75"))
425 if (strEQ(name, "CHAR_BIT"))
431 if (strEQ(name, "CHAR_MAX"))
437 if (strEQ(name, "CHAR_MIN"))
443 if (strEQ(name, "CHILD_MAX"))
449 if (strEQ(name, "CLK_TCK"))
455 if (strEQ(name, "CLOCAL"))
461 if (strEQ(name, "CLOCKS_PER_SEC"))
462 #ifdef CLOCKS_PER_SEC
463 return CLOCKS_PER_SEC;
467 if (strEQ(name, "CREAD"))
473 if (strEQ(name, "CS5"))
479 if (strEQ(name, "CS6"))
485 if (strEQ(name, "CS7"))
491 if (strEQ(name, "CS8"))
497 if (strEQ(name, "CSIZE"))
503 if (strEQ(name, "CSTOPB"))
511 if (strEQ(name, "DBL_MAX"))
517 if (strEQ(name, "DBL_MIN"))
523 if (strEQ(name, "DBL_DIG"))
529 if (strEQ(name, "DBL_EPSILON"))
535 if (strEQ(name, "DBL_MANT_DIG"))
541 if (strEQ(name, "DBL_MAX_10_EXP"))
542 #ifdef DBL_MAX_10_EXP
543 return DBL_MAX_10_EXP;
547 if (strEQ(name, "DBL_MAX_EXP"))
553 if (strEQ(name, "DBL_MIN_10_EXP"))
554 #ifdef DBL_MIN_10_EXP
555 return DBL_MIN_10_EXP;
559 if (strEQ(name, "DBL_MIN_EXP"))
569 if (strEQ(name, "EACCES"))
575 if (strEQ(name, "EADDRINUSE"))
581 if (strEQ(name, "EADDRNOTAVAIL"))
583 return EADDRNOTAVAIL;
587 if (strEQ(name, "EAFNOSUPPORT"))
593 if (strEQ(name, "EAGAIN"))
599 if (strEQ(name, "EALREADY"))
607 if (strEQ(name, "EBADF"))
613 if (strEQ(name, "EBUSY"))
621 if (strEQ(name, "ECHILD"))
627 if (strEQ(name, "ECHO"))
633 if (strEQ(name, "ECHOE"))
639 if (strEQ(name, "ECHOK"))
645 if (strEQ(name, "ECHONL"))
651 if (strEQ(name, "ECONNABORTED"))
657 if (strEQ(name, "ECONNREFUSED"))
663 if (strEQ(name, "ECONNRESET"))
671 if (strEQ(name, "EDEADLK"))
677 if (strEQ(name, "EDESTADDRREQ"))
683 if (strEQ(name, "EDOM"))
689 if (strEQ(name, "EDQUOT"))
697 if (strEQ(name, "EEXIST"))
705 if (strEQ(name, "EFAULT"))
711 if (strEQ(name, "EFBIG"))
719 if (strEQ(name, "EHOSTDOWN"))
725 if (strEQ(name, "EHOSTUNREACH"))
733 if (strEQ(name, "EINPROGRESS"))
739 if (strEQ(name, "EINTR"))
745 if (strEQ(name, "EINVAL"))
751 if (strEQ(name, "EIO"))
757 if (strEQ(name, "EISCONN"))
763 if (strEQ(name, "EISDIR"))
769 if (strEQ(name, "ELOOP"))
777 if (strEQ(name, "EMFILE"))
783 if (strEQ(name, "EMLINK"))
789 if (strEQ(name, "EMSGSIZE"))
797 if (strEQ(name, "ENETDOWN"))
803 if (strEQ(name, "ENETRESET"))
809 if (strEQ(name, "ENETUNREACH"))
815 if (strEQ(name, "ENOBUFS"))
821 if (strEQ(name, "ENOEXEC"))
827 if (strEQ(name, "ENOMEM"))
833 if (strEQ(name, "ENOPROTOOPT"))
839 if (strEQ(name, "ENOSPC"))
845 if (strEQ(name, "ENOTBLK"))
851 if (strEQ(name, "ENOTCONN"))
857 if (strEQ(name, "ENOTDIR"))
863 if (strEQ(name, "ENOTEMPTY"))
869 if (strEQ(name, "ENOTSOCK"))
875 if (strEQ(name, "ENOTTY"))
881 if (strEQ(name, "ENFILE"))
887 if (strEQ(name, "ENODEV"))
893 if (strEQ(name, "ENOENT"))
899 if (strEQ(name, "ENOLCK"))
905 if (strEQ(name, "ENOSYS"))
911 if (strEQ(name, "ENXIO"))
917 if (strEQ(name, "ENAMETOOLONG"))
925 if (strEQ(name, "EOF"))
931 if (strEQ(name, "EOPNOTSUPP"))
939 if (strEQ(name, "EPERM"))
945 if (strEQ(name, "EPFNOSUPPORT"))
951 if (strEQ(name, "EPIPE"))
957 if (strEQ(name, "EPROCLIM"))
963 if (strEQ(name, "EPROTONOSUPPORT"))
964 #ifdef EPROTONOSUPPORT
965 return EPROTONOSUPPORT;
969 if (strEQ(name, "EPROTOTYPE"))
977 if (strEQ(name, "ERANGE"))
983 if (strEQ(name, "EREMOTE"))
989 if (strEQ(name, "ERESTART"))
995 if (strEQ(name, "EROFS"))
1003 if (strEQ(name, "ESHUTDOWN"))
1009 if (strEQ(name, "ESOCKTNOSUPPORT"))
1010 #ifdef ESOCKTNOSUPPORT
1011 return ESOCKTNOSUPPORT;
1015 if (strEQ(name, "ESPIPE"))
1021 if (strEQ(name, "ESRCH"))
1027 if (strEQ(name, "ESTALE"))
1035 if (strEQ(name, "ETIMEDOUT"))
1041 if (strEQ(name, "ETOOMANYREFS"))
1043 return ETOOMANYREFS;
1047 if (strEQ(name, "ETXTBSY"))
1055 if (strEQ(name, "EUSERS"))
1063 if (strEQ(name, "EWOULDBLOCK"))
1071 if (strEQ(name, "EXIT_FAILURE"))
1073 return EXIT_FAILURE;
1077 if (strEQ(name, "EXIT_SUCCESS"))
1079 return EXIT_SUCCESS;
1083 if (strEQ(name, "EXDEV"))
1091 if (strEQ(name, "E2BIG"))
1099 if (strnEQ(name, "FLT_", 4)) {
1100 if (strEQ(name, "FLT_MAX"))
1106 if (strEQ(name, "FLT_MIN"))
1112 if (strEQ(name, "FLT_ROUNDS"))
1118 if (strEQ(name, "FLT_DIG"))
1124 if (strEQ(name, "FLT_EPSILON"))
1130 if (strEQ(name, "FLT_MANT_DIG"))
1132 return FLT_MANT_DIG;
1136 if (strEQ(name, "FLT_MAX_10_EXP"))
1137 #ifdef FLT_MAX_10_EXP
1138 return FLT_MAX_10_EXP;
1142 if (strEQ(name, "FLT_MAX_EXP"))
1148 if (strEQ(name, "FLT_MIN_10_EXP"))
1149 #ifdef FLT_MIN_10_EXP
1150 return FLT_MIN_10_EXP;
1154 if (strEQ(name, "FLT_MIN_EXP"))
1160 if (strEQ(name, "FLT_RADIX"))
1168 if (strnEQ(name, "F_", 2)) {
1169 if (strEQ(name, "F_DUPFD"))
1175 if (strEQ(name, "F_GETFD"))
1181 if (strEQ(name, "F_GETFL"))
1187 if (strEQ(name, "F_GETLK"))
1193 if (strEQ(name, "F_OK"))
1199 if (strEQ(name, "F_RDLCK"))
1205 if (strEQ(name, "F_SETFD"))
1211 if (strEQ(name, "F_SETFL"))
1217 if (strEQ(name, "F_SETLK"))
1223 if (strEQ(name, "F_SETLKW"))
1229 if (strEQ(name, "F_UNLCK"))
1235 if (strEQ(name, "F_WRLCK"))
1243 if (strEQ(name, "FD_CLOEXEC"))
1249 if (strEQ(name, "FILENAME_MAX"))
1251 return FILENAME_MAX;
1257 if (strEQ(name, "HUGE_VAL"))
1263 if (strEQ(name, "HUPCL"))
1271 if (strEQ(name, "INT_MAX"))
1277 if (strEQ(name, "INT_MIN"))
1283 if (strEQ(name, "ICANON"))
1289 if (strEQ(name, "ICRNL"))
1295 if (strEQ(name, "IEXTEN"))
1301 if (strEQ(name, "IGNBRK"))
1307 if (strEQ(name, "IGNCR"))
1313 if (strEQ(name, "IGNPAR"))
1319 if (strEQ(name, "INLCR"))
1325 if (strEQ(name, "INPCK"))
1331 if (strEQ(name, "ISIG"))
1337 if (strEQ(name, "ISTRIP"))
1343 if (strEQ(name, "IXOFF"))
1349 if (strEQ(name, "IXON"))
1357 if (strnEQ(name, "LC_", 3)) {
1358 if (strEQ(name, "LC_ALL"))
1364 if (strEQ(name, "LC_COLLATE"))
1370 if (strEQ(name, "LC_CTYPE"))
1376 if (strEQ(name, "LC_MONETARY"))
1382 if (strEQ(name, "LC_NUMERIC"))
1388 if (strEQ(name, "LC_TIME"))
1396 if (strnEQ(name, "LDBL_", 5)) {
1397 if (strEQ(name, "LDBL_MAX"))
1403 if (strEQ(name, "LDBL_MIN"))
1409 if (strEQ(name, "LDBL_DIG"))
1415 if (strEQ(name, "LDBL_EPSILON"))
1417 return LDBL_EPSILON;
1421 if (strEQ(name, "LDBL_MANT_DIG"))
1422 #ifdef LDBL_MANT_DIG
1423 return LDBL_MANT_DIG;
1427 if (strEQ(name, "LDBL_MAX_10_EXP"))
1428 #ifdef LDBL_MAX_10_EXP
1429 return LDBL_MAX_10_EXP;
1433 if (strEQ(name, "LDBL_MAX_EXP"))
1435 return LDBL_MAX_EXP;
1439 if (strEQ(name, "LDBL_MIN_10_EXP"))
1440 #ifdef LDBL_MIN_10_EXP
1441 return LDBL_MIN_10_EXP;
1445 if (strEQ(name, "LDBL_MIN_EXP"))
1447 return LDBL_MIN_EXP;
1453 if (strnEQ(name, "L_", 2)) {
1454 if (strEQ(name, "L_ctermid"))
1460 if (strEQ(name, "L_cuserid"))
1466 if (strEQ(name, "L_tmpname"))
1474 if (strEQ(name, "LONG_MAX"))
1480 if (strEQ(name, "LONG_MIN"))
1486 if (strEQ(name, "LINK_MAX"))
1494 if (strEQ(name, "MAX_CANON"))
1500 if (strEQ(name, "MAX_INPUT"))
1506 if (strEQ(name, "MB_CUR_MAX"))
1512 if (strEQ(name, "MB_LEN_MAX"))
1520 if (strEQ(name, "NULL")) return 0;
1521 if (strEQ(name, "NAME_MAX"))
1527 if (strEQ(name, "NCCS"))
1533 if (strEQ(name, "NGROUPS_MAX"))
1539 if (strEQ(name, "NOFLSH"))
1547 if (strnEQ(name, "O_", 2)) {
1548 if (strEQ(name, "O_APPEND"))
1554 if (strEQ(name, "O_CREAT"))
1560 if (strEQ(name, "O_TRUNC"))
1566 if (strEQ(name, "O_RDONLY"))
1572 if (strEQ(name, "O_RDWR"))
1578 if (strEQ(name, "O_WRONLY"))
1584 if (strEQ(name, "O_EXCL"))
1590 if (strEQ(name, "O_NOCTTY"))
1596 if (strEQ(name, "O_NONBLOCK"))
1602 if (strEQ(name, "O_ACCMODE"))
1610 if (strEQ(name, "OPEN_MAX"))
1616 if (strEQ(name, "OPOST"))
1624 if (strEQ(name, "PATH_MAX"))
1630 if (strEQ(name, "PARENB"))
1636 if (strEQ(name, "PARMRK"))
1642 if (strEQ(name, "PARODD"))
1648 if (strEQ(name, "PIPE_BUF"))
1656 if (strEQ(name, "RAND_MAX"))
1662 if (strEQ(name, "R_OK"))
1670 if (strnEQ(name, "SIG", 3)) {
1671 if (name[3] == '_') {
1672 if (strEQ(name, "SIG_BLOCK"))
1679 if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
1682 if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
1685 if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
1687 if (strEQ(name, "SIG_SETMASK"))
1693 if (strEQ(name, "SIG_UNBLOCK"))
1701 if (strEQ(name, "SIGABRT"))
1707 if (strEQ(name, "SIGALRM"))
1713 if (strEQ(name, "SIGCHLD"))
1719 if (strEQ(name, "SIGCONT"))
1725 if (strEQ(name, "SIGFPE"))
1731 if (strEQ(name, "SIGHUP"))
1737 if (strEQ(name, "SIGILL"))
1743 if (strEQ(name, "SIGINT"))
1749 if (strEQ(name, "SIGKILL"))
1755 if (strEQ(name, "SIGPIPE"))
1761 if (strEQ(name, "SIGQUIT"))
1767 if (strEQ(name, "SIGSEGV"))
1773 if (strEQ(name, "SIGSTOP"))
1779 if (strEQ(name, "SIGTERM"))
1785 if (strEQ(name, "SIGTSTP"))
1791 if (strEQ(name, "SIGTTIN"))
1797 if (strEQ(name, "SIGTTOU"))
1803 if (strEQ(name, "SIGUSR1"))
1809 if (strEQ(name, "SIGUSR2"))
1817 if (name[1] == '_') {
1818 if (strEQ(name, "S_ISGID"))
1824 if (strEQ(name, "S_ISUID"))
1830 if (strEQ(name, "S_IRGRP"))
1836 if (strEQ(name, "S_IROTH"))
1842 if (strEQ(name, "S_IRUSR"))
1848 if (strEQ(name, "S_IRWXG"))
1854 if (strEQ(name, "S_IRWXO"))
1860 if (strEQ(name, "S_IRWXU"))
1866 if (strEQ(name, "S_IWGRP"))
1872 if (strEQ(name, "S_IWOTH"))
1878 if (strEQ(name, "S_IWUSR"))
1884 if (strEQ(name, "S_IXGRP"))
1890 if (strEQ(name, "S_IXOTH"))
1896 if (strEQ(name, "S_IXUSR"))
1902 errno = EAGAIN; /* the following aren't constants */
1904 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1907 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1910 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1913 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1916 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1920 if (strEQ(name, "SEEK_CUR"))
1926 if (strEQ(name, "SEEK_END"))
1932 if (strEQ(name, "SEEK_SET"))
1938 if (strEQ(name, "STREAM_MAX"))
1944 if (strEQ(name, "SHRT_MAX"))
1950 if (strEQ(name, "SHRT_MIN"))
1956 if (strnEQ(name, "SA_", 3)) {
1957 if (strEQ(name, "SA_NOCLDSTOP"))
1959 return SA_NOCLDSTOP;
1963 if (strEQ(name, "SA_NOCLDWAIT"))
1965 return SA_NOCLDWAIT;
1969 if (strEQ(name, "SA_NODEFER"))
1975 if (strEQ(name, "SA_ONSTACK"))
1981 if (strEQ(name, "SA_RESETHAND"))
1983 return SA_RESETHAND;
1987 if (strEQ(name, "SA_RESTART"))
1993 if (strEQ(name, "SA_SIGINFO"))
2001 if (strEQ(name, "SCHAR_MAX"))
2007 if (strEQ(name, "SCHAR_MIN"))
2013 if (strEQ(name, "SSIZE_MAX"))
2019 if (strEQ(name, "STDIN_FILENO"))
2021 return STDIN_FILENO;
2025 if (strEQ(name, "STDOUT_FILENO"))
2026 #ifdef STDOUT_FILENO
2027 return STDOUT_FILENO;
2031 if (strEQ(name, "STRERR_FILENO"))
2032 #ifdef STRERR_FILENO
2033 return STRERR_FILENO;
2039 if (strEQ(name, "TCIFLUSH"))
2045 if (strEQ(name, "TCIOFF"))
2051 if (strEQ(name, "TCIOFLUSH"))
2057 if (strEQ(name, "TCION"))
2063 if (strEQ(name, "TCOFLUSH"))
2069 if (strEQ(name, "TCOOFF"))
2075 if (strEQ(name, "TCOON"))
2081 if (strEQ(name, "TCSADRAIN"))
2087 if (strEQ(name, "TCSAFLUSH"))
2093 if (strEQ(name, "TCSANOW"))
2099 if (strEQ(name, "TMP_MAX"))
2105 if (strEQ(name, "TOSTOP"))
2111 if (strEQ(name, "TZNAME_MAX"))
2119 if (strEQ(name, "UCHAR_MAX"))
2125 if (strEQ(name, "UINT_MAX"))
2131 if (strEQ(name, "ULONG_MAX"))
2137 if (strEQ(name, "USHRT_MAX"))
2145 if (strEQ(name, "VEOF"))
2151 if (strEQ(name, "VEOL"))
2157 if (strEQ(name, "VERASE"))
2163 if (strEQ(name, "VINTR"))
2169 if (strEQ(name, "VKILL"))
2175 if (strEQ(name, "VMIN"))
2181 if (strEQ(name, "VQUIT"))
2187 if (strEQ(name, "VSTART"))
2193 if (strEQ(name, "VSTOP"))
2199 if (strEQ(name, "VSUSP"))
2205 if (strEQ(name, "VTIME"))
2213 if (strEQ(name, "W_OK"))
2219 if (strEQ(name, "WNOHANG"))
2225 if (strEQ(name, "WUNTRACED"))
2231 errno = EAGAIN; /* the following aren't constants */
2233 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2236 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2239 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2242 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2245 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2248 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2252 if (strEQ(name, "X_OK"))
2260 if (strnEQ(name, "_PC_", 4)) {
2261 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2262 #ifdef _PC_CHOWN_RESTRICTED
2263 return _PC_CHOWN_RESTRICTED;
2267 if (strEQ(name, "_PC_LINK_MAX"))
2269 return _PC_LINK_MAX;
2273 if (strEQ(name, "_PC_MAX_CANON"))
2274 #ifdef _PC_MAX_CANON
2275 return _PC_MAX_CANON;
2279 if (strEQ(name, "_PC_MAX_INPUT"))
2280 #ifdef _PC_MAX_INPUT
2281 return _PC_MAX_INPUT;
2285 if (strEQ(name, "_PC_NAME_MAX"))
2287 return _PC_NAME_MAX;
2291 if (strEQ(name, "_PC_NO_TRUNC"))
2293 return _PC_NO_TRUNC;
2297 if (strEQ(name, "_PC_PATH_MAX"))
2299 return _PC_PATH_MAX;
2303 if (strEQ(name, "_PC_PIPE_BUF"))
2305 return _PC_PIPE_BUF;
2309 if (strEQ(name, "_PC_VDISABLE"))
2311 return _PC_VDISABLE;
2317 if (strnEQ(name, "_POSIX_", 7)) {
2318 if (strEQ(name, "_POSIX_ARG_MAX"))
2319 #ifdef _POSIX_ARG_MAX
2320 return _POSIX_ARG_MAX;
2324 if (strEQ(name, "_POSIX_CHILD_MAX"))
2325 #ifdef _POSIX_CHILD_MAX
2326 return _POSIX_CHILD_MAX;
2330 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2331 #ifdef _POSIX_CHOWN_RESTRICTED
2332 return _POSIX_CHOWN_RESTRICTED;
2336 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2337 #ifdef _POSIX_JOB_CONTROL
2338 return _POSIX_JOB_CONTROL;
2342 if (strEQ(name, "_POSIX_LINK_MAX"))
2343 #ifdef _POSIX_LINK_MAX
2344 return _POSIX_LINK_MAX;
2348 if (strEQ(name, "_POSIX_MAX_CANON"))
2349 #ifdef _POSIX_MAX_CANON
2350 return _POSIX_MAX_CANON;
2354 if (strEQ(name, "_POSIX_MAX_INPUT"))
2355 #ifdef _POSIX_MAX_INPUT
2356 return _POSIX_MAX_INPUT;
2360 if (strEQ(name, "_POSIX_NAME_MAX"))
2361 #ifdef _POSIX_NAME_MAX
2362 return _POSIX_NAME_MAX;
2366 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2367 #ifdef _POSIX_NGROUPS_MAX
2368 return _POSIX_NGROUPS_MAX;
2372 if (strEQ(name, "_POSIX_NO_TRUNC"))
2373 #ifdef _POSIX_NO_TRUNC
2374 return _POSIX_NO_TRUNC;
2378 if (strEQ(name, "_POSIX_OPEN_MAX"))
2379 #ifdef _POSIX_OPEN_MAX
2380 return _POSIX_OPEN_MAX;
2384 if (strEQ(name, "_POSIX_PATH_MAX"))
2385 #ifdef _POSIX_PATH_MAX
2386 return _POSIX_PATH_MAX;
2390 if (strEQ(name, "_POSIX_PIPE_BUF"))
2391 #ifdef _POSIX_PIPE_BUF
2392 return _POSIX_PIPE_BUF;
2396 if (strEQ(name, "_POSIX_SAVED_IDS"))
2397 #ifdef _POSIX_SAVED_IDS
2398 return _POSIX_SAVED_IDS;
2402 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2403 #ifdef _POSIX_SSIZE_MAX
2404 return _POSIX_SSIZE_MAX;
2408 if (strEQ(name, "_POSIX_STREAM_MAX"))
2409 #ifdef _POSIX_STREAM_MAX
2410 return _POSIX_STREAM_MAX;
2414 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2415 #ifdef _POSIX_TZNAME_MAX
2416 return _POSIX_TZNAME_MAX;
2420 if (strEQ(name, "_POSIX_VDISABLE"))
2421 #ifdef _POSIX_VDISABLE
2422 return _POSIX_VDISABLE;
2426 if (strEQ(name, "_POSIX_VERSION"))
2427 #ifdef _POSIX_VERSION
2428 return _POSIX_VERSION;
2434 if (strnEQ(name, "_SC_", 4)) {
2435 if (strEQ(name, "_SC_ARG_MAX"))
2441 if (strEQ(name, "_SC_CHILD_MAX"))
2442 #ifdef _SC_CHILD_MAX
2443 return _SC_CHILD_MAX;
2447 if (strEQ(name, "_SC_CLK_TCK"))
2453 if (strEQ(name, "_SC_JOB_CONTROL"))
2454 #ifdef _SC_JOB_CONTROL
2455 return _SC_JOB_CONTROL;
2459 if (strEQ(name, "_SC_NGROUPS_MAX"))
2460 #ifdef _SC_NGROUPS_MAX
2461 return _SC_NGROUPS_MAX;
2465 if (strEQ(name, "_SC_OPEN_MAX"))
2467 return _SC_OPEN_MAX;
2471 if (strEQ(name, "_SC_SAVED_IDS"))
2472 #ifdef _SC_SAVED_IDS
2473 return _SC_SAVED_IDS;
2477 if (strEQ(name, "_SC_STREAM_MAX"))
2478 #ifdef _SC_STREAM_MAX
2479 return _SC_STREAM_MAX;
2483 if (strEQ(name, "_SC_TZNAME_MAX"))
2484 #ifdef _SC_TZNAME_MAX
2485 return _SC_TZNAME_MAX;
2489 if (strEQ(name, "_SC_VERSION"))
2506 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2509 new(packname = "POSIX::SigSet", ...)
2514 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2515 sigemptyset(RETVAL);
2516 for (i = 1; i < items; i++)
2517 sigaddset(RETVAL, SvIV(ST(i)));
2524 POSIX::SigSet sigset
2526 safefree((char *)sigset);
2529 sigaddset(sigset, sig)
2530 POSIX::SigSet sigset
2534 sigdelset(sigset, sig)
2535 POSIX::SigSet sigset
2540 POSIX::SigSet sigset
2544 POSIX::SigSet sigset
2547 sigismember(sigset, sig)
2548 POSIX::SigSet sigset
2552 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2555 new(packname = "POSIX::Termios", ...)
2560 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2562 not_here("termios");
2570 DESTROY(termios_ref)
2571 POSIX::Termios termios_ref
2574 safefree((char *)termios_ref);
2576 not_here("termios");
2580 getattr(termios_ref, fd = 0)
2581 POSIX::Termios termios_ref
2584 RETVAL = tcgetattr(fd, termios_ref);
2589 setattr(termios_ref, fd = 0, optional_actions = 0)
2590 POSIX::Termios termios_ref
2592 int optional_actions
2594 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2599 cfgetispeed(termios_ref)
2600 POSIX::Termios termios_ref
2603 cfgetospeed(termios_ref)
2604 POSIX::Termios termios_ref
2607 getiflag(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_iflag;
2613 not_here("getiflag");
2620 getoflag(termios_ref)
2621 POSIX::Termios termios_ref
2623 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2624 RETVAL = termios_ref->c_oflag;
2626 not_here("getoflag");
2633 getcflag(termios_ref)
2634 POSIX::Termios termios_ref
2636 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2637 RETVAL = termios_ref->c_cflag;
2639 not_here("getcflag");
2646 getlflag(termios_ref)
2647 POSIX::Termios termios_ref
2649 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2650 RETVAL = termios_ref->c_lflag;
2652 not_here("getlflag");
2659 getcc(termios_ref, ccix)
2660 POSIX::Termios termios_ref
2663 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2665 croak("Bad getcc subscript");
2666 RETVAL = termios_ref->c_cc[ccix];
2675 cfsetispeed(termios_ref, speed)
2676 POSIX::Termios termios_ref
2680 cfsetospeed(termios_ref, speed)
2681 POSIX::Termios termios_ref
2685 setiflag(termios_ref, iflag)
2686 POSIX::Termios termios_ref
2689 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2690 termios_ref->c_iflag = iflag;
2692 not_here("setiflag");
2696 setoflag(termios_ref, oflag)
2697 POSIX::Termios termios_ref
2700 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2701 termios_ref->c_oflag = oflag;
2703 not_here("setoflag");
2707 setcflag(termios_ref, cflag)
2708 POSIX::Termios termios_ref
2711 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2712 termios_ref->c_cflag = cflag;
2714 not_here("setcflag");
2718 setlflag(termios_ref, lflag)
2719 POSIX::Termios termios_ref
2722 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2723 termios_ref->c_lflag = lflag;
2725 not_here("setlflag");
2729 setcc(termios_ref, ccix, cc)
2730 POSIX::Termios termios_ref
2734 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2736 croak("Bad setcc subscript");
2737 termios_ref->c_cc[ccix] = cc;
2743 MODULE = POSIX PACKAGE = POSIX
2752 unsigned char * charstring
2754 unsigned char *s = charstring;
2755 unsigned char *e = s + na; /* "na" set by typemap side effect */
2756 for (RETVAL = 1; RETVAL && s < e; s++)
2764 unsigned char * charstring
2766 unsigned char *s = charstring;
2767 unsigned char *e = s + na; /* "na" set by typemap side effect */
2768 for (RETVAL = 1; RETVAL && s < e; s++)
2776 unsigned char * charstring
2778 unsigned char *s = charstring;
2779 unsigned char *e = s + na; /* "na" set by typemap side effect */
2780 for (RETVAL = 1; RETVAL && s < e; s++)
2788 unsigned char * charstring
2790 unsigned char *s = charstring;
2791 unsigned char *e = s + na; /* "na" set by typemap side effect */
2792 for (RETVAL = 1; RETVAL && s < e; s++)
2800 unsigned char * charstring
2802 unsigned char *s = charstring;
2803 unsigned char *e = s + na; /* "na" set by typemap side effect */
2804 for (RETVAL = 1; RETVAL && s < e; s++)
2812 unsigned char * charstring
2814 unsigned char *s = charstring;
2815 unsigned char *e = s + na; /* "na" set by typemap side effect */
2816 for (RETVAL = 1; RETVAL && s < e; s++)
2824 unsigned char * charstring
2826 unsigned char *s = charstring;
2827 unsigned char *e = s + na; /* "na" set by typemap side effect */
2828 for (RETVAL = 1; RETVAL && s < e; s++)
2836 unsigned char * charstring
2838 unsigned char *s = charstring;
2839 unsigned char *e = s + na; /* "na" set by typemap side effect */
2840 for (RETVAL = 1; RETVAL && s < e; s++)
2848 unsigned char * charstring
2850 unsigned char *s = charstring;
2851 unsigned char *e = s + na; /* "na" set by typemap side effect */
2852 for (RETVAL = 1; RETVAL && s < e; s++)
2860 unsigned char * charstring
2862 unsigned char *s = charstring;
2863 unsigned char *e = s + na; /* "na" set by typemap side effect */
2864 for (RETVAL = 1; RETVAL && s < e; s++)
2871 isxdigit(charstring)
2872 unsigned char * charstring
2874 unsigned char *s = charstring;
2875 unsigned char *e = s + na; /* "na" set by typemap side effect */
2876 for (RETVAL = 1; RETVAL && s < e; s++)
2883 open(filename, flags = O_RDONLY, mode = 0666)
2888 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2889 TAINT_PROPER("open");
2890 RETVAL = open(filename, flags, mode);
2898 #ifdef HAS_LOCALECONV
2899 struct lconv *lcbuf;
2901 SET_NUMERIC_LOCAL();
2902 if (lcbuf = localeconv()) {
2904 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2905 hv_store(RETVAL, "decimal_point", 13,
2906 newSVpv(lcbuf->decimal_point, 0), 0);
2907 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2908 hv_store(RETVAL, "thousands_sep", 13,
2909 newSVpv(lcbuf->thousands_sep, 0), 0);
2910 if (lcbuf->grouping && *lcbuf->grouping)
2911 hv_store(RETVAL, "grouping", 8,
2912 newSVpv(lcbuf->grouping, 0), 0);
2913 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2914 hv_store(RETVAL, "int_curr_symbol", 15,
2915 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2916 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2917 hv_store(RETVAL, "currency_symbol", 15,
2918 newSVpv(lcbuf->currency_symbol, 0), 0);
2919 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2920 hv_store(RETVAL, "mon_decimal_point", 17,
2921 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2922 #ifndef NO_LOCALECONV_MON_THOUSANDS_SEP
2923 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2924 hv_store(RETVAL, "mon_thousands_sep", 17,
2925 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2927 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2928 hv_store(RETVAL, "mon_grouping", 12,
2929 newSVpv(lcbuf->mon_grouping, 0), 0);
2930 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2931 hv_store(RETVAL, "positive_sign", 13,
2932 newSVpv(lcbuf->positive_sign, 0), 0);
2933 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2934 hv_store(RETVAL, "negative_sign", 13,
2935 newSVpv(lcbuf->negative_sign, 0), 0);
2937 if (lcbuf->int_frac_digits != CHAR_MAX)
2938 hv_store(RETVAL, "int_frac_digits", 15,
2939 newSViv(lcbuf->int_frac_digits), 0);
2940 if (lcbuf->frac_digits != CHAR_MAX)
2941 hv_store(RETVAL, "frac_digits", 11,
2942 newSViv(lcbuf->frac_digits), 0);
2943 if (lcbuf->p_cs_precedes != CHAR_MAX)
2944 hv_store(RETVAL, "p_cs_precedes", 13,
2945 newSViv(lcbuf->p_cs_precedes), 0);
2946 if (lcbuf->p_sep_by_space != CHAR_MAX)
2947 hv_store(RETVAL, "p_sep_by_space", 14,
2948 newSViv(lcbuf->p_sep_by_space), 0);
2949 if (lcbuf->n_cs_precedes != CHAR_MAX)
2950 hv_store(RETVAL, "n_cs_precedes", 13,
2951 newSViv(lcbuf->n_cs_precedes), 0);
2952 if (lcbuf->n_sep_by_space != CHAR_MAX)
2953 hv_store(RETVAL, "n_sep_by_space", 14,
2954 newSViv(lcbuf->n_sep_by_space), 0);
2955 if (lcbuf->p_sign_posn != CHAR_MAX)
2956 hv_store(RETVAL, "p_sign_posn", 11,
2957 newSViv(lcbuf->p_sign_posn), 0);
2958 if (lcbuf->n_sign_posn != CHAR_MAX)
2959 hv_store(RETVAL, "n_sign_posn", 11,
2960 newSViv(lcbuf->n_sign_posn), 0);
2963 localeconv(); /* A stub to call not_here(). */
2969 setlocale(category, locale = 0)
2973 RETVAL = setlocale(category, locale);
2975 #ifdef USE_LOCALE_CTYPE
2976 if (category == LC_CTYPE
2978 || category == LC_ALL
2984 if (category == LC_ALL)
2985 newctype = setlocale(LC_CTYPE, NULL);
2989 perl_new_ctype(newctype);
2991 #endif /* USE_LOCALE_CTYPE */
2992 #ifdef USE_LOCALE_COLLATE
2993 if (category == LC_COLLATE
2995 || category == LC_ALL
3001 if (category == LC_ALL)
3002 newcoll = setlocale(LC_COLLATE, NULL);
3006 perl_new_collate(newcoll);
3008 #endif /* USE_LOCALE_COLLATE */
3009 #ifdef USE_LOCALE_NUMERIC
3010 if (category == LC_NUMERIC
3012 || category == LC_ALL
3018 if (category == LC_ALL)
3019 newnum = setlocale(LC_NUMERIC, NULL);
3023 perl_new_numeric(newnum);
3025 #endif /* USE_LOCALE_NUMERIC */
3065 /* (We already know stack is long enough.) */
3066 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3067 PUSHs(sv_2mortal(newSViv(expvar)));
3083 /* (We already know stack is long enough.) */
3084 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3085 PUSHs(sv_2mortal(newSVnv(intvar)));
3100 sigaction(sig, action, oldaction = 0)
3102 POSIX::SigAction action
3103 POSIX::SigAction oldaction
3106 # This code is really grody because we're trying to make the signal
3107 # interface look beautiful, which is hard.
3110 gv_fetchpv("SIG", TRUE, SVt_PVHV);
3113 struct sigaction act;
3114 struct sigaction oact;
3115 POSIX__SigSet sigset;
3117 SV** sigsvp = hv_fetch(GvHVn(siggv),
3119 strlen(sig_name[sig]),
3122 /* Remember old handler name if desired. */
3124 char *hand = SvPVx(*sigsvp, na);
3125 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
3126 sv_setpv(*svp, *hand ? hand : "DEFAULT");
3130 /* Vector new handler through %SIG. (We always use sighandler
3131 for the C signal handler, which reads %SIG to dispatch.) */
3132 svp = hv_fetch(action, "HANDLER", 7, FALSE);
3134 croak("Can't supply an action without a HANDLER");
3135 sv_setpv(*sigsvp, SvPV(*svp, na));
3136 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
3137 act.sa_handler = sighandler;
3139 /* Set up any desired mask. */
3140 svp = hv_fetch(action, "MASK", 4, FALSE);
3141 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
3143 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3144 sigset = (sigset_t*) tmp;
3145 act.sa_mask = *sigset;
3148 sigemptyset(& act.sa_mask);
3150 /* Set up any desired flags. */
3151 svp = hv_fetch(action, "FLAGS", 5, FALSE);
3152 act.sa_flags = svp ? SvIV(*svp) : 0;
3155 /* Now work around sigaction oddities */
3156 if (action && oldaction)
3157 RETVAL = sigaction(sig, & act, & oact);
3159 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3161 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3166 /* Get back the mask. */
3167 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
3168 if (sv_isa(*svp, "POSIX::SigSet")) {
3170 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3171 sigset = (sigset_t*) tmp;
3174 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
3175 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
3177 *sigset = oact.sa_mask;
3179 /* Get back the flags. */
3180 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
3181 sv_setiv(*svp, oact.sa_flags);
3189 POSIX::SigSet sigset
3192 sigprocmask(how, sigset, oldsigset = 0)
3194 POSIX::SigSet sigset
3195 POSIX::SigSet oldsigset
3198 sigsuspend(signal_mask)
3199 POSIX::SigSet signal_mask
3219 lseek(fd, offset, whence)
3232 if (pipe(fds) != -1) {
3234 PUSHs(sv_2mortal(newSViv(fds[0])));
3235 PUSHs(sv_2mortal(newSViv(fds[1])));
3239 read(fd, buffer, nbytes)
3241 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3245 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3248 SvCUR(sv_buffer) = RETVAL;
3249 SvPOK_only(sv_buffer);
3250 *SvEND(sv_buffer) = '\0';
3251 SvTAINTED_on(sv_buffer);
3267 tcsetpgrp(fd, pgrp_id)
3276 if (uname(&buf) >= 0) {
3278 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3279 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3280 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3281 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3282 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3285 uname((char *) 0); /* A stub to call not_here(). */
3289 write(fd, buffer, nbytes)
3307 mbstowcs(s, pwcs, n)
3319 wcstombs(s, pwcs, n)
3341 SET_NUMERIC_LOCAL();
3342 num = strtod(str, &unparsed);
3343 PUSHs(sv_2mortal(newSVnv(num)));
3344 if (GIMME == G_ARRAY) {
3347 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3353 strtol(str, base = 0)
3360 num = strtol(str, &unparsed, base);
3361 if (num >= IV_MIN && num <= IV_MAX)
3362 PUSHs(sv_2mortal(newSViv((IV)num)));
3364 PUSHs(sv_2mortal(newSVnv((double)num)));
3365 if (GIMME == G_ARRAY) {
3368 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3374 strtoul(str, base = 0)
3381 num = strtoul(str, &unparsed, base);
3383 PUSHs(sv_2mortal(newSViv((IV)num)));
3385 PUSHs(sv_2mortal(newSVnv((double)num)));
3386 if (GIMME == G_ARRAY) {
3389 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3401 char *p = SvPV(src,srclen);
3403 ST(0) = sv_2mortal(NEWSV(800,srclen));
3404 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3405 if (dstlen > srclen) {
3407 SvGROW(ST(0), dstlen);
3408 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3411 SvCUR(ST(0)) = dstlen;
3416 mkfifo(filename, mode)
3420 TAINT_PROPER("mkfifo");
3421 RETVAL = mkfifo(filename, mode);
3437 tcflush(fd, queue_selector)
3442 tcsendbreak(fd, duration)
3447 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3460 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3463 mytm.tm_hour = hour;
3464 mytm.tm_mday = mday;
3466 mytm.tm_year = year;
3467 mytm.tm_wday = wday;
3468 mytm.tm_yday = yday;
3469 mytm.tm_isdst = isdst;
3470 RETVAL = asctime(&mytm);
3487 realtime = times( &tms );
3489 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
3490 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
3491 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
3492 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) );
3493 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) );
3496 difftime(time1, time2)
3501 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3514 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3517 mytm.tm_hour = hour;
3518 mytm.tm_mday = mday;
3520 mytm.tm_year = year;
3521 mytm.tm_wday = wday;
3522 mytm.tm_yday = yday;
3523 mytm.tm_isdst = isdst;
3524 RETVAL = mktime(&mytm);
3530 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3546 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3549 mytm.tm_hour = hour;
3550 mytm.tm_mday = mday;
3552 mytm.tm_year = year;
3553 mytm.tm_wday = wday;
3554 mytm.tm_yday = yday;
3555 mytm.tm_isdst = isdst;
3556 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3557 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3567 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3568 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3571 access(filename, mode)
3589 pathconf(filename, name)