The CHECKOP macro was not invoked on some newly created ops
[p5sagit/p5-mst-13.2.git] / ext / POSIX / POSIX.pm
CommitLineData
a0d0e21e 1package POSIX;
2
17f410f9 3our(@ISA, %EXPORT_TAGS, @EXPORT_OK, $AUTOLOAD) = ();
73c78b0a 4
3b35bae3 5use AutoLoader;
c07a80fd 6
9426adcd 7use XSLoader ();
a0d0e21e 8
d4742b2c 9our $VERSION = "1.05" ;
c07a80fd 10
748a9306 11# Grandfather old foo_h form to new :foo_h form
66fbe9e2 12my $loaded;
13
a0d0e21e 14sub import {
66fbe9e2 15 load_imports() unless $loaded++;
a0d0e21e 16 my $this = shift;
748a9306 17 my @list = map { m/^\w+_h$/ ? ":$_" : $_ } @_;
a0d0e21e 18 local $Exporter::ExportLevel = 1;
19 Exporter::import($this,@list);
20}
21
66fbe9e2 22sub croak { require Carp; goto &Carp::croak }
f2b27c0e 23# declare usage to assist AutoLoad
24sub usage;
4633a7c4 25
9426adcd 26XSLoader::load 'POSIX', $VERSION;
4633a7c4 27
a290f238 28my %NON_CONSTS = (map {($_,1)}
29 qw(S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG WEXITSTATUS
30 WIFEXITED WIFSIGNALED WIFSTOPPED WSTOPSIG WTERMSIG));
4633a7c4 31
a0d0e21e 32sub AUTOLOAD {
33 if ($AUTOLOAD =~ /::(_?[a-z])/) {
66fbe9e2 34 # require AutoLoader;
a0d0e21e 35 $AutoLoader::AUTOLOAD = $AUTOLOAD;
36 goto &AutoLoader::AUTOLOAD
37 }
4633a7c4 38 local $! = 0;
39 my $constname = $AUTOLOAD;
a0d0e21e 40 $constname =~ s/.*:://;
a290f238 41 if ($NON_CONSTS{$constname}) {
42 my ($val, $error) = &int_macro_int($constname, $_[0]);
43 croak $error if $error;
44 *$AUTOLOAD = sub { &int_macro_int($constname, $_[0]) };
45 } else {
46 my ($error, $val) = constant($constname);
47 croak $error if $error;
4633a7c4 48 *$AUTOLOAD = sub { $val };
49 }
4633a7c4 50
a0d0e21e 51 goto &$AUTOLOAD;
52}
53
557c0de7 54package POSIX::SigAction;
55
56use AutoLoader 'AUTOLOAD';
57sub new { bless {HANDLER => $_[1], MASK => $_[2], FLAGS => $_[3] || 0}, $_[0] }
58
59package POSIX;
d4742b2c 60
611;
62__END__
63
f2b27c0e 64sub usage {
c07a80fd 65 my ($mess) = @_;
a0d0e21e 66 croak "Usage: POSIX::$mess";
67}
68
f2b27c0e 69sub redef {
c07a80fd 70 my ($mess) = @_;
a0d0e21e 71 croak "Use method $mess instead";
72}
73
f2b27c0e 74sub unimpl {
c07a80fd 75 my ($mess) = @_;
a0d0e21e 76 $mess =~ s/xxx//;
77 croak "Unimplemented: POSIX::$mess";
78}
79
a0d0e21e 80sub assert {
81 usage "assert(expr)" if @_ != 1;
82 if (!$_[0]) {
83 croak "Assertion failed";
84 }
85}
86
87sub tolower {
88 usage "tolower(string)" if @_ != 1;
89 lc($_[0]);
90}
91
92sub toupper {
93 usage "toupper(string)" if @_ != 1;
94 uc($_[0]);
95}
96
97sub closedir {
98 usage "closedir(dirhandle)" if @_ != 1;
b56ec344 99 CORE::closedir($_[0]);
a0d0e21e 100}
101
102sub opendir {
103 usage "opendir(directory)" if @_ != 1;
66fbe9e2 104 my $dirhandle;
b56ec344 105 CORE::opendir($dirhandle, $_[0])
a0d0e21e 106 ? $dirhandle
4633a7c4 107 : undef;
a0d0e21e 108}
109
110sub readdir {
111 usage "readdir(dirhandle)" if @_ != 1;
b56ec344 112 CORE::readdir($_[0]);
a0d0e21e 113}
114
115sub rewinddir {
116 usage "rewinddir(dirhandle)" if @_ != 1;
b56ec344 117 CORE::rewinddir($_[0]);
a0d0e21e 118}
119
120sub errno {
121 usage "errno()" if @_ != 0;
122 $! + 0;
123}
124
125sub creat {
126 usage "creat(filename, mode)" if @_ != 2;
94b6baf5 127 &open($_[0], &O_WRONLY | &O_CREAT | &O_TRUNC, $_[1]);
a0d0e21e 128}
129
130sub fcntl {
131 usage "fcntl(filehandle, cmd, arg)" if @_ != 3;
b56ec344 132 CORE::fcntl($_[0], $_[1], $_[2]);
a0d0e21e 133}
134
135sub getgrgid {
136 usage "getgrgid(gid)" if @_ != 1;
b56ec344 137 CORE::getgrgid($_[0]);
a0d0e21e 138}
139
140sub getgrnam {
141 usage "getgrnam(name)" if @_ != 1;
b56ec344 142 CORE::getgrnam($_[0]);
a0d0e21e 143}
144
145sub atan2 {
146 usage "atan2(x,y)" if @_ != 2;
b56ec344 147 CORE::atan2($_[0], $_[1]);
a0d0e21e 148}
149
150sub cos {
151 usage "cos(x)" if @_ != 1;
b56ec344 152 CORE::cos($_[0]);
a0d0e21e 153}
154
155sub exp {
156 usage "exp(x)" if @_ != 1;
b56ec344 157 CORE::exp($_[0]);
a0d0e21e 158}
159
160sub fabs {
161 usage "fabs(x)" if @_ != 1;
b56ec344 162 CORE::abs($_[0]);
a0d0e21e 163}
164
165sub log {
166 usage "log(x)" if @_ != 1;
b56ec344 167 CORE::log($_[0]);
a0d0e21e 168}
169
170sub pow {
171 usage "pow(x,exponent)" if @_ != 2;
172 $_[0] ** $_[1];
173}
174
175sub sin {
176 usage "sin(x)" if @_ != 1;
b56ec344 177 CORE::sin($_[0]);
a0d0e21e 178}
179
180sub sqrt {
181 usage "sqrt(x)" if @_ != 1;
b56ec344 182 CORE::sqrt($_[0]);
a0d0e21e 183}
184
a0d0e21e 185sub getpwnam {
186 usage "getpwnam(name)" if @_ != 1;
b56ec344 187 CORE::getpwnam($_[0]);
a0d0e21e 188}
189
190sub getpwuid {
191 usage "getpwuid(uid)" if @_ != 1;
b56ec344 192 CORE::getpwuid($_[0]);
a0d0e21e 193}
194
195sub longjmp {
196 unimpl "longjmp() is C-specific: use die instead";
197}
198
199sub setjmp {
200 unimpl "setjmp() is C-specific: use eval {} instead";
201}
202
203sub siglongjmp {
204 unimpl "siglongjmp() is C-specific: use die instead";
205}
206
207sub sigsetjmp {
208 unimpl "sigsetjmp() is C-specific: use eval {} instead";
209}
210
211sub kill {
212 usage "kill(pid, sig)" if @_ != 2;
b56ec344 213 CORE::kill $_[1], $_[0];
a0d0e21e 214}
215
216sub raise {
217 usage "raise(sig)" if @_ != 1;
b56ec344 218 CORE::kill $_[0], $$; # Is this good enough?
a0d0e21e 219}
220
221sub offsetof {
222 unimpl "offsetof() is C-specific, stopped";
223}
224
225sub clearerr {
28757baa 226 redef "IO::Handle::clearerr()";
a0d0e21e 227}
228
229sub fclose {
28757baa 230 redef "IO::Handle::close()";
a0d0e21e 231}
232
233sub fdopen {
28757baa 234 redef "IO::Handle::new_from_fd()";
a0d0e21e 235}
236
237sub feof {
28757baa 238 redef "IO::Handle::eof()";
a0d0e21e 239}
240
241sub fgetc {
28757baa 242 redef "IO::Handle::getc()";
a0d0e21e 243}
244
245sub fgets {
28757baa 246 redef "IO::Handle::gets()";
a0d0e21e 247}
248
249sub fileno {
28757baa 250 redef "IO::Handle::fileno()";
a0d0e21e 251}
252
253sub fopen {
28757baa 254 redef "IO::File::open()";
a0d0e21e 255}
256
257sub fprintf {
258 unimpl "fprintf() is C-specific--use printf instead";
259}
260
261sub fputc {
262 unimpl "fputc() is C-specific--use print instead";
263}
264
265sub fputs {
266 unimpl "fputs() is C-specific--use print instead";
267}
268
269sub fread {
270 unimpl "fread() is C-specific--use read instead";
271}
272
273sub freopen {
274 unimpl "freopen() is C-specific--use open instead";
275}
276
277sub fscanf {
278 unimpl "fscanf() is C-specific--use <> and regular expressions instead";
279}
280
281sub fseek {
28757baa 282 redef "IO::Seekable::seek()";
a0d0e21e 283}
284
f0709b24 285sub fsync {
286 redef "IO::Handle::sync()";
287}
288
a0d0e21e 289sub ferror {
28757baa 290 redef "IO::Handle::error()";
a0d0e21e 291}
292
293sub fflush {
28757baa 294 redef "IO::Handle::flush()";
a0d0e21e 295}
296
297sub fgetpos {
28757baa 298 redef "IO::Seekable::getpos()";
a0d0e21e 299}
300
301sub fsetpos {
28757baa 302 redef "IO::Seekable::setpos()";
a0d0e21e 303}
304
305sub ftell {
28757baa 306 redef "IO::Seekable::tell()";
a0d0e21e 307}
308
309sub fwrite {
310 unimpl "fwrite() is C-specific--use print instead";
311}
312
313sub getc {
314 usage "getc(handle)" if @_ != 1;
b56ec344 315 CORE::getc($_[0]);
a0d0e21e 316}
317
318sub getchar {
319 usage "getchar()" if @_ != 0;
b56ec344 320 CORE::getc(STDIN);
a0d0e21e 321}
322
323sub gets {
324 usage "gets()" if @_ != 0;
325 scalar <STDIN>;
326}
327
328sub perror {
329 print STDERR "@_: " if @_;
330 print STDERR $!,"\n";
331}
332
333sub printf {
334 usage "printf(pattern, args...)" if @_ < 1;
b56ec344 335 CORE::printf STDOUT @_;
a0d0e21e 336}
337
338sub putc {
339 unimpl "putc() is C-specific--use print instead";
340}
341
342sub putchar {
343 unimpl "putchar() is C-specific--use print instead";
344}
345
346sub puts {
347 unimpl "puts() is C-specific--use print instead";
348}
349
350sub remove {
351 usage "remove(filename)" if @_ != 1;
b56ec344 352 CORE::unlink($_[0]);
a0d0e21e 353}
354
355sub rename {
356 usage "rename(oldfilename, newfilename)" if @_ != 2;
b56ec344 357 CORE::rename($_[0], $_[1]);
a0d0e21e 358}
359
360sub rewind {
361 usage "rewind(filehandle)" if @_ != 1;
b56ec344 362 CORE::seek($_[0],0,0);
a0d0e21e 363}
364
365sub scanf {
366 unimpl "scanf() is C-specific--use <> and regular expressions instead";
367}
368
369sub sprintf {
370 usage "sprintf(pattern,args)" if @_ == 0;
b56ec344 371 CORE::sprintf(shift,@_);
a0d0e21e 372}
373
374sub sscanf {
375 unimpl "sscanf() is C-specific--use regular expressions instead";
376}
377
378sub tmpfile {
28757baa 379 redef "IO::File::new_tmpfile()";
a0d0e21e 380}
381
382sub ungetc {
28757baa 383 redef "IO::Handle::ungetc()";
a0d0e21e 384}
385
386sub vfprintf {
387 unimpl "vfprintf() is C-specific";
388}
389
390sub vprintf {
391 unimpl "vprintf() is C-specific";
392}
393
394sub vsprintf {
395 unimpl "vsprintf() is C-specific";
396}
397
398sub abs {
399 usage "abs(x)" if @_ != 1;
b56ec344 400 CORE::abs($_[0]);
a0d0e21e 401}
402
403sub atexit {
404 unimpl "atexit() is C-specific: use END {} instead";
405}
406
407sub atof {
408 unimpl "atof() is C-specific, stopped";
409}
410
411sub atoi {
412 unimpl "atoi() is C-specific, stopped";
413}
414
415sub atol {
416 unimpl "atol() is C-specific, stopped";
417}
418
419sub bsearch {
37120919 420 unimpl "bsearch() not supplied";
a0d0e21e 421}
422
423sub calloc {
424 unimpl "calloc() is C-specific, stopped";
425}
426
427sub div {
428 unimpl "div() is C-specific, stopped";
429}
430
431sub exit {
432 usage "exit(status)" if @_ != 1;
b56ec344 433 CORE::exit($_[0]);
a0d0e21e 434}
435
436sub free {
437 unimpl "free() is C-specific, stopped";
a0d0e21e 438}
439
440sub getenv {
441 usage "getenv(name)" if @_ != 1;
442 $ENV{$_[0]};
443}
444
445sub labs {
446 unimpl "labs() is C-specific, use abs instead";
447}
448
449sub ldiv {
450 unimpl "ldiv() is C-specific, use / and int instead";
451}
452
453sub malloc {
454 unimpl "malloc() is C-specific, stopped";
455}
456
457sub qsort {
458 unimpl "qsort() is C-specific, use sort instead";
459}
460
461sub rand {
462 unimpl "rand() is non-portable, use Perl's rand instead";
463}
464
465sub realloc {
466 unimpl "realloc() is C-specific, stopped";
467}
468
469sub srand {
470 unimpl "srand()";
471}
472
a0d0e21e 473sub system {
474 usage "system(command)" if @_ != 1;
b56ec344 475 CORE::system($_[0]);
a0d0e21e 476}
477
478sub memchr {
479 unimpl "memchr() is C-specific, use index() instead";
480}
481
482sub memcmp {
483 unimpl "memcmp() is C-specific, use eq instead";
484}
485
486sub memcpy {
487 unimpl "memcpy() is C-specific, use = instead";
37120919 488}
a0d0e21e 489
490sub memmove {
491 unimpl "memmove() is C-specific, use = instead";
492}
493
494sub memset {
495 unimpl "memset() is C-specific, use x instead";
496}
497
498sub strcat {
499 unimpl "strcat() is C-specific, use .= instead";
500}
501
502sub strchr {
503 unimpl "strchr() is C-specific, use index() instead";
504}
505
506sub strcmp {
507 unimpl "strcmp() is C-specific, use eq instead";
508}
509
510sub strcpy {
511 unimpl "strcpy() is C-specific, use = instead";
512}
513
514sub strcspn {
515 unimpl "strcspn() is C-specific, use regular expressions instead";
516}
517
518sub strerror {
519 usage "strerror(errno)" if @_ != 1;
520 local $! = $_[0];
521 $! . "";
522}
523
524sub strlen {
525 unimpl "strlen() is C-specific, use length instead";
526}
527
528sub strncat {
529 unimpl "strncat() is C-specific, use .= instead";
530}
531
532sub strncmp {
533 unimpl "strncmp() is C-specific, use eq instead";
534}
535
536sub strncpy {
537 unimpl "strncpy() is C-specific, use = instead";
538}
539
540sub strpbrk {
541 unimpl "strpbrk() is C-specific, stopped";
542}
543
544sub strrchr {
545 unimpl "strrchr() is C-specific, use rindex() instead";
546}
547
548sub strspn {
549 unimpl "strspn() is C-specific, stopped";
550}
551
552sub strstr {
553 usage "strstr(big, little)" if @_ != 2;
b56ec344 554 CORE::index($_[0], $_[1]);
a0d0e21e 555}
556
557sub strtok {
558 unimpl "strtok() is C-specific, stopped";
559}
560
561sub chmod {
3b35bae3 562 usage "chmod(mode, filename)" if @_ != 2;
b56ec344 563 CORE::chmod($_[0], $_[1]);
a0d0e21e 564}
565
566sub fstat {
567 usage "fstat(fd)" if @_ != 1;
c07a80fd 568 local *TMP;
29778b0a 569 CORE::open(TMP, "<&$_[0]"); # Gross.
b56ec344 570 my @l = CORE::stat(TMP);
29778b0a 571 CORE::close(TMP);
a0d0e21e 572 @l;
573}
574
575sub mkdir {
576 usage "mkdir(directoryname, mode)" if @_ != 2;
b56ec344 577 CORE::mkdir($_[0], $_[1]);
a0d0e21e 578}
579
580sub stat {
581 usage "stat(filename)" if @_ != 1;
b56ec344 582 CORE::stat($_[0]);
a0d0e21e 583}
584
585sub umask {
586 usage "umask(mask)" if @_ != 1;
b56ec344 587 CORE::umask($_[0]);
a0d0e21e 588}
589
a0d0e21e 590sub wait {
cb1a09d0 591 usage "wait()" if @_ != 0;
b56ec344 592 CORE::wait();
a0d0e21e 593}
594
595sub waitpid {
cb1a09d0 596 usage "waitpid(pid, options)" if @_ != 2;
b56ec344 597 CORE::waitpid($_[0], $_[1]);
a0d0e21e 598}
599
600sub gmtime {
601 usage "gmtime(time)" if @_ != 1;
b56ec344 602 CORE::gmtime($_[0]);
a0d0e21e 603}
604
605sub localtime {
606 usage "localtime(time)" if @_ != 1;
b56ec344 607 CORE::localtime($_[0]);
a0d0e21e 608}
609
610sub time {
37120919 611 usage "time()" if @_ != 0;
b56ec344 612 CORE::time;
a0d0e21e 613}
614
615sub alarm {
616 usage "alarm(seconds)" if @_ != 1;
b56ec344 617 CORE::alarm($_[0]);
a0d0e21e 618}
619
620sub chdir {
621 usage "chdir(directory)" if @_ != 1;
b56ec344 622 CORE::chdir($_[0]);
a0d0e21e 623}
624
625sub chown {
626 usage "chown(filename, uid, gid)" if @_ != 3;
b56ec344 627 CORE::chown($_[0], $_[1], $_[2]);
a0d0e21e 628}
629
630sub execl {
631 unimpl "execl() is C-specific, stopped";
a0d0e21e 632}
633
634sub execle {
635 unimpl "execle() is C-specific, stopped";
a0d0e21e 636}
637
638sub execlp {
639 unimpl "execlp() is C-specific, stopped";
a0d0e21e 640}
641
642sub execv {
643 unimpl "execv() is C-specific, stopped";
a0d0e21e 644}
645
646sub execve {
647 unimpl "execve() is C-specific, stopped";
a0d0e21e 648}
649
650sub execvp {
651 unimpl "execvp() is C-specific, stopped";
a0d0e21e 652}
653
654sub fork {
655 usage "fork()" if @_ != 0;
b56ec344 656 CORE::fork;
a0d0e21e 657}
658
a0d0e21e 659sub getegid {
660 usage "getegid()" if @_ != 0;
661 $) + 0;
662}
663
664sub geteuid {
665 usage "geteuid()" if @_ != 0;
666 $> + 0;
667}
668
669sub getgid {
670 usage "getgid()" if @_ != 0;
671 $( + 0;
672}
673
674sub getgroups {
675 usage "getgroups()" if @_ != 0;
c07a80fd 676 my %seen;
a0d0e21e 677 grep(!$seen{$_}++, split(' ', $) ));
678}
679
680sub getlogin {
681 usage "getlogin()" if @_ != 0;
b56ec344 682 CORE::getlogin();
a0d0e21e 683}
684
685sub getpgrp {
686 usage "getpgrp()" if @_ != 0;
5507c093 687 CORE::getpgrp;
a0d0e21e 688}
689
690sub getpid {
691 usage "getpid()" if @_ != 0;
692 $$;
693}
694
695sub getppid {
696 usage "getppid()" if @_ != 0;
b56ec344 697 CORE::getppid;
a0d0e21e 698}
699
700sub getuid {
701 usage "getuid()" if @_ != 0;
702 $<;
703}
704
705sub isatty {
706 usage "isatty(filehandle)" if @_ != 1;
707 -t $_[0];
708}
709
710sub link {
711 usage "link(oldfilename, newfilename)" if @_ != 2;
b56ec344 712 CORE::link($_[0], $_[1]);
a0d0e21e 713}
714
715sub rmdir {
716 usage "rmdir(directoryname)" if @_ != 1;
b56ec344 717 CORE::rmdir($_[0]);
a0d0e21e 718}
719
a41ecaa8 720sub setbuf {
721 redef "IO::Handle::setbuf()";
722}
723
a41ecaa8 724sub setvbuf {
725 redef "IO::Handle::setvbuf()";
726}
727
a0d0e21e 728sub sleep {
729 usage "sleep(seconds)" if @_ != 1;
2ab27a20 730 $_[0] - CORE::sleep($_[0]);
a0d0e21e 731}
732
733sub unlink {
734 usage "unlink(filename)" if @_ != 1;
b56ec344 735 CORE::unlink($_[0]);
a0d0e21e 736}
737
738sub utime {
739 usage "utime(filename, atime, mtime)" if @_ != 3;
b56ec344 740 CORE::utime($_[1], $_[2], $_[0]);
a0d0e21e 741}
742
66fbe9e2 743sub load_imports {
744%EXPORT_TAGS = (
745
746 assert_h => [qw(assert NDEBUG)],
747
748 ctype_h => [qw(isalnum isalpha iscntrl isdigit isgraph islower
749 isprint ispunct isspace isupper isxdigit tolower toupper)],
750
d4742b2c 751 dirent_h => [],
66fbe9e2 752
753 errno_h => [qw(E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT
754 EAGAIN EALREADY EBADF EBUSY ECHILD ECONNABORTED
755 ECONNREFUSED ECONNRESET EDEADLK EDESTADDRREQ EDOM EDQUOT
756 EEXIST EFAULT EFBIG EHOSTDOWN EHOSTUNREACH EINPROGRESS
757 EINTR EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK
758 EMSGSIZE ENAMETOOLONG ENETDOWN ENETRESET ENETUNREACH
759 ENFILE ENOBUFS ENODEV ENOENT ENOEXEC ENOLCK ENOMEM
760 ENOPROTOOPT ENOSPC ENOSYS ENOTBLK ENOTCONN ENOTDIR
761 ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOPNOTSUPP EPERM
762 EPFNOSUPPORT EPIPE EPROCLIM EPROTONOSUPPORT EPROTOTYPE
763 ERANGE EREMOTE ERESTART EROFS ESHUTDOWN ESOCKTNOSUPPORT
764 ESPIPE ESRCH ESTALE ETIMEDOUT ETOOMANYREFS ETXTBSY
765 EUSERS EWOULDBLOCK EXDEV errno)],
766
767 fcntl_h => [qw(FD_CLOEXEC F_DUPFD F_GETFD F_GETFL F_GETLK F_RDLCK
768 F_SETFD F_SETFL F_SETLK F_SETLKW F_UNLCK F_WRLCK
769 O_ACCMODE O_APPEND O_CREAT O_EXCL O_NOCTTY O_NONBLOCK
770 O_RDONLY O_RDWR O_TRUNC O_WRONLY
771 creat
772 SEEK_CUR SEEK_END SEEK_SET
773 S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU
774 S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISGID S_ISREG S_ISUID
775 S_IWGRP S_IWOTH S_IWUSR)],
776
777 float_h => [qw(DBL_DIG DBL_EPSILON DBL_MANT_DIG
778 DBL_MAX DBL_MAX_10_EXP DBL_MAX_EXP
779 DBL_MIN DBL_MIN_10_EXP DBL_MIN_EXP
780 FLT_DIG FLT_EPSILON FLT_MANT_DIG
781 FLT_MAX FLT_MAX_10_EXP FLT_MAX_EXP
782 FLT_MIN FLT_MIN_10_EXP FLT_MIN_EXP
783 FLT_RADIX FLT_ROUNDS
784 LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG
785 LDBL_MAX LDBL_MAX_10_EXP LDBL_MAX_EXP
786 LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP)],
787
d4742b2c 788 grp_h => [],
66fbe9e2 789
790 limits_h => [qw( ARG_MAX CHAR_BIT CHAR_MAX CHAR_MIN CHILD_MAX
791 INT_MAX INT_MIN LINK_MAX LONG_MAX LONG_MIN MAX_CANON
792 MAX_INPUT MB_LEN_MAX NAME_MAX NGROUPS_MAX OPEN_MAX
793 PATH_MAX PIPE_BUF SCHAR_MAX SCHAR_MIN SHRT_MAX SHRT_MIN
794 SSIZE_MAX STREAM_MAX TZNAME_MAX UCHAR_MAX UINT_MAX
795 ULONG_MAX USHRT_MAX _POSIX_ARG_MAX _POSIX_CHILD_MAX
796 _POSIX_LINK_MAX _POSIX_MAX_CANON _POSIX_MAX_INPUT
797 _POSIX_NAME_MAX _POSIX_NGROUPS_MAX _POSIX_OPEN_MAX
798 _POSIX_PATH_MAX _POSIX_PIPE_BUF _POSIX_SSIZE_MAX
799 _POSIX_STREAM_MAX _POSIX_TZNAME_MAX)],
800
83f427f7 801 locale_h => [qw(LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES
802 LC_MONETARY LC_NUMERIC LC_TIME NULL
803 localeconv setlocale)],
66fbe9e2 804
805 math_h => [qw(HUGE_VAL acos asin atan ceil cosh fabs floor fmod
806 frexp ldexp log10 modf pow sinh tan tanh)],
807
d4742b2c 808 pwd_h => [],
66fbe9e2 809
810 setjmp_h => [qw(longjmp setjmp siglongjmp sigsetjmp)],
811
812 signal_h => [qw(SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK
813 SA_RESETHAND SA_RESTART SA_SIGINFO SIGABRT SIGALRM
814 SIGCHLD SIGCONT SIGFPE SIGHUP SIGILL SIGINT SIGKILL
815 SIGPIPE SIGQUIT SIGSEGV SIGSTOP SIGTERM SIGTSTP SIGTTIN
816 SIGTTOU SIGUSR1 SIGUSR2 SIG_BLOCK SIG_DFL SIG_ERR
817 SIG_IGN SIG_SETMASK SIG_UNBLOCK raise sigaction signal
818 sigpending sigprocmask sigsuspend)],
819
d4742b2c 820 stdarg_h => [],
66fbe9e2 821
822 stddef_h => [qw(NULL offsetof)],
823
824 stdio_h => [qw(BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid
825 L_tmpname NULL SEEK_CUR SEEK_END SEEK_SET
826 STREAM_MAX TMP_MAX stderr stdin stdout
827 clearerr fclose fdopen feof ferror fflush fgetc fgetpos
828 fgets fopen fprintf fputc fputs fread freopen
829 fscanf fseek fsetpos ftell fwrite getchar gets
830 perror putc putchar puts remove rewind
831 scanf setbuf setvbuf sscanf tmpfile tmpnam
832 ungetc vfprintf vprintf vsprintf)],
833
834 stdlib_h => [qw(EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX NULL RAND_MAX
835 abort atexit atof atoi atol bsearch calloc div
836 free getenv labs ldiv malloc mblen mbstowcs mbtowc
837 qsort realloc strtod strtol strtoul wcstombs wctomb)],
838
839 string_h => [qw(NULL memchr memcmp memcpy memmove memset strcat
840 strchr strcmp strcoll strcpy strcspn strerror strlen
841 strncat strncmp strncpy strpbrk strrchr strspn strstr
842 strtok strxfrm)],
843
844 sys_stat_h => [qw(S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU
845 S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISGID S_ISREG
846 S_ISUID S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR
847 fstat mkfifo)],
848
d4742b2c 849 sys_times_h => [],
66fbe9e2 850
d4742b2c 851 sys_types_h => [],
66fbe9e2 852
853 sys_utsname_h => [qw(uname)],
854
855 sys_wait_h => [qw(WEXITSTATUS WIFEXITED WIFSIGNALED WIFSTOPPED
856 WNOHANG WSTOPSIG WTERMSIG WUNTRACED)],
857
858 termios_h => [qw( B0 B110 B1200 B134 B150 B1800 B19200 B200 B2400
859 B300 B38400 B4800 B50 B600 B75 B9600 BRKINT CLOCAL
860 CREAD CS5 CS6 CS7 CS8 CSIZE CSTOPB ECHO ECHOE ECHOK
861 ECHONL HUPCL ICANON ICRNL IEXTEN IGNBRK IGNCR IGNPAR
862 INLCR INPCK ISIG ISTRIP IXOFF IXON NCCS NOFLSH OPOST
863 PARENB PARMRK PARODD TCIFLUSH TCIOFF TCIOFLUSH TCION
864 TCOFLUSH TCOOFF TCOON TCSADRAIN TCSAFLUSH TCSANOW
865 TOSTOP VEOF VEOL VERASE VINTR VKILL VMIN VQUIT VSTART
866 VSTOP VSUSP VTIME
867 cfgetispeed cfgetospeed cfsetispeed cfsetospeed tcdrain
868 tcflow tcflush tcgetattr tcsendbreak tcsetattr )],
869
870 time_h => [qw(CLK_TCK CLOCKS_PER_SEC NULL asctime clock ctime
871 difftime mktime strftime tzset tzname)],
872
873 unistd_h => [qw(F_OK NULL R_OK SEEK_CUR SEEK_END SEEK_SET
b250498f 874 STDERR_FILENO STDIN_FILENO STDOUT_FILENO W_OK X_OK
66fbe9e2 875 _PC_CHOWN_RESTRICTED _PC_LINK_MAX _PC_MAX_CANON
876 _PC_MAX_INPUT _PC_NAME_MAX _PC_NO_TRUNC _PC_PATH_MAX
877 _PC_PIPE_BUF _PC_VDISABLE _POSIX_CHOWN_RESTRICTED
878 _POSIX_JOB_CONTROL _POSIX_NO_TRUNC _POSIX_SAVED_IDS
879 _POSIX_VDISABLE _POSIX_VERSION _SC_ARG_MAX
880 _SC_CHILD_MAX _SC_CLK_TCK _SC_JOB_CONTROL
d61b6859 881 _SC_NGROUPS_MAX _SC_OPEN_MAX _SC_PAGESIZE _SC_SAVED_IDS
66fbe9e2 882 _SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION
883 _exit access ctermid cuserid
884 dup2 dup execl execle execlp execv execve execvp
f0709b24 885 fpathconf fsync getcwd getegid geteuid getgid getgroups
66fbe9e2 886 getpid getuid isatty lseek pathconf pause setgid setpgid
887 setsid setuid sysconf tcgetpgrp tcsetpgrp ttyname)],
888
d4742b2c 889 utime_h => [],
66fbe9e2 890
891);
892
893# Exporter::export_tags();
894for (values %EXPORT_TAGS) {
895 push @EXPORT, @$_;
896}
897
898@EXPORT_OK = qw(
d925a710 899 abs
900 alarm
901 atan2
902 chdir
903 chmod
904 chown
905 close
906 closedir
907 cos
908 exit
909 exp
910 fcntl
911 fileno
912 fork
913 getc
914 getgrgid
915 getgrnam
916 getlogin
917 getpgrp
918 getppid
919 getpwnam
920 getpwuid
921 gmtime
922 isatty
923 kill
924 link
925 localtime
926 log
927 mkdir
928 nice
929 open
930 opendir
931 pipe
932 printf
933 rand
934 read
935 readdir
936 rename
937 rewinddir
938 rmdir
939 sin
940 sleep
941 sprintf
942 sqrt
943 srand
944 stat
945 system
946 time
947 times
948 umask
949 unlink
950 utime
951 wait
952 waitpid
953 write
66fbe9e2 954);
955
956require Exporter;
957}
557c0de7 958
959package POSIX::SigAction;
960
961sub handler { $_[0]->{HANDLER} = $_[1] if @_ > 1; $_[0]->{HANDLER} };
962sub mask { $_[0]->{MASK} = $_[1] if @_ > 1; $_[0]->{MASK} };
963sub flags { $_[0]->{FLAGS} = $_[1] if @_ > 1; $_[0]->{FLAGS} };