diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sparc64/solaris/ipc.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/sparc64/solaris/ipc.c')
-rw-r--r-- | arch/sparc64/solaris/ipc.c | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/arch/sparc64/solaris/ipc.c b/arch/sparc64/solaris/ipc.c new file mode 100644 index 000000000000..8cef5fd57b2e --- /dev/null +++ b/arch/sparc64/solaris/ipc.c | |||
@@ -0,0 +1,127 @@ | |||
1 | /* $Id: ipc.c,v 1.5 1999/12/09 00:41:00 davem Exp $ | ||
2 | * ipc.c: Solaris IPC emulation | ||
3 | * | ||
4 | * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) | ||
5 | */ | ||
6 | |||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/types.h> | ||
9 | #include <linux/smp_lock.h> | ||
10 | #include <linux/wait.h> | ||
11 | #include <linux/mm.h> | ||
12 | #include <linux/shm.h> | ||
13 | #include <linux/sem.h> | ||
14 | #include <linux/msg.h> | ||
15 | |||
16 | #include <asm/uaccess.h> | ||
17 | #include <asm/string.h> | ||
18 | #include <asm/ipc.h> | ||
19 | |||
20 | #include "conv.h" | ||
21 | |||
22 | struct solaris_ipc_perm { | ||
23 | s32 uid; | ||
24 | s32 gid; | ||
25 | s32 cuid; | ||
26 | s32 cgid; | ||
27 | u32 mode; | ||
28 | u32 seq; | ||
29 | int key; | ||
30 | s32 pad[4]; | ||
31 | }; | ||
32 | |||
33 | struct solaris_shmid_ds { | ||
34 | struct solaris_ipc_perm shm_perm; | ||
35 | int shm_segsz; | ||
36 | u32 shm_amp; | ||
37 | unsigned short shm_lkcnt; | ||
38 | char __padxx[2]; | ||
39 | s32 shm_lpid; | ||
40 | s32 shm_cpid; | ||
41 | u32 shm_nattch; | ||
42 | u32 shm_cnattch; | ||
43 | s32 shm_atime; | ||
44 | s32 shm_pad1; | ||
45 | s32 shm_dtime; | ||
46 | s32 shm_pad2; | ||
47 | s32 shm_ctime; | ||
48 | s32 shm_pad3; | ||
49 | unsigned short shm_cv; | ||
50 | char shm_pad4[2]; | ||
51 | u32 shm_sptas; | ||
52 | s32 shm_pad5[2]; | ||
53 | }; | ||
54 | |||
55 | asmlinkage long solaris_shmsys(int cmd, u32 arg1, u32 arg2, u32 arg3) | ||
56 | { | ||
57 | int (*sys_ipc)(unsigned,int,int,unsigned long,void __user *,long) = | ||
58 | (int (*)(unsigned,int,int,unsigned long,void __user *,long))SYS(ipc); | ||
59 | mm_segment_t old_fs; | ||
60 | unsigned long raddr; | ||
61 | int ret; | ||
62 | |||
63 | switch (cmd) { | ||
64 | case 0: /* shmat */ | ||
65 | old_fs = get_fs(); | ||
66 | set_fs(KERNEL_DS); | ||
67 | ret = sys_ipc(SHMAT, arg1, arg3 & ~0x4000, (unsigned long)&raddr, A(arg2), 0); | ||
68 | set_fs(old_fs); | ||
69 | if (ret >= 0) return (u32)raddr; | ||
70 | else return ret; | ||
71 | case 1: /* shmctl */ | ||
72 | switch (arg2) { | ||
73 | case 3: /* SHM_LOCK */ | ||
74 | case 4: /* SHM_UNLOCK */ | ||
75 | return sys_ipc(SHMCTL, arg1, (arg2 == 3) ? SHM_LOCK : SHM_UNLOCK, 0, NULL, 0); | ||
76 | case 10: /* IPC_RMID */ | ||
77 | return sys_ipc(SHMCTL, arg1, IPC_RMID, 0, NULL, 0); | ||
78 | case 11: /* IPC_SET */ | ||
79 | { | ||
80 | struct shmid_ds s; | ||
81 | struct solaris_shmid_ds __user *p = A(arg3); | ||
82 | |||
83 | if (get_user (s.shm_perm.uid, &p->shm_perm.uid) || | ||
84 | __get_user (s.shm_perm.gid, &p->shm_perm.gid) || | ||
85 | __get_user (s.shm_perm.mode, &p->shm_perm.mode)) | ||
86 | return -EFAULT; | ||
87 | old_fs = get_fs(); | ||
88 | set_fs(KERNEL_DS); | ||
89 | ret = sys_ipc(SHMCTL, arg1, IPC_SET, 0, &s, 0); | ||
90 | set_fs(old_fs); | ||
91 | return ret; | ||
92 | } | ||
93 | case 12: /* IPC_STAT */ | ||
94 | { | ||
95 | struct shmid_ds s; | ||
96 | struct solaris_shmid_ds __user *p = A(arg3); | ||
97 | |||
98 | old_fs = get_fs(); | ||
99 | set_fs(KERNEL_DS); | ||
100 | ret = sys_ipc(SHMCTL, arg1, IPC_SET, 0, &s, 0); | ||
101 | set_fs(old_fs); | ||
102 | if (put_user (s.shm_perm.uid, &(p->shm_perm.uid)) || | ||
103 | __put_user (s.shm_perm.gid, &(p->shm_perm.gid)) || | ||
104 | __put_user (s.shm_perm.cuid, &(p->shm_perm.cuid)) || | ||
105 | __put_user (s.shm_perm.cgid, &(p->shm_perm.cgid)) || | ||
106 | __put_user (s.shm_perm.mode, &(p->shm_perm.mode)) || | ||
107 | __put_user (s.shm_perm.seq, &(p->shm_perm.seq)) || | ||
108 | __put_user (s.shm_perm.key, &(p->shm_perm.key)) || | ||
109 | __put_user (s.shm_segsz, &(p->shm_segsz)) || | ||
110 | __put_user (s.shm_lpid, &(p->shm_lpid)) || | ||
111 | __put_user (s.shm_cpid, &(p->shm_cpid)) || | ||
112 | __put_user (s.shm_nattch, &(p->shm_nattch)) || | ||
113 | __put_user (s.shm_atime, &(p->shm_atime)) || | ||
114 | __put_user (s.shm_dtime, &(p->shm_dtime)) || | ||
115 | __put_user (s.shm_ctime, &(p->shm_ctime))) | ||
116 | return -EFAULT; | ||
117 | return ret; | ||
118 | } | ||
119 | default: return -EINVAL; | ||
120 | } | ||
121 | case 2: /* shmdt */ | ||
122 | return sys_ipc(SHMDT, 0, 0, 0, A(arg1), 0); | ||
123 | case 3: /* shmget */ | ||
124 | return sys_ipc(SHMGET, arg1, arg2, arg3, NULL, 0); | ||
125 | } | ||
126 | return -EINVAL; | ||
127 | } | ||