Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1984 lines
51 KiB

  1. =head1 NAME
  2. POSIX - Perl interface to IEEE Std 1003.1
  3. =head1 SYNOPSIS
  4. use POSIX;
  5. use POSIX qw(setsid);
  6. use POSIX qw(:errno_h :fcntl_h);
  7. printf "EINTR is %d\n", EINTR;
  8. $sess_id = POSIX::setsid();
  9. $fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644);
  10. # note: that's a filedescriptor, *NOT* a filehandle
  11. =head1 DESCRIPTION
  12. The POSIX module permits you to access all (or nearly all) the standard
  13. POSIX 1003.1 identifiers. Many of these identifiers have been given Perl-ish
  14. interfaces. Things which are C<#defines> in C, like EINTR or O_NDELAY, are
  15. automatically exported into your namespace. All functions are only exported
  16. if you ask for them explicitly. Most likely people will prefer to use the
  17. fully-qualified function names.
  18. This document gives a condensed list of the features available in the POSIX
  19. module. Consult your operating system's manpages for general information on
  20. most features. Consult L<perlfunc> for functions which are noted as being
  21. identical to Perl's builtin functions.
  22. The first section describes POSIX functions from the 1003.1 specification.
  23. The second section describes some classes for signal objects, TTY objects,
  24. and other miscellaneous objects. The remaining sections list various
  25. constants and macros in an organization which roughly follows IEEE Std
  26. 1003.1b-1993.
  27. =head1 NOTE
  28. The POSIX module is probably the most complex Perl module supplied with
  29. the standard distribution. It incorporates autoloading, namespace games,
  30. and dynamic loading of code that's in Perl, C, or both. It's a great
  31. source of wisdom.
  32. =head1 CAVEATS
  33. A few functions are not implemented because they are C specific. If you
  34. attempt to call these, they will print a message telling you that they
  35. aren't implemented, and suggest using the Perl equivalent should one
  36. exist. For example, trying to access the setjmp() call will elicit the
  37. message "setjmp() is C-specific: use eval {} instead".
  38. Furthermore, some evil vendors will claim 1003.1 compliance, but in fact
  39. are not so: they will not pass the PCTS (POSIX Compliance Test Suites).
  40. For example, one vendor may not define EDEADLK, or the semantics of the
  41. errno values set by open(2) might not be quite right. Perl does not
  42. attempt to verify POSIX compliance. That means you can currently
  43. successfully say "use POSIX", and then later in your program you find
  44. that your vendor has been lax and there's no usable ICANON macro after
  45. all. This could be construed to be a bug.
  46. =head1 FUNCTIONS
  47. =over 8
  48. =item _exit
  49. This is identical to the C function C<_exit()>. It exits the program
  50. immediately which means among other things buffered I/O is B<not> flushed.
  51. =item abort
  52. This is identical to the C function C<abort()>. It terminates the
  53. process with a C<SIGABRT> signal unless caught by a signal handler or
  54. if the handler does not return normally (it e.g. does a C<longjmp>).
  55. =item abs
  56. This is identical to Perl's builtin C<abs()> function, returning
  57. the absolute value of its numerical argument.
  58. =item access
  59. Determines the accessibility of a file.
  60. if( POSIX::access( "/", &POSIX::R_OK ) ){
  61. print "have read permission\n";
  62. }
  63. Returns C<undef> on failure. Note: do not use C<access()> for
  64. security purposes. Between the C<access()> call and the operation
  65. you are preparing for the permissions might change: a classic
  66. I<race condition>.
  67. =item acos
  68. This is identical to the C function C<acos()>, returning
  69. the arcus cosine of its numerical argument. See also L<Math::Trig>.
  70. =item alarm
  71. This is identical to Perl's builtin C<alarm()> function,
  72. either for arming or disarming the C<SIGARLM> timer.
  73. =item asctime
  74. This is identical to the C function C<asctime()>. It returns
  75. a string of the form
  76. "Fri Jun 2 18:22:13 2000\n\0"
  77. and it is called thusly
  78. $asctime = asctime($sec, $min, $hour, $mday, $mon, $year,
  79. $wday, $yday, $isdst);
  80. The C<$mon> is zero-based: January equals C<0>. The C<$year> is
  81. 1900-based: 2001 equals C<101>. The C<$wday>, C<$yday>, and C<$isdst>
  82. default to zero (and the first two are usually ignored anyway).
  83. =item asin
  84. This is identical to the C function C<asin()>, returning
  85. the arcus sine of its numerical argument. See also L<Math::Trig>.
  86. =item assert
  87. Unimplemented, but you can use L<perlfunc/die> and the L<Carp> module
  88. to achieve similar things.
  89. =item atan
  90. This is identical to the C function C<atan()>, returning the
  91. arcus tangent of its numerical argument. See also L<Math::Trig>.
  92. =item atan2
  93. This is identical to Perl's builtin C<atan2()> function, returning
  94. the arcus tangent defined by its two numerical arguments, the I<y>
  95. coordinate and the I<x> coordinate. See also L<Math::Trig>.
  96. =item atexit
  97. atexit() is C-specific: use C<END {}> instead, see L<perlsub>.
  98. =item atof
  99. atof() is C-specific. Perl converts strings to numbers transparently.
  100. If you need to force a scalar to a number, add a zero to it.
  101. =item atoi
  102. atoi() is C-specific. Perl converts strings to numbers transparently.
  103. If you need to force a scalar to a number, add a zero to it.
  104. If you need to have just the integer part, see L<perlfunc/int>.
  105. =item atol
  106. atol() is C-specific. Perl converts strings to numbers transparently.
  107. If you need to force a scalar to a number, add a zero to it.
  108. If you need to have just the integer part, see L<perlfunc/int>.
  109. =item bsearch
  110. bsearch() not supplied. For doing binary search on wordlists,
  111. see L<Search::Dict>.
  112. =item calloc
  113. calloc() is C-specific. Perl does memory management transparently.
  114. =item ceil
  115. This is identical to the C function C<ceil()>, returning the smallest
  116. integer value greater than or equal to the given numerical argument.
  117. =item chdir
  118. This is identical to Perl's builtin C<chdir()> function, allowing
  119. one to change the working (default) directory, see L<perlfunc/chdir>.
  120. =item chmod
  121. This is identical to Perl's builtin C<chmod()> function, allowing
  122. one to change file and directory permissions, see L<perlfunc/chmod>.
  123. =item chown
  124. This is identical to Perl's builtin C<chown()> function, allowing one
  125. to change file and directory owners and groups, see L<perlfunc/chown>.
  126. =item clearerr
  127. Use the method L<IO::Handle::clearerr()> instead, to reset the error
  128. state (if any) and EOF state (if any) of the given stream.
  129. =item clock
  130. This is identical to the C function C<clock()>, returning the
  131. amount of spent processor time in microseconds.
  132. =item close
  133. Close the file. This uses file descriptors such as those obtained by calling
  134. C<POSIX::open>.
  135. $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
  136. POSIX::close( $fd );
  137. Returns C<undef> on failure.
  138. See also L<perlfunc/close>.
  139. =item closedir
  140. This is identical to Perl's builtin C<closedir()> function for closing
  141. a directory handle, see L<perlfunc/closedir>.
  142. =item cos
  143. This is identical to Perl's builtin C<cos()> function, for returning
  144. the cosine of its numerical argument, see L<perlfunc/cos>.
  145. See also L<Math::Trig>.
  146. =item cosh
  147. This is identical to the C function C<cosh()>, for returning
  148. the hyperbolic cosine of its numeric argument. See also L<Math::Trig>.
  149. =item creat
  150. Create a new file. This returns a file descriptor like the ones returned by
  151. C<POSIX::open>. Use C<POSIX::close> to close the file.
  152. $fd = POSIX::creat( "foo", 0611 );
  153. POSIX::close( $fd );
  154. See also L<perlfunc/sysopen> and its C<O_CREAT> flag.
  155. =item ctermid
  156. Generates the path name for the controlling terminal.
  157. $path = POSIX::ctermid();
  158. =item ctime
  159. This is identical to the C function C<ctime()> and equivalent
  160. to C<asctime(localtime(...))>, see L</asctime> and L</localtime>.
  161. =item cuserid
  162. Get the login name of the owner of the current process.
  163. $name = POSIX::cuserid();
  164. =item difftime
  165. This is identical to the C function C<difftime()>, for returning
  166. the time difference (in seconds) between two times (as returned
  167. by C<time()>), see L</time>.
  168. =item div
  169. div() is C-specific, use L<perlfunc/int> on the usual C</> division and
  170. the modulus C<%>.
  171. =item dup
  172. This is similar to the C function C<dup()>, for duplicating a file
  173. descriptor.
  174. This uses file descriptors such as those obtained by calling
  175. C<POSIX::open>.
  176. Returns C<undef> on failure.
  177. =item dup2
  178. This is similar to the C function C<dup2()>, for duplicating a file
  179. descriptor to an another known file descriptor.
  180. This uses file descriptors such as those obtained by calling
  181. C<POSIX::open>.
  182. Returns C<undef> on failure.
  183. =item errno
  184. Returns the value of errno.
  185. $errno = POSIX::errno();
  186. This identical to the numerical values of the C<$!>, see L<perlvar/$ERRNO>.
  187. =item execl
  188. execl() is C-specific, see L<perlfunc/exec>.
  189. =item execle
  190. execle() is C-specific, see L<perlfunc/exec>.
  191. =item execlp
  192. execlp() is C-specific, see L<perlfunc/exec>.
  193. =item execv
  194. execv() is C-specific, see L<perlfunc/exec>.
  195. =item execve
  196. execve() is C-specific, see L<perlfunc/exec>.
  197. =item execvp
  198. execvp() is C-specific, see L<perlfunc/exec>.
  199. =item exit
  200. This is identical to Perl's builtin C<exit()> function for exiting the
  201. program, see L<perlfunc/exit>.
  202. =item exp
  203. This is identical to Perl's builtin C<exp()> function for
  204. returning the exponent (I<e>-based) of the numerical argument,
  205. see L<perlfunc/exp>.
  206. =item fabs
  207. This is identical to Perl's builtin C<abs()> function for returning
  208. the absolute value of the numerical argument, see L<perlfunc/abs>.
  209. =item fclose
  210. Use method C<IO::Handle::close()> instead, or see L<perlfunc/close>.
  211. =item fcntl
  212. This is identical to Perl's builtin C<fcntl()> function,
  213. see L<perlfunc/fcntl>.
  214. =item fdopen
  215. Use method C<IO::Handle::new_from_fd()> instead, or see L<perlfunc/open>.
  216. =item feof
  217. Use method C<IO::Handle::eof()> instead, or see L<perlfunc/eof>.
  218. =item ferror
  219. Use method C<IO::Handle::error()> instead.
  220. =item fflush
  221. Use method C<IO::Handle::flush()> instead.
  222. See also L<perlvar/$OUTPUT_AUTOFLUSH>.
  223. =item fgetc
  224. Use method C<IO::Handle::getc()> instead, or see L<perlfunc/read>.
  225. =item fgetpos
  226. Use method C<IO::Seekable::getpos()> instead, or see L<L/seek>.
  227. =item fgets
  228. Use method C<IO::Handle::gets()> instead. Similar to E<lt>E<gt>, also known
  229. as L<perlfunc/readline>.
  230. =item fileno
  231. Use method C<IO::Handle::fileno()> instead, or see L<perlfunc/fileno>.
  232. =item floor
  233. This is identical to the C function C<floor()>, returning the largest
  234. integer value less than or equal to the numerical argument.
  235. =item fmod
  236. This is identical to the C function C<fmod()>.
  237. $r = modf($x, $y);
  238. It returns the remainder C<$r = $x - $n*$y>, where C<$n = trunc($x/$y)>.
  239. The C<$r> has the same sign as C<$x> and magnitude (absolute value)
  240. less than the magnitude of C<$y>.
  241. =item fopen
  242. Use method C<IO::File::open()> instead, or see L<perlfunc/open>.
  243. =item fork
  244. This is identical to Perl's builtin C<fork()> function
  245. for duplicating the current process, see L<perlfunc/fork>
  246. and L<perlfork> if you are in Windows.
  247. =item fpathconf
  248. Retrieves the value of a configurable limit on a file or directory. This
  249. uses file descriptors such as those obtained by calling C<POSIX::open>.
  250. The following will determine the maximum length of the longest allowable
  251. pathname on the filesystem which holds C</tmp/foo>.
  252. $fd = POSIX::open( "/tmp/foo", &POSIX::O_RDONLY );
  253. $path_max = POSIX::fpathconf( $fd, &POSIX::_PC_PATH_MAX );
  254. Returns C<undef> on failure.
  255. =item fprintf
  256. fprintf() is C-specific, see L<perlfunc/printf> instead.
  257. =item fputc
  258. fputc() is C-specific, see L<perlfunc/print> instead.
  259. =item fputs
  260. fputs() is C-specific, see L<perlfunc/print> instead.
  261. =item fread
  262. fread() is C-specific, see L<perlfunc/read> instead.
  263. =item free
  264. free() is C-specific. Perl does memory management transparently.
  265. =item freopen
  266. freopen() is C-specific, see L<perlfunc/open> instead.
  267. =item frexp
  268. Return the mantissa and exponent of a floating-point number.
  269. ($mantissa, $exponent) = POSIX::frexp( 1.234e56 );
  270. =item fscanf
  271. fscanf() is C-specific, use E<lt>E<gt> and regular expressions instead.
  272. =item fseek
  273. Use method C<IO::Seekable::seek()> instead, or see L<perlfunc/seek>.
  274. =item fsetpos
  275. Use method C<IO::Seekable::setpos()> instead, or seek L<perlfunc/seek>.
  276. =item fstat
  277. Get file status. This uses file descriptors such as those obtained by
  278. calling C<POSIX::open>. The data returned is identical to the data from
  279. Perl's builtin C<stat> function.
  280. $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
  281. @stats = POSIX::fstat( $fd );
  282. =item ftell
  283. Use method C<IO::Seekable::tell()> instead, or see L<perlfunc/tell>.
  284. =item fwrite
  285. fwrite() is C-specific, see L<perlfunc/print> instead.
  286. =item getc
  287. This is identical to Perl's builtin C<getc()> function,
  288. see L<perlfunc/getc>.
  289. =item getchar
  290. Returns one character from STDIN. Identical to Perl's C<getc()>,
  291. see L<perlfunc/getc>.
  292. =item getcwd
  293. Returns the name of the current working directory.
  294. See also L<Cwd>.
  295. =item getegid
  296. Returns the effective group identifier. Similar to Perl' s builtin
  297. variable C<$(>, see L<perlvar/$EGID>.
  298. =item getenv
  299. Returns the value of the specified enironment variable.
  300. The same information is available through the C<%ENV> array.
  301. =item geteuid
  302. Returns the effective user identifier. Identical to Perl's builtin C<$E<gt>>
  303. variable, see L<perlvar/$EUID>.
  304. =item getgid
  305. Returns the user's real group identifier. Similar to Perl's builtin
  306. variable C<$)>, see L<perlvar/$GID>.
  307. =item getgrgid
  308. This is identical to Perl's builtin C<getgrgid()> function for
  309. returning group entries by group identifiers, see
  310. L<perlfunc/getgrgid>.
  311. =item getgrnam
  312. This is identical to Perl's builtin C<getgrnam()> function for
  313. returning group entries by group names, see L<perlfunc/getgrnam>.
  314. =item getgroups
  315. Returns the ids of the user's supplementary groups. Similar to Perl's
  316. builtin variable C<$)>, see L<perlvar/$GID>.
  317. =item getlogin
  318. This is identical to Perl's builtin C<getlogin()> function for
  319. returning the user name associated with the current session, see
  320. L<perlfunc/getlogin>.
  321. =item getpgrp
  322. This is identical to Perl's builtin C<getpgrp()> function for
  323. returning the prcess group identifier of the current process, see
  324. L<perlfunc/getpgrp>.
  325. =item getpid
  326. Returns the process identifier. Identical to Perl's builtin
  327. variable C<$$>, see L<perlvar/$PID>.
  328. =item getppid
  329. This is identical to Perl's builtin C<getppid()> function for
  330. returning the process identifier of the parent process of the current
  331. process , see L<perlfunc/getppid>.
  332. =item getpwnam
  333. This is identical to Perl's builtin C<getpwnam()> function for
  334. returning user entries by user names, see L<perlfunc/getpwnam>.
  335. =item getpwuid
  336. This is identical to Perl's builtin C<getpwuid()> function for
  337. returning user entries by user identifiers, see L<perlfunc/getpwuid>.
  338. =item gets
  339. Returns one line from C<STDIN>, similar to E<lt>E<gt>, also known
  340. as the C<readline()> function, see L<perlfunc/readline>.
  341. B<NOTE>: if you have C programs that still use C<gets()>, be very
  342. afraid. The C<gets()> function is a source of endless grief because
  343. it has no buffer overrun checks. It should B<never> be used. The
  344. C<fgets()> function should be preferred instead.
  345. =item getuid
  346. Returns the user's identifier. Identical to Perl's builtin C<$E<lt>> variable,
  347. see L<perlvar/$UID>.
  348. =item gmtime
  349. This is identical to Perl's builtin C<gmtime()> function for
  350. converting seconds since the epoch to a date in Greenwich Mean Time,
  351. see L<perlfunc/gmtime>.
  352. =item isalnum
  353. This is identical to the C function, except that it can apply to a single
  354. character or to a whole string. Consider using regular expressions and the
  355. C</[[:isalnum:]]/> construct instead, or possibly the C</\w/> construct.
  356. =item isalpha
  357. This is identical to the C function, except that it can apply to a single
  358. character or to a whole string. Consider using regular expressions and the
  359. C</[[:isalpha:]]/> construct instead.
  360. =item isatty
  361. Returns a boolean indicating whether the specified filehandle is connected
  362. to a tty. Similar to the C<-t> operator, see L<perlfunc/-X>.
  363. =item iscntrl
  364. This is identical to the C function, except that it can apply to a single
  365. character or to a whole string. Consider using regular expressions and the
  366. C</[[:iscntrl:]]/> construct instead.
  367. =item isdigit
  368. This is identical to the C function, except that it can apply to a single
  369. character or to a whole string. Consider using regular expressions and the
  370. C</[[:isdigit:]]/> construct instead, or the C</\d/> construct.
  371. =item isgraph
  372. This is identical to the C function, except that it can apply to a single
  373. character or to a whole string. Consider using regular expressions and the
  374. C</[[:isgraph:]]/> construct instead.
  375. =item islower
  376. This is identical to the C function, except that it can apply to a single
  377. character or to a whole string. Consider using regular expressions and the
  378. C</[[:islower:]]/> construct instead. Do B<not> use C</a-z/>.
  379. =item isprint
  380. This is identical to the C function, except that it can apply to a single
  381. character or to a whole string. Consider using regular expressions and the
  382. C</[[:isprint:]]/> construct instead.
  383. =item ispunct
  384. This is identical to the C function, except that it can apply to a single
  385. character or to a whole string. Consider using regular expressions and the
  386. C</[[:ispunct:]]/> construct instead.
  387. =item isspace
  388. This is identical to the C function, except that it can apply to a single
  389. character or to a whole string. Consider using regular expressions and the
  390. C</[[:isspace:]]/> construct instead, or the C</\s/> construct.
  391. =item isupper
  392. This is identical to the C function, except that it can apply to a single
  393. character or to a whole string. Consider using regular expressions and the
  394. C</[[:isupper:]]/> construct instead. Do B<not> use C</A-Z/>.
  395. =item isxdigit
  396. This is identical to the C function, except that it can apply to a single
  397. character or to a whole string. Consider using regular expressions and the
  398. C</[[:isxdigit:]]/> construct instead, or simply C</[0-9a-f]/i>.
  399. =item kill
  400. This is identical to Perl's builtin C<kill()> function for sending
  401. signals to processes (often to terminate them), see L<perlfunc/kill>.
  402. =item labs
  403. (For returning absolute values of long integers.)
  404. labs() is C-specific, see L<perlfunc/abs> instead.
  405. =item ldexp
  406. This is identical to the C function C<ldexp()>
  407. for multiplying floating point numbers with powers of two.
  408. $x_quadrupled = POSIX::ldexp($x, 2);
  409. =item ldiv
  410. (For computing dividends of long integers.)
  411. ldiv() is C-specific, use C</> and C<int()> instead.
  412. =item link
  413. This is identical to Perl's builtin C<link()> function
  414. for creating hard links into files, see L<perlfunc/link>.
  415. =item localeconv
  416. Get numeric formatting information. Returns a reference to a hash
  417. containing the current locale formatting values.
  418. Here is how to query the database for the B<de> (Deutsch or German) locale.
  419. $loc = POSIX::setlocale( &POSIX::LC_ALL, "de" );
  420. print "Locale = $loc\n";
  421. $lconv = POSIX::localeconv();
  422. print "decimal_point = ", $lconv->{decimal_point}, "\n";
  423. print "thousands_sep = ", $lconv->{thousands_sep}, "\n";
  424. print "grouping = ", $lconv->{grouping}, "\n";
  425. print "int_curr_symbol = ", $lconv->{int_curr_symbol}, "\n";
  426. print "currency_symbol = ", $lconv->{currency_symbol}, "\n";
  427. print "mon_decimal_point = ", $lconv->{mon_decimal_point}, "\n";
  428. print "mon_thousands_sep = ", $lconv->{mon_thousands_sep}, "\n";
  429. print "mon_grouping = ", $lconv->{mon_grouping}, "\n";
  430. print "positive_sign = ", $lconv->{positive_sign}, "\n";
  431. print "negative_sign = ", $lconv->{negative_sign}, "\n";
  432. print "int_frac_digits = ", $lconv->{int_frac_digits}, "\n";
  433. print "frac_digits = ", $lconv->{frac_digits}, "\n";
  434. print "p_cs_precedes = ", $lconv->{p_cs_precedes}, "\n";
  435. print "p_sep_by_space = ", $lconv->{p_sep_by_space}, "\n";
  436. print "n_cs_precedes = ", $lconv->{n_cs_precedes}, "\n";
  437. print "n_sep_by_space = ", $lconv->{n_sep_by_space}, "\n";
  438. print "p_sign_posn = ", $lconv->{p_sign_posn}, "\n";
  439. print "n_sign_posn = ", $lconv->{n_sign_posn}, "\n";
  440. =item localtime
  441. This is identical to Perl's builtin C<localtime()> function for
  442. converting seconds since the epoch to a date see L<perlfunc/localtime>.
  443. =item log
  444. This is identical to Perl's builtin C<log()> function,
  445. returning the natural (I<e>-based) logarithm of the numerical argument,
  446. see L<perlfunc/log>.
  447. =item log10
  448. This is identical to the C function C<log10()>,
  449. returning the 10-base logarithm of the numerical argument.
  450. You can also use
  451. sub log10 { log($_[0]) / log(10) }
  452. or
  453. sub log10 { log($_[0]) / 2.30258509299405 }
  454. or
  455. sub log10 { log($_[0]) * 0.434294481903252 }
  456. =item longjmp
  457. longjmp() is C-specific: use L<perlfunc/die> instead.
  458. =item lseek
  459. Move the file's read/write position. This uses file descriptors such as
  460. those obtained by calling C<POSIX::open>.
  461. $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
  462. $off_t = POSIX::lseek( $fd, 0, &POSIX::SEEK_SET );
  463. Returns C<undef> on failure.
  464. =item malloc
  465. malloc() is C-specific. Perl does memory management transparently.
  466. =item mblen
  467. This is identical to the C function C<mblen()>.
  468. Perl does not have any support for the wide and multibyte
  469. characters of the C standards, so this might be a rather
  470. useless function.
  471. =item mbstowcs
  472. This is identical to the C function C<mbstowcs()>.
  473. Perl does not have any support for the wide and multibyte
  474. characters of the C standards, so this might be a rather
  475. useless function.
  476. =item mbtowc
  477. This is identical to the C function C<mbtowc()>.
  478. Perl does not have any support for the wide and multibyte
  479. characters of the C standards, so this might be a rather
  480. useless function.
  481. =item memchr
  482. memchr() is C-specific, see L<perlfunc/index> instead.
  483. =item memcmp
  484. memcmp() is C-specific, use C<eq> instead, see L<perlop>.
  485. =item memcpy
  486. memcpy() is C-specific, use C<=>, see L<perlop>, or see L<perlfunc/substr>.
  487. =item memmove
  488. memmove() is C-specific, use C<=>, see L<perlop>, or see L<perlfunc/substr>.
  489. =item memset
  490. memset() is C-specific, use C<x> instead, see L<perlop>.
  491. =item mkdir
  492. This is identical to Perl's builtin C<mkdir()> function
  493. for creating directories, see L<perlfunc/mkdir>.
  494. =item mkfifo
  495. This is similar to the C function C<mkfifo()> for creating
  496. FIFO special files.
  497. if (mkfifo($path, $mode)) { ....
  498. Returns C<undef> on failure. The C<$mode> is similar to the
  499. mode of C<mkdir()>, see L<perlfunc/mkdir>.
  500. =item mktime
  501. Convert date/time info to a calendar time.
  502. Synopsis:
  503. mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
  504. The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero.
  505. I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The
  506. year (C<year>) is given in years since 1900. I.e. The year 1995 is 95; the
  507. year 2001 is 101. Consult your system's C<mktime()> manpage for details
  508. about these and the other arguments.
  509. Calendar time for December 12, 1995, at 10:30 am.
  510. $time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 );
  511. print "Date = ", POSIX::ctime($time_t);
  512. Returns C<undef> on failure.
  513. =item modf
  514. Return the integral and fractional parts of a floating-point number.
  515. ($fractional, $integral) = POSIX::modf( 3.14 );
  516. =item nice
  517. This is similar to the C function C<nice()>, for changing
  518. the scheduling preference of the current process. Positive
  519. arguments mean more polite process, negative values more
  520. needy process. Normal user processes can only be more polite.
  521. Returns C<undef> on failure.
  522. =item offsetof
  523. offsetof() is C-specific, you probably want to see L<perlfunc/pack> instead.
  524. =item open
  525. Open a file for reading for writing. This returns file descriptors, not
  526. Perl filehandles. Use C<POSIX::close> to close the file.
  527. Open a file read-only with mode 0666.
  528. $fd = POSIX::open( "foo" );
  529. Open a file for read and write.
  530. $fd = POSIX::open( "foo", &POSIX::O_RDWR );
  531. Open a file for write, with truncation.
  532. $fd = POSIX::open( "foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC );
  533. Create a new file with mode 0640. Set up the file for writing.
  534. $fd = POSIX::open( "foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0640 );
  535. Returns C<undef> on failure.
  536. See also L<perlfunc/sysopen>.
  537. =item opendir
  538. Open a directory for reading.
  539. $dir = POSIX::opendir( "/tmp" );
  540. @files = POSIX::readdir( $dir );
  541. POSIX::closedir( $dir );
  542. Returns C<undef> on failure.
  543. =item pathconf
  544. Retrieves the value of a configurable limit on a file or directory.
  545. The following will determine the maximum length of the longest allowable
  546. pathname on the filesystem which holds C</tmp>.
  547. $path_max = POSIX::pathconf( "/tmp", &POSIX::_PC_PATH_MAX );
  548. Returns C<undef> on failure.
  549. =item pause
  550. This is similar to the C function C<pause()>, which suspends
  551. the execution of the current process until a signal is received.
  552. Returns C<undef> on failure.
  553. =item perror
  554. This is identical to the C function C<perror()>, which outputs to the
  555. standard error stream the specified message followed by ": " and the
  556. current error string. Use the C<warn()> function and the C<$!>
  557. variable instead, see L<perlfunc/warn> and L<perlvar/$ERRNO>.
  558. =item pipe
  559. Create an interprocess channel. This returns file descriptors like those
  560. returned by C<POSIX::open>.
  561. ($fd0, $fd1) = POSIX::pipe();
  562. POSIX::write( $fd0, "hello", 5 );
  563. POSIX::read( $fd1, $buf, 5 );
  564. See also L<perlfunc/pipe>.
  565. =item pow
  566. Computes C<$x> raised to the power C<$exponent>.
  567. $ret = POSIX::pow( $x, $exponent );
  568. You can also use the C<**> operator, see L<perlop>.
  569. =item printf
  570. Formats and prints the specified arguments to STDOUT.
  571. See also L<perlfunc/printf>.
  572. =item putc
  573. putc() is C-specific, see L<perlfunc/print> instead.
  574. =item putchar
  575. putchar() is C-specific, see L<perlfunc/print> instead.
  576. =item puts
  577. puts() is C-specific, see L<perlfunc/print> instead.
  578. =item qsort
  579. qsort() is C-specific, see L<perlfunc/sort> instead.
  580. =item raise
  581. Sends the specified signal to the current process.
  582. See also L<perlfunc/kill> and the C<$$> in L<perlvar/$PID>.
  583. =item rand
  584. C<rand()> is non-portable, see L<perlfunc/rand> instead.
  585. =item read
  586. Read from a file. This uses file descriptors such as those obtained by
  587. calling C<POSIX::open>. If the buffer C<$buf> is not large enough for the
  588. read then Perl will extend it to make room for the request.
  589. $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
  590. $bytes = POSIX::read( $fd, $buf, 3 );
  591. Returns C<undef> on failure.
  592. See also L<perlfunc/sysread>.
  593. =item readdir
  594. This is identical to Perl's builtin C<readdir()> function
  595. for reading directory entries, see L<perlfunc/readdir>.
  596. =item realloc
  597. realloc() is C-specific. Perl does memory management transparently.
  598. =item remove
  599. This is identical to Perl's builtin C<unlink()> function
  600. for removing files, see L<perlfunc/unlink>.
  601. =item rename
  602. This is identical to Perl's builtin C<rename()> function
  603. for renaming files, see L<perlfunc/rename>.
  604. =item rewind
  605. Seeks to the beginning of the file.
  606. =item rewinddir
  607. This is identical to Perl's builtin C<rewinddir()> function for
  608. rewinding directory entry streams, see L<perlfunc/rewinddir>.
  609. =item rmdir
  610. This is identical to Perl's builtin C<rmdir()> function
  611. for removing (empty) directories, see L<perlfunc/rmdir>.
  612. =item scanf
  613. scanf() is C-specific, use E<lt>E<gt> and regular expressions instead,
  614. see L<perlre>.
  615. =item setgid
  616. Sets the real group identifier for this process.
  617. Identical to assigning a value to the Perl's builtin C<$)> variable,
  618. see L<perlvar/$UID>.
  619. =item setjmp
  620. C<setjmp()> is C-specific: use C<eval {}> instead,
  621. see L<perlfunc/eval>.
  622. =item setlocale
  623. Modifies and queries program's locale. The following examples assume
  624. use POSIX qw(setlocale LC_ALL LC_CTYPE);
  625. has been issued.
  626. The following will set the traditional UNIX system locale behavior
  627. (the second argument C<"C">).
  628. $loc = setlocale( LC_ALL, "C" );
  629. The following will query the current LC_CTYPE category. (No second
  630. argument means 'query'.)
  631. $loc = setlocale( LC_CTYPE );
  632. The following will set the LC_CTYPE behaviour according to the locale
  633. environment variables (the second argument C<"">).
  634. Please see your systems L<setlocale(3)> documentation for the locale
  635. environment variables' meaning or consult L<perllocale>.
  636. $loc = setlocale( LC_CTYPE, "" );
  637. The following will set the LC_COLLATE behaviour to Argentinian
  638. Spanish. B<NOTE>: The naming and availability of locales depends on
  639. your operating system. Please consult L<perllocale> for how to find
  640. out which locales are available in your system.
  641. $loc = setlocale( LC_ALL, "es_AR.ISO8859-1" );
  642. =item setpgid
  643. This is similar to the C function C<setpgid()> for
  644. setting the process group identifier of the current process.
  645. Returns C<undef> on failure.
  646. =item setsid
  647. This is identical to the C function C<setsid()> for
  648. setting the session identifier of the current process.
  649. =item setuid
  650. Sets the real user identifier for this process.
  651. Identical to assigning a value to the Perl's builtin C<$E<lt>> variable,
  652. see L<perlvar/$UID>.
  653. =item sigaction
  654. Detailed signal management. This uses C<POSIX::SigAction> objects for the
  655. C<action> and C<oldaction> arguments. Consult your system's C<sigaction>
  656. manpage for details.
  657. Synopsis:
  658. sigaction(sig, action, oldaction = 0)
  659. Returns C<undef> on failure.
  660. =item siglongjmp
  661. siglongjmp() is C-specific: use L<perlfunc/die> instead.
  662. =item sigpending
  663. Examine signals that are blocked and pending. This uses C<POSIX::SigSet>
  664. objects for the C<sigset> argument. Consult your system's C<sigpending>
  665. manpage for details.
  666. Synopsis:
  667. sigpending(sigset)
  668. Returns C<undef> on failure.
  669. =item sigprocmask
  670. Change and/or examine calling process's signal mask. This uses
  671. C<POSIX::SigSet> objects for the C<sigset> and C<oldsigset> arguments.
  672. Consult your system's C<sigprocmask> manpage for details.
  673. Synopsis:
  674. sigprocmask(how, sigset, oldsigset = 0)
  675. Returns C<undef> on failure.
  676. =item sigsetjmp
  677. C<sigsetjmp()> is C-specific: use C<eval {}> instead,
  678. see L<perlfunc/eval>.
  679. =item sigsuspend
  680. Install a signal mask and suspend process until signal arrives. This uses
  681. C<POSIX::SigSet> objects for the C<signal_mask> argument. Consult your
  682. system's C<sigsuspend> manpage for details.
  683. Synopsis:
  684. sigsuspend(signal_mask)
  685. Returns C<undef> on failure.
  686. =item sin
  687. This is identical to Perl's builtin C<sin()> function
  688. for returning the sine of the numerical argument,
  689. see L<perlfunc/sin>. See also L<Math::Trig>.
  690. =item sinh
  691. This is identical to the C function C<sinh()>
  692. for returning the hyperbolic sine of the numerical argument.
  693. See also L<Math::Trig>.
  694. =item sleep
  695. This is identical to Perl's builtin C<sleep()> function
  696. for suspending the execution of the current for process
  697. for certain number of seconds, see L<perlfunc/sleep>.
  698. =item sprintf
  699. This is similar to Perl's builtin C<sprintf()> function
  700. for returning a string that has the arguments formatted as requested,
  701. see L<perlfunc/sprintf>.
  702. =item sqrt
  703. This is identical to Perl's builtin C<sqrt()> function.
  704. for returning the square root of the numerical argument,
  705. see L<perlfunc/sqrt>.
  706. =item srand
  707. Give a seed the pseudorandom number generator, see L<perlfunc/srand>.
  708. =item sscanf
  709. sscanf() is C-specific, use regular expressions instead,
  710. see L<perlre>.
  711. =item stat
  712. This is identical to Perl's builtin C<stat()> function
  713. for retutning information about files and directories.
  714. =item strcat
  715. strcat() is C-specific, use C<.=> instead, see L<perlop>.
  716. =item strchr
  717. strchr() is C-specific, see L<perlfunc/index> instead.
  718. =item strcmp
  719. strcmp() is C-specific, use C<eq> or C<cmp> instead, see L<perlop>.
  720. =item strcoll
  721. This is identical to the C function C<strcoll()>
  722. for collating (comparing) strings transformed using
  723. the C<strxfrm()> function. Not really needed since
  724. Perl can do this transparently, see L<perllocale>.
  725. =item strcpy
  726. strcpy() is C-specific, use C<=> instead, see L<perlop>.
  727. =item strcspn
  728. strcspn() is C-specific, use regular expressions instead,
  729. see L<perlre>.
  730. =item strerror
  731. Returns the error string for the specified errno.
  732. Identical to the string form of the C<$!>, see L<perlvar/$ERRNO>.
  733. =item strftime
  734. Convert date and time information to string. Returns the string.
  735. Synopsis:
  736. strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)
  737. The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero.
  738. I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The
  739. year (C<year>) is given in years since 1900. I.e., the year 1995 is 95; the
  740. year 2001 is 101. Consult your system's C<strftime()> manpage for details
  741. about these and the other arguments.
  742. If you want your code to be portable, your format (C<fmt>) argument
  743. should use only the conversion specifiers defined by the ANSI C
  744. standard. These are C<aAbBcdHIjmMpSUwWxXyYZ%>.
  745. The given arguments are made consistent
  746. as though by calling C<mktime()> before calling your system's
  747. C<strftime()> function, except that the C<isdst> value is not affected.
  748. The string for Tuesday, December 12, 1995.
  749. $str = POSIX::strftime( "%A, %B %d, %Y", 0, 0, 0, 12, 11, 95, 2 );
  750. print "$str\n";
  751. =item strlen
  752. strlen() is C-specific, use C<length()> instead, see L<perlfunc/length>.
  753. =item strncat
  754. strncat() is C-specific, use C<.=> instead, see L<perlop>.
  755. =item strncmp
  756. strncmp() is C-specific, use C<eq> instead, see L<perlop>.
  757. =item strncpy
  758. strncpy() is C-specific, use C<=> instead, see L<perlop>.
  759. =item strpbrk
  760. strpbrk() is C-specific, use regular expressions instead,
  761. see L<perlre>.
  762. =item strrchr
  763. strrchr() is C-specific, see L<perlfunc/rindex> instead.
  764. =item strspn
  765. strspn() is C-specific, use regular expressions instead,
  766. see L<perlre>.
  767. =item strstr
  768. This is identical to Perl's builtin C<index()> function,
  769. see L<perlfunc/index>.
  770. =item strtod
  771. String to double translation. Returns the parsed number and the number
  772. of characters in the unparsed portion of the string. Truly
  773. POSIX-compliant systems set $! ($ERRNO) to indicate a translation
  774. error, so clear $! before calling strtod. However, non-POSIX systems
  775. may not check for overflow, and therefore will never set $!.
  776. strtod should respect any POSIX I<setlocale()> settings.
  777. To parse a string $str as a floating point number use
  778. $! = 0;
  779. ($num, $n_unparsed) = POSIX::strtod($str);
  780. The second returned item and $! can be used to check for valid input:
  781. if (($str eq '') || ($n_unparsed != 0) || !$!) {
  782. die "Non-numeric input $str" . $! ? ": $!\n" : "\n";
  783. }
  784. When called in a scalar context strtod returns the parsed number.
  785. =item strtok
  786. strtok() is C-specific, use regular expressions instead, see
  787. L<perlre>, or L<perlfunc/split>.
  788. =item strtol
  789. String to (long) integer translation. Returns the parsed number and
  790. the number of characters in the unparsed portion of the string. Truly
  791. POSIX-compliant systems set $! ($ERRNO) to indicate a translation
  792. error, so clear $! before calling strtol. However, non-POSIX systems
  793. may not check for overflow, and therefore will never set $!.
  794. strtol should respect any POSIX I<setlocale()> settings.
  795. To parse a string $str as a number in some base $base use
  796. $! = 0;
  797. ($num, $n_unparsed) = POSIX::strtol($str, $base);
  798. The base should be zero or between 2 and 36, inclusive. When the base
  799. is zero or omitted strtol will use the string itself to determine the
  800. base: a leading "0x" or "0X" means hexadecimal; a leading "0" means
  801. octal; any other leading characters mean decimal. Thus, "1234" is
  802. parsed as a decimal number, "01234" as an octal number, and "0x1234"
  803. as a hexadecimal number.
  804. The second returned item and $! can be used to check for valid input:
  805. if (($str eq '') || ($n_unparsed != 0) || !$!) {
  806. die "Non-numeric input $str" . $! ? ": $!\n" : "\n";
  807. }
  808. When called in a scalar context strtol returns the parsed number.
  809. =item strtoul
  810. String to unsigned (long) integer translation. strtoul() is identical
  811. to strtol() except that strtoul() only parses unsigned integers. See
  812. L</strtol> for details.
  813. Note: Some vendors supply strtod() and strtol() but not strtoul().
  814. Other vendors that do supply strtoul() parse "-1" as a valid value.
  815. =item strxfrm
  816. String transformation. Returns the transformed string.
  817. $dst = POSIX::strxfrm( $src );
  818. Used in conjunction with the C<strcoll()> function, see L</strcoll>.
  819. Not really needed since Perl can do this transparently, see
  820. L<perllocale>.
  821. =item sysconf
  822. Retrieves values of system configurable variables.
  823. The following will get the machine's clock speed.
  824. $clock_ticks = POSIX::sysconf( &POSIX::_SC_CLK_TCK );
  825. Returns C<undef> on failure.
  826. =item system
  827. This is identical to Perl's builtin C<system()> function, see
  828. L<perlfunc/system>.
  829. =item tan
  830. This is identical to the C function C<tan()>, returning the
  831. tangent of the numerical argument. See also L<Math::Trig>.
  832. =item tanh
  833. This is identical to the C function C<tanh()>, returning the
  834. hyperbolic tangent of the numerical argument. See also L<Math::Trig>.
  835. =item tcdrain
  836. This is similar to the C function C<tcdrain()> for draining
  837. the output queue of its argument stream.
  838. Returns C<undef> on failure.
  839. =item tcflow
  840. This is similar to the C function C<tcflow()> for controlling
  841. the flow of its argument stream.
  842. Returns C<undef> on failure.
  843. =item tcflush
  844. This is similar to the C function C<tcflush()> for flushing
  845. the I/O buffers of its argumeny stream.
  846. Returns C<undef> on failure.
  847. =item tcgetpgrp
  848. This is identical to the C function C<tcgetpgrp()> for returning the
  849. process group identifier of the foreground process group of the controlling
  850. terminal.
  851. =item tcsendbreak
  852. This is similar to the C function C<tcsendbreak()> for sending
  853. a break on its argument stream.
  854. Returns C<undef> on failure.
  855. =item tcsetpgrp
  856. This is similar to the C function C<tcsetpgrp()> for setting the
  857. process group identifier of the foreground process group of the controlling
  858. terminal.
  859. Returns C<undef> on failure.
  860. =item time
  861. This is identical to Perl's builtin C<time()> function
  862. for returning the number of seconds since the epoch
  863. (whatever it is for the system), see L<perlfunc/time>.
  864. =item times
  865. The times() function returns elapsed realtime since some point in the past
  866. (such as system startup), user and system times for this process, and user
  867. and system times used by child processes. All times are returned in clock
  868. ticks.
  869. ($realtime, $user, $system, $cuser, $csystem) = POSIX::times();
  870. Note: Perl's builtin C<times()> function returns four values, measured in
  871. seconds.
  872. =item tmpfile
  873. Use method C<IO::File::new_tmpfile()> instead, or see L<File::Temp>.
  874. =item tmpnam
  875. Returns a name for a temporary file.
  876. $tmpfile = POSIX::tmpnam();
  877. For security reasons, which are probably detailed in your system's
  878. documentation for the C library tmpnam() function, this interface
  879. should not be used; instead see L<File::Temp>.
  880. =item tolower
  881. This is identical to the C function, except that it can apply to a single
  882. character or to a whole string. Consider using the C<lc()> function,
  883. see L<perlfunc/lc>, or the equivalent C<\L> operator inside doublequotish
  884. strings.
  885. =item toupper
  886. This is identical to the C function, except that it can apply to a single
  887. character or to a whole string. Consider using the C<uc()> function,
  888. see L<perlfunc/uc>, or the equivalent C<\U> operator inside doublequotish
  889. strings.
  890. =item ttyname
  891. This is identical to the C function C<ttyname()> for returning the
  892. name of the current terminal.
  893. =item tzname
  894. Retrieves the time conversion information from the C<tzname> variable.
  895. POSIX::tzset();
  896. ($std, $dst) = POSIX::tzname();
  897. =item tzset
  898. This is identical to the C function C<tzset()> for setting
  899. the current timezone based on the environment variable C<TZ>,
  900. to be used by C<ctime()>, C<localtime()>, C<mktime()>, and C<strftime()>
  901. functions.
  902. =item umask
  903. This is identical to Perl's builtin C<umask()> function
  904. for setting (and querying) the file creation permission mask,
  905. see L<perlfunc/umask>.
  906. =item uname
  907. Get name of current operating system.
  908. ($sysname, $nodename, $release, $version, $machine) = POSIX::uname();
  909. Note that the actual meanings of the various fields are not
  910. that well standardized, do not expect any great portability.
  911. The C<$sysname> might be the name of the operating system,
  912. the C<$nodename> might be the name of the host, the C<$release>
  913. might be the (major) release number of the operating system,
  914. the C<$version> might be the (minor) release number of the
  915. operating system, and the C<$machine> might be a hardware identifier.
  916. Maybe.
  917. =item ungetc
  918. Use method C<IO::Handle::ungetc()> instead.
  919. =item unlink
  920. This is identical to Perl's builtin C<unlink()> function
  921. for removing files, see L<perlfunc/unlink>.
  922. =item utime
  923. This is identical to Perl's builtin C<utime()> function
  924. for changing the time stamps of files and directories,
  925. see L<perlfunc/utime>.
  926. =item vfprintf
  927. vfprintf() is C-specific, see L<perlfunc/printf> instead.
  928. =item vprintf
  929. vprintf() is C-specific, see L<perlfunc/printf> instead.
  930. =item vsprintf
  931. vsprintf() is C-specific, see L<perlfunc/sprintf> instead.
  932. =item wait
  933. This is identical to Perl's builtin C<wait()> function,
  934. see L<perlfunc/wait>.
  935. =item waitpid
  936. Wait for a child process to change state. This is identical to Perl's
  937. builtin C<waitpid()> function, see L<perlfunc/waitpid>.
  938. $pid = POSIX::waitpid( -1, &POSIX::WNOHANG );
  939. print "status = ", ($? / 256), "\n";
  940. =item wcstombs
  941. This is identical to the C function C<wcstombs()>.
  942. Perl does not have any support for the wide and multibyte
  943. characters of the C standards, so this might be a rather
  944. useless function.
  945. =item wctomb
  946. This is identical to the C function C<wctomb()>.
  947. Perl does not have any support for the wide and multibyte
  948. characters of the C standards, so this might be a rather
  949. useless function.
  950. =item write
  951. Write to a file. This uses file descriptors such as those obtained by
  952. calling C<POSIX::open>.
  953. $fd = POSIX::open( "foo", &POSIX::O_WRONLY );
  954. $buf = "hello";
  955. $bytes = POSIX::write( $b, $buf, 5 );
  956. Returns C<undef> on failure.
  957. See also L<perlfunc/syswrite>.
  958. =back
  959. =head1 CLASSES
  960. =head2 POSIX::SigAction
  961. =over 8
  962. =item new
  963. Creates a new C<POSIX::SigAction> object which corresponds to the C
  964. C<struct sigaction>. This object will be destroyed automatically when it is
  965. no longer needed. The first parameter is the fully-qualified name of a sub
  966. which is a signal-handler. The second parameter is a C<POSIX::SigSet>
  967. object, it defaults to the empty set. The third parameter contains the
  968. C<sa_flags>, it defaults to 0.
  969. $sigset = POSIX::SigSet->new(SIGINT, SIGQUIT);
  970. $sigaction = POSIX::SigAction->new( 'main::handler', $sigset, &POSIX::SA_NOCLDSTOP );
  971. This C<POSIX::SigAction> object should be used with the C<POSIX::sigaction()>
  972. function.
  973. =back
  974. =head2 POSIX::SigSet
  975. =over 8
  976. =item new
  977. Create a new SigSet object. This object will be destroyed automatically
  978. when it is no longer needed. Arguments may be supplied to initialize the
  979. set.
  980. Create an empty set.
  981. $sigset = POSIX::SigSet->new;
  982. Create a set with SIGUSR1.
  983. $sigset = POSIX::SigSet->new( &POSIX::SIGUSR1 );
  984. =item addset
  985. Add a signal to a SigSet object.
  986. $sigset->addset( &POSIX::SIGUSR2 );
  987. Returns C<undef> on failure.
  988. =item delset
  989. Remove a signal from the SigSet object.
  990. $sigset->delset( &POSIX::SIGUSR2 );
  991. Returns C<undef> on failure.
  992. =item emptyset
  993. Initialize the SigSet object to be empty.
  994. $sigset->emptyset();
  995. Returns C<undef> on failure.
  996. =item fillset
  997. Initialize the SigSet object to include all signals.
  998. $sigset->fillset();
  999. Returns C<undef> on failure.
  1000. =item ismember
  1001. Tests the SigSet object to see if it contains a specific signal.
  1002. if( $sigset->ismember( &POSIX::SIGUSR1 ) ){
  1003. print "contains SIGUSR1\n";
  1004. }
  1005. =back
  1006. =head2 POSIX::Termios
  1007. =over 8
  1008. =item new
  1009. Create a new Termios object. This object will be destroyed automatically
  1010. when it is no longer needed. A Termios object corresponds to the termios
  1011. C struct. new() mallocs a new one, getattr() fills it from a file descriptor,
  1012. and setattr() sets a file descriptor's parameters to match Termios' contents.
  1013. $termios = POSIX::Termios->new;
  1014. =item getattr
  1015. Get terminal control attributes.
  1016. Obtain the attributes for stdin.
  1017. $termios->getattr()
  1018. Obtain the attributes for stdout.
  1019. $termios->getattr( 1 )
  1020. Returns C<undef> on failure.
  1021. =item getcc
  1022. Retrieve a value from the c_cc field of a termios object. The c_cc field is
  1023. an array so an index must be specified.
  1024. $c_cc[1] = $termios->getcc(1);
  1025. =item getcflag
  1026. Retrieve the c_cflag field of a termios object.
  1027. $c_cflag = $termios->getcflag;
  1028. =item getiflag
  1029. Retrieve the c_iflag field of a termios object.
  1030. $c_iflag = $termios->getiflag;
  1031. =item getispeed
  1032. Retrieve the input baud rate.
  1033. $ispeed = $termios->getispeed;
  1034. =item getlflag
  1035. Retrieve the c_lflag field of a termios object.
  1036. $c_lflag = $termios->getlflag;
  1037. =item getoflag
  1038. Retrieve the c_oflag field of a termios object.
  1039. $c_oflag = $termios->getoflag;
  1040. =item getospeed
  1041. Retrieve the output baud rate.
  1042. $ospeed = $termios->getospeed;
  1043. =item setattr
  1044. Set terminal control attributes.
  1045. Set attributes immediately for stdout.
  1046. $termios->setattr( 1, &POSIX::TCSANOW );
  1047. Returns C<undef> on failure.
  1048. =item setcc
  1049. Set a value in the c_cc field of a termios object. The c_cc field is an
  1050. array so an index must be specified.
  1051. $termios->setcc( &POSIX::VEOF, 1 );
  1052. =item setcflag
  1053. Set the c_cflag field of a termios object.
  1054. $termios->setcflag( $c_cflag | &POSIX::CLOCAL );
  1055. =item setiflag
  1056. Set the c_iflag field of a termios object.
  1057. $termios->setiflag( $c_iflag | &POSIX::BRKINT );
  1058. =item setispeed
  1059. Set the input baud rate.
  1060. $termios->setispeed( &POSIX::B9600 );
  1061. Returns C<undef> on failure.
  1062. =item setlflag
  1063. Set the c_lflag field of a termios object.
  1064. $termios->setlflag( $c_lflag | &POSIX::ECHO );
  1065. =item setoflag
  1066. Set the c_oflag field of a termios object.
  1067. $termios->setoflag( $c_oflag | &POSIX::OPOST );
  1068. =item setospeed
  1069. Set the output baud rate.
  1070. $termios->setospeed( &POSIX::B9600 );
  1071. Returns C<undef> on failure.
  1072. =item Baud rate values
  1073. B38400 B75 B200 B134 B300 B1800 B150 B0 B19200 B1200 B9600 B600 B4800 B50 B2400 B110
  1074. =item Terminal interface values
  1075. TCSADRAIN TCSANOW TCOON TCIOFLUSH TCOFLUSH TCION TCIFLUSH TCSAFLUSH TCIOFF TCOOFF
  1076. =item c_cc field values
  1077. VEOF VEOL VERASE VINTR VKILL VQUIT VSUSP VSTART VSTOP VMIN VTIME NCCS
  1078. =item c_cflag field values
  1079. CLOCAL CREAD CSIZE CS5 CS6 CS7 CS8 CSTOPB HUPCL PARENB PARODD
  1080. =item c_iflag field values
  1081. BRKINT ICRNL IGNBRK IGNCR IGNPAR INLCR INPCK ISTRIP IXOFF IXON PARMRK
  1082. =item c_lflag field values
  1083. ECHO ECHOE ECHOK ECHONL ICANON IEXTEN ISIG NOFLSH TOSTOP
  1084. =item c_oflag field values
  1085. OPOST
  1086. =back
  1087. =head1 PATHNAME CONSTANTS
  1088. =over 8
  1089. =item Constants
  1090. _PC_CHOWN_RESTRICTED _PC_LINK_MAX _PC_MAX_CANON _PC_MAX_INPUT _PC_NAME_MAX _PC_NO_TRUNC _PC_PATH_MAX _PC_PIPE_BUF _PC_VDISABLE
  1091. =back
  1092. =head1 POSIX CONSTANTS
  1093. =over 8
  1094. =item Constants
  1095. _POSIX_ARG_MAX _POSIX_CHILD_MAX _POSIX_CHOWN_RESTRICTED _POSIX_JOB_CONTROL _POSIX_LINK_MAX _POSIX_MAX_CANON _POSIX_MAX_INPUT _POSIX_NAME_MAX _POSIX_NGROUPS_MAX _POSIX_NO_TRUNC _POSIX_OPEN_MAX _POSIX_PATH_MAX _POSIX_PIPE_BUF _POSIX_SAVED_IDS _POSIX_SSIZE_MAX _POSIX_STREAM_MAX _POSIX_TZNAME_MAX _POSIX_VDISABLE _POSIX_VERSION
  1096. =back
  1097. =head1 SYSTEM CONFIGURATION
  1098. =over 8
  1099. =item Constants
  1100. _SC_ARG_MAX _SC_CHILD_MAX _SC_CLK_TCK _SC_JOB_CONTROL _SC_NGROUPS_MAX _SC_OPEN_MAX _SC_SAVED_IDS _SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION
  1101. =back
  1102. =head1 ERRNO
  1103. =over 8
  1104. =item Constants
  1105. E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN EALREADY EBADF
  1106. EBUSY ECHILD ECONNABORTED ECONNREFUSED ECONNRESET EDEADLK EDESTADDRREQ
  1107. EDOM EDQUOT EEXIST EFAULT EFBIG EHOSTDOWN EHOSTUNREACH EINPROGRESS EINTR
  1108. EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK EMSGSIZE ENAMETOOLONG
  1109. ENETDOWN ENETRESET ENETUNREACH ENFILE ENOBUFS ENODEV ENOENT ENOEXEC
  1110. ENOLCK ENOMEM ENOPROTOOPT ENOSPC ENOSYS ENOTBLK ENOTCONN ENOTDIR
  1111. ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOPNOTSUPP EPERM EPFNOSUPPORT EPIPE
  1112. EPROCLIM EPROTONOSUPPORT EPROTOTYPE ERANGE EREMOTE ERESTART EROFS
  1113. ESHUTDOWN ESOCKTNOSUPPORT ESPIPE ESRCH ESTALE ETIMEDOUT ETOOMANYREFS
  1114. ETXTBSY EUSERS EWOULDBLOCK EXDEV
  1115. =back
  1116. =head1 FCNTL
  1117. =over 8
  1118. =item Constants
  1119. FD_CLOEXEC F_DUPFD F_GETFD F_GETFL F_GETLK F_OK F_RDLCK F_SETFD F_SETFL F_SETLK F_SETLKW F_UNLCK F_WRLCK O_ACCMODE O_APPEND O_CREAT O_EXCL O_NOCTTY O_NONBLOCK O_RDONLY O_RDWR O_TRUNC O_WRONLY
  1120. =back
  1121. =head1 FLOAT
  1122. =over 8
  1123. =item Constants
  1124. DBL_DIG DBL_EPSILON DBL_MANT_DIG DBL_MAX DBL_MAX_10_EXP DBL_MAX_EXP DBL_MIN DBL_MIN_10_EXP DBL_MIN_EXP FLT_DIG FLT_EPSILON FLT_MANT_DIG FLT_MAX FLT_MAX_10_EXP FLT_MAX_EXP FLT_MIN FLT_MIN_10_EXP FLT_MIN_EXP FLT_RADIX FLT_ROUNDS LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG LDBL_MAX LDBL_MAX_10_EXP LDBL_MAX_EXP LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP
  1125. =back
  1126. =head1 LIMITS
  1127. =over 8
  1128. =item Constants
  1129. ARG_MAX CHAR_BIT CHAR_MAX CHAR_MIN CHILD_MAX INT_MAX INT_MIN LINK_MAX LONG_MAX LONG_MIN MAX_CANON MAX_INPUT MB_LEN_MAX NAME_MAX NGROUPS_MAX OPEN_MAX PATH_MAX PIPE_BUF SCHAR_MAX SCHAR_MIN SHRT_MAX SHRT_MIN SSIZE_MAX STREAM_MAX TZNAME_MAX UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX
  1130. =back
  1131. =head1 LOCALE
  1132. =over 8
  1133. =item Constants
  1134. LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME
  1135. =back
  1136. =head1 MATH
  1137. =over 8
  1138. =item Constants
  1139. HUGE_VAL
  1140. =back
  1141. =head1 SIGNAL
  1142. =over 8
  1143. =item Constants
  1144. SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK SA_RESETHAND SA_RESTART
  1145. SA_SIGINFO SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP SIGILL SIGINT
  1146. SIGKILL SIGPIPE SIGQUIT SIGSEGV SIGSTOP SIGTERM SIGTSTP SIGTTIN SIGTTOU
  1147. SIGUSR1 SIGUSR2 SIG_BLOCK SIG_DFL SIG_ERR SIG_IGN SIG_SETMASK
  1148. SIG_UNBLOCK
  1149. =back
  1150. =head1 STAT
  1151. =over 8
  1152. =item Constants
  1153. S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU S_ISGID S_ISUID S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR
  1154. =item Macros
  1155. S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG
  1156. =back
  1157. =head1 STDLIB
  1158. =over 8
  1159. =item Constants
  1160. EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX RAND_MAX
  1161. =back
  1162. =head1 STDIO
  1163. =over 8
  1164. =item Constants
  1165. BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid L_tmpname TMP_MAX
  1166. =back
  1167. =head1 TIME
  1168. =over 8
  1169. =item Constants
  1170. CLK_TCK CLOCKS_PER_SEC
  1171. =back
  1172. =head1 UNISTD
  1173. =over 8
  1174. =item Constants
  1175. R_OK SEEK_CUR SEEK_END SEEK_SET STDIN_FILENO STDOUT_FILENO STDERR_FILENO W_OK X_OK
  1176. =back
  1177. =head1 WAIT
  1178. =over 8
  1179. =item Constants
  1180. WNOHANG WUNTRACED
  1181. =item Macros
  1182. WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG
  1183. =back