linux(4): Implement semtimedop syscalls.
On i386 are two semtimedop. The old one is called via multiplexor and uses 32-bit timespec, and new semtimedop_tim64, which is uses 64-bit timespec. MFC after: 2 weeks
This commit is contained in:
parent
430460d717
commit
3245a2ecea
@ -68,6 +68,5 @@ DUMMY(mq_notify);
|
||||
DUMMY(mq_getsetattr);
|
||||
DUMMY(readahead);
|
||||
DUMMY(restart_syscall);
|
||||
DUMMY(semtimedop);
|
||||
/* Linux 3.15: */
|
||||
DUMMY(kexec_file_load);
|
||||
|
@ -71,4 +71,3 @@ DUMMY(clock_adjtime64);
|
||||
DUMMY(io_pgetevents_time64);
|
||||
DUMMY(mq_timedsend_time64);
|
||||
DUMMY(mq_timedreceive_time64);
|
||||
DUMMY(semtimedop_time64);
|
||||
|
@ -279,6 +279,15 @@ linux_ipc(struct thread *td, struct linux_ipc_args *args)
|
||||
return (error);
|
||||
return (linux_semctl(td, &a));
|
||||
}
|
||||
case LINUX_SEMTIMEDOP: {
|
||||
struct linux_semtimedop_args a;
|
||||
|
||||
a.semid = args->arg1;
|
||||
a.tsops = PTRIN(args->ptr);
|
||||
a.nsops = args->arg2;
|
||||
a.timeout = PTRIN(args->arg5);
|
||||
return (linux_semtimedop(td, &a));
|
||||
}
|
||||
case LINUX_MSGSND: {
|
||||
struct linux_msgsnd_args a;
|
||||
|
||||
|
@ -59,5 +59,4 @@ DUMMY(mq_timedsend);
|
||||
DUMMY(mq_timedreceive);
|
||||
DUMMY(mq_notify);
|
||||
DUMMY(mq_getsetattr);
|
||||
DUMMY(semtimedop);
|
||||
DUMMY(kexec_file_load);
|
||||
|
@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
#include <compat/linux/linux_ipc.h>
|
||||
#include <compat/linux/linux_ipc64.h>
|
||||
#include <compat/linux/linux_timer.h>
|
||||
#include <compat/linux/linux_util.h>
|
||||
|
||||
/*
|
||||
@ -504,6 +505,50 @@ linux_shminfo_pushdown(l_int ver, struct l_shminfo64 *linux_shminfo64,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
||||
int
|
||||
linux_semtimedop_time64(struct thread *td, struct linux_semtimedop_time64_args *args)
|
||||
{
|
||||
struct timespec ts, *tsa;
|
||||
struct l_timespec64 lts;
|
||||
int error;
|
||||
|
||||
if (args->timeout) {
|
||||
if ((error = copyin(args->timeout, <s, sizeof(lts))))
|
||||
return (error);
|
||||
error = linux_to_native_timespec64(&ts, <s);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
tsa = &ts;
|
||||
} else
|
||||
tsa = NULL;
|
||||
|
||||
return (kern_semop(td, args->semid, PTRIN(args->tsops),
|
||||
args->nsops, tsa));
|
||||
}
|
||||
#endif /* __i386__) || (__amd64__ && COMPAT_LINUX32) */
|
||||
|
||||
int
|
||||
linux_semtimedop(struct thread *td, struct linux_semtimedop_args *args)
|
||||
{
|
||||
struct timespec ts, *tsa;
|
||||
struct l_timespec lts;
|
||||
int error;
|
||||
|
||||
if (args->timeout) {
|
||||
if ((error = copyin(args->timeout, <s, sizeof(lts))))
|
||||
return (error);
|
||||
error = linux_to_native_timespec(&ts, <s);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
tsa = &ts;
|
||||
} else
|
||||
tsa = NULL;
|
||||
|
||||
return (kern_semop(td, args->semid, PTRIN(args->tsops),
|
||||
args->nsops, tsa));
|
||||
}
|
||||
|
||||
int
|
||||
linux_semget(struct thread *td, struct linux_semget_args *args)
|
||||
{
|
||||
|
@ -37,6 +37,7 @@
|
||||
#define LINUX_SEMOP 1
|
||||
#define LINUX_SEMGET 2
|
||||
#define LINUX_SEMCTL 3
|
||||
#define LINUX_SEMTIMEDOP 4
|
||||
#define LINUX_MSGSND 11
|
||||
#define LINUX_MSGRCV 12
|
||||
#define LINUX_MSGGET 13
|
||||
@ -82,4 +83,16 @@
|
||||
#define LINUX_IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger
|
||||
message sizes, etc. */
|
||||
|
||||
#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
|
||||
struct linux_semtimedop_args
|
||||
{
|
||||
l_int semid;
|
||||
struct sembuf *tsops;
|
||||
l_uint nsops;
|
||||
struct l_timespec *timeout;
|
||||
};
|
||||
|
||||
int linux_semtimedop(struct thread *, struct linux_semtimedop_args *);
|
||||
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
|
||||
|
||||
#endif /* _LINUX_IPC_H_ */
|
||||
|
@ -73,4 +73,3 @@ DUMMY(clock_adjtime64);
|
||||
DUMMY(io_pgetevents_time64);
|
||||
DUMMY(mq_timedsend_time64);
|
||||
DUMMY(mq_timedreceive_time64);
|
||||
DUMMY(semtimedop_time64);
|
||||
|
@ -154,6 +154,15 @@ linux_ipc(struct thread *td, struct linux_ipc_args *args)
|
||||
return (error);
|
||||
return (linux_semctl(td, &a));
|
||||
}
|
||||
case LINUX_SEMTIMEDOP: {
|
||||
struct linux_semtimedop_args a;
|
||||
|
||||
a.semid = args->arg1;
|
||||
a.tsops = PTRIN(args->ptr);
|
||||
a.nsops = args->arg2;
|
||||
a.timeout = PTRIN(args->arg5);
|
||||
return (linux_semtimedop(td, &a));
|
||||
}
|
||||
case LINUX_MSGSND: {
|
||||
struct linux_msgsnd_args a;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user