From: Lionel Sambuc Date: Mon, 12 May 2014 09:21:52 +0000 (+0200) Subject: Message type for VFS_SELECT X-Git-Tag: v3.3.0~324 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doc/syslog.conf.5.html?a=commitdiff_plain;h=733200537019b8f93b243a8e408cad6ea291618e;p=minix.git Message type for VFS_SELECT Change-Id: Ifd6cb7082dd528f1698a0ca070de447aad85ba60 --- diff --git a/include/minix/callnr.h b/include/minix/callnr.h index 2627b8dca..4de7c2d43 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -232,13 +232,6 @@ #define NR_VFS_CALLS 49 /* highest number from base plus one */ -/* Field names for the select(2) call. */ -#define VFS_SELECT_NFDS m8_i1 /* int */ -#define VFS_SELECT_READFDS m8_p1 /* fd_set * */ -#define VFS_SELECT_WRITEFDS m8_p2 /* fd_set * */ -#define VFS_SELECT_ERRORFDS m8_p3 /* fd_set * */ -#define VFS_SELECT_TIMEOUT m8_p4 /* struct timeval * */ - /* Field names for the getvfsstat(2) call. */ #define VFS_GETVFSSTAT_BUF m1_p1 /* struct statvfs * */ #define VFS_GETVFSSTAT_LEN m1_i1 /* size_t */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 7466332fb..48fa5970c 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -146,6 +146,17 @@ typedef struct { } mess_sigcalls; _ASSERT_MSG_SIZE(mess_sigcalls); +typedef struct { + uint32_t nfds; + fd_set *readfds; + fd_set *writefds; + fd_set *errorfds; + vir_bytes timeout; /* user-provided 'struct timeval *' */ + + uint8_t padding[36]; +} mess_lc_vfs_select; +_ASSERT_MSG_SIZE(mess_lc_vfs_select); + typedef struct { dev_t device; off_t seek_pos; @@ -597,6 +608,8 @@ typedef struct { mess_fs_vfs_readsuper m_fs_vfs_readsuper; mess_fs_vfs_readwrite m_fs_vfs_readwrite; + mess_lc_vfs_select m_lc_vfs_select; + mess_vfs_fs_breadwrite m_vfs_fs_breadwrite; mess_vfs_fs_chmod m_vfs_fs_chmod; mess_vfs_fs_chown m_vfs_fs_chown; diff --git a/lib/libc/sys-minix/select.c b/lib/libc/sys-minix/select.c index 09f4ab1be..adc8c8193 100644 --- a/lib/libc/sys-minix/select.c +++ b/lib/libc/sys-minix/select.c @@ -13,11 +13,11 @@ int select(int nfds, message m; memset(&m, 0, sizeof(m)); - m.VFS_SELECT_NFDS = nfds; - m.VFS_SELECT_READFDS = (char *) readfds; - m.VFS_SELECT_WRITEFDS = (char *) writefds; - m.VFS_SELECT_ERRORFDS = (char *) errorfds; - m.VFS_SELECT_TIMEOUT = (char *) timeout; + m.m_lc_vfs_select.nfds = nfds; + m.m_lc_vfs_select.readfds = readfds; + m.m_lc_vfs_select.writefds = writefds; + m.m_lc_vfs_select.errorfds = errorfds; + m.m_lc_vfs_select.timeout = (vir_bytes)timeout; return (_syscall(VFS_PROC_NR, VFS_SELECT, &m)); } diff --git a/servers/vfs/select.c b/servers/vfs/select.c index 945be2cf8..65495620e 100644 --- a/servers/vfs/select.c +++ b/servers/vfs/select.c @@ -97,8 +97,8 @@ int do_select(void) struct selectentry *se; vir_bytes vtimeout; - nfds = job_m_in.VFS_SELECT_NFDS; - vtimeout = (vir_bytes) job_m_in.VFS_SELECT_TIMEOUT; + nfds = job_m_in.m_lc_vfs_select.nfds; + vtimeout = job_m_in.m_lc_vfs_select.timeout; /* Sane amount of file descriptors? */ if (nfds < 0 || nfds > OPEN_MAX) return(EINVAL); @@ -113,9 +113,9 @@ int do_select(void) wipe_select(se); /* Clear results of previous usage */ se->requestor = fp; se->req_endpt = who_e; - se->vir_readfds = (fd_set *) job_m_in.VFS_SELECT_READFDS; - se->vir_writefds = (fd_set *) job_m_in.VFS_SELECT_WRITEFDS; - se->vir_errorfds = (fd_set *) job_m_in.VFS_SELECT_ERRORFDS; + se->vir_readfds = job_m_in.m_lc_vfs_select.readfds; + se->vir_writefds = job_m_in.m_lc_vfs_select.writefds; + se->vir_errorfds = job_m_in.m_lc_vfs_select.errorfds; /* Copy fdsets from the process */ if ((r = copy_fdsets(se, nfds, FROM_PROC)) != OK) { @@ -126,8 +126,8 @@ int do_select(void) /* Did the process set a timeout value? If so, retrieve it. */ if (vtimeout != 0) { do_timeout = 1; - r = sys_datacopy_wrapper(who_e, (vir_bytes) vtimeout, SELF, - (vir_bytes) &timeout, sizeof(timeout)); + r = sys_datacopy_wrapper(who_e, vtimeout, SELF, (vir_bytes) &timeout, + sizeof(timeout)); if (r != OK) { se->requestor = NULL; return(r);