This source file includes following definitions.
- ipc_init
- ipcperms
- sem_exit
- shm_swap
- sys_semget
- sys_semop
- sys_semctl
- sys_msgget
- sys_msgsnd
- sys_msgrcv
- sys_msgctl
- sys_shmget
- sys_shmat
- sys_shmdt
- sys_shmctl
- kerneld_exit
1
2
3
4
5
6 #include <linux/config.h>
7 #include <linux/errno.h>
8 #include <asm/segment.h>
9 #include <linux/sched.h>
10 #include <linux/mm.h>
11 #include <linux/sem.h>
12 #include <linux/msg.h>
13 #include <linux/shm.h>
14 #include <linux/stat.h>
15
16 #if defined(CONFIG_SYSVIPC) || defined(CONFIG_KERNELD)
17
18 extern void sem_init (void), msg_init (void), shm_init (void);
19
20 void ipc_init (void)
21 {
22 sem_init();
23 msg_init();
24 shm_init();
25 return;
26 }
27
28
29
30
31
32 int ipcperms (struct ipc_perm *ipcp, short flag)
33 {
34 int requested_mode, granted_mode;
35
36 if (suser())
37 return 0;
38 requested_mode = (flag >> 6) | (flag >> 3) | flag;
39 granted_mode = ipcp->mode;
40 if (current->euid == ipcp->cuid || current->euid == ipcp->uid)
41 granted_mode >>= 6;
42 else if (in_group_p(ipcp->cgid) || in_group_p(ipcp->gid))
43 granted_mode >>= 3;
44
45 if (requested_mode & ~granted_mode & 0007)
46 return -1;
47 return 0;
48 }
49
50 #else
51
52
53
54
55 void sem_exit (void)
56 {
57 return;
58 }
59
60 int shm_swap (int prio, unsigned long limit)
61 {
62 return 0;
63 }
64
65 asmlinkage int sys_semget (key_t key, int nsems, int semflg)
66 {
67 return -ENOSYS;
68 }
69
70 asmlinkage int sys_semop (int semid, struct sembuf *sops, unsigned nsops)
71 {
72 return -ENOSYS;
73 }
74
75 asmlinkage int sys_semctl (int semid, int semnum, int cmd, union semun arg)
76 {
77 return -ENOSYS;
78 }
79
80 asmlinkage int sys_msgget (key_t key, int msgflg)
81 {
82 return -ENOSYS;
83 }
84
85 asmlinkage int sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg)
86 {
87 return -ENOSYS;
88 }
89
90 asmlinkage int sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp,
91 int msgflg)
92 {
93 return -ENOSYS;
94 }
95
96 asmlinkage int sys_msgctl (int msqid, int cmd, struct msqid_ds *buf)
97 {
98 return -ENOSYS;
99 }
100
101 asmlinkage int sys_shmget (key_t key, int size, int flag)
102 {
103 return -ENOSYS;
104 }
105
106 asmlinkage int sys_shmat (int shmid, char *shmaddr, int shmflg, ulong *addr)
107 {
108 return -ENOSYS;
109 }
110
111 asmlinkage int sys_shmdt (char *shmaddr)
112 {
113 return -ENOSYS;
114 }
115
116 asmlinkage int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf)
117 {
118 return -ENOSYS;
119 }
120
121 void kerneld_exit(void)
122 {
123 }
124 #endif