POSIX - Perl interface to IEEE Std 1003.1
+=head1 SYNOPSIS
+
+ use POSIX;
+ use POSIX qw(setsid);
+ use POSIX qw(:errno_h :fcntl_h);
+
+ printf "EINTR is %d\n", EINTR;
+
+ $sess_id = POSIX::setsid();
+
+ $fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644);
+ # note: that's a filedescriptor, *NOT* a filehandle
+
=head1 DESCRIPTION
The POSIX module permits you to access all (or nearly all) the standard
constants and macros in an organization which roughly follows IEEE Std
1003.1b-1993.
-=head1 EXAMPLES
-
- printf "EINTR is %d\n", EINTR;
-
- $sess_id = POSIX::setsid();
-
- $fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644);
- # note: that's a filedescriptor, *NOT* a filehandle
-
=head1 NOTE
The POSIX module is probably the most complex Perl module supplied with
=item assert
+Unimplemented.
=item atan
=item clearerr
-Use method C<FileHandle::clearerr()> instead.
+Use method C<IO::Handle::clearerr()> instead.
=item clock
=item close
+Close the file. This uses file descriptors such as those obtained by calling
+C<POSIX::open>.
+
+ $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
+ POSIX::close( $fd );
Returns C<undef> on failure.
=item creat
+Create a new file. This returns a file descriptor like the ones returned by
+C<POSIX::open>. Use C<POSIX::close> to close the file.
+
+ $fd = POSIX::creat( "foo", 0611 );
+ POSIX::close( $fd );
=item ctermid
-Generates the path name for controlling terminal.
+Generates the path name for the controlling terminal.
$path = POSIX::ctermid();
=item dup
+This is similar to the C function C<dup()>.
+
+This uses file descriptors such as those obtained by calling
+C<POSIX::open>.
Returns C<undef> on failure.
=item dup2
+This is similar to the C function C<dup2()>.
+
+This uses file descriptors such as those obtained by calling
+C<POSIX::open>.
Returns C<undef> on failure.
=item fclose
-Use method C<FileHandle::close()> instead.
+Use method C<IO::Handle::close()> instead.
=item fcntl
=item fdopen
-Use method C<FileHandle::new_from_fd()> instead.
+Use method C<IO::Handle::new_from_fd()> instead.
=item feof
-Use method C<FileHandle::eof()> instead.
+Use method C<IO::Handle::eof()> instead.
=item ferror
-Use method C<FileHandle::error()> instead.
+Use method C<IO::Handle::error()> instead.
=item fflush
-Use method C<FileHandle::flush()> instead.
+Use method C<IO::Handle::flush()> instead.
=item fgetc
-Use method C<FileHandle::getc()> instead.
+Use method C<IO::Handle::getc()> instead.
=item fgetpos
-Use method C<FileHandle::getpos()> instead.
+Use method C<IO::Seekable::getpos()> instead.
=item fgets
-Use method C<FileHandle::gets()> instead.
+Use method C<IO::Handle::gets()> instead.
=item fileno
-Use method C<FileHandle::fileno()> instead.
+Use method C<IO::Handle::fileno()> instead.
=item floor
=item fopen
-Use method C<FileHandle::open()> instead.
+Use method C<IO::File::open()> instead.
=item fork
=item fpathconf
+Retrieves the value of a configurable limit on a file or directory. This
+uses file descriptors such as those obtained by calling C<POSIX::open>.
+
+The following will determine the maximum length of the longest allowable
+pathname on the filesystem which holds C</tmp/foo>.
+
+ $fd = POSIX::open( "/tmp/foo", &POSIX::O_RDONLY );
+ $path_max = POSIX::fpathconf( $fd, &POSIX::_PC_PATH_MAX );
Returns C<undef> on failure.
=item frexp
+Return the mantissa and exponent of a floating-point number.
+
+ ($mantissa, $exponent) = POSIX::frexp( 3.14 );
=item fscanf
=item fseek
-Use method C<FileHandle::seek()> instead.
+Use method C<IO::Seekable::seek()> instead.
=item fsetpos
-Use method C<FileHandle::setpos()> instead.
+Use method C<IO::Seekable::setpos()> instead.
=item fstat
+Get file status. This uses file descriptors such as those obtained by
+calling C<POSIX::open>. The data returned is identical to the data from
+Perl's builtin C<stat> function.
+
+ $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
+ @stats = POSIX::fstat( $fd );
=item ftell
-Use method C<FileHandle::tell()> instead.
+Use method C<IO::Seekable::tell()> instead.
=item fwrite
=item isalnum
+This is identical to the C function, except that it can apply to a single
+character or to a whole string.
=item isalpha
+This is identical to the C function, except that it can apply to a single
+character or to a whole string.
=item isatty
=item iscntrl
+This is identical to the C function, except that it can apply to a single
+character or to a whole string.
=item isdigit
+This is identical to the C function, except that it can apply to a single
+character or to a whole string.
=item isgraph
+This is identical to the C function, except that it can apply to a single
+character or to a whole string.
=item islower
+This is identical to the C function, except that it can apply to a single
+character or to a whole string.
=item isprint
+This is identical to the C function, except that it can apply to a single
+character or to a whole string.
=item ispunct
+This is identical to the C function, except that it can apply to a single
+character or to a whole string.
=item isspace
+This is identical to the C function, except that it can apply to a single
+character or to a whole string.
=item isupper
+This is identical to the C function, except that it can apply to a single
+character or to a whole string.
=item isxdigit
+This is identical to the C function, except that it can apply to a single
+character or to a whole string.
=item kill
=item localeconv
+Get numeric formatting information. Returns a reference to a hash
+containing the current locale formatting values.
+
+The database for the B<de> (Deutsch or German) locale.
+
+ $loc = POSIX::setlocale( &POSIX::LC_ALL, "de" );
+ print "Locale = $loc\n";
+ $lconv = POSIX::localeconv();
+ print "decimal_point = ", $lconv->{decimal_point}, "\n";
+ print "thousands_sep = ", $lconv->{thousands_sep}, "\n";
+ print "grouping = ", $lconv->{grouping}, "\n";
+ print "int_curr_symbol = ", $lconv->{int_curr_symbol}, "\n";
+ print "currency_symbol = ", $lconv->{currency_symbol}, "\n";
+ print "mon_decimal_point = ", $lconv->{mon_decimal_point}, "\n";
+ print "mon_thousands_sep = ", $lconv->{mon_thousands_sep}, "\n";
+ print "mon_grouping = ", $lconv->{mon_grouping}, "\n";
+ print "positive_sign = ", $lconv->{positive_sign}, "\n";
+ print "negative_sign = ", $lconv->{negative_sign}, "\n";
+ print "int_frac_digits = ", $lconv->{int_frac_digits}, "\n";
+ print "frac_digits = ", $lconv->{frac_digits}, "\n";
+ print "p_cs_precedes = ", $lconv->{p_cs_precedes}, "\n";
+ print "p_sep_by_space = ", $lconv->{p_sep_by_space}, "\n";
+ print "n_cs_precedes = ", $lconv->{n_cs_precedes}, "\n";
+ print "n_sep_by_space = ", $lconv->{n_sep_by_space}, "\n";
+ print "p_sign_posn = ", $lconv->{p_sign_posn}, "\n";
+ print "n_sign_posn = ", $lconv->{n_sign_posn}, "\n";
=item localtime
=item lseek
+Move the file's read/write position. This uses file descriptors such as
+those obtained by calling C<POSIX::open>.
+
+ $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
+ $off_t = POSIX::lseek( $fd, 0, &POSIX::SEEK_SET );
Returns C<undef> on failure.
=item mblen
+This is identical to the C function C<mblen()>.
=item mbstowcs
+This is identical to the C function C<mbstowcs()>.
=item mbtowc
+This is identical to the C function C<mbtowc()>.
=item memchr
=item mkfifo
+This is similar to the C function C<mkfifo()>.
Returns C<undef> on failure.
=item mktime
+Convert date/time info to a calendar time.
+
+Synopsis:
+
+ mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
+
+The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero.
+I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The
+year (C<year>) is given in years since 1900. I.e. The year 1995 is 95; the
+year 2001 is 101. Consult your system's C<mktime()> manpage for details
+about these and the other arguments.
+
+Calendar time for December 12, 1995, at 10:30 am.
+
+ $time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 );
+ print "Date = ", POSIX::ctime($time_t);
Returns C<undef> on failure.
=item modf
+Return the integral and fractional parts of a floating-point number.
+
+ ($fractional, $integral) = POSIX::modf( 3.14 );
=item nice
+This is similar to the C function C<nice()>.
Returns C<undef> on failure.
=item open
+Open a file for reading for writing. This returns file descriptors, not
+Perl filehandles. Use C<POSIX::close> to close the file.
+
+Open a file read-only with mode 0666.
+
+ $fd = POSIX::open( "foo" );
+
+Open a file for read and write.
+
+ $fd = POSIX::open( "foo", &POSIX::O_RDWR );
+
+Open a file for write, with truncation.
+
+ $fd = POSIX::open( "foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC );
+
+Create a new file with mode 0640. Set up the file for writing.
+
+ $fd = POSIX::open( "foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0640 );
Returns C<undef> on failure.
=item opendir
+Open a directory for reading.
+
+ $dir = POSIX::opendir( "/tmp" );
+ @files = POSIX::readdir( $dir );
+ POSIX::closedir( $dir );
+
+Returns C<undef> on failure.
=item pathconf
=item pipe
+Create an interprocess channel. This returns file descriptors like those
+returned by C<POSIX::open>.
+
+ ($fd0, $fd1) = POSIX::pipe();
+ POSIX::write( $fd0, "hello", 5 );
+ POSIX::read( $fd1, $buf, 5 );
=item pow
=item read
+Read from a file. This uses file descriptors such as those obtained by
+calling C<POSIX::open>. If the buffer C<$buf> is not large enough for the
+read then Perl will extend it to make room for the request.
+
+ $fd = POSIX::open( "foo", &POSIX::O_RDONLY );
+ $bytes = POSIX::read( $fd, $buf, 3 );
Returns C<undef> on failure.
Modifies and queries program's locale.
-The following will set the traditional UNIX system locale behavior.
+The following will set the traditional UNIX system locale behavior
+(the second argument C<"C">).
$loc = POSIX::setlocale( &POSIX::LC_ALL, "C" );
+The following will query (the missing second argument) the current
+LC_CTYPE category.
+
+ $loc = POSIX::setlocale( &POSIX::LC_CTYPE);
+
+The following will set the LC_CTYPE behaviour according to the locale
+environment variables (the second argument C<"">).
+Please see your systems L<setlocale(3)> documentation for the locale
+environment variables' meaning or consult L<perllocale>.
+
+ $loc = POSIX::setlocale( &POSIX::LC_CTYPE, "");
+
+The following will set the LC_COLLATE behaviour to Argentinian
+Spanish. B<NOTE>: The naming and availability of locales depends on
+your operating system. Please consult L<perllocale> for how to find
+out which locales are available in your system.
+
+ $loc = POSIX::setlocale( &POSIX::LC_ALL, "es_AR.ISO8859-1" );
+
=item setpgid
+This is similar to the C function C<setpgid()>.
Returns C<undef> on failure.
=item sigaction
+Detailed signal management. This uses C<POSIX::SigAction> objects for the
+C<action> and C<oldaction> arguments. Consult your system's C<sigaction>
+manpage for details.
+
+Synopsis:
+
+ sigaction(sig, action, oldaction = 0)
Returns C<undef> on failure.
=item sigpending
+Examine signals that are blocked and pending. This uses C<POSIX::SigSet>
+objects for the C<sigset> argument. Consult your system's C<sigpending>
+manpage for details.
+
+Synopsis:
+
+ sigpending(sigset)
Returns C<undef> on failure.
=item sigprocmask
+Change and/or examine calling process's signal mask. This uses
+C<POSIX::SigSet> objects for the C<sigset> and C<oldsigset> arguments.
+Consult your system's C<sigprocmask> manpage for details.
+
+Synopsis:
+
+ sigprocmask(how, sigset, oldsigset = 0)
Returns C<undef> on failure.
=item sigsuspend
+Install a signal mask and suspend process until signal arrives. This uses
+C<POSIX::SigSet> objects for the C<signal_mask> argument. Consult your
+system's C<sigsuspend> manpage for details.
+
+Synopsis:
+
+ sigsuspend(signal_mask)
Returns C<undef> on failure.
=item sprintf
+This is identical to Perl's builtin C<sprintf()> function.
=item sqrt
=item strftime
+Convert date and time information to string. Returns the string.
+
+Synopsis:
+
+ strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
+
+The month (C<mon>), weekday (C<wday>), and yearday (C<yday>) begin at zero.
+I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The
+year (C<year>) is given in years since 1900. I.e. The year 1995 is 95; the
+year 2001 is 101. Consult your system's C<strftime()> manpage for details
+about these and the other arguments.
+
+The string for Tuesday, December 12, 1995.
+
+ $str = POSIX::strftime( "%A, %B %d, %Y", 0, 0, 0, 12, 11, 95, 2 );
+ print "$str\n";
=item strlen
=item strtod
-strtod() is C-specific.
+String to double translation. Returns the parsed number and the number
+of characters in the unparsed portion of the string. Truly
+POSIX-compliant systems set $! ($ERRNO) to indicate a translation
+error, so clear $! before calling strtod. However, non-POSIX systems
+may not check for overflow, and therefore will never set $!.
+
+strtod should respect any POSIX I<setlocale()> settings.
+
+To parse a string $str as a floating point number use
+
+ $! = 0;
+ ($num, $n_unparsed) = POSIX::strtod($str);
+
+The second returned item and $! can be used to check for valid input:
+
+ if (($str eq '') || ($n_unparsed != 0) || !$!) {
+ die "Non-numeric input $str" . $! ? ": $!\n" : "\n";
+ }
+
+When called in a scalar context strtod returns the parsed number.
=item strtok
=item strtol
-strtol() is C-specific.
+String to (long) integer translation. Returns the parsed number and
+the number of characters in the unparsed portion of the string. Truly
+POSIX-compliant systems set $! ($ERRNO) to indicate a translation
+error, so clear $! before calling strtol. However, non-POSIX systems
+may not check for overflow, and therefore will never set $!.
+
+strtol should respect any POSIX I<setlocale()> settings.
+
+To parse a string $str as a number in some base $base use
+
+ $! = 0;
+ ($num, $n_unparsed) = POSIX::strtol($str, $base);
+
+The base should be zero or between 2 and 36, inclusive. When the base
+is zero or omitted strtol will use the string itself to determine the
+base: a leading "0x" or "0X" means hexadecimal; a leading "0" means
+octal; any other leading characters mean decimal. Thus, "1234" is
+parsed as a decimal number, "01234" as an octal number, and "0x1234"
+as a hexadecimal number.
+
+The second returned item and $! can be used to check for valid input:
+
+ if (($str eq '') || ($n_unparsed != 0) || !$!) {
+ die "Non-numeric input $str" . $! ? ": $!\n" : "\n";
+ }
+
+When called in a scalar context strtol returns the parsed number.
+
+=item strtoul
+
+String to unsigned (long) integer translation. strtoul is identical
+to strtol except that strtoul only parses unsigned integers. See
+I<strtol> for details.
+
+Note: Some vendors supply strtod and strtol but not strtoul.
+Other vendors that do suply strtoul parse "-1" as a valid value.
=item strxfrm
+String transformation. Returns the transformed string.
+
+ $dst = POSIX::strxfrm( $src );
=item sysconf
=item tcdrain
+This is similar to the C function C<tcdrain()>.
Returns C<undef> on failure.
=item tcflow
+This is similar to the C function C<tcflow()>.
Returns C<undef> on failure.
=item tcflush
+This is similar to the C function C<tcflush()>.
Returns C<undef> on failure.
=item tcsendbreak
+This is similar to the C function C<tcsendbreak()>.
Returns C<undef> on failure.
=item tcsetpgrp
+This is similar to the C function C<tcsetpgrp()>.
Returns C<undef> on failure.
=item tmpfile
-Use method C<FileHandle::new_tmpfile()> instead.
+Use method C<IO::File::new_tmpfile()> instead.
=item tmpnam
=item ttyname
+This is identical to the C function C<ttyname()>.
=item tzname
+Retrieves the time conversion information from the C<tzname> variable.
+
+ POSIX::tzset();
+ ($std, $dst) = POSIX::tzname();
=item tzset
=item uname
+Get name of current operating system.
+
+ ($sysname, $nodename, $release, $version, $machine ) = POSIX::uname();
=item ungetc
-Use method C<FileHandle::ungetc()> instead.
+Use method C<IO::Handle::ungetc()> instead.
=item unlink
=item wait
+This is identical to Perl's builtin C<wait()> function.
=item waitpid
+Wait for a child process to change state. This is identical to Perl's
+builtin C<waitpid()> function.
+
+ $pid = POSIX::waitpid( -1, &POSIX::WNOHANG );
+ print "status = ", ($? / 256), "\n";
=item wcstombs
+This is identical to the C function C<wcstombs()>.
=item wctomb
+This is identical to the C function C<wctomb()>.
=item write
+Write to a file. This uses file descriptors such as those obtained by
+calling C<POSIX::open>.
+
+ $fd = POSIX::open( "foo", &POSIX::O_WRONLY );
+ $buf = "hello";
+ $bytes = POSIX::write( $b, $buf, 5 );
Returns C<undef> on failure.
=head1 CLASSES
-=head2 FileHandle
+=head2 POSIX::SigAction
=over 8
=item new
+Creates a new C<POSIX::SigAction> object which corresponds to the C
+C<struct sigaction>. This object will be destroyed automatically when it is
+no longer needed. The first parameter is the fully-qualified name of a sub
+which is a signal-handler. The second parameter is a C<POSIX::SigSet>
+object, it defaults to the empty set. The third parameter contains the
+C<sa_flags>, it defaults to 0.
-=item clearerr
-
-
-=item close
-
-
-=item eof
-
-
-=item error
-
-
-=item fileno
-
-
-=item flush
-
-
-Returns C<undef> on failure.
-
-=item getc
-
-
-=item getpos
-
-
-=item gets
-
+ $sigset = POSIX::SigSet->new(SIGINT, SIGQUIT);
+ $sigaction = POSIX::SigAction->new( 'main::handler', $sigset, &POSIX::SA_NOCLDSTOP );
-=item new_from_fd
-
-
-=item new_tmpfile
-
-
-=item seek
-
-
-=item setbuf
-
-
-=item setpos
-
-
-Returns C<undef> on failure.
-
-=item setvbuf
-
-
-Returns C<undef> on failure.
-
-=item tell
-
-
-=item ungetc
-
-
-=back
-
-=head2 POSIX::SigAction
-
-=over 8
-
-=item new
-
-Creates a new SigAction object. This object will be destroyed automatically
-when it is no longer needed.
+This C<POSIX::SigAction> object should be used with the C<POSIX::sigaction()>
+function.
=back
=item getattr
+Get terminal control attributes.
+
+Obtain the attributes for stdin.
+
+ $termios->getattr()
+
+Obtain the attributes for stdout.
+
+ $termios->getattr( 1 )
Returns C<undef> on failure.
=item setattr
+Set terminal control attributes.
+
+Set attributes immediately for stdout.
+
+ $termios->setattr( 1, &POSIX::TCSANOW );
Returns C<undef> on failure.
Set a value in the c_cc field of a termios object. The c_cc field is an
array so an index must be specified.
- $termios->setcc( 1, &POSIX::VEOF );
+ $termios->setcc( &POSIX::VEOF, 1 );
=item setcflag
=item Constants
-E2BIG EACCES EAGAIN EBADF EBUSY ECHILD EDEADLK EDOM EEXIST EFAULT EFBIG EINTR EINVAL EIO EISDIR EMFILE EMLINK ENAMETOOLONG ENFILE ENODEV ENOENT ENOEXEC ENOLCK ENOMEM ENOSPC ENOSYS ENOTDIR ENOTEMPTY ENOTTY ENXIO EPERM EPIPE ERANGE EROFS ESPIPE ESRCH EXDEV
+E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN EALREADY EBADF
+EBUSY ECHILD ECONNABORTED ECONNREFUSED ECONNRESET EDEADLK EDESTADDRREQ
+EDOM EDQUOT EEXIST EFAULT EFBIG EHOSTDOWN EHOSTUNREACH EINPROGRESS EINTR
+EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK EMSGSIZE ENAMETOOLONG
+ENETDOWN ENETRESET ENETUNREACH ENFILE ENOBUFS ENODEV ENOENT ENOEXEC
+ENOLCK ENOMEM ENOPROTOOPT ENOSPC ENOSYS ENOTBLK ENOTCONN ENOTDIR
+ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOPNOTSUPP EPERM EPFNOSUPPORT EPIPE
+EPROCLIM EPROTONOSUPPORT EPROTOTYPE ERANGE EREMOTE ERESTART EROFS
+ESHUTDOWN ESOCKTNOSUPPORT ESPIPE ESRCH ESTALE ETIMEDOUT ETOOMANYREFS
+ETXTBSY EUSERS EWOULDBLOCK EXDEV
=back
=item Constants
-SA_NOCLDSTOP SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV SIGSTOP SIGTERM SIGTSTP SIGTTIN SIGTTOU SIGUSR1 SIGUSR2 SIG_BLOCK SIG_DFL SIG_ERR SIG_IGN SIG_SETMASK SIG_UNBLOCK
+SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK SA_RESETHAND SA_RESTART
+SA_SIGINFO SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP SIGILL SIGINT
+SIGKILL SIGPIPE SIGQUIT SIGSEGV SIGSTOP SIGTERM SIGTSTP SIGTTIN SIGTTOU
+SIGUSR1 SIGUSR2 SIG_BLOCK SIG_DFL SIG_ERR SIG_IGN SIG_SETMASK
+SIG_UNBLOCK
=back
=item Constants
-BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid L_tmpname TMP_MAX _IOFBF _IOLBF _IONBF
+BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid L_tmpname TMP_MAX
=back
=head1 CREATION
-This document generated by mkposixman.PL version 951129.
+This document generated by ./mkposixman.PL version 19960129.