Message type for VFS_SELECT

Change-Id: Ifd6cb7082dd528f1698a0ca070de447aad85ba60
This commit is contained in:
Lionel Sambuc 2014-05-12 11:21:52 +02:00
parent 58b67186c2
commit 7332005370
4 changed files with 25 additions and 19 deletions

View file

@ -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 */

View file

@ -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;

View file

@ -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));
}

View file

@ -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);