commited some changes and added README
[meinos.git] / kernel2 / include / ipc / sem.h
blob0386cabcac1fee342172e4921ea8574670de809e
1 /*
2 meinOS - A unix-like x86 microkernel operating system
3 Copyright (C) 2008 Janosch Gräf <janosch.graef@gmx.net>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef _IPC_SEM_H_
20 #define _IPC_SEM_H_
22 #include <sys/types.h>
23 #include <ipc.h>
24 #include <procm.h>
26 typedef struct ipc_sem_S ipc_sem_t;
28 typedef struct {
29 ipc_sem_t *semset;
30 int val;
31 pid_t lopid;
32 llist_t waitn;
33 llist_t waitz;
34 } ipc_sem_sem_t;
36 struct ipc_sem_S {
37 ipc_obj_t ipc;
38 size_t num;
39 ipc_sem_sem_t *sems;
40 time_t otime;
41 time_t ctime;
44 typedef struct {
45 unsigned short num;
46 short op;
47 short flags;
48 } ipc_sem_op_t;
50 typedef struct {
51 int val;
52 proc_t *proc;
53 } ipc_sem_sleepn_t;
55 id_t ipc_sem_lastid;
57 int ipc_sem_init();
58 id_t ipc_sem_get(key_t key);
59 int ipc_sem_create(key_t key,size_t nsems,mode_t mode,time_t time);
60 int ipc_sem_op(id_t id,ipc_sem_op_t *ops,size_t nops,time_t time);
61 int ipc_sem_getval(id_t id,size_t num);
62 int ipc_sem_setval(id_t id,size_t num,int val,time_t time);
63 pid_t ipc_sem_getpid(id_t id,size_t num);
64 size_t ipc_sem_getcnt(id_t id,size_t num,int type);
65 int ipc_sem_getall(id_t id,short *buf);
66 int ipc_sem_setall(id_t id,short *buf,time_t time);
67 int ipc_sem_stat(id_t id,uid_t *uid,gid_t *gid,uid_t *cuid,gid_t *cgid,mode_t *mode,size_t *nsems,time_t *otime,time_t *ctime);
68 int ipc_sem_set(id_t id,uid_t uid,gid_t gid,mode_t mode,time_t time);
69 int ipc_sem_destroy(id_t id);
71 #endif