svn commit: r254664 - in stable/9/sys: compat/freebsd32 kern sys
Konstantin Belousov
kib at FreeBSD.org
Thu Aug 22 17:30:03 UTC 2013
Author: kib
Date: Thu Aug 22 17:30:01 2013
New Revision: 254664
URL: http://svnweb.freebsd.org/changeset/base/254664
Log:
MFC r253494:
id_t is 64bit, provide the compat32 wrapper for clock_getcpuclockid2(2).
Reminded by: Petr Salinger <Petr.Salinger at seznam.cz>
Modified:
stable/9/sys/compat/freebsd32/freebsd32_misc.c
stable/9/sys/compat/freebsd32/syscalls.master
stable/9/sys/kern/kern_time.c
stable/9/sys/sys/syscallsubr.h
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/sys/ (props changed)
Modified: stable/9/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- stable/9/sys/compat/freebsd32/freebsd32_misc.c Thu Aug 22 16:39:59 2013 (r254663)
+++ stable/9/sys/compat/freebsd32/freebsd32_misc.c Thu Aug 22 17:30:01 2013 (r254664)
@@ -2384,6 +2384,20 @@ freebsd32_ktimer_gettime(struct thread *
}
int
+freebsd32_clock_getcpuclockid2(struct thread *td,
+ struct freebsd32_clock_getcpuclockid2_args *uap)
+{
+ clockid_t clk_id;
+ int error;
+
+ error = kern_clock_getcpuclockid2(td, PAIR32TO64(id_t, uap->id),
+ uap->which, &clk_id);
+ if (error == 0)
+ error = copyout(&clk_id, uap->clock_id, sizeof(clockid_t));
+ return (error);
+}
+
+int
freebsd32_thr_new(struct thread *td,
struct freebsd32_thr_new_args *uap)
{
Modified: stable/9/sys/compat/freebsd32/syscalls.master
==============================================================================
--- stable/9/sys/compat/freebsd32/syscalls.master Thu Aug 22 16:39:59 2013 (r254663)
+++ stable/9/sys/compat/freebsd32/syscalls.master Thu Aug 22 17:30:01 2013 (r254664)
@@ -461,8 +461,9 @@
244 AUE_NULL UNIMPL nosys
245 AUE_NULL UNIMPL nosys
246 AUE_NULL UNIMPL nosys
-247 AUE_NULL NOPROTO { int clock_getcpuclockid2(id_t id,\
- int which, clockid_t *clock_id); }
+247 AUE_NULL STD { int freebsd32_clock_getcpuclockid2(\
+ uint32_t id1, uint32_t id2,\
+ int which, clockid_t *clock_id); }
248 AUE_NULL UNIMPL ntp_gettime
249 AUE_NULL UNIMPL nosys
; syscall numbers initially used in OpenBSD
Modified: stable/9/sys/kern/kern_time.c
==============================================================================
--- stable/9/sys/kern/kern_time.c Thu Aug 22 16:39:59 2013 (r254663)
+++ stable/9/sys/kern/kern_time.c Thu Aug 22 17:30:01 2013 (r254664)
@@ -179,38 +179,46 @@ int
sys_clock_getcpuclockid2(struct thread *td, struct clock_getcpuclockid2_args *uap)
{
clockid_t clk_id;
+ int error;
+
+ error = kern_clock_getcpuclockid2(td, uap->id, uap->which, &clk_id);
+ if (error == 0)
+ error = copyout(&clk_id, uap->clock_id, sizeof(clockid_t));
+ return (error);
+}
+
+int
+kern_clock_getcpuclockid2(struct thread *td, id_t id, int which,
+ clockid_t *clk_id)
+{
struct proc *p;
pid_t pid;
lwpid_t tid;
int error;
- switch(uap->which) {
+ switch (which) {
case CPUCLOCK_WHICH_PID:
- if (uap->id != 0) {
- p = pfind(uap->id);
+ if (id != 0) {
+ p = pfind(id);
if (p == NULL)
return (ESRCH);
error = p_cansee(td, p);
PROC_UNLOCK(p);
- if (error)
+ if (error != 0)
return (error);
- pid = uap->id;
+ pid = id;
} else {
pid = td->td_proc->p_pid;
}
- clk_id = MAKE_PROCESS_CPUCLOCK(pid);
- break;
+ *clk_id = MAKE_PROCESS_CPUCLOCK(pid);
+ return (0);
case CPUCLOCK_WHICH_TID:
- if (uap->id == 0)
- tid = td->td_tid;
- else
- tid = uap->id;
- clk_id = MAKE_THREAD_CPUCLOCK(tid);
- break;
+ tid = id == 0 ? td->td_tid : id;
+ *clk_id = MAKE_THREAD_CPUCLOCK(tid);
+ return (0);
default:
return (EINVAL);
}
- return (copyout(&clk_id, uap->clock_id, sizeof(clockid_t)));
}
#ifndef _SYS_SYSPROTO_H_
Modified: stable/9/sys/sys/syscallsubr.h
==============================================================================
--- stable/9/sys/sys/syscallsubr.h Thu Aug 22 16:39:59 2013 (r254663)
+++ stable/9/sys/sys/syscallsubr.h Thu Aug 22 17:30:01 2013 (r254664)
@@ -74,6 +74,8 @@ int kern_chmod(struct thread *td, char *
int mode);
int kern_chown(struct thread *td, char *path, enum uio_seg pathseg, int uid,
int gid);
+int kern_clock_getcpuclockid2(struct thread *td, id_t id, int which,
+ clockid_t *clk_id);
int kern_clock_getres(struct thread *td, clockid_t clock_id,
struct timespec *ts);
int kern_clock_gettime(struct thread *td, clockid_t clock_id,
More information about the svn-src-stable-9
mailing list