home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.wizards:3861 comp.unix.programmer:4587 comp.unix.internals:1779
- Newsgroups: comp.unix.wizards,comp.unix.programmer,comp.unix.internals
- Path: sparky!uunet!ddssuprs!lpc
- From: lpc@dickens.com (Luis P Caamano)
- Subject: Re: Implementation of Sys V. based message queues
- Message-ID: <1992Sep9.151216.25028@dickens.com>
- Date: Wed, 9 Sep 1992 15:12:16 GMT
- References: <1992Sep3.232807.18181@noao.edu> <1992Sep8.171014.21414@dickens.com> <1992Sep8.202405.24405@noao.edu>
- Organization: Dickens Data Systems, Inc.
- Lines: 54
-
- In article <1992Sep8.202405.24405@noao.edu> rstevens@noao.edu (W. Richard Stevens) writes:
-
- [ some stuff deleted ]
-
- >
- >My bottom line is that it appears that I would have to take every
- >program using select that doesn't give a hoot about System V message
- >queues and recode the selects to conform to this new interface. Yuck.
- >(Maybe they have some #defined constant that brings in the BSD-style
- ^^^^^^^^
-
- In fact, you don't notice the change in select until you read the
- man page, and then you jump off your seat :-)
-
- No. You don't have to change the code and yes, /usr/include/sys/select.h
- contains some #define's to simplify the use of low/high bits separation but
- no special kludges to make it look BSD. (fd_set it's still there).
-
- ----excerpt from /usr/include/sys/select.h (AIX 3.2)-----
- #include <sys/time.h>
-
- extern int select(
- unsigned long nfdsmsgs, /* #file descriptors/message queues */
- void *readlist, /* file descriptors to check for read */
- void *writelist, /* file descriptors to check for write */
- void *exceptlist, /* file descriptors to check for exceptions */
- struct timeval *timeout); /* length of time to wait for events */
-
- ...
-
- typedef unsigned int fd_mask;
- #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
- #ifndef howmany
- #define howmany(x, y) (((x)+((y)-1))/(y))
- #endif
-
- typedef struct fd_set {
- fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
- } fd_set;
-
- #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
- #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
- #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
- #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
- ----------------------------------------
-
- --
- ---------------------------------------------------------------------------
- Luis P. Caamano | lpc@dickens.com
- Dickens Data Systems, Inc. | uunet!dickens.com!lpc
- Atlanta, GA | (404) 475-8860
- ---------------------------------------------------------------------------
- If I think I know it all, I'll stop learning. -myself
- The more I learn, the more I know I know nothing. -somebody else
-