Commit 0ffe9b33 authored by David S. Miller's avatar David S. Miller

[SPARC]: SEMTIMEDOP for both Sparc ports.

parent a1bafab5
...@@ -123,7 +123,10 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user ...@@ -123,7 +123,10 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user
if (call <= SEMCTL) if (call <= SEMCTL)
switch (call) { switch (call) {
case SEMOP: case SEMOP:
err = sys_semop (first, (struct sembuf __user *)ptr, second); err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
goto out;
case SEMTIMEDOP:
err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, (const struct timespec __user *) fifth);
goto out; goto out;
case SEMGET: case SEMGET:
err = sys_semget (first, second, third); err = sys_semget (first, second, third);
......
...@@ -182,7 +182,10 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir ...@@ -182,7 +182,10 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
if (call <= SEMCTL) if (call <= SEMCTL)
switch (call) { switch (call) {
case SEMOP: case SEMOP:
err = sys_semop (first, (struct sembuf *)ptr, second); err = sys_semtimedop (first, (struct sembuf *)ptr, second, NULL);
goto out;
case SEMTIMEDOP:
err = sys_semtimedop (first, (struct sembuf *)ptr, second, (const struct timespec *) fifth);
goto out; goto out;
case SEMGET: case SEMGET:
err = sys_semget (first, second, (int)third); err = sys_semget (first, second, (int)third);
......
...@@ -736,6 +736,22 @@ static int do_sys32_shmctl (int first, int second, void *uptr) ...@@ -736,6 +736,22 @@ static int do_sys32_shmctl (int first, int second, void *uptr)
return err; return err;
} }
static int sys32_semtimedop(int semid, struct sembuf *tsems, int nsems,
const struct compat_timespec *timeout32)
{
struct compat_timespec t32;
struct timespec *t64 = compat_alloc_user_space(sizeof(*t64));
if (copy_from_user(&t32, timeout32, sizeof(t32)))
return -EFAULT;
if (put_user(t32.tv_sec, &t64->tv_sec) ||
put_user(t32.tv_nsec, &t64->tv_nsec))
return -EFAULT;
return sys_semtimedop(semid, tsems, nsems, t64);
}
asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
{ {
int version, err; int version, err;
...@@ -747,8 +763,10 @@ asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u ...@@ -747,8 +763,10 @@ asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u
switch (call) { switch (call) {
case SEMOP: case SEMOP:
/* struct sembuf is the same on 32 and 64bit :)) */ /* struct sembuf is the same on 32 and 64bit :)) */
err = sys_semop (first, (struct sembuf *)AA(ptr), second); err = sys_semtimedop (first, (struct sembuf *)AA(ptr), second, NULL);
goto out; goto out;
case SEMTIMEDOP:
err = sys32_semtimedop (first, (struct sembuf *)AA(ptr), second, (const struct compat_timespec *) AA(fifth));
case SEMGET: case SEMGET:
err = sys_semget (first, second, third); err = sys_semget (first, second, third);
goto out; goto out;
......
...@@ -14,6 +14,7 @@ struct ipc_kludge { ...@@ -14,6 +14,7 @@ struct ipc_kludge {
#define SEMOP 1 #define SEMOP 1
#define SEMGET 2 #define SEMGET 2
#define SEMCTL 3 #define SEMCTL 3
#define SEMTIMEDOP 4
#define MSGSND 11 #define MSGSND 11
#define MSGRCV 12 #define MSGRCV 12
#define MSGGET 13 #define MSGGET 13
......
...@@ -14,6 +14,7 @@ struct ipc_kludge { ...@@ -14,6 +14,7 @@ struct ipc_kludge {
#define SEMOP 1 #define SEMOP 1
#define SEMGET 2 #define SEMGET 2
#define SEMCTL 3 #define SEMCTL 3
#define SEMTIMEDOP 4
#define MSGSND 11 #define MSGSND 11
#define MSGRCV 12 #define MSGRCV 12
#define MSGGET 13 #define MSGGET 13
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment