CVS commit: src/sys/dev/acpi

2010-01-04 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Mon Jan  4 09:34:47 UTC 2010

Modified Files:
src/sys/dev/acpi: wmi_acpi.c wmi_acpivar.h

Log Message:
Cleanup:

- Provide the module declaration and use ACPI_FREE
  as well as ACPI_ALLOCATE_LOCAL_BUFFER for ACPI_DEBUG.

- Maintain the calling conventions of existing ACPI utility
  functions by initializing the output buffer for the caller
  in all applicable functions.

- Remove superfluous const correctness. Additional semantics:
  u_char - char, u_int16_t - uint16_t, and u_int64_t - uint64_t.

- Collect the validation of input parameters to a single function.

ok pgoyette@


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/wmi_acpi.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/wmi_acpivar.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/dev/acpi/wmi_acpi.c
diff -u src/sys/dev/acpi/wmi_acpi.c:1.4 src/sys/dev/acpi/wmi_acpi.c:1.5
--- src/sys/dev/acpi/wmi_acpi.c:1.4	Sun Jan  3 17:53:15 2010
+++ src/sys/dev/acpi/wmi_acpi.c	Mon Jan  4 09:34:47 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wmi_acpi.c,v 1.4 2010/01/03 17:53:15 jruoho Exp $	*/
+/*	$NetBSD: wmi_acpi.c,v 1.5 2010/01/04 09:34:47 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 2009 Jukka Ruohonen jruoho...@iki.fi
@@ -27,16 +27,20 @@
  * SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wmi_acpi.c,v 1.4 2010/01/03 17:53:15 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: wmi_acpi.c,v 1.5 2010/01/04 09:34:47 jruoho Exp $);
 
 #include sys/param.h
 #include sys/device.h
 #include sys/endian.h
 #include sys/kmem.h
 
+#include dev/acpi/acpireg.h
 #include dev/acpi/acpivar.h
 #include dev/acpi/wmi_acpivar.h
 
+#define _COMPONENT  ACPI_RESOURCE_COMPONENT
+ACPI_MODULE_NAME(wmi_acpi)
+
 /*
  * This implements something called Microsoft Windows Management
  * Instrumentation (WMI). This subset of ACPI is desribed in:
@@ -97,8 +101,8 @@
 #define ACPI_WMI_FLAG_DATA  (ACPI_WMI_FLAG_EXPENSIVE |		\
 	 ACPI_WMI_FLAG_STRING)
 
-#define UGET16(x)   (*(u_int16_t *)(x))
-#define UGET64(x)   (*(u_int64_t *)(x))
+#define UGET16(x)   (*(uint16_t *)(x))
+#define UGET64(x)   (*(uint64_t *)(x))
 
 #define HEXCHAR(x)  (((x) = '0'  (x) = '9') ||			\
 	 ((x) = 'a'  (x) = 'f') ||			\
@@ -122,14 +126,14 @@
 #endif
 
 static ACPI_STATUS acpi_wmi_guid_get(struct acpi_wmi_softc *,
-   const u_char * const, struct wmi_t **);
+ const char *, struct wmi_t **);
 static voidacpi_wmi_event_add(struct acpi_wmi_softc *);
 static voidacpi_wmi_event_del(struct acpi_wmi_softc *);
 static voidacpi_wmi_event_handler(ACPI_HANDLE, uint32_t, void *);
 static boolacpi_wmi_suspend(device_t PMF_FN_PROTO);
 static boolacpi_wmi_resume(device_t PMF_FN_PROTO);
-static ACPI_STATUS acpi_wmi_enable(const ACPI_HANDLE, const char * const,
-   const bool, const bool);
+static ACPI_STATUS acpi_wmi_enable(ACPI_HANDLE, const char *, bool, bool);
+static boolacpi_wmi_input(struct wmi_t *, uint8_t, uint8_t);
 
 const char * const acpi_wmi_ids[] = {
 	PNP0C14,
@@ -229,7 +233,7 @@
 	AcpiFormatException(rv));
 
 	if (buf.Pointer != NULL)
-		AcpiOsFree(buf.Pointer);
+		ACPI_FREE(buf.Pointer);
 
 	return false;
 }
@@ -258,12 +262,12 @@
 		SIMPLEQ_INSERT_TAIL(sc-wmi_head, wmi, wmi_link);
 	}
 
-	AcpiOsFree(obj);
+	ACPI_FREE(obj);
 
 	return true;
 
 fail:
-	AcpiOsFree(obj);
+	ACPI_FREE(obj);
 	acpi_wmi_del(sc);
 
 	return false;
@@ -315,12 +319,12 @@
 
 static ACPI_STATUS
 acpi_wmi_guid_get(struct acpi_wmi_softc *sc,
-const u_char * const src, struct wmi_t **out)
+const char *src, struct wmi_t **out)
 {
 	struct wmi_t *wmi;
 	struct guid_t *guid;
-	u_char bin[16];
-	u_char hex[2];
+	char bin[16];
+	char hex[2];
 	const char *ptr;
 	uint8_t i;
 
@@ -367,7 +371,7 @@
  * can use this in their autoconf(9) routines.
  */
 int
-acpi_wmi_guid_match(device_t self, const u_char const * guid)
+acpi_wmi_guid_match(device_t self, const char *guid)
 {
 	struct acpi_wmi_softc *sc = device_private(self);
 
@@ -458,7 +462,7 @@
  * Returns extra information possibly associated with an event.
  */
 ACPI_STATUS
-acpi_wmi_event_get(device_t self, const uint32_t event, ACPI_BUFFER *obuf)
+acpi_wmi_event_get(device_t self, uint32_t event, ACPI_BUFFER *obuf)
 {
 	struct acpi_wmi_softc *sc = device_private(self);
 	struct wmi_t *wmi;
@@ -477,6 +481,9 @@
 	arg.Count = 0x01;
 	arg.Pointer = obj;
 
+	obuf-Pointer = NULL;
+	obuf-Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
 	SIMPLEQ_FOREACH(wmi, sc-wmi_head, wmi_link) {
 
 		if (!(wmi-guid.flags  ACPI_WMI_FLAG_EVENT))
@@ -555,8 +562,7 @@
  * Enables or disables data collection (WCxx) or an event (WExx).
  */
 static ACPI_STATUS
-acpi_wmi_enable(const 

CVS commit: src/sys/dev/acpi

2010-01-04 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Mon Jan  4 10:06:53 UTC 2010

Modified Files:
src/sys/dev/acpi: wmi_acpi.c wmi_acpivar.h

Log Message:
Update the copyright.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/acpi/wmi_acpi.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/wmi_acpivar.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/dev/acpi/wmi_acpi.c
diff -u src/sys/dev/acpi/wmi_acpi.c:1.6 src/sys/dev/acpi/wmi_acpi.c:1.7
--- src/sys/dev/acpi/wmi_acpi.c:1.6	Mon Jan  4 09:43:30 2010
+++ src/sys/dev/acpi/wmi_acpi.c	Mon Jan  4 10:06:53 2010
@@ -1,7 +1,7 @@
-/*	$NetBSD: wmi_acpi.c,v 1.6 2010/01/04 09:43:30 jruoho Exp $	*/
+/*	$NetBSD: wmi_acpi.c,v 1.7 2010/01/04 10:06:53 jruoho Exp $	*/
 
 /*-
- * Copyright (c) 2009 Jukka Ruohonen jruoho...@iki.fi
+ * Copyright (c) 2009, 2010 Jukka Ruohonen jruoho...@iki.fi
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wmi_acpi.c,v 1.6 2010/01/04 09:43:30 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: wmi_acpi.c,v 1.7 2010/01/04 10:06:53 jruoho Exp $);
 
 #include sys/param.h
 #include sys/device.h

Index: src/sys/dev/acpi/wmi_acpivar.h
diff -u src/sys/dev/acpi/wmi_acpivar.h:1.5 src/sys/dev/acpi/wmi_acpivar.h:1.6
--- src/sys/dev/acpi/wmi_acpivar.h:1.5	Mon Jan  4 09:43:30 2010
+++ src/sys/dev/acpi/wmi_acpivar.h	Mon Jan  4 10:06:53 2010
@@ -1,7 +1,7 @@
-/*	$NetBSD: wmi_acpivar.h,v 1.5 2010/01/04 09:43:30 jruoho Exp $	*/
+/*	$NetBSD: wmi_acpivar.h,v 1.6 2010/01/04 10:06:53 jruoho Exp $	*/
 
 /*-
- * Copyright (c) 2009 Jukka Ruohonen jruoho...@iki.fi
+ * Copyright (c) 2009, 2010 Jukka Ruohonen jruoho...@iki.fi
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,7 @@
 #define WMI_ACPIVAR_H
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: wmi_acpivar.h,v 1.5 2010/01/04 09:43:30 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: wmi_acpivar.h,v 1.6 2010/01/04 10:06:53 jruoho Exp $);
 
 ACPI_STATUS acpi_wmi_event_register(device_t, ACPI_NOTIFY_HANDLER);
 ACPI_STATUS acpi_wmi_event_get(device_t, uint32_t, ACPI_BUFFER *);



CVS commit: src/usr.sbin/wake

2010-01-04 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Mon Jan  4 11:34:40 UTC 2010

Modified Files:
src/usr.sbin/wake: wake.8 wake.c

Log Message:
Only use an auto-determined interface if it is the only one in the system
that is up and running.  This change prevents wake(8) from picking an
arbitrary interface (which is possibly the wrong one).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/wake/wake.8
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/wake/wake.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.sbin/wake/wake.8
diff -u src/usr.sbin/wake/wake.8:1.7 src/usr.sbin/wake/wake.8:1.8
--- src/usr.sbin/wake/wake.8:1.7	Sun Jan  3 19:04:26 2010
+++ src/usr.sbin/wake/wake.8	Mon Jan  4 11:34:39 2010
@@ -1,4 +1,4 @@
-.\ $NetBSD: wake.8,v 1.7 2010/01/03 19:04:26 wiz Exp $
+.\ $NetBSD: wake.8,v 1.8 2010/01/04 11:34:39 mbalmer Exp $
 .\
 .\ Copyright (c) 2009, 2010 Marc Balmer m...@msys.ch
 .\
@@ -14,7 +14,7 @@
 .\ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\
-.Dd January 3, 2010
+.Dd January 4, 2010
 .Dt WAKE 8
 .Os
 .Sh NAME
@@ -35,13 +35,12 @@
 and can be used to power on machines from a remote system without
 having physical access to them.
 .Pp
-If
 .Ar interface
-is an Ethernet interface of the local machine, it is used to send the
+is an Ethernet interface of the local machine and is used to send the
 Wake on LAN frames over it.
-Else
-.Nm
-uses the first Ethernet device found in the system.
+If there is only one Ethernet device available that is up and running, then the
+.Ar interface
+argument can be omitted.
 .Ar lladdr
 is the link layer address of the remote machine.
 This can be specified as the actual hardware address

Index: src/usr.sbin/wake/wake.c
diff -u src/usr.sbin/wake/wake.c:1.10 src/usr.sbin/wake/wake.c:1.11
--- src/usr.sbin/wake/wake.c:1.10	Sun Jan  3 17:58:14 2010
+++ src/usr.sbin/wake/wake.c	Mon Jan  4 11:34:39 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: wake.c,v 1.10 2010/01/03 17:58:14 mbalmer Exp $ */
+/* $NetBSD: wake.c,v 1.11 2010/01/04 11:34:39 mbalmer Exp $ */
 
 /*
  * Copyright (C) 2006, 2007, 2008, 2009, 2010 Marc Balmer m...@msys.ch
@@ -117,6 +117,7 @@
 {
 	struct ifaddrs *ifap, *ifa;
 	struct sockaddr_dl *sdl = NULL;
+	int nifs;
 
 	if (dst == NULL || len == 0)
 		return 0;
@@ -125,18 +126,18 @@
 		return -1;
 
 	/* XXX also check the link state */
-	for (ifa = ifap; ifa; ifa = ifa-ifa_next)
+	for (nifs = 0, ifa = ifap; ifa; ifa = ifa-ifa_next)
 		if (ifa-ifa_addr-sa_family == AF_LINK 
 		ifa-ifa_flags  IFF_UP  ifa-ifa_flags  IFF_RUNNING) {
 			sdl = (struct sockaddr_dl *)ifa-ifa_addr;
 			if (sdl-sdl_type == IFT_ETHER) {
 strlcpy(dst, ifa-ifa_name, len);
-break;
+nifs++;
 			}
 		}
 
 	freeifaddrs(ifap);
-	return 0;
+	return nifs == 1 ? 0 : -1;
 }
 
 static int



CVS commit: src/sys/kern

2010-01-04 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Mon Jan  4 16:01:43 UTC 2010

Modified Files:
src/sys/kern: subr_kmem.c

Log Message:
Use CTASSERT() for constant only assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/kern/subr_kmem.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/subr_kmem.c
diff -u src/sys/kern/subr_kmem.c:1.30 src/sys/kern/subr_kmem.c:1.31
--- src/sys/kern/subr_kmem.c:1.30	Mon Oct 12 23:36:02 2009
+++ src/sys/kern/subr_kmem.c	Mon Jan  4 16:01:42 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kmem.c,v 1.30 2009/10/12 23:36:02 yamt Exp $	*/
+/*	$NetBSD: subr_kmem.c,v 1.31 2010/01/04 16:01:42 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.30 2009/10/12 23:36:02 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.31 2010/01/04 16:01:42 uebayasi Exp $);
 
 #include sys/param.h
 #include sys/callback.h
@@ -161,8 +161,8 @@
 kmem_poolpage_alloc(struct pool *pool, int prflags)
 {
 
-	KASSERT(KM_SLEEP == PR_WAITOK);
-	KASSERT(KM_NOSLEEP == PR_NOWAIT);
+	CTASSERT(KM_SLEEP == PR_WAITOK);
+	CTASSERT(KM_NOSLEEP == PR_NOWAIT);
 
 	return (void *)vmem_alloc(kmem_arena, pool-pr_alloc-pa_pagesz,
 	kmf_to_vmf(prflags) | VM_INSTANTFIT);
@@ -205,8 +205,8 @@
 	if (size = kmem_cache_min  size = kmem_cache_max) {
 		kc = kmem_cache[(size + kmem_cache_mask)  kmem_cache_shift];
 		KASSERT(size = kc-kc_pa.pa_pagesz);
-		KASSERT(KM_SLEEP == PR_WAITOK);
-		KASSERT(KM_NOSLEEP == PR_NOWAIT);
+		CTASSERT(KM_SLEEP == PR_WAITOK);
+		CTASSERT(KM_NOSLEEP == PR_NOWAIT);
 		kmflags = (KM_SLEEP | KM_NOSLEEP);
 		p = pool_cache_get(kc-kc_cache, kmflags);
 	} else {



CVS commit: src

2010-01-04 Thread Adam Hamsik
Module Name:src
Committed By:   haad
Date:   Mon Jan  4 16:57:48 UTC 2010

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4: Makefile

Log Message:
Add device-mapper manual page to build and add it to apropriate lists.


To generate a diff of this commit:
cvs rdiff -u -r1.1178 -r1.1179 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.499 -r1.500 src/share/man/man4/Makefile

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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1178 src/distrib/sets/lists/man/mi:1.1179
--- src/distrib/sets/lists/man/mi:1.1178	Tue Dec 15 03:01:16 2009
+++ src/distrib/sets/lists/man/mi	Mon Jan  4 16:57:48 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1178 2009/12/15 03:01:16 mrg Exp $
+# $NetBSD: mi,v 1.1179 2010/01/04 16:57:48 haad Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -858,7 +858,8 @@
 ./usr/share/man/cat4/depca.0			man-sys-catman		.cat
 ./usr/share/man/cat4/dge.0			man-sys-catman		.cat
 ./usr/share/man/cat4/dk.0			man-sys-catman		.cat
-./usr/share/man/cat4/dmoverio.0			man-sys-catman		.cat
+./usr/share/man/cat4/dm.0			man-sys-catman		.cat
+./usr/share/man/cat4/dmoverio.0			man-sys-catman  .cat
 ./usr/share/man/cat4/dmphy.0			man-sys-catman		.cat
 ./usr/share/man/cat4/dpt.0			man-sys-catman		.cat
 ./usr/share/man/cat4/dpti.0			man-sys-catman		.cat
@@ -3489,6 +3490,7 @@
 ./usr/share/man/html4/depca.html		man-sys-htmlman		html
 ./usr/share/man/html4/dge.html			man-sys-htmlman		html
 ./usr/share/man/html4/dk.html			man-sys-htmlman		html
+./usr/share/man/html4/dm.html			man-sys-htmlman html
 ./usr/share/man/html4/dmoverio.html		man-sys-htmlman		html
 ./usr/share/man/html4/dmphy.html		man-sys-htmlman		html
 ./usr/share/man/html4/dpt.html			man-sys-htmlman		html
@@ -4654,7 +4656,7 @@
 ./usr/share/man/html8/iteconfig.html		man-sysutil-htmlman	html
 ./usr/share/man/html8/iwictl.html		man-sysutil-htmlman	html
 ./usr/share/man/html8/kadmin.html		man-krb5-htmlman	kerberos,html
-./usr/share/man/html8/kadmind.html		man-krb5-htmlman	kerberos,html
+./usr/share/man/html8/kamind.html		man-krb5-htmlman	kerberos,html
 ./usr/share/man/html8/kcm.html			man-krb5-htmlman	kerberos,html
 ./usr/share/man/html8/kdc.html			man-krb5-htmlman	kerberos,html
 ./usr/share/man/html8/kerberos.html		man-krb5-htmlman	kerberos,html
@@ -5898,6 +5900,7 @@
 ./usr/share/man/man4/depca.4			man-sys-man		.man
 ./usr/share/man/man4/dge.4			man-sys-man		.man
 ./usr/share/man/man4/dk.4			man-sys-man		.man
+./usr/share/man/man4/dm.4 			man-sys-man .man
 ./usr/share/man/man4/dmoverio.4			man-sys-man		.man
 ./usr/share/man/man4/dmphy.4			man-sys-man		.man
 ./usr/share/man/man4/dpt.4			man-sys-man		.man

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.499 src/share/man/man4/Makefile:1.500
--- src/share/man/man4/Makefile:1.499	Wed Sep 30 22:32:04 2009
+++ src/share/man/man4/Makefile	Mon Jan  4 16:57:48 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.499 2009/09/30 22:32:04 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.500 2010/01/04 16:57:48 haad Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 acpidalb.4 \
@@ -19,7 +19,7 @@
 	cec.4 cgd.4 cfb.4 ch.4 chipsfb.4 ciphy.4 ciss.4 clcs.4 clct.4 clnp.4 \
 	clockctl.4 cltp.4 cmdide.4 cmpci.4 cms.4 cnw.4 \
 	com.4 coretemp.4 crypto.4 cs80bus.4 cuda.4 cypide.4 \
-	ddb.4 ddc.4 de.4 dge.4 dk.4 dmoverio.4 \
+	ddb.4 ddc.4 de.4 dge.4 dk.4 dm.4 dmoverio.4 \
 	dmphy.4 dpt.4 dpti.4 drm.4 drum.4 \
 	eap.4 ebus.4 edc.4 elmc.4 emuxki.4 en.4 envsys.4 ep.4 esh.4 esis.4 \
 	esa.4 esiop.4 esm.4 eso.4 etherip.4 exphy.4 \



CVS commit: src/usr.bin/make

2010-01-04 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Mon Jan  4 17:05:25 UTC 2010

Modified Files:
src/usr.bin/make: main.c

Log Message:
We need to have set curdir before calling Dir_FindHereOrAbove().
We can call getcwd again if -C is used.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/usr.bin/make/main.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/make/main.c
diff -u src/usr.bin/make/main.c:1.174 src/usr.bin/make/main.c:1.175
--- src/usr.bin/make/main.c:1.174	Wed Sep  9 17:09:49 2009
+++ src/usr.bin/make/main.c	Mon Jan  4 17:05:25 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.174 2009/09/09 17:09:49 sjg Exp $	*/
+/*	$NetBSD: main.c,v 1.175 2010/01/04 17:05:25 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = $NetBSD: main.c,v 1.174 2009/09/09 17:09:49 sjg Exp $;
+static char rcsid[] = $NetBSD: main.c,v 1.175 2010/01/04 17:05:25 sjg Exp $;
 #else
 #include sys/cdefs.h
 #ifndef lint
@@ -81,7 +81,7 @@
 #if 0
 static char sccsid[] = @(#)main.c	8.3 (Berkeley) 3/19/94;
 #else
-__RCSID($NetBSD: main.c,v 1.174 2009/09/09 17:09:49 sjg Exp $);
+__RCSID($NetBSD: main.c,v 1.175 2010/01/04 17:05:25 sjg Exp $);
 #endif
 #endif /* not lint */
 #endif
@@ -393,6 +393,10 @@
 	  strerror(errno));
 exit(1);
 			}
+			if (getcwd(curdir, MAXPATHLEN) == NULL) {
+(void)fprintf(stderr, %s: %s.\n, progname, strerror(errno));
+exit(2);
+			}
 			ignorePWD = TRUE;
 			break;
 		case 'D':
@@ -509,7 +513,6 @@
 found_path, sizeof(found_path)))
 	break;		/* nothing doing */
 (void)Dir_AddDir(sysIncPath, found_path);
-
 			} else {
 (void)Dir_AddDir(sysIncPath, argvalue);
 			}
@@ -881,18 +884,20 @@
 	Main_ParseArgLine(getenv(MAKE));
 #endif
 
-	MainParseArgs(argc, argv);
-
 	/*
-	 * Find where we are (now) and take care of PWD for the automounter...
-	 * All this code is so that we know where we are when we start up
-	 * on a different machine with pmake.
+	 * Find where we are (now).
+	 * We take care of PWD for the automounter below...
 	 */
 	if (getcwd(curdir, MAXPATHLEN) == NULL) {
 		(void)fprintf(stderr, %s: %s.\n, progname, strerror(errno));
 		exit(2);
 	}
 
+	MainParseArgs(argc, argv);
+
+	/*
+	 * Verify that cwd is sane.
+	 */
 	if (stat(curdir, sa) == -1) {
 	(void)fprintf(stderr, %s: %s: %s.\n,
 		 progname, curdir, strerror(errno));
@@ -900,6 +905,8 @@
 	}
 
 	/*
+	 * All this code is so that we know where we are when we start up
+	 * on a different machine with pmake.
 	 * Overriding getcwd() with $PWD totally breaks MAKEOBJDIRPREFIX
 	 * since the value of curdir can vary depending on how we got
 	 * here.  Ie sitting at a shell prompt (shell that provides $PWD)



CVS commit: src/share/man/man9

2010-01-04 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Jan  4 18:00:26 UTC 2010

Added Files:
src/share/man/man9: pcq.9

Log Message:
Add a manual page for producer/consumer queues, pcq(9), that I derived
from some documentation written by Matt Thomas.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/share/man/man9/pcq.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/share/man/man9/pcq.9
diff -u /dev/null src/share/man/man9/pcq.9:1.1
--- /dev/null	Mon Jan  4 18:00:26 2010
+++ src/share/man/man9/pcq.9	Mon Jan  4 18:00:26 2010
@@ -0,0 +1,146 @@
+.\	$NetBSD: pcq.9,v 1.1 2010/01/04 18:00:26 dyoung Exp $
+.\ $NetBSD: pcq.9,v 1.1 2010/01/04 18:00:26 dyoung Exp $
+.\
+.\ Copyright (c) 2010 The NetBSD Foundation, Inc.
+.\ All rights reserved.
+.\
+.\ This code is derived from software contributed to The NetBSD Foundation
+.\ by Matt Thomas.
+.\
+.\ 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.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\
+.Dd January 2, 2010
+.Dt PCQ 9
+.Os
+.Sh NAME
+.Nm PCQ ,
+.Nm pcq_put ,
+.Nm pcq_peek ,
+.Nm pcq_get ,
+.Nm pcq_maxitems ,
+.Nm pcq_create ,
+.Nm pcq_destroy
+.Nd Producer/consumer queue.
+.Sh SYNOPSIS
+.In sys/pcq.h
+.Ft pcq_t *
+.Fn pcq_create size_t maxlen km_flags_t kmflags
+.Ft void
+.Fn pcq_destroy pcq_t *pcq
+.Ft void *
+.Fn pcq_get pcq_t *pcq
+.Ft size_t
+.Fn pcq_maxitems pcq_t *pcq
+.Ft void *
+.Fn pcq_peek pcq_t *pcq
+.Ft bool
+.Fn pcq_put pcq_t *pcq void *item
+.Sh DESCRIPTION
+The machine-independent
+.Nm
+framework provides producer/consumer queues.
+A queue
+.Po
+.Vt pcq_t
+.Pc
+allows multiple writers
+.Pq producers
+but only a single reader
+.Pq consumer .
+Compare-and-store operations are used to allow lockless updates.
+The consumer is expected to be protected by a mutex that covers
+the structure that the
+.Vt pcq_t
+is embedded into
+.Po
+e.g., socket lock, ifnet hwlock
+.Pc .
+These queues operate in a first-in, first-out
+.Pq FIFO
+manner.
+The act of inserting or removing an item from a
+.Vt pcq_t
+does not modify the item in any way.
+.Nm
+does not prevent an item being inserted multiple times into a single
+.Vt pcq_t .
+.Sh FUNCTIONS
+.Bl -tag -width compact
+.It Fn pcq_create maxlen kmflags
+Create a queue that can store at most
+.Fa maxlen
+items at one time.
+.Fa kmflags
+should be either
+.Dv KM_SLEEP ,
+if
+.Fn pcq_create
+should sleep until resources are available, or
+.Dv KM_NOSLEEP
+if it should return
+.Dv NULL
+if resources are unavailable.
+See
+.Xr kmem 9 .
+.It Fn pcq_destroy pcq
+Free the resources held by
+.Fa pcq .
+.It Fn pcq_get pcq
+Remove the next item to be consumed from the queue and return
+it.
+If the queue is empty,
+return
+.Dv NULL .
+.It Fn pcq_maxitems pcq
+Return the maximum number of items that the queue can store at
+any one time.
+.It Fn pcq_peek pcq
+Return the next item to be consumed from the queue but do not remove
+it from the queue.
+If the queue is empty,
+return
+.Dv NULL .
+.It Fn pcq_put pcq item
+Place an item at the end of the queue.
+If there is no room in the queue for the item, return
+.Dv false ;
+otherwise, return
+.Dv true .
+The item must not have the value of
+.Dv NULL .
+.El
+.Sh FILES
+.Bl -tag -width sys/kern/subr_pcq.c
+.It Pa sys/kern/subr_pcq.c
+.Nm
+implementation.
+.El
+.\ .Sh EXAMPLES
+.\ .Sh SEE ALSO
+.\ Cross-references should be ordered by section (low to high), then in
+.\ alphabetical order.
+.\ .Sh HISTORY
+.Sh AUTHORS
+.An Matt Thomas Aq m...@netbsd.org
+.\ .Sh CAVEATS
+.\ .Sh BUGS
+.\ .Sh SECURITY CONSIDERATIONS



CVS commit: src/sys/netbt

2010-01-04 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Mon Jan  4 19:20:05 UTC 2010

Modified Files:
src/sys/netbt: l2cap_upper.c rfcomm_upper.c sco_upper.c

Log Message:
prevent local socket address from being changed after socket is
in use (connect or listen)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/netbt/l2cap_upper.c
cvs rdiff -u -r1.12 -r1.13 src/sys/netbt/rfcomm_upper.c
cvs rdiff -u -r1.8 -r1.9 src/sys/netbt/sco_upper.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/netbt/l2cap_upper.c
diff -u src/sys/netbt/l2cap_upper.c:1.10 src/sys/netbt/l2cap_upper.c:1.11
--- src/sys/netbt/l2cap_upper.c:1.10	Fri Sep 25 19:44:57 2009
+++ src/sys/netbt/l2cap_upper.c	Mon Jan  4 19:20:05 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: l2cap_upper.c,v 1.10 2009/09/25 19:44:57 plunky Exp $	*/
+/*	$NetBSD: l2cap_upper.c,v 1.11 2010/01/04 19:20:05 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: l2cap_upper.c,v 1.10 2009/09/25 19:44:57 plunky Exp $);
+__KERNEL_RCSID(0, $NetBSD: l2cap_upper.c,v 1.11 2010/01/04 19:20:05 plunky Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -110,6 +110,9 @@
 l2cap_bind(struct l2cap_channel *chan, struct sockaddr_bt *addr)
 {
 
+	if (chan-lc_lcid != L2CAP_NULL_CID)
+		return EINVAL;
+
 	memcpy(chan-lc_laddr, addr, sizeof(struct sockaddr_bt));
 	return 0;
 }

Index: src/sys/netbt/rfcomm_upper.c
diff -u src/sys/netbt/rfcomm_upper.c:1.12 src/sys/netbt/rfcomm_upper.c:1.13
--- src/sys/netbt/rfcomm_upper.c:1.12	Sun Nov 22 19:09:16 2009
+++ src/sys/netbt/rfcomm_upper.c	Mon Jan  4 19:20:05 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rfcomm_upper.c,v 1.12 2009/11/22 19:09:16 mbalmer Exp $	*/
+/*	$NetBSD: rfcomm_upper.c,v 1.13 2010/01/04 19:20:05 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rfcomm_upper.c,v 1.12 2009/11/22 19:09:16 mbalmer Exp $);
+__KERNEL_RCSID(0, $NetBSD: rfcomm_upper.c,v 1.13 2010/01/04 19:20:05 plunky Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -106,6 +106,9 @@
 rfcomm_bind(struct rfcomm_dlc *dlc, struct sockaddr_bt *addr)
 {
 
+	if (dlc-rd_state != RFCOMM_DLC_CLOSED)
+		return EINVAL;
+
 	memcpy(dlc-rd_laddr, addr, sizeof(struct sockaddr_bt));
 	return 0;
 }

Index: src/sys/netbt/sco_upper.c
diff -u src/sys/netbt/sco_upper.c:1.8 src/sys/netbt/sco_upper.c:1.9
--- src/sys/netbt/sco_upper.c:1.8	Wed Aug  6 15:01:24 2008
+++ src/sys/netbt/sco_upper.c	Mon Jan  4 19:20:05 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: sco_upper.c,v 1.8 2008/08/06 15:01:24 plunky Exp $	*/
+/*	$NetBSD: sco_upper.c,v 1.9 2010/01/04 19:20:05 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sco_upper.c,v 1.8 2008/08/06 15:01:24 plunky Exp $);
+__KERNEL_RCSID(0, $NetBSD: sco_upper.c,v 1.9 2010/01/04 19:20:05 plunky Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -90,6 +90,9 @@
 sco_bind(struct sco_pcb *pcb, struct sockaddr_bt *addr)
 {
 
+	if (pcb-sp_link != NULL || pcb-sp_flags  SP_LISTENING)
+		return EINVAL;
+
 	bdaddr_copy(pcb-sp_laddr, addr-bt_bdaddr);
 	return 0;
 }



CVS commit: src/distrib/sets/lists/man

2010-01-04 Thread Adam Hamsik
Module Name:src
Committed By:   haad
Date:   Mon Jan  4 20:18:02 UTC 2010

Modified Files:
src/distrib/sets/lists/man: mi

Log Message:
Revert my unattended change to kadmind.html page


To generate a diff of this commit:
cvs rdiff -u -r1.1179 -r1.1180 src/distrib/sets/lists/man/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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1179 src/distrib/sets/lists/man/mi:1.1180
--- src/distrib/sets/lists/man/mi:1.1179	Mon Jan  4 16:57:48 2010
+++ src/distrib/sets/lists/man/mi	Mon Jan  4 20:18:02 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1179 2010/01/04 16:57:48 haad Exp $
+# $NetBSD: mi,v 1.1180 2010/01/04 20:18:02 haad Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -4656,7 +4656,7 @@
 ./usr/share/man/html8/iteconfig.html		man-sysutil-htmlman	html
 ./usr/share/man/html8/iwictl.html		man-sysutil-htmlman	html
 ./usr/share/man/html8/kadmin.html		man-krb5-htmlman	kerberos,html
-./usr/share/man/html8/kamind.html		man-krb5-htmlman	kerberos,html
+./usr/share/man/html8/kadmind.html		man-krb5-htmlman	kerberos,html
 ./usr/share/man/html8/kcm.html			man-krb5-htmlman	kerberos,html
 ./usr/share/man/html8/kdc.html			man-krb5-htmlman	kerberos,html
 ./usr/share/man/html8/kerberos.html		man-krb5-htmlman	kerberos,html
@@ -5900,7 +5900,7 @@
 ./usr/share/man/man4/depca.4			man-sys-man		.man
 ./usr/share/man/man4/dge.4			man-sys-man		.man
 ./usr/share/man/man4/dk.4			man-sys-man		.man
-./usr/share/man/man4/dm.4 			man-sys-man .man
+./usr/share/man/man4/dm.4			man-sys-man .man
 ./usr/share/man/man4/dmoverio.4			man-sys-man		.man
 ./usr/share/man/man4/dmphy.4			man-sys-man		.man
 ./usr/share/man/man4/dpt.4			man-sys-man		.man



CVS commit: src/lib/libpuffs

2010-01-04 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jan  4 22:04:50 UTC 2010

Modified Files:
src/lib/libpuffs: puffs_framebuf.3

Log Message:
fix typography


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/lib/libpuffs/puffs_framebuf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpuffs/puffs_framebuf.3
diff -u src/lib/libpuffs/puffs_framebuf.3:1.27 src/lib/libpuffs/puffs_framebuf.3:1.28
--- src/lib/libpuffs/puffs_framebuf.3:1.27	Sun Nov 22 18:40:26 2009
+++ src/lib/libpuffs/puffs_framebuf.3	Mon Jan  4 22:04:50 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: puffs_framebuf.3,v 1.27 2009/11/22 18:40:26 mbalmer Exp $
+.\	$NetBSD: puffs_framebuf.3,v 1.28 2010/01/04 22:04:50 pooka Exp $
 .\
 .\ Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\
@@ -89,7 +89,7 @@
 .Fc
 .Ft void
 .Fo puffs_framev_enqueue_justsend
-.Fa struct puffs_usermount *pu int fd struct puffs_framebuf *pufbuf
+.Fa struct puffs_usermount *pu int fd struct puffs_framebuf *pufbuf
 .Fa int waitreply int flags
 .Fc
 .Ft void



CVS commit: src/share/man/man9

2010-01-04 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jan  4 23:06:34 UTC 2010

Modified Files:
src/share/man/man9: pcq.9

Log Message:
Sort NAME section and removing trailing dot; remove duplicate RCS Id.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man9/pcq.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/pcq.9
diff -u src/share/man/man9/pcq.9:1.1 src/share/man/man9/pcq.9:1.2
--- src/share/man/man9/pcq.9:1.1	Mon Jan  4 18:00:26 2010
+++ src/share/man/man9/pcq.9	Mon Jan  4 23:06:34 2010
@@ -1,5 +1,4 @@
-.\	$NetBSD: pcq.9,v 1.1 2010/01/04 18:00:26 dyoung Exp $
-.\ $NetBSD: pcq.9,v 1.1 2010/01/04 18:00:26 dyoung Exp $
+.\ $NetBSD: pcq.9,v 1.2 2010/01/04 23:06:34 wiz Exp $
 .\
 .\ Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -33,13 +32,13 @@
 .Os
 .Sh NAME
 .Nm PCQ ,
-.Nm pcq_put ,
-.Nm pcq_peek ,
+.Nm pcq_create ,
+.Nm pcq_destroy ,
 .Nm pcq_get ,
 .Nm pcq_maxitems ,
-.Nm pcq_create ,
-.Nm pcq_destroy
-.Nd Producer/consumer queue.
+.Nm pcq_peek ,
+.Nm pcq_put
+.Nd Producer/consumer queue
 .Sh SYNOPSIS
 .In sys/pcq.h
 .Ft pcq_t *