📄 flushq.9
字号:
'\" tr.\" -*- nroff -*-.\".\" @(#) flushq.9,v 1.1.4.1 2004/01/12 23:33:00 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:00 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 FLUSHQ 9 "2004/01/12 23:33:00" "LiS-2_16_18-8" "Linux STREAMS DDI/DKI".SH NAME.B flushq\- flushes messages from a \fISTREAMS\fR message queue.SH SYNOPSIS.PP.B #include <sys/stream.h>.HP 8.BI "flushq(queue_t *" q ", int " flag );.SH DESCRIPTION.PP.BR flushq ()is used to flush messages from a.IR STREAMS (4)message queue. It is typicallycalled in a.B M_FLUSHhandling routine to flush the requested messages from a queue..PPThe arguments to.B flushqare interpreted as follows:.TP 8.I qThe queue to flush..TP 8.I flagHow to flush the queue..I flagcan be one of the following:.RS.TP 12.B FLUSHDATAFlush only data messages; do not flush the control messages from the queue..TP 12.B FLUSHALLFlush all the messages from queue: both data messages and control messages..RE.SH EXAMPLES.PP.BR flushq ()is normally used within the.B M_FLUSHhandling procedures for a.IR STREAMS (4)module or driver as follows:.sp.in +4.nf\fC\s-2\int x_w_flush(queue_t *q, mblk_t *mp){ if (*mp->b_rptr & FLUSHW) { if (*mp->b_rptr & FLUSHBAND) flushband(WR(q), mp->b_rptr[1], FLUSHALL); else flushq(WR(q), FLUSHALL); if (q->q_next) { putnext(q, mp); return (0); } *mp->b_rptr &= ~FLUSHW; } if (*mp->b_rptr & FLUSHR) { if (*mp->b_rptr & FLUSHBAND) flushband(RD(q), mp->b_rptr[1], FLUSHALL); else flushq(RD(q), FLUSHALL); if (!q->q_next) { qreply(q, mp); return (0); } *mp->b_rptr &= ~FLUSHR; } freemsg(mp); return (0);}int x_r_flush(queue_t *q, mblk_t *mp){ if (*mp->b_rptr & FLUSHR) { if (*mp->b_rptr & FLUSHBAND) flushband(RD(q), mp->b_rptr[1], FLUSHALL); else flushq(RD(q), FLUSHALL); if (q->q_next) { putnext(q, mp); return (0); } *mp->b_rptr &= ~FLUSHR; } if (*mp->b_rptr & FLUSHW) { if (*mp->b_rptr & FLUSHBAND) flushband(WR(q), mp->b_rptr[1], FLUSHALL); else flushq(WR(q), FLUSHALL); if (!q->q_next) { qreply(q, mp); return (0); } *mp->b_rptr &= ~FLUSHW; } freemsg(mp); return (0);}\s+2\fR.fi.PPIn addition,.BR flushq ()is often used when closing or.BR I_UNLINK inga stream as follows:.sp.in +4.nf\fC\s-2\void x_free_priv(queue_t *q){ priv_t *p = (priv_t *) q->q_ptr; flushq(RD(q), FLUSHALL); flushq(WR(q), FLUSHALL); /* free some more stuff */ free(p); RD(q)->q_ptr = WR(q)->q_ptr = NULL; return;}\s+2\fR.fi.SH "RETURN VALUES".PP.BR flushq ()returns.BR void ..SH ERRORS.PPIf the.I qpassed to.BR flushq ()is.BR NULL ,or the.I qdoes not point to a valid queue structure, then.BR flushq ()will silently fail..SH CAVEATS.PP.B LiS.[LiS.]implements the call to.BR flushq (9).BI flushq( q ", " band )as a call to.BI flushband( q ", " 0 ", " flag )..SH "SEE ALSO".PP.BR flushband (9)..SH VERSIONS.PPThis manpage was written for.B LiS\c..[LiS.].PP.BR flushq ()first appeared in SVR 3..[svr3.].\".\".XX.[magic.].[svr42.].[svr4.].\".\".[$LIST$.].TA
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -