00001 /* 00002 ** pipevar.h for lseos in lseos-srv/basic/pipe 00003 ** 00004 ** Copyright(c)2004 Vianney Rancurel 00005 ** Login <vianney@epita.fr> 00006 ** 00007 ** Started on Tue Feb 17 17:14:41 2004 Vianney Rancurel 00008 ** Last update Mon Dec 6 12:24:55 2004 Vianney Rancurel 00009 */ 00010 #ifndef __PIPEVAR_H__ 00011 #define __PIPEVAR_H__ 1 00012 #include <libc.h> 00013 00014 typedef enum 00015 { 00016 PIPE_STILL_AVAIL = 100, 00017 PIPE_BAD_TYPE, 00018 PIPE_ALREADY_CLOSED, 00019 PIPE_TOO_MANY_HOLDERS, 00020 PIPE_HOLDER_DOESNT_EXIST, 00021 PIPE_BAD_PATH_SPEC, 00022 } t_pipe_suberrno_codes; 00023 00024 typedef struct s_pipestat 00025 { 00026 int cumulated; 00027 int nwrites; 00028 int nreads; 00029 } t_pipestat; 00030 00031 typedef struct s_pipe 00032 { 00033 u_int32_t avail:1; 00034 u_int32_t closed:1; 00035 00036 #define MAXHOLDER 10 00037 pid_t holders[MAXHOLDER]; 00038 uid_t uid; 00039 00040 int type; 00041 #define PIPE_CONSUMER 1 00042 #define PIPE_PRODUCER 2 00043 00044 int party; 00045 00046 char *buf; /* by convention, buffer used is in 00047 the consumer */ 00048 int pos; 00049 00050 u_int32_t cond; 00051 00052 t_pipestat stats; 00053 } t_pipe; 00054 00055 typedef struct s_pipe_info 00056 { 00057 pid_t notify_pid; 00058 00059 __cpu_simple_lock_t lock; 00060 } t_pipe_info; 00061 00062 #endif