home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / events.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  25.6 KB  |  846 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_EVENTS_H
  11. #define _SYS_EVENTS_H
  12.  
  13. #ident    "@(#)/usr/include/sys/events.h.sl 1.1 4.0 12/08/90 4937 AT&T-USL"
  14. /*            File Contents
  15. **            =============
  16. **
  17. **    This file contains data which must be included in an 
  18. **    application program using the events facility.
  19. */
  20.  
  21.  
  22. /*            Required Header Files
  23. **            =====================
  24. **
  25. **    The following header files must be includes before including
  26. **    this file.
  27. **
  28. **        REQUIRES    sys/types.h
  29. **        REQUIRES    sys/signal.h
  30. **        REQUIRES    sys/evecb.h
  31. **        REQUIRES    sys/hrtcntl.h
  32. **        REQUIRES    sys/priocntl.h
  33. **        REQUIRES    sys/procset.h
  34. */
  35.  
  36. /*            The Events VFS Version Number
  37. **            =============================
  38. **
  39. **    In order to be able to make changes to the events VFS in the
  40. **    future, we define a version number which is automatically passed
  41. **    through from the application program to the libraries and then
  42. **    to the kernel.  If we want to change the events interface, we
  43. **    just increase the version number so the events library routines
  44. **    and the kernel can tell the difference.  This works with either
  45. **    private or shared libraries.
  46. **    The current version number is as follows.
  47. */
  48.  
  49. typedef ulong    evver_t;    /* Type for the version nbr.    */
  50.  
  51. #define    EV_VERSION    2    /* The current version number.    */
  52.  
  53. /*    The following are previously used version numbers which are
  54. **    still supported.
  55. */
  56.  
  57. /*    None yet.
  58. */
  59.  
  60. /*    The following are previously used version numbers which are no
  61. **    longer supported.
  62. */
  63.  
  64. #define    EV_VER_PROTO1    1    /* Version number used in the    */
  65.                 /* first prototype of events.    */
  66.  
  67. /*            The Events Function Interfaces
  68. **            ==============================
  69. **
  70. **    When a user program calls one of the functions described on one
  71. **    of the events manual pages, it is actually invoking one of the
  72. **    following macros.  The purpose of the macros is to pass the
  73. **    version number to the library routines.  The library routines
  74. **    will, in turn, pass the version number down to the kernel.  This
  75. **    will allow us to make changes to the events VFS in the future 
  76. **    and still support old *.o and a.out files.
  77. **
  78. **    Thanks to Jeff Smits for the idea of using macros here.
  79. */
  80.  
  81. #define    evpost(elp, els, flags)    \
  82.     __evpost(EV_VERSION, elp, els, flags)
  83.  
  84. #define    evpoll(cmd, elp, els, top) \
  85.     __evpoll(EV_VERSION, cmd, elp, els, top)
  86.  
  87. #define    evpollmore(elp, els) \
  88.     __evpollmore(EV_VERSION, elp, els)
  89.  
  90. #define    evtrap(cmd, elp, els, tid, handlerp, tap) \
  91.     __evtrap(EV_VERSION, cmd, elp, els, tid, handlerp, tap)
  92.  
  93. #define    evtrapcancel(tidp, tids) \
  94.     __evtrapcancel(EV_VERSION, tidp, tids)
  95.     
  96. #define    evcntl(cmd, arg1, arg2) \
  97.     __evcntl(EV_VERSION, cmd, arg1, arg2)
  98.  
  99. #define    evqcntl(eqd, cmd, arg) \
  100.     __evqcntl(EV_VERSION, eqd, cmd, arg)
  101.  
  102. #define    evexit(idtype, id, ecbp) \
  103.     __evexit(EV_VERSION, idtype, id, ecbp)
  104.  
  105. #define    evexitset(psp, hostid, ecbp) \
  106.     __evexitset(EV_VERSION, psp, hostid, ecbp)
  107.  
  108. #define    evsig(sigsetp, ecbp, silp, sils) \
  109.     __evsig(EV_VERSION, sigsetp, ecbp, silp, sils)
  110.  
  111. /*            Miscellaneous Definitions
  112. **            =========================
  113. **
  114. **    In our implementation, an event queue identifier is just
  115. **    a file descriptor since we implement events as a VFS.
  116. **    The following value is intended to represent the absence
  117. **    of an event queue.  Therefore, it must have a value that
  118. **    could not be an event queue identifier; i.e., for us, a
  119. **    file descriptor.  We don't want to use a negative value
  120. **    since a negative return value usually indicates an error.
  121. **    Only -1 should really be used to indicate an error but,
  122. **    by convention, many programmers test for "rtrn < 0".
  123. **    Therefore, the following is the largest positive value
  124. **    which we can fit into an short.  Change it if necessary
  125. **    when porting to another system.
  126. */
  127.  
  128. #define    EQ_NOQUEUE    0x7fff    /* No event queue.    */
  129.  
  130.  
  131. /*    The following symbol is used to represent the set of all trap
  132. **    identifiers.  It is used in place of a pointer to a list of
  133. **    trap identifiers so its value must be distinguishable from a
  134. **    pointer.  It cannot be zero either since zero is used to
  135. **    indicate that no trap identifiers are being specified.  Change
  136. **    it if necessary when porting.
  137. */
  138.  
  139. #define    TR_ALL    ((long *)-1)        /* All trap identifiers.*/
  140.  
  141. /*            The evtypes_t Enumeration
  142. **            =========================
  143. **
  144. **    The following are the event types.  These are the values
  145. **    for the ev_type field of the event_t structure.
  146. */
  147.  
  148. typedef enum evtypes {
  149.  
  150.         ET_POST,    /* A user event created with    */
  151.                 /* the evpost function call.    */
  152.         ET_ASYNC,    /* Return from an asynchronous    */
  153.                 /* system call such as asyncio.    */
  154.         ET_TIMER,    /* Expiration of a timer set by */
  155.                 /* the hrtalarm function call.    */
  156.         ET_SIG,        /* An event indicating the fact */
  157.                 /* that a signal was sent to a    */
  158.                 /* process.  Posted due to an    */
  159.                 /* evsig function call.        */
  160.         ET_STREAM,    /* A change of state of a    */
  161.                 /* stream head.  Posted due to    */
  162.                 /* an I_SETEV type streams    */
  163.                 /* ioctl.            */
  164.         ET_DRIVER,    /* The event was posted by a    */
  165.                 /* device driver or streams    */
  166.                 /* module.            */
  167.         ET_EXIT        /* A message created on process */
  168.                 /* exit due to a previous call    */
  169.                 /* of evexit.            */
  170. } evtypes_t;
  171.  
  172. /*            The event_t Structure
  173. **            =====================
  174. **
  175. **    The following structure describes an event at user
  176. **    level.  It is the parameter passed on many of the
  177. **    events function calls.
  178. */
  179.  
  180.  
  181. typedef struct event {
  182.     int        ev_eqd;        /* The event queue    */
  183.                     /* descriptor.  For us,    */
  184.                     /* a file descriptor.    */
  185.     long        ev_flags;    /* Flags defined below.    */
  186.     long        ev_eid;        /* The event identifier.*/
  187.     long        ev_eidlim;    /* High limit of event    */
  188.                     /* identifiers for    */
  189.                     /* range type match    */
  190.                     /* (EF_EIDRNG set).    */
  191.     long        ev_pri;        /* The event's priority.*/
  192.     hostid_t    ev_hostid;    /* The hostid of the    */
  193.                     /* system on which the    */
  194.                     /* process ev_pid was    */
  195.                     /* running when it     */
  196.                     /* requested that the    */
  197.                     /* event be posted.    */
  198.     int        ev_pfd;        /* A file descriptor    */
  199.                     /* being passed with    */
  200.                     /* the event (only if    */
  201.                     /* EF_PFD is set).    */
  202.     evtypes_t    ev_type;    /* The event type as    */
  203.                     /* defined above.    */
  204.     pid_t        ev_pid;        /* The process id of    */
  205.                     /* the poster of the    */
  206.                     /* event.        */
  207.     uid_t        ev_uid;        /* The effective user    */
  208.                     /* id of the poster of    */
  209.                     /* the event.        */
  210.     int        ev_error;    /* An error code.    */
  211.                     /* Values are defined    */
  212.                     /* in sys/errno.h.    */
  213.                     /* This field has a    */
  214.                     /* value only if     */
  215.                     /* EF_ERROR is set in    */
  216.                     /* the ev_flags field.    */
  217.     hrtime_t    ev_time;    /* The time that the    */
  218.                     /* event was posted.    */
  219.     size_t        ev_datamax;    /* Size of buffer for    */
  220.                     /* event type dependent    */
  221.                     /* data (in bytes).    */
  222.     size_t        ev_datasize;    /* Actual nbr of bytes    */
  223.                     /* of event type    */
  224.                     /* dependent data.    */
  225.     char        *ev_data;    /* Ptr to the dependent    */
  226.                     /* data.        */
  227. } event_t;
  228.  
  229. /*            The event_t Structure (Continued)
  230. **            =================================
  231. **
  232. **    The following is a list of flags that can be set in the
  233. **    ev_flags field of the event_t structure.  They are divided
  234. **    into various categories which are described following the
  235. **    list.
  236. */
  237.  
  238. #define    EF_PRI        0x0001    /* Return the highest priority    */
  239.                 /* event on the queue.        */
  240.                 /* Otherwise, return the first    */
  241.                 /* (FIFO order) event.        */
  242. #define    EF_TYPE        0x0002    /* The ev_type field must match    */
  243.                 /* on an evpoll or evtrap.    */
  244. #define    EF_EID        0x0004    /* The ev_eid field must match    */
  245.                 /* on an evpoll or evtrap.    */
  246. #define    EF_EIDRNG    0x0008    /* The eid must be greater than    */
  247.                 /* or equal to ev_eid and less    */
  248.                 /* than or equal to ev_eidlim     */
  249.                 /* on an ev_poll or ev_trap.    */
  250. #define    EF_SHM        0x0010    /* Event dependent data is to    */
  251.                 /* be transferred in shared    */
  252.                 /* memory.  Otherwise, copy    */
  253.                 /* into and out of the kernel.    */
  254. #define    EF_DISCARD    0x0020    /* Receive event in discard    */
  255.                 /* mode.  Throw away data which    */
  256.                 /* won't fit in the buffer.    */
  257.                 /* Otherwise, save it for a    */
  258.                 /* possible evpollmore.        */
  259. #define    EF_QUICKD    0x0040    /* Data may be or has been sent    */
  260.                 /* or returned in the ev_data    */
  261.                 /* field of the event rather    */
  262.                 /* than in a buffer.        */
  263. #define    EF_PFD        0x0080    /* Flag set if a file         */
  264.                 /* descriptor is being passed    */
  265.                 /* in the ev_pfd field.        */
  266. #define    EF_TIME        0x0100    /* The ev_time field should be    */
  267.                 /* supplied in the returned    */
  268.                 /* event.  The ev_time.hrt_res    */
  269.                 /* field has been set by the    */
  270.                 /* caller.            */
  271. #define    EF_DONE        0x0200    /* The event has occurred.      */
  272.                 /* Otherwise, it is being    */
  273.                 /* waited for.            */
  274. #define    EF_MORE        0x0400    /* There is more dependent data    */
  275.                 /* with this event than buffer    */
  276.                 /* space allocated.        */
  277. #define    EF_CANCEL    0x0800    /* Indicates that the event was */
  278.                 /* posted as a result of    */
  279.                 /* something being cancelled    */
  280.                 /* rather than completing.    */
  281. #define    EF_ERROR    0x1000    /* Indicates that an error has    */
  282.                 /* occurred.            */
  283.  
  284. /*            The event_t Structure (Continued)
  285. **            =================================
  286. **
  287. **    The above flags are divided into the following categories.
  288. **
  289. **        EV_FLAGS_USER    Set by the user and interrogated by
  290. **                the system.
  291. **        EV_FLAGS_SYS    Set by the system and interrogated by
  292. **                the user.
  293. **        EV_FLAGS_POST    Subset of EV_FLAGS_USR that are valid
  294. **                on an evpost function.  The other flags
  295. **                (in EV_FLAGS_USR but not in
  296. **                EV_FLAGS_POST) are valid only with
  297. **                evpoll and evtrap.
  298. **        EV_FLAGS_MORE    Subset of EV_FLAGS_USR.  The setting of
  299. **                these flags on an evpollmore must
  300. **                match their setting on the original
  301. **                evpoll or evtrap.
  302. */
  303.  
  304. #define    EV_FLAGS_USER    (EF_PRI | EF_TYPE | EF_EID | EF_EIDRNG | \
  305.              EF_SHM | EF_DISCARD | EF_QUICKD | \
  306.              EF_PFD | EF_TIME)
  307. #define    EV_FLAGS_SYS    (EF_DONE | EF_MORE  | EF_CANCEL | EF_ERROR)
  308. #define    EV_FLAGS_POST    (EF_SHM | EF_QUICKD | EF_PFD)
  309. #define    EV_FLAGS_MORE    (EF_PRI | EF_TYPE | EF_EID | EF_EIDRNG)
  310.  
  311.  
  312. /*    The following symbol defines the maximum number of bytes of data
  313. **    which can be passed in EF_QUICKD mode.  It must be equal to the
  314. **    size of the ev_data field in the event_t structure defined
  315. **    above.
  316. */
  317.  
  318. #define    EV_MAXQD    sizeof(char *)
  319.  
  320. /*            Data for the evpost Function
  321. **            ============================
  322. **
  323. **    The following are the possible flags which can be passed as
  324. **    an argument to evpost.
  325. */
  326.  
  327. #define    EPF_NONBLOCK    0x0001    /* Don't wait if events can't    */
  328.                 /* be posted immediately.    */
  329.  
  330. /*            Data for the evpoll and evtrap Functions
  331. **            ========================================
  332. **
  333. **    The following are the possible commands for the evpoll and 
  334. **    evtrap functions.
  335. */
  336.  
  337. typedef enum evpollcmds {
  338.  
  339.     EC_ONE,        /* Return one event.            */
  340.     EC_ANY,        /* Return any which are done, but at    */
  341.             /* least one.                */
  342.     EC_ALL        /* Return only if all are done.        */
  343. } evpollcmds_t;
  344.  
  345. /*    The following is the structure of the optional "tap" (trap
  346. **    argument pointer) argument to evtrap.
  347. */
  348.  
  349. typedef struct evta {
  350.     pcparms_t    *eta_prip;    /* Ptr to the scheduler    */
  351.                     /* priority at which     */
  352.                     /* this trap handler is    */
  353.                     /* to run or NULL if no    */
  354.                     /* change in priority     */
  355.                     /* is requested.    */
  356.     long        *eta_hlp;    /* Ptr to a list of     */
  357.                     /* tid's to hold when    */
  358.                     /* this handler is     */
  359.                     /* called or TR_ALL or    */
  360.                     /* NULL to hold only    */
  361.                     /* the tid being     */
  362.                     /* handled.        */
  363.     size_t        eta_hls;    /* Nbr of elements in    */
  364.                     /* the hold array    */
  365.                     /* eta_hlp.        */
  366.     uint        eta_flags;    /* Various flags as    */
  367.                     /* defined below.    */
  368. } evta_t;
  369.  
  370. /*    The flags in eta_flags are as follows.
  371. */
  372.  
  373. #define    ETAF_RESTART    0x0001    /* Set if restartable system    */
  374.                 /* calls are to be restarted    */
  375.                 /* after calling the trap    */
  376.                 /* handler for this trap id.    */
  377. #define    ETAF_ALTSTACK    0x0002    /* Set if this trap handler is    */
  378.                 /* to be called on an alternate    */
  379.                 /* stack.            */
  380.  
  381. /*            Data for the evtrap Handler Function
  382. **            ====================================
  383. **
  384. **    The following is the type of the context argument which is
  385. **    passed to a user trap handler.  Since a user program is not
  386. **    suppossed to reference the contents of this struture, it is
  387. **    defined in terms of another structure which is defined in
  388. **    evsys.h
  389. */
  390.  
  391. typedef struct evcntxt    evcontext_t;
  392.  
  393. /*            Data for the evcntl Commands
  394. **            ============================
  395. **
  396. **    The following are the commands for the evcntl function.
  397. */
  398.  
  399. typedef enum evcntlcmds {
  400.     EC_TRAPHOLD,    /* Add to the current set of held trap    */
  401.             /* identifiers.                */
  402.     EC_TRAPSET,    /* Redefine the contents of the current    */
  403.             /* set of held trap identifiers.    */
  404.     EC_TRAPRELSE,    /* Delete from the current set of held    */
  405.             /* trap identifiers.            */
  406.     EC_TRAPPAUSE,    /* An EC_TRAPRELSE followed by a     */
  407.             /* pause() but done as one atomic op.    */
  408.     EC_TRAPRET,    /* Return from one or more trap     */
  409.             /* handlers to a user specfied context.    */
  410.     EC_TRAPEND,    /* Process has exited all trap handlers.*/
  411.     EC_ALTSTACK,    /* Specify use of an alternate stack     */
  412.             /* when calling a trap handler.        */
  413.     EC_GETPRINFO,    /* Get the per-process event        */
  414.             /* information.                */
  415.     EC_SETPRINFO,    /* Set the per-process event        */
  416.             /* information.                */
  417.     EC_GETCFGINFO,    /* Get the events VFS configuration    */
  418.             /* information.                */
  419.     EC_GETMEMINFO    /* Get the events VFS memory usage    */
  420.             /* information.                */
  421. } evcntlcmds_t;
  422.  
  423. /*        Data for the evqcntl Commands
  424. **        =============================
  425. **
  426. **    The following are the commands for the evqcntl
  427. **    function.
  428. */
  429.  
  430. typedef enum evqcntlcmds {
  431.     EC_GETCM,    /* Get the current close mode of the    */
  432.             /* queue.                */
  433.     EC_SETCM,    /* Set close mode for the queue.    */
  434.     EC_GETQINFO,    /* Get the current values of the queue    */
  435.             /* parameters.                */
  436.     EC_SETQINFO    /* Set the settable queue parameters.    */
  437. } evqcntlcmds_t;
  438.  
  439. /*
  440. **    The following are the different close modes which can be
  441. **    set for a queue using the EC_SETCM command of the evqcntl
  442. **    function.
  443. */
  444.  
  445. typedef enum evcm {
  446.     ECM_DELALL,    /* Delete all events on the queue when    */
  447.             /* the last close of the queue occurs.    */
  448.     ECM_DELNONE,    /* Leave all events on the queue when    */
  449.             /* the last close of the queue occurs.    */
  450.     ECM_DELSYS,    /* Delete all events posted by the     */
  451.             /* system (ev_type != ET_POST) when the    */
  452.             /* last close of the queue occurs.    */
  453.     ECM_DELUSER    /* Delete only those events with type    */
  454.             /* equal to ET_POST when the last close    */
  455.             /* of the queue occurs.            */
  456. } evcm_t;
  457.  
  458. /*            The evcntl evaltstk_t Structure
  459. **            ===============================
  460. **
  461. **    The following is the evaltstk_t structure.  It is used with
  462. **    the evcntl command EC_ALTSTACK.
  463. */
  464.  
  465. typedef struct evaltstk {
  466.     caddr_t        etas_stkp;    /* Ptr to the start of    */
  467.                     /* the stack.        */
  468.     ulong        etas_stks;    /* Size of the stack in    */
  469.                     /* bytes.        */
  470.     uint        etas_flags;    /* The flags defined    */
  471.                     /* below.        */
  472. } evaltstk_t;
  473.  
  474.  
  475. /*    The flags for the etas_flags field are as follows.
  476. */
  477.  
  478. #define    EASF_DISABLE    0x0001    /* The use of an alternate    */
  479.                 /* stack is or should be    */
  480.                 /* disabled.  Can be set by the    */
  481.                 /* user or the kernel.        */
  482. #define    EASF_ONSTACK    0x0002    /* The process is currently    */
  483.                 /* running on the alternate    */
  484.                 /* stack.  Set only by the     */
  485.                 /* kernel to return to the user    */
  486.  
  487. /*    The following values are just ballpark figures.  The first one
  488. **    should really involve sizeof(pcb_t) and sizeof(evcntxt_t) but
  489. **    we don't want these definitions to have to be known to all
  490. **    programs which include this header file.
  491. */
  492.  
  493. #define    ETAS_MINSIZE     256    /* Minimum size for alternate    */
  494.                 /* stack.            */
  495. #define    ETAS_SIZE    2048    /* Recommended size for     */
  496.                 /* alternate stack.        */
  497.  
  498. /*            The evcntl evprinfo_t Structure
  499. **            ===============================
  500. **
  501. **    The following is the evprinfo_t structure.  It is used with the
  502. **    evcntl commands EC_SETPRINFO and EC_SETPRINFO.
  503. */
  504.  
  505. typedef struct evprinfo {
  506.     ushort    evpi_maxtraps;    /* Maximum number of trap    */
  507.                 /* expressions allowed for this    */
  508.                 /* process.  The default is     */
  509.                 /* evci_maxtraps in the        */
  510.                 /* evcinfo_t structure.        */
  511.     ushort    evpi_maxeterms;    /* Maximum number of terms    */
  512.                 /* allowed in an expression.    */
  513.                 /* The default value is        */
  514.                 /* evci_maxeterms in the    */
  515.                 /* evcinfo_t structure.        */
  516. } evprinfo_t;
  517.  
  518. /*            The evcntl evcinfo_t Structure
  519. **            ==============================
  520. **
  521. **    The following is the evcinfo_t structure.  It is used with the
  522. **    evcntl command EC_GETCFGINFO.
  523. */
  524.  
  525. typedef struct evcinfo {
  526.  
  527.     /*    The following are global limits on data allocation for
  528.     **    the entire events VFS.
  529.     */
  530.  
  531.     ushort    evci_mevqueues;        /* Max nbr of event    */
  532.                     /* queue structures    */
  533.                     /* (evqueue_t) to     */
  534.                     /* allocate.        */
  535.     ushort    evci_mevkevs;        /* Max nbr of kernel    */
  536.                     /* event structures    */
  537.                     /* (evkev_t) to     */
  538.                     /* allocate.        */
  539.     ushort    evci_mevexrefs;        /* Max nbr of event    */
  540.                     /* expression reference    */
  541.                     /* structures        */
  542.                     /* (evexref_t) to     */
  543.                     /* allocate.        */
  544.     ushort    evci_mevexprs;        /* Max nbr of event    */
  545.                     /* expression         */
  546.                     /* structures (evexpr_t)*/
  547.                     /* to allocate.        */
  548.     ushort    evci_mevterms;        /* Max nbr of event    */
  549.                     /* term structures    */
  550.                     /* (evterm_t) to    */
  551.                     /* allocate.        */
  552.     ushort    evci_mevsexprs;        /* Max nbr of event    */
  553.                     /* satisfied expression    */
  554.                     /* structures        */
  555.                     /* (evsexpr_t) to    */
  556.                     /* allocate.        */
  557.     ushort    evci_mevsterms;        /* Max nbr of event    */
  558.                     /* satisfied term    */
  559.                     /* structures        */
  560.                     /* (evsterm_t) to    */
  561.                     /* allocate.        */
  562.     ushort    evci_mevtids;        /* Max nbr of trap    */
  563.                     /* identifier structures*/
  564.                     /* (evtid_t) to     */
  565.                     /* allocate.        */
  566.     ushort    evci_mevretrys;        /* Max nbr of retry    */
  567.                     /* structures        */
  568.                     /* (evretry_t) to    */
  569.                     /* allocate.        */
  570.     ushort    evci_mevexits;        /* Max nbr of event    */
  571.                     /* exit structures    */
  572.                     /* (evexit_t) to    */
  573.                     /* allocate.        */
  574.  
  575. /*            The evcntl evcinfo_t Structure (Continued)
  576. **            ==========================================
  577. */
  578.  
  579.     ushort    evci_mevsigs;        /* Max nbr of event    */
  580.                     /* signal structures    */
  581.                     /* (evsig_t) to        */
  582.                     /* allocate.        */
  583.     ushort    evci_mevstrds;        /* Max nbr of stream    */
  584.                     /* data structures    */
  585.                     /* (evd_stream_t) to    */
  586.                     /* allocate.        */
  587.     ushort    evci_mevdirents;    /* Max nbr of directory    */
  588.                     /* entries (dirent_t)    */
  589.                     /* to allocate.        */
  590.     ulong    evci_mevdata;        /* Max nbr of bytes to    */
  591.                     /* allocate for holding    */
  592.                     /* events type dependent*/
  593.                     /* data and other    */
  594.                     /* miscellaneous uses.    */
  595.     ushort    evci_tidhts;        /* Number of entries in    */
  596.                     /* the trap id hash    */
  597.                     /* table.  Must be a    */
  598.                     /* power of 2.        */
  599.     ushort    evci_fnhts;        /* Number of entries in    */
  600.                     /* the file name hash    */
  601.                     /* table.  Must be a     */
  602.                     /* power of 2.        */
  603.  
  604. /*            The evcntl evcinfo_t Structure (Continued)
  605. **            ==========================================
  606. */
  607.  
  608.     /*    The following are default per-queue limits which can
  609.     **    be modified with evqcntl.
  610.     */
  611.  
  612.     ushort    evci_maxev;        /* Default max nbr of    */
  613.                     /* events allowed on a    */
  614.                     /* queue.        */
  615.     ulong    evci_maxdpe;        /* Default max nbr of    */
  616.                     /* bytes of data allowed*/
  617.                     /* per event.        */
  618.     ulong    evci_maxmem;        /* Default max total    */
  619.                     /* nbr of bytes of data    */
  620.                     /* allowed in memory    */
  621.                     /* for all events on an    */
  622.                     /* event queue.        */
  623.  
  624.     /*    The following are default per-process limits which can
  625.     **    be modified with evcntl.
  626.     */
  627.  
  628.     ushort    evci_maxtraps;        /* Default max nbr of    */
  629.                     /* trap expressions    */
  630.                     /* allowed for a    */
  631.                     /* process.        */
  632.     ushort    evci_maxeterms;        /* Default max nbr of    */
  633.                     /* terms allowed in an    */
  634.                     /* expression.        */
  635. } evcinfo_t;
  636.  
  637. /*            The evqcntl evinfo_t Structure
  638. **            ==============================
  639. **
  640. **    The following is the events information structure.  It is used
  641. **    in conjunction with the evqinfo_t structure below to get
  642. **    information about individual events on the queue being checked
  643. **    with the evqcntl command EC_GETQINFO.
  644. */
  645.  
  646. typedef struct evinfo {
  647.     long        evi_flags;    /* Same as ev_flags.    */
  648.     long        evi_eid;    /* Same as ev_eid.    */
  649.     long        evi_pri;    /* Same as ev_pri.    */
  650.     hostid_t    evi_hostid;    /* Same as ev_hostid.    */
  651.     int        evi_pfd;    /* Same as ev_pfd.    */
  652.     evtypes_t    evi_type;    /* Same as ev_type.    */
  653.     pid_t        evi_pid;    /* Same as ev_pid.    */
  654.     uid_t        evi_uid;    /* Same as ev_uid.    */
  655.     hrtime_t    evi_time;    /* Same as ev_time.    */
  656.     size_t        evi_datasize;    /* Same as ev_datasize.    */
  657. } evinfo_t;
  658.  
  659. /*            The evqcntl evqinfo_t Structure
  660. **            ===============================
  661. **
  662. **    The following is the evqinfo_t structure.  It is used with the
  663. **    evqcntl commands EC_SETQINFO and EC_GETQINFO.  Only the
  664. **    following fields are set from the user's structure for
  665. **    EC_SETQINFO.
  666. **
  667. **        evqi_closemd
  668. **        evqi_maxev    evqi_maxdpe    evqi_maxmem
  669. **
  670. **    The fields on the last line cannot be increased above their
  671. **    system default values (in evinfo) except by the super-user.
  672. */
  673.  
  674. /*            The evqcntl evqinfo_t Structure (Continued)
  675. **            ===========================================
  676. */
  677.  
  678. typedef struct evqinfo {
  679.     ulong        evqi_memsize;    /* Total nbr of bytes of*/
  680.                     /* data in private    */
  681.                     /* memory used by all    */
  682.                     /* the events on the    */
  683.                     /* queue.  Data in    */
  684.                     /* shared memory or the    */
  685.                     /* ev_data member of an    */
  686.                     /* event will not be    */
  687.                     /* counted in this    */
  688.                     /* value.        */
  689.     ulong        evqi_shmsize;    /* Total nbr of bytes    */
  690.                     /* of data in shared    */
  691.                     /* memory for all    */
  692.                     /* events on the queue.    */
  693.     evinfo_t    *evqi_evinfop;    /* Ptr to an array of    */
  694.                     /* evevinfo_t        */
  695.                     /* structures to return    */
  696.                     /* data about the    */
  697.                     /* events on the queue.    */
  698.     ushort        evqi_evinfos;    /* Nbr of elements in    */
  699.                     /* the evqi_evinfop    */
  700.                     /* array.        */
  701.     ushort        evqi_nevents;    /* Nbr of events on the */
  702.                     /* queue.        */
  703.     evcm_t        evqi_closemd;    /* The close mode.  The    */
  704.                     /* values are ECM_XXXX    */
  705.                     /* as defined above.    */
  706.     ushort        evqi_opencnt;    /* Number of opens (not */
  707.                     /* dup's) for the queue.*/
  708.     ulong        evqi_maxev;    /* Max nbr of events    */
  709.                     /* which can be on the    */
  710.                     /* queue.  Initialized    */
  711.                     /* from evci_maxev.    */
  712.     ulong        evqi_maxdpe;    /* Max data per event    */
  713.                     /* for this queue.    */
  714.                     /* Initialized from    */
  715.                     /* evci_maxdpe.        */
  716.     ulong        evqi_maxmem;    /* Max total memory for    */
  717.                     /* all events on the    */
  718.                     /* queue.  Initialized    */
  719.                     /* from evci_maxmem.    */
  720. } evqinfo_t;
  721.  
  722. /*            Data for the evexit Function
  723. **            ============================
  724. **
  725. **    The following structure describes the event dependent data
  726. **    returned for an ET_EXIT event.
  727. */
  728.  
  729. typedef struct evd_exit {
  730.     hostid_t    ee_hostid;    /* The host on which    */
  731.                     /* the process exited.    */
  732.     pid_t        ee_pid;        /* The process id of    */
  733.                     /* the exiting    process.*/
  734.     int        ee_status;    /* The exit status of    */
  735.                     /* the process.        */
  736. }evd_exit_t;
  737.  
  738.  
  739.  
  740.  
  741.  
  742. /*            Data for the evsig Function
  743. **            ===========================
  744. **
  745. **    The following are the flags which can be returned in the
  746. **    ev_data field of an ET_SIG event.  This event will always have
  747. **    the EF_QUICKD flag set and the ev_datasize equal to
  748. **    sizeof(char *).
  749. */
  750.  
  751. #define    ESF_USER    0x01    /* Signal generated from user    */
  752.                 /* level (system call) such as    */
  753.                 /* kill or sigsend.  Otherwise,    */
  754.                 /* was generated by the kernel.    */
  755. #define    ESF_INTR    0x02    /* Signal was generated from    */
  756.                 /* interrupt level.        */
  757.  
  758.  
  759. /*    The following structure is used with the evsig function
  760. **    to get back the previous signal event disposition.
  761. */
  762.  
  763. typedef struct evsiginfo {
  764.     sigset_t    evsi_sigset;    /* The set of signals    */
  765.                     /* whose disposition is    */
  766.                     /* described in this    */
  767.                     /* structure.        */
  768.     int        evsi_eqd;    /* The event queue    */
  769.                     /* descriptor to which    */
  770.                     /* a signal event is to    */
  771.                     /* be posted or the    */
  772.                     /* value EQ_NOQUEUE.    */
  773.     long        evsi_pri;    /* The priority of the    */
  774.                     /* event to be posted.    */
  775. } evsiginfo_t;
  776.  
  777.  
  778. /*    When an ET_STREAM event is posted, the ev_data field will point
  779. **    to a structure of the following format.
  780. */
  781.  
  782. typedef struct evd_stream {
  783.     int    es_mask;    /* The condition which has    */
  784.                 /* occurred.  Exactly one of     */
  785.                 /* the S_XXXX flags will be on    */
  786.                 /* in this word.        */
  787.     long    es_data;    /* If the bit on in es_mask is    */
  788.                 /* one of those for which a    */
  789.                 /* priority band applies, then    */
  790.                 /* this is the band for which a    */
  791.                 /* message has arrived.        */
  792.                 /* If es_mask is S_ERROR, then    */
  793.                 /* this is the error code.    */
  794.                 /* Otherwise, this field is not    */
  795.                 /* used.            */
  796. } evd_stream_t;
  797.  
  798. /*            Function Prototypes
  799. **            ===================
  800. **
  801. **    The following are prototypes for the library functions which
  802. **    users call (indirectly using the macros at the start of this
  803. **    file.)
  804. */
  805.  
  806. #if !defined(_KERNEL)
  807. #if defined(__STDC__)
  808.  
  809. int    __evpost(const evver_t, event_t *const, const int, const int);
  810. int    __evpoll(const evver_t, const evpollcmds_t, event_t *const,
  811.          const int, const hrtime_t *const);
  812. int    __evpollmore(const evver_t, event_t *const, const int);
  813. int    __evtrap(const evver_t, const evpollcmds_t, event_t *const,
  814.          const int, const long,
  815.          void (*const)(event_t *, int, long, evcontext_t *),
  816.          const evta_t *const);
  817. int    __evtrapcancel(const evver_t, long *const, const int);
  818. int    __evcntl(const evver_t, const evcntlcmds_t, const long,
  819.          const long);
  820. int    __evqcntl(const evver_t, const eqd, const evqcntlcmds_t,
  821.          const long);
  822. int    __evexit(const evver_t, const idtype_t, const id_t,
  823.          const ecb_t *const);
  824. int    __evexitset(const evver_t, const procset_t *const,
  825.             const hostid_t hostid, const ecb_t *const);
  826. int    __evsig(const evver_t, const sigset_t *const,
  827.         const ecb_t *const, evsiginfo_t *const, const int);
  828.  
  829. #else
  830.  
  831. int    __evpost();
  832. int    __evpoll();
  833. int    __evpollmore();
  834. int    __evtrap();
  835. int    __evtrapcancel();
  836. int    __evcntl();
  837. int    __evqcntl();
  838. int    __evexit();
  839. int    __evexitset();
  840. int    __evsig();
  841.  
  842. #endif    /* defined(__STDC__)    */
  843. #endif    /* !defined(_KERNEL)    */
  844.  
  845. #endif    /* _SYS_EVENTS_H */
  846.