aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo_ipc.h
diff options
context:
space:
mode:
Diffstat (limited to 'pseudo_ipc.h')
-rw-r--r--pseudo_ipc.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/pseudo_ipc.h b/pseudo_ipc.h
index 50794a1..063a1ef 100644
--- a/pseudo_ipc.h
+++ b/pseudo_ipc.h
@@ -33,7 +33,7 @@ typedef struct {
pseudo_msg_type_t type;
op_id_t op;
res_id_t result;
- int xerrno;
+ int access;
int client;
int fd;
dev_t dev;
@@ -47,6 +47,22 @@ typedef struct {
char path[];
} pseudo_msg_t;
+enum {
+ PSA_EXEC = 1,
+ PSA_WRITE = (PSA_EXEC << 1),
+ PSA_READ = (PSA_WRITE << 1),
+ PSA_APPEND = (PSA_READ << 1),
+} pseudo_access_t;
+
+#define PSEUDO_ACCESS_MAP(mode, fcntl_access, pseudo_access) ((((mode) & O_ACCMODE) == (fcntl_access)) ? (pseudo_access) : (0))
+#define PSEUDO_ACCESS_FLAG(mode, fcntl_access, pseudo_access) (((mode) & (fcntl_access)) ? (pseudo_access) : (0))
+#define PSEUDO_ACCESS(mode) ( \
+ PSEUDO_ACCESS_MAP(mode, O_RDONLY, PSA_READ) | \
+ PSEUDO_ACCESS_MAP(mode, O_WRONLY, PSA_WRITE) | \
+ PSEUDO_ACCESS_MAP(mode, O_RDWR, PSA_READ | PSA_WRITE) | \
+ PSEUDO_ACCESS_FLAG(mode, O_APPEND, PSA_APPEND))
+extern int pseudo_access_fopen(const char *);
+
#define PSEUDO_HEADER_SIZE (offsetof(pseudo_msg_t, path))
extern pseudo_msg_t *pseudo_msg_receive(int fd);