Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Apr 2004 07:50:39 -0700 (PDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 50710 for review
Message-ID:  <200404091450.i39Eodtb048831@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=50710

Change 50710 by rwatson@rwatson_tislabs on 2004/04/09 07:50:39

	Integrate netperf_socket:
	
	- Various ACPI improvements. 
	- NULL-related changes to uipc_socket.c
	- wait.h name pollution reduced.

Affected files ...

.. //depot/projects/netperf_socket/sys/dev/acpica/acpi.c#13 integrate
.. //depot/projects/netperf_socket/sys/dev/acpica/acpi_package.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/acpica/acpi_powerres.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/acpica/acpi_thermal.c#6 integrate
.. //depot/projects/netperf_socket/sys/dev/acpica/acpivar.h#7 integrate
.. //depot/projects/netperf_socket/sys/dev/md/md.c#13 integrate
.. //depot/projects/netperf_socket/sys/kern/sched_ule.c#6 integrate
.. //depot/projects/netperf_socket/sys/kern/uipc_socket.c#10 integrate
.. //depot/projects/netperf_socket/sys/netatalk/aarp.c#7 integrate
.. //depot/projects/netperf_socket/sys/sys/wait.h#4 integrate

Differences ...

==== //depot/projects/netperf_socket/sys/dev/acpica/acpi.c#13 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.135 2004/04/08 16:45:12 njl Exp $
+ *	$FreeBSD: src/sys/dev/acpica/acpi.c,v 1.136 2004/04/09 06:40:03 njl Exp $
  */
 
 #include "opt_acpi.h"
@@ -1983,9 +1983,11 @@
 acpi_device_enable_wake_event(ACPI_HANDLE h)
 {
     struct acpi_softc		*sc;
+    uint32_t			gpe_bit, lowest_wake;
+    ACPI_HANDLE			handle;
     ACPI_STATUS			status;
     ACPI_BUFFER			prw_buffer;
-    ACPI_OBJECT			*res;
+    ACPI_OBJECT			*res, *res2;
 
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
@@ -1994,67 +1996,72 @@
 	return;
 
     /*
-     * _PRW object is only required for devices that have the ability
-     * to wake the system from a system sleeping state.
+     * The _PRW object (7.2.9) is only required for devices that have the
+     * ability to wake the system from a sleeping state.
      */
+    prw_buffer.Pointer = NULL;
     prw_buffer.Length = ACPI_ALLOCATE_BUFFER;
     status = AcpiEvaluateObject(h, "_PRW", NULL, &prw_buffer);
     if (ACPI_FAILURE(status))
 	return;
-
     res = (ACPI_OBJECT *)prw_buffer.Pointer;
     if (res == NULL)
 	return;
-
-    if ((res->Type != ACPI_TYPE_PACKAGE) || (res->Package.Count < 2)) {
+    if (!ACPI_PKG_VALID(res, 2))
 	goto out;
-    }
 
     /*
-     * The element 1 of the _PRW object:
-     * The lowest power system sleeping state that can be entered
-     * while still providing wake functionality.
-     * The sleeping state being entered must be greater or equal to
-     * the power state declared in element 1 of the _PRW object.
+     * Element 1 of the _PRW object:
+     * The lowest power system sleeping state that can be entered while still
+     * providing wake functionality.  The sleeping state being entered must
+     * be less than (i.e., higher power) or equal to this value.
      */
-    if (res->Package.Elements[1].Type != ACPI_TYPE_INTEGER)
+    if (acpi_PkgInt32(res, 1, &lowest_wake) != 0)
 	goto out;
-
-    if (sc->acpi_sstate > res->Package.Elements[1].Integer.Value)
+    if (sc->acpi_sstate > lowest_wake)
 	goto out;
 
     /*
-     * The element 0 of the _PRW object:
+     * Element 0 of the _PRW object:
      */
-    switch(res->Package.Elements[0].Type) {
+    switch (res->Package.Elements[0].Type) {
     case ACPI_TYPE_INTEGER:
-	/* 
+	/*
 	 * If the data type of this package element is numeric, then this
 	 * _PRW package element is the bit index in the GPEx_EN, in the
 	 * GPE blocks described in the FADT, of the enable bit that is
 	 * enabled for the wake event.
 	 */
-
-	status = AcpiEnableGpe(NULL, res->Package.Elements[0].Integer.Value,
-			       ACPI_EVENT_WAKE_ENABLE);
+	gpe_bit = res->Package.Elements[0].Integer.Value;
+	status = AcpiEnableGpe(NULL, gpe_bit, ACPI_EVENT_WAKE_ENABLE);
 	if (ACPI_FAILURE(status))
-	    printf("%s: EnableEvent Failed\n", __func__);
+	    printf("wake enable: AcpiEnableGpe failed for %u\n",
+		   gpe_bit);
 	break;
     case ACPI_TYPE_PACKAGE:
 	/*
-	 * XXX TBD
-	 *
 	 * If the data type of this package element is a package, then this
 	 * _PRW package element is itself a package containing two
-	 * elements. The first is an object reference to the GPE Block
+	 * elements.  The first is an object reference to the GPE Block
 	 * device that contains the GPE that will be triggered by the wake
-	 * event. The second element is numeric and it contains the bit
+	 * event.  The second element is numeric and it contains the bit
 	 * index in the GPEx_EN, in the GPE Block referenced by the
 	 * first element in the package, of the enable bit that is enabled for
 	 * the wake event.
+	 *
 	 * For example, if this field is a package then it is of the form:
 	 * Package() {\_SB.PCI0.ISA.GPE, 2}
 	 */
+	res2 = &res->Package.Elements[0];
+	if (!ACPI_PKG_VALID(res2, 2))
+	    goto out;
+	handle = acpi_GetReference(NULL, &res2->Package.Elements[0]);
+	if (handle == NULL || acpi_PkgInt32(res2, 1, &gpe_bit) != 0)
+	    goto out;
+	status = AcpiEnableGpe(handle, gpe_bit, ACPI_EVENT_WAKE_ENABLE);
+	if (ACPI_FAILURE(status))
+	    printf("wake enable: AcpiEnableGpe (package) failed for %u\n",
+		   gpe_bit);
 	break;
     default:
 	break;

==== //depot/projects/netperf_socket/sys/dev/acpica/acpi_package.c#2 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/acpica/acpi_package.c,v 1.2 2003/12/23 18:26:53 njl Exp $
+ * $FreeBSD: src/sys/dev/acpica/acpi_package.c,v 1.3 2004/04/09 06:40:03 njl Exp $
  */
 
 #include <sys/param.h>
@@ -123,3 +123,34 @@
 
     return (0);
 }
+
+ACPI_HANDLE
+acpi_GetReference(ACPI_HANDLE scope, ACPI_OBJECT *obj)
+{
+    ACPI_HANDLE h;
+
+    if (obj == NULL)
+	return (NULL);
+
+    switch (obj->Type) {
+    case ACPI_TYPE_LOCAL_REFERENCE:
+    case ACPI_TYPE_ANY:
+	h = obj->Reference.Handle;
+	break;
+    case ACPI_TYPE_STRING:
+	/*
+	 * The String object usually contains a fully-qualified path, so
+	 * scope can be NULL.
+	 *
+	 * XXX This may not always be the case.
+	 */
+	if (ACPI_FAILURE(AcpiGetHandle(scope, obj->String.Pointer, &h)))
+	    h = NULL;
+	break;
+    default:
+	h = NULL;
+	break;
+    }
+
+    return (h);
+}

==== //depot/projects/netperf_socket/sys/dev/acpica/acpi_powerres.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_powerres.c,v 1.19 2004/03/03 18:34:42 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_powerres.c,v 1.20 2004/04/09 06:55:50 njl Exp $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
@@ -488,30 +488,10 @@
 
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
-    /* check the object type */
-    switch (obj->Type) {
-    case ACPI_TYPE_ANY:
-	ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "building reference from %s to %s\n",
-			 acpi_name(pc->ac_consumer),
-			 acpi_name(obj->Reference.Handle)));
-	res = obj->Reference.Handle;
-	break;
-    case ACPI_TYPE_STRING:
-	ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "building reference from %s to %s\n",
-			  acpi_name(pc->ac_consumer), obj->String.Pointer));
-
-	/* Get the handle of the resource */
-	status = AcpiGetHandle(NULL, obj->String.Pointer, &res);
-	if (ACPI_FAILURE(status)) {
-	    ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS,
-			     "couldn't find power resource %s\n", 
-			     obj->String.Pointer));
-	    return_VOID;
-	}
-	break;
-    default:
+    res = acpi_GetReference(NULL, obj);
+    if (res == NULL) {
 	ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS,
-			 "can't create a power reference for object type %d\n", 
+			 "can't create a power reference for object type %d\n",
 			 obj->Type));
 	return_VOID;
     }

==== //depot/projects/netperf_socket/sys/dev/acpica/acpi_thermal.c#6 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_thermal.c,v 1.40 2004/03/05 18:06:31 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_thermal.c,v 1.41 2004/04/09 06:55:50 njl Exp $");
 
 #include "opt_acpi.h"
 #include <sys/param.h>
@@ -550,38 +550,27 @@
 static void
 acpi_tz_switch_cooler_off(ACPI_OBJECT *obj, void *arg)
 {
-    ACPI_HANDLE		cooler;
+    struct acpi_tz_softc	*sc = (struct acpi_tz_softc *)arg;
+    ACPI_HANDLE			cooler;
+    ACPI_STATUS			status;
 
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
     ACPI_ASSERTLOCK;
 
-    switch(obj->Type) {
-    case ACPI_TYPE_ANY:
-	ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n",
-			 acpi_name(obj->Reference.Handle)));
+    cooler = acpi_GetReference(NULL, obj);
+    if (cooler == NULL) {
+	ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "can't get handle\n"));
+	return_VOID;
+    }
 
-	acpi_pwr_switch_consumer(obj->Reference.Handle, ACPI_STATE_D3);
-	break;
-    case ACPI_TYPE_STRING:
-	ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n",
-			 obj->String.Pointer));
-
-	/*
-	 * Find the handle for the device and turn it off.
-	 * The String object here seems to contain a fully-qualified path, so we
-	 * don't have to search for it in our parents.
-	 *
-	 * XXX This may not always be the case.
-	 */
-	if (ACPI_SUCCESS(AcpiGetHandle(NULL, obj->String.Pointer, &cooler)))
-	    acpi_pwr_switch_consumer(cooler, ACPI_STATE_D3);
-	break;
-    default:
-	ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS,
-			 "called to handle unsupported object type %d\n",
-			 obj->Type));
-	break;
+    ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s off\n",
+		     acpi_name(cooler)));
+    status = acpi_pwr_switch_consumer(cooler, ACPI_STATE_D3);
+    if (ACPI_FAILURE(status)) {
+	ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
+		    "failed to deactivate %s - %s\n", acpi_name(cooler),
+		    AcpiFormatException(status));
     }
 
     return_VOID;
@@ -591,7 +580,7 @@
  * Given an object, verify that it's a reference to a device of some sort, 
  * and try to switch it on.
  *
- * XXX replication of off/on function code is bad, mmmkay?
+ * XXX replication of off/on function code is bad.
  */
 static void
 acpi_tz_switch_cooler_on(ACPI_OBJECT *obj, void *arg)
@@ -604,47 +593,19 @@
 
     ACPI_ASSERTLOCK;
 
-    switch(obj->Type) {
-    case ACPI_TYPE_ANY:
-	ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n",
-			 acpi_name(obj->Reference.Handle)));
+    cooler = acpi_GetReference(NULL, obj);
+    if (cooler == NULL) {
+	ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "can't get handle\n"));
+	return_VOID;
+    }
 
-	status = acpi_pwr_switch_consumer(obj->Reference.Handle, ACPI_STATE_D0);
-	if (ACPI_FAILURE(status)) {
-	    ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
-			"failed to activate %s - %s\n",
-			acpi_name(obj->Reference.Handle),
-			AcpiFormatException(status));
-	}
-	break;
-    case ACPI_TYPE_STRING:
-	ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n",
-			 obj->String.Pointer));
-
-	/*
-	 * Find the handle for the device and turn it off.
-	 * The String object here seems to contain a fully-qualified path, so we
-	 * don't have to search for it in our parents.
-	 *
-	 * XXX This may not always be the case.
-	 */
-	if (ACPI_SUCCESS(AcpiGetHandle(NULL, obj->String.Pointer, &cooler))) {
-	    status = acpi_pwr_switch_consumer(cooler, ACPI_STATE_D0);
-	    if (ACPI_FAILURE(status)) {
-		ACPI_VPRINT(sc->tz_dev,
-			    acpi_device_get_parent_softc(sc->tz_dev),
-			    "failed to activate %s - %s\n",
-			    obj->String.Pointer, AcpiFormatException(status));
-	    }
-	} else {
-	    ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
-			"couldn't find %s\n", obj->String.Pointer);
-	}
-	break;
-    default:
-	ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "unsupported object type %d\n",
-			  obj->Type));
-	break;
+    ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "called to turn %s on\n",
+		     acpi_name(cooler)));
+    status = acpi_pwr_switch_consumer(cooler, ACPI_STATE_D0);
+    if (ACPI_FAILURE(status)) {
+	ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
+		    "failed to activate %s - %s\n", acpi_name(cooler),
+		    AcpiFormatException(status));
     }
 
     return_VOID;

==== //depot/projects/netperf_socket/sys/dev/acpica/acpivar.h#7 (text+ko) ====

@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/dev/acpica/acpivar.h,v 1.59 2004/04/01 04:21:33 njl Exp $
+ *	$FreeBSD: src/sys/dev/acpica/acpivar.h,v 1.60 2004/04/09 06:53:50 njl Exp $
  */
 
 #include "bus_if.h"
@@ -360,6 +360,7 @@
 int		acpi_PkgStr(ACPI_OBJECT *res, int idx, void *dst, size_t size);
 int		acpi_PkgGas(device_t dev, ACPI_OBJECT *res, int idx, int *rid,
 			    struct resource **dst);
+ACPI_HANDLE	acpi_GetReference(ACPI_HANDLE scope, ACPI_OBJECT *obj);
 
 #if __FreeBSD_version >= 500000
 #ifndef ACPI_MAX_THREADS

==== //depot/projects/netperf_socket/sys/dev/md/md.c#13 (text+ko) ====

@@ -6,7 +6,7 @@
  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
  * ----------------------------------------------------------------------------
  *
- * $FreeBSD: src/sys/dev/md/md.c,v 1.121 2004/04/07 20:45:57 imp Exp $
+ * $FreeBSD: src/sys/dev/md/md.c,v 1.122 2004/04/09 05:12:47 imp Exp $
  *
  */
 
@@ -19,6 +19,10 @@
  * Copyright (c) 1990, 1993
  *	The Regents of the University of California.  All rights reserved.
  *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:

==== //depot/projects/netperf_socket/sys/kern/sched_ule.c#6 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.103 2004/04/04 19:12:56 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/sched_ule.c,v 1.104 2004/04/09 14:31:29 cognet Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -752,7 +752,7 @@
 	 * threshold at which we start to reassign kses has a large impact
 	 * on the overall performance of the system.  Tuned too high and
 	 * some CPUs may idle.  Too low and there will be excess migration
-	 * and context swiches.
+	 * and context switches.
 	 */
 	if (ksg->ksg_load > (ksg->ksg_cpus * 2) && kseq_idle) {
 		/*

==== //depot/projects/netperf_socket/sys/kern/uipc_socket.c#10 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/uipc_socket.c,v 1.169 2004/04/05 21:03:36 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/uipc_socket.c,v 1.170 2004/04/09 13:23:51 rwatson Exp $");
 
 #include "opt_inet.h"
 #include "opt_mac.h"
@@ -132,7 +132,7 @@
 #endif
 
 	so = uma_zalloc(socket_zone, mflags | M_ZERO);
-	if (so) {
+	if (so != NULL) {
 #ifdef MAC
 		error = mac_init_socket(so, mflags);
 		if (error != 0) {
@@ -174,7 +174,7 @@
 	else
 		prp = pffindtype(dom, type);
 
-	if (prp == 0 || prp->pr_usrreqs->pru_attach == 0)
+	if (prp == NULL || prp->pr_usrreqs->pru_attach == NULL)
 		return (EPROTONOSUPPORT);
 
 	if (jailed(cred) && jail_socket_unixiproute_only &&
@@ -291,7 +291,7 @@
 	KASSERT(so->so_count == 0, ("socket %p so_count not 0", so));
 	SOCK_LOCK_ASSERT(so);
 
-	if (so->so_pcb || (so->so_state & SS_NOFDREF) == 0) {
+	if (so->so_pcb != NULL || (so->so_state & SS_NOFDREF) == 0) {
 		SOCK_UNLOCK(so);
 		return;
 	}
@@ -365,7 +365,7 @@
 		}
 	}
 	SOCK_LOCK(so);
-	if (so->so_pcb == 0)
+	if (so->so_pcb == NULL)
 		goto discard;
 	if (so->so_state & SS_ISCONNECTED) {
 		if ((so->so_state & SS_ISDISCONNECTING) == 0) {
@@ -388,7 +388,7 @@
 		}
 	}
 drop:
-	if (so->so_pcb) {
+	if (so->so_pcb != NULL) {
 		int error2;
 		SOCK_UNLOCK(so);
 		error2 = (*so->so_proto->pr_usrreqs->pru_detach)(so);
@@ -540,7 +540,7 @@
 	int cow_send;
 #endif /* ZERO_COPY_SOCKETS */
 
-	if (uio)
+	if (uio != NULL)
 		resid = uio->uio_resid;
 	else
 		resid = top->m_pkthdr.len;
@@ -562,9 +562,9 @@
 	dontroute =
 	    (flags & MSG_DONTROUTE) && (so->so_options & SO_DONTROUTE) == 0 &&
 	    (so->so_proto->pr_flags & PR_ATOMIC);
-	if (td)
+	if (td != NULL)
 		td->td_proc->p_stats->p_ru.ru_msgsnd++;
-	if (control)
+	if (control != NULL)
 		clen = control->m_len;
 #define	snderr(errno)	{ error = (errno); goto release; }
 
@@ -592,7 +592,7 @@
 				if ((so->so_state & SS_ISCONFIRMING) == 0 &&
 				    !(resid == 0 && clen != 0))
 					snderr(ENOTCONN);
-			} else if (addr == 0)
+			} else if (addr == NULL)
 			    snderr(so->so_proto->pr_flags & PR_CONNREQUIRED ?
 				   ENOTCONN : EDESTADDRREQ);
 		}
@@ -730,8 +730,8 @@
 		    if (dontroute)
 			    so->so_options &= ~SO_DONTROUTE;
 		    clen = 0;
-		    control = 0;
-		    top = 0;
+		    control = NULL;
+		    top = NULL;
 		    mp = &top;
 		    if (error)
 			goto release;
@@ -742,9 +742,9 @@
 	sbunlock(&so->so_snd);
 out:
 	SOCKBUF_UNLOCK(&so->so_snd);
-	if (top)
+	if (top != NULL)
 		m_freem(top);
-	if (control)
+	if (control != NULL)
 		m_freem(control);
 	return (error);
 }
@@ -782,11 +782,11 @@
 	int orig_resid = uio->uio_resid;
 
 	mp = mp0;
-	if (psa)
+	if (psa != NULL)
 		*psa = 0;
-	if (controlp)
+	if (controlp != NULL)
 		*controlp = 0;
-	if (flagsp)
+	if (flagsp != NULL)
 		flags = *flagsp &~ MSG_EOR;
 	else
 		flags = 0;
@@ -824,12 +824,12 @@
 			m = m_free(m);
 		} while (uio->uio_resid && error == 0 && m);
 bad:
-		if (m)
+		if (m != NULL)
 			m_freem(m);
 		return (error);
 	}
-	if (mp)
-		*mp = (struct mbuf *)0;
+	if (mp != NULL)
+		*mp = NULL;
 	if (so->so_state & SS_ISCONFIRMING && uio->uio_resid)
 		(*pr->pr_usrreqs->pru_rcvd)(so, 0);
 
@@ -851,15 +851,15 @@
 	 * we have to do the receive in sections, and thus risk returning
 	 * a short count if a timeout or signal occurs after we start.
 	 */
-	if (m == 0 || (((flags & MSG_DONTWAIT) == 0 &&
+	if (m == NULL || (((flags & MSG_DONTWAIT) == 0 &&
 	    so->so_rcv.sb_cc < uio->uio_resid) &&
 	    (so->so_rcv.sb_cc < so->so_rcv.sb_lowat ||
 	    ((flags & MSG_WAITALL) && uio->uio_resid <= so->so_rcv.sb_hiwat)) &&
-	    m->m_nextpkt == 0 && (pr->pr_flags & PR_ATOMIC) == 0)) {
-		KASSERT(!(m == 0 && so->so_rcv.sb_cc),
+	    m->m_nextpkt == NULL && (pr->pr_flags & PR_ATOMIC) == 0)) {
+		KASSERT(!(m == NULL && so->so_rcv.sb_cc),
 		    ("m %p so->so_rcv.sb_cc %u", m, so->so_rcv.sb_cc));
 		if (so->so_error) {
-			if (m)
+			if (m != NULL)
 				goto dontblock;
 			error = so->so_error;
 			if ((flags & MSG_PEEK) == 0)
@@ -872,7 +872,7 @@
 			else
 				goto release;
 		}
-		for (; m; m = m->m_next)
+		for (; m != NULL; m = m->m_next)
 			if (m->m_type == MT_OOBDATA  || (m->m_flags & M_EOR)) {
 				m = so->so_rcv.sb_mb;
 				goto dontblock;
@@ -905,7 +905,7 @@
 	if (pr->pr_flags & PR_ADDR) {
 		KASSERT(m->m_type == MT_SONAME,
 		    ("m->m_type == %d", m->m_type));
-		if (psa) {
+		if (psa != NULL) {
 			*psa = sodupsockaddr(mtod(m, struct sockaddr *),
 					M_NOWAIT);
 			if (*psa == NULL) {
@@ -922,13 +922,13 @@
 		}
 		orig_resid = 0;
 	}
-	if (m && m->m_type == MT_CONTROL) {
+	if (m != NULL && m->m_type == MT_CONTROL) {
 		struct mbuf *cm = NULL;
 		struct mbuf **cme = &cm;
 
 		do {
 			if (flags & MSG_PEEK) {
-				if (controlp) {
+				if (controlp != NULL) {
 					SOCKBUF_UNLOCK(&so->so_rcv);
 					*controlp = m_copym(m, 0, m->m_len,
 						M_TRYWAIT);
@@ -954,9 +954,9 @@
 					m_free(m);
 				m = so->so_rcv.sb_mb;
 			}
-		} while (m && m->m_type == MT_CONTROL);
+		} while (m != NULL && m->m_type == MT_CONTROL);
 		if (cm != NULL) {
-			if (pr->pr_domain->dom_externalize) {
+			if (pr->pr_domain->dom_externalize != NULL) {
 				/*
 				 * NB: drop the lock to avoid potential LORs;
 				 * in particular unix domain sockets grab the
@@ -971,7 +971,7 @@
 		}
 		orig_resid = 0;
 	}
-	if (m) {
+	if (m != NULL) {
 		if ((flags & MSG_PEEK) == 0) {
 			m->m_nextpkt = nextrecord;
 			/*
@@ -1000,7 +1000,7 @@
 
 	moff = 0;
 	offset = 0;
-	while (m && uio->uio_resid > 0 && error == 0) {
+	while (m != NULL && uio->uio_resid > 0 && error == 0) {
 		if (m->m_type == MT_OOBDATA) {
 			if (type != MT_OOBDATA)
 				break;
@@ -1023,7 +1023,7 @@
 		 * we must note any additions to the sockbuf when we
 		 * block interrupts again.
 		 */
-		if (mp == 0) {
+		if (mp == NULL) {
 			SBLASTRECORDCHK(&so->so_rcv);
 			SBLASTMBUFCHK(&so->so_rcv);
 			SOCKBUF_UNLOCK(&so->so_rcv);
@@ -1064,16 +1064,16 @@
 			} else {
 				nextrecord = m->m_nextpkt;
 				sbfree(&so->so_rcv, m);
-				if (mp) {
+				if (mp != NULL) {
 					*mp = m;
 					mp = &m->m_next;
 					so->so_rcv.sb_mb = m = m->m_next;
-					*mp = (struct mbuf *)0;
+					*mp = NULL;
 				} else {
 					so->so_rcv.sb_mb = m_free(m);
 					m = so->so_rcv.sb_mb;
 				}
-				if (m) {
+				if (m != NULL) {
 					m->m_nextpkt = nextrecord;
 					if (nextrecord == NULL)
 						so->so_rcv.sb_lastrecord = m;
@@ -1088,7 +1088,7 @@
 			if (flags & MSG_PEEK)
 				moff += len;
 			else {
-				if (mp)
+				if (mp != NULL)
 					*mp = m_copym(m, 0, len, M_TRYWAIT);
 				m->m_data += len;
 				m->m_len -= len;
@@ -1117,15 +1117,15 @@
 		 * with a short count but without error.
 		 * Keep sockbuf locked against other readers.
 		 */
-		while (flags & MSG_WAITALL && m == 0 && uio->uio_resid > 0 &&
-		    !sosendallatonce(so) && !nextrecord) {
+		while (flags & MSG_WAITALL && m == NULL && uio->uio_resid > 0 &&
+		    !sosendallatonce(so) && nextrecord == NULL) {
 			if (so->so_error || so->so_state & SS_CANTRCVMORE)
 				break;
 			/*
 			 * Notify the protocol that some data has been
 			 * drained before blocking.
 			 */
-			if (pr->pr_flags & PR_WANTRCVD && so->so_pcb)
+			if (pr->pr_flags & PR_WANTRCVD && so->so_pcb != NULL)
 				(*pr->pr_usrreqs->pru_rcvd)(so, flags);
 			SBLASTRECORDCHK(&so->so_rcv);
 			SBLASTMBUFCHK(&so->so_rcv);
@@ -1135,18 +1135,18 @@
 				goto release;
 			}
 			m = so->so_rcv.sb_mb;
-			if (m)
+			if (m != NULL)
 				nextrecord = m->m_nextpkt;
 		}
 	}
 
-	if (m && pr->pr_flags & PR_ATOMIC) {
+	if (m != NULL && pr->pr_flags & PR_ATOMIC) {
 		flags |= MSG_TRUNC;
 		if ((flags & MSG_PEEK) == 0)
 			(void) sbdroprecord(&so->so_rcv);
 	}
 	if ((flags & MSG_PEEK) == 0) {
-		if (m == 0) {
+		if (m == NULL) {
 			/*
 			 * First part is an inline SB_EMPTY_FIXUP().  Second
 			 * part makes sure sb_lastrecord is up-to-date if
@@ -1168,7 +1168,7 @@
 	    (flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0)
 		goto restart;		/* XXX multi-counts msgs */
 
-	if (flagsp)
+	if (flagsp != NULL)
 		*flagsp |= flags;
 release:
 	sbunlock(&so->so_rcv);
@@ -1216,7 +1216,7 @@
 	    sizeof(*sb) - offsetof(struct sockbuf, sb_startzero));
 	SOCKBUF_UNLOCK(sb);
 
-	if (pr->pr_flags & PR_RIGHTS && pr->pr_domain->dom_dispose)
+	if (pr->pr_flags & PR_RIGHTS && pr->pr_domain->dom_dispose != NULL)
 		(*pr->pr_domain->dom_dispose)(asb.sb_mb);
 	sbrelease(&asb, so);
 }
@@ -1327,7 +1327,7 @@
 	if (valsize > len)
 		sopt->sopt_valsize = valsize = len;
 
-	if (sopt->sopt_td != 0)
+	if (sopt->sopt_td != NULL)
 		return (copyin(sopt->sopt_val, buf, valsize));
 
 	bcopy(sopt->sopt_val, buf, valsize);
@@ -1489,7 +1489,8 @@
 			error = ENOPROTOOPT;
 			break;
 		}
-		if (error == 0 && so->so_proto && so->so_proto->pr_ctloutput) {
+		if (error == 0 && so->so_proto != NULL &&
+		    so->so_proto->pr_ctloutput != NULL) {
 			(void) ((*so->so_proto->pr_ctloutput)
 				  (so, sopt));
 		}
@@ -1518,8 +1519,8 @@
 	 */
 	valsize = min(len, sopt->sopt_valsize);
 	sopt->sopt_valsize = valsize;
-	if (sopt->sopt_val != 0) {
-		if (sopt->sopt_td != 0)
+	if (sopt->sopt_val != NULL) {
+		if (sopt->sopt_td != NULL)
 			error = copyout(buf, sopt->sopt_val, valsize);
 		else
 			bcopy(buf, sopt->sopt_val, valsize);
@@ -1669,7 +1670,7 @@
 	int sopt_size = sopt->sopt_valsize;
 
 	MGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT, MT_DATA);
-	if (m == 0)
+	if (m == NULL)
 		return ENOBUFS;
 	if (sopt_size > MLEN) {
 		MCLGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT);
@@ -1687,12 +1688,13 @@
 
 	while (sopt_size) {
 		MGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT, MT_DATA);
-		if (m == 0) {
+		if (m == NULL) {
 			m_freem(*mp);
 			return ENOBUFS;
 		}
 		if (sopt_size > MLEN) {
-			MCLGET(m, sopt->sopt_td ? M_TRYWAIT : M_DONTWAIT);
+			MCLGET(m, sopt->sopt_td != NULL ? M_TRYWAIT :
+			    M_DONTWAIT);
 			if ((m->m_flags & M_EXT) == 0) {
 				m_freem(m);
 				m_freem(*mp);

==== //depot/projects/netperf_socket/sys/netatalk/aarp.c#7 (text+ko) ====

@@ -2,7 +2,7 @@
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
  *
- * $FreeBSD: src/sys/netatalk/aarp.c,v 1.29 2004/04/09 01:40:12 rwatson Exp $
+ * $FreeBSD: src/sys/netatalk/aarp.c,v 1.30 2004/04/09 03:17:21 rwatson Exp $
  */
 
 #include "opt_atalk.h"

==== //depot/projects/netperf_socket/sys/sys/wait.h#4 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)wait.h	8.2 (Berkeley) 7/10/94
- * $FreeBSD: src/sys/sys/wait.h,v 1.19 2004/04/07 04:19:50 imp Exp $
+ * $FreeBSD: src/sys/sys/wait.h,v 1.20 2004/04/09 13:14:32 bde Exp $
  */
 
 #ifndef _SYS_WAIT_H_
@@ -93,22 +93,21 @@
 #endif /* __BSD_VISIBLE */
 
 #ifdef _KERNEL
+struct rusage;
 int	kern_wait(struct thread *td, pid_t pid, int *status, int options,
-	    struct rusage *rusage);
-
-#else
+	    struct rusage *rup);
+#else /* !_KERNEL */
 #include <sys/types.h>
 
 __BEGIN_DECLS
-struct rusage;	/* forward declaration */
-
 pid_t	wait(int *);
 pid_t	waitpid(pid_t, int *, int);
 #if __BSD_VISIBLE
+struct rusage;
 pid_t	wait3(int *, int, struct rusage *);
 pid_t	wait4(pid_t, int *, int, struct rusage *);
 #endif
 __END_DECLS
-#endif
+#endif /* _KERNEL */
 
 #endif /* !_SYS_WAIT_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404091450.i39Eodtb048831>