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>
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
59 /* The default VMS emulation of Unix signals isn't very POSIXish */
61 # define sigpending(a) (not_here("sigpending"),0)
63 /* sigset_t is atomic under VMS, so these routines are easy */
64 int sigemptyset(sigset_t *set) {
65 if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
68 int sigfillset(sigset_t *set) {
70 if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
71 for (i = 0; i < NSIG; i++) *set |= (1 << i);
74 int sigaddset(sigset_t *set, int sig) {
75 if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
76 if (sig > NSIG) { SETERRNO(EINVAL,LIB$_INVARG); return -1; }
77 *set |= (1 << (sig - 1));
80 int sigdelset(sigset_t *set, int sig) {
81 if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
82 if (sig > NSIG) { SETERRNO(EINVAL,LIB$_INVARG); return -1; }
83 *set &= ~(1 << (sig - 1));
86 int sigismember(sigset_t *set, int sig) {
87 if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
88 if (sig > NSIG) { SETERRNO(EINVAL,LIB$_INVARG); return -1; }
89 *set & (1 << (sig - 1));
91 /* The tools for sigprocmask() are there, just not the routine itself */
93 # define SIG_UNBLOCK 1
99 # define SIG_SETMASK 3
101 int sigprocmask(int how, sigset_t *set, sigset_t *oset) {
103 set_errno(EFAULT); set_vaxc_errno(SS$_ACCVIO);
108 *oset = sigsetmask(*set);
111 *oset = sigblock(*set);
115 sigsetmask(*oset & ~*set);
118 set_errno(EINVAL); set_vaxc_errno(LIB$_INVARG);
123 # define sigaction sigvec
124 # define sa_flags sv_onstack
125 # define sa_handler sv_handler
126 # define sa_mask sv_mask
127 # define sigsuspend(set) sigpause(*set)
129 # define HAS_TZNAME /* shows up in VMS 7.0 */
130 # endif /* __VMS_VER < 70000000 */
132 /* The POSIX notion of ttyname() is better served by getname() under VMS */
133 static char ttnambuf[64];
134 # define ttyname(fd) (isatty(fd) > 0 ? getname(fd,ttnambuf,0) : NULL)
136 /* The non-POSIX CRTL times() has void return type, so we just get the
137 current time directly */
138 clock_t vms_times(struct tms *bufptr) {
140 /* Get wall time and convert to 10 ms intervals to
141 * produce the return value that the POSIX standard expects */
142 # if defined(__DECC) && defined (__ALPHA)
145 _ckvmssts(sys$gettim(&vmstime));
147 retval = vmstime & 0x7fffffff;
149 /* (Older hw or ccs don't have an atomic 64-bit type, so we
150 * juggle 32-bit ints (and a float) to produce a time_t result
151 * with minimal loss of information.) */
152 long int vmstime[2],remainder,divisor = 100000;
153 _ckvmssts(sys$gettim((unsigned long int *)vmstime));
154 vmstime[1] &= 0x7fff; /* prevent overflow in EDIV */
155 _ckvmssts(lib$ediv(&divisor,vmstime,(long int *)&retval,&remainder));
157 /* Fill in the struct tms using the CRTL routine . . .*/
158 times((tbuffer_t *)bufptr);
159 return (clock_t) retval;
161 # define times(t) vms_times(t)
164 # include <sys/times.h>
166 # include <sys/utsname.h>
168 # include <sys/wait.h>
175 typedef long SysRetLong;
176 typedef sigset_t* POSIX__SigSet;
177 typedef HV* POSIX__SigAction;
179 typedef struct termios* POSIX__Termios;
180 #else /* Define termios types to int, and call not_here for the functions.*/
181 #define POSIX__Termios int
185 #define cfgetispeed(x) not_here("cfgetispeed")
186 #define cfgetospeed(x) not_here("cfgetospeed")
187 #define tcdrain(x) not_here("tcdrain")
188 #define tcflush(x,y) not_here("tcflush")
189 #define tcsendbreak(x,y) not_here("tcsendbreak")
190 #define cfsetispeed(x,y) not_here("cfsetispeed")
191 #define cfsetospeed(x,y) not_here("cfsetospeed")
192 #define ctermid(x) (char *) not_here("ctermid")
193 #define tcflow(x,y) not_here("tcflow")
194 #define tcgetattr(x,y) not_here("tcgetattr")
195 #define tcsetattr(x,y,z) not_here("tcsetattr")
198 /* Possibly needed prototypes */
199 char *cuserid _((char *));
200 double strtod _((const char *, char **));
201 long strtol _((const char *, char **, int));
202 unsigned long strtoul _((const char *, char **, int));
205 #define cuserid(a) (char *) not_here("cuserid")
209 #define difftime(a,b) not_here("difftime")
212 #ifndef HAS_FPATHCONF
213 #define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
216 #define mktime(a) not_here("mktime")
219 #define nice(a) not_here("nice")
222 #define pathconf(f,n) (SysRetLong) not_here("pathconf")
225 #define sysconf(n) (SysRetLong) not_here("sysconf")
228 #define readlink(a,b,c) not_here("readlink")
231 #define setpgid(a,b) not_here("setpgid")
234 #define setsid() not_here("setsid")
237 #define strcoll(s1,s2) not_here("strcoll")
240 #define strtod(s1,s2) not_here("strtod")
243 #define strtol(s1,s2,b) not_here("strtol")
246 #define strtoul(s1,s2,b) not_here("strtoul")
249 #define strxfrm(s1,s2,n) not_here("strxfrm")
251 #ifndef HAS_TCGETPGRP
252 #define tcgetpgrp(a) not_here("tcgetpgrp")
254 #ifndef HAS_TCSETPGRP
255 #define tcsetpgrp(a,b) not_here("tcsetpgrp")
258 #define times(a) not_here("times")
261 #define uname(a) not_here("uname")
264 #define waitpid(a,b,c) not_here("waitpid")
269 #define mblen(a,b) not_here("mblen")
273 #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
276 #define mbtowc(pwc, s, n) not_here("mbtowc")
279 #define wcstombs(s, pwcs, n) not_here("wcstombs")
282 #define wctomb(s, wchar) not_here("wcstombs")
284 #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
285 /* If we don't have these functions, then we wouldn't have gotten a typedef
286 for wchar_t, the wide character type. Defining wchar_t allows the
287 functions referencing it to compile. Its actual type is then meaningless,
288 since without the above functions, all sections using it end up calling
289 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
295 #ifndef HAS_LOCALECONV
296 #define localeconv() not_here("localeconv")
300 extern char *tzname[];
302 char *tzname[] = { "" , "" };
305 /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX)
306 * fields for which we don't have Configure support yet:
307 * char *tm_zone; -- abbreviation of timezone name
308 * long tm_gmtoff; -- offset from GMT in seconds
309 * To workaround core dumps from the uninitialised tm_zone we get the
310 * system to give us a reasonable struct to copy. This fix means that
311 * strftime uses the tm_zone and tm_gmtoff values returned by
312 * localtime(time()). That should give the desired result most of the
313 * time. But probably not always!
315 * This is a temporary workaround to be removed once Configure
316 * support is added and NETaa14816 is considered in full.
317 * It does not address tzname aspects of NETaa14816.
319 #ifdef STRUCT_TM_HASZONE
321 init_tm(ptm) /* see mktime, strftime and asctime */
326 Copy(localtime(&now), ptm, 1, struct tm);
330 # define init_tm(ptm)
334 #ifndef HAS_LONG_DOUBLE /* XXX What to do about long doubles? */
350 croak("POSIX::%s not implemented on this architecture", s);
362 if (strEQ(name, "ARG_MAX"))
370 if (strEQ(name, "BUFSIZ"))
376 if (strEQ(name, "BRKINT"))
382 if (strEQ(name, "B9600"))
388 if (strEQ(name, "B19200"))
394 if (strEQ(name, "B38400"))
400 if (strEQ(name, "B0"))
406 if (strEQ(name, "B110"))
412 if (strEQ(name, "B1200"))
418 if (strEQ(name, "B134"))
424 if (strEQ(name, "B150"))
430 if (strEQ(name, "B1800"))
436 if (strEQ(name, "B200"))
442 if (strEQ(name, "B2400"))
448 if (strEQ(name, "B300"))
454 if (strEQ(name, "B4800"))
460 if (strEQ(name, "B50"))
466 if (strEQ(name, "B600"))
472 if (strEQ(name, "B75"))
480 if (strEQ(name, "CHAR_BIT"))
486 if (strEQ(name, "CHAR_MAX"))
492 if (strEQ(name, "CHAR_MIN"))
498 if (strEQ(name, "CHILD_MAX"))
504 if (strEQ(name, "CLK_TCK"))
510 if (strEQ(name, "CLOCAL"))
516 if (strEQ(name, "CLOCKS_PER_SEC"))
517 #ifdef CLOCKS_PER_SEC
518 return CLOCKS_PER_SEC;
522 if (strEQ(name, "CREAD"))
528 if (strEQ(name, "CS5"))
534 if (strEQ(name, "CS6"))
540 if (strEQ(name, "CS7"))
546 if (strEQ(name, "CS8"))
552 if (strEQ(name, "CSIZE"))
558 if (strEQ(name, "CSTOPB"))
566 if (strEQ(name, "DBL_MAX"))
572 if (strEQ(name, "DBL_MIN"))
578 if (strEQ(name, "DBL_DIG"))
584 if (strEQ(name, "DBL_EPSILON"))
590 if (strEQ(name, "DBL_MANT_DIG"))
596 if (strEQ(name, "DBL_MAX_10_EXP"))
597 #ifdef DBL_MAX_10_EXP
598 return DBL_MAX_10_EXP;
602 if (strEQ(name, "DBL_MAX_EXP"))
608 if (strEQ(name, "DBL_MIN_10_EXP"))
609 #ifdef DBL_MIN_10_EXP
610 return DBL_MIN_10_EXP;
614 if (strEQ(name, "DBL_MIN_EXP"))
624 if (strEQ(name, "EACCES"))
630 if (strEQ(name, "EADDRINUSE"))
636 if (strEQ(name, "EADDRNOTAVAIL"))
638 return EADDRNOTAVAIL;
642 if (strEQ(name, "EAFNOSUPPORT"))
648 if (strEQ(name, "EAGAIN"))
654 if (strEQ(name, "EALREADY"))
662 if (strEQ(name, "EBADF"))
668 if (strEQ(name, "EBUSY"))
676 if (strEQ(name, "ECHILD"))
682 if (strEQ(name, "ECHO"))
688 if (strEQ(name, "ECHOE"))
694 if (strEQ(name, "ECHOK"))
700 if (strEQ(name, "ECHONL"))
706 if (strEQ(name, "ECONNABORTED"))
712 if (strEQ(name, "ECONNREFUSED"))
718 if (strEQ(name, "ECONNRESET"))
726 if (strEQ(name, "EDEADLK"))
732 if (strEQ(name, "EDESTADDRREQ"))
738 if (strEQ(name, "EDOM"))
744 if (strEQ(name, "EDQUOT"))
752 if (strEQ(name, "EEXIST"))
760 if (strEQ(name, "EFAULT"))
766 if (strEQ(name, "EFBIG"))
774 if (strEQ(name, "EHOSTDOWN"))
780 if (strEQ(name, "EHOSTUNREACH"))
788 if (strEQ(name, "EINPROGRESS"))
794 if (strEQ(name, "EINTR"))
800 if (strEQ(name, "EINVAL"))
806 if (strEQ(name, "EIO"))
812 if (strEQ(name, "EISCONN"))
818 if (strEQ(name, "EISDIR"))
824 if (strEQ(name, "ELOOP"))
832 if (strEQ(name, "EMFILE"))
838 if (strEQ(name, "EMLINK"))
844 if (strEQ(name, "EMSGSIZE"))
852 if (strEQ(name, "ENETDOWN"))
858 if (strEQ(name, "ENETRESET"))
864 if (strEQ(name, "ENETUNREACH"))
870 if (strEQ(name, "ENOBUFS"))
876 if (strEQ(name, "ENOEXEC"))
882 if (strEQ(name, "ENOMEM"))
888 if (strEQ(name, "ENOPROTOOPT"))
894 if (strEQ(name, "ENOSPC"))
900 if (strEQ(name, "ENOTBLK"))
906 if (strEQ(name, "ENOTCONN"))
912 if (strEQ(name, "ENOTDIR"))
918 if (strEQ(name, "ENOTEMPTY"))
924 if (strEQ(name, "ENOTSOCK"))
930 if (strEQ(name, "ENOTTY"))
936 if (strEQ(name, "ENFILE"))
942 if (strEQ(name, "ENODEV"))
948 if (strEQ(name, "ENOENT"))
954 if (strEQ(name, "ENOLCK"))
960 if (strEQ(name, "ENOSYS"))
966 if (strEQ(name, "ENXIO"))
972 if (strEQ(name, "ENAMETOOLONG"))
980 if (strEQ(name, "EOF"))
986 if (strEQ(name, "EOPNOTSUPP"))
994 if (strEQ(name, "EPERM"))
1000 if (strEQ(name, "EPFNOSUPPORT"))
1002 return EPFNOSUPPORT;
1006 if (strEQ(name, "EPIPE"))
1012 if (strEQ(name, "EPROCLIM"))
1018 if (strEQ(name, "EPROTONOSUPPORT"))
1019 #ifdef EPROTONOSUPPORT
1020 return EPROTONOSUPPORT;
1024 if (strEQ(name, "EPROTOTYPE"))
1032 if (strEQ(name, "ERANGE"))
1038 if (strEQ(name, "EREMOTE"))
1044 if (strEQ(name, "ERESTART"))
1050 if (strEQ(name, "EROFS"))
1058 if (strEQ(name, "ESHUTDOWN"))
1064 if (strEQ(name, "ESOCKTNOSUPPORT"))
1065 #ifdef ESOCKTNOSUPPORT
1066 return ESOCKTNOSUPPORT;
1070 if (strEQ(name, "ESPIPE"))
1076 if (strEQ(name, "ESRCH"))
1082 if (strEQ(name, "ESTALE"))
1090 if (strEQ(name, "ETIMEDOUT"))
1096 if (strEQ(name, "ETOOMANYREFS"))
1098 return ETOOMANYREFS;
1102 if (strEQ(name, "ETXTBSY"))
1110 if (strEQ(name, "EUSERS"))
1118 if (strEQ(name, "EWOULDBLOCK"))
1126 if (strEQ(name, "EXIT_FAILURE"))
1128 return EXIT_FAILURE;
1132 if (strEQ(name, "EXIT_SUCCESS"))
1134 return EXIT_SUCCESS;
1138 if (strEQ(name, "EXDEV"))
1146 if (strEQ(name, "E2BIG"))
1154 if (strnEQ(name, "FLT_", 4)) {
1155 if (strEQ(name, "FLT_MAX"))
1161 if (strEQ(name, "FLT_MIN"))
1167 if (strEQ(name, "FLT_ROUNDS"))
1173 if (strEQ(name, "FLT_DIG"))
1179 if (strEQ(name, "FLT_EPSILON"))
1185 if (strEQ(name, "FLT_MANT_DIG"))
1187 return FLT_MANT_DIG;
1191 if (strEQ(name, "FLT_MAX_10_EXP"))
1192 #ifdef FLT_MAX_10_EXP
1193 return FLT_MAX_10_EXP;
1197 if (strEQ(name, "FLT_MAX_EXP"))
1203 if (strEQ(name, "FLT_MIN_10_EXP"))
1204 #ifdef FLT_MIN_10_EXP
1205 return FLT_MIN_10_EXP;
1209 if (strEQ(name, "FLT_MIN_EXP"))
1215 if (strEQ(name, "FLT_RADIX"))
1223 if (strnEQ(name, "F_", 2)) {
1224 if (strEQ(name, "F_DUPFD"))
1230 if (strEQ(name, "F_GETFD"))
1236 if (strEQ(name, "F_GETFL"))
1242 if (strEQ(name, "F_GETLK"))
1248 if (strEQ(name, "F_OK"))
1254 if (strEQ(name, "F_RDLCK"))
1260 if (strEQ(name, "F_SETFD"))
1266 if (strEQ(name, "F_SETFL"))
1272 if (strEQ(name, "F_SETLK"))
1278 if (strEQ(name, "F_SETLKW"))
1284 if (strEQ(name, "F_UNLCK"))
1290 if (strEQ(name, "F_WRLCK"))
1298 if (strEQ(name, "FD_CLOEXEC"))
1304 if (strEQ(name, "FILENAME_MAX"))
1306 return FILENAME_MAX;
1312 if (strEQ(name, "HUGE_VAL"))
1318 if (strEQ(name, "HUPCL"))
1326 if (strEQ(name, "INT_MAX"))
1332 if (strEQ(name, "INT_MIN"))
1338 if (strEQ(name, "ICANON"))
1344 if (strEQ(name, "ICRNL"))
1350 if (strEQ(name, "IEXTEN"))
1356 if (strEQ(name, "IGNBRK"))
1362 if (strEQ(name, "IGNCR"))
1368 if (strEQ(name, "IGNPAR"))
1374 if (strEQ(name, "INLCR"))
1380 if (strEQ(name, "INPCK"))
1386 if (strEQ(name, "ISIG"))
1392 if (strEQ(name, "ISTRIP"))
1398 if (strEQ(name, "IXOFF"))
1404 if (strEQ(name, "IXON"))
1412 if (strnEQ(name, "LC_", 3)) {
1413 if (strEQ(name, "LC_ALL"))
1419 if (strEQ(name, "LC_COLLATE"))
1425 if (strEQ(name, "LC_CTYPE"))
1431 if (strEQ(name, "LC_MONETARY"))
1437 if (strEQ(name, "LC_NUMERIC"))
1443 if (strEQ(name, "LC_TIME"))
1451 if (strnEQ(name, "LDBL_", 5)) {
1452 if (strEQ(name, "LDBL_MAX"))
1458 if (strEQ(name, "LDBL_MIN"))
1464 if (strEQ(name, "LDBL_DIG"))
1470 if (strEQ(name, "LDBL_EPSILON"))
1472 return LDBL_EPSILON;
1476 if (strEQ(name, "LDBL_MANT_DIG"))
1477 #ifdef LDBL_MANT_DIG
1478 return LDBL_MANT_DIG;
1482 if (strEQ(name, "LDBL_MAX_10_EXP"))
1483 #ifdef LDBL_MAX_10_EXP
1484 return LDBL_MAX_10_EXP;
1488 if (strEQ(name, "LDBL_MAX_EXP"))
1490 return LDBL_MAX_EXP;
1494 if (strEQ(name, "LDBL_MIN_10_EXP"))
1495 #ifdef LDBL_MIN_10_EXP
1496 return LDBL_MIN_10_EXP;
1500 if (strEQ(name, "LDBL_MIN_EXP"))
1502 return LDBL_MIN_EXP;
1508 if (strnEQ(name, "L_", 2)) {
1509 if (strEQ(name, "L_ctermid"))
1515 if (strEQ(name, "L_cuserid"))
1521 if (strEQ(name, "L_tmpname"))
1529 if (strEQ(name, "LONG_MAX"))
1535 if (strEQ(name, "LONG_MIN"))
1541 if (strEQ(name, "LINK_MAX"))
1549 if (strEQ(name, "MAX_CANON"))
1555 if (strEQ(name, "MAX_INPUT"))
1561 if (strEQ(name, "MB_CUR_MAX"))
1567 if (strEQ(name, "MB_LEN_MAX"))
1575 if (strEQ(name, "NULL")) return 0;
1576 if (strEQ(name, "NAME_MAX"))
1582 if (strEQ(name, "NCCS"))
1588 if (strEQ(name, "NGROUPS_MAX"))
1594 if (strEQ(name, "NOFLSH"))
1602 if (strnEQ(name, "O_", 2)) {
1603 if (strEQ(name, "O_APPEND"))
1609 if (strEQ(name, "O_CREAT"))
1615 if (strEQ(name, "O_TRUNC"))
1621 if (strEQ(name, "O_RDONLY"))
1627 if (strEQ(name, "O_RDWR"))
1633 if (strEQ(name, "O_WRONLY"))
1639 if (strEQ(name, "O_EXCL"))
1645 if (strEQ(name, "O_NOCTTY"))
1651 if (strEQ(name, "O_NONBLOCK"))
1657 if (strEQ(name, "O_ACCMODE"))
1665 if (strEQ(name, "OPEN_MAX"))
1671 if (strEQ(name, "OPOST"))
1679 if (strEQ(name, "PATH_MAX"))
1685 if (strEQ(name, "PARENB"))
1691 if (strEQ(name, "PARMRK"))
1697 if (strEQ(name, "PARODD"))
1703 if (strEQ(name, "PIPE_BUF"))
1711 if (strEQ(name, "RAND_MAX"))
1717 if (strEQ(name, "R_OK"))
1725 if (strnEQ(name, "SIG", 3)) {
1726 if (name[3] == '_') {
1727 if (strEQ(name, "SIG_BLOCK"))
1734 if (strEQ(name, "SIG_DFL")) return (int)SIG_DFL;
1737 if (strEQ(name, "SIG_ERR")) return (int)SIG_ERR;
1740 if (strEQ(name, "SIG_IGN")) return (int)SIG_IGN;
1742 if (strEQ(name, "SIG_SETMASK"))
1748 if (strEQ(name, "SIG_UNBLOCK"))
1756 if (strEQ(name, "SIGABRT"))
1762 if (strEQ(name, "SIGALRM"))
1768 if (strEQ(name, "SIGCHLD"))
1774 if (strEQ(name, "SIGCONT"))
1780 if (strEQ(name, "SIGFPE"))
1786 if (strEQ(name, "SIGHUP"))
1792 if (strEQ(name, "SIGILL"))
1798 if (strEQ(name, "SIGINT"))
1804 if (strEQ(name, "SIGKILL"))
1810 if (strEQ(name, "SIGPIPE"))
1816 if (strEQ(name, "SIGQUIT"))
1822 if (strEQ(name, "SIGSEGV"))
1828 if (strEQ(name, "SIGSTOP"))
1834 if (strEQ(name, "SIGTERM"))
1840 if (strEQ(name, "SIGTSTP"))
1846 if (strEQ(name, "SIGTTIN"))
1852 if (strEQ(name, "SIGTTOU"))
1858 if (strEQ(name, "SIGUSR1"))
1864 if (strEQ(name, "SIGUSR2"))
1872 if (name[1] == '_') {
1873 if (strEQ(name, "S_ISGID"))
1879 if (strEQ(name, "S_ISUID"))
1885 if (strEQ(name, "S_IRGRP"))
1891 if (strEQ(name, "S_IROTH"))
1897 if (strEQ(name, "S_IRUSR"))
1903 if (strEQ(name, "S_IRWXG"))
1909 if (strEQ(name, "S_IRWXO"))
1915 if (strEQ(name, "S_IRWXU"))
1921 if (strEQ(name, "S_IWGRP"))
1927 if (strEQ(name, "S_IWOTH"))
1933 if (strEQ(name, "S_IWUSR"))
1939 if (strEQ(name, "S_IXGRP"))
1945 if (strEQ(name, "S_IXOTH"))
1951 if (strEQ(name, "S_IXUSR"))
1957 errno = EAGAIN; /* the following aren't constants */
1959 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1962 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1965 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1968 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1971 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1975 if (strEQ(name, "SEEK_CUR"))
1981 if (strEQ(name, "SEEK_END"))
1987 if (strEQ(name, "SEEK_SET"))
1993 if (strEQ(name, "STREAM_MAX"))
1999 if (strEQ(name, "SHRT_MAX"))
2005 if (strEQ(name, "SHRT_MIN"))
2011 if (strnEQ(name, "SA_", 3)) {
2012 if (strEQ(name, "SA_NOCLDSTOP"))
2014 return SA_NOCLDSTOP;
2018 if (strEQ(name, "SA_NOCLDWAIT"))
2020 return SA_NOCLDWAIT;
2024 if (strEQ(name, "SA_NODEFER"))
2030 if (strEQ(name, "SA_ONSTACK"))
2036 if (strEQ(name, "SA_RESETHAND"))
2038 return SA_RESETHAND;
2042 if (strEQ(name, "SA_RESTART"))
2048 if (strEQ(name, "SA_SIGINFO"))
2056 if (strEQ(name, "SCHAR_MAX"))
2062 if (strEQ(name, "SCHAR_MIN"))
2068 if (strEQ(name, "SSIZE_MAX"))
2074 if (strEQ(name, "STDIN_FILENO"))
2076 return STDIN_FILENO;
2080 if (strEQ(name, "STDOUT_FILENO"))
2081 #ifdef STDOUT_FILENO
2082 return STDOUT_FILENO;
2086 if (strEQ(name, "STRERR_FILENO"))
2087 #ifdef STRERR_FILENO
2088 return STRERR_FILENO;
2094 if (strEQ(name, "TCIFLUSH"))
2100 if (strEQ(name, "TCIOFF"))
2106 if (strEQ(name, "TCIOFLUSH"))
2112 if (strEQ(name, "TCION"))
2118 if (strEQ(name, "TCOFLUSH"))
2124 if (strEQ(name, "TCOOFF"))
2130 if (strEQ(name, "TCOON"))
2136 if (strEQ(name, "TCSADRAIN"))
2142 if (strEQ(name, "TCSAFLUSH"))
2148 if (strEQ(name, "TCSANOW"))
2154 if (strEQ(name, "TMP_MAX"))
2160 if (strEQ(name, "TOSTOP"))
2166 if (strEQ(name, "TZNAME_MAX"))
2174 if (strEQ(name, "UCHAR_MAX"))
2180 if (strEQ(name, "UINT_MAX"))
2186 if (strEQ(name, "ULONG_MAX"))
2192 if (strEQ(name, "USHRT_MAX"))
2200 if (strEQ(name, "VEOF"))
2206 if (strEQ(name, "VEOL"))
2212 if (strEQ(name, "VERASE"))
2218 if (strEQ(name, "VINTR"))
2224 if (strEQ(name, "VKILL"))
2230 if (strEQ(name, "VMIN"))
2236 if (strEQ(name, "VQUIT"))
2242 if (strEQ(name, "VSTART"))
2248 if (strEQ(name, "VSTOP"))
2254 if (strEQ(name, "VSUSP"))
2260 if (strEQ(name, "VTIME"))
2268 if (strEQ(name, "W_OK"))
2274 if (strEQ(name, "WNOHANG"))
2280 if (strEQ(name, "WUNTRACED"))
2286 errno = EAGAIN; /* the following aren't constants */
2288 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2291 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2294 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2297 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2300 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2303 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2307 if (strEQ(name, "X_OK"))
2315 if (strnEQ(name, "_PC_", 4)) {
2316 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2317 #ifdef _PC_CHOWN_RESTRICTED
2318 return _PC_CHOWN_RESTRICTED;
2322 if (strEQ(name, "_PC_LINK_MAX"))
2324 return _PC_LINK_MAX;
2328 if (strEQ(name, "_PC_MAX_CANON"))
2329 #ifdef _PC_MAX_CANON
2330 return _PC_MAX_CANON;
2334 if (strEQ(name, "_PC_MAX_INPUT"))
2335 #ifdef _PC_MAX_INPUT
2336 return _PC_MAX_INPUT;
2340 if (strEQ(name, "_PC_NAME_MAX"))
2342 return _PC_NAME_MAX;
2346 if (strEQ(name, "_PC_NO_TRUNC"))
2348 return _PC_NO_TRUNC;
2352 if (strEQ(name, "_PC_PATH_MAX"))
2354 return _PC_PATH_MAX;
2358 if (strEQ(name, "_PC_PIPE_BUF"))
2360 return _PC_PIPE_BUF;
2364 if (strEQ(name, "_PC_VDISABLE"))
2366 return _PC_VDISABLE;
2372 if (strnEQ(name, "_POSIX_", 7)) {
2373 if (strEQ(name, "_POSIX_ARG_MAX"))
2374 #ifdef _POSIX_ARG_MAX
2375 return _POSIX_ARG_MAX;
2379 if (strEQ(name, "_POSIX_CHILD_MAX"))
2380 #ifdef _POSIX_CHILD_MAX
2381 return _POSIX_CHILD_MAX;
2385 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2386 #ifdef _POSIX_CHOWN_RESTRICTED
2387 return _POSIX_CHOWN_RESTRICTED;
2391 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2392 #ifdef _POSIX_JOB_CONTROL
2393 return _POSIX_JOB_CONTROL;
2397 if (strEQ(name, "_POSIX_LINK_MAX"))
2398 #ifdef _POSIX_LINK_MAX
2399 return _POSIX_LINK_MAX;
2403 if (strEQ(name, "_POSIX_MAX_CANON"))
2404 #ifdef _POSIX_MAX_CANON
2405 return _POSIX_MAX_CANON;
2409 if (strEQ(name, "_POSIX_MAX_INPUT"))
2410 #ifdef _POSIX_MAX_INPUT
2411 return _POSIX_MAX_INPUT;
2415 if (strEQ(name, "_POSIX_NAME_MAX"))
2416 #ifdef _POSIX_NAME_MAX
2417 return _POSIX_NAME_MAX;
2421 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2422 #ifdef _POSIX_NGROUPS_MAX
2423 return _POSIX_NGROUPS_MAX;
2427 if (strEQ(name, "_POSIX_NO_TRUNC"))
2428 #ifdef _POSIX_NO_TRUNC
2429 return _POSIX_NO_TRUNC;
2433 if (strEQ(name, "_POSIX_OPEN_MAX"))
2434 #ifdef _POSIX_OPEN_MAX
2435 return _POSIX_OPEN_MAX;
2439 if (strEQ(name, "_POSIX_PATH_MAX"))
2440 #ifdef _POSIX_PATH_MAX
2441 return _POSIX_PATH_MAX;
2445 if (strEQ(name, "_POSIX_PIPE_BUF"))
2446 #ifdef _POSIX_PIPE_BUF
2447 return _POSIX_PIPE_BUF;
2451 if (strEQ(name, "_POSIX_SAVED_IDS"))
2452 #ifdef _POSIX_SAVED_IDS
2453 return _POSIX_SAVED_IDS;
2457 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2458 #ifdef _POSIX_SSIZE_MAX
2459 return _POSIX_SSIZE_MAX;
2463 if (strEQ(name, "_POSIX_STREAM_MAX"))
2464 #ifdef _POSIX_STREAM_MAX
2465 return _POSIX_STREAM_MAX;
2469 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2470 #ifdef _POSIX_TZNAME_MAX
2471 return _POSIX_TZNAME_MAX;
2475 if (strEQ(name, "_POSIX_VDISABLE"))
2476 #ifdef _POSIX_VDISABLE
2477 return _POSIX_VDISABLE;
2481 if (strEQ(name, "_POSIX_VERSION"))
2482 #ifdef _POSIX_VERSION
2483 return _POSIX_VERSION;
2489 if (strnEQ(name, "_SC_", 4)) {
2490 if (strEQ(name, "_SC_ARG_MAX"))
2496 if (strEQ(name, "_SC_CHILD_MAX"))
2497 #ifdef _SC_CHILD_MAX
2498 return _SC_CHILD_MAX;
2502 if (strEQ(name, "_SC_CLK_TCK"))
2508 if (strEQ(name, "_SC_JOB_CONTROL"))
2509 #ifdef _SC_JOB_CONTROL
2510 return _SC_JOB_CONTROL;
2514 if (strEQ(name, "_SC_NGROUPS_MAX"))
2515 #ifdef _SC_NGROUPS_MAX
2516 return _SC_NGROUPS_MAX;
2520 if (strEQ(name, "_SC_OPEN_MAX"))
2522 return _SC_OPEN_MAX;
2526 if (strEQ(name, "_SC_SAVED_IDS"))
2527 #ifdef _SC_SAVED_IDS
2528 return _SC_SAVED_IDS;
2532 if (strEQ(name, "_SC_STREAM_MAX"))
2533 #ifdef _SC_STREAM_MAX
2534 return _SC_STREAM_MAX;
2538 if (strEQ(name, "_SC_TZNAME_MAX"))
2539 #ifdef _SC_TZNAME_MAX
2540 return _SC_TZNAME_MAX;
2544 if (strEQ(name, "_SC_VERSION"))
2561 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2564 new(packname = "POSIX::SigSet", ...)
2569 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2570 sigemptyset(RETVAL);
2571 for (i = 1; i < items; i++)
2572 sigaddset(RETVAL, SvIV(ST(i)));
2579 POSIX::SigSet sigset
2581 safefree((char *)sigset);
2584 sigaddset(sigset, sig)
2585 POSIX::SigSet sigset
2589 sigdelset(sigset, sig)
2590 POSIX::SigSet sigset
2595 POSIX::SigSet sigset
2599 POSIX::SigSet sigset
2602 sigismember(sigset, sig)
2603 POSIX::SigSet sigset
2607 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2610 new(packname = "POSIX::Termios", ...)
2615 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2617 not_here("termios");
2624 DESTROY(termios_ref)
2625 POSIX::Termios termios_ref
2628 safefree((char *)termios_ref);
2630 not_here("termios");
2634 getattr(termios_ref, fd = 0)
2635 POSIX::Termios termios_ref
2638 RETVAL = tcgetattr(fd, termios_ref);
2643 setattr(termios_ref, fd = 0, optional_actions = 0)
2644 POSIX::Termios termios_ref
2646 int optional_actions
2648 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2653 cfgetispeed(termios_ref)
2654 POSIX::Termios termios_ref
2657 cfgetospeed(termios_ref)
2658 POSIX::Termios termios_ref
2661 getiflag(termios_ref)
2662 POSIX::Termios termios_ref
2664 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2665 RETVAL = termios_ref->c_iflag;
2667 not_here("getiflag");
2673 getoflag(termios_ref)
2674 POSIX::Termios termios_ref
2676 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2677 RETVAL = termios_ref->c_oflag;
2679 not_here("getoflag");
2685 getcflag(termios_ref)
2686 POSIX::Termios termios_ref
2688 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2689 RETVAL = termios_ref->c_cflag;
2691 not_here("getcflag");
2697 getlflag(termios_ref)
2698 POSIX::Termios termios_ref
2700 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2701 RETVAL = termios_ref->c_lflag;
2703 not_here("getlflag");
2709 getcc(termios_ref, ccix)
2710 POSIX::Termios termios_ref
2713 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2715 croak("Bad getcc subscript");
2716 RETVAL = termios_ref->c_cc[ccix];
2724 cfsetispeed(termios_ref, speed)
2725 POSIX::Termios termios_ref
2729 cfsetospeed(termios_ref, speed)
2730 POSIX::Termios termios_ref
2734 setiflag(termios_ref, iflag)
2735 POSIX::Termios termios_ref
2738 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2739 termios_ref->c_iflag = iflag;
2741 not_here("setiflag");
2745 setoflag(termios_ref, oflag)
2746 POSIX::Termios termios_ref
2749 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2750 termios_ref->c_oflag = oflag;
2752 not_here("setoflag");
2756 setcflag(termios_ref, cflag)
2757 POSIX::Termios termios_ref
2760 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2761 termios_ref->c_cflag = cflag;
2763 not_here("setcflag");
2767 setlflag(termios_ref, lflag)
2768 POSIX::Termios termios_ref
2771 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2772 termios_ref->c_lflag = lflag;
2774 not_here("setlflag");
2778 setcc(termios_ref, ccix, cc)
2779 POSIX::Termios termios_ref
2783 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2785 croak("Bad setcc subscript");
2786 termios_ref->c_cc[ccix] = cc;
2792 MODULE = POSIX PACKAGE = POSIX
2805 for (s = charstring; *s && RETVAL; s++)
2817 for (s = charstring; *s && RETVAL; s++)
2829 for (s = charstring; *s && RETVAL; s++)
2841 for (s = charstring; *s && RETVAL; s++)
2853 for (s = charstring; *s && RETVAL; s++)
2865 for (s = charstring; *s && RETVAL; s++)
2877 for (s = charstring; *s && RETVAL; s++)
2889 for (s = charstring; *s && RETVAL; s++)
2901 for (s = charstring; *s && RETVAL; s++)
2913 for (s = charstring; *s && RETVAL; s++)
2920 isxdigit(charstring)
2925 for (s = charstring; *s && RETVAL; s++)
2932 open(filename, flags = O_RDONLY, mode = 0666)
2937 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2938 TAINT_PROPER("open");
2939 RETVAL = open(filename, flags, mode);
2947 #ifdef HAS_LOCALECONV
2948 struct lconv *lcbuf;
2950 SET_NUMERIC_LOCAL();
2951 if (lcbuf = localeconv()) {
2953 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2954 hv_store(RETVAL, "decimal_point", 13,
2955 newSVpv(lcbuf->decimal_point, 0), 0);
2956 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2957 hv_store(RETVAL, "thousands_sep", 13,
2958 newSVpv(lcbuf->thousands_sep, 0), 0);
2959 if (lcbuf->grouping && *lcbuf->grouping)
2960 hv_store(RETVAL, "grouping", 8,
2961 newSVpv(lcbuf->grouping, 0), 0);
2962 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2963 hv_store(RETVAL, "int_curr_symbol", 15,
2964 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2965 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2966 hv_store(RETVAL, "currency_symbol", 15,
2967 newSVpv(lcbuf->currency_symbol, 0), 0);
2968 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2969 hv_store(RETVAL, "mon_decimal_point", 17,
2970 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2971 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2972 hv_store(RETVAL, "mon_thousands_sep", 17,
2973 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2974 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2975 hv_store(RETVAL, "mon_grouping", 12,
2976 newSVpv(lcbuf->mon_grouping, 0), 0);
2977 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2978 hv_store(RETVAL, "positive_sign", 13,
2979 newSVpv(lcbuf->positive_sign, 0), 0);
2980 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2981 hv_store(RETVAL, "negative_sign", 13,
2982 newSVpv(lcbuf->negative_sign, 0), 0);
2984 if (lcbuf->int_frac_digits != CHAR_MAX)
2985 hv_store(RETVAL, "int_frac_digits", 15,
2986 newSViv(lcbuf->int_frac_digits), 0);
2987 if (lcbuf->frac_digits != CHAR_MAX)
2988 hv_store(RETVAL, "frac_digits", 11,
2989 newSViv(lcbuf->frac_digits), 0);
2990 if (lcbuf->p_cs_precedes != CHAR_MAX)
2991 hv_store(RETVAL, "p_cs_precedes", 13,
2992 newSViv(lcbuf->p_cs_precedes), 0);
2993 if (lcbuf->p_sep_by_space != CHAR_MAX)
2994 hv_store(RETVAL, "p_sep_by_space", 14,
2995 newSViv(lcbuf->p_sep_by_space), 0);
2996 if (lcbuf->n_cs_precedes != CHAR_MAX)
2997 hv_store(RETVAL, "n_cs_precedes", 13,
2998 newSViv(lcbuf->n_cs_precedes), 0);
2999 if (lcbuf->n_sep_by_space != CHAR_MAX)
3000 hv_store(RETVAL, "n_sep_by_space", 14,
3001 newSViv(lcbuf->n_sep_by_space), 0);
3002 if (lcbuf->p_sign_posn != CHAR_MAX)
3003 hv_store(RETVAL, "p_sign_posn", 11,
3004 newSViv(lcbuf->p_sign_posn), 0);
3005 if (lcbuf->n_sign_posn != CHAR_MAX)
3006 hv_store(RETVAL, "n_sign_posn", 11,
3007 newSViv(lcbuf->n_sign_posn), 0);
3010 localeconv(); /* A stub to call not_here(). */
3016 setlocale(category, locale = 0)
3020 RETVAL = setlocale(category, locale);
3022 #ifdef USE_LOCALE_CTYPE
3023 if (category == LC_CTYPE
3025 || category == LC_ALL
3031 if (category == LC_ALL)
3032 newctype = setlocale(LC_CTYPE, NULL);
3036 perl_new_ctype(newctype);
3038 #endif /* USE_LOCALE_CTYPE */
3039 #ifdef USE_LOCALE_COLLATE
3040 if (category == LC_COLLATE
3042 || category == LC_ALL
3048 if (category == LC_ALL)
3049 newcoll = setlocale(LC_COLLATE, NULL);
3053 perl_new_collate(newcoll);
3055 #endif /* USE_LOCALE_COLLATE */
3056 #ifdef USE_LOCALE_NUMERIC
3057 if (category == LC_NUMERIC
3059 || category == LC_ALL
3065 if (category == LC_ALL)
3066 newnum = setlocale(LC_NUMERIC, NULL);
3070 perl_new_numeric(newnum);
3072 #endif /* USE_LOCALE_NUMERIC */
3112 /* (We already know stack is long enough.) */
3113 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3114 PUSHs(sv_2mortal(newSViv(expvar)));
3130 /* (We already know stack is long enough.) */
3131 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3132 PUSHs(sv_2mortal(newSVnv(intvar)));
3147 sigaction(sig, action, oldaction = 0)
3149 POSIX::SigAction action
3150 POSIX::SigAction oldaction
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);
3236 POSIX::SigSet sigset
3239 sigprocmask(how, sigset, oldsigset = 0)
3241 POSIX::SigSet sigset
3242 POSIX::SigSet oldsigset
3245 sigsuspend(signal_mask)
3246 POSIX::SigSet signal_mask
3266 lseek(fd, offset, whence)
3279 if (pipe(fds) != -1) {
3281 PUSHs(sv_2mortal(newSViv(fds[0])));
3282 PUSHs(sv_2mortal(newSViv(fds[1])));
3286 read(fd, buffer, nbytes)
3288 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3292 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3295 SvCUR(sv_buffer) = RETVAL;
3296 SvPOK_only(sv_buffer);
3297 *SvEND(sv_buffer) = '\0';
3298 SvTAINTED_on(sv_buffer);
3314 tcsetpgrp(fd, pgrp_id)
3323 if (uname(&buf) >= 0) {
3325 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3326 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3327 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3328 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3329 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3332 uname((char *) 0); /* A stub to call not_here(). */
3336 write(fd, buffer, nbytes)
3354 mbstowcs(s, pwcs, n)
3366 wcstombs(s, pwcs, n)
3388 SET_NUMERIC_LOCAL();
3389 num = strtod(str, &unparsed);
3390 PUSHs(sv_2mortal(newSVnv(num)));
3391 if (GIMME == G_ARRAY) {
3394 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3400 strtol(str, base = 0)
3407 num = strtol(str, &unparsed, base);
3408 if (num >= IV_MIN && num <= IV_MAX)
3409 PUSHs(sv_2mortal(newSViv((IV)num)));
3411 PUSHs(sv_2mortal(newSVnv((double)num)));
3412 if (GIMME == G_ARRAY) {
3415 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3421 strtoul(str, base = 0)
3428 num = strtoul(str, &unparsed, base);
3430 PUSHs(sv_2mortal(newSViv((IV)num)));
3432 PUSHs(sv_2mortal(newSVnv((double)num)));
3433 if (GIMME == G_ARRAY) {
3436 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3448 char *p = SvPV(src,srclen);
3450 ST(0) = sv_2mortal(NEWSV(800,srclen));
3451 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3452 if (dstlen > srclen) {
3454 SvGROW(ST(0), dstlen);
3455 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3458 SvCUR(ST(0)) = dstlen;
3463 mkfifo(filename, mode)
3467 TAINT_PROPER("mkfifo");
3468 RETVAL = mkfifo(filename, mode);
3484 tcflush(fd, queue_selector)
3489 tcsendbreak(fd, duration)
3494 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3507 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3510 mytm.tm_hour = hour;
3511 mytm.tm_mday = mday;
3513 mytm.tm_year = year;
3514 mytm.tm_wday = wday;
3515 mytm.tm_yday = yday;
3516 mytm.tm_isdst = isdst;
3517 RETVAL = asctime(&mytm);
3534 realtime = times( &tms );
3536 PUSHs( sv_2mortal( newSVnv( realtime ) ) );
3537 PUSHs( sv_2mortal( newSVnv( tms.tms_utime ) ) );
3538 PUSHs( sv_2mortal( newSVnv( tms.tms_stime ) ) );
3539 PUSHs( sv_2mortal( newSVnv( tms.tms_cutime ) ) );
3540 PUSHs( sv_2mortal( newSVnv( tms.tms_cstime ) ) );
3543 difftime(time1, time2)
3548 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3561 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3564 mytm.tm_hour = hour;
3565 mytm.tm_mday = mday;
3567 mytm.tm_year = year;
3568 mytm.tm_wday = wday;
3569 mytm.tm_yday = yday;
3570 mytm.tm_isdst = isdst;
3571 RETVAL = mktime(&mytm);
3577 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3593 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3596 mytm.tm_hour = hour;
3597 mytm.tm_mday = mday;
3599 mytm.tm_year = year;
3600 mytm.tm_wday = wday;
3601 mytm.tm_yday = yday;
3602 mytm.tm_isdst = isdst;
3603 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3604 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3614 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3615 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3618 access(filename, mode)
3636 pathconf(filename, name)