📄 streamio.7
字号:
.B SNDPIPEsend.B SIGPIPEon.BR write (2)and.BR putmsg (2)if the stream head has received a write error.BR "" ( M_ERROR )message..PPUpon success,.B I_GWROPTreturns zero (0) and the write options flags in the integer pointed to by.IR arg .Upon failure,.B I_GWROPTreturns -1 and sets.I errnoto an appropriate error number as follows:.TP 12.RB [ EFAULT ].I argpointed outside the caller's valid address space..SS I_LINK.PP.PPLinks on stream under the multiplexing driver on stream.IR fd ..I argis the integer file descriptor of the stream to link under.IR fd ..PPThis call is passed as an.B I_STRioctl using an.B M_IOCTLdown the stream head write queue to be processed by the multiplexing driver on.IR fd ..B I_LINKwill block until an acknowledgment is received from the driver, the calltimes out waiting for an acknowledgement, the call is interrupted whileblocked by a signal, or the receipt of hangup or error message..PPUpon success,.B I_LINKreturns a positive integer representing the multiplex identifier of the lowerstream. This value can be subsequently used in a.B I_UNLINKcommand.Upon failure,.B I_LINKreturns -1 and sets.I errnoto an appropriate error number as follows:.PP.TP 12.RB [ EBADF ].I argis not a valid open file descriptor..TP 12.RB [ ETIME ]the command timed out before receiving an acknowledgment..TP 12.RB [ ENOSR ]a buffer for the ioctl message could not be allocated..TP 12.RB [ EINVAL ].I fdreceived an error message..TP 12.RB [ ENXIO ].I fdreceived a hangup or is closing..TP 12.RB [ EINVAL ].I fdhas no lower multiplexing driver definition..TP 12.RB [ EINVAL ].I argis already linked under a multiplexor or is not a STREAMS character specialfile..PPIn addition, any error received in an error message will be returned in.IR errno .Also, any error returned by the module or driver in an ioctl positive ornegative acknowledgement message will also be returned in.IR errno ..SS I_LIST.PP.PPList all of the modules pushed on the stream specified by.IR fd ..I argis a pointer to a.B str_liststructure to place the module names as follows:.sp.nf\fC\s-1\struct str_list { int sl_nmods; struct str_mlist *sl_modlist;};\fR\s+1.fi.PP.I sl_nmodsindicates the number of.B str_mliststructures the array pointed to by.IR sl_modlist ..I sl_modlistpoints to a list of.B str_mliststructures formatted as follows:.sp.nf\fC\s-1\struct str_mlist { char l_name[FMNAMESZ + 1];};\fR\s+1.fi.PPIf.I argis.BR NULL ,.B I_LISTwill return a positive integer.I retvalindicating the number of modules, including the driver, on stream.IR fd .This can be used to determine the number of module and driver names beforepassing the.B str_liststructure..PP.B I_LISTonly lists.I sl_nmodsnumber of modules and drivers starting with the module below the stream head.If there is an insuffient number of members in the.I sl_modlistarray to hold all of the names,.B I_LISTwill success, but will return only the number of names in the space provided..PPUpon success,.B I_LISTreturns zero (0) and the module and driver names in the passed in.B str_list " and " str_mliststructures, or, when.I argis.BR NULL ,returns a positive integer indicating the number of modules plus the driver onthe stream.IR fd.Upon failure,.B I_LISTreturns -1 and sets.I errnoto an appropriate error number as follows:.TP 12.RB [ EFAULT ].IR arg " or " str_mlistpoints outside the caller's valid address space..TP 12.RB [ EINVAL ].I sl_nmodsis less than 1, or,.I str_mlistis.BR NULL ..PPSee.IR "\*(lqBUGS\*(rq" ,below..SS I_LOOK.PP.PPGets the name of the first module beneath the stream head..I argis a pointer to a character string buffer to accept the name.This buffer must be at least.B (FNAMESZ + 1)in length..PPUpon success,.B I_LOOKcopies the name of the module beneath the stream head to tbe buffer pointed toby.IR arg .Upon failure,.B I_LOOKreturns -1 and sets.I errnoto an appropriate error number as follows:.TP 12.RB [ EFAULT ].I argpointed outside the caller's valid address space..TP 12.RB [ EINVAL ]there is no module beneath the stream head..SS I_NREAD.PP.PPGets the number of unread data bytes contained in.B M_DATAmessage blocks in the first messsage on the stream head read queue..I argpoints to an integer to contain the number of unread bytes..PPUpon success,.B I_NREADreturns zero (0) or a positive integer indicating the number of messages onthe stream head read queue.Upon failure,.B I_NREADreturns -1 and sets.I errnoto an appropriate error number as follows:.TP 12.RB [ EFAULT ].I argpoints outside the caller's valid address space..HP 12.B Note:.B LiS.[LiS.]uses.BR qsize "(9) and " msgdsize (9)to provide this command..SS I_PEEK.PP.PPPeeks at the next message on the stream head read queue without removing themessage from the queue..I argis a pointer to a.B strpeekstructure formatted as follows:.sp.nf\fC\s-1\struct strpeek { struct strbuf ctlbuf; struct strbuf databuf; long flags;};\fR\s+1.fi.PP.I ctlbufdescribes the control part of the message, and is formatted the same as the.B strbufstructure pointed to by.I ctlptras an argument to.BR getmsg (2).If there is no control part,the.I maxlenfield of this.B strbufshould be zero (0)..I databufdescribes the data part of the message, and is formatted the same as the.B strbufstructure pointed to by.I datptras an argument to.BR getmsg (2).If there is no data part,the.I maxlenfield of this.B strbufshould be zero (0)..PP.I flagsprovides the read flags and is formatted the same as the.I flagsargument to.BR getmsg (2)..PPUpon success,.B I_PEEKreturns zero (0)if there was no message on the stream head read queue, and returns one (1)and the retrieved message in the structure pointed to by.IR arg ,if there was a message on the stream head read queue.Upon failure,.B I_PEEKreturns -1 and sets.I errnoto an appropriate error message as follows:.TP 12.RB [ EFAULT ].IR arg ", " ctlbuf.buf " or " databuf.bufpoint outside the caller's valid address space..PPIn addition,.B I_PEEKcan return any.I errnoreturned by.BR getmsg (2).See.BR getmsg (2)..SS I_PLINK.PP.PPLinks on stream under the multiplexing driver on stream.IR fd ..I argis the integer file descriptor of the stream to link under.IR fd ..PPThis call is passed as an.B I_STRioctl using an.B M_IOCTLdown the stream head write queue to be processed by the multiplexing driver on.IR fd ..B I_PLINKwill block until an acknowledgment is received from the driver, the calltimes out waiting for an acknowledgement, the call is interrupted whileblocked by a signal, or the receipt of hangup or error message..PPUpon success,.B I_PLINKreturns a positive integer representing the multiplex identifier of the lowerstream. This value can be subsequently used in a.B I_PUNLINKcommand.Upon failure,.B I_PLINKreturns -1 and sets.I errnoto an appropriate error number as follows:.PP.TP 12.RB [ EBADF ].I argis not a valid open file descriptor..TP 12.RB [ ETIME ]the command timed out before receiving an acknowledgment..TP 12.RB [ ENOSR ]a buffer for the ioctl message could not be allocated..TP 12.RB [ EINVAL ].I fdreceived an error message..TP 12.RB [ ENXIO ].I fdreceived a hangup or is closing..TP 12.RB [ EINVAL ].I fdhas no lower multiplexing driver definition..TP 12.RB [ EINVAL ].I argis already linked under a multiplexor or is not a STREAMS character specialfile..PPIn addition, any error received in an error message will be returned in.IR errno .Also, any error returned by the module or driver in an ioctl positive ornegative acknowledgement message will also be returned in.IR errno ..PP.SS I_POP.PP.PPPops the STREAMS module just beneath the stream head from.IR fd ..I argis ignored..PPUpon success,.B I_POPpops the moudule beneath the stream head by calling.BR qdetach (9)andreturns (0).Upon failure,.B I_POPreturns -1 and sets.I errnoto an appropriate error number as follows:.TP 12.RB [ ENXIO ].I fdreceived a hangup or is closing..TP 12.RB [ EINVAL ]there was no module beneath the stream head..PPSee.BR qdetach (9)for more information..SS I_PUNLINK.PP.PPUnlink a stream from under a multiplexing driver that was previously linkedwith.BR I_PLINK ..I argis the multiplexor identifier of the linked stream, or,.B MUXID_ALLindicating that all linked streams are requested to be unlinked..PPThis call is passed as an.B I_STRioctl using an.B M_IOCTLdown the stream head write queue to be processed by the multiplexing driver on.IR fd ..B I_PUNLINKwill block until an acknowledgement is received from the driver, the calltimes out waiting for an acknowledgement, the call is interrupted whileblocked by a signal, or the receipt of hangup or error message..PPUpon success,.B I_PUNLINKreturns zero (0) and unlinks the specified stream(s).Upon failure,.B I_PUNLINKreturns -1 and sets.I errnoto an appropriate error number as follows:.TP 12.RB [ ENXIO ].I fdreceived a hangup or is closing..TP 12.RB [ EINVAL ].I argis invalid..TP 12.RB [ ETIME ]the call timed out waiting for a response from the driver..TP 12.RB [ EINTR ]the call was interrupted by a signal..TP 12.RB [ ENOSR "], [" EAGAIN ]could not allocate the buffer for the ioctl message..PPIn addition, any error received in a error message will be returnedin.IR errno .Also, any error returned by the module or driver in a ioctl positive ornegative acknowledgement message will also be returned in.SS I_PUSH.PP.PPPushes a STREAMS module by name on the stream specified by.IR fd ..I argis a pointer to a string that contains the name of the module to push..PPUpon success,.B I_PUSHpushes the named module and returns zero (0).Upon failure,.B I_PUSHreturns -1 and sets.T errnoto an appropriate error number as follows:.TP 12.RB [ EFAULT ].I argpoints outside the caller's valid address space..TP 12.RB [ EXNXIO ]the stream specified by.I fdhas received a hangup or is closing..TP 12.RB [ EINVAL ]the module name pointed to by.I argis invalid..TP 12.RB [ ENOSR ].I fdhas reached its maximum push count. No more modules can be pushed on thestream..TP 12.RB [ ENOMEM ]memory allocation for the queue pair for the pushed module failed..TP 12.RB [ ENOPKG ]the module has no qopen routine..PPIn addition, any error returned by the module's.BR qopen (9)function may be returned by.BR I_PUSH .See.BR qattach (9)and.BR qopen (9)for more information..SS I_RECVFD.PP.PP.I argis a pointer to a.B strrecvfdstructure formatted as follows:.sp.nf\fC\s-1\struct strrecvfd { int fd; uid_t uid; gid_t gid; ...};\fR\s+1.fi.PPIn the.B strrecfdstructure,.I fdis the filedescriptor received, and.IR uid " and " gidare the credentials associated with the file descriptor..PPUpon success,.B I_RECVFDreturns zero (0) and the completed.B strrecvfdstructure.Upon failure,.B I_RECVFDreturns -1 and sets.I errnoto an appropriate error number as follows:.PP.TP 12.RB [ EFAULT ].I argpoints outside the caller's valid address space..TP 12.RB [ ENXIO ].I fdreceived a hangup message or is closing..TP 12.RB [ EBADF ].I fdis not a stream..TP 12.RB [ EAGAIN ]no file descriptor message.BR "" ( M_PASSFP )is waiting..TP 12.RB [ ENFILE ]no remaining file descriptors could be allocated for the receiving process..TP 12.RB [ EBADMSG ]the message on the top of the stream head read queue is not a passed filedescriptor.BR "" ( M_PASSFD )message..SS I_SENDFD.PP.PPSends a file descriptor to the other end of a pipe..I argis the integer file descriptor to send..PPUpon success,.B I_SENDFDreturns (0).Upon failure,.B I_SENDFDreturns -1 and sets.I errnoto an appropriate error number as follows:.TP 12.RB [ EBADF ].I argis not a valid file descriptor..TP 12.RB [ EPIPE ].TP 12.RB [ ENOSR ]a buffer could not be allocated to send the file descriptor..TP 12.RB [ ENOMEM ]a file descriptor could not be allocated for the receiving end..SS I_SETCLTIME.PP.PPSets the closing delay time for the stream head..I argis a.B longvalue which specifies the delay time in milliseconds..PPUpon success,.B I_SETTLTIMEreturns zero (0) and sets the close delay time for.BR fd .Upon failure,.B I_SETTLTIMEreturns -1 and sets.T errnoto an appropriate error number as follows:.TP 12.RB [ EINVAL ].I argis outside the valid range 0 to 300,000 milliseconds..SS I_SETSIG.PP.PPSets the mask of events for which the stream head will send the callingprocess a.B SIGPOLLor.B SIGURGsignal..I argis an integer value containins one or more of the following event flags:.TP 12.B S_INPUTany message but high priority on read queue..TP 12.B S_HIPRIhigh priority message on read queue..TP 12.B S_OUTPUTwrite queue is no longer full..TP 12.B S_MSGsignal message at front of read queue..TP 12.B S_ERRORerror message arrived at stream head..TP 12.B S_HANGUPhangup message arrived at stream head..TP 12.B S_RDNORMnormal message on read queue.TP 12.B S_WRNORMsame as.BR S_OUTPUT ..TP 12.B S_RDBANDout of band message on read queue.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -