From owner-freebsd-threads@FreeBSD.ORG Sat Jul 20 13:40:01 2013 Return-Path: Delivered-To: freebsd-threads@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 6AB34E9C for ; Sat, 20 Jul 2013 13:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 4AFD722F for ; Sat, 20 Jul 2013 13:40:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r6KDe1n5045087 for ; Sat, 20 Jul 2013 13:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r6KDe18X045086; Sat, 20 Jul 2013 13:40:01 GMT (envelope-from gnats) Date: Sat, 20 Jul 2013 13:40:01 GMT Message-Id: <201307201340.r6KDe18X045086@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org Cc: From: dfilter@FreeBSD.ORG (dfilter service) Subject: Re: threads/180652: commit references a PR X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: dfilter service List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jul 2013 13:40:01 -0000 The following reply was made to PR threads/180652; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: threads/180652: commit references a PR Date: Sat, 20 Jul 2013 13:39:54 +0000 (UTC) Author: kib Date: Sat Jul 20 13:39:41 2013 New Revision: 253494 URL: http://svnweb.freebsd.org/changeset/base/253494 Log: id_t is 64bit, provide the compat32 wrapper for clock_getcpuclockid2(2). Reported and tested by: Petr Salinger PR: threads/180652 Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/syscalls.master head/sys/kern/kern_time.c head/sys/sys/syscallsubr.h Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Sat Jul 20 13:14:59 2013 (r253493) +++ head/sys/compat/freebsd32/freebsd32_misc.c Sat Jul 20 13:39:41 2013 (r253494) @@ -2332,6 +2332,20 @@ freebsd32_clock_getres(struct thread *td } 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: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Sat Jul 20 13:14:59 2013 (r253493) +++ head/sys/compat/freebsd32/syscalls.master Sat Jul 20 13:39:41 2013 (r253494) @@ -457,8 +457,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: head/sys/kern/kern_time.c ============================================================================== --- head/sys/kern/kern_time.c Sat Jul 20 13:14:59 2013 (r253493) +++ head/sys/kern/kern_time.c Sat Jul 20 13:39:41 2013 (r253494) @@ -183,38 +183,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: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Sat Jul 20 13:14:59 2013 (r253493) +++ head/sys/sys/syscallsubr.h Sat Jul 20 13:39:41 2013 (r253494) @@ -76,6 +76,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, _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"