|
|
1.1 ! root 1: #ifndef __SYS_STREAM_H__ ! 2: #define __SYS_STREAM_H__ ! 3: ! 4: /* ! 5: * This ^^^^^^^^^^^^^^^^ symbol is used in the DDI/DKI header <sys/ddi.h> to ! 6: * determine which #undef directives it is required to perform, on the basis ! 7: * that it should avoid touching namespaces unless they have been reserved ! 8: * by the inclusion of a header which reserves such classes of names. ! 9: */ ! 10: ! 11: /* ! 12: *-IMPORTS: ! 13: * <common/ccompat.h> ! 14: * __PROTO () ! 15: * __EXTERN_C_BEGIN__ ! 16: * __EXTERN_C_END__ ! 17: * __VOID__ ! 18: * <common/_cred.h> ! 19: * cred_t ! 20: * <kernel/_toid.h> ! 21: * toid_t ! 22: * <kernel/x86lock.h> ! 23: * atomic_uchar_t ! 24: * <sys/types.h> ! 25: * caddr_t ! 26: */ ! 27: ! 28: #include <common/ccompat.h> ! 29: #include <common/_cred.h> ! 30: #include <kernel/_toid.h> ! 31: #include <kernel/x86lock.h> ! 32: #include <sys/types.h> ! 33: ! 34: #include <common/_stream.h> ! 35: ! 36: /* ! 37: * Public section of the <sys/stream.h> file, for consumption by user ! 38: * application code using access to the STREAMS messaging system, and ! 39: * by STREAMS drivers. ! 40: * ! 41: * The information in this header is directly related to the information ! 42: * published in the System V, Release 4 STREAMS Programmer's Guide, ! 43: * Appendices A and B. ! 44: */ ! 45: ! 46: ! 47: /* ! 48: * Message types. The particular values here may have some significance ! 49: * to some macros defined later, particularly datamsg (). ! 50: */ ! 51: ! 52: #define M_PRI 0x80 ! 53: #define QPCTL M_PRI ! 54: ! 55: /* regular messages */ ! 56: ! 57: #define M_DATA 0 ! 58: #define M_PROTO 1 ! 59: #define M_DELAY 2 ! 60: ! 61: #define M_IOCTL 3 ! 62: #define M_SETOPTS 4 ! 63: #define M_SIG 5 ! 64: #define M_CTL 6 ! 65: #define M_BREAK 7 ! 66: #define M_PASSFP 8 ! 67: #define M_RSE 9 ! 68: ! 69: /* priority messages */ ! 70: ! 71: #define M_PCPROTO (1 + M_PRI) ! 72: #define M_IOCACK (3 + M_PRI) ! 73: #define M_IOCNAK (4 + M_PRI) ! 74: #define M_PCSIG (5 + M_PRI) ! 75: #define M_ERROR (6 + M_PRI) ! 76: #define M_FLUSH (7 + M_PRI) ! 77: #define M_HANGUP (8 + M_PRI) ! 78: #define M_START (9 + M_PRI) ! 79: #define M_STOP (10 + M_PRI) ! 80: #define M_COPYIN (11 + M_PRI) ! 81: #define M_COPYOUT (12 + M_PRI) ! 82: #define M_IOCDATA (13 + M_PRI) ! 83: #define M_PCRSE (14 + M_PRI) ! 84: #define M_READ (15 + M_PRI) ! 85: #define M_STARTI (16 + M_PRI) ! 86: #define M_STOPI (17 + M_PRI) ! 87: ! 88: ! 89: struct streamtab { ! 90: struct qinit * st_rdinit; /* defines read QUEUE */ ! 91: struct qinit * st_wrinit; /* defines write QUEUE */ ! 92: struct qinit * st_muxrinit; /* for multiplexing drivers only */ ! 93: struct qinit * st_muxwinit; /* for multiplexing drivers only */ ! 94: }; ! 95: ! 96: ! 97: /* ! 98: * Private type definitions. ! 99: */ ! 100: ! 101: typedef atomic_uchar_t __str_lock_t; ! 102: ! 103: ! 104: /* ! 105: * QUEUE structures - these structures are used to build streams. ! 106: * ! 107: * Note that "queue_t" structures occur in pairs, first the write queue, then ! 108: * the read queue. The QREADR flag distinguishes them for the RD (q), WR (q) ! 109: * and OTHERQ (q) macros. ! 110: * ! 111: * The System V DDI/DKI adds multiprocessor support to STREAMS via the notion ! 112: * of "freezing" a stream, something mostly analagous to a basic lock. We can ! 113: * implement this facility either in terms of the primitive machine-specific ! 114: * atomic operations, or in terms of the DDI/DKI high-level lock operations. ! 115: * ! 116: * For now, we choose the latter. ! 117: */ ! 118: ! 119: struct queue { ! 120: struct qinit * q_qinfo; /* procedures and limits for queue */ ! 121: mblk_t * q_first; /* head of message queue for QUEUE */ ! 122: mblk_t * q_last; /* tail of message queue for QUEUE */ ! 123: queue_t * q_next; /* next QUEUE in stream */ ! 124: queue_t * q_link; /* next on STEAMS scheduling list */ ! 125: __VOID__ * q_ptr; /* to private data structure */ ! 126: unsigned long q_count; /* number of characters in queue */ ! 127: unsigned long q_flag; /* QUEUE state */ ! 128: long q_minpsz; /* minimum packet size accepted */ ! 129: long q_maxpsz; /* maximum packet size accepted */ ! 130: unsigned long q_hiwat; /* message queue high water mark */ ! 131: unsigned long q_lowat; /* message queue low water mark */ ! 132: qband_t * q_bandp; /* separate flow information */ ! 133: unsigned char q_nband; /* number of priority bands */ ! 134: unsigned char q_pad1 [3]; /* reserved for future use */ ! 135: long q_pad2 [2]; /* reserved for future use */ ! 136: ! 137: /* ! 138: * Data from this point are MWC extensions for multiprocessing. The ! 139: * DDI/DKI revokes user's right to know about the size of the ! 140: * structure, among other things. ! 141: */ ! 142: ! 143: unsigned char q_active; /* count of active put/srv routines */ ! 144: unsigned char q_lastband; /* band of last retrieved message */ ! 145: __str_lock_t q_locked; /* hack implementation of freezing */ ! 146: }; ! 147: ! 148: /* ! 149: * Hack around the union above. This field should only be referred to by some ! 150: * layering macros in <sys/strmlib.h> anyway, but we try and keep it clean. ! 151: */ ! 152: ! 153: #define q_lock x.q_lock ! 154: ! 155: ! 156: /* ! 157: * Queue flag definitions : these are internal to the system, and the values ! 158: * bear no relation to any definitions in System V. Drivers use these flags at ! 159: * their own risk... ! 160: */ ! 161: ! 162: #define QENAB 0x0001 /* queue is on qenable () schedule */ ! 163: #define QWANTR 0x0002 /* someone wants to read from the queue */ ! 164: #define QWANTW 0x0004 /* someone wants to write to the queue */ ! 165: #define QFULL 0x0008 /* queue is full */ ! 166: #define QREADR 0x0010 /* set for read queues */ ! 167: #define QNOENB 0x0020 /* prevent queue from being enabled */ ! 168: #define QBACK 0x0040 /* queue has been back-enabled */ ! 169: #define QOLD 0x0080 /* pre-SVR4 open/close interface */ ! 170: #define QPROCSOFF 0x0100 /* put/service routines disabled */ ! 171: #define QDRAIN 0x0200 /* waiting for queue to drain */ ! 172: #define QSRVACTIVE 0x0400 /* service routine is active */ ! 173: ! 174: /* #define QUSE ????? queue has been allocated */ ! 175: /* #define QHLIST ????? SVR4, not used by this implementation */ ! 176: ! 177: ! 178: /* ! 179: * queue priority-band information. ! 180: */ ! 181: ! 182: struct qband { ! 183: struct qband * qb_next; /* next band's info */ ! 184: unsigned long qb_count; /* count of bytes in band */ ! 185: struct msgb * qb_first; /* beginning of band's data */ ! 186: struct msgb * qb_last; /* end of band's data */ ! 187: unsigned long qb_hiwat; /* high water mark for band */ ! 188: unsigned long qb_lowat; /* low water mark for band */ ! 189: unsigned long qb_flag; /* flags, see below */ ! 190: unsigned long qb_pad1; /* reserved for future use */ ! 191: }; ! 192: ! 193: ! 194: ! 195: /* Flags used in band structure */ ! 196: ! 197: #define QB_FULL 0x0001 /* band is considered full */ ! 198: #define QB_WANTW 0x0002 /* someone wants to write to band */ ! 199: #define QB_BACK 0x0004 /* queue has been back-enabled */ ! 200: ! 201: /* non-SVR4 flag */ ! 202: #define QB_FIRST 0x0100 /* first entry in allocation unit */ ! 203: ! 204: ! 205: /* ! 206: * Message structures - the format of STREAMS messages and message data ! 207: * blocks. ! 208: */ ! 209: ! 210: struct msgb { ! 211: struct msgb * b_next; /* next message on queue */ ! 212: struct msgb * b_prev; /* previous message on queue */ ! 213: struct msgb * b_cont; /* next message block of message */ ! 214: unsigned char * b_rptr; /* first unread data byte in buffer */ ! 215: unsigned char * b_wptr; /* first unwritten data byte in buffer */ ! 216: struct datab * b_datap; /* data block */ ! 217: ! 218: unsigned char b_band; /* message priority */ ! 219: unsigned char b_pad1; ! 220: unsigned short b_flag; /* message flags */ ! 221: long b_pad2; ! 222: }; ! 223: ! 224: ! 225: /* Flag definitions for message blocks */ ! 226: ! 227: #define MSGMARK 0x0001 /* last byte of message is "marked" */ ! 228: #define MSGNOLOOP 0x0002 /* don't loop message to write-side of stream */ ! 229: #define MSGDELIM 0x0004 /* message is delimited */ ! 230: ! 231: /* Extra flag definitions, for STREAMS private use only */ ! 232: ! 233: #define MSGTRIPLE 0x0100 /* message block is part of triple */ ! 234: #define MSGFREE 0x0200 /* message block is free */ ! 235: ! 236: #define MSGMASK_SYSTEM 0x0300 /* system-private flags */ ! 237: ! 238: ! 239: /* ! 240: * Data structure used to control freeing of user-defined STREAMS buffer ! 241: * memory (such as user memory that is temporarily mapped to kernel space ! 242: * to avoid copying, or driver-dependent shared memory from an I/O space). ! 243: */ ! 244: ! 245: struct free_rtn { ! 246: void (* free_func) /* driver-dependent free routine */ ! 247: __PROTO ((__VOID__ * _arg)); ! 248: __VOID__ * free_arg; /* argument for free_rtn */ ! 249: }; ! 250: ! 251: typedef struct free_rtn frtn_t; ! 252: ! 253: ! 254: /* ! 255: * Data block descriptors - several mblk_t's may refer to the same section ! 256: * of STREAMS buffer memory to avoid copying. ! 257: * ! 258: * Note that this data structure is NOT identical to it's System V ! 259: * counterpart. ! 260: */ ! 261: ! 262: struct datab { ! 263: frtn_t * db_frtnp; /* internal use */ ! 264: unsigned char * db_base; /* first byte of buffer */ ! 265: unsigned char * db_lim; /* last+1 byte of buffer */ ! 266: unsigned char db_ref; /* count of messages pointing here */ ! 267: unsigned char db_type; /* message type */ ! 268: short db_pad1; /* reserved for future use */ ! 269: long db_pad2; /* reserved for future use */ ! 270: }; ! 271: ! 272: ! 273: /* ! 274: * Define one of these structures with external visibility to publish the ! 275: * entry points to your STREAMS driver. ! 276: */ ! 277: ! 278: typedef void (* __putp_t) /* put procedure */ ! 279: __PROTO ((queue_t * _q, mblk_t * _mp)); ! 280: typedef void (* __srvp_t) /* service procedure */ ! 281: __PROTO ((queue_t * _q)); ! 282: typedef int (* __qopen_t) /* open procedure */ ! 283: __PROTO ((queue_t * _q, n_dev_t * _devp, int _flag, ! 284: int _sflag, cred_t * _credp)); ! 285: typedef int (* __qclose_t) /* called on last close/pop */ ! 286: __PROTO ((queue_t * _q, int _flag, cred_t * _credp)); ! 287: typedef int (* __qadmin_t) /* reserved for future use */ ! 288: __PROTO ((void)); ! 289: ! 290: struct qinit { ! 291: __putp_t qi_putp; /* put procedure */ ! 292: __srvp_t qi_srvp; /* service procedure */ ! 293: __qopen_t qi_qopen; /* called on each open */ ! 294: __qclose_t qi_qclose; /* called on last close/pop */ ! 295: __qadmin_t qu_qadmin; /* reserved for future use */ ! 296: struct module_info ! 297: * qi_minfo; /* information structure */ ! 298: struct module_stat ! 299: * qi_mstat; /* statistics - optional */ ! 300: }; ! 301: ! 302: ! 303: /* ! 304: * General STREAMS "module information", mainly used by SysV configuration ! 305: * utilities, although it also provides defaults for the queues at open time. ! 306: */ ! 307: ! 308: struct module_info { ! 309: unsigned short mi_idnum; /* module ID number */ ! 310: char * mi_idname; /* module name */ ! 311: long mi_minpsz; /* min packet size accepted */ ! 312: long mi_maxpsz; /* max packet size accepted */ ! 313: unsigned long mi_hiwat; /* hi-water mark, for flow control */ ! 314: unsigned long mi_lowat; /* lo-water mark, for flow control */ ! 315: }; ! 316: ! 317: ! 318: /* Infinite message size, for use in module_info mi_minpsz/mi_maxpsz */ ! 319: ! 320: #define INFPSZ 0x7FFFFFFF ! 321: ! 322: ! 323: /* ! 324: * General statistics structure, useful for profiling module/driver ! 325: * activity. ! 326: */ ! 327: ! 328: struct module_stat { ! 329: long ms_pcnt; /* count of calls to put proc */ ! 330: long ms_scnt; /* count of calls to service proc */ ! 331: long ms_ocnt; /* count of calls to open proc */ ! 332: long ms_ccnt; /* count of calls to close proc */ ! 333: long ms_acnt; /* count of calls to admin proc */ ! 334: char * ms_xptr; /* pointer to private statistics */ ! 335: short ms_xsize; /* length of private stats buffer */ ! 336: }; ! 337: ! 338: ! 339: /* ! 340: * link block for multiplexed streams... this structure appears in the data ! 341: * portion of I_LINK and I_UNLINK M_IOCTL messages. ! 342: * ! 343: * Note that the STREAMS manual documents the type of "l_index" as an "int", ! 344: * but for our purposes an "n_dev_t" (which is a long) is more appropriate. ! 345: */ ! 346: ! 347: typedef n_dev_t __muxid_t; ! 348: ! 349: struct linkblk { ! 350: queue_t * l_qtop; /* lowest write queue of upper stream */ ! 351: queue_t * l_qbot; /* highest write queue of lower stream */ ! 352: __muxid_t l_index; /* unique index for lower stream */ ! 353: long l_pad [5]; /* reserved for future use */ ! 354: }; ! 355: ! 356: ! 357: /* ! 358: * Stream head options control message format, used as the data part of an ! 359: * M_SETOPTS message set from a driver or module to the stream head. The ! 360: * values for the "so_readopt" member can be found in <stropts.h> as well ! 361: * as below. ! 362: */ ! 363: ! 364: struct stroptions { ! 365: unsigned long so_flags; /* options to set */ ! 366: short so_readopt; /* read option */ ! 367: unsigned short so_wroff; /* write offset */ ! 368: long so_minpsz; /* min packet size */ ! 369: long so_maxpsz; /* max packet size */ ! 370: unsigned long so_hiwat; /* read queue high-water mark */ ! 371: unsigned long so_lowat; /* read queue low-water mark */ ! 372: unsigned char so_band; /* band for water marks */ ! 373: }; ! 374: ! 375: ! 376: /* ! 377: * Flag values for the "so_flags" member, ! 378: */ ! 379: ! 380: #define SO_ALL 0x3F /* set all options */ ! 381: #define SO_READOPT 0x0001 /* set read option */ ! 382: #define SO_WROFF 0x0002 /* set write offset */ ! 383: #define SO_MINPSZ 0x0004 /* set min packet size */ ! 384: #define SO_MAXPSZ 0x0008 /* set max packet size */ ! 385: #define SO_HIWAT 0x0010 /* set read queue high-water mark */ ! 386: #define SO_LOWAT 0x0020 /* set read queue low-water mark */ ! 387: ! 388: /* Flags above control which members to look at, below are R4 extensions */ ! 389: ! 390: #define SO_MREADON 0x0040 /* set read notification on */ ! 391: #define SO_MREADOFF 0x0080 /* set read notification off */ ! 392: #define SO_NDELON 0x0100 /* old TTY semantics for NDELAY */ ! 393: #define SO_NDELOFF 0x0200 /* STREAMS semantics for NDELAY */ ! 394: #define SO_ISTTY 0x0400 /* stream is acting as a terminal */ ! 395: #define SO_ISNTTY 0x0800 /* stream is not acting as a terminal */ ! 396: #define SO_TOSTOP 0x1000 /* stop on background writes to stream */ ! 397: #define SO_TONSTOP 0x2000 /* don't stop on background writes */ ! 398: #define SO_BAND 0x4000 /* water marks that affect band */ ! 399: ! 400: /* ! 401: * Other flags relevant to the above structure are defined in <sys/stropts.h>. ! 402: */ ! 403: ! 404: ! 405: /* ! 406: * Structure of data block found at head of M_IOCTL message, usually reused ! 407: * for replying to M_IOCTL with an M_IOCACK or M_IOCNAK message. ! 408: */ ! 409: ! 410: struct iocblk { ! 411: int ioc_cmd; /* ioctl () command type */ ! 412: cred_t * ioc_cr; /* user's full credentials */ ! 413: unsigned int ioc_id; /* M_IOCTL sequence number */ ! 414: unsigned int ioc_count; /* bytes in data field */ ! 415: int ioc_error; /* error code */ ! 416: int ioc_rval; /* return value */ ! 417: ! 418: long ioc_filler [4]; /* reserved for future use */ ! 419: }; ! 420: ! 421: ! 422: /* ! 423: * For compatibility with SVR3 sources ! 424: */ ! 425: ! 426: #define ioc_uid ioc_cr->cr_uid ! 427: #define ioc_gid ioc_cr->cr_gid ! 428: ! 429: ! 430: /* ! 431: * This special value of "ioc_count" is used to indicate that the stream ! 432: * head has passed us a "transparent" ioctl rather than an I_STR ioctl. ! 433: */ ! 434: ! 435: #define TRANSPARENT ((unsigned int) -1) ! 436: ! 437: ! 438: /* ! 439: * This structure defines the data format used in an M_COPYIN/M_COPYOUT ! 440: * message (used to request data copying from user process space during ! 441: * an ioctl ()). Note that the first three members of the "copyreq" structure ! 442: * match the first three fields of the "iocblk" structure. It is intended ! 443: * that drivers be able to use this property to simply use the intial message ! 444: * block from M_IOCTL for all the transparent IOCTL messages. ! 445: */ ! 446: ! 447: struct copyreq { ! 448: int cq_cmd; /* ioctl command (from ioc_cmd) */ ! 449: cred_t * cq_cr; /* full credentials (from ioc_cr) */ ! 450: unsigned int cq_id; /* ioctl id (from ioc_id) */ ! 451: caddr_t cq_addr; /* user address to copy data to/from */ ! 452: unsigned int cq_size; /* number of bytes to copy */ ! 453: int cq_flag; /* flags, see below */ ! 454: mblk_t * cq_private; /* private state information */ ! 455: long cq_filler [4]; /* reserved for future use */ ! 456: }; ! 457: ! 458: /* For compatibility with old sources. */ ! 459: ! 460: #define cq_uid cq_cr->cr_uid ! 461: #define cq_gid cq_cr->cr_gid ! 462: ! 463: /* cq_flag values */ ! 464: ! 465: #define STRCANON 0x0001 /* b_cont data block contains canonical format specifier */ ! 466: #define RECOPY 0x0002 /* perform I_STR copyin again using canonical format specifier */ ! 467: ! 468: ! 469: /* ! 470: * This structure is used in the M_IOCDATA response to an M_COPYIN/M_COPYOUT, ! 471: * and is laid out so that equivalent fields from the "struct copyreq" ! 472: * structure remain at the same offset, ie we expect the stream head to ! 473: * simply turn around our request, although it is not required to do so. ! 474: */ ! 475: ! 476: struct copyresp { ! 477: int cp_cmd; /* ioctl command (from cq_cmd) */ ! 478: cred_t * cp_cr; /* full credentials (from cq_cr) */ ! 479: unsigned int cp_id; /* ioctl id (from cq_id) */ ! 480: caddr_t cp_rval; /* request status: 0 success, non-zero failure */ ! 481: unsigned int cp_pad1; /* reserved */ ! 482: unsigned int cp_pad2; /* reserved */ ! 483: mblk_t * cp_private; /* private state information */ ! 484: long cp_filler [4]; /* reserved for future use */ ! 485: }; ! 486: ! 487: /* for compatibility with old sources */ ! 488: ! 489: #define cp_uid cp_cr->cr_uid ! 490: #define cp_gid cp_cr->cr_gid ! 491: ! 492: ! 493: /* ! 494: * LOCAL EXTENSIONS : The methods used in the multiplexing examples in the ! 495: * STREAMS V.2 manual are slightly inefficient. The following general STREAMS ! 496: * queue schedling routines were defined for multiplexing drivers and device ! 497: * drivers (such as Ethernet drivers) that must consume data from several ! 498: * queues. ! 499: * ! 500: * In the STREAMS code supplied, these routines are also used for the main ! 501: * streams queue scheduling, so we define them here. A consequence of this is ! 502: * that a given queue may not be queued for both STREAMS execution and ! 503: * multiplexing at the same time. ! 504: * ! 505: * The basic idea is to use qschedule () and qunschedule () to add and remove ! 506: * a queue from the scheduling list. Lower queues may then getq () from the ! 507: * "s_head" of the scheduling list to consume the data. Since by default this ! 508: * will simply attempt to drain each scheduled queue of data before moving to ! 509: * the next, the muxrobin () call adjusts the head/tail pointers to effect ! 510: * a round-robin of the queues that have data. ! 511: */ ! 512: ! 513: struct strsched { ! 514: queue_t * s_head; /* next queue to read data from */ ! 515: queue_t * s_tail; /* last queue to read data from */ ! 516: }; ! 517: ! 518: ! 519: /* ! 520: * Message allocation priorities, used with allocb () and bufcall () ! 521: */ ! 522: ! 523: enum { ! 524: BPRI_LO, ! 525: BPRI_MED, ! 526: BPRI_HI ! 527: }; ! 528: ! 529: ! 530: /* ! 531: * Flag values used with flushq () and flushband (). ! 532: */ ! 533: ! 534: enum { ! 535: FLUSHDATA, /* flush M_DATA, M_PROTO, M_PCPROTO, M_DELAY */ ! 536: FLUSHALL /* flush all messages from queue */ ! 537: }; ! 538: ! 539: ! 540: /* ! 541: * queue field numbers to be used with strqget ()/strqset (). ! 542: */ ! 543: ! 544: typedef enum qfields { ! 545: QHIWAT = 0, /* q_hiwat or qb_hiwat */ ! 546: QLOWAT = 1, /* q_lowat or qb_lowat */ ! 547: QMAXPSZ = 2, /* q_maxpsz */ ! 548: QMINPSZ = 3, /* q_minpsz */ ! 549: QCOUNT = 4, /* q_count or qb_count */ ! 550: QFIRST = 5, /* q_first or qb_first */ ! 551: QLAST = 6, /* q_last or qb_last */ ! 552: QFLAG = 7, /* q_flag or qb_flag */ ! 553: QBAD = 8 ! 554: } qfields_t; ! 555: ! 556: ! 557: /* ! 558: * External function definitions for the STREAMS library. ! 559: * ! 560: * Note that prototypes are also provided for those STREAMS functions that ! 561: * are available as macros. This is since this header is a more appropriate ! 562: * place to encode this knowledge than the DDI/DKI required header ! 563: * <sys/ddi.h> ! 564: * ! 565: * The System V Release 4 Multi-Processor DDI/DKI defines some extra versions ! 566: * of some common STREAMS library functions so that STREAMS driver code does ! 567: * not reference the q->q_next member, since this may not be safe in a multi- ! 568: * processor environment. These functions are included in this implementation ! 569: * and are prototyped below to help device drivers anticipate the multi- ! 570: * processor environment. ! 571: */ ! 572: ! 573: __EXTERN_C_BEGIN__ ! 574: ! 575: int adjmsg __PROTO ((mblk_t * _mp, int _len)); ! 576: mblk_t * allocb __PROTO ((int _size, unsigned int _pri)); ! 577: queue_t * backq __PROTO ((queue_t * _q)); ! 578: int bcanput __PROTO ((queue_t * _q, unsigned char _pri)); ! 579: int bcanputnext __PROTO ((queue_t * _q, unsigned char _pri)); ! 580: /* see <sys/bufcall.h> for a discussion of this declaration for bufcall () */ ! 581: #define __STDARG_BUFCALL__ ! 582: toid_t bufcall __PROTO ((unsigned int _size, int _pri, ...)); ! 583: int canput __PROTO ((queue_t * _q)); ! 584: int canputnext __PROTO ((queue_t * _q)); ! 585: mblk_t * copyb __PROTO ((mblk_t * _bp)); ! 586: mblk_t * copymsg __PROTO ((mblk_t * _mp)); ! 587: int datamsg __PROTO ((unsigned char _type)); ! 588: mblk_t * dupb __PROTO ((mblk_t * _bp)); ! 589: mblk_t * dupmsg __PROTO ((mblk_t * _mp)); ! 590: void enableok __PROTO ((queue_t * _q)); ! 591: mblk_t * esballoc __PROTO ((unsigned char * _base, int _size, ! 592: int _pri, frtn_t * _fr_rtn)); ! 593: /* The following assumes __STDARG_BUFCALL__ as above */ ! 594: toid_t esbbcall __PROTO ((int _pri, ...)); ! 595: void flushband __PROTO ((queue_t * _q, unsigned char _pri, ! 596: int _flag)); ! 597: void flushq __PROTO ((queue_t * _q, int _flag)); ! 598: pl_t freezestr __PROTO ((queue_t * _q)); ! 599: void freeb __PROTO ((mblk_t * _bp)); ! 600: void freemsg __PROTO ((mblk_t * _mp)); ! 601: int (* getadmin __PROTO ((unsigned short _mid))) ! 602: __PROTO ((void)); ! 603: unsigned short getmid __PROTO ((char * _name)); ! 604: mblk_t * getq __PROTO ((queue_t * _q)); ! 605: int insq __PROTO ((queue_t * _q, mblk_t * _emp, ! 606: mblk_t * _nmp)); ! 607: void linkb __PROTO ((mblk_t * _mp, mblk_t * _bp)); ! 608: int msgdsize __PROTO ((mblk_t * _mp)); ! 609: mblk_t * msgpullup __PROTO ((mblk_t * _mp, int _len)); ! 610: void noenable __PROTO ((queue_t * _q)); ! 611: queue_t * OTHERQ __PROTO ((queue_t * _q)); ! 612: int pcmsg __PROTO ((uchar_t _type)); ! 613: int pullupmsg __PROTO ((mblk_t * _mp, int _len)); ! 614: void put __PROTO ((queue_t * _q, mblk_t * _mp)); ! 615: int putbq __PROTO ((queue_t * _q, mblk_t * _mp)); ! 616: int putctl __PROTO ((queue_t * _q, int _type)); ! 617: int putctl1 __PROTO ((queue_t * _q, int _type, ! 618: int _param)); ! 619: int putnext __PROTO ((queue_t * _q, mblk_t * _mp)); ! 620: int putnextctl __PROTO ((queue_t * _q, int _type)); ! 621: int putnextctl1 __PROTO ((queue_t * _q, int _type, ! 622: int _param)); ! 623: int putq __PROTO ((queue_t * _q, mblk_t * _mp)); ! 624: void qenable __PROTO ((queue_t * _q)); ! 625: void qprocsoff __PROTO ((queue_t * _rq)); ! 626: void qprocson __PROTO ((queue_t * _rq)); ! 627: void qreply __PROTO ((queue_t * _q, mblk_t * _mp)); ! 628: int qsize __PROTO ((queue_t * _q)); ! 629: queue_t * RD __PROTO ((queue_t * _q)); ! 630: mblk_t * rmvb __PROTO ((mblk_t * _mp, mblk_t * _bp)); ! 631: void rmvq __PROTO ((queue_t * _q, mblk_t * _mp)); ! 632: int strlog __PROTO ((short _mid, short _sid, char _level, ! 633: unsigned short _flags, char * _fmt, ! 634: ...)); ! 635: int strqget __PROTO ((queue_t * _q, qfields_t _what, ! 636: unsigned char _pri, long * _valp)); ! 637: int strqset __PROTO ((queue_t * _q, qfields_t _what, ! 638: unsigned char _pri, long _val)); ! 639: int testb __PROTO ((int _size, int _pri)); ! 640: void unbufcall __PROTO ((toid_t _id)); ! 641: void unfreezestr __PROTO ((queue_t * _q, pl_t _pl)); ! 642: mblk_t * unlinkb __PROTO ((mblk_t * _mp)); ! 643: queue_t * WR __PROTO ((queue_t * _q)); ! 644: ! 645: __EXTERN_C_END__ ! 646: ! 647: ! 648: /* ! 649: * Possible values for the stream open flag "sflag" in a module or driver ! 650: * open (0 implies a normal driver open) ! 651: */ ! 652: ! 653: enum { ! 654: MODOPEN = 1, /* normal module open */ ! 655: CLONEOPEN /* clone device open */ ! 656: }; ! 657: ! 658: ! 659: /* ! 660: * Special value for the two-byte form of the M_ERROR message. ! 661: */ ! 662: ! 663: enum { ! 664: NOERROR = 0xFF ! 665: }; ! 666: ! 667: ! 668: /* ! 669: * Functions that are normally implemented as macros (although the function ! 670: * versions which are prototyped above are available by including the ! 671: * <sys/ddi.h> header. ! 672: */ ! 673: /* ! 674: * NB: Borland C++ 3.1 in 'C' mode insists that if a pointer is derived from ! 675: * a ternary where the arms are calculated from lvalues then dereferencing ! 676: * that pointer does not yield a valid lvalue, e.g. ! 677: * WR (q)->q_ptr = NULL; ! 678: * it thinks is invalid, which is untrue. To fix this, the pointer value from ! 679: * the ternary seems to need massaging to turn it into a proper rvalue... the ! 680: * easiest way to do this is add 0 to the *result* of the ternary. This is ! 681: * optimized away by basic constant-folding in even simple compilers. ! 682: */ ! 683: ! 684: #define __HACK(exp) ((exp) + 0) ! 685: ! 686: #define datamsg(type) ((unsigned char) ((type) & (M_PRI - 1)) <= M_DELAY) ! 687: /* There is no multiprocessor macro implementation of enableok () */ ! 688: /* There is no multiprocessor macro implementation of noenable () */ ! 689: #define OTHERQ(q) __HACK (((q)->q_flag & QREADR) != 0 ? (q) + 1 : (q) - 1) ! 690: #define pcmsg(type) ((type) >= QPCTL) ! 691: #define RD(q) __HACK (((q)->q_flag & QREADR) != 0 ? (q) : (q) - 1) ! 692: #define WR(q) __HACK (((q)->q_flag & QREADR) != 0 ? (q) + 1 : (q)) ! 693: ! 694: #endif /* ! defined (__SYS_STREAM_H__) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.