📄 qbufcall.9
字号:
'\" tr.\" -*- nroff -*-.\".\" @(#) qbufcall.9,v 1.1.4.1 2004/01/12 23:33:10 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:33:10 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 QBUFCALL 9 "2004/01/12 23:33:10" "LiS-2_16_18-8" "Linux STREAMS DDI/DKI".SH NAME.B qbufcall\- install a \fISTREAMS\fR buffer callback.SH SYNOPSIS.PP.B #include <sys/stream.h>.HP 8.BI "int " retval " = bufcall(unsigned " size ", int " priority ", void (*" function ")(long), long " arg );.SH DESCRIPTION.PPWhen allocation of a buffer fails as a result of a failed call to.BR allocb (9),the service routine shouldplace the.IR STREAMS (4)message that invoked the.BR allocb (9)call back on the queue with.BR putbq (9)and call the.BR bufcall ()function with the queue's service routine as the.I functionargument and a pointer to the queue as the.I argargument to the call.The.I sizeand.I priorityarguments should be the same as the.I sizeand.I priorityarguments that were issued to.BR allocb (9)..PPIn this way, the queue service routine will be recalled once there issufficient memory to allocate the requested buffer and message blocks..PPThe arguments to.BR bufcall ()are interpreted as follows:.TP 12.I sizeThe size of the requested data buffer..TP 12.I priorityThe priority of the requested message. The priority can be one of thefollowing values:.RS.TP 12.B BPRI_LOThe buffer needed is a high priority buffer..TP 12.B BPRI_MEDThe buffer needed is a medium priority buffer..TP 12.B BPRI_HIThe buffer needed is a low priority buffer..PPThe.I priorityargument is ignored by post-SVR 4.2 STREAMS.[svr42.]implementations..RE.TP 12.I functionThe callback function to call when a buffer of the requested size and message of therequested priority becomes available..TP 12.I argThe argument to pass to the callback function..SH "RETURN VALUES".PPUpon success,.BR bufcall ()returns true (1) and the specified.I functionwill be called with the sepcified.I argat a later time when buffers of the necessary size become available..PPUpon failure,.BR bufcall ()returns false (0) and no call will be generated to the specified.IR function ..SH ERRORS.PPWhen.BR bufcall ()encounters an error, it returns false (0)..PP.BR bufcall ()returns false (0) when the function pointer to the callback function,.I functionis.BR NULL ,or cannot allocate the necessary internal structures..SH CAVEATS.PPThe.B LiS.[LiS.]implementation of.BR bufcall ()does not actually generate a callback function once a buffer of theappropriate size becomes available. Instead.B LiS.[LiS.]starts a timer. When the timer expires, the ability to allocate the necessarybuffers is checked and the callback function invoked if it is now possible toallocate the necessary structures and buffers.This is not entirely consistent with SVR 4.2.[svr42.]operation..PP.B LiS.[LiS.]builds a linked list of buffer call structures and assigns an integer id toeach structure. Searches for unique buffer ids when ids are assigned andsearches for buffer ids when.BR unbufcall (9)is called are linear searches that are slow and inefficient.In fact, \*(lqThe Magic Garden\*(rq explains that in SVR 4.2.[svr42.]a.BR bufcall ()results in the creation of a.B streventstructure which is linked to the.I strbcallssystem variableand sets the.I strbcwaitflag which is then causes.BR kmem_free ()to set the.IR qrunflag .At no point in this process is an integer id assigned to the.B streventstructure. This means that.B LiS.[LiS.]meaninglessly assigns an integer id to the buffer call structure and theinefficiencies of linear searches are pointless..SH "SEE ALSO".PP.BR putbq (9),.BR allocb "(9) and ".BR unbufcall (9)..SH HISTORY.PP.BR bufcall ()first appeared in SVR 3..[svr3.].SH VERSIONS.PPThis manpage was written for.B LiS\c..[LiS.].\".\".XX.[magic.].[svr42.].[svr4.].\".\".[$LIST$.].TA
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -