CVS commit: src
Module Name:src Committed By: jruoho Date: Thu Oct 20 06:48:25 UTC 2011 Modified Files: src/share/man/man9: cpufreq.9 src/sys/kern: subr_cpufreq.c Log Message: Do not use xcall(9) in cpufreq_register(9), as it requires kthreads to be running and may impose hacks like config_interrupts(9) in the backend. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/share/man/man9/cpufreq.9 cvs rdiff -u -r1.4 -r1.5 src/sys/kern/subr_cpufreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/cpufreq.9 diff -u src/share/man/man9/cpufreq.9:1.4 src/share/man/man9/cpufreq.9:1.5 --- src/share/man/man9/cpufreq.9:1.4 Fri Sep 30 04:21:17 2011 +++ src/share/man/man9/cpufreq.9 Thu Oct 20 06:48:24 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: cpufreq.9,v 1.4 2011/09/30 04:21:17 jruoho Exp $ */ +.\ $NetBSD: cpufreq.9,v 1.5 2011/10/20 06:48:24 jruoho Exp $ */ .\ .\ Copyright (c) 2011 Jukka Ruohonen jruohonen.iki.fi .\ All rights reserved. @@ -25,7 +25,7 @@ .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\ POSSIBILITY OF SUCH DAMAGE. .\ -.Dd September 30, 2011 +.Dd October 20, 2011 .Dt CPUFREQ 9 .Os .Sh NAME @@ -115,7 +115,7 @@ a machine-dependent backend with the fra Only one backend can be registered. Upon successful completion, .Fn cpufreq_register -returns 0 and sets the frequency to the maximum available level. +returns 0. .Pp The following elements in .Vt struct cpufreq @@ -277,6 +277,7 @@ while calling the functions. This, and the use of .Xr xcall 9 , implies that no memory can be allocated in the backend during the calls. +Nor should the functions be called from interrupt context. .Sh CODE REFERENCES The .Nm Index: src/sys/kern/subr_cpufreq.c diff -u src/sys/kern/subr_cpufreq.c:1.4 src/sys/kern/subr_cpufreq.c:1.5 --- src/sys/kern/subr_cpufreq.c:1.4 Fri Sep 30 04:10:54 2011 +++ src/sys/kern/subr_cpufreq.c Thu Oct 20 06:48:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_cpufreq.c,v 1.4 2011/09/30 04:10:54 jruoho Exp $ */ +/* $NetBSD: subr_cpufreq.c,v 1.5 2011/10/20 06:48:24 jruoho Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_cpufreq.c,v 1.4 2011/09/30 04:10:54 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_cpufreq.c,v 1.5 2011/10/20 06:48:24 jruoho Exp $); #include sys/param.h #include sys/cpu.h @@ -62,7 +62,7 @@ cpufreq_init(void) int cpufreq_register(struct cpufreq *cf) { - uint32_t c, i, j, k, m; + uint32_t c, i, j, k; int rv; KASSERT(cf != NULL); @@ -138,8 +138,6 @@ cpufreq_register(struct cpufreq *cf) return rv; } - m = cpufreq_get_max(); - cpufreq_set_all_raw(m); mutex_exit(cpufreq_lock); return 0;
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: jruoho Date: Thu Oct 20 06:57:24 UTC 2011 Modified Files: src/sys/dev/acpi: acpi_cpu.c Log Message: Initialize P-states to P0 (i.e. the highest frequency). To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/dev/acpi/acpi_cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_cpu.c diff -u src/sys/dev/acpi/acpi_cpu.c:1.45 src/sys/dev/acpi/acpi_cpu.c:1.46 --- src/sys/dev/acpi/acpi_cpu.c:1.45 Tue Oct 18 05:08:24 2011 +++ src/sys/dev/acpi/acpi_cpu.c Thu Oct 20 06:57:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_cpu.c,v 1.45 2011/10/18 05:08:24 jruoho Exp $ */ +/* $NetBSD: acpi_cpu.c,v 1.46 2011/10/20 06:57:23 jruoho Exp $ */ /*- * Copyright (c) 2010, 2011 Jukka Ruohonen jruoho...@iki.fi @@ -27,7 +27,7 @@ * SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_cpu.c,v 1.45 2011/10/18 05:08:24 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_cpu.c,v 1.46 2011/10/20 06:57:23 jruoho Exp $); #include sys/param.h #include sys/cpu.h @@ -249,24 +249,18 @@ acpicpu_once_attach(void) static int acpicpu_once_detach(void) { - struct cpu_info *ci = curcpu(); struct acpicpu_softc *sc; if (acpicpu_count != 0) return EDEADLK; + cpufreq_deregister(); + if (acpicpu_log != NULL) sysctl_teardown(acpicpu_log); - if (acpicpu_sc != NULL) { - - sc = acpicpu_sc[ci-ci_acpiid]; - - if ((sc-sc_flags ACPICPU_FLAG_P) != 0) - cpufreq_deregister(); - + if (acpicpu_sc != NULL) kmem_free(acpicpu_sc, maxcpus * sizeof(*sc)); - } return 0; } @@ -333,6 +327,12 @@ acpicpu_start(device_t self) if (cpufreq_register(cf) != 0) aprint_error_dev(self, failed to register cpufreq\n); + else { + /* + * Initialize the states to P0. + */ + cpufreq_set_all(sc-sc_pstate[0].ps_freq); + } } }
CVS commit: src/share/man/man9
Module Name:src Committed By: jruoho Date: Thu Oct 20 09:31:00 UTC 2011 Modified Files: src/share/man/man9: mstohz.9 tvtohz.9 Log Message: Xref mstohz(9) and tvtohz(9) with each other. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/share/man/man9/mstohz.9 cvs rdiff -u -r1.4 -r1.5 src/share/man/man9/tvtohz.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/mstohz.9 diff -u src/share/man/man9/mstohz.9:1.9 src/share/man/man9/mstohz.9:1.10 --- src/share/man/man9/mstohz.9:1.9 Fri Apr 8 07:55:04 2011 +++ src/share/man/man9/mstohz.9 Thu Oct 20 09:31:00 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: mstohz.9,v 1.9 2011/04/08 07:55:04 jruoho Exp $ +.\ $NetBSD: mstohz.9,v 1.10 2011/10/20 09:31:00 jruoho Exp $ .\ .\ Copyright (c) 2002 Manuel Bouyer. .\ @@ -24,7 +24,7 @@ .\ SUCH DAMAGE. .\ .\ -.Dd April 8, 2011 +.Dd October 20, 2011 .Dt MSTOHZ 9 .Os .Sh NAME @@ -61,7 +61,8 @@ The return value is either the number of for the specified value. .Sh SEE ALSO .Xr param 3 , -.Xr callout 9 +.Xr callout 9 , +.Xr tvtohz 9 .Sh BUGS Neither .Fn mstohz Index: src/share/man/man9/tvtohz.9 diff -u src/share/man/man9/tvtohz.9:1.4 src/share/man/man9/tvtohz.9:1.5 --- src/share/man/man9/tvtohz.9:1.4 Mon May 17 20:18:30 2010 +++ src/share/man/man9/tvtohz.9 Thu Oct 20 09:31:00 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: tvtohz.9,v 1.4 2010/05/17 20:18:30 jruoho Exp $ +.\ $NetBSD: tvtohz.9,v 1.5 2011/10/20 09:31:00 jruoho Exp $ .\ .\ Copyright (c) 2000 Kelly Yancey .\ All rights reserved. @@ -26,7 +26,7 @@ .\ .\ $FreeBSD: src/share/man/man9/tvtohz.9,v 1.4 2005/02/09 18:07:17 ru Exp $ .\ -.Dd May 17, 2010 +.Dd October 20, 2011 .Dt TVTOHZ 9 .Os .Sh NAME @@ -48,10 +48,10 @@ Returns the integral number of system ti interval, including the current tick. .Sh SEE ALSO .Xr timeval 3 , +.Xr callout 9 , .Xr microtime 9 , .Xr microuptime 9 , -.Xr timecounter 9 , -.Xr timeout 9 +.Xr mstohz 9 .Sh HISTORY The .Nm
CVS commit: src/share/man/man9
Module Name:src Committed By: wiz Date: Thu Oct 20 10:36:42 UTC 2011 Modified Files: src/share/man/man9: mstohz.9 Log Message: Use Aq instead of \*[Lt]...\*[Gt] To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/share/man/man9/mstohz.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/mstohz.9 diff -u src/share/man/man9/mstohz.9:1.10 src/share/man/man9/mstohz.9:1.11 --- src/share/man/man9/mstohz.9:1.10 Thu Oct 20 09:31:00 2011 +++ src/share/man/man9/mstohz.9 Thu Oct 20 10:36:42 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: mstohz.9,v 1.10 2011/10/20 09:31:00 jruoho Exp $ +.\ $NetBSD: mstohz.9,v 1.11 2011/10/20 10:36:42 wiz Exp $ .\ .\ Copyright (c) 2002 Manuel Bouyer. .\ @@ -50,11 +50,11 @@ Conversely, converts system clock ticks to milliseconds. .Pp These macros are defined in the -.Em \*[Lt]sys/param.h\*[Gt] +.Aq Em sys/param.h header. Individual ports can have a processor-specific, more efficient version implemented in their -.Em \*[Lt]machine/param.h\*[Gt] +.Aq Em machine/param.h header as a define. .Sh RETURN VALUES The return value is either the number of clock ticks or milliseconds
CVS commit: src/share/man/man9
Module Name:src Committed By: njoly Date: Thu Oct 20 12:14:13 UTC 2011 Modified Files: src/share/man/man9: usbdi.9 Log Message: Use .In macro. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/share/man/man9/usbdi.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/usbdi.9 diff -u src/share/man/man9/usbdi.9:1.7 src/share/man/man9/usbdi.9:1.8 --- src/share/man/man9/usbdi.9:1.7 Wed Apr 30 13:10:59 2008 +++ src/share/man/man9/usbdi.9 Thu Oct 20 12:14:12 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: usbdi.9,v 1.7 2008/04/30 13:10:59 martin Exp $ +.\ $NetBSD: usbdi.9,v 1.8 2011/10/20 12:14:12 njoly Exp $ .\ .\ Copyright (c) 1999 The NetBSD Foundation, Inc. .\ All rights reserved. @@ -34,8 +34,8 @@ .Nm usbdi .Nd USB device drivers interface .Sh SYNOPSIS -.Cd #include \*[Lt]dev/usb/usb.h\*[Gt] -.Cd #include \*[Lt]dev/usb/usbdi.h\*[Gt] +.In dev/usb/usb.h +.In dev/usb/usbdi.h .Sh DESCRIPTION Device driver access to the USB bus centers around transfers. A transfer describes a communication with a USB device.
CVS commit: src/sys/arch/xen/x86
Module Name:src Committed By: jruoho Date: Thu Oct 20 13:21:11 UTC 2011 Modified Files: src/sys/arch/xen/x86: cpu.c Log Message: Remove code that is commented out and out-of-sync with x86. If Xen needs to use cpu_resume(), cpu_suspend(), or cpu_shutdown() in the future, it is better to expose these from x86 rather than duplicate code. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/arch/xen/x86/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/x86/cpu.c diff -u src/sys/arch/xen/x86/cpu.c:1.67 src/sys/arch/xen/x86/cpu.c:1.68 --- src/sys/arch/xen/x86/cpu.c:1.67 Thu Oct 6 06:56:30 2011 +++ src/sys/arch/xen/x86/cpu.c Thu Oct 20 13:21:11 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.67 2011/10/06 06:56:30 mrg Exp $ */ +/* $NetBSD: cpu.c,v 1.68 2011/10/20 13:21:11 jruoho Exp $ */ /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp */ /*- @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.67 2011/10/06 06:56:30 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.68 2011/10/20 13:21:11 jruoho Exp $); #include opt_ddb.h #include opt_multiprocessor.h @@ -535,11 +535,6 @@ cpu_attach_common(device_t parent, devic pat_init(ci); atomic_or_32(cpus_attached, ci-ci_cpumask); -#if 0 - if (!pmf_device_register(self, cpu_suspend, cpu_resume)) - aprint_error_dev(self, couldn't establish power handler\n); -#endif - #ifdef MPVERBOSE if (mp_verbose) { struct lwp *l = ci-ci_data.cpu_idlelwp; @@ -1132,72 +1127,6 @@ cpu_offline_md(void) splx(s); } -#if 0 -/* XXX joerg restructure and restart CPUs individually */ -static bool -cpu_suspend(device_t dv, const pmf_qual_t *qual) -{ - struct cpu_softc *sc = device_private(dv); - struct cpu_info *ci = sc-sc_info; - int err; - - if ((ci-ci_flags CPUF_PRESENT) == 0) - return true; - - cpufreq_suspend(ci); - - if ((ci-ci_flags CPUF_PRIMARY) != 0) - return true; - - if (ci-ci_data.cpu_idlelwp == NULL) - return true; - - sc-sc_wasonline = !(ci-ci_schedstate.spc_flags SPCF_OFFLINE); - - if (sc-sc_wasonline) { - mutex_enter(cpu_lock); - err = cpu_setstate(ci, false); - mutex_exit(cpu_lock); - - if (err != 0) - return false; - } - - return true; -} - -static bool -cpu_resume(device_t dv, const pmf_qual_t *qual) -{ - struct cpu_softc *sc = device_private(dv); - struct cpu_info *ci = sc-sc_info; - int err = 0; - - if ((ci-ci_flags CPUF_PRESENT) == 0) - return true; - - if ((ci-ci_flags CPUF_PRIMARY) != 0) - goto out; - - if (ci-ci_data.cpu_idlelwp == NULL) - goto out; - - if (sc-sc_wasonline) { - mutex_enter(cpu_lock); - err = cpu_setstate(ci, true); - mutex_exit(cpu_lock); - } - -out: - if (err != 0) - return false; - - cpufreq_resume(ci); - - return true; -} -#endif - void cpu_get_tsc_freq(struct cpu_info *ci) {
CVS commit: src/share/man/man4/man4.x86
Module Name:src Committed By: jruoho Date: Thu Oct 20 13:54:39 UTC 2011 Modified Files: src/share/man/man4/man4.x86: est.4 Log Message: Add the relevant datasheets to SEE ALSO. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/man4.x86/est.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/man4.x86/est.4 diff -u src/share/man/man4/man4.x86/est.4:1.3 src/share/man/man4/man4.x86/est.4:1.4 --- src/share/man/man4/man4.x86/est.4:1.3 Fri Mar 4 05:58:07 2011 +++ src/share/man/man4/man4.x86/est.4 Thu Oct 20 13:54:38 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: est.4,v 1.3 2011/03/04 05:58:07 jruoho Exp $ +.\ $NetBSD: est.4,v 1.4 2011/10/20 13:54:38 jruoho Exp $ .\ .\ Copyright (c) 2011 Jukka Ruohonen jruoho...@iki.fi .\ All rights reserved. @@ -24,7 +24,7 @@ .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\ POSSIBILITY OF SUCH DAMAGE. .\ -.Dd March 4, 2011 +.Dd October 20, 2011 .Dt EST 4 .Os .Sh NAME @@ -59,6 +59,20 @@ not guaranteed to exist in the future ve .Xr acpicpu 4 , .Xr odcm 4 , .Xr powernow 4 +.Rs +.%A Intel Corporation +.%T Intel Pentium M Processor. +.%T Datasheet +.%D March, 2004 +.%U http://download.intel.com/support/processors/mobile/pm/sb/25261203.pdf +.Re +.Rs +.%A Intel Corporation +.%T Enhanced Intel SpeedStep Technology for the Intel Pentium M Processor. +.%T White Paper +.%D March, 2004 +.%U http://download.intel.com/design/network/papers/30117401.pdf +.Re .Sh CAVEATS The .Nm
CVS commit: src/sys/kern
Module Name:src Committed By: njoly Date: Thu Oct 20 18:18:21 UTC 2011 Modified Files: src/sys/kern: sys_pipe.c Log Message: Do call fd_set_exclose() on both file descriptors, to set the close-on-exec flag. To generate a diff of this commit: cvs rdiff -u -r1.133 -r1.134 src/sys/kern/sys_pipe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/sys_pipe.c diff -u src/sys/kern/sys_pipe.c:1.133 src/sys/kern/sys_pipe.c:1.134 --- src/sys/kern/sys_pipe.c:1.133 Wed Oct 5 13:30:24 2011 +++ src/sys/kern/sys_pipe.c Thu Oct 20 18:18:21 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_pipe.c,v 1.133 2011/10/05 13:30:24 apb Exp $ */ +/* $NetBSD: sys_pipe.c,v 1.134 2011/10/20 18:18:21 njoly Exp $ */ /*- * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: sys_pipe.c,v 1.133 2011/10/05 13:30:24 apb Exp $); +__KERNEL_RCSID(0, $NetBSD: sys_pipe.c,v 1.134 2011/10/20 18:18:21 njoly Exp $); #include sys/param.h #include sys/systm.h @@ -271,6 +271,7 @@ pipe1(struct lwp *l, register_t *retval, rf-f_type = DTYPE_PIPE; rf-f_data = (void *)rpipe; rf-f_ops = pipeops; + fd_set_exclose(l, fd, (flags O_CLOEXEC) != 0); error = fd_allocfile(wf, fd); if (error) @@ -280,6 +281,7 @@ pipe1(struct lwp *l, register_t *retval, wf-f_type = DTYPE_PIPE; wf-f_data = (void *)wpipe; wf-f_ops = pipeops; + fd_set_exclose(l, fd, (flags O_CLOEXEC) != 0); rpipe-pipe_peer = wpipe; wpipe-pipe_peer = rpipe;
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: njoly Date: Thu Oct 20 18:20:30 UTC 2011 Modified Files: src/tests/lib/libc/sys: t_pipe.c Log Message: New testcase that check for close-on-exec flag on pipe2 syscall. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_pipe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_pipe.c diff -u src/tests/lib/libc/sys/t_pipe.c:1.1 src/tests/lib/libc/sys/t_pipe.c:1.2 --- src/tests/lib/libc/sys/t_pipe.c:1.1 Sat Oct 15 06:17:02 2011 +++ src/tests/lib/libc/sys/t_pipe.c Thu Oct 20 18:20:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: t_pipe.c,v 1.1 2011/10/15 06:17:02 jruoho Exp $ */ +/* $NetBSD: t_pipe.c,v 1.2 2011/10/20 18:20:30 njoly Exp $ */ /*- * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. @@ -29,12 +29,13 @@ #include sys/cdefs.h __COPYRIGHT(@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved.); -__RCSID($NetBSD: t_pipe.c,v 1.1 2011/10/15 06:17:02 jruoho Exp $); +__RCSID($NetBSD: t_pipe.c,v 1.2 2011/10/20 18:20:30 njoly Exp $); #include sys/types.h #include sys/wait.h #include errno.h +#include fcntl.h #include poll.h #include sched.h #include signal.h @@ -154,9 +155,34 @@ ATF_TC_BODY(pipe_restart, tc) } } +ATF_TC(pipe2_cloexec); +ATF_TC_HEAD(pipe2_cloexec, tc) +{ + atf_tc_set_md_var(tc, descr, Check pipe2(2) with O_CLOEXEC); +} + +ATF_TC_BODY(pipe2_cloexec, tc) +{ + int flag, fildes[2]; + + ATF_REQUIRE(pipe2(fildes, O_CLOEXEC) != -1); + + flag = fcntl(fildes[0], F_GETFD); + ATF_REQUIRE(flag != -1); + ATF_CHECK((flag FD_CLOEXEC) != 0); + + flag = fcntl(fildes[1], F_GETFD); + ATF_REQUIRE(flag != -1); + ATF_CHECK((flag FD_CLOEXEC) != 0); + + ATF_REQUIRE(close(fildes[0]) != -1); + ATF_REQUIRE(close(fildes[1]) != -1); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, pipe_restart); + ATF_TP_ADD_TC(tp, pipe2_cloexec); return atf_no_error(); }
CVS commit: src/sys
Module Name:src Committed By: jmcneill Date: Thu Oct 20 20:13:55 UTC 2011 Modified Files: src/sys/arch/x86/x86: vmt.c src/sys/modules/vmt: Makefile Log Message: mark vm_reg members as volatile instead of building this with -O0 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/x86/vmt.c cvs rdiff -u -r1.1 -r1.2 src/sys/modules/vmt/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/x86/vmt.c diff -u src/sys/arch/x86/x86/vmt.c:1.5 src/sys/arch/x86/x86/vmt.c:1.6 --- src/sys/arch/x86/x86/vmt.c:1.5 Tue Oct 18 21:41:25 2011 +++ src/sys/arch/x86/x86/vmt.c Thu Oct 20 20:13:55 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vmt.c,v 1.5 2011/10/18 21:41:25 jmcneill Exp $ */ +/* $NetBSD: vmt.c,v 1.6 2011/10/20 20:13:55 jmcneill Exp $ */ /* $OpenBSD: vmt.c,v 1.11 2011/01/27 21:29:25 dtucker Exp $ */ /* @@ -151,14 +151,15 @@ union vm_reg { } __packed; /* A register frame. */ +/* XXX 'volatile' as a workaround because BACKDOOR_OP is likely broken */ struct vm_backdoor { - union vm_reg eax; - union vm_reg ebx; - union vm_reg ecx; - union vm_reg edx; - union vm_reg esi; - union vm_reg edi; - union vm_reg ebp; + volatile union vm_reg eax; + volatile union vm_reg ebx; + volatile union vm_reg ecx; + volatile union vm_reg edx; + volatile union vm_reg esi; + volatile union vm_reg edi; + volatile union vm_reg ebp; } __packed; /* RPC context. */ Index: src/sys/modules/vmt/Makefile diff -u src/sys/modules/vmt/Makefile:1.1 src/sys/modules/vmt/Makefile:1.2 --- src/sys/modules/vmt/Makefile:1.1 Mon Oct 17 22:39:23 2011 +++ src/sys/modules/vmt/Makefile Thu Oct 20 20:13:54 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1 2011/10/17 22:39:23 jmcneill Exp $ +# $NetBSD: Makefile,v 1.2 2011/10/20 20:13:54 jmcneill Exp $ .include ../Makefile.inc @@ -7,7 +7,6 @@ KMOD= vmt IOCONF= vmt.ioconf SRCS= vmt.c -COPTS.vmt.c= -O0 WARNS= 4
CVS commit: src/sys/dev/pci
Module Name:src Committed By: macallan Date: Thu Oct 20 22:04:10 UTC 2011 Modified Files: src/sys/dev/pci: voyager.c Log Message: include opt_voyager.h To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/voyager.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/voyager.c diff -u src/sys/dev/pci/voyager.c:1.5 src/sys/dev/pci/voyager.c:1.6 --- src/sys/dev/pci/voyager.c:1.5 Tue Oct 18 17:57:40 2011 +++ src/sys/dev/pci/voyager.c Thu Oct 20 22:04:10 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: voyager.c,v 1.5 2011/10/18 17:57:40 macallan Exp $ */ +/* $NetBSD: voyager.c,v 1.6 2011/10/20 22:04:10 macallan Exp $ */ /* * Copyright (c) 2009, 2011 Michael Lorenz @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: voyager.c,v 1.5 2011/10/18 17:57:40 macallan Exp $); +__KERNEL_RCSID(0, $NetBSD: voyager.c,v 1.6 2011/10/20 22:04:10 macallan Exp $); #include sys/param.h #include sys/systm.h @@ -49,6 +49,8 @@ __KERNEL_RCSID(0, $NetBSD: voyager.c,v #include dev/pci/voyagervar.h +#include opt_voyager.h + #ifdef VOYAGER_DEBUG #define DPRINTF aprint_normal #else
CVS commit: src/tests/lib/libc/regex
Module Name:src Committed By: christos Date: Fri Oct 21 00:41:35 UTC 2011 Modified Files: src/tests/lib/libc/regex: t_exhaust.c Log Message: simplify. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/regex/t_exhaust.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/regex/t_exhaust.c diff -u src/tests/lib/libc/regex/t_exhaust.c:1.1 src/tests/lib/libc/regex/t_exhaust.c:1.2 --- src/tests/lib/libc/regex/t_exhaust.c:1.1 Sun Oct 9 14:21:08 2011 +++ src/tests/lib/libc/regex/t_exhaust.c Thu Oct 20 20:41:34 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: t_exhaust.c,v 1.1 2011/10/09 18:21:08 christos Exp $ */ +/* $NetBSD: t_exhaust.c,v 1.2 2011/10/21 00:41:34 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: t_exhaust.c,v 1.1 2011/10/09 18:21:08 christos Exp $); +__RCSID($NetBSD: t_exhaust.c,v 1.2 2011/10/21 00:41:34 christos Exp $); #include stdio.h #include regex.h @@ -178,12 +178,12 @@ ATF_TC_BODY(regcomp_too_big, tc) char *d = (*patterns[i])(); e = regcomp(re, d, i == 6 ? REG_BASIC : REG_EXTENDED); free(d); - if (e != 0) + if (e) { ATF_REQUIRE_MSG(e == REG_ESPACE, regcomp returned %d for pattern %zu, e, i); - if (e) continue; - e = regexec(re, , 0, NULL, 0); + } + (void)regexec(re, , 0, NULL, 0); regfree(re); } }
CVS commit: src/lib/libutil
Module Name:src Committed By: christos Date: Fri Oct 21 01:37:59 UTC 2011 Modified Files: src/lib/libutil: Makefile Log Message: Don't use = to assing SRCS, but += so that we can remove snprintb.c, which was added elsewhere. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/lib/libutil/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libutil/Makefile diff -u src/lib/libutil/Makefile:1.66 src/lib/libutil/Makefile:1.67 --- src/lib/libutil/Makefile:1.66 Tue Aug 30 08:39:52 2011 +++ src/lib/libutil/Makefile Thu Oct 20 21:37:59 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.66 2011/08/30 12:39:52 bouyer Exp $ +# $NetBSD: Makefile,v 1.67 2011/10/21 01:37:59 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 USE_SHLIBDIR= yes @@ -10,7 +10,7 @@ USE_SHLIBDIR= yes WARNS= 4 LIB= util CPPFLAGS+=-DLIBC_SCCS -I${.CURDIR} -SRCS= efun.c getbootfile.c getlabelsector.c getmaxpartitions.c \ +SRCS+= efun.c getbootfile.c getlabelsector.c getmaxpartitions.c \ getmntopts.c getrawpartition.c \ disklabel_dkcksum.c disklabel_scan.c \ if_media.c \ @@ -18,7 +18,7 @@ SRCS= efun.c getbootfile.c getlabelsecto logwtmp.c logwtmpx.c opendisk.c parsedate.y \ passwd.c pw_scan.c pidfile.c pidlock.c pty.c \ raise_default_signal.c \ - secure_path.c snprintb.c sockaddr_snprintf.c stat_flags.c \ + secure_path.c sockaddr_snprintf.c stat_flags.c \ strpct.c ttyaction.c ttymsg.c MAN= efun.3 getbootfile.3 getlabelsector.3 getmaxpartitions.3 \
CVS commit: src/lib/libutil
Module Name:src Committed By: christos Date: Fri Oct 21 02:05:36 UTC 2011 Modified Files: src/lib/libutil: Makefile Log Message: Add proc_compare To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/lib/libutil/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libutil/Makefile diff -u src/lib/libutil/Makefile:1.67 src/lib/libutil/Makefile:1.68 --- src/lib/libutil/Makefile:1.67 Thu Oct 20 21:37:59 2011 +++ src/lib/libutil/Makefile Thu Oct 20 22:05:36 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.67 2011/10/21 01:37:59 christos Exp $ +# $NetBSD: Makefile,v 1.68 2011/10/21 02:05:36 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 USE_SHLIBDIR= yes @@ -27,7 +27,7 @@ MAN= efun.3 getbootfile.3 getlabelsector login.3 login_cap.3 loginx.3 \ disklabel_dkcksum.3 disklabel_scan.3 \ opendisk.3 openpty.3 parsedate.3 pidfile.3 pidlock.3 \ - pw_getconf.3 pw_init.3 pw_lock.3 secure_path.3 \ + proc_compare.3 pw_getconf.3 pw_init.3 pw_lock.3 secure_path.3 \ raise_default_signal.3 \ snprintb.3 sockaddr_snprintf.3 stat_flags.3 strpct.3 ttyaction.3 \ ttymsg.3 util.3
CVS commit: src/sys/sys
Module Name:src Committed By: christos Date: Fri Oct 21 02:07:07 UTC 2011 Modified Files: src/sys/sys: proc.h sysctl.h Log Message: add proc_compare prototype. To generate a diff of this commit: cvs rdiff -u -r1.310 -r1.311 src/sys/sys/proc.h cvs rdiff -u -r1.196 -r1.197 src/sys/sys/sysctl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/proc.h diff -u src/sys/sys/proc.h:1.310 src/sys/sys/proc.h:1.311 --- src/sys/sys/proc.h:1.310 Fri Sep 2 16:10:19 2011 +++ src/sys/sys/proc.h Thu Oct 20 22:07:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.310 2011/09/02 20:10:19 christos Exp $ */ +/* $NetBSD: proc.h,v 1.311 2011/10/21 02:07:07 christos Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -507,6 +507,8 @@ void proc_initspecific(struct proc *); void proc_finispecific(struct proc *); void * proc_getspecific(struct proc *, specificdata_key_t); void proc_setspecific(struct proc *, specificdata_key_t, void *); +int proc_compare(const struct proc *, const struct lwp *, +const struct proc *, const struct lwp *); int proclist_foreach_call(struct proclist *, int (*)(struct proc *, void *arg), void *); Index: src/sys/sys/sysctl.h diff -u src/sys/sys/sysctl.h:1.196 src/sys/sys/sysctl.h:1.197 --- src/sys/sys/sysctl.h:1.196 Wed Oct 12 19:04:22 2011 +++ src/sys/sys/sysctl.h Thu Oct 20 22:07:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sysctl.h,v 1.196 2011/10/12 23:04:22 dholland Exp $ */ +/* $NetBSD: sysctl.h,v 1.197 2011/10/21 02:07:07 christos Exp $ */ /* * Copyright (c) 1989, 1993 @@ -1219,6 +1219,8 @@ int sysctlbyname(const char *, void *, s int sysctlgetmibinfo(const char *, int *, u_int *, char *, size_t *, struct sysctlnode **, int); int sysctlnametomib(const char *, int *, size_t *); +int proc_compare(const struct kinfo_proc2 *, const struct kinfo_lwp *, +const struct kinfo_proc2 *, const struct kinfo_lwp *); __END_DECLS #endif /* !_KERNEL */
CVS commit: src/sys/kern
Module Name:src Committed By: christos Date: Fri Oct 21 02:08:10 UTC 2011 Modified Files: src/sys/kern: tty.c Log Message: extract broken proc_compare. lwp compares against self. To generate a diff of this commit: cvs rdiff -u -r1.248 -r1.249 src/sys/kern/tty.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/tty.c diff -u src/sys/kern/tty.c:1.248 src/sys/kern/tty.c:1.249 --- src/sys/kern/tty.c:1.248 Fri Sep 23 20:05:38 2011 +++ src/sys/kern/tty.c Thu Oct 20 22:08:09 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: tty.c,v 1.248 2011/09/24 00:05:38 christos Exp $ */ +/* $NetBSD: tty.c,v 1.249 2011/10/21 02:08:09 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tty.c,v 1.248 2011/09/24 00:05:38 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: tty.c,v 1.249 2011/10/21 02:08:09 christos Exp $); #include sys/param.h #include sys/systm.h @@ -99,7 +99,7 @@ static void ttyecho(int, struct tty *); static void ttyrubo(struct tty *, int); static void ttyprintf_nolock(struct tty *, const char *fmt, ...) __attribute__((__format__(__printf__,2,3))); -static int proc_compare(struct proc *, struct proc *); +static int proc_compare_wrapper(struct proc *, struct proc *); static void ttysigintr(void *); /* Symbolic sleep message strings. */ @@ -2488,7 +2488,7 @@ ttygetinfo(struct tty *tp, int fromsig, } else mutex_enter(p-p_lock); oldpick = pick; - if (proc_compare(pick, p)) + if (proc_compare_wrapper(pick, p)) pick = p; mutex_exit(p-p_lock); if (p-p_lock != oldpick-p_lock) @@ -2594,26 +2594,11 @@ ttyputinfo(struct tty *tp, char *buf) } /* - * Returns 1 if p2 is better than p1 - * - * The algorithm for picking the interesting process is thus: - * - * 1) Only foreground processes are eligible - implied. - * 2) Runnable processes are favored over anything else. The runner - * with the highest CPU utilization is picked (l_pctcpu). Ties are - * broken by picking the highest pid. - * 3) The sleeper with the shortest sleep time is next. With ties, - * we pick out just short-term sleepers (P_SINTR == 0). - * 4) Further ties are broken by picking the highest pid. - */ -#define ISRUN(p) ((p)-p_nrlwps 0) -#define TESTAB(a, b) ((a)1 | (b)) -#define ONLYA 2 -#define ONLYB 1 -#define BOTH 3 - + * Returns 1 if p2 has a better chance being the active foreground process + * in a terminal instead of p1. + */ static int -proc_compare(struct proc *p1, struct proc *p2) +proc_compare_wrapper(struct proc *p1, struct proc *p2) { lwp_t *l1, *l2; @@ -2621,51 +2606,12 @@ proc_compare(struct proc *p1, struct pro KASSERT(mutex_owned(p2-p_lock)); if ((l1 = LIST_FIRST(p1-p_lwps)) == NULL) - return (1); + return 1; + if ((l2 = LIST_FIRST(p2-p_lwps)) == NULL) - return (0); - /* - * see if at least one of them is runnable - */ - switch (TESTAB(ISRUN(p1), ISRUN(p2))) { - case ONLYA: - return (0); - case ONLYB: - return (1); - case BOTH: - /* - * tie - favor one with highest recent CPU utilization - */ - if (l2-l_pctcpu l1-l_pctcpu) - return (1); - return (p2-p_pid p1-p_pid); /* tie - return highest pid */ - } - /* - * weed out zombies - */ - switch (TESTAB(P_ZOMBIE(p1), P_ZOMBIE(p2))) { - case ONLYA: - return (1); - case ONLYB: - return (0); - case BOTH: - return (p2-p_pid p1-p_pid); /* tie - return highest pid */ - } - /* - * pick the one with the smallest sleep time - */ - if (l2-l_slptime l2-l_slptime) - return (0); - if (l2-l_slptime l2-l_slptime) - return (1); - /* - * favor one sleeping in a non-interruptible sleep - */ - if (l2-l_flag LW_SINTR (l2-l_flag LW_SINTR) == 0) - return (1); - if (l2-l_flag LW_SINTR (l2-l_flag LW_SINTR) == 0) - return (0); - return (p2-p_pid p1-p_pid); /* tie - return highest pid */ + return 0; + + return proc_compare(p1, l1, p2, l2); } /*
CVS commit: src/common/lib/libutil
Module Name:src Committed By: christos Date: Fri Oct 21 02:09:00 UTC 2011 Modified Files: src/common/lib/libutil: Makefile.inc Added Files: src/common/lib/libutil: proc_compare.c Log Message: Add a version of proc_compare that works both for kernel and userland (and uses the same algorithm!) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/common/lib/libutil/Makefile.inc cvs rdiff -u -r0 -r1.1 src/common/lib/libutil/proc_compare.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libutil/Makefile.inc diff -u src/common/lib/libutil/Makefile.inc:1.2 src/common/lib/libutil/Makefile.inc:1.3 --- src/common/lib/libutil/Makefile.inc:1.2 Tue Aug 16 06:33:17 2011 +++ src/common/lib/libutil/Makefile.inc Thu Oct 20 22:09:00 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.2 2011/08/16 10:33:17 christos Exp $ +# $NetBSD: Makefile.inc,v 1.3 2011/10/21 02:09:00 christos Exp $ .PATH.c: ${.PARSEDIR} -SRCS+= snprintb.c +SRCS+= snprintb.c proc_compare.c COPTS.snprintb.c = -Wno-format-nonliteral Added files: Index: src/common/lib/libutil/proc_compare.c diff -u /dev/null src/common/lib/libutil/proc_compare.c:1.1 --- /dev/null Thu Oct 20 22:09:00 2011 +++ src/common/lib/libutil/proc_compare.c Thu Oct 20 22:09:00 2011 @@ -0,0 +1,146 @@ +/* $NetBSD: proc_compare.c,v 1.1 2011/10/21 02:09:00 christos Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + *may be used to endorse or promote products derived from this software + *without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef _STANDALONE +# ifndef _KERNEL + +# if HAVE_NBTOOL_CONFIG_H +# include nbtool_config.h +# endif + +# include sys/cdefs.h +# if defined(LIBC_SCCS) !defined(lint) +__RCSID($NetBSD: proc_compare.c,v 1.1 2011/10/21 02:09:00 christos Exp $); +# endif + +# include sys/types.h +# include sys/inttypes.h +# include sys/sysctl.h +# include stdio.h +# include util.h +# include errno.h +# define PROC struct kinfo_proc2 +# define LWP struct kinfo_lwp +# define P_RTIME_SEC p_rtime_sec +# define P_RTIME_USEC p_rtime_usec +# else +# include sys/cdefs.h +__KERNEL_RCSID(0, $NetBSD: proc_compare.c,v 1.1 2011/10/21 02:09:00 christos Exp $); +# include sys/param.h +# include sys/inttypes.h +# include sys/systm.h +# include sys/proc.h +# include sys/lwp.h +# include lib/libkern/libkern.h +# define PROC struct proc +# define LWP struct lwp +# define P_RTIME_SEC p_rtime.sec +# define P_RTIME_USEC p_rtime.frac +# endif +/* + * Returns 1 if p2 is better than p1 + * + * The algorithm for picking the interesting process is thus: + * + * 1) Only foreground processes are eligible - implied. + * 2) Runnable processes are favored over anything else. The runner + * with the highest CPU utilization is picked (l_pctcpu). Ties are + * broken by picking the highest pid. + * 3) The sleeper with the shortest sleep time is next. With ties, + * we pick out just short-term sleepers (P_SINTR == 0). + * 4) Further ties are broken by picking the one started last. + * 5) Finally the one with the biggest pid wins, but that is nonsense + * because of pid randomization. + */ +#define ISRUN(p) ((p)-p_nrlwps 0) +#define TESTAB(a, b) (((a) 1) | (b)) +#define ONLYA 2 +#define ONLYB 1 +#define BOTH 3 + +int +proc_compare(const PROC *p1, const LWP *l1, const PROC *p2, const LWP *l2) +{ + /* + * see if at least one of them is runnable + */ + switch (TESTAB(ISRUN(p1),
CVS commit: src/distrib/sets/lists/comp
Module Name:src Committed By: christos Date: Fri Oct 21 02:11:19 UTC 2011 Modified Files: src/distrib/sets/lists/comp: mi Log Message: Add proc_compare.3 To generate a diff of this commit: cvs rdiff -u -r1.1694 -r1.1695 src/distrib/sets/lists/comp/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.1694 src/distrib/sets/lists/comp/mi:1.1695 --- src/distrib/sets/lists/comp/mi:1.1694 Mon Oct 17 10:20:54 2011 +++ src/distrib/sets/lists/comp/mi Thu Oct 20 22:11:18 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1694 2011/10/17 14:20:54 chs Exp $ +# $NetBSD: mi,v 1.1695 2011/10/21 02:11:18 christos Exp $ # # Note: don't delete entries from here - mark them as obsolete instead. # @@ -8172,6 +8172,7 @@ ./usr/share/man/cat3/ppath_set_object.0 comp-c-catman .cat ./usr/share/man/cat3/ppath_set_uint64.0 comp-c-catman .cat ./usr/share/man/cat3/ppath_subpath.0 comp-c-catman .cat +./usr/share/man/cat3/proc_compare.0 comp-c-catman .cat ./usr/share/man/cat3/prop_array.0 comp-c-catman .cat ./usr/share/man/cat3/prop_array_add.0 comp-c-catman .cat ./usr/share/man/cat3/prop_array_capacity.0 comp-c-catman .cat @@ -14350,6 +14351,7 @@ ./usr/share/man/html3/ppath_set_object.html comp-c-htmlman html ./usr/share/man/html3/ppath_set_uint64.html comp-c-htmlman html ./usr/share/man/html3/ppath_subpath.html comp-c-htmlman html +./usr/share/man/html3/proc_compare.html comp-c-htmlman html ./usr/share/man/html3/prop_array.html comp-c-htmlman html ./usr/share/man/html3/prop_array_add.html comp-c-htmlman html ./usr/share/man/html3/prop_array_capacity.html comp-c-htmlman html @@ -20520,6 +20522,7 @@ ./usr/share/man/man3/ppath_set_object.3 comp-c-man .man ./usr/share/man/man3/ppath_set_uint64.3 comp-c-man .man ./usr/share/man/man3/ppath_subpath.3 comp-c-man .man +./usr/share/man/man3/proc_compare.3 comp-c-man .man ./usr/share/man/man3/prop_array.3 comp-c-man .man ./usr/share/man/man3/prop_array_add.3 comp-c-man .man ./usr/share/man/man3/prop_array_capacity.3 comp-c-man .man
CVS commit: src/usr.bin/w
Module Name:src Committed By: christos Date: Fri Oct 21 02:26:09 UTC 2011 Modified Files: src/usr.bin/w: Makefile extern.h w.c Removed Files: src/usr.bin/w: proc_compare.c Log Message: Remove stale proc_compare code and use the shared one in libutil. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.bin/w/Makefile cvs rdiff -u -r1.6 -r1.7 src/usr.bin/w/extern.h cvs rdiff -u -r1.14 -r0 src/usr.bin/w/proc_compare.c cvs rdiff -u -r1.75 -r1.76 src/usr.bin/w/w.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/w/Makefile diff -u src/usr.bin/w/Makefile:1.20 src/usr.bin/w/Makefile:1.21 --- src/usr.bin/w/Makefile:1.20 Wed Aug 17 09:48:11 2011 +++ src/usr.bin/w/Makefile Thu Oct 20 22:26:09 2011 @@ -1,13 +1,13 @@ -# $NetBSD: Makefile,v 1.20 2011/08/17 13:48:11 christos Exp $ +# $NetBSD: Makefile,v 1.21 2011/10/21 02:26:09 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 6/6/93 .include bsd.own.mk PROG= w -SRCS= fmt.c pr_time.c proc_compare.c w.c +SRCS= fmt.c pr_time.c w.c MAN= w.1 uptime.1 -DPADD= ${LIBKVM} -LDADD= -lkvm +DPADD= ${LIBKVM} ${LIBUTIL} +LDADD= -lkvm -lutil LINKS= ${BINDIR}/w ${BINDIR}/uptime CPPFLAGS+= -DSUPPORT_UTMP -DSUPPORT_UTMPX Index: src/usr.bin/w/extern.h diff -u src/usr.bin/w/extern.h:1.6 src/usr.bin/w/extern.h:1.7 --- src/usr.bin/w/extern.h:1.6 Thu Aug 7 07:17:12 2003 +++ src/usr.bin/w/extern.h Thu Oct 20 22:26:09 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.6 2003/08/07 11:17:12 agc Exp $ */ +/* $NetBSD: extern.h,v 1.7 2011/10/21 02:26:09 christos Exp $ */ /*- * Copyright (c) 1993 @@ -36,4 +36,3 @@ void fmt_puts(char *, int *); void fmt_putc(int, int *); void pr_attime(time_t *, time_t *); void pr_idle(time_t); -int proc_compare(struct kinfo_proc2 *, struct kinfo_proc2 *); Index: src/usr.bin/w/w.c diff -u src/usr.bin/w/w.c:1.75 src/usr.bin/w/w.c:1.76 --- src/usr.bin/w/w.c:1.75 Fri Sep 16 11:39:30 2011 +++ src/usr.bin/w/w.c Thu Oct 20 22:26:09 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: w.c,v 1.75 2011/09/16 15:39:30 joerg Exp $ */ +/* $NetBSD: w.c,v 1.76 2011/10/21 02:26:09 christos Exp $ */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = @(#)w.c 8.6 (Berkeley) 6/30/94; #else -__RCSID($NetBSD: w.c,v 1.75 2011/09/16 15:39:30 joerg Exp $); +__RCSID($NetBSD: w.c,v 1.76 2011/10/21 02:26:09 christos Exp $); #endif #endif /* not lint */ @@ -120,6 +120,8 @@ struct entry { static void pr_args(struct kinfo_proc2 *); static void pr_header(time_t *, int); +static int proc_compare_wrapper(const struct kinfo_proc2 *, +const struct kinfo_proc2 *); #if defined(SUPPORT_UTMP) || defined(SUPPORT_UTMPX) static int ttystat(const char *, struct stat *); static void process(struct entry *); @@ -302,9 +304,6 @@ main(int argc, char **argv) /* Include trailing space because TTY header starts one column early. */ for (i = 0; i nentries; i++, kp++) { - if (kp-p_stat == SIDL || kp-p_stat == SZOMB) - continue; - for (ep = ehead; ep != NULL; ep = ep-next) { if (ep-tdev != 0 ep-tdev == kp-p_tdev kp-p__pgid == kp-p_tpgid) { @@ -312,7 +311,7 @@ main(int argc, char **argv) * Proc is in foreground of this * terminal */ -if (proc_compare(ep-tp, kp)) +if (proc_compare_wrapper(ep-tp, kp)) ep-tp = kp; break; } @@ -618,6 +617,27 @@ process(struct entry *ep) } #endif +static int +proc_compare_wrapper(const struct kinfo_proc2 *p1, +const struct kinfo_proc2 *p2) +{ + struct kinfo_lwp *l1, *l2; + int cnt; + + if (p1 == NULL) + return 1; + + l1 = kvm_getlwps(kd, p1-p_pid, 0, sizeof(*l1), cnt); + if (l1 == NULL || cnt == 0) + return 1; + + l2 = kvm_getlwps(kd, p2-p_pid, 0, sizeof(*l1), cnt); + if (l2 == NULL || cnt == 0) + return 0; + + return proc_compare(p1, l1, p2, l2); +} + static void usage(int wcmd) {