← Index
NYTProf Performance Profile   « line view »
For /usr/local/bin/sa-learn
  Run on Tue Nov 7 05:38:10 2017
Reported on Tue Nov 7 06:16:00 2017

Filename/usr/local/lib/perl5/5.24/mach/POSIX.pm
StatementsExecuted 406 statements in 12.2ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1112.92ms2.92msPOSIX::::load_imports POSIX::load_imports
1111.09ms4.69msPOSIX::::BEGIN@11 POSIX::BEGIN@11
666310µs14.6msPOSIX::::import POSIX::import
141163µs63µsPOSIX::::CORE:subst POSIX::CORE:subst (opcode)
11147µs62µsPOSIX::::BEGIN@2 POSIX::BEGIN@2
11128µs45µsPOSIX::::BEGIN@206 POSIX::BEGIN@206
11124µs54µsPOSIX::::BEGIN@3 POSIX::BEGIN@3
0000s0sPOSIX::::AUTOLOAD POSIX::AUTOLOAD
0000s0sPOSIX::SigAction::::flagsPOSIX::SigAction::flags
0000s0sPOSIX::SigAction::::handlerPOSIX::SigAction::handler
0000s0sPOSIX::SigAction::::maskPOSIX::SigAction::mask
0000s0sPOSIX::SigAction::::newPOSIX::SigAction::new
0000s0sPOSIX::SigAction::::safePOSIX::SigAction::safe
0000s0sPOSIX::SigRt::::CLEAR POSIX::SigRt::CLEAR
0000s0sPOSIX::SigRt::::DELETE POSIX::SigRt::DELETE
0000s0sPOSIX::SigRt::::EXISTS POSIX::SigRt::EXISTS
0000s0sPOSIX::SigRt::::FETCH POSIX::SigRt::FETCH
0000s0sPOSIX::SigRt::::SCALAR POSIX::SigRt::SCALAR
0000s0sPOSIX::SigRt::::STORE POSIX::SigRt::STORE
0000s0sPOSIX::SigRt::::_check POSIX::SigRt::_check
0000s0sPOSIX::SigRt::::_croak POSIX::SigRt::_croak
0000s0sPOSIX::SigRt::::_exist POSIX::SigRt::_exist
0000s0sPOSIX::SigRt::::_getsig POSIX::SigRt::_getsig
0000s0sPOSIX::SigRt::::_init POSIX::SigRt::_init
0000s0sPOSIX::SigRt::::new POSIX::SigRt::new
0000s0sPOSIX::::croak POSIX::croak
0000s0sPOSIX::::perror POSIX::perror
0000s0sPOSIX::::printf POSIX::printf
0000s0sPOSIX::::sprintf POSIX::sprintf
0000s0sPOSIX::::usage POSIX::usage
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package POSIX;
2262µs278µs
# spent 62µs (47+15) within POSIX::BEGIN@2 which was called: # once (47µs+15µs) by Mail::SpamAssassin::Logger::Stderr::BEGIN@37 at line 2
use strict;
# spent 62µs making 1 call to POSIX::BEGIN@2 # spent 15µs making 1 call to strict::import
32178µs284µs
# spent 54µs (24+30) within POSIX::BEGIN@3 which was called: # once (24µs+30µs) by Mail::SpamAssassin::Logger::Stderr::BEGIN@37 at line 3
use warnings;
# spent 54µs making 1 call to POSIX::BEGIN@3 # spent 30µs making 1 call to warnings::import
4
5our ($AUTOLOAD, %SIGRT);
6
712µsour $VERSION = '1.65_01';
8
912µsrequire XSLoader;
10
111299µs
# spent 4.69ms (1.09+3.60) within POSIX::BEGIN@11 which was called: # once (1.09ms+3.60ms) by Mail::SpamAssassin::Logger::Stderr::BEGIN@37 at line 17
use Fcntl qw(FD_CLOEXEC F_DUPFD F_GETFD F_GETFL F_GETLK F_RDLCK F_SETFD
12 F_SETFL F_SETLK F_SETLKW F_UNLCK F_WRLCK O_ACCMODE O_APPEND
13 O_CREAT O_EXCL O_NOCTTY O_NONBLOCK O_RDONLY O_RDWR O_TRUNC
14 O_WRONLY SEEK_CUR SEEK_END SEEK_SET
15 S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG
16 S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU S_ISGID S_ISUID
1711.27ms27.78ms S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR);
# spent 4.69ms making 1 call to POSIX::BEGIN@11 # spent 3.10ms making 1 call to Exporter::import
18
1912µsmy $loaded;
20
21
# spent 14.6ms (310µs+14.3) within POSIX::import which was called 6 times, avg 2.44ms/call: # once (124µs+13.0ms) by Mail::SpamAssassin::Util::BEGIN@79 at line 80 of Mail/SpamAssassin/Util.pm # once (38µs+720µs) by Mail::SpamAssassin::PerMsgStatus::BEGIN@36 at line 36 of Mail/SpamAssassin/Dns.pm # once (40µs+200µs) by Sys::Syslog::BEGIN@8 at line 8 of Sys/Syslog.pm # once (38µs+160µs) by Razor2::Logger::BEGIN@8 at line 8 of Razor2/Logger.pm # once (38µs+150µs) by Mail::SpamAssassin::Bayes::Combine::BEGIN@36 at line 36 of Mail/SpamAssassin/Bayes/CombineChi.pm # once (31µs+140µs) by IO::Socket::IP::BEGIN@33 at line 33 of IO/Socket/IP.pm
sub import {
22616µs my $pkg = shift;
23
24622µs12.92ms load_imports() unless $loaded++;
# spent 2.92ms making 1 call to POSIX::load_imports
25
26 # Grandfather old foo_h form to new :foo_h form
276228µs1463µs s/^(?=\w+_h$)/:/ for my @list = @_;
# spent 63µs making 14 calls to POSIX::CORE:subst, avg 5µs/call
28
29614µs local $Exporter::ExportLevel = 1;
30696µs611.3ms Exporter::import($pkg,@list);
# spent 11.3ms making 6 calls to Exporter::import, avg 1.89ms/call
31}
32
33sub croak { require Carp; goto &Carp::croak }
34sub usage { croak "Usage: POSIX::$_[0]" }
35
3611.12ms11.10msXSLoader::load();
# spent 1.10ms making 1 call to XSLoader::load
37
38175µsmy %replacement = (
39 atexit => 'END {}',
40 atof => undef,
41 atoi => undef,
42 atol => undef,
43 bsearch => \'not supplied',
44 calloc => undef,
45 clearerr => 'IO::Handle::clearerr',
46 div => '/, % and int',
47 execl => undef,
48 execle => undef,
49 execlp => undef,
50 execv => undef,
51 execve => undef,
52 execvp => undef,
53 fclose => 'IO::Handle::close',
54 fdopen => 'IO::Handle::new_from_fd',
55 feof => 'IO::Handle::eof',
56 ferror => 'IO::Handle::error',
57 fflush => 'IO::Handle::flush',
58 fgetc => 'IO::Handle::getc',
59 fgetpos => 'IO::Seekable::getpos',
60 fgets => 'IO::Handle::gets',
61 fileno => 'IO::Handle::fileno',
62 fopen => 'IO::File::open',
63 fprintf => 'printf',
64 fputc => 'print',
65 fputs => 'print',
66 fread => 'read',
67 free => undef,
68 freopen => 'open',
69 fscanf => '<> and regular expressions',
70 fseek => 'IO::Seekable::seek',
71 fsetpos => 'IO::Seekable::setpos',
72 fsync => 'IO::Handle::sync',
73 ftell => 'IO::Seekable::tell',
74 fwrite => 'print',
75 labs => 'abs',
76 ldiv => '/, % and int',
77 longjmp => 'die',
78 malloc => undef,
79 memchr => 'index()',
80 memcmp => 'eq',
81 memcpy => '=',
82 memmove => '=',
83 memset => 'x',
84 offsetof => undef,
85 putc => 'print',
86 putchar => 'print',
87 puts => 'print',
88 qsort => 'sort',
89 rand => \'non-portable, use Perl\'s rand instead',
90 realloc => undef,
91 scanf => '<> and regular expressions',
92 setbuf => 'IO::Handle::setbuf',
93 setjmp => 'eval {}',
94 setvbuf => 'IO::Handle::setvbuf',
95 siglongjmp => 'die',
96 sigsetjmp => 'eval {}',
97 srand => \'not supplied; refer to Perl\'s srand documentation',
98 sscanf => 'regular expressions',
99 strcat => '.=',
100 strchr => 'index()',
101 strcmp => 'eq',
102 strcpy => '=',
103 strcspn => 'regular expressions',
104 strlen => 'length',
105 strncat => '.=',
106 strncmp => 'eq',
107 strncpy => '=',
108 strpbrk => undef,
109 strrchr => 'rindex()',
110 strspn => undef,
111 strtok => undef,
112 tmpfile => 'IO::File::new_tmpfile',
113 ungetc => 'IO::Handle::ungetc',
114 vfprintf => undef,
115 vprintf => undef,
116 vsprintf => undef,
117);
118
119156µsmy %reimpl = (
120 assert => 'expr => croak "Assertion failed" if !$_[0]',
121 tolower => 'string => lc($_[0])',
122 toupper => 'string => uc($_[0])',
123 closedir => 'dirhandle => CORE::closedir($_[0])',
124 opendir => 'directory => my $dh; CORE::opendir($dh, $_[0]) ? $dh : undef',
125 readdir => 'dirhandle => CORE::readdir($_[0])',
126 rewinddir => 'dirhandle => CORE::rewinddir($_[0])',
127 errno => '$! + 0',
128 creat => 'filename, mode => &open($_[0], &O_WRONLY | &O_CREAT | &O_TRUNC, $_[1])',
129 fcntl => 'filehandle, cmd, arg => CORE::fcntl($_[0], $_[1], $_[2])',
130 getgrgid => 'gid => CORE::getgrgid($_[0])',
131 getgrnam => 'name => CORE::getgrnam($_[0])',
132 atan2 => 'x, y => CORE::atan2($_[0], $_[1])',
133 cos => 'x => CORE::cos($_[0])',
134 exp => 'x => CORE::exp($_[0])',
135 fabs => 'x => CORE::abs($_[0])',
136 log => 'x => CORE::log($_[0])',
137 pow => 'x, exponent => $_[0] ** $_[1]',
138 sin => 'x => CORE::sin($_[0])',
139 sqrt => 'x => CORE::sqrt($_[0])',
140 getpwnam => 'name => CORE::getpwnam($_[0])',
141 getpwuid => 'uid => CORE::getpwuid($_[0])',
142 kill => 'pid, sig => CORE::kill $_[1], $_[0]',
143 raise => 'sig => CORE::kill $_[0], $$; # Is this good enough',
144 getc => 'handle => CORE::getc($_[0])',
145 getchar => 'CORE::getc(STDIN)',
146 gets => 'scalar <STDIN>',
147 remove => 'filename => (-d $_[0]) ? CORE::rmdir($_[0]) : CORE::unlink($_[0])',
148 rename => 'oldfilename, newfilename => CORE::rename($_[0], $_[1])',
149 rewind => 'filehandle => CORE::seek($_[0],0,0)',
150 abs => 'x => CORE::abs($_[0])',
151 exit => 'status => CORE::exit($_[0])',
152 getenv => 'name => $ENV{$_[0]}',
153 system => 'command => CORE::system($_[0])',
154 strerror => 'errno => BEGIN { local $!; require locale; locale->import} my $e = $_[0] + 0; local $!; $! = $e; "$!"',
155 strstr => 'big, little => CORE::index($_[0], $_[1])',
156 chmod => 'mode, filename => CORE::chmod($_[0], $_[1])',
157 fstat => 'fd => CORE::open my $dup, "<&", $_[0]; CORE::stat($dup)', # Gross.
158 mkdir => 'directoryname, mode => CORE::mkdir($_[0], $_[1])',
159 stat => 'filename => CORE::stat($_[0])',
160 umask => 'mask => CORE::umask($_[0])',
161 wait => 'CORE::wait()',
162 waitpid => 'pid, options => CORE::waitpid($_[0], $_[1])',
163 gmtime => 'time => CORE::gmtime($_[0])',
164 localtime => 'time => CORE::localtime($_[0])',
165 time => 'CORE::time',
166 alarm => 'seconds => CORE::alarm($_[0])',
167 chdir => 'directory => CORE::chdir($_[0])',
168 chown => 'uid, gid, filename => CORE::chown($_[0], $_[1], $_[2])',
169 fork => 'CORE::fork',
170 getegid => '$) + 0',
171 geteuid => '$> + 0',
172 getgid => '$( + 0',
173 getgroups => 'my %seen; grep !$seen{$_}++, split " ", $)',
174 getlogin => 'CORE::getlogin()',
175 getpgrp => 'CORE::getpgrp',
176 getpid => '$$',
177 getppid => 'CORE::getppid',
178 getuid => '$<',
179 isatty => 'filehandle => -t $_[0]',
180 link => 'oldfilename, newfilename => CORE::link($_[0], $_[1])',
181 rmdir => 'directoryname => CORE::rmdir($_[0])',
182 unlink => 'filename => CORE::unlink($_[0])',
183 utime => 'filename, atime, mtime => CORE::utime($_[1], $_[2], $_[0])',
184);
185
18611.44mseval join ';', map "sub $_", keys %replacement, keys %reimpl;
187
188sub AUTOLOAD {
189 my ($func) = ($AUTOLOAD =~ /.*::(.*)/);
190
191 die "POSIX.xs has failed to load\n" if $func eq 'constant';
192
193 if (my $code = $reimpl{$func}) {
194 my ($num, $arg) = (0, '');
195 if ($code =~ s/^(.*?) *=> *//) {
196 $arg = $1;
197 $num = 1 + $arg =~ tr/,//;
198 }
199 # no warnings to be consistent with the old implementation, where each
200 # function was in its own little AutoSplit world:
201 eval qq{ sub $func {
202 no warnings;
203 usage "$func($arg)" if \@_ != $num;
204 $code
205 } };
20623.66ms262µs
# spent 45µs (28+17) within POSIX::BEGIN@206 which was called: # once (28µs+17µs) by Mail::SpamAssassin::Logger::Stderr::BEGIN@37 at line 206
no strict;
# spent 45µs making 1 call to POSIX::BEGIN@206 # spent 17µs making 1 call to strict::unimport
207 goto &$AUTOLOAD;
208 }
209 if (exists $replacement{$func}) {
210 my $how = $replacement{$func};
211 croak "Unimplemented: POSIX::$func() is C-specific, stopped"
212 unless defined $how;
213 croak "Unimplemented: POSIX::$func() is $$how" if ref $how;
214 croak "Use method $how() instead of POSIX::$func()" if $how =~ /::/;
215 croak "Unimplemented: POSIX::$func() is C-specific: use $how instead";
216 }
217
218 constant($func);
219}
220
221sub perror {
222 print STDERR "@_: " if @_;
223 print STDERR $!,"\n";
224}
225
226sub printf {
227 usage "printf(pattern, args...)" if @_ < 1;
228 CORE::printf STDOUT @_;
229}
230
231sub sprintf {
232 usage "sprintf(pattern, args...)" if @_ == 0;
233 CORE::sprintf(shift,@_);
234}
235
236
# spent 2.92ms within POSIX::load_imports which was called: # once (2.92ms+0s) by POSIX::import at line 24
sub load_imports {
2371287µsmy %default_export_tags = ( # cf. exports policy below
238
239 assert_h => [qw(assert NDEBUG)],
240
241 ctype_h => [qw(isalnum isalpha iscntrl isdigit isgraph islower
242 isprint ispunct isspace isupper isxdigit tolower toupper)],
243
244 dirent_h => [],
245
246 errno_h => [qw(E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN
247 EALREADY EBADF EBADMSG EBUSY ECANCELED ECHILD ECONNABORTED
248 ECONNREFUSED ECONNRESET EDEADLK EDESTADDRREQ EDOM EDQUOT EEXIST
249 EFAULT EFBIG EHOSTDOWN EHOSTUNREACH EIDRM EILSEQ EINPROGRESS
250 EINTR EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK EMSGSIZE
251 ENAMETOOLONG ENETDOWN ENETRESET ENETUNREACH ENFILE ENOBUFS
252 ENODATA ENODEV ENOENT ENOEXEC ENOLCK ENOLINK ENOMEM ENOMSG
253 ENOPROTOOPT ENOSPC ENOSR ENOSTR ENOSYS ENOTBLK ENOTCONN ENOTDIR
254 ENOTEMPTY ENOTRECOVERABLE ENOTSOCK ENOTSUP ENOTTY ENXIO
255 EOPNOTSUPP EOTHER EOVERFLOW EOWNERDEAD EPERM EPFNOSUPPORT EPIPE
256 EPROCLIM EPROTO EPROTONOSUPPORT EPROTOTYPE ERANGE EREMOTE
257 ERESTART EROFS ESHUTDOWN ESOCKTNOSUPPORT ESPIPE ESRCH ESTALE
258 ETIME ETIMEDOUT ETOOMANYREFS ETXTBSY EUSERS EWOULDBLOCK EXDEV
259 errno)],
260
261 fcntl_h => [qw(FD_CLOEXEC F_DUPFD F_GETFD F_GETFL F_GETLK F_RDLCK
262 F_SETFD F_SETFL F_SETLK F_SETLKW F_UNLCK F_WRLCK
263 O_ACCMODE O_APPEND O_CREAT O_EXCL O_NOCTTY O_NONBLOCK
264 O_RDONLY O_RDWR O_TRUNC O_WRONLY
265 creat
266 SEEK_CUR SEEK_END SEEK_SET
267 S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU
268 S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISGID S_ISREG S_ISUID
269 S_IWGRP S_IWOTH S_IWUSR)],
270
271 float_h => [qw(DBL_DIG DBL_EPSILON DBL_MANT_DIG
272 DBL_MAX DBL_MAX_10_EXP DBL_MAX_EXP
273 DBL_MIN DBL_MIN_10_EXP DBL_MIN_EXP
274 FLT_DIG FLT_EPSILON FLT_MANT_DIG
275 FLT_MAX FLT_MAX_10_EXP FLT_MAX_EXP
276 FLT_MIN FLT_MIN_10_EXP FLT_MIN_EXP
277 FLT_RADIX FLT_ROUNDS
278 LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG
279 LDBL_MAX LDBL_MAX_10_EXP LDBL_MAX_EXP
280 LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP)],
281
282 grp_h => [],
283
284 limits_h => [qw( ARG_MAX CHAR_BIT CHAR_MAX CHAR_MIN CHILD_MAX
285 INT_MAX INT_MIN LINK_MAX LONG_MAX LONG_MIN MAX_CANON
286 MAX_INPUT MB_LEN_MAX NAME_MAX NGROUPS_MAX OPEN_MAX
287 PATH_MAX PIPE_BUF SCHAR_MAX SCHAR_MIN SHRT_MAX SHRT_MIN
288 SSIZE_MAX STREAM_MAX TZNAME_MAX UCHAR_MAX UINT_MAX
289 ULONG_MAX USHRT_MAX _POSIX_ARG_MAX _POSIX_CHILD_MAX
290 _POSIX_LINK_MAX _POSIX_MAX_CANON _POSIX_MAX_INPUT
291 _POSIX_NAME_MAX _POSIX_NGROUPS_MAX _POSIX_OPEN_MAX
292 _POSIX_PATH_MAX _POSIX_PIPE_BUF _POSIX_SSIZE_MAX
293 _POSIX_STREAM_MAX _POSIX_TZNAME_MAX)],
294
295 locale_h => [qw(LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES
296 LC_MONETARY LC_NUMERIC LC_TIME NULL
297 localeconv setlocale)],
298
299 math_h => [qw(FP_ILOGB0 FP_ILOGBNAN FP_INFINITE FP_NAN FP_NORMAL
300 FP_SUBNORMAL FP_ZERO
301 M_1_PI M_2_PI M_2_SQRTPI M_E M_LN10 M_LN2 M_LOG10E M_LOG2E
302 M_PI M_PI_2 M_PI_4 M_SQRT1_2 M_SQRT2
303 HUGE_VAL INFINITY NAN
304 acos asin atan ceil cosh fabs floor fmod
305 frexp ldexp log10 modf pow sinh tan tanh)],
306
307 pwd_h => [],
308
309 setjmp_h => [qw(longjmp setjmp siglongjmp sigsetjmp)],
310
311 signal_h => [qw(SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK
312 SA_RESETHAND SA_RESTART SA_SIGINFO SIGABRT SIGALRM
313 SIGCHLD SIGCONT SIGFPE SIGHUP SIGILL SIGINT SIGKILL
314 SIGPIPE %SIGRT SIGRTMIN SIGRTMAX SIGQUIT SIGSEGV SIGSTOP
315 SIGTERM SIGTSTP SIGTTIN SIGTTOU SIGUSR1 SIGUSR2 SIGBUS
316 SIGPOLL SIGPROF SIGSYS SIGTRAP SIGURG SIGVTALRM SIGXCPU SIGXFSZ
317 SIG_BLOCK SIG_DFL SIG_ERR SIG_IGN SIG_SETMASK SIG_UNBLOCK
318 raise sigaction signal sigpending sigprocmask sigsuspend)],
319
320 stdarg_h => [],
321
322 stddef_h => [qw(NULL offsetof)],
323
324 stdio_h => [qw(BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid
325 L_tmpname NULL SEEK_CUR SEEK_END SEEK_SET
326 STREAM_MAX TMP_MAX stderr stdin stdout
327 clearerr fclose fdopen feof ferror fflush fgetc fgetpos
328 fgets fopen fprintf fputc fputs fread freopen
329 fscanf fseek fsetpos ftell fwrite getchar gets
330 perror putc putchar puts remove rewind
331 scanf setbuf setvbuf sscanf tmpfile tmpnam
332 ungetc vfprintf vprintf vsprintf)],
333
334 stdlib_h => [qw(EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX NULL RAND_MAX
335 abort atexit atof atoi atol bsearch calloc div
336 free getenv labs ldiv malloc mblen mbstowcs mbtowc
337 qsort realloc strtod strtol strtoul wcstombs wctomb)],
338
339 string_h => [qw(NULL memchr memcmp memcpy memmove memset strcat
340 strchr strcmp strcoll strcpy strcspn strerror strlen
341 strncat strncmp strncpy strpbrk strrchr strspn strstr
342 strtok strxfrm)],
343
344 sys_stat_h => [qw(S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU
345 S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISGID S_ISREG
346 S_ISUID S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR
347 fstat mkfifo)],
348
349 sys_times_h => [],
350
351 sys_types_h => [],
352
353 sys_utsname_h => [qw(uname)],
354
355 sys_wait_h => [qw(WEXITSTATUS WIFEXITED WIFSIGNALED WIFSTOPPED
356 WNOHANG WSTOPSIG WTERMSIG WUNTRACED)],
357
358 termios_h => [qw( B0 B110 B1200 B134 B150 B1800 B19200 B200 B2400
359 B300 B38400 B4800 B50 B600 B75 B9600 BRKINT CLOCAL
360 CREAD CS5 CS6 CS7 CS8 CSIZE CSTOPB ECHO ECHOE ECHOK
361 ECHONL HUPCL ICANON ICRNL IEXTEN IGNBRK IGNCR IGNPAR
362 INLCR INPCK ISIG ISTRIP IXOFF IXON NCCS NOFLSH OPOST
363 PARENB PARMRK PARODD TCIFLUSH TCIOFF TCIOFLUSH TCION
364 TCOFLUSH TCOOFF TCOON TCSADRAIN TCSAFLUSH TCSANOW
365 TOSTOP VEOF VEOL VERASE VINTR VKILL VMIN VQUIT VSTART
366 VSTOP VSUSP VTIME
367 cfgetispeed cfgetospeed cfsetispeed cfsetospeed tcdrain
368 tcflow tcflush tcgetattr tcsendbreak tcsetattr )],
369
370 time_h => [qw(CLK_TCK CLOCKS_PER_SEC NULL asctime clock ctime
371 difftime mktime strftime tzset tzname)],
372
373 unistd_h => [qw(F_OK NULL R_OK SEEK_CUR SEEK_END SEEK_SET
374 STDERR_FILENO STDIN_FILENO STDOUT_FILENO W_OK X_OK
375 _PC_CHOWN_RESTRICTED _PC_LINK_MAX _PC_MAX_CANON
376 _PC_MAX_INPUT _PC_NAME_MAX _PC_NO_TRUNC _PC_PATH_MAX
377 _PC_PIPE_BUF _PC_VDISABLE _POSIX_CHOWN_RESTRICTED
378 _POSIX_JOB_CONTROL _POSIX_NO_TRUNC _POSIX_SAVED_IDS
379 _POSIX_VDISABLE _POSIX_VERSION _SC_ARG_MAX
380 _SC_CHILD_MAX _SC_CLK_TCK _SC_JOB_CONTROL
381 _SC_NGROUPS_MAX _SC_OPEN_MAX _SC_PAGESIZE _SC_SAVED_IDS
382 _SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION
383 _exit access ctermid cuserid
384 dup2 dup execl execle execlp execv execve execvp
385 fpathconf fsync getcwd getegid geteuid getgid getgroups
386 getpid getuid isatty lseek pathconf pause setgid setpgid
387 setsid setuid sysconf tcgetpgrp tcsetpgrp ttyname)],
388
389 utime_h => [],
390);
391
39215µsif ($^O eq 'MSWin32') {
393 $default_export_tags{winsock_h} = [qw(
394 WSAEINTR WSAEBADF WSAEACCES WSAEFAULT WSAEINVAL WSAEMFILE WSAEWOULDBLOCK
395 WSAEINPROGRESS WSAEALREADY WSAENOTSOCK WSAEDESTADDRREQ WSAEMSGSIZE
396 WSAEPROTOTYPE WSAENOPROTOOPT WSAEPROTONOSUPPORT WSAESOCKTNOSUPPORT
397 WSAEOPNOTSUPP WSAEPFNOSUPPORT WSAEAFNOSUPPORT WSAEADDRINUSE
398 WSAEADDRNOTAVAIL WSAENETDOWN WSAENETUNREACH WSAENETRESET WSAECONNABORTED
399 WSAECONNRESET WSAENOBUFS WSAEISCONN WSAENOTCONN WSAESHUTDOWN
400 WSAETOOMANYREFS WSAETIMEDOUT WSAECONNREFUSED WSAELOOP WSAENAMETOOLONG
401 WSAEHOSTDOWN WSAEHOSTUNREACH WSAENOTEMPTY WSAEPROCLIM WSAEUSERS
402 WSAEDQUOT WSAESTALE WSAEREMOTE WSAEDISCON WSAENOMORE WSAECANCELLED
403 WSAEINVALIDPROCTABLE WSAEINVALIDPROVIDER WSAEPROVIDERFAILEDINIT
404 WSAEREFUSED)];
405}
406
407my %other_export_tags = ( # cf. exports policy below
408 fenv_h => [qw(
409 FE_DOWNWARD FE_TONEAREST FE_TOWARDZERO FE_UPWARD fegetround fesetround
410 )],
411
41213µs math_h_c99 => [ @{$default_export_tags{math_h}}, qw(
413 Inf NaN acosh asinh atanh cbrt copysign erf erfc exp2 expm1 fdim fma
414 fmax fmin fpclassify hypot ilogb isfinite isgreater isgreaterequal
415 isinf isless islessequal islessgreater isnan isnormal isunordered j0 j1
416 jn lgamma log1p log2 logb lrint nan nearbyint nextafter nexttoward
417 remainder remquo rint round scalbn signbit tgamma trunc y0 y1 yn
418 )],
419
420271µs stdlib_h_c99 => [ @{$default_export_tags{stdlib_h}}, 'strtold' ],
421
422 nan_payload => [ qw(getpayload setpayload setpayloadsig issignaling) ],
423
424 signal_h_si_code => [qw(
425 ILL_ILLOPC ILL_ILLOPN ILL_ILLADR ILL_ILLTRP ILL_PRVOPC ILL_PRVREG
426 ILL_COPROC ILL_BADSTK
427 FPE_INTDIV FPE_INTOVF FPE_FLTDIV FPE_FLTOVF FPE_FLTUND
428 FPE_FLTRES FPE_FLTINV FPE_FLTSUB
429 SEGV_MAPERR SEGV_ACCERR
430 BUS_ADRALN BUS_ADRERR BUS_OBJERR
431 TRAP_BRKPT TRAP_TRACE
432 CLD_EXITED CLD_KILLED CLD_DUMPED CLD_TRAPPED CLD_STOPPED CLD_CONTINUED
433 POLL_IN POLL_OUT POLL_MSG POLL_ERR POLL_PRI POLL_HUP
434 SI_USER SI_QUEUE SI_TIMER SI_ASYNCIO SI_MESGQ
435 )],
436);
437
438# exports policy:
439# - new functions may not be added to @EXPORT, only to @EXPORT_OK
440# - new SHOUTYCONSTANTS are OK to add to @EXPORT
441
442{
443 # De-duplicate the export list:
44427µs my ( %export, %export_ok );
44528688µs @export {map {@$_} values %default_export_tags} = ();
4466132µs @export_ok{map {@$_} values %other_export_tags} = ();
447 # Doing the de-dup with a temporary hash has the advantage that the SVs in
448 # @EXPORT are actually shared hash key scalars, which will save some memory.
4491259µs our @EXPORT = keys %export;
450
451 # you do not want to add symbols to the following list. add a new tag instead
452 our @EXPORT_OK = (qw(close lchown nice open pipe read sleep times write
453 printf sprintf lround),
454 # lround() should really be in the :math_h_c99 tag, but
455 # we're too far into the 5.24 code freeze for that to be
456 # done now. This can be revisited in the 5.25.x cycle.
4573121.39ms grep {!exists $export{$_}} keys %reimpl, keys %replacement, keys %export_ok);
458
459175µs our %EXPORT_TAGS = ( %default_export_tags, %other_export_tags );
460}
461
462118µsrequire Exporter;
463}
464
465package POSIX::SigAction;
466
467sub new { bless {HANDLER => $_[1], MASK => $_[2], FLAGS => $_[3] || 0, SAFE => 0}, $_[0] }
468sub handler { $_[0]->{HANDLER} = $_[1] if @_ > 1; $_[0]->{HANDLER} };
469sub mask { $_[0]->{MASK} = $_[1] if @_ > 1; $_[0]->{MASK} };
470sub flags { $_[0]->{FLAGS} = $_[1] if @_ > 1; $_[0]->{FLAGS} };
471sub safe { $_[0]->{SAFE} = $_[1] if @_ > 1; $_[0]->{SAFE} };
472
473{
474114µspackage POSIX::SigSet;
475# This package is here entirely to make sure that POSIX::SigSet is seen by the
476# PAUSE indexer, so that it will always be clearly indexed in core. This is to
477# prevent the accidental case where a third-party distribution can accidentally
478# claim the POSIX::SigSet package, as occurred in 2011-12. -- rjbs, 2011-12-30
479}
480
481package POSIX::SigRt;
482
4831567µsrequire Tie::Hash;
484
485116µsour @ISA = 'Tie::StdHash';
486
487our ($_SIGRTMIN, $_SIGRTMAX, $_sigrtn);
488
48912µsour $SIGACTION_FLAGS = 0;
490
491sub _init {
492 $_SIGRTMIN = &POSIX::SIGRTMIN;
493 $_SIGRTMAX = &POSIX::SIGRTMAX;
494 $_sigrtn = $_SIGRTMAX - $_SIGRTMIN;
495}
496
497sub _croak {
498 &_init unless defined $_sigrtn;
499 die "POSIX::SigRt not available" unless defined $_sigrtn && $_sigrtn > 0;
500}
501
502sub _getsig {
503 &_croak;
504 my $rtsig = $_[0];
505 # Allow (SIGRT)?MIN( + n)?, a common idiom when doing these things in C.
506 $rtsig = $_SIGRTMIN + ($1 || 0)
507 if $rtsig =~ /^(?:(?:SIG)?RT)?MIN(\s*\+\s*(\d+))?$/;
508 return $rtsig;
509}
510
511sub _exist {
512 my $rtsig = _getsig($_[1]);
513 my $ok = $rtsig >= $_SIGRTMIN && $rtsig <= $_SIGRTMAX;
514 ($rtsig, $ok);
515}
516
517sub _check {
518 my ($rtsig, $ok) = &_exist;
519 die "No POSIX::SigRt signal $_[1] (valid range SIGRTMIN..SIGRTMAX, or $_SIGRTMIN..$_SIGRTMAX)"
520 unless $ok;
521 return $rtsig;
522}
523
524sub new {
525 my ($rtsig, $handler, $flags) = @_;
526 my $sigset = POSIX::SigSet->new($rtsig);
527 my $sigact = POSIX::SigAction->new($handler, $sigset, $flags);
528 POSIX::sigaction($rtsig, $sigact);
529}
530
531sub EXISTS { &_exist }
532sub FETCH { my $rtsig = &_check;
533 my $oa = POSIX::SigAction->new();
534 POSIX::sigaction($rtsig, undef, $oa);
535 return $oa->{HANDLER} }
536sub STORE { my $rtsig = &_check; new($rtsig, $_[2], $SIGACTION_FLAGS) }
537sub DELETE { delete $SIG{ &_check } }
538sub CLEAR { &_exist; delete @SIG{ &POSIX::SIGRTMIN .. &POSIX::SIGRTMAX } }
539sub SCALAR { &_croak; $_sigrtn + 1 }
540
5411109µs110µstie %POSIX::SIGRT, 'POSIX::SigRt';
# spent 10µs making 1 call to Tie::StdHash::TIEHASH
542# and the expression on the line above is true, so we return true.
 
# spent 63µs within POSIX::CORE:subst which was called 14 times, avg 5µs/call: # 14 times (63µs+0s) by POSIX::import at line 27, avg 5µs/call
sub POSIX::CORE:subst; # opcode