.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "POSIX 1" .TH POSIX 1 "2002-11-24" "perl v5.8.0" "Perl Programmers Reference Guide" .SH "NAME" POSIX \- Perl interface to IEEE Std 1003.1 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use POSIX; \& use POSIX qw(setsid); \& use POSIX qw(:errno_h :fcntl_h); .Ve .PP .Vb 1 \& printf "EINTR is %d\en", EINTR; .Ve .PP .Vb 1 \& $sess_id = POSIX::setsid(); .Ve .PP .Vb 2 \& $fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644); \& # note: that's a filedescriptor, *NOT* a filehandle .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \s-1POSIX\s0 module permits you to access all (or nearly all) the standard \&\s-1POSIX\s0 1003.1 identifiers. Many of these identifiers have been given Perl-ish interfaces. Things which are \f(CW\*(C`#defines\*(C'\fR in C, like \s-1EINTR\s0 or O_NDELAY, are automatically exported into your namespace. All functions are only exported if you ask for them explicitly. Most likely people will prefer to use the fully-qualified function names. .PP This document gives a condensed list of the features available in the \s-1POSIX\s0 module. Consult your operating system's manpages for general information on most features. Consult perlfunc for functions which are noted as being identical to Perl's builtin functions. .PP The first section describes \s-1POSIX\s0 functions from the 1003.1 specification. The second section describes some classes for signal objects, \s-1TTY\s0 objects, and other miscellaneous objects. The remaining sections list various constants and macros in an organization which roughly follows \s-1IEEE\s0 Std 1003.1b\-1993. .SH "NOTE" .IX Header "NOTE" The \s-1POSIX\s0 module is probably the most complex Perl module supplied with the standard distribution. It incorporates autoloading, namespace games, and dynamic loading of code that's in Perl, C, or both. It's a great source of wisdom. .SH "CAVEATS" .IX Header "CAVEATS" A few functions are not implemented because they are C specific. If you attempt to call these, they will print a message telling you that they aren't implemented, and suggest using the Perl equivalent should one exist. For example, trying to access the \fIsetjmp()\fR call will elicit the message \*(L"\fIsetjmp()\fR is C\-specific: use eval {} instead\*(R". .PP Furthermore, some evil vendors will claim 1003.1 compliance, but in fact are not so: they will not pass the \s-1PCTS\s0 (\s-1POSIX\s0 Compliance Test Suites). For example, one vendor may not define \s-1EDEADLK\s0, or the semantics of the errno values set by \fIopen\fR\|(2) might not be quite right. Perl does not attempt to verify \s-1POSIX\s0 compliance. That means you can currently successfully say \*(L"use \s-1POSIX\s0\*(R", and then later in your program you find that your vendor has been lax and there's no usable \s-1ICANON\s0 macro after all. This could be construed to be a bug. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .IP "_exit" 8 .IX Item "_exit" This is identical to the C function \f(CW\*(C`_exit()\*(C'\fR. It exits the program immediately which means among other things buffered I/O is \fBnot\fR flushed. .IP "abort" 8 .IX Item "abort" This is identical to the C function \f(CW\*(C`abort()\*(C'\fR. It terminates the process with a \f(CW\*(C`SIGABRT\*(C'\fR signal unless caught by a signal handler or if the handler does not return normally (it e.g. does a \f(CW\*(C`longjmp\*(C'\fR). .IP "abs" 8 .IX Item "abs" This is identical to Perl's builtin \f(CW\*(C`abs()\*(C'\fR function, returning the absolute value of its numerical argument. .IP "access" 8 .IX Item "access" Determines the accessibility of a file. .Sp .Vb 3 \& if( POSIX::access( "/", &POSIX::R_OK ) ){ \& print "have read permission\en"; \& } .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. Note: do not use \f(CW\*(C`access()\*(C'\fR for security purposes. Between the \f(CW\*(C`access()\*(C'\fR call and the operation you are preparing for the permissions might change: a classic \&\fIrace condition\fR. .IP "acos" 8 .IX Item "acos" This is identical to the C function \f(CW\*(C`acos()\*(C'\fR, returning the arcus cosine of its numerical argument. See also Math::Trig. .IP "alarm" 8 .IX Item "alarm" This is identical to Perl's builtin \f(CW\*(C`alarm()\*(C'\fR function, either for arming or disarming the \f(CW\*(C`SIGARLM\*(C'\fR timer. .IP "asctime" 8 .IX Item "asctime" This is identical to the C function \f(CW\*(C`asctime()\*(C'\fR. It returns a string of the form .Sp .Vb 1 \& "Fri Jun 2 18:22:13 2000\en\e0" .Ve .Sp and it is called thusly .Sp .Vb 2 \& $asctime = asctime($sec, $min, $hour, $mday, $mon, $year, \& $wday, $yday, $isdst); .Ve .Sp The \f(CW$mon\fR is zero\-based: January equals \f(CW0\fR. The \f(CW$year\fR is 1900\-based: 2001 equals \f(CW101\fR. The \f(CW$wday\fR, \f(CW$yday\fR, and \f(CW$isdst\fR default to zero (and the first two are usually ignored anyway). .IP "asin" 8 .IX Item "asin" This is identical to the C function \f(CW\*(C`asin()\*(C'\fR, returning the arcus sine of its numerical argument. See also Math::Trig. .IP "assert" 8 .IX Item "assert" Unimplemented, but you can use \*(L"die\*(R" in perlfunc and the Carp module to achieve similar things. .IP "atan" 8 .IX Item "atan" This is identical to the C function \f(CW\*(C`atan()\*(C'\fR, returning the arcus tangent of its numerical argument. See also Math::Trig. .IP "atan2" 8 .IX Item "atan2" This is identical to Perl's builtin \f(CW\*(C`atan2()\*(C'\fR function, returning the arcus tangent defined by its two numerical arguments, the \fIy\fR coordinate and the \fIx\fR coordinate. See also Math::Trig. .IP "atexit" 8 .IX Item "atexit" \&\fIatexit()\fR is C\-specific: use \f(CW\*(C`END {}\*(C'\fR instead, see perlsub. .IP "atof" 8 .IX Item "atof" \&\fIatof()\fR is C\-specific. Perl converts strings to numbers transparently. If you need to force a scalar to a number, add a zero to it. .IP "atoi" 8 .IX Item "atoi" \&\fIatoi()\fR is C\-specific. Perl converts strings to numbers transparently. If you need to force a scalar to a number, add a zero to it. If you need to have just the integer part, see \*(L"int\*(R" in perlfunc. .IP "atol" 8 .IX Item "atol" \&\fIatol()\fR is C\-specific. Perl converts strings to numbers transparently. If you need to force a scalar to a number, add a zero to it. If you need to have just the integer part, see \*(L"int\*(R" in perlfunc. .IP "bsearch" 8 .IX Item "bsearch" \&\fIbsearch()\fR not supplied. For doing binary search on wordlists, see Search::Dict. .IP "calloc" 8 .IX Item "calloc" \&\fIcalloc()\fR is C\-specific. Perl does memory management transparently. .IP "ceil" 8 .IX Item "ceil" This is identical to the C function \f(CW\*(C`ceil()\*(C'\fR, returning the smallest integer value greater than or equal to the given numerical argument. .IP "chdir" 8 .IX Item "chdir" This is identical to Perl's builtin \f(CW\*(C`chdir()\*(C'\fR function, allowing one to change the working (default) directory, see \*(L"chdir\*(R" in perlfunc. .IP "chmod" 8 .IX Item "chmod" This is identical to Perl's builtin \f(CW\*(C`chmod()\*(C'\fR function, allowing one to change file and directory permissions, see \*(L"chmod\*(R" in perlfunc. .IP "chown" 8 .IX Item "chown" This is identical to Perl's builtin \f(CW\*(C`chown()\*(C'\fR function, allowing one to change file and directory owners and groups, see \*(L"chown\*(R" in perlfunc. .IP "clearerr" 8 .IX Item "clearerr" Use the method \f(CW\*(C`IO::Handle::clearerr()\*(C'\fR instead, to reset the error state (if any) and \s-1EOF\s0 state (if any) of the given stream. .IP "clock" 8 .IX Item "clock" This is identical to the C function \f(CW\*(C`clock()\*(C'\fR, returning the amount of spent processor time in microseconds. .IP "close" 8 .IX Item "close" Close the file. This uses file descriptors such as those obtained by calling \&\f(CW\*(C`POSIX::open\*(C'\fR. .Sp .Vb 2 \& $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); \& POSIX::close( $fd ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .Sp See also \*(L"close\*(R" in perlfunc. .IP "closedir" 8 .IX Item "closedir" This is identical to Perl's builtin \f(CW\*(C`closedir()\*(C'\fR function for closing a directory handle, see \*(L"closedir\*(R" in perlfunc. .IP "cos" 8 .IX Item "cos" This is identical to Perl's builtin \f(CW\*(C`cos()\*(C'\fR function, for returning the cosine of its numerical argument, see \*(L"cos\*(R" in perlfunc. See also Math::Trig. .IP "cosh" 8 .IX Item "cosh" This is identical to the C function \f(CW\*(C`cosh()\*(C'\fR, for returning the hyperbolic cosine of its numeric argument. See also Math::Trig. .IP "creat" 8 .IX Item "creat" Create a new file. This returns a file descriptor like the ones returned by \&\f(CW\*(C`POSIX::open\*(C'\fR. Use \f(CW\*(C`POSIX::close\*(C'\fR to close the file. .Sp .Vb 2 \& $fd = POSIX::creat( "foo", 0611 ); \& POSIX::close( $fd ); .Ve .Sp See also \*(L"sysopen\*(R" in perlfunc and its \f(CW\*(C`O_CREAT\*(C'\fR flag. .IP "ctermid" 8 .IX Item "ctermid" Generates the path name for the controlling terminal. .Sp .Vb 1 \& $path = POSIX::ctermid(); .Ve .IP "ctime" 8 .IX Item "ctime" This is identical to the C function \f(CW\*(C`ctime()\*(C'\fR and equivalent to \f(CW\*(C`asctime(localtime(...))\*(C'\fR, see \*(L"asctime\*(R" and \*(L"localtime\*(R". .IP "cuserid" 8 .IX Item "cuserid" Get the login name of the owner of the current process. .Sp .Vb 1 \& $name = POSIX::cuserid(); .Ve .IP "difftime" 8 .IX Item "difftime" This is identical to the C function \f(CW\*(C`difftime()\*(C'\fR, for returning the time difference (in seconds) between two times (as returned by \f(CW\*(C`time()\*(C'\fR), see \*(L"time\*(R". .IP "div" 8 .IX Item "div" \&\fIdiv()\fR is C\-specific, use \*(L"int\*(R" in perlfunc on the usual \f(CW\*(C`/\*(C'\fR division and the modulus \f(CW\*(C`%\*(C'\fR. .IP "dup" 8 .IX Item "dup" This is similar to the C function \f(CW\*(C`dup()\*(C'\fR, for duplicating a file descriptor. .Sp This uses file descriptors such as those obtained by calling \&\f(CW\*(C`POSIX::open\*(C'\fR. .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "dup2" 8 .IX Item "dup2" This is similar to the C function \f(CW\*(C`dup2()\*(C'\fR, for duplicating a file descriptor to an another known file descriptor. .Sp This uses file descriptors such as those obtained by calling \&\f(CW\*(C`POSIX::open\*(C'\fR. .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "errno" 8 .IX Item "errno" Returns the value of errno. .Sp .Vb 1 \& $errno = POSIX::errno(); .Ve .Sp This identical to the numerical values of the \f(CW$!\fR, see \*(L"$ERRNO\*(R" in perlvar. .IP "execl" 8 .IX Item "execl" \&\fIexecl()\fR is C\-specific, see \*(L"exec\*(R" in perlfunc. .IP "execle" 8 .IX Item "execle" \&\fIexecle()\fR is C\-specific, see \*(L"exec\*(R" in perlfunc. .IP "execlp" 8 .IX Item "execlp" \&\fIexeclp()\fR is C\-specific, see \*(L"exec\*(R" in perlfunc. .IP "execv" 8 .IX Item "execv" \&\fIexecv()\fR is C\-specific, see \*(L"exec\*(R" in perlfunc. .IP "execve" 8 .IX Item "execve" \&\fIexecve()\fR is C\-specific, see \*(L"exec\*(R" in perlfunc. .IP "execvp" 8 .IX Item "execvp" \&\fIexecvp()\fR is C\-specific, see \*(L"exec\*(R" in perlfunc. .IP "exit" 8 .IX Item "exit" This is identical to Perl's builtin \f(CW\*(C`exit()\*(C'\fR function for exiting the program, see \*(L"exit\*(R" in perlfunc. .IP "exp" 8 .IX Item "exp" This is identical to Perl's builtin \f(CW\*(C`exp()\*(C'\fR function for returning the exponent (\fIe\fR\-based) of the numerical argument, see \*(L"exp\*(R" in perlfunc. .IP "fabs" 8 .IX Item "fabs" This is identical to Perl's builtin \f(CW\*(C`abs()\*(C'\fR function for returning the absolute value of the numerical argument, see \*(L"abs\*(R" in perlfunc. .IP "fclose" 8 .IX Item "fclose" Use method \f(CW\*(C`IO::Handle::close()\*(C'\fR instead, or see \*(L"close\*(R" in perlfunc. .IP "fcntl" 8 .IX Item "fcntl" This is identical to Perl's builtin \f(CW\*(C`fcntl()\*(C'\fR function, see \*(L"fcntl\*(R" in perlfunc. .IP "fdopen" 8 .IX Item "fdopen" Use method \f(CW\*(C`IO::Handle::new_from_fd()\*(C'\fR instead, or see \*(L"open\*(R" in perlfunc. .IP "feof" 8 .IX Item "feof" Use method \f(CW\*(C`IO::Handle::eof()\*(C'\fR instead, or see \*(L"eof\*(R" in perlfunc. .IP "ferror" 8 .IX Item "ferror" Use method \f(CW\*(C`IO::Handle::error()\*(C'\fR instead. .IP "fflush" 8 .IX Item "fflush" Use method \f(CW\*(C`IO::Handle::flush()\*(C'\fR instead. See also \*(L"$OUTPUT_AUTOFLUSH\*(R" in perlvar. .IP "fgetc" 8 .IX Item "fgetc" Use method \f(CW\*(C`IO::Handle::getc()\*(C'\fR instead, or see \*(L"read\*(R" in perlfunc. .IP "fgetpos" 8 .IX Item "fgetpos" Use method \f(CW\*(C`IO::Seekable::getpos()\*(C'\fR instead, or see \*(L"seek\*(R" in L. .IP "fgets" 8 .IX Item "fgets" Use method \f(CW\*(C`IO::Handle::gets()\*(C'\fR instead. Similar to <>, also known as \*(L"readline\*(R" in perlfunc. .IP "fileno" 8 .IX Item "fileno" Use method \f(CW\*(C`IO::Handle::fileno()\*(C'\fR instead, or see \*(L"fileno\*(R" in perlfunc. .IP "floor" 8 .IX Item "floor" This is identical to the C function \f(CW\*(C`floor()\*(C'\fR, returning the largest integer value less than or equal to the numerical argument. .IP "fmod" 8 .IX Item "fmod" This is identical to the C function \f(CW\*(C`fmod()\*(C'\fR. .Sp .Vb 1 \& $r = fmod($x, $y); .Ve .Sp It returns the remainder \f(CW\*(C`$r = $x \- $n*$y\*(C'\fR, where \f(CW\*(C`$n = trunc($x/$y)\*(C'\fR. The \f(CW$r\fR has the same sign as \f(CW$x\fR and magnitude (absolute value) less than the magnitude of \f(CW$y\fR. .IP "fopen" 8 .IX Item "fopen" Use method \f(CW\*(C`IO::File::open()\*(C'\fR instead, or see \*(L"open\*(R" in perlfunc. .IP "fork" 8 .IX Item "fork" This is identical to Perl's builtin \f(CW\*(C`fork()\*(C'\fR function for duplicating the current process, see \*(L"fork\*(R" in perlfunc and perlfork if you are in Windows. .IP "fpathconf" 8 .IX Item "fpathconf" Retrieves the value of a configurable limit on a file or directory. This uses file descriptors such as those obtained by calling \f(CW\*(C`POSIX::open\*(C'\fR. .Sp The following will determine the maximum length of the longest allowable pathname on the filesystem which holds \f(CW\*(C`/tmp/foo\*(C'\fR. .Sp .Vb 2 \& $fd = POSIX::open( "/tmp/foo", &POSIX::O_RDONLY ); \& $path_max = POSIX::fpathconf( $fd, &POSIX::_PC_PATH_MAX ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "fprintf" 8 .IX Item "fprintf" \&\fIfprintf()\fR is C\-specific, see \*(L"printf\*(R" in perlfunc instead. .IP "fputc" 8 .IX Item "fputc" \&\fIfputc()\fR is C\-specific, see \*(L"print\*(R" in perlfunc instead. .IP "fputs" 8 .IX Item "fputs" \&\fIfputs()\fR is C\-specific, see \*(L"print\*(R" in perlfunc instead. .IP "fread" 8 .IX Item "fread" \&\fIfread()\fR is C\-specific, see \*(L"read\*(R" in perlfunc instead. .IP "free" 8 .IX Item "free" \&\fIfree()\fR is C\-specific. Perl does memory management transparently. .IP "freopen" 8 .IX Item "freopen" \&\fIfreopen()\fR is C\-specific, see \*(L"open\*(R" in perlfunc instead. .IP "frexp" 8 .IX Item "frexp" Return the mantissa and exponent of a floating-point number. .Sp .Vb 1 \& ($mantissa, $exponent) = POSIX::frexp( 1.234e56 ); .Ve .IP "fscanf" 8 .IX Item "fscanf" \&\fIfscanf()\fR is C\-specific, use <> and regular expressions instead. .IP "fseek" 8 .IX Item "fseek" Use method \f(CW\*(C`IO::Seekable::seek()\*(C'\fR instead, or see \*(L"seek\*(R" in perlfunc. .IP "fsetpos" 8 .IX Item "fsetpos" Use method \f(CW\*(C`IO::Seekable::setpos()\*(C'\fR instead, or seek \*(L"seek\*(R" in perlfunc. .IP "fstat" 8 .IX Item "fstat" Get file status. This uses file descriptors such as those obtained by calling \f(CW\*(C`POSIX::open\*(C'\fR. The data returned is identical to the data from Perl's builtin \f(CW\*(C`stat\*(C'\fR function. .Sp .Vb 2 \& $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); \& @stats = POSIX::fstat( $fd ); .Ve .IP "ftell" 8 .IX Item "ftell" Use method \f(CW\*(C`IO::Seekable::tell()\*(C'\fR instead, or see \*(L"tell\*(R" in perlfunc. .IP "fwrite" 8 .IX Item "fwrite" \&\fIfwrite()\fR is C\-specific, see \*(L"print\*(R" in perlfunc instead. .IP "getc" 8 .IX Item "getc" This is identical to Perl's builtin \f(CW\*(C`getc()\*(C'\fR function, see \*(L"getc\*(R" in perlfunc. .IP "getchar" 8 .IX Item "getchar" Returns one character from \s-1STDIN\s0. Identical to Perl's \f(CW\*(C`getc()\*(C'\fR, see \*(L"getc\*(R" in perlfunc. .IP "getcwd" 8 .IX Item "getcwd" Returns the name of the current working directory. See also Cwd. .IP "getegid" 8 .IX Item "getegid" Returns the effective group identifier. Similar to Perl' s builtin variable \f(CW$(\fR, see \*(L"$EGID\*(R" in perlvar. .IP "getenv" 8 .IX Item "getenv" Returns the value of the specified enironment variable. The same information is available through the \f(CW%ENV\fR array. .IP "geteuid" 8 .IX Item "geteuid" Returns the effective user identifier. Identical to Perl's builtin \f(CW$>\fR variable, see \*(L"$EUID\*(R" in perlvar. .IP "getgid" 8 .IX Item "getgid" Returns the user's real group identifier. Similar to Perl's builtin variable \f(CW$)\fR, see \*(L"$GID\*(R" in perlvar. .IP "getgrgid" 8 .IX Item "getgrgid" This is identical to Perl's builtin \f(CW\*(C`getgrgid()\*(C'\fR function for returning group entries by group identifiers, see \&\*(L"getgrgid\*(R" in perlfunc. .IP "getgrnam" 8 .IX Item "getgrnam" This is identical to Perl's builtin \f(CW\*(C`getgrnam()\*(C'\fR function for returning group entries by group names, see \*(L"getgrnam\*(R" in perlfunc. .IP "getgroups" 8 .IX Item "getgroups" Returns the ids of the user's supplementary groups. Similar to Perl's builtin variable \f(CW$)\fR, see \*(L"$GID\*(R" in perlvar. .IP "getlogin" 8 .IX Item "getlogin" This is identical to Perl's builtin \f(CW\*(C`getlogin()\*(C'\fR function for returning the user name associated with the current session, see \&\*(L"getlogin\*(R" in perlfunc. .IP "getpgrp" 8 .IX Item "getpgrp" This is identical to Perl's builtin \f(CW\*(C`getpgrp()\*(C'\fR function for returning the prcess group identifier of the current process, see \&\*(L"getpgrp\*(R" in perlfunc. .IP "getpid" 8 .IX Item "getpid" Returns the process identifier. Identical to Perl's builtin variable \f(CW$$\fR, see \*(L"$PID\*(R" in perlvar. .IP "getppid" 8 .IX Item "getppid" This is identical to Perl's builtin \f(CW\*(C`getppid()\*(C'\fR function for returning the process identifier of the parent process of the current process , see \*(L"getppid\*(R" in perlfunc. .IP "getpwnam" 8 .IX Item "getpwnam" This is identical to Perl's builtin \f(CW\*(C`getpwnam()\*(C'\fR function for returning user entries by user names, see \*(L"getpwnam\*(R" in perlfunc. .IP "getpwuid" 8 .IX Item "getpwuid" This is identical to Perl's builtin \f(CW\*(C`getpwuid()\*(C'\fR function for returning user entries by user identifiers, see \*(L"getpwuid\*(R" in perlfunc. .IP "gets" 8 .IX Item "gets" Returns one line from \f(CW\*(C`STDIN\*(C'\fR, similar to <>, also known as the \f(CW\*(C`readline()\*(C'\fR function, see \*(L"readline\*(R" in perlfunc. .Sp \&\fB\s-1NOTE\s0\fR: if you have C programs that still use \f(CW\*(C`gets()\*(C'\fR, be very afraid. The \f(CW\*(C`gets()\*(C'\fR function is a source of endless grief because it has no buffer overrun checks. It should \fBnever\fR be used. The \&\f(CW\*(C`fgets()\*(C'\fR function should be preferred instead. .IP "getuid" 8 .IX Item "getuid" Returns the user's identifier. Identical to Perl's builtin \f(CW$<\fR variable, see \*(L"$UID\*(R" in perlvar. .IP "gmtime" 8 .IX Item "gmtime" This is identical to Perl's builtin \f(CW\*(C`gmtime()\*(C'\fR function for converting seconds since the epoch to a date in Greenwich Mean Time, see \*(L"gmtime\*(R" in perlfunc. .IP "isalnum" 8 .IX Item "isalnum" This is identical to the C function, except that it can apply to a single character or to a whole string. Consider using regular expressions and the \&\f(CW\*(C`/[[:alnum:]]/\*(C'\fR construct instead, or possibly the \f(CW\*(C`/\ew/\*(C'\fR construct. .IP "isalpha" 8 .IX Item "isalpha" This is identical to the C function, except that it can apply to a single character or to a whole string. Consider using regular expressions and the \&\f(CW\*(C`/[[:alpha:]]/\*(C'\fR construct instead. .IP "isatty" 8 .IX Item "isatty" Returns a boolean indicating whether the specified filehandle is connected to a tty. Similar to the \f(CW\*(C`\-t\*(C'\fR operator, see \*(L"\-X\*(R" in perlfunc. .IP "iscntrl" 8 .IX Item "iscntrl" This is identical to the C function, except that it can apply to a single character or to a whole string. Consider using regular expressions and the \&\f(CW\*(C`/[[:cntrl:]]/\*(C'\fR construct instead. .IP "isdigit" 8 .IX Item "isdigit" This is identical to the C function, except that it can apply to a single character or to a whole string. Consider using regular expressions and the \&\f(CW\*(C`/[[:digit:]]/\*(C'\fR construct instead, or the \f(CW\*(C`/\ed/\*(C'\fR construct. .IP "isgraph" 8 .IX Item "isgraph" This is identical to the C function, except that it can apply to a single character or to a whole string. Consider using regular expressions and the \&\f(CW\*(C`/[[:graph:]]/\*(C'\fR construct instead. .IP "islower" 8 .IX Item "islower" This is identical to the C function, except that it can apply to a single character or to a whole string. Consider using regular expressions and the \&\f(CW\*(C`/[[:lower:]]/\*(C'\fR construct instead. Do \fBnot\fR use \f(CW\*(C`/[a\-z]/\*(C'\fR. .IP "isprint" 8 .IX Item "isprint" This is identical to the C function, except that it can apply to a single character or to a whole string. Consider using regular expressions and the \&\f(CW\*(C`/[[:print:]]/\*(C'\fR construct instead. .IP "ispunct" 8 .IX Item "ispunct" This is identical to the C function, except that it can apply to a single character or to a whole string. Consider using regular expressions and the \&\f(CW\*(C`/[[:punct:]]/\*(C'\fR construct instead. .IP "isspace" 8 .IX Item "isspace" This is identical to the C function, except that it can apply to a single character or to a whole string. Consider using regular expressions and the \&\f(CW\*(C`/[[:space:]]/\*(C'\fR construct instead, or the \f(CW\*(C`/\es/\*(C'\fR construct. (Note that \f(CW\*(C`/\es/\*(C'\fR and \f(CW\*(C`/[[:space:]]/\*(C'\fR are slightly different in that \&\f(CW\*(C`/[[:space:]]/\*(C'\fR can normally match a vertical tab, while \f(CW\*(C`/\es/\*(C'\fR does not.) .IP "isupper" 8 .IX Item "isupper" This is identical to the C function, except that it can apply to a single character or to a whole string. Consider using regular expressions and the \&\f(CW\*(C`/[[:upper:]]/\*(C'\fR construct instead. Do \fBnot\fR use \f(CW\*(C`/[A\-Z]/\*(C'\fR. .IP "isxdigit" 8 .IX Item "isxdigit" This is identical to the C function, except that it can apply to a single character or to a whole string. Consider using regular expressions and the \&\f(CW\*(C`/[[:xdigit:]]/\*(C'\fR construct instead, or simply \f(CW\*(C`/[0\-9a\-f]/i\*(C'\fR. .IP "kill" 8 .IX Item "kill" This is identical to Perl's builtin \f(CW\*(C`kill()\*(C'\fR function for sending signals to processes (often to terminate them), see \*(L"kill\*(R" in perlfunc. .IP "labs" 8 .IX Item "labs" (For returning absolute values of long integers.) \&\fIlabs()\fR is C\-specific, see \*(L"abs\*(R" in perlfunc instead. .IP "ldexp" 8 .IX Item "ldexp" This is identical to the C function \f(CW\*(C`ldexp()\*(C'\fR for multiplying floating point numbers with powers of two. .Sp .Vb 1 \& $x_quadrupled = POSIX::ldexp($x, 2); .Ve .IP "ldiv" 8 .IX Item "ldiv" (For computing dividends of long integers.) \&\fIldiv()\fR is C\-specific, use \f(CW\*(C`/\*(C'\fR and \f(CW\*(C`int()\*(C'\fR instead. .IP "link" 8 .IX Item "link" This is identical to Perl's builtin \f(CW\*(C`link()\*(C'\fR function for creating hard links into files, see \*(L"link\*(R" in perlfunc. .IP "localeconv" 8 .IX Item "localeconv" Get numeric formatting information. Returns a reference to a hash containing the current locale formatting values. .Sp Here is how to query the database for the \fBde\fR (Deutsch or German) locale. .Sp .Vb 21 \& $loc = POSIX::setlocale( &POSIX::LC_ALL, "de" ); \& print "Locale = $loc\en"; \& $lconv = POSIX::localeconv(); \& print "decimal_point = ", $lconv->{decimal_point}, "\en"; \& print "thousands_sep = ", $lconv->{thousands_sep}, "\en"; \& print "grouping = ", $lconv->{grouping}, "\en"; \& print "int_curr_symbol = ", $lconv->{int_curr_symbol}, "\en"; \& print "currency_symbol = ", $lconv->{currency_symbol}, "\en"; \& print "mon_decimal_point = ", $lconv->{mon_decimal_point}, "\en"; \& print "mon_thousands_sep = ", $lconv->{mon_thousands_sep}, "\en"; \& print "mon_grouping = ", $lconv->{mon_grouping}, "\en"; \& print "positive_sign = ", $lconv->{positive_sign}, "\en"; \& print "negative_sign = ", $lconv->{negative_sign}, "\en"; \& print "int_frac_digits = ", $lconv->{int_frac_digits}, "\en"; \& print "frac_digits = ", $lconv->{frac_digits}, "\en"; \& print "p_cs_precedes = ", $lconv->{p_cs_precedes}, "\en"; \& print "p_sep_by_space = ", $lconv->{p_sep_by_space}, "\en"; \& print "n_cs_precedes = ", $lconv->{n_cs_precedes}, "\en"; \& print "n_sep_by_space = ", $lconv->{n_sep_by_space}, "\en"; \& print "p_sign_posn = ", $lconv->{p_sign_posn}, "\en"; \& print "n_sign_posn = ", $lconv->{n_sign_posn}, "\en"; .Ve .IP "localtime" 8 .IX Item "localtime" This is identical to Perl's builtin \f(CW\*(C`localtime()\*(C'\fR function for converting seconds since the epoch to a date see \*(L"localtime\*(R" in perlfunc. .IP "log" 8 .IX Item "log" This is identical to Perl's builtin \f(CW\*(C`log()\*(C'\fR function, returning the natural (\fIe\fR\-based) logarithm of the numerical argument, see \*(L"log\*(R" in perlfunc. .IP "log10" 8 .IX Item "log10" This is identical to the C function \f(CW\*(C`log10()\*(C'\fR, returning the 10\-base logarithm of the numerical argument. You can also use .Sp .Vb 1 \& sub log10 { log($_[0]) / log(10) } .Ve .Sp or .Sp .Vb 1 \& sub log10 { log($_[0]) / 2.30258509299405 } .Ve .Sp or .Sp .Vb 1 \& sub log10 { log($_[0]) * 0.434294481903252 } .Ve .IP "longjmp" 8 .IX Item "longjmp" \&\fIlongjmp()\fR is C\-specific: use \*(L"die\*(R" in perlfunc instead. .IP "lseek" 8 .IX Item "lseek" Move the file's read/write position. This uses file descriptors such as those obtained by calling \f(CW\*(C`POSIX::open\*(C'\fR. .Sp .Vb 2 \& $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); \& $off_t = POSIX::lseek( $fd, 0, &POSIX::SEEK_SET ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "malloc" 8 .IX Item "malloc" \&\fImalloc()\fR is C\-specific. Perl does memory management transparently. .IP "mblen" 8 .IX Item "mblen" This is identical to the C function \f(CW\*(C`mblen()\*(C'\fR. Perl does not have any support for the wide and multibyte characters of the C standards, so this might be a rather useless function. .IP "mbstowcs" 8 .IX Item "mbstowcs" This is identical to the C function \f(CW\*(C`mbstowcs()\*(C'\fR. Perl does not have any support for the wide and multibyte characters of the C standards, so this might be a rather useless function. .IP "mbtowc" 8 .IX Item "mbtowc" This is identical to the C function \f(CW\*(C`mbtowc()\*(C'\fR. Perl does not have any support for the wide and multibyte characters of the C standards, so this might be a rather useless function. .IP "memchr" 8 .IX Item "memchr" \&\fImemchr()\fR is C\-specific, see \*(L"index\*(R" in perlfunc instead. .IP "memcmp" 8 .IX Item "memcmp" \&\fImemcmp()\fR is C\-specific, use \f(CW\*(C`eq\*(C'\fR instead, see perlop. .IP "memcpy" 8 .IX Item "memcpy" \&\fImemcpy()\fR is C\-specific, use \f(CW\*(C`=\*(C'\fR, see perlop, or see \*(L"substr\*(R" in perlfunc. .IP "memmove" 8 .IX Item "memmove" \&\fImemmove()\fR is C\-specific, use \f(CW\*(C`=\*(C'\fR, see perlop, or see \*(L"substr\*(R" in perlfunc. .IP "memset" 8 .IX Item "memset" \&\fImemset()\fR is C\-specific, use \f(CW\*(C`x\*(C'\fR instead, see perlop. .IP "mkdir" 8 .IX Item "mkdir" This is identical to Perl's builtin \f(CW\*(C`mkdir()\*(C'\fR function for creating directories, see \*(L"mkdir\*(R" in perlfunc. .IP "mkfifo" 8 .IX Item "mkfifo" This is similar to the C function \f(CW\*(C`mkfifo()\*(C'\fR for creating \&\s-1FIFO\s0 special files. .Sp .Vb 1 \& if (mkfifo($path, $mode)) { .... .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. The \f(CW$mode\fR is similar to the mode of \f(CW\*(C`mkdir()\*(C'\fR, see \*(L"mkdir\*(R" in perlfunc. .IP "mktime" 8 .IX Item "mktime" Convert date/time info to a calendar time. .Sp Synopsis: .Sp .Vb 1 \& mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0) .Ve .Sp The month (\f(CW\*(C`mon\*(C'\fR), weekday (\f(CW\*(C`wday\*(C'\fR), and yearday (\f(CW\*(C`yday\*(C'\fR) begin at zero. I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The year (\f(CW\*(C`year\*(C'\fR) is given in years since 1900. I.e. The year 1995 is 95; the year 2001 is 101. Consult your system's \f(CW\*(C`mktime()\*(C'\fR manpage for details about these and the other arguments. .Sp Calendar time for December 12, 1995, at 10:30 am. .Sp .Vb 2 \& $time_t = POSIX::mktime( 0, 30, 10, 12, 11, 95 ); \& print "Date = ", POSIX::ctime($time_t); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "modf" 8 .IX Item "modf" Return the integral and fractional parts of a floating-point number. .Sp .Vb 1 \& ($fractional, $integral) = POSIX::modf( 3.14 ); .Ve .IP "nice" 8 .IX Item "nice" This is similar to the C function \f(CW\*(C`nice()\*(C'\fR, for changing the scheduling preference of the current process. Positive arguments mean more polite process, negative values more needy process. Normal user processes can only be more polite. .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "offsetof" 8 .IX Item "offsetof" \&\fIoffsetof()\fR is C\-specific, you probably want to see \*(L"pack\*(R" in perlfunc instead. .IP "open" 8 .IX Item "open" Open a file for reading for writing. This returns file descriptors, not Perl filehandles. Use \f(CW\*(C`POSIX::close\*(C'\fR to close the file. .Sp Open a file read-only with mode 0666. .Sp .Vb 1 \& $fd = POSIX::open( "foo" ); .Ve .Sp Open a file for read and write. .Sp .Vb 1 \& $fd = POSIX::open( "foo", &POSIX::O_RDWR ); .Ve .Sp Open a file for write, with truncation. .Sp .Vb 1 \& $fd = POSIX::open( "foo", &POSIX::O_WRONLY | &POSIX::O_TRUNC ); .Ve .Sp Create a new file with mode 0640. Set up the file for writing. .Sp .Vb 1 \& $fd = POSIX::open( "foo", &POSIX::O_CREAT | &POSIX::O_WRONLY, 0640 ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .Sp See also \*(L"sysopen\*(R" in perlfunc. .IP "opendir" 8 .IX Item "opendir" Open a directory for reading. .Sp .Vb 3 \& $dir = POSIX::opendir( "/tmp" ); \& @files = POSIX::readdir( $dir ); \& POSIX::closedir( $dir ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "pathconf" 8 .IX Item "pathconf" Retrieves the value of a configurable limit on a file or directory. .Sp The following will determine the maximum length of the longest allowable pathname on the filesystem which holds \f(CW\*(C`/tmp\*(C'\fR. .Sp .Vb 1 \& $path_max = POSIX::pathconf( "/tmp", &POSIX::_PC_PATH_MAX ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "pause" 8 .IX Item "pause" This is similar to the C function \f(CW\*(C`pause()\*(C'\fR, which suspends the execution of the current process until a signal is received. .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "perror" 8 .IX Item "perror" This is identical to the C function \f(CW\*(C`perror()\*(C'\fR, which outputs to the standard error stream the specified message followed by \*(L": \*(R" and the current error string. Use the \f(CW\*(C`warn()\*(C'\fR function and the \f(CW$!\fR variable instead, see \*(L"warn\*(R" in perlfunc and \*(L"$ERRNO\*(R" in perlvar. .IP "pipe" 8 .IX Item "pipe" Create an interprocess channel. This returns file descriptors like those returned by \f(CW\*(C`POSIX::open\*(C'\fR. .Sp .Vb 3 \& ($fd0, $fd1) = POSIX::pipe(); \& POSIX::write( $fd0, "hello", 5 ); \& POSIX::read( $fd1, $buf, 5 ); .Ve .Sp See also \*(L"pipe\*(R" in perlfunc. .IP "pow" 8 .IX Item "pow" Computes \f(CW$x\fR raised to the power \f(CW$exponent\fR. .Sp .Vb 1 \& $ret = POSIX::pow( $x, $exponent ); .Ve .Sp You can also use the \f(CW\*(C`**\*(C'\fR operator, see perlop. .IP "printf" 8 .IX Item "printf" Formats and prints the specified arguments to \s-1STDOUT\s0. See also \*(L"printf\*(R" in perlfunc. .IP "putc" 8 .IX Item "putc" \&\fIputc()\fR is C\-specific, see \*(L"print\*(R" in perlfunc instead. .IP "putchar" 8 .IX Item "putchar" \&\fIputchar()\fR is C\-specific, see \*(L"print\*(R" in perlfunc instead. .IP "puts" 8 .IX Item "puts" \&\fIputs()\fR is C\-specific, see \*(L"print\*(R" in perlfunc instead. .IP "qsort" 8 .IX Item "qsort" \&\fIqsort()\fR is C\-specific, see \*(L"sort\*(R" in perlfunc instead. .IP "raise" 8 .IX Item "raise" Sends the specified signal to the current process. See also \*(L"kill\*(R" in perlfunc and the \f(CW$$\fR in \*(L"$PID\*(R" in perlvar. .IP "rand" 8 .IX Item "rand" \&\f(CW\*(C`rand()\*(C'\fR is non\-portable, see \*(L"rand\*(R" in perlfunc instead. .IP "read" 8 .IX Item "read" Read from a file. This uses file descriptors such as those obtained by calling \f(CW\*(C`POSIX::open\*(C'\fR. If the buffer \f(CW$buf\fR is not large enough for the read then Perl will extend it to make room for the request. .Sp .Vb 2 \& $fd = POSIX::open( "foo", &POSIX::O_RDONLY ); \& $bytes = POSIX::read( $fd, $buf, 3 ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .Sp See also \*(L"sysread\*(R" in perlfunc. .IP "readdir" 8 .IX Item "readdir" This is identical to Perl's builtin \f(CW\*(C`readdir()\*(C'\fR function for reading directory entries, see \*(L"readdir\*(R" in perlfunc. .IP "realloc" 8 .IX Item "realloc" \&\fIrealloc()\fR is C\-specific. Perl does memory management transparently. .IP "remove" 8 .IX Item "remove" This is identical to Perl's builtin \f(CW\*(C`unlink()\*(C'\fR function for removing files, see \*(L"unlink\*(R" in perlfunc. .IP "rename" 8 .IX Item "rename" This is identical to Perl's builtin \f(CW\*(C`rename()\*(C'\fR function for renaming files, see \*(L"rename\*(R" in perlfunc. .IP "rewind" 8 .IX Item "rewind" Seeks to the beginning of the file. .IP "rewinddir" 8 .IX Item "rewinddir" This is identical to Perl's builtin \f(CW\*(C`rewinddir()\*(C'\fR function for rewinding directory entry streams, see \*(L"rewinddir\*(R" in perlfunc. .IP "rmdir" 8 .IX Item "rmdir" This is identical to Perl's builtin \f(CW\*(C`rmdir()\*(C'\fR function for removing (empty) directories, see \*(L"rmdir\*(R" in perlfunc. .IP "scanf" 8 .IX Item "scanf" \&\fIscanf()\fR is C\-specific, use <> and regular expressions instead, see perlre. .IP "setgid" 8 .IX Item "setgid" Sets the real group identifier and the effective group identifier for this process. Similar to assigning a value to the Perl's builtin \&\f(CW$)\fR variable, see \*(L"$GID\*(R" in perlvar, except that the latter will change only the real user identifier, and that the \fIsetgid()\fR uses only a single numeric argument, as opposed to a space-separated list of numbers. .IP "setjmp" 8 .IX Item "setjmp" \&\f(CW\*(C`setjmp()\*(C'\fR is C\-specific: use \f(CW\*(C`eval {}\*(C'\fR instead, see \*(L"eval\*(R" in perlfunc. .IP "setlocale" 8 .IX Item "setlocale" Modifies and queries program's locale. The following examples assume .Sp .Vb 1 \& use POSIX qw(setlocale LC_ALL LC_CTYPE); .Ve .Sp has been issued. .Sp The following will set the traditional \s-1UNIX\s0 system locale behavior (the second argument \f(CW"C"\fR). .Sp .Vb 1 \& $loc = setlocale( LC_ALL, "C" ); .Ve .Sp The following will query the current \s-1LC_CTYPE\s0 category. (No second argument means 'query'.) .Sp .Vb 1 \& $loc = setlocale( LC_CTYPE ); .Ve .Sp The following will set the \s-1LC_CTYPE\s0 behaviour according to the locale environment variables (the second argument \f(CW""\fR). Please see your systems \f(CWsetlocale(3)\fR documentation for the locale environment variables' meaning or consult perllocale. .Sp .Vb 1 \& $loc = setlocale( LC_CTYPE, "" ); .Ve .Sp The following will set the \s-1LC_COLLATE\s0 behaviour to Argentinian Spanish. \fB\s-1NOTE\s0\fR: The naming and availability of locales depends on your operating system. Please consult perllocale for how to find out which locales are available in your system. .Sp .Vb 1 \& $loc = setlocale( LC_ALL, "es_AR.ISO8859-1" ); .Ve .IP "setpgid" 8 .IX Item "setpgid" This is similar to the C function \f(CW\*(C`setpgid()\*(C'\fR for setting the process group identifier of the current process. .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "setsid" 8 .IX Item "setsid" This is identical to the C function \f(CW\*(C`setsid()\*(C'\fR for setting the session identifier of the current process. .IP "setuid" 8 .IX Item "setuid" Sets the real user identifier and the effective user identifier for this process. Similar to assigning a value to the Perl's builtin \&\f(CW$<\fR variable, see \*(L"$UID\*(R" in perlvar, except that the latter will change only the real user identifier. .IP "sigaction" 8 .IX Item "sigaction" Detailed signal management. This uses \f(CW\*(C`POSIX::SigAction\*(C'\fR objects for the \&\f(CW\*(C`action\*(C'\fR and \f(CW\*(C`oldaction\*(C'\fR arguments. Consult your system's \f(CW\*(C`sigaction\*(C'\fR manpage for details. .Sp Synopsis: .Sp .Vb 1 \& sigaction(sig, action, oldaction = 0) .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "siglongjmp" 8 .IX Item "siglongjmp" \&\fIsiglongjmp()\fR is C\-specific: use \*(L"die\*(R" in perlfunc instead. .IP "sigpending" 8 .IX Item "sigpending" Examine signals that are blocked and pending. This uses \f(CW\*(C`POSIX::SigSet\*(C'\fR objects for the \f(CW\*(C`sigset\*(C'\fR argument. Consult your system's \f(CW\*(C`sigpending\*(C'\fR manpage for details. .Sp Synopsis: .Sp .Vb 1 \& sigpending(sigset) .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "sigprocmask" 8 .IX Item "sigprocmask" Change and/or examine calling process's signal mask. This uses \&\f(CW\*(C`POSIX::SigSet\*(C'\fR objects for the \f(CW\*(C`sigset\*(C'\fR and \f(CW\*(C`oldsigset\*(C'\fR arguments. Consult your system's \f(CW\*(C`sigprocmask\*(C'\fR manpage for details. .Sp Synopsis: .Sp .Vb 1 \& sigprocmask(how, sigset, oldsigset = 0) .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "sigsetjmp" 8 .IX Item "sigsetjmp" \&\f(CW\*(C`sigsetjmp()\*(C'\fR is C\-specific: use \f(CW\*(C`eval {}\*(C'\fR instead, see \*(L"eval\*(R" in perlfunc. .IP "sigsuspend" 8 .IX Item "sigsuspend" Install a signal mask and suspend process until signal arrives. This uses \&\f(CW\*(C`POSIX::SigSet\*(C'\fR objects for the \f(CW\*(C`signal_mask\*(C'\fR argument. Consult your system's \f(CW\*(C`sigsuspend\*(C'\fR manpage for details. .Sp Synopsis: .Sp .Vb 1 \& sigsuspend(signal_mask) .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "sin" 8 .IX Item "sin" This is identical to Perl's builtin \f(CW\*(C`sin()\*(C'\fR function for returning the sine of the numerical argument, see \*(L"sin\*(R" in perlfunc. See also Math::Trig. .IP "sinh" 8 .IX Item "sinh" This is identical to the C function \f(CW\*(C`sinh()\*(C'\fR for returning the hyperbolic sine of the numerical argument. See also Math::Trig. .IP "sleep" 8 .IX Item "sleep" This is functionally identical to Perl's builtin \f(CW\*(C`sleep()\*(C'\fR function for suspending the execution of the current for process for certain number of seconds, see \*(L"sleep\*(R" in perlfunc. There is one signifanct difference, however: \f(CW\*(C`POSIX::sleep()\*(C'\fR returns the number of \&\fBunslept\fR seconds, while the \f(CW\*(C`CORE::sleep()\*(C'\fR returns the number of slept seconds. .IP "sprintf" 8 .IX Item "sprintf" This is similar to Perl's builtin \f(CW\*(C`sprintf()\*(C'\fR function for returning a string that has the arguments formatted as requested, see \*(L"sprintf\*(R" in perlfunc. .IP "sqrt" 8 .IX Item "sqrt" This is identical to Perl's builtin \f(CW\*(C`sqrt()\*(C'\fR function. for returning the square root of the numerical argument, see \*(L"sqrt\*(R" in perlfunc. .IP "srand" 8 .IX Item "srand" Give a seed the pseudorandom number generator, see \*(L"srand\*(R" in perlfunc. .IP "sscanf" 8 .IX Item "sscanf" \&\fIsscanf()\fR is C\-specific, use regular expressions instead, see perlre. .IP "stat" 8 .IX Item "stat" This is identical to Perl's builtin \f(CW\*(C`stat()\*(C'\fR function for retutning information about files and directories. .IP "strcat" 8 .IX Item "strcat" \&\fIstrcat()\fR is C\-specific, use \f(CW\*(C`.=\*(C'\fR instead, see perlop. .IP "strchr" 8 .IX Item "strchr" \&\fIstrchr()\fR is C\-specific, see \*(L"index\*(R" in perlfunc instead. .IP "strcmp" 8 .IX Item "strcmp" \&\fIstrcmp()\fR is C\-specific, use \f(CW\*(C`eq\*(C'\fR or \f(CW\*(C`cmp\*(C'\fR instead, see perlop. .IP "strcoll" 8 .IX Item "strcoll" This is identical to the C function \f(CW\*(C`strcoll()\*(C'\fR for collating (comparing) strings transformed using the \f(CW\*(C`strxfrm()\*(C'\fR function. Not really needed since Perl can do this transparently, see perllocale. .IP "strcpy" 8 .IX Item "strcpy" \&\fIstrcpy()\fR is C\-specific, use \f(CW\*(C`=\*(C'\fR instead, see perlop. .IP "strcspn" 8 .IX Item "strcspn" \&\fIstrcspn()\fR is C\-specific, use regular expressions instead, see perlre. .IP "strerror" 8 .IX Item "strerror" Returns the error string for the specified errno. Identical to the string form of the \f(CW$!\fR, see \*(L"$ERRNO\*(R" in perlvar. .IP "strftime" 8 .IX Item "strftime" Convert date and time information to string. Returns the string. .Sp Synopsis: .Sp .Vb 1 \& strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) .Ve .Sp The month (\f(CW\*(C`mon\*(C'\fR), weekday (\f(CW\*(C`wday\*(C'\fR), and yearday (\f(CW\*(C`yday\*(C'\fR) begin at zero. I.e. January is 0, not 1; Sunday is 0, not 1; January 1st is 0, not 1. The year (\f(CW\*(C`year\*(C'\fR) is given in years since 1900. I.e., the year 1995 is 95; the year 2001 is 101. Consult your system's \f(CW\*(C`strftime()\*(C'\fR manpage for details about these and the other arguments. If you want your code to be portable, your format (\f(CW\*(C`fmt\*(C'\fR) argument should use only the conversion specifiers defined by the \s-1ANSI\s0 C standard. These are \f(CW\*(C`aAbBcdHIjmMpSUwWxXyYZ%\*(C'\fR. The given arguments are made consistent as though by calling \f(CW\*(C`mktime()\*(C'\fR before calling your system's \&\f(CW\*(C`strftime()\*(C'\fR function, except that the \f(CW\*(C`isdst\*(C'\fR value is not affected. .Sp The string for Tuesday, December 12, 1995. .Sp .Vb 2 \& $str = POSIX::strftime( "%A, %B %d, %Y", 0, 0, 0, 12, 11, 95, 2 ); \& print "$str\en"; .Ve .IP "strlen" 8 .IX Item "strlen" \&\fIstrlen()\fR is C\-specific, use \f(CW\*(C`length()\*(C'\fR instead, see \*(L"length\*(R" in perlfunc. .IP "strncat" 8 .IX Item "strncat" \&\fIstrncat()\fR is C\-specific, use \f(CW\*(C`.=\*(C'\fR instead, see perlop. .IP "strncmp" 8 .IX Item "strncmp" \&\fIstrncmp()\fR is C\-specific, use \f(CW\*(C`eq\*(C'\fR instead, see perlop. .IP "strncpy" 8 .IX Item "strncpy" \&\fIstrncpy()\fR is C\-specific, use \f(CW\*(C`=\*(C'\fR instead, see perlop. .IP "strpbrk" 8 .IX Item "strpbrk" \&\fIstrpbrk()\fR is C\-specific, use regular expressions instead, see perlre. .IP "strrchr" 8 .IX Item "strrchr" \&\fIstrrchr()\fR is C\-specific, see \*(L"rindex\*(R" in perlfunc instead. .IP "strspn" 8 .IX Item "strspn" \&\fIstrspn()\fR is C\-specific, use regular expressions instead, see perlre. .IP "strstr" 8 .IX Item "strstr" This is identical to Perl's builtin \f(CW\*(C`index()\*(C'\fR function, see \*(L"index\*(R" in perlfunc. .IP "strtod" 8 .IX Item "strtod" 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 $!. .Sp strtod should respect any \s-1POSIX\s0 \fI\fIsetlocale()\fI\fR settings. .Sp To parse a string \f(CW$str\fR as a floating point number use .Sp .Vb 2 \& $! = 0; \& ($num, $n_unparsed) = POSIX::strtod($str); .Ve .Sp The second returned item and $! can be used to check for valid input: .Sp .Vb 3 \& if (($str eq '') || ($n_unparsed != 0) || !$!) { \& die "Non-numeric input $str" . $! ? ": $!\en" : "\en"; \& } .Ve .Sp When called in a scalar context strtod returns the parsed number. .IP "strtok" 8 .IX Item "strtok" \&\fIstrtok()\fR is C\-specific, use regular expressions instead, see perlre, or \*(L"split\*(R" in perlfunc. .IP "strtol" 8 .IX Item "strtol" 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 $!. .Sp strtol should respect any \s-1POSIX\s0 \fI\fIsetlocale()\fI\fR settings. .Sp To parse a string \f(CW$str\fR as a number in some base \f(CW$base\fR use .Sp .Vb 2 \& $! = 0; \& ($num, $n_unparsed) = POSIX::strtol($str, $base); .Ve .Sp 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 \*(L"0x\*(R" or \*(L"0X\*(R" means hexadecimal; a leading \*(L"0\*(R" means octal; any other leading characters mean decimal. Thus, \*(L"1234\*(R" is parsed as a decimal number, \*(L"01234\*(R" as an octal number, and \*(L"0x1234\*(R" as a hexadecimal number. .Sp The second returned item and $! can be used to check for valid input: .Sp .Vb 3 \& if (($str eq '') || ($n_unparsed != 0) || !$!) { \& die "Non-numeric input $str" . $! ? ": $!\en" : "\en"; \& } .Ve .Sp When called in a scalar context strtol returns the parsed number. .IP "strtoul" 8 .IX Item "strtoul" String to unsigned (long) integer translation. \fIstrtoul()\fR is identical to \fIstrtol()\fR except that \fIstrtoul()\fR only parses unsigned integers. See \&\*(L"strtol\*(R" for details. .Sp Note: Some vendors supply \fIstrtod()\fR and \fIstrtol()\fR but not \fIstrtoul()\fR. Other vendors that do supply \fIstrtoul()\fR parse \*(L"\-1\*(R" as a valid value. .IP "strxfrm" 8 .IX Item "strxfrm" String transformation. Returns the transformed string. .Sp .Vb 1 \& $dst = POSIX::strxfrm( $src ); .Ve .Sp Used in conjunction with the \f(CW\*(C`strcoll()\*(C'\fR function, see \*(L"strcoll\*(R". .Sp Not really needed since Perl can do this transparently, see perllocale. .IP "sysconf" 8 .IX Item "sysconf" Retrieves values of system configurable variables. .Sp The following will get the machine's clock speed. .Sp .Vb 1 \& $clock_ticks = POSIX::sysconf( &POSIX::_SC_CLK_TCK ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "system" 8 .IX Item "system" This is identical to Perl's builtin \f(CW\*(C`system()\*(C'\fR function, see \&\*(L"system\*(R" in perlfunc. .IP "tan" 8 .IX Item "tan" This is identical to the C function \f(CW\*(C`tan()\*(C'\fR, returning the tangent of the numerical argument. See also Math::Trig. .IP "tanh" 8 .IX Item "tanh" This is identical to the C function \f(CW\*(C`tanh()\*(C'\fR, returning the hyperbolic tangent of the numerical argument. See also Math::Trig. .IP "tcdrain" 8 .IX Item "tcdrain" This is similar to the C function \f(CW\*(C`tcdrain()\*(C'\fR for draining the output queue of its argument stream. .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "tcflow" 8 .IX Item "tcflow" This is similar to the C function \f(CW\*(C`tcflow()\*(C'\fR for controlling the flow of its argument stream. .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "tcflush" 8 .IX Item "tcflush" This is similar to the C function \f(CW\*(C`tcflush()\*(C'\fR for flushing the I/O buffers of its argumeny stream. .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "tcgetpgrp" 8 .IX Item "tcgetpgrp" This is identical to the C function \f(CW\*(C`tcgetpgrp()\*(C'\fR for returning the process group identifier of the foreground process group of the controlling terminal. .IP "tcsendbreak" 8 .IX Item "tcsendbreak" This is similar to the C function \f(CW\*(C`tcsendbreak()\*(C'\fR for sending a break on its argument stream. .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "tcsetpgrp" 8 .IX Item "tcsetpgrp" This is similar to the C function \f(CW\*(C`tcsetpgrp()\*(C'\fR for setting the process group identifier of the foreground process group of the controlling terminal. .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "time" 8 .IX Item "time" This is identical to Perl's builtin \f(CW\*(C`time()\*(C'\fR function for returning the number of seconds since the epoch (whatever it is for the system), see \*(L"time\*(R" in perlfunc. .IP "times" 8 .IX Item "times" The \fItimes()\fR function returns elapsed realtime since some point in the past (such as system startup), user and system times for this process, and user and system times used by child processes. All times are returned in clock ticks. .Sp .Vb 1 \& ($realtime, $user, $system, $cuser, $csystem) = POSIX::times(); .Ve .Sp Note: Perl's builtin \f(CW\*(C`times()\*(C'\fR function returns four values, measured in seconds. .IP "tmpfile" 8 .IX Item "tmpfile" Use method \f(CW\*(C`IO::File::new_tmpfile()\*(C'\fR instead, or see File::Temp. .IP "tmpnam" 8 .IX Item "tmpnam" Returns a name for a temporary file. .Sp .Vb 1 \& $tmpfile = POSIX::tmpnam(); .Ve .Sp For security reasons, which are probably detailed in your system's documentation for the C library \fItmpnam()\fR function, this interface should not be used; instead see File::Temp. .IP "tolower" 8 .IX Item "tolower" This is identical to the C function, except that it can apply to a single character or to a whole string. Consider using the \f(CW\*(C`lc()\*(C'\fR function, see \*(L"lc\*(R" in perlfunc, or the equivalent \f(CW\*(C`\eL\*(C'\fR operator inside doublequotish strings. .IP "toupper" 8 .IX Item "toupper" This is identical to the C function, except that it can apply to a single character or to a whole string. Consider using the \f(CW\*(C`uc()\*(C'\fR function, see \*(L"uc\*(R" in perlfunc, or the equivalent \f(CW\*(C`\eU\*(C'\fR operator inside doublequotish strings. .IP "ttyname" 8 .IX Item "ttyname" This is identical to the C function \f(CW\*(C`ttyname()\*(C'\fR for returning the name of the current terminal. .IP "tzname" 8 .IX Item "tzname" Retrieves the time conversion information from the \f(CW\*(C`tzname\*(C'\fR variable. .Sp .Vb 2 \& POSIX::tzset(); \& ($std, $dst) = POSIX::tzname(); .Ve .IP "tzset" 8 .IX Item "tzset" This is identical to the C function \f(CW\*(C`tzset()\*(C'\fR for setting the current timezone based on the environment variable \f(CW\*(C`TZ\*(C'\fR, to be used by \f(CW\*(C`ctime()\*(C'\fR, \f(CW\*(C`localtime()\*(C'\fR, \f(CW\*(C`mktime()\*(C'\fR, and \f(CW\*(C`strftime()\*(C'\fR functions. .IP "umask" 8 .IX Item "umask" This is identical to Perl's builtin \f(CW\*(C`umask()\*(C'\fR function for setting (and querying) the file creation permission mask, see \*(L"umask\*(R" in perlfunc. .IP "uname" 8 .IX Item "uname" Get name of current operating system. .Sp .Vb 1 \& ($sysname, $nodename, $release, $version, $machine) = POSIX::uname(); .Ve .Sp Note that the actual meanings of the various fields are not that well standardized, do not expect any great portability. The \f(CW$sysname\fR might be the name of the operating system, the \f(CW$nodename\fR might be the name of the host, the \f(CW$release\fR might be the (major) release number of the operating system, the \f(CW$version\fR might be the (minor) release number of the operating system, and the \f(CW$machine\fR might be a hardware identifier. Maybe. .IP "ungetc" 8 .IX Item "ungetc" Use method \f(CW\*(C`IO::Handle::ungetc()\*(C'\fR instead. .IP "unlink" 8 .IX Item "unlink" This is identical to Perl's builtin \f(CW\*(C`unlink()\*(C'\fR function for removing files, see \*(L"unlink\*(R" in perlfunc. .IP "utime" 8 .IX Item "utime" This is identical to Perl's builtin \f(CW\*(C`utime()\*(C'\fR function for changing the time stamps of files and directories, see \*(L"utime\*(R" in perlfunc. .IP "vfprintf" 8 .IX Item "vfprintf" \&\fIvfprintf()\fR is C\-specific, see \*(L"printf\*(R" in perlfunc instead. .IP "vprintf" 8 .IX Item "vprintf" \&\fIvprintf()\fR is C\-specific, see \*(L"printf\*(R" in perlfunc instead. .IP "vsprintf" 8 .IX Item "vsprintf" \&\fIvsprintf()\fR is C\-specific, see \*(L"sprintf\*(R" in perlfunc instead. .IP "wait" 8 .IX Item "wait" This is identical to Perl's builtin \f(CW\*(C`wait()\*(C'\fR function, see \*(L"wait\*(R" in perlfunc. .IP "waitpid" 8 .IX Item "waitpid" Wait for a child process to change state. This is identical to Perl's builtin \f(CW\*(C`waitpid()\*(C'\fR function, see \*(L"waitpid\*(R" in perlfunc. .Sp .Vb 2 \& $pid = POSIX::waitpid( -1, POSIX::WNOHANG ); \& print "status = ", ($? / 256), "\en"; .Ve .IP "wcstombs" 8 .IX Item "wcstombs" This is identical to the C function \f(CW\*(C`wcstombs()\*(C'\fR. Perl does not have any support for the wide and multibyte characters of the C standards, so this might be a rather useless function. .IP "wctomb" 8 .IX Item "wctomb" This is identical to the C function \f(CW\*(C`wctomb()\*(C'\fR. Perl does not have any support for the wide and multibyte characters of the C standards, so this might be a rather useless function. .IP "write" 8 .IX Item "write" Write to a file. This uses file descriptors such as those obtained by calling \f(CW\*(C`POSIX::open\*(C'\fR. .Sp .Vb 3 \& $fd = POSIX::open( "foo", &POSIX::O_WRONLY ); \& $buf = "hello"; \& $bytes = POSIX::write( $b, $buf, 5 ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .Sp See also \*(L"syswrite\*(R" in perlfunc. .SH "CLASSES" .IX Header "CLASSES" .Sh "POSIX::SigAction" .IX Subsection "POSIX::SigAction" .IP "new" 8 .IX Item "new" Creates a new \f(CW\*(C`POSIX::SigAction\*(C'\fR object which corresponds to the C \&\f(CW\*(C`struct sigaction\*(C'\fR. 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 \f(CW\*(C`POSIX::SigSet\*(C'\fR object, it defaults to the empty set. The third parameter contains the \&\f(CW\*(C`sa_flags\*(C'\fR, it defaults to 0. .Sp .Vb 2 \& $sigset = POSIX::SigSet->new(SIGINT, SIGQUIT); \& $sigaction = POSIX::SigAction->new( 'main::handler', $sigset, &POSIX::SA_NOCLDSTOP ); .Ve .Sp This \f(CW\*(C`POSIX::SigAction\*(C'\fR object should be used with the \f(CW\*(C`POSIX::sigaction()\*(C'\fR function. .Sh "POSIX::SigSet" .IX Subsection "POSIX::SigSet" .IP "new" 8 .IX Item "new" Create a new SigSet object. This object will be destroyed automatically when it is no longer needed. Arguments may be supplied to initialize the set. .Sp Create an empty set. .Sp .Vb 1 \& $sigset = POSIX::SigSet->new; .Ve .Sp Create a set with \s-1SIGUSR1\s0. .Sp .Vb 1 \& $sigset = POSIX::SigSet->new( &POSIX::SIGUSR1 ); .Ve .IP "addset" 8 .IX Item "addset" Add a signal to a SigSet object. .Sp .Vb 1 \& $sigset->addset( &POSIX::SIGUSR2 ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "delset" 8 .IX Item "delset" Remove a signal from the SigSet object. .Sp .Vb 1 \& $sigset->delset( &POSIX::SIGUSR2 ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "emptyset" 8 .IX Item "emptyset" Initialize the SigSet object to be empty. .Sp .Vb 1 \& $sigset->emptyset(); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "fillset" 8 .IX Item "fillset" Initialize the SigSet object to include all signals. .Sp .Vb 1 \& $sigset->fillset(); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "ismember" 8 .IX Item "ismember" Tests the SigSet object to see if it contains a specific signal. .Sp .Vb 3 \& if( $sigset->ismember( &POSIX::SIGUSR1 ) ){ \& print "contains SIGUSR1\en"; \& } .Ve .Sh "POSIX::Termios" .IX Subsection "POSIX::Termios" .IP "new" 8 .IX Item "new" Create a new Termios object. This object will be destroyed automatically when it is no longer needed. A Termios object corresponds to the termios C struct. \fInew()\fR mallocs a new one, \fIgetattr()\fR fills it from a file descriptor, and \fIsetattr()\fR sets a file descriptor's parameters to match Termios' contents. .Sp .Vb 1 \& $termios = POSIX::Termios->new; .Ve .IP "getattr" 8 .IX Item "getattr" Get terminal control attributes. .Sp Obtain the attributes for stdin. .Sp .Vb 1 \& $termios->getattr() .Ve .Sp Obtain the attributes for stdout. .Sp .Vb 1 \& $termios->getattr( 1 ) .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "getcc" 8 .IX Item "getcc" Retrieve a value from the c_cc field of a termios object. The c_cc field is an array so an index must be specified. .Sp .Vb 1 \& $c_cc[1] = $termios->getcc(1); .Ve .IP "getcflag" 8 .IX Item "getcflag" Retrieve the c_cflag field of a termios object. .Sp .Vb 1 \& $c_cflag = $termios->getcflag; .Ve .IP "getiflag" 8 .IX Item "getiflag" Retrieve the c_iflag field of a termios object. .Sp .Vb 1 \& $c_iflag = $termios->getiflag; .Ve .IP "getispeed" 8 .IX Item "getispeed" Retrieve the input baud rate. .Sp .Vb 1 \& $ispeed = $termios->getispeed; .Ve .IP "getlflag" 8 .IX Item "getlflag" Retrieve the c_lflag field of a termios object. .Sp .Vb 1 \& $c_lflag = $termios->getlflag; .Ve .IP "getoflag" 8 .IX Item "getoflag" Retrieve the c_oflag field of a termios object. .Sp .Vb 1 \& $c_oflag = $termios->getoflag; .Ve .IP "getospeed" 8 .IX Item "getospeed" Retrieve the output baud rate. .Sp .Vb 1 \& $ospeed = $termios->getospeed; .Ve .IP "setattr" 8 .IX Item "setattr" Set terminal control attributes. .Sp Set attributes immediately for stdout. .Sp .Vb 1 \& $termios->setattr( 1, &POSIX::TCSANOW ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "setcc" 8 .IX Item "setcc" 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. .Sp .Vb 1 \& $termios->setcc( &POSIX::VEOF, 1 ); .Ve .IP "setcflag" 8 .IX Item "setcflag" Set the c_cflag field of a termios object. .Sp .Vb 1 \& $termios->setcflag( $c_cflag | &POSIX::CLOCAL ); .Ve .IP "setiflag" 8 .IX Item "setiflag" Set the c_iflag field of a termios object. .Sp .Vb 1 \& $termios->setiflag( $c_iflag | &POSIX::BRKINT ); .Ve .IP "setispeed" 8 .IX Item "setispeed" Set the input baud rate. .Sp .Vb 1 \& $termios->setispeed( &POSIX::B9600 ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "setlflag" 8 .IX Item "setlflag" Set the c_lflag field of a termios object. .Sp .Vb 1 \& $termios->setlflag( $c_lflag | &POSIX::ECHO ); .Ve .IP "setoflag" 8 .IX Item "setoflag" Set the c_oflag field of a termios object. .Sp .Vb 1 \& $termios->setoflag( $c_oflag | &POSIX::OPOST ); .Ve .IP "setospeed" 8 .IX Item "setospeed" Set the output baud rate. .Sp .Vb 1 \& $termios->setospeed( &POSIX::B9600 ); .Ve .Sp Returns \f(CW\*(C`undef\*(C'\fR on failure. .IP "Baud rate values" 8 .IX Item "Baud rate values" B38400 B75 B200 B134 B300 B1800 B150 B0 B19200 B1200 B9600 B600 B4800 B50 B2400 B110 .IP "Terminal interface values" 8 .IX Item "Terminal interface values" \&\s-1TCSADRAIN\s0 \s-1TCSANOW\s0 \s-1TCOON\s0 \s-1TCIOFLUSH\s0 \s-1TCOFLUSH\s0 \s-1TCION\s0 \s-1TCIFLUSH\s0 \s-1TCSAFLUSH\s0 \s-1TCIOFF\s0 \s-1TCOOFF\s0 .IP "c_cc field values" 8 .IX Item "c_cc field values" \&\s-1VEOF\s0 \s-1VEOL\s0 \s-1VERASE\s0 \s-1VINTR\s0 \s-1VKILL\s0 \s-1VQUIT\s0 \s-1VSUSP\s0 \s-1VSTART\s0 \s-1VSTOP\s0 \s-1VMIN\s0 \s-1VTIME\s0 \s-1NCCS\s0 .IP "c_cflag field values" 8 .IX Item "c_cflag field values" \&\s-1CLOCAL\s0 \s-1CREAD\s0 \s-1CSIZE\s0 \s-1CS5\s0 \s-1CS6\s0 \s-1CS7\s0 \s-1CS8\s0 \s-1CSTOPB\s0 \s-1HUPCL\s0 \s-1PARENB\s0 \s-1PARODD\s0 .IP "c_iflag field values" 8 .IX Item "c_iflag field values" \&\s-1BRKINT\s0 \s-1ICRNL\s0 \s-1IGNBRK\s0 \s-1IGNCR\s0 \s-1IGNPAR\s0 \s-1INLCR\s0 \s-1INPCK\s0 \s-1ISTRIP\s0 \s-1IXOFF\s0 \s-1IXON\s0 \s-1PARMRK\s0 .IP "c_lflag field values" 8 .IX Item "c_lflag field values" \&\s-1ECHO\s0 \s-1ECHOE\s0 \s-1ECHOK\s0 \s-1ECHONL\s0 \s-1ICANON\s0 \s-1IEXTEN\s0 \s-1ISIG\s0 \s-1NOFLSH\s0 \s-1TOSTOP\s0 .IP "c_oflag field values" 8 .IX Item "c_oflag field values" \&\s-1OPOST\s0 .SH "PATHNAME CONSTANTS" .IX Header "PATHNAME CONSTANTS" .IP "Constants" 8 .IX Item "Constants" _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 .SH "POSIX CONSTANTS" .IX Header "POSIX CONSTANTS" .IP "Constants" 8 .IX Item "Constants" _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 .SH "SYSTEM CONFIGURATION" .IX Header "SYSTEM CONFIGURATION" .IP "Constants" 8 .IX Item "Constants" _SC_ARG_MAX _SC_CHILD_MAX _SC_CLK_TCK _SC_JOB_CONTROL _SC_NGROUPS_MAX _SC_OPEN_MAX _SC_PAGESIZE _SC_SAVED_IDS _SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION .SH "ERRNO" .IX Header "ERRNO" .IP "Constants" 8 .IX Item "Constants" E2BIG \s-1EACCES\s0 \s-1EADDRINUSE\s0 \s-1EADDRNOTAVAIL\s0 \s-1EAFNOSUPPORT\s0 \s-1EAGAIN\s0 \s-1EALREADY\s0 \s-1EBADF\s0 \&\s-1EBUSY\s0 \s-1ECHILD\s0 \s-1ECONNABORTED\s0 \s-1ECONNREFUSED\s0 \s-1ECONNRESET\s0 \s-1EDEADLK\s0 \s-1EDESTADDRREQ\s0 \&\s-1EDOM\s0 \s-1EDQUOT\s0 \s-1EEXIST\s0 \s-1EFAULT\s0 \s-1EFBIG\s0 \s-1EHOSTDOWN\s0 \s-1EHOSTUNREACH\s0 \s-1EINPROGRESS\s0 \s-1EINTR\s0 \&\s-1EINVAL\s0 \s-1EIO\s0 \s-1EISCONN\s0 \s-1EISDIR\s0 \s-1ELOOP\s0 \s-1EMFILE\s0 \s-1EMLINK\s0 \s-1EMSGSIZE\s0 \s-1ENAMETOOLONG\s0 \&\s-1ENETDOWN\s0 \s-1ENETRESET\s0 \s-1ENETUNREACH\s0 \s-1ENFILE\s0 \s-1ENOBUFS\s0 \s-1ENODEV\s0 \s-1ENOENT\s0 \s-1ENOEXEC\s0 \&\s-1ENOLCK\s0 \s-1ENOMEM\s0 \s-1ENOPROTOOPT\s0 \s-1ENOSPC\s0 \s-1ENOSYS\s0 \s-1ENOTBLK\s0 \s-1ENOTCONN\s0 \s-1ENOTDIR\s0 \&\s-1ENOTEMPTY\s0 \s-1ENOTSOCK\s0 \s-1ENOTTY\s0 \s-1ENXIO\s0 \s-1EOPNOTSUPP\s0 \s-1EPERM\s0 \s-1EPFNOSUPPORT\s0 \s-1EPIPE\s0 \&\s-1EPROCLIM\s0 \s-1EPROTONOSUPPORT\s0 \s-1EPROTOTYPE\s0 \s-1ERANGE\s0 \s-1EREMOTE\s0 \s-1ERESTART\s0 \s-1EROFS\s0 \&\s-1ESHUTDOWN\s0 \s-1ESOCKTNOSUPPORT\s0 \s-1ESPIPE\s0 \s-1ESRCH\s0 \s-1ESTALE\s0 \s-1ETIMEDOUT\s0 \s-1ETOOMANYREFS\s0 \&\s-1ETXTBSY\s0 \s-1EUSERS\s0 \s-1EWOULDBLOCK\s0 \s-1EXDEV\s0 .SH "FCNTL" .IX Header "FCNTL" .IP "Constants" 8 .IX Item "Constants" \&\s-1FD_CLOEXEC\s0 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 .SH "FLOAT" .IX Header "FLOAT" .IP "Constants" 8 .IX Item "Constants" \&\s-1DBL_DIG\s0 \s-1DBL_EPSILON\s0 \s-1DBL_MANT_DIG\s0 \s-1DBL_MAX\s0 \s-1DBL_MAX_10_EXP\s0 \s-1DBL_MAX_EXP\s0 \s-1DBL_MIN\s0 \s-1DBL_MIN_10_EXP\s0 \s-1DBL_MIN_EXP\s0 \s-1FLT_DIG\s0 \s-1FLT_EPSILON\s0 \s-1FLT_MANT_DIG\s0 \s-1FLT_MAX\s0 \s-1FLT_MAX_10_EXP\s0 \s-1FLT_MAX_EXP\s0 \s-1FLT_MIN\s0 \s-1FLT_MIN_10_EXP\s0 \s-1FLT_MIN_EXP\s0 \s-1FLT_RADIX\s0 \s-1FLT_ROUNDS\s0 \s-1LDBL_DIG\s0 \s-1LDBL_EPSILON\s0 \s-1LDBL_MANT_DIG\s0 \s-1LDBL_MAX\s0 \s-1LDBL_MAX_10_EXP\s0 \s-1LDBL_MAX_EXP\s0 \s-1LDBL_MIN\s0 \s-1LDBL_MIN_10_EXP\s0 \s-1LDBL_MIN_EXP\s0 .SH "LIMITS" .IX Header "LIMITS" .IP "Constants" 8 .IX Item "Constants" \&\s-1ARG_MAX\s0 \s-1CHAR_BIT\s0 \s-1CHAR_MAX\s0 \s-1CHAR_MIN\s0 \s-1CHILD_MAX\s0 \s-1INT_MAX\s0 \s-1INT_MIN\s0 \s-1LINK_MAX\s0 \s-1LONG_MAX\s0 \s-1LONG_MIN\s0 \s-1MAX_CANON\s0 \s-1MAX_INPUT\s0 \s-1MB_LEN_MAX\s0 \s-1NAME_MAX\s0 \s-1NGROUPS_MAX\s0 \s-1OPEN_MAX\s0 \s-1PATH_MAX\s0 \s-1PIPE_BUF\s0 \s-1SCHAR_MAX\s0 \s-1SCHAR_MIN\s0 \s-1SHRT_MAX\s0 \s-1SHRT_MIN\s0 \s-1SSIZE_MAX\s0 \s-1STREAM_MAX\s0 \s-1TZNAME_MAX\s0 \s-1UCHAR_MAX\s0 \s-1UINT_MAX\s0 \s-1ULONG_MAX\s0 \s-1USHRT_MAX\s0 .SH "LOCALE" .IX Header "LOCALE" .IP "Constants" 8 .IX Item "Constants" \&\s-1LC_ALL\s0 \s-1LC_COLLATE\s0 \s-1LC_CTYPE\s0 \s-1LC_MONETARY\s0 \s-1LC_NUMERIC\s0 \s-1LC_TIME\s0 .SH "MATH" .IX Header "MATH" .IP "Constants" 8 .IX Item "Constants" \&\s-1HUGE_VAL\s0 .SH "SIGNAL" .IX Header "SIGNAL" .IP "Constants" 8 .IX Item "Constants" \&\s-1SA_NOCLDSTOP\s0 \s-1SA_NOCLDWAIT\s0 \s-1SA_NODEFER\s0 \s-1SA_ONSTACK\s0 \s-1SA_RESETHAND\s0 \s-1SA_RESTART\s0 \&\s-1SA_SIGINFO\s0 \s-1SIGABRT\s0 \s-1SIGALRM\s0 \s-1SIGCHLD\s0 \s-1SIGCONT\s0 \s-1SIGFPE\s0 \s-1SIGHUP\s0 \s-1SIGILL\s0 \s-1SIGINT\s0 \&\s-1SIGKILL\s0 \s-1SIGPIPE\s0 \s-1SIGQUIT\s0 \s-1SIGSEGV\s0 \s-1SIGSTOP\s0 \s-1SIGTERM\s0 \s-1SIGTSTP\s0 \s-1SIGTTIN\s0 \s-1SIGTTOU\s0 \&\s-1SIGUSR1\s0 \s-1SIGUSR2\s0 \s-1SIG_BLOCK\s0 \s-1SIG_DFL\s0 \s-1SIG_ERR\s0 \s-1SIG_IGN\s0 \s-1SIG_SETMASK\s0 \&\s-1SIG_UNBLOCK\s0 .SH "STAT" .IX Header "STAT" .IP "Constants" 8 .IX Item "Constants" 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 .IP "Macros" 8 .IX Item "Macros" S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG .SH "STDLIB" .IX Header "STDLIB" .IP "Constants" 8 .IX Item "Constants" \&\s-1EXIT_FAILURE\s0 \s-1EXIT_SUCCESS\s0 \s-1MB_CUR_MAX\s0 \s-1RAND_MAX\s0 .SH "STDIO" .IX Header "STDIO" .IP "Constants" 8 .IX Item "Constants" \&\s-1BUFSIZ\s0 \s-1EOF\s0 \s-1FILENAME_MAX\s0 L_ctermid L_cuserid L_tmpname \s-1TMP_MAX\s0 .SH "TIME" .IX Header "TIME" .IP "Constants" 8 .IX Item "Constants" \&\s-1CLK_TCK\s0 \s-1CLOCKS_PER_SEC\s0 .SH "UNISTD" .IX Header "UNISTD" .IP "Constants" 8 .IX Item "Constants" R_OK \s-1SEEK_CUR\s0 \s-1SEEK_END\s0 \s-1SEEK_SET\s0 \s-1STDIN_FILENO\s0 \s-1STDOUT_FILENO\s0 \s-1STDERR_FILENO\s0 W_OK X_OK .SH "WAIT" .IX Header "WAIT" .IP "Constants" 8 .IX Item "Constants" \&\s-1WNOHANG\s0 \s-1WUNTRACED\s0 .RS 8 .IP "\s-1WNOHANG\s0" 16 .IX Item "WNOHANG" Do not suspend the calling process until a child process changes state but instead return immediately. .IP "\s-1WUNTRACED\s0" 16 .IX Item "WUNTRACED" Catch stopped child processes. .RE .RS 8 .RE .IP "Macros" 8 .IX Item "Macros" \&\s-1WIFEXITED\s0 \s-1WEXITSTATUS\s0 \s-1WIFSIGNALED\s0 \s-1WTERMSIG\s0 \s-1WIFSTOPPED\s0 \s-1WSTOPSIG\s0 .RS 8 .IP "\s-1WIFEXITED\s0" 16 .IX Item "WIFEXITED" \&\s-1WIFEXITED\s0($?) returns true if the child process exited normally (\f(CW\*(C`exit()\*(C'\fR or by falling off the end of \f(CW\*(C`main()\*(C'\fR) .IP "\s-1WEXITSTATUS\s0" 16 .IX Item "WEXITSTATUS" \&\s-1WEXITSTATUS\s0($?) returns the normal exit status of the child process (only meaningful if \s-1WIFEXITED\s0($?) is true) .IP "\s-1WIFSIGNALED\s0" 16 .IX Item "WIFSIGNALED" \&\s-1WIFSIGNALED\s0($?) returns true if the child process terminated because of a signal .IP "\s-1WTERMSIG\s0" 16 .IX Item "WTERMSIG" \&\s-1WTERMSIG\s0($?) returns the signal the child process terminated for (only meaningful if \s-1WIFSIGNALED\s0($?) is true) .IP "\s-1WIFSTOPPED\s0" 16 .IX Item "WIFSTOPPED" \&\s-1WIFSTOPPED\s0($?) returns true if the child process is currently stopped (can happen only if you specified the \s-1WUNTRACED\s0 flag to \fIwaitpid()\fR) .IP "\s-1WSTOPSIG\s0" 16 .IX Item "WSTOPSIG" \&\s-1WSTOPSIG\s0($?) returns the signal the child process was stopped for (only meaningful if \s-1WIFSTOPPED\s0($?) is true) .RE .RS 8 .RE