From: Ben Gras Date: Fri, 17 Jun 2005 13:34:47 +0000 (+0000) Subject: Various select() support flags, prototypes, definitions. X-Git-Tag: v3.1.0~742 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=c40770ce68a056a4e325e495686cf066d28e9e92;p=minix.git Various select() support flags, prototypes, definitions. Major numbers for inet, tty, ctty. Defined _MINIX_VERSION to check for major minix version in applications. Prototype for (fake) readlink(). --- diff --git a/include/minix/com.h b/include/minix/com.h index 666610ead..aa0dbcae4 100755 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -66,7 +66,8 @@ # define KSIG_PENDING (NOTIFICATION | 2) /* signal(s) pending */ # define NEW_KMESS (NOTIFICATION | 3) /* new kernel message */ # define HARD_STOP (NOTIFICATION | 4) /* system shutdown */ -#define NR_NOTIFY_TYPES 5 /* nr of bits in mask */ +# define DEV_SELECTED (NOTIFICATION | 5) /* select() notification */ +#define NR_NOTIFY_TYPES 6 /* nr of bits in mask */ /* Shorthands for message parameters passed with notifications. */ #define NOTIFY_SOURCE m_source @@ -89,6 +90,7 @@ #define DEV_GATHER 9 /* fcn code for reading into a vector */ #define TTY_SETPGRP 10 /* fcn code for setpgroup */ #define TTY_EXIT 11 /* a process group leader has exited */ +#define DEV_SELECT 12 /* request select() attention */ #define SUSPEND -998 /* used in interrupts when tty has no data */ /* Field names for messages to block and character device drivers. */ @@ -99,6 +101,11 @@ #define POSITION m2_l1 /* file offset */ #define ADDRESS m2_p1 /* core buffer address */ +/* Field names for DEV_SELECT messages to device drivers. */ +#define DEVICE m2_i1 /* minor device */ +#define DEV_SEL_OPS m2_i2 /* which select operations are requested */ +#define DEV_SEL_WATCH m2_i3 /* request notify if no operations are ready */ + /* Field names used in reply messages from tasks. */ #define REP_PROC_NR m2_i1 /* # of proc on whose behalf I/O was done */ #define REP_STATUS m2_i2 /* bytes transferred or error number */ @@ -125,6 +132,11 @@ # define URANDOM_DEV RANDOM_DEV # define ZERO_DEV 6 /* minor device for /dev/zero */ +#define TTY_MAJOR 4 /* major device no. for ttys */ +#define CTTY_MAJOR 5 /* major device no. for /dev/tty */ + +#define INET_MAJOR 7 /* major device no. for inet */ + /* Full device numbers that are special to the boot monitor and FS. */ # define DEV_RAM 0x0100 /* device number of /dev/ram */ # define DEV_BOOT 0x0104 /* device number of /dev/boot */ @@ -367,6 +379,13 @@ #define PZ_MEM_PTR m1_p1 /* base */ #define PZ_COUNT m1_i1 /* count */ +/* Field names for SELECT (FS) */ +#define SEL_NFDS m8_i1 +#define SEL_READFDS m8_p1 +#define SEL_WRITEFDS m8_p2 +#define SEL_ERRORFDS m8_p3 +#define SEL_TIMEOUT m8_p4 + /*===========================================================================* * Miscellaneous messages, mainly used by IS * *===========================================================================*/ diff --git a/include/minix/config.h b/include/minix/config.h index 55c8bd94a..17a92d22b 100755 --- a/include/minix/config.h +++ b/include/minix/config.h @@ -5,6 +5,8 @@ #define OS_RELEASE "3" #define OS_VERSION "0.6" +#define _MINIX_VERSION 3 + /* This file sets configuration parameters for the MINIX kernel, FS, and PM. * It is divided up into two main sections. The first section contains * user-settable parameters. In the second section, various internal system diff --git a/include/sys/select.h b/include/sys/select.h index ba9b226d5..7e6feacb2 100755 --- a/include/sys/select.h +++ b/include/sys/select.h @@ -27,10 +27,17 @@ typedef struct { _PROTOTYPE( int select, (int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout) ); _PROTOTYPE( void FD_CLR, (int fd, fd_set *fdset)); -_PROTOTYPE( void FD_ISSET, (int fd, fd_set *fdset)); +_PROTOTYPE( int FD_ISSET, (int fd, fd_set *fdset)); _PROTOTYPE( void FD_SET, (int fd, fd_set *fdset)); _PROTOTYPE( void FD_ZERO, (fd_set *fdset)); +/* possible select() operation types; read, write, errors */ +/* (FS/driver internal use only) */ +#define SEL_RD (1 << 0) +#define SEL_WR (1 << 1) +#define SEL_ERR (1 << 2) +#define SEL_NOTIFY (1 << 3) /* not a real select operation */ + #endif /* _POSIX_SOURCE */ #endif /* _SYS_SELECT_H */ diff --git a/include/timers.h b/include/timers.h index 62d134ee5..9a12b3d78 100644 --- a/include/timers.h +++ b/include/timers.h @@ -51,10 +51,10 @@ typedef struct timer /* The following generic timer management functions are available. They * can be used to operate on the lists of timers. */ -_PROTOTYPE( void tmrs_clrtimer, (timer_t **tmrs, timer_t *tp) ); -_PROTOTYPE( void tmrs_exptimers, (timer_t **tmrs, clock_t now) ); -_PROTOTYPE( void tmrs_settimer, (timer_t **tmrs, timer_t *tp, - clock_t exp_time, tmr_func_t watchdog) ); +_PROTOTYPE( clock_t tmrs_clrtimer, (timer_t **tmrs, timer_t *tp, clock_t *new_head) ); +_PROTOTYPE( void tmrs_exptimers, (timer_t **tmrs, clock_t now, clock_t *new_head) ); +_PROTOTYPE( clock_t tmrs_settimer, (timer_t **tmrs, timer_t *tp, + clock_t exp_time, tmr_func_t watchdog, clock_t *new_head) ); #endif /* _TIMERS_H */ diff --git a/include/unistd.h b/include/unistd.h index 870ee51e2..0630bbd26 100755 --- a/include/unistd.h +++ b/include/unistd.h @@ -166,6 +166,6 @@ _PROTOTYPE( int setgroups, (int ngroups, const gid_t *gidset) ); #endif -_PROTOTYPE( int setcache, (int kb)); +_PROTOTYPE( int readlink, (const char *, char *, int)); #endif /* _UNISTD_H */