diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2015-03-08 19:07:48 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2015-03-08 19:07:48 +0100 |
commit | 6dd488b87fdc47fb377ba648a6cd598bdab87f59 (patch) | |
tree | 2e69225353054eb43a9869af4ca9766a0f39c828 /src/common/include | |
parent | bcee004478c6448541ce583e75c706e185190800 (diff) | |
download | kogata-6dd488b87fdc47fb377ba648a6cd598bdab87f59.tar.gz kogata-6dd488b87fdc47fb377ba648a6cd598bdab87f59.zip |
Implement select ; add two tests for channels.
Diffstat (limited to 'src/common/include')
-rw-r--r-- | src/common/include/fs.h | 13 | ||||
-rw-r--r-- | src/common/include/proc.h | 2 | ||||
-rw-r--r-- | src/common/include/syscallproto.h | 4 |
3 files changed, 17 insertions, 2 deletions
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 <stdint.h> #include <stddef.h> +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 <stddef.h> #include <stdint.h> +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 <proc.h> +#include <fs.h> -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* |