Annotation of coherent/f/usr/include/sys/poll.h, revision 1.1.1.1

1.1       root        1: #ifndef        __SYS_POLL_H__
                      2: #define        __SYS_POLL_H__
                      3: 
                      4: /*
                      5:  * This header defines prototypes for functions that manipulate the structures
                      6:  * used to support device polling in the kernel. definitions from this file
                      7:  * are imported by <poll.h>
                      8:  */
                      9: /*
                     10:  *-IMPORTS:
                     11:  *     <common/ccompat.h>
                     12:  *             __EXTERN_C_BEGIN__
                     13:  *             __EXTERN_C_END__
                     14:  *             __PROTO ()
                     15:  */
                     16: 
                     17: #if    _DDI_DKI
                     18: 
                     19: #include <common/feature.h>
                     20: #include <common/ccompat.h>
                     21: 
                     22: 
                     23: /*
                     24:  * The contents of the "pollhead" structure used in System V polling are not
                     25:  * specified here, or indeed anywhere else outside of the file which
                     26:  * implements the routines whose prototypes are given below.
                     27:  *
                     28:  * The "pollhead" structure is intended to be totally opaque. Instances must
                     29:  * be allocated and freed with the functions given, and no access to the
                     30:  * internal structure of this item is permissible.
                     31:  *
                     32:  * It is worthwhile for implementations to note several facts about System V
                     33:  * polling, however; consider the extra difficulties involved in preventing
                     34:  * race conditions in polling when the system is multithreaded. The chpoll ()
                     35:  * entry point is required to never sleep, or call a function such that it
                     36:  * might sleep (which means that calling "phalloc (KM_SLEEP)" is not permitted
                     37:  * in that context), implying that an implementation may hold a basic lock to
                     38:  * limit race conditions. Essentially, implementations should spend as little
                     39:  * time as possible in the chpoll () entry point.
                     40:  */
                     41: 
                     42: __EXTERN_C_BEGIN__
                     43: 
                     44: struct pollhead        * phalloc       __PROTO ((int _flag));
                     45: void           phfree          __PROTO ((struct pollhead * _php));
                     46: void           pollwakeup      __PROTO ((struct pollhead * _php,
                     47:                                          short _event));
                     48: 
                     49: __EXTERN_C_END__
                     50: 
                     51: #endif /* _DDI_DKI */
                     52: 
                     53: #if    _OLD_COH_POLLING || (__COHERENT__ && __KERNEL__)
                     54: 
                     55: #include <common/_poll.h>
                     56: 
                     57: 
                     58: /*
                     59:  * The following structure is defined by the implementation code in the
                     60:  * Coherent kernel, so we define it so that this header can replace that one.
                     61:  *
                     62:  * We keep the old structure name, and also preserve the name of one of the
                     63:  * structure members. That's about it, though. The *only* field that old-style
                     64:  * Coherent drivers were allowed documented access to is e_procp, and then
                     65:  * only as a test to see whether pollwake () needed to be called at all, which
                     66:  * was unnecessary.
                     67:  */
                     68: 
                     69: typedef struct event   event_t;
                     70: 
                     71: struct event {
                     72: #if    ! _OLD_COH_POLLING
                     73:        event_t       * e_pnext;
                     74:        event_t       * e_dnext;
                     75:        event_t       * e_dlast;
                     76:        struct proc   * e_procp;
                     77: #else
                     78:        poll_t          e_node;         /* for circular list management */
                     79:        __VOID__      * e_reserved;     /* unused, for binary compatibility */
                     80:        __VOID__      * e_procp;        /* drivers can test this for != 0 */
                     81: #endif
                     82: };
                     83: 
                     84: 
                     85: __EXTERN_C_BEGIN__
                     86: 
                     87: void   pollopen                __PROTO ((event_t * _elistp));
                     88: void   pollwake                __PROTO ((event_t * _elistp));
                     89: 
                     90: __EXTERN_C_END__
                     91: 
                     92: /*
                     93:  * Declare the existence of the 'event_t' hack to code that wants to work
                     94:  * either with or without it.
                     95:  */
                     96: 
                     97: #ifndef        _OLD_COH_POLLING
                     98: #define        _OLD_COH_POLLING        1
                     99: #endif
                    100: 
                    101: #endif /* _OLD_COH_POLLING || (__COHERENT__ && __KERNEL__) */
                    102: 
                    103: 
                    104: /*
                    105:  * Here we put an enumeration which defines the common elements of the event
                    106:  * masks used in <poll.h> for poll (), and <stropts.h> for the I_SETSIG
                    107:  * ioctl (). Mostly, the two masks match; the bits where they differ do not
                    108:  * conflict in key routines because the events they match in <stropts.h>
                    109:  * cannot be polled for.
                    110:  *
                    111:  * The exact numeric values used here can be found in the System V ABI.
                    112:  */
                    113: 
                    114: enum {
                    115:        __POLL_INPUT    = 0x0001,       /* any message other than M_PCPROTO */
                    116:        __POLL_HIPRI    = 0x0002,       /* a high priority message has arrived */
                    117:        __POLL_OUTPUT   = 0x0004,       /* the write queue is no longer full */
                    118:        __POLL_008      = 0x0008,       /* a SIGPOLL signal message has arrived */
                    119:                                        /* -or- fatal error on stream */
                    120:        __POLL_010      = 0x0010,       /* an M_ERROR message has arrived */
                    121:                                        /* -or- stream is hung up */
                    122:        __POLL_020      = 0x0020,       /* an M_HANGUP message has arrived */
                    123:                                        /* -or- file descriptor invalid */
                    124:        __POLL_RDNORM   = 0x0040,       /* a non-priority message has arrived */
                    125:        __POLL_WRNORM   = __POLL_OUTPUT,/* alias for S_OUTPUT */
                    126:        __POLL_RDBAND   = 0x0080,       /* a priority band message has arrived */
                    127:        __POLL_WRBAND   = 0x0100,       /* a priority band is writeable */
                    128:        __POLL_BANDURG  = 0x0200,       /* request SIGURG rather than SIGPOLL */
                    129:        __POLL_MASK     = 0x02FF        /* MASK FOR I_SETSIG */
                    130: };
                    131: 
                    132: enum {
                    133:        /*
                    134:         * Definitions for events that may be polled for.
                    135:         */
                    136: 
                    137:        POLLIN          = __POLL_INPUT, /* ready message, not M_PCPROTO */
                    138:        POLLPRI         = __POLL_HIPRI, /* ready message type M_PCPROTO */
                    139:        POLLOUT         = __POLL_OUTPUT,/* normal band is writeable */
                    140:        POLLRDNORM      = __POLL_RDNORM,/* normal message is ready */
                    141:        POLLWRNORM      = __POLL_OUTPUT,/* same as POLLOUT */
                    142:        POLLRDBAND      = __POLL_RDBAND,/* ready message in band > 0 */
                    143:        POLLWRBAND      = __POLL_WRBAND,/* band > 0 downstream is writeable */
                    144: 
                    145:        /*
                    146:         * Definitions for additional events that may not be polled for but which may
                    147:         * be returned anyway.
                    148:         */
                    149: 
                    150:        POLLERR         = __POLL_008,   /* fatal error on stream */
                    151:        POLLHUP         = __POLL_010,   /* stream is hung up */
                    152:        POLLNVAL        = __POLL_020    /* fd not associated with a stream */
                    153: 
                    154:        /* value 0x0200 is reserved for BANDURG flag in <stropts.h> */
                    155: };
                    156: 
                    157: #endif /* ! defined (__SYS_POLL_H__) */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.