home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
You can browse this item here: tex
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| Python script text executable
| default (weak)
| |
98%
| file
| LaTeX document, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
| |
100%
| xdgMime
| text/x-matlab
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 20 4d 61 6e 75 61 6c | 20 74 65 78 74 20 61 6e |% Manual| text an|
|00000010| 64 20 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |d implem|entation|
|00000020| 20 62 79 20 4a 61 61 70 | 20 56 65 72 6d 65 75 6c | by Jaap| Vermeul|
|00000030| 65 6e 0a 5c 73 65 63 74 | 69 6f 6e 7b 53 74 61 6e |en.\sect|ion{Stan|
|00000040| 64 61 72 64 20 4d 6f 64 | 75 6c 65 20 5c 73 65 63 |dard Mod|ule \sec|
|00000050| 74 63 6f 64 65 7b 70 6f | 73 69 78 66 69 6c 65 7d |tcode{po|sixfile}|
|00000060| 7d 0a 5c 62 69 6d 6f 64 | 69 6e 64 65 78 7b 70 6f |}.\bimod|index{po|
|00000070| 73 69 78 66 69 6c 65 7d | 0a 5c 69 6e 64 65 78 69 |sixfile}|.\indexi|
|00000080| 69 7b 70 6f 73 69 78 7d | 7b 66 69 6c 65 20 6f 62 |i{posix}|{file ob|
|00000090| 6a 65 63 74 7d 0a 0a 5c | 65 6d 70 68 7b 4e 6f 74 |ject}..\|emph{Not|
|000000a0| 65 3a 7d 20 54 68 69 73 | 20 6d 6f 64 75 6c 65 20 |e:} This| module |
|000000b0| 77 69 6c 6c 20 62 65 63 | 6f 6d 65 20 6f 62 73 6f |will bec|ome obso|
|000000c0| 6c 65 74 65 20 69 6e 20 | 61 20 66 75 74 75 72 65 |lete in |a future|
|000000d0| 20 72 65 6c 65 61 73 65 | 2e 0a 54 68 65 20 6c 6f | release|..The lo|
|000000e0| 63 6b 69 6e 67 20 6f 70 | 65 72 61 74 69 6f 6e 20 |cking op|eration |
|000000f0| 74 68 61 74 20 69 74 20 | 70 72 6f 76 69 64 65 73 |that it |provides|
|00000100| 20 69 73 20 64 6f 6e 65 | 20 62 65 74 74 65 72 20 | is done| better |
|00000110| 61 6e 64 20 6d 6f 72 65 | 0a 70 6f 72 74 61 62 6c |and more|.portabl|
|00000120| 79 20 62 79 20 74 68 65 | 20 5c 63 6f 64 65 7b 66 |y by the| \code{f|
|00000130| 63 6e 74 6c 2e 6c 6f 63 | 6b 66 28 29 7d 20 63 61 |cntl.loc|kf()} ca|
|00000140| 6c 6c 2e 0a 0a 54 68 69 | 73 20 6d 6f 64 75 6c 65 |ll...Thi|s module|
|00000150| 20 69 6d 70 6c 65 6d 65 | 6e 74 73 20 73 6f 6d 65 | impleme|nts some|
|00000160| 20 61 64 64 69 74 69 6f | 6e 61 6c 20 66 75 6e 63 | additio|nal func|
|00000170| 74 69 6f 6e 61 6c 69 74 | 79 20 6f 76 65 72 20 74 |tionalit|y over t|
|00000180| 68 65 20 62 75 69 6c 74 | 2d 69 6e 0a 66 69 6c 65 |he built|-in.file|
|00000190| 20 6f 62 6a 65 63 74 73 | 2e 20 20 49 6e 20 70 61 | objects|. In pa|
|000001a0| 72 74 69 63 75 6c 61 72 | 2c 20 69 74 20 69 6d 70 |rticular|, it imp|
|000001b0| 6c 65 6d 65 6e 74 73 20 | 66 69 6c 65 20 6c 6f 63 |lements |file loc|
|000001c0| 6b 69 6e 67 2c 20 63 6f | 6e 74 72 6f 6c 20 6f 76 |king, co|ntrol ov|
|000001d0| 65 72 0a 74 68 65 20 66 | 69 6c 65 20 66 6c 61 67 |er.the f|ile flag|
|000001e0| 73 2c 20 61 6e 64 20 61 | 6e 20 65 61 73 79 20 69 |s, and a|n easy i|
|000001f0| 6e 74 65 72 66 61 63 65 | 20 74 6f 20 64 75 70 6c |nterface| to dupl|
|00000200| 69 63 61 74 65 20 74 68 | 65 20 66 69 6c 65 20 6f |icate th|e file o|
|00000210| 62 6a 65 63 74 2e 0a 54 | 68 65 20 6d 6f 64 75 6c |bject..T|he modul|
|00000220| 65 20 64 65 66 69 6e 65 | 73 20 61 20 6e 65 77 20 |e define|s a new |
|00000230| 66 69 6c 65 20 6f 62 6a | 65 63 74 2c 20 74 68 65 |file obj|ect, the|
|00000240| 20 70 6f 73 69 78 66 69 | 6c 65 20 6f 62 6a 65 63 | posixfi|le objec|
|00000250| 74 2e 20 20 49 74 0a 68 | 61 73 20 61 6c 6c 20 74 |t. It.h|as all t|
|00000260| 68 65 20 73 74 61 6e 64 | 61 72 64 20 66 69 6c 65 |he stand|ard file|
|00000270| 20 6f 62 6a 65 63 74 20 | 6d 65 74 68 6f 64 73 20 | object |methods |
|00000280| 61 6e 64 20 61 64 64 73 | 20 74 68 65 20 6d 65 74 |and adds| the met|
|00000290| 68 6f 64 73 0a 64 65 73 | 63 72 69 62 65 64 20 62 |hods.des|cribed b|
|000002a0| 65 6c 6f 77 2e 20 20 54 | 68 69 73 20 6d 6f 64 75 |elow. T|his modu|
|000002b0| 6c 65 20 6f 6e 6c 79 20 | 77 6f 72 6b 73 20 66 6f |le only |works fo|
|000002c0| 72 20 63 65 72 74 61 69 | 6e 20 66 6c 61 76 6f 72 |r certai|n flavor|
|000002d0| 73 20 6f 66 0a 5c 55 4e | 49 58 7b 7d 2c 20 73 69 |s of.\UN|IX{}, si|
|000002e0| 6e 63 65 20 69 74 20 75 | 73 65 73 20 5c 63 6f 64 |nce it u|ses \cod|
|000002f0| 65 7b 66 63 6e 74 6c 28 | 29 7d 20 66 6f 72 20 66 |e{fcntl(|)} for f|
|00000300| 69 6c 65 20 6c 6f 63 6b | 69 6e 67 2e 0a 0a 54 6f |ile lock|ing...To|
|00000310| 20 69 6e 73 74 61 6e 74 | 69 61 74 65 20 61 20 70 | instant|iate a p|
|00000320| 6f 73 69 78 66 69 6c 65 | 20 6f 62 6a 65 63 74 2c |osixfile| object,|
|00000330| 20 75 73 65 20 74 68 65 | 20 5c 63 6f 64 65 7b 6f | use the| \code{o|
|00000340| 70 65 6e 28 29 7d 20 66 | 75 6e 63 74 69 6f 6e 20 |pen()} f|unction |
|00000350| 69 6e 0a 74 68 65 20 70 | 6f 73 69 78 66 69 6c 65 |in.the p|osixfile|
|00000360| 20 6d 6f 64 75 6c 65 2e | 20 20 54 68 65 20 72 65 | module.| The re|
|00000370| 73 75 6c 74 69 6e 67 20 | 6f 62 6a 65 63 74 20 6c |sulting |object l|
|00000380| 6f 6f 6b 73 20 61 6e 64 | 20 66 65 65 6c 73 20 72 |ooks and| feels r|
|00000390| 6f 75 67 68 6c 79 0a 74 | 68 65 20 73 61 6d 65 20 |oughly.t|he same |
|000003a0| 61 73 20 61 20 73 74 61 | 6e 64 61 72 64 20 66 69 |as a sta|ndard fi|
|000003b0| 6c 65 20 6f 62 6a 65 63 | 74 2e 0a 0a 54 68 65 20 |le objec|t...The |
|000003c0| 70 6f 73 69 78 66 69 6c | 65 20 6d 6f 64 75 6c 65 |posixfil|e module|
|000003d0| 20 64 65 66 69 6e 65 73 | 20 74 68 65 20 66 6f 6c | defines| the fol|
|000003e0| 6c 6f 77 69 6e 67 20 63 | 6f 6e 73 74 61 6e 74 73 |lowing c|onstants|
|000003f0| 3a 0a 0a 5c 72 65 6e 65 | 77 63 6f 6d 6d 61 6e 64 |:..\rene|wcommand|
|00000400| 7b 5c 69 6e 64 65 78 73 | 75 62 69 74 65 6d 7d 7b |{\indexs|ubitem}{|
|00000410| 28 69 6e 20 6d 6f 64 75 | 6c 65 20 70 6f 73 69 78 |(in modu|le posix|
|00000420| 66 69 6c 65 29 7d 0a 5c | 62 65 67 69 6e 7b 64 61 |file)}.\|begin{da|
|00000430| 74 61 64 65 73 63 7d 7b | 53 45 45 4b 5f 53 45 54 |tadesc}{|SEEK_SET|
|00000440| 7d 0a 6f 66 66 73 65 74 | 20 69 73 20 63 61 6c 63 |}.offset| is calc|
|00000450| 75 6c 61 74 65 64 20 66 | 72 6f 6d 20 74 68 65 20 |ulated f|rom the |
|00000460| 73 74 61 72 74 20 6f 66 | 20 74 68 65 20 66 69 6c |start of| the fil|
|00000470| 65 0a 5c 65 6e 64 7b 64 | 61 74 61 64 65 73 63 7d |e.\end{d|atadesc}|
|00000480| 0a 0a 5c 62 65 67 69 6e | 7b 64 61 74 61 64 65 73 |..\begin|{datades|
|00000490| 63 7d 7b 53 45 45 4b 5f | 43 55 52 7d 0a 6f 66 66 |c}{SEEK_|CUR}.off|
|000004a0| 73 65 74 20 69 73 20 63 | 61 6c 63 75 6c 61 74 65 |set is c|alculate|
|000004b0| 64 20 66 72 6f 6d 20 74 | 68 65 20 63 75 72 72 65 |d from t|he curre|
|000004c0| 6e 74 20 70 6f 73 69 74 | 69 6f 6e 20 69 6e 20 74 |nt posit|ion in t|
|000004d0| 68 65 20 66 69 6c 65 0a | 5c 65 6e 64 7b 64 61 74 |he file.|\end{dat|
|000004e0| 61 64 65 73 63 7d 0a 0a | 5c 62 65 67 69 6e 7b 64 |adesc}..|\begin{d|
|000004f0| 61 74 61 64 65 73 63 7d | 7b 53 45 45 4b 5f 45 4e |atadesc}|{SEEK_EN|
|00000500| 44 7d 0a 6f 66 66 73 65 | 74 20 69 73 20 63 61 6c |D}.offse|t is cal|
|00000510| 63 75 6c 61 74 65 64 20 | 66 72 6f 6d 20 74 68 65 |culated |from the|
|00000520| 20 65 6e 64 20 6f 66 20 | 74 68 65 20 66 69 6c 65 | end of |the file|
|00000530| 0a 5c 65 6e 64 7b 64 61 | 74 61 64 65 73 63 7d 0a |.\end{da|tadesc}.|
|00000540| 0a 54 68 65 20 70 6f 73 | 69 78 66 69 6c 65 20 6d |.The pos|ixfile m|
|00000550| 6f 64 75 6c 65 20 64 65 | 66 69 6e 65 73 20 74 68 |odule de|fines th|
|00000560| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 66 75 6e 63 |e follow|ing func|
|00000570| 74 69 6f 6e 73 3a 0a 0a | 5c 72 65 6e 65 77 63 6f |tions:..|\renewco|
|00000580| 6d 6d 61 6e 64 7b 5c 69 | 6e 64 65 78 73 75 62 69 |mmand{\i|ndexsubi|
|00000590| 74 65 6d 7d 7b 28 69 6e | 20 6d 6f 64 75 6c 65 20 |tem}{(in| module |
|000005a0| 70 6f 73 69 78 66 69 6c | 65 29 7d 0a 0a 5c 62 65 |posixfil|e)}..\be|
|000005b0| 67 69 6e 7b 66 75 6e 63 | 64 65 73 63 7d 7b 6f 70 |gin{func|desc}{op|
|000005c0| 65 6e 7d 7b 66 69 6c 65 | 6e 61 6d 65 5c 6f 70 74 |en}{file|name\opt|
|000005d0| 69 6f 6e 61 6c 7b 5c 2c | 20 6d 6f 64 65 5c 6f 70 |ional{\,| mode\op|
|000005e0| 74 69 6f 6e 61 6c 7b 5c | 2c 20 62 75 66 73 69 7a |tional{\|, bufsiz|
|000005f0| 65 7d 7d 7d 0a 20 43 72 | 65 61 74 65 20 61 20 6e |e}}}. Cr|eate a n|
|00000600| 65 77 20 70 6f 73 69 78 | 66 69 6c 65 20 6f 62 6a |ew posix|file obj|
|00000610| 65 63 74 20 77 69 74 68 | 20 74 68 65 20 67 69 76 |ect with| the giv|
|00000620| 65 6e 20 66 69 6c 65 6e | 61 6d 65 20 61 6e 64 20 |en filen|ame and |
|00000630| 6d 6f 64 65 2e 20 20 54 | 68 65 0a 20 5c 76 61 72 |mode. T|he. \var|
|00000640| 7b 66 69 6c 65 6e 61 6d | 65 7d 2c 20 5c 76 61 72 |{filenam|e}, \var|
|00000650| 7b 6d 6f 64 65 7d 20 61 | 6e 64 20 5c 76 61 72 7b |{mode} a|nd \var{|
|00000660| 62 75 66 73 69 7a 65 7d | 20 61 72 67 75 6d 65 6e |bufsize}| argumen|
|00000670| 74 73 20 61 72 65 0a 20 | 69 6e 74 65 72 70 72 65 |ts are. |interpre|
|00000680| 74 65 64 20 74 68 65 20 | 73 61 6d 65 20 77 61 79 |ted the |same way|
|00000690| 20 61 73 20 62 79 20 74 | 68 65 20 62 75 69 6c 74 | as by t|he built|
|000006a0| 2d 69 6e 20 5c 63 6f 64 | 65 7b 6f 70 65 6e 28 29 |-in \cod|e{open()|
|000006b0| 7d 20 66 75 6e 63 74 69 | 6f 6e 2e 0a 5c 65 6e 64 |} functi|on..\end|
|000006c0| 7b 66 75 6e 63 64 65 73 | 63 7d 0a 0a 5c 62 65 67 |{funcdes|c}..\beg|
|000006d0| 69 6e 7b 66 75 6e 63 64 | 65 73 63 7d 7b 66 69 6c |in{funcd|esc}{fil|
|000006e0| 65 6f 70 65 6e 7d 7b 66 | 69 6c 65 6f 62 6a 65 63 |eopen}{f|ileobjec|
|000006f0| 74 7d 0a 20 43 72 65 61 | 74 65 20 61 20 6e 65 77 |t}. Crea|te a new|
|00000700| 20 70 6f 73 69 78 66 69 | 6c 65 20 6f 62 6a 65 63 | posixfi|le objec|
|00000710| 74 20 77 69 74 68 20 74 | 68 65 20 67 69 76 65 6e |t with t|he given|
|00000720| 20 73 74 61 6e 64 61 72 | 64 20 66 69 6c 65 20 6f | standar|d file o|
|00000730| 62 6a 65 63 74 2e 0a 20 | 54 68 65 20 72 65 73 75 |bject.. |The resu|
|00000740| 6c 74 69 6e 67 20 6f 62 | 6a 65 63 74 20 68 61 73 |lting ob|ject has|
|00000750| 20 74 68 65 20 73 61 6d | 65 20 66 69 6c 65 6e 61 | the sam|e filena|
|00000760| 6d 65 20 61 6e 64 20 6d | 6f 64 65 20 61 73 20 74 |me and m|ode as t|
|00000770| 68 65 20 6f 72 69 67 69 | 6e 61 6c 0a 20 66 69 6c |he origi|nal. fil|
|00000780| 65 20 6f 62 6a 65 63 74 | 2e 0a 5c 65 6e 64 7b 66 |e object|..\end{f|
|00000790| 75 6e 63 64 65 73 63 7d | 0a 0a 54 68 65 20 70 6f |uncdesc}|..The po|
|000007a0| 73 69 78 66 69 6c 65 20 | 6f 62 6a 65 63 74 20 64 |sixfile |object d|
|000007b0| 65 66 69 6e 65 73 20 74 | 68 65 20 66 6f 6c 6c 6f |efines t|he follo|
|000007c0| 77 69 6e 67 20 61 64 64 | 69 74 69 6f 6e 61 6c 20 |wing add|itional |
|000007d0| 6d 65 74 68 6f 64 73 3a | 0a 0a 5c 72 65 6e 65 77 |methods:|..\renew|
|000007e0| 63 6f 6d 6d 61 6e 64 7b | 5c 69 6e 64 65 78 73 75 |command{|\indexsu|
|000007f0| 62 69 74 65 6d 7d 7b 28 | 70 6f 73 69 78 66 69 6c |bitem}{(|posixfil|
|00000800| 65 20 6d 65 74 68 6f 64 | 29 7d 0a 5c 62 65 67 69 |e method|)}.\begi|
|00000810| 6e 7b 66 75 6e 63 64 65 | 73 63 7d 7b 6c 6f 63 6b |n{funcde|sc}{lock|
|00000820| 7d 7b 66 6d 74 5c 2c 20 | 5c 6f 70 74 69 6f 6e 61 |}{fmt\, |\optiona|
|00000830| 6c 7b 6c 65 6e 5c 6f 70 | 74 69 6f 6e 61 6c 7b 5c |l{len\op|tional{\|
|00000840| 2c 20 73 74 61 72 74 0a | 5c 6f 70 74 69 6f 6e 61 |, start.|\optiona|
|00000850| 6c 7b 5c 2c 20 77 68 65 | 6e 63 65 7d 7d 7d 7d 0a |l{\, whe|nce}}}}.|
|00000860| 20 4c 6f 63 6b 20 74 68 | 65 20 73 70 65 63 69 66 | Lock th|e specif|
|00000870| 69 65 64 20 73 65 63 74 | 69 6f 6e 20 6f 66 20 74 |ied sect|ion of t|
|00000880| 68 65 20 66 69 6c 65 20 | 74 68 61 74 20 74 68 65 |he file |that the|
|00000890| 20 66 69 6c 65 20 6f 62 | 6a 65 63 74 20 69 73 0a | file ob|ject is.|
|000008a0| 20 72 65 66 65 72 72 69 | 6e 67 20 74 6f 2e 20 20 | referri|ng to. |
|000008b0| 54 68 65 20 66 6f 72 6d | 61 74 20 69 73 20 65 78 |The form|at is ex|
|000008c0| 70 6c 61 69 6e 65 64 0a | 20 62 65 6c 6f 77 20 69 |plained.| below i|
|000008d0| 6e 20 61 20 74 61 62 6c | 65 2e 20 20 54 68 65 20 |n a tabl|e. The |
|000008e0| 5c 76 61 72 7b 6c 65 6e | 7d 20 61 72 67 75 6d 65 |\var{len|} argume|
|000008f0| 6e 74 20 73 70 65 63 69 | 66 69 65 73 20 74 68 65 |nt speci|fies the|
|00000900| 20 6c 65 6e 67 74 68 20 | 6f 66 20 74 68 65 0a 20 | length |of the. |
|00000910| 73 65 63 74 69 6f 6e 20 | 74 68 61 74 20 73 68 6f |section |that sho|
|00000920| 75 6c 64 20 62 65 20 6c | 6f 63 6b 65 64 2e 20 54 |uld be l|ocked. T|
|00000930| 68 65 20 64 65 66 61 75 | 6c 74 20 69 73 20 5c 63 |he defau|lt is \c|
|00000940| 6f 64 65 7b 30 7d 2e 20 | 5c 76 61 72 7b 73 74 61 |ode{0}. |\var{sta|
|00000950| 72 74 7d 0a 20 73 70 65 | 63 69 66 69 65 73 20 74 |rt}. spe|cifies t|
|00000960| 68 65 20 73 74 61 72 74 | 69 6e 67 20 6f 66 66 73 |he start|ing offs|
|00000970| 65 74 20 6f 66 20 74 68 | 65 20 73 65 63 74 69 6f |et of th|e sectio|
|00000980| 6e 2c 20 77 68 65 72 65 | 20 74 68 65 20 64 65 66 |n, where| the def|
|00000990| 61 75 6c 74 20 69 73 0a | 20 5c 63 6f 64 65 7b 30 |ault is.| \code{0|
|000009a0| 7d 2e 20 20 54 68 65 20 | 5c 76 61 72 7b 77 68 65 |}. The |\var{whe|
|000009b0| 6e 63 65 7d 20 61 72 67 | 75 6d 65 6e 74 20 73 70 |nce} arg|ument sp|
|000009c0| 65 63 69 66 69 65 73 20 | 77 68 65 72 65 20 74 68 |ecifies |where th|
|000009d0| 65 20 6f 66 66 73 65 74 | 20 69 73 0a 20 72 65 6c |e offset| is. rel|
|000009e0| 61 74 69 76 65 20 74 6f | 2e 20 49 74 20 61 63 63 |ative to|. It acc|
|000009f0| 65 70 74 73 20 6f 6e 65 | 20 6f 66 20 74 68 65 20 |epts one| of the |
|00000a00| 63 6f 6e 73 74 61 6e 74 | 73 20 5c 63 6f 64 65 7b |constant|s \code{|
|00000a10| 53 45 45 4b 5f 53 45 54 | 7d 2c 0a 20 5c 63 6f 64 |SEEK_SET|},. \cod|
|00000a20| 65 7b 53 45 45 4b 5f 43 | 55 52 7d 20 6f 72 20 5c |e{SEEK_C|UR} or \|
|00000a30| 63 6f 64 65 7b 53 45 45 | 4b 5f 45 4e 44 7d 2e 20 |code{SEE|K_END}. |
|00000a40| 20 54 68 65 20 64 65 66 | 61 75 6c 74 20 69 73 20 | The def|ault is |
|00000a50| 5c 63 6f 64 65 7b 53 45 | 45 4b 5f 53 45 54 7d 2e |\code{SE|EK_SET}.|
|00000a60| 0a 20 46 6f 72 20 6d 6f | 72 65 20 69 6e 66 6f 72 |. For mo|re infor|
|00000a70| 6d 61 74 69 6f 6e 20 61 | 62 6f 75 74 20 74 68 65 |mation a|bout the|
|00000a80| 20 61 72 67 75 6d 65 6e | 74 73 20 72 65 66 65 72 | argumen|ts refer|
|00000a90| 20 74 6f 20 74 68 65 20 | 66 63 6e 74 6c 0a 20 6d | to the |fcntl. m|
|00000aa0| 61 6e 75 61 6c 20 70 61 | 67 65 20 6f 6e 20 79 6f |anual pa|ge on yo|
|00000ab0| 75 72 20 73 79 73 74 65 | 6d 2e 0a 5c 65 6e 64 7b |ur syste|m..\end{|
|00000ac0| 66 75 6e 63 64 65 73 63 | 7d 0a 0a 5c 62 65 67 69 |funcdesc|}..\begi|
|00000ad0| 6e 7b 66 75 6e 63 64 65 | 73 63 7d 7b 66 6c 61 67 |n{funcde|sc}{flag|
|00000ae0| 73 7d 7b 5c 6f 70 74 69 | 6f 6e 61 6c 7b 66 6c 61 |s}{\opti|onal{fla|
|00000af0| 67 73 7d 7d 0a 20 53 65 | 74 20 74 68 65 20 73 70 |gs}}. Se|t the sp|
|00000b00| 65 63 69 66 69 65 64 20 | 66 6c 61 67 73 20 66 6f |ecified |flags fo|
|00000b10| 72 20 74 68 65 20 66 69 | 6c 65 20 74 68 61 74 20 |r the fi|le that |
|00000b20| 74 68 65 20 66 69 6c 65 | 20 6f 62 6a 65 63 74 20 |the file| object |
|00000b30| 69 73 20 72 65 66 65 72 | 72 69 6e 67 0a 20 74 6f |is refer|ring. to|
|00000b40| 2e 20 20 54 68 65 20 6e | 65 77 20 66 6c 61 67 73 |. The n|ew flags|
|00000b50| 20 61 72 65 20 4f 52 65 | 64 20 77 69 74 68 20 74 | are ORe|d with t|
|00000b60| 68 65 20 6f 6c 64 20 66 | 6c 61 67 73 2c 20 75 6e |he old f|lags, un|
|00000b70| 6c 65 73 73 20 73 70 65 | 63 69 66 69 65 64 0a 20 |less spe|cified. |
|00000b80| 6f 74 68 65 72 77 69 73 | 65 2e 20 20 54 68 65 20 |otherwis|e. The |
|00000b90| 66 6f 72 6d 61 74 20 69 | 73 20 65 78 70 6c 61 69 |format i|s explai|
|00000ba0| 6e 65 64 20 62 65 6c 6f | 77 20 69 6e 20 61 20 74 |ned belo|w in a t|
|00000bb0| 61 62 6c 65 2e 20 20 57 | 69 74 68 6f 75 74 0a 20 |able. W|ithout. |
|00000bc0| 74 68 65 20 5c 76 61 72 | 7b 66 6c 61 67 73 7d 20 |the \var|{flags} |
|00000bd0| 61 72 67 75 6d 65 6e 74 | 0a 20 61 20 73 74 72 69 |argument|. a stri|
|00000be0| 6e 67 20 69 6e 64 69 63 | 61 74 69 6e 67 20 74 68 |ng indic|ating th|
|00000bf0| 65 20 63 75 72 72 65 6e | 74 20 66 6c 61 67 73 20 |e curren|t flags |
|00000c00| 69 73 20 72 65 74 75 72 | 6e 65 64 20 28 74 68 69 |is retur|ned (thi|
|00000c10| 73 20 69 73 0a 20 74 68 | 65 20 73 61 6d 65 20 61 |s is. th|e same a|
|00000c20| 73 20 74 68 65 20 27 3f | 27 20 6d 6f 64 69 66 69 |s the '?|' modifi|
|00000c30| 65 72 29 2e 20 20 46 6f | 72 20 6d 6f 72 65 20 69 |er). Fo|r more i|
|00000c40| 6e 66 6f 72 6d 61 74 69 | 6f 6e 20 61 62 6f 75 74 |nformati|on about|
|00000c50| 20 74 68 65 20 66 6c 61 | 67 73 0a 20 72 65 66 65 | the fla|gs. refe|
|00000c60| 72 20 74 6f 20 74 68 65 | 20 66 63 6e 74 6c 20 6d |r to the| fcntl m|
|00000c70| 61 6e 75 61 6c 20 70 61 | 67 65 20 6f 6e 20 79 6f |anual pa|ge on yo|
|00000c80| 75 72 20 73 79 73 74 65 | 6d 2e 0a 5c 65 6e 64 7b |ur syste|m..\end{|
|00000c90| 66 75 6e 63 64 65 73 63 | 7d 0a 0a 5c 62 65 67 69 |funcdesc|}..\begi|
|00000ca0| 6e 7b 66 75 6e 63 64 65 | 73 63 7d 7b 64 75 70 7d |n{funcde|sc}{dup}|
|00000cb0| 7b 7d 0a 20 44 75 70 6c | 69 63 61 74 65 20 74 68 |{}. Dupl|icate th|
|00000cc0| 65 20 66 69 6c 65 20 6f | 62 6a 65 63 74 20 61 6e |e file o|bject an|
|00000cd0| 64 20 74 68 65 20 75 6e | 64 65 72 6c 79 69 6e 67 |d the un|derlying|
|00000ce0| 20 66 69 6c 65 20 70 6f | 69 6e 74 65 72 20 61 6e | file po|inter an|
|00000cf0| 64 20 66 69 6c 65 0a 20 | 64 65 73 63 72 69 70 74 |d file. |descript|
|00000d00| 6f 72 2e 20 20 54 68 65 | 20 72 65 73 75 6c 74 69 |or. The| resulti|
|00000d10| 6e 67 20 6f 62 6a 65 63 | 74 20 62 65 68 61 76 65 |ng objec|t behave|
|00000d20| 73 20 61 73 20 69 66 20 | 69 74 20 77 65 72 65 20 |s as if |it were |
|00000d30| 6e 65 77 6c 79 0a 20 6f | 70 65 6e 65 64 2e 0a 5c |newly. o|pened..\|
|00000d40| 65 6e 64 7b 66 75 6e 63 | 64 65 73 63 7d 0a 0a 5c |end{func|desc}..\|
|00000d50| 62 65 67 69 6e 7b 66 75 | 6e 63 64 65 73 63 7d 7b |begin{fu|ncdesc}{|
|00000d60| 64 75 70 32 7d 7b 66 64 | 7d 0a 20 44 75 70 6c 69 |dup2}{fd|}. Dupli|
|00000d70| 63 61 74 65 20 74 68 65 | 20 66 69 6c 65 20 6f 62 |cate the| file ob|
|00000d80| 6a 65 63 74 20 61 6e 64 | 20 74 68 65 20 75 6e 64 |ject and| the und|
|00000d90| 65 72 6c 79 69 6e 67 20 | 66 69 6c 65 20 70 6f 69 |erlying |file poi|
|00000da0| 6e 74 65 72 20 61 6e 64 | 20 66 69 6c 65 0a 20 64 |nter and| file. d|
|00000db0| 65 73 63 72 69 70 74 6f | 72 2e 20 20 54 68 65 20 |escripto|r. The |
|00000dc0| 6e 65 77 20 6f 62 6a 65 | 63 74 20 77 69 6c 6c 20 |new obje|ct will |
|00000dd0| 68 61 76 65 20 74 68 65 | 20 67 69 76 65 6e 20 66 |have the| given f|
|00000de0| 69 6c 65 20 64 65 73 63 | 72 69 70 74 6f 72 2e 0a |ile desc|riptor..|
|00000df0| 20 4f 74 68 65 72 77 69 | 73 65 20 74 68 65 20 72 | Otherwi|se the r|
|00000e00| 65 73 75 6c 74 69 6e 67 | 20 6f 62 6a 65 63 74 20 |esulting| object |
|00000e10| 62 65 68 61 76 65 73 20 | 61 73 20 69 66 20 69 74 |behaves |as if it|
|00000e20| 20 77 65 72 65 20 6e 65 | 77 6c 79 20 6f 70 65 6e | were ne|wly open|
|00000e30| 65 64 2e 0a 5c 65 6e 64 | 7b 66 75 6e 63 64 65 73 |ed..\end|{funcdes|
|00000e40| 63 7d 0a 0a 5c 62 65 67 | 69 6e 7b 66 75 6e 63 64 |c}..\beg|in{funcd|
|00000e50| 65 73 63 7d 7b 66 69 6c | 65 7d 7b 7d 0a 20 52 65 |esc}{fil|e}{}. Re|
|00000e60| 74 75 72 6e 20 74 68 65 | 20 73 74 61 6e 64 61 72 |turn the| standar|
|00000e70| 64 20 66 69 6c 65 20 6f | 62 6a 65 63 74 20 74 68 |d file o|bject th|
|00000e80| 61 74 20 74 68 65 20 70 | 6f 73 69 78 66 69 6c 65 |at the p|osixfile|
|00000e90| 20 6f 62 6a 65 63 74 20 | 69 73 20 62 61 73 65 64 | object |is based|
|00000ea0| 0a 20 6f 6e 2e 20 20 54 | 68 69 73 20 69 73 20 73 |. on. T|his is s|
|00000eb0| 6f 6d 65 74 69 6d 65 73 | 20 6e 65 63 65 73 73 61 |ometimes| necessa|
|00000ec0| 72 79 20 66 6f 72 20 66 | 75 6e 63 74 69 6f 6e 73 |ry for f|unctions|
|00000ed0| 20 74 68 61 74 20 69 6e | 73 69 73 74 20 6f 6e 20 | that in|sist on |
|00000ee0| 61 0a 20 73 74 61 6e 64 | 61 72 64 20 66 69 6c 65 |a. stand|ard file|
|00000ef0| 20 6f 62 6a 65 63 74 2e | 0a 5c 65 6e 64 7b 66 75 | object.|.\end{fu|
|00000f00| 6e 63 64 65 73 63 7d 0a | 0a 41 6c 6c 20 6d 65 74 |ncdesc}.|.All met|
|00000f10| 68 6f 64 73 20 72 65 74 | 75 72 6e 20 5c 63 6f 64 |hods ret|urn \cod|
|00000f20| 65 7b 49 4f 45 72 72 6f | 72 7d 20 77 68 65 6e 20 |e{IOErro|r} when |
|00000f30| 74 68 65 20 72 65 71 75 | 65 73 74 20 66 61 69 6c |the requ|est fail|
|00000f40| 73 2e 0a 0a 46 6f 72 6d | 61 74 20 63 68 61 72 61 |s...Form|at chara|
|00000f50| 63 74 65 72 73 20 66 6f | 72 20 74 68 65 20 5c 63 |cters fo|r the \c|
|00000f60| 6f 64 65 7b 6c 6f 63 6b | 28 29 7d 20 6d 65 74 68 |ode{lock|()} meth|
|00000f70| 6f 64 20 68 61 76 65 20 | 74 68 65 20 66 6f 6c 6c |od have |the foll|
|00000f80| 6f 77 69 6e 67 20 6d 65 | 61 6e 69 6e 67 3a 0a 0a |owing me|aning:..|
|00000f90| 5c 62 65 67 69 6e 7b 74 | 61 62 6c 65 69 69 69 7d |\begin{t|ableiii}|
|00000fa0| 7b 7c 63 7c 6c 7c 63 7c | 7d 7b 73 61 6d 70 7d 7b |{|c|l|c||}{samp}{|
|00000fb0| 46 6f 72 6d 61 74 7d 7b | 4d 65 61 6e 69 6e 67 7d |Format}{|Meaning}|
|00000fc0| 7b 7d 0a 20 20 5c 6c 69 | 6e 65 69 69 69 7b 75 7d |{}. \li|neiii{u}|
|00000fd0| 7b 75 6e 6c 6f 63 6b 20 | 74 68 65 20 73 70 65 63 |{unlock |the spec|
|00000fe0| 69 66 69 65 64 20 72 65 | 67 69 6f 6e 7d 7b 7d 0a |ified re|gion}{}.|
|00000ff0| 20 20 5c 6c 69 6e 65 69 | 69 69 7b 72 7d 7b 72 65 | \linei|ii{r}{re|
|00001000| 71 75 65 73 74 20 61 20 | 72 65 61 64 20 6c 6f 63 |quest a |read loc|
|00001010| 6b 20 66 6f 72 20 74 68 | 65 20 73 70 65 63 69 66 |k for th|e specif|
|00001020| 69 65 64 20 73 65 63 74 | 69 6f 6e 7d 7b 7d 0a 20 |ied sect|ion}{}. |
|00001030| 20 5c 6c 69 6e 65 69 69 | 69 7b 77 7d 7b 72 65 71 | \lineii|i{w}{req|
|00001040| 75 65 73 74 20 61 20 77 | 72 69 74 65 20 6c 6f 63 |uest a w|rite loc|
|00001050| 6b 20 66 6f 72 20 74 68 | 65 20 73 70 65 63 69 66 |k for th|e specif|
|00001060| 69 65 64 20 73 65 63 74 | 69 6f 6e 7d 7b 7d 0a 5c |ied sect|ion}{}.\|
|00001070| 65 6e 64 7b 74 61 62 6c | 65 69 69 69 7d 0a 0a 49 |end{tabl|eiii}..I|
|00001080| 6e 20 61 64 64 69 74 69 | 6f 6e 20 74 68 65 20 66 |n additi|on the f|
|00001090| 6f 6c 6c 6f 77 69 6e 67 | 20 6d 6f 64 69 66 69 65 |ollowing| modifie|
|000010a0| 72 73 20 63 61 6e 20 62 | 65 20 61 64 64 65 64 20 |rs can b|e added |
|000010b0| 74 6f 20 74 68 65 20 66 | 6f 72 6d 61 74 3a 0a 0a |to the f|ormat:..|
|000010c0| 5c 62 65 67 69 6e 7b 74 | 61 62 6c 65 69 69 69 7d |\begin{t|ableiii}|
|000010d0| 7b 7c 63 7c 6c 7c 63 7c | 7d 7b 73 61 6d 70 7d 7b |{|c|l|c||}{samp}{|
|000010e0| 4d 6f 64 69 66 69 65 72 | 7d 7b 4d 65 61 6e 69 6e |Modifier|}{Meanin|
|000010f0| 67 7d 7b 4e 6f 74 65 73 | 7d 0a 20 20 5c 6c 69 6e |g}{Notes|}. \lin|
|00001100| 65 69 69 69 7b 7c 7d 7b | 77 61 69 74 20 75 6e 74 |eiii{|}{|wait unt|
|00001110| 69 6c 20 74 68 65 20 6c | 6f 63 6b 20 68 61 73 20 |il the l|ock has |
|00001120| 62 65 65 6e 20 67 72 61 | 6e 74 65 64 7d 7b 7d 0a |been gra|nted}{}.|
|00001130| 20 20 5c 6c 69 6e 65 69 | 69 69 7b 3f 7d 7b 72 65 | \linei|ii{?}{re|
|00001140| 74 75 72 6e 20 74 68 65 | 20 66 69 72 73 74 20 6c |turn the| first l|
|00001150| 6f 63 6b 20 63 6f 6e 66 | 6c 69 63 74 69 6e 67 20 |ock conf|licting |
|00001160| 77 69 74 68 20 74 68 65 | 20 72 65 71 75 65 73 74 |with the| request|
|00001170| 65 64 20 6c 6f 63 6b 2c | 20 6f 72 0a 20 20 20 20 |ed lock,| or. |
|00001180| 20 20 20 20 20 20 20 20 | 20 20 5c 63 6f 64 65 7b | | \code{|
|00001190| 4e 6f 6e 65 7d 20 69 66 | 20 74 68 65 72 65 20 69 |None} if| there i|
|000011a0| 73 20 6e 6f 20 63 6f 6e | 66 6c 69 63 74 2e 7d 7b |s no con|flict.}{|
|000011b0| 28 31 29 7d 20 0a 5c 65 | 6e 64 7b 74 61 62 6c 65 |(1)} .\e|nd{table|
|000011c0| 69 69 69 7d 0a 0a 4e 6f | 74 65 3a 0a 0a 28 31 29 |iii}..No|te:..(1)|
|000011d0| 20 54 68 65 20 6c 6f 63 | 6b 20 72 65 74 75 72 6e | The loc|k return|
|000011e0| 65 64 20 69 73 20 69 6e | 20 74 68 65 20 66 6f 72 |ed is in| the for|
|000011f0| 6d 61 74 20 5c 63 6f 64 | 65 7b 28 6d 6f 64 65 2c |mat \cod|e{(mode,|
|00001200| 20 6c 65 6e 2c 20 73 74 | 61 72 74 2c 0a 77 68 65 | len, st|art,.whe|
|00001210| 6e 63 65 2c 20 70 69 64 | 29 7d 20 77 68 65 72 65 |nce, pid|)} where|
|00001220| 20 6d 6f 64 65 20 69 73 | 20 61 20 63 68 61 72 61 | mode is| a chara|
|00001230| 63 74 65 72 20 72 65 70 | 72 65 73 65 6e 74 69 6e |cter rep|resentin|
|00001240| 67 20 74 68 65 20 74 79 | 70 65 20 6f 66 20 6c 6f |g the ty|pe of lo|
|00001250| 63 6b 0a 28 27 72 27 20 | 6f 72 20 27 77 27 29 2e |ck.('r' |or 'w').|
|00001260| 20 20 54 68 69 73 20 6d | 6f 64 69 66 69 65 72 20 | This m|odifier |
|00001270| 70 72 65 76 65 6e 74 73 | 20 61 20 72 65 71 75 65 |prevents| a reque|
|00001280| 73 74 20 66 72 6f 6d 20 | 62 65 69 6e 67 20 67 72 |st from |being gr|
|00001290| 61 6e 74 65 64 3b 20 69 | 74 0a 69 73 20 66 6f 72 |anted; i|t.is for|
|000012a0| 20 71 75 65 72 79 20 70 | 75 72 70 6f 73 65 73 20 | query p|urposes |
|000012b0| 6f 6e 6c 79 2e 0a 0a 46 | 6f 72 6d 61 74 20 63 68 |only...F|ormat ch|
|000012c0| 61 72 61 63 74 65 72 20 | 66 6f 72 20 74 68 65 20 |aracter |for the |
|000012d0| 5c 63 6f 64 65 7b 66 6c | 61 67 73 28 29 7d 20 6d |\code{fl|ags()} m|
|000012e0| 65 74 68 6f 64 20 68 61 | 76 65 20 74 68 65 20 66 |ethod ha|ve the f|
|000012f0| 6f 6c 6c 6f 77 69 6e 67 | 20 6d 65 61 6e 69 6e 67 |ollowing| meaning|
|00001300| 3a 0a 0a 5c 62 65 67 69 | 6e 7b 74 61 62 6c 65 69 |:..\begi|n{tablei|
|00001310| 69 69 7d 7b 7c 63 7c 6c | 7c 63 7c 7d 7b 73 61 6d |ii}{|c|l||c|}{sam|
|00001320| 70 7d 7b 46 6f 72 6d 61 | 74 7d 7b 4d 65 61 6e 69 |p}{Forma|t}{Meani|
|00001330| 6e 67 7d 7b 7d 0a 20 20 | 5c 6c 69 6e 65 69 69 69 |ng}{}. |\lineiii|
|00001340| 7b 61 7d 7b 61 70 70 65 | 6e 64 20 6f 6e 6c 79 20 |{a}{appe|nd only |
|00001350| 66 6c 61 67 7d 7b 7d 0a | 20 20 5c 6c 69 6e 65 69 |flag}{}.| \linei|
|00001360| 69 69 7b 63 7d 7b 63 6c | 6f 73 65 20 6f 6e 20 65 |ii{c}{cl|ose on e|
|00001370| 78 65 63 20 66 6c 61 67 | 7d 7b 7d 0a 20 20 5c 6c |xec flag|}{}. \l|
|00001380| 69 6e 65 69 69 69 7b 6e | 7d 7b 6e 6f 20 64 65 6c |ineiii{n|}{no del|
|00001390| 61 79 20 66 6c 61 67 20 | 28 61 6c 73 6f 20 63 61 |ay flag |(also ca|
|000013a0| 6c 6c 65 64 20 6e 6f 6e | 2d 62 6c 6f 63 6b 69 6e |lled non|-blockin|
|000013b0| 67 20 66 6c 61 67 29 7d | 7b 7d 0a 20 20 5c 6c 69 |g flag)}|{}. \li|
|000013c0| 6e 65 69 69 69 7b 73 7d | 7b 73 79 6e 63 68 72 6f |neiii{s}|{synchro|
|000013d0| 6e 69 7a 61 74 69 6f 6e | 20 66 6c 61 67 7d 7b 7d |nization| flag}{}|
|000013e0| 0a 5c 65 6e 64 7b 74 61 | 62 6c 65 69 69 69 7d 0a |.\end{ta|bleiii}.|
|000013f0| 0a 49 6e 20 61 64 64 69 | 74 69 6f 6e 20 74 68 65 |.In addi|tion the|
|00001400| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 6d 6f 64 69 66 | followi|ng modif|
|00001410| 69 65 72 73 20 63 61 6e | 20 62 65 20 61 64 64 65 |iers can| be adde|
|00001420| 64 20 74 6f 20 74 68 65 | 20 66 6f 72 6d 61 74 3a |d to the| format:|
|00001430| 0a 0a 5c 62 65 67 69 6e | 7b 74 61 62 6c 65 69 69 |..\begin|{tableii|
|00001440| 69 7d 7b 7c 63 7c 6c 7c | 63 7c 7d 7b 73 61 6d 70 |i}{|c|l||c|}{samp|
|00001450| 7d 7b 4d 6f 64 69 66 69 | 65 72 7d 7b 4d 65 61 6e |}{Modifi|er}{Mean|
|00001460| 69 6e 67 7d 7b 4e 6f 74 | 65 73 7d 0a 20 20 5c 6c |ing}{Not|es}. \l|
|00001470| 69 6e 65 69 69 69 7b 21 | 7d 7b 74 75 72 6e 20 74 |ineiii{!|}{turn t|
|00001480| 68 65 20 73 70 65 63 69 | 66 69 65 64 20 66 6c 61 |he speci|fied fla|
|00001490| 67 73 20 27 6f 66 66 27 | 2c 20 69 6e 73 74 65 61 |gs 'off'|, instea|
|000014a0| 64 20 6f 66 20 74 68 65 | 20 64 65 66 61 75 6c 74 |d of the| default|
|000014b0| 20 27 6f 6e 27 7d 7b 28 | 31 29 7d 0a 20 20 5c 6c | 'on'}{(|1)}. \l|
|000014c0| 69 6e 65 69 69 69 7b 3d | 7d 7b 72 65 70 6c 61 63 |ineiii{=|}{replac|
|000014d0| 65 20 74 68 65 20 66 6c | 61 67 73 2c 20 69 6e 73 |e the fl|ags, ins|
|000014e0| 74 65 61 64 20 6f 66 20 | 74 68 65 20 64 65 66 61 |tead of |the defa|
|000014f0| 75 6c 74 20 27 4f 52 27 | 20 6f 70 65 72 61 74 69 |ult 'OR'| operati|
|00001500| 6f 6e 7d 7b 28 31 29 7d | 0a 20 20 5c 6c 69 6e 65 |on}{(1)}|. \line|
|00001510| 69 69 69 7b 3f 7d 7b 72 | 65 74 75 72 6e 20 61 20 |iii{?}{r|eturn a |
|00001520| 73 74 72 69 6e 67 20 69 | 6e 20 77 68 69 63 68 20 |string i|n which |
|00001530| 74 68 65 20 63 68 61 72 | 61 63 74 65 72 73 20 72 |the char|acters r|
|00001540| 65 70 72 65 73 65 6e 74 | 20 74 68 65 20 66 6c 61 |epresent| the fla|
|00001550| 67 73 20 74 68 61 74 0a | 20 20 61 72 65 20 73 65 |gs that.| are se|
|00001560| 74 2e 7d 7b 28 32 29 7d | 0a 5c 65 6e 64 7b 74 61 |t.}{(2)}|.\end{ta|
|00001570| 62 6c 65 69 69 69 7d 0a | 0a 4e 6f 74 65 3a 0a 0a |bleiii}.|.Note:..|
|00001580| 28 31 29 20 54 68 65 20 | 5c 63 6f 64 65 7b 21 7d |(1) The |\code{!}|
|00001590| 20 61 6e 64 20 5c 63 6f | 64 65 7b 3d 7d 20 6d 6f | and \co|de{=} mo|
|000015a0| 64 69 66 69 65 72 73 20 | 61 72 65 20 6d 75 74 75 |difiers |are mutu|
|000015b0| 61 6c 6c 79 20 65 78 63 | 6c 75 73 69 76 65 2e 0a |ally exc|lusive..|
|000015c0| 0a 28 32 29 20 54 68 69 | 73 20 73 74 72 69 6e 67 |.(2) Thi|s string|
|000015d0| 20 72 65 70 72 65 73 65 | 6e 74 73 20 74 68 65 20 | represe|nts the |
|000015e0| 66 6c 61 67 73 20 61 66 | 74 65 72 20 74 68 65 79 |flags af|ter they|
|000015f0| 20 6d 61 79 20 68 61 76 | 65 20 62 65 65 6e 20 61 | may hav|e been a|
|00001600| 6c 74 65 72 65 64 0a 62 | 79 20 74 68 65 20 73 61 |ltered.b|y the sa|
|00001610| 6d 65 20 63 61 6c 6c 2e | 0a 0a 45 78 61 6d 70 6c |me call.|..Exampl|
|00001620| 65 73 3a 0a 0a 5c 62 63 | 6f 64 65 5c 62 65 67 69 |es:..\bc|ode\begi|
|00001630| 6e 7b 76 65 72 62 61 74 | 69 6d 7d 0a 66 72 6f 6d |n{verbat|im}.from|
|00001640| 20 70 6f 73 69 78 66 69 | 6c 65 20 69 6d 70 6f 72 | posixfi|le impor|
|00001650| 74 20 2a 0a 0a 66 69 6c | 65 20 3d 20 6f 70 65 6e |t *..fil|e = open|
|00001660| 28 27 2f 74 6d 70 2f 74 | 65 73 74 27 2c 20 27 77 |('/tmp/t|est', 'w|
|00001670| 27 29 0a 66 69 6c 65 2e | 6c 6f 63 6b 28 27 77 7c |').file.|lock('w||
|00001680| 27 29 0a 2e 2e 2e 0a 66 | 69 6c 65 2e 6c 6f 63 6b |').....f|ile.lock|
|00001690| 28 27 75 27 29 0a 66 69 | 6c 65 2e 63 6c 6f 73 65 |('u').fi|le.close|
|000016a0| 28 29 0a 5c 65 6e 64 7b | 76 65 72 62 61 74 69 6d |().\end{|verbatim|
|000016b0| 7d 5c 65 63 6f 64 65 0a | |}\ecode.| |
+--------+-------------------------+-------------------------+--------+--------+