📄 posix.3
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" 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. \*(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-.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\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el .ds Aq '.\".\" 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..ie \nF \{\. de IX. tm Index:\\$1\t\\n%\t"\\$2"... nr % 0. rr F.\}.el \{\. de IX...\}.\".\" 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 3".TH POSIX 3 "2007-12-18" "perl v5.10.0" "Perl Programmers Reference Guide".\" For nroff, turn off justification. Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.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);\&\& printf "EINTR is %d\en", EINTR;\&\& $sess_id = POSIX::setsid();\&\& $fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644);\& # note: that\*(Aqs 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-ishinterfaces..PP\&\fIEverything is exported by default\fR with the exception of any \s-1POSIX\s0functions with the same name as a built-in Perl function, such as\&\f(CW\*(C`abs\*(C'\fR, \f(CW\*(C`alarm\*(C'\fR, \f(CW\*(C`rmdir\*(C'\fR, \f(CW\*(C`write\*(C'\fR, etc.., which will be exportedonly if you ask for them explicitly. This is an unfortunate backwardscompatibility feature. You can stop the exporting by saying \f(CW\*(C`usePOSIX ()\*(C'\fR and then use the fully qualified names (ie. \f(CW\*(C`POSIX::SEEK_END\*(C'\fR)..PPThis document gives a condensed list of the features available in the \s-1POSIX\s0module. Consult your operating system's manpages for general information onmost features. Consult perlfunc for functions which are noted as beingidentical to Perl's builtin functions..PPThe 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 variousconstants and macros in an organization which roughly follows \s-1IEEE\s0 Std1003.1b\-1993..SH "NOTE".IX Header "NOTE"The \s-1POSIX\s0 module is probably the most complex Perl module supplied withthe standard distribution. It incorporates autoloading, namespace games,and dynamic loading of code that's in Perl, C, or both. It's a greatsource of wisdom..SH "CAVEATS".IX Header "CAVEATS"A few functions are not implemented because they are C specific. If youattempt to call these, they will print a message telling you that theyaren't implemented, and suggest using the Perl equivalent should oneexist. For example, trying to access the \fIsetjmp()\fR call will elicit themessage \*(L"\fIsetjmp()\fR is C\-specific: use eval {} instead\*(R"..PPFurthermore, some evil vendors will claim 1003.1 compliance, but in factare 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 theerrno values set by \fIopen\fR\|(2) might not be quite right. Perl does notattempt to verify \s-1POSIX\s0 compliance. That means you can currentlysuccessfully say \*(L"use \s-1POSIX\s0\*(R", and then later in your program you findthat your vendor has been lax and there's no usable \s-1ICANON\s0 macro afterall. 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 programimmediately which means among other things buffered I/O is \fBnot\fR flushed..SpNote that when using threads and in Linux this is \fBnot\fR a good way toexit a thread because in Linux processes and threads are kind of thesame thing (Note: while this is the situation in early 2003 there areprojects under way to have threads with more POSIXly semantics in Linux).If you want not to return from a thread, detach the thread..IP "abort" 8.IX Item "abort"This is identical to the C function \f(CW\*(C`abort()\*(C'\fR. It terminates theprocess with a \f(CW\*(C`SIGABRT\*(C'\fR signal unless caught by a signal handler orif 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, returningthe 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.SpReturns \f(CW\*(C`undef\*(C'\fR on failure. Note: do not use \f(CW\*(C`access()\*(C'\fR forsecurity purposes. Between the \f(CW\*(C`access()\*(C'\fR call and the operationyou 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, returningthe 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 returnsa string of the form.Sp.Vb 1\& "Fri Jun 2 18:22:13 2000\en\e0".Ve.Spand it is called thusly.Sp.Vb 2\& $asctime = asctime($sec, $min, $hour, $mday, $mon, $year,\& $wday, $yday, $isdst);.Ve.SpThe \f(CW$mon\fR is zero-based: January equals \f(CW0\fR. The \f(CW$year\fR is1900\-based: 2001 equals \f(CW101\fR. \f(CW$wday\fR and \f(CW$yday\fR default to zero(and are usually ignored anyway), and \f(CW$isdst\fR defaults to \-1..IP "asin" 8.IX Item "asin"This is identical to the C function \f(CW\*(C`asin()\*(C'\fR, returningthe 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 moduleto achieve similar things..IP "atan" 8.IX Item "atan"This is identical to the C function \f(CW\*(C`atan()\*(C'\fR, returning thearcus 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, returningthe arcus tangent defined by its two numerical arguments, the \fIy\fRcoordinate 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 smallestinteger 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, allowingone 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, allowingone 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 oneto 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 errorstate (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 theamount 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.SpReturns \f(CW\*(C`undef\*(C'\fR on failure..SpSee 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 closinga 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 returningthe cosine of its numerical argument, see \*(L"cos\*(R" in perlfunc.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -