?? canput.9
字號:
'\" tr.\" -*- nroff -*-.\".\" @(#) canput.9,v 1.1.4.1 2004/01/12 23:32:59 brian Exp.\".\" =========================================================================.\".\" Copyright (C) 2001-2004 OpenSS7 Corp. <www.openss7.com>.\".\" All Rights Reserved..\".\" Permission is granted to make and distribute verbatim copies of this.\" manual provided the copyright notice and this permission notice are.\" preserved on all copies..\".\" Permission is granted to copy and distribute modified versions of this.\" manual under the conditions for verbatim copying, provided that the.\" entire resulting derived work is distributed under the terms of a.\" permission notice identical to this one.\" .\" Since the Linux kernel and libraries are constantly changing, this.\" manual page may be incorrect or out-of-date. The author(s) assume no.\" responsibility for errors or omissions, or for damages resulting from.\" the use of the information contained herein. The author(s) may not.\" have taken the same level of care in the production of this manual,.\" which is licensed free of charge, as they might when working.\" professionally..\" .\" Formatted or processed versions of this manual, if unaccompanied by.\" the source, must acknowledge the copyright and authors of this work..\".\" =========================================================================.\".\" Modified 2004/01/12 23:32:59 by brian.\".\" =========================================================================.so lis.macros.R1bracket-label "\fR[\fB" "\fR]" "\fR, \fB"no-default-databasedatabase lis.refsaccumulatemove-punctuationabbreviate Ajoin-authors ", " ", " " and "et-al " et al" 2 3abbreviate-label-ranges ".."sort-adjacent-labels.R2.\".\".TH CANPUT 9 "2004/01/12 23:32:59" "LiS-2_16_18-8" "Linux STREAMS DDI/DKI".SH "NAME".B canput\- test flow control on a \fISTREAMS\fR message queue.SH "SYNOPSIS".PP.B #include <sys/stream.h>.HP 8.BI "int " retval " = canput(queue_t *" q );.SH "DESCRIPTION".PP.BR canput ()checks whether the stream is flow controlled starting at thespecified queue,.IR q ..BR canput ()looks for the next queue which has a service routine or which has nonext queue..PPIf the next queue has the.B QFULLflag is clear indicating that the queue is not full, then.BR canput ()will return true (1)..PPIf the next queue has the the.B QFULLflag is set indicating that the queue is full,then.BR canput ()will return false (0)..PPWhen.BR canput ()returns false (0), it also sets the.B QWANTWflag for the queue upon which.BR canput ()stopped, indicating that the.IR STREAMS (4)executive should backenableservice procedures when the flow controlled queue isno longer full..PPIt is the responsibility of a.IR STREAMS (4)module putting a band zero (0)non-priority message to a message queue to check for flow control using.BR canput ()before placing a message on the queue with.BR putq (9)..SH "RETURN VALUES".PP.BR canput ()returns false (0) when the specified.IR STREAMS (4)message queue is flow controlledand returns true (1) when the specified.IR STREAMS (4)message queue is not flowcontrolled..SH "ERRORS".PP.BR canput ()always succeeds..SH "EXAMPLES".PP.BR canput ()is normally called before a call to.BR putq (9)as follows:.sp.nf\fC\s-1\voidexample_putp(queue_t *q, mblk_t *mp){ priv_t p = (priv_t *)q->q_ptr; queue_t *uq = p->upper_queue; if (!q->q_count && (mp->b_datap->db_type >= QPCTL || canput(uq))) { /* put to upper if we are empty and upper is not flow controlled */ putq(uq, mp); } else { /* put to our own queue otherwise */ putq(q, mp); }}\s+1\fR.fi.PPAbove, the example uses.BR canput ()from the lower queue put procedure to test the upper queue for flow control.If the upper queue is flow controlled, the message is placed on the lowerqueue. Otherwise, if the lower queue is empty and the upper queue is not flowcontrolled, the example places the message directly on the upper queue..SH "CAVEATS".PPIn the.B LiS.[LiS.]implementation, if.BR canput ()suffers an internal error, it will return false (0)..PP.B LiS.[LiS.]implements\fB\)canput(\fI\)q\fB\))\fR\),\fB\)canputnext(\fI\)q\fB\))\fR\) and\fB\)bcanputnext(\fI\)q\fB\), \fI\)band\fB\))\fR\)with macros that call\fB\)bcanput(\fI\)q\fB\), \fI\)band\fB\))\fR\)..SH "NOTES".PP.PP.B LfS.[LfS.]implements .BR canput ()and.BR canputnext (9)function directly and ensure integrity of dereferencing of the.I qpointer. This means that, while equivalent,.BI canput( q->q_next )and.BI canputnext( q )are different in that the caller is responsible for protecting the integrity ofthe.I q->q_nextdereferencing for.BI canput( q->q_next )\fR.Driver and module writers should always use.BI canputnext( q )instead of.BI canput( q->q_next )\fR.In fact, driver and module writers should avoid the dereference.I q->q_nextaltogether..SH "SEE ALSO".PP.BR putq (9),.BR canputnext (9),.BR bcanput (9),.BR bcanputnext (9),.BR noenable "(9) and ".BR enableok (9)..SH "VERSIONS".PPThis manpage was written for.B LiS\c..[LiS.].PP.BR canput ()first appeared in SVR 3..[svr3.].\".\".XX.[magic.].[svr42.].[svr4.].\".\".[$LIST$.].TA
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -