From 6dd488b87fdc47fb377ba648a6cd598bdab87f59 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 8 Mar 2015 19:07:48 +0100 Subject: Implement select ; add two tests for channels. --- src/common/include/fs.h | 13 +++++++++++++ src/common/include/proc.h | 2 ++ src/common/include/syscallproto.h | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/common') diff --git a/src/common/include/fs.h b/src/common/include/fs.h index 431c16f..5a2fc84 100644 --- a/src/common/include/fs.h +++ b/src/common/include/fs.h @@ -3,6 +3,8 @@ #include #include +typedef int fd_t; + #define FT_REGULAR 0 // no flags = regular file #define FT_DIR (0x01) #define FT_DEV (0x02) @@ -28,6 +30,7 @@ #define FM_ALL_MODES (0xFFFF) + typedef struct { int type; int access; @@ -46,4 +49,14 @@ typedef struct { #define IOCTL_BLOCKDEV_GET_BLOCK_SIZE 40 #define IOCTL_BLOCKDEV_GET_BLOCK_COUNT 41 + +#define SEL_READ 0x01 +#define SEL_WRITE 0x02 +#define SEL_ERROR 0x04 + +typedef struct { + fd_t fd; + uint16_t req_flags, got_flags; // rq_flags : what caller is interested in +} sel_fd_t; + /* vim: set ts=4 sw=4 tw=0 noet :*/ diff --git a/src/common/include/proc.h b/src/common/include/proc.h index 831e5c6..29b5b91 100644 --- a/src/common/include/proc.h +++ b/src/common/include/proc.h @@ -3,6 +3,8 @@ #include #include +typedef int pid_t; + #define PS_LOADING 1 #define PS_RUNNING 2 #define PS_FINISHED 3 diff --git a/src/common/include/syscallproto.h b/src/common/include/syscallproto.h index bbb49b3..9f300d3 100644 --- a/src/common/include/syscallproto.h +++ b/src/common/include/syscallproto.h @@ -1,9 +1,8 @@ #pragma once #include +#include -typedef int fd_t; -typedef int pid_t; typedef struct { fd_t a, b; } fd_pair_t; #define SC_MAX 128 // maximum number of syscalls @@ -33,6 +32,7 @@ typedef struct { fd_t a, b; } fd_pair_t; #define SC_STAT_OPEN 35 // args: fd, out stat_t *data -- stat on open file handle #define SC_IOCTL 36 // args: fd, command, out void* data #define SC_GET_MODE 37 // args: fd -- get mode for open file handle +#define SC_SELECT 38 // args: sel_fd_t*, count, timeout #define SC_MK_CHANNEL 40 // args: blocking?, (int, int)* #define SC_GEN_TOKEN 41 // args: fd, token_t* -- cgit v1.2.3