?? ftok.3
字號:
.\" SCCSID: @(#)ftok.3 8.1 9/11/90.TH ftok 3.SH Nameftok \- standard interprocess communication package.SH Syntax.nf.B #include <sys/types.h>.B #include <sys/ipc.h>.PP.B key_t ftok(path, id).B char \(**path;.B char id;.fi.SH Description.NXR "ftok subroutine".NXR "interprocess communication package"All interprocess communication facilitiesrequire the user to supply a keyto be used by the .MS msgget 2 ,.MS semget 2 ,and.MS shmget 2system calls to obtain interprocess communication identifiers.One suggested method for forming a keyis to use the.PN ftok ,file to key,subroutine described below.Another way to compose keysis to include the project ID in the most significant byteand to use the remaining portion as a sequence number.There are many other ways to form keys,but it is necessary for each systemto define standards for forming them.If some standard is not adhered to,it will be possible for unrelated processesto unintentionally interfere witheach other's operation.Therefore,it is strongly suggested thatthe most significant byte of a keyin some senserefer to a projectso that keys do not conflictacross a given system..PPThe.PN ftoksubroutine returns a key based on.I pathand.I idthat is usable in subsequent.PN msgget ,.PN semget ,and.PN shmgetsystem calls.The.I pathmust be the path nameof an existing filethat is accessibleto the process. The.I idis a characterwhich uniquely identifiesa project.Note that.PN ftokwill return the same keyfor linked fileswhen called with the same.I idand that it will returndifferent keys whencalled with the same file namebut different.IR ids ..SH Return ValuesThe.PN ftoksubroutine returns.B "(key_t) \-1"if \fIpath\fPdoes not existor if it is not accessibleto the process..SH WarningIf the file whose \fIpath\fP is passedto.PN ftokis removed when keys still refer to the file,future calls to.PN ftokwith the same \fIpath\fP and \fIid\fPwill return an error.If the same file is recreated,then.PN ftokis likely to return a different keythan it did the original time it was called..SH See Alsointro(2), msgget(2), semget(2), shmget(2)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -