From owner-p4-projects@FreeBSD.ORG Wed Nov 12 16:43:54 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3AD3A1065676; Wed, 12 Nov 2008 16:43:54 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F289D1065672 for ; Wed, 12 Nov 2008 16:43:53 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E85978FC13 for ; Wed, 12 Nov 2008 16:43:53 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id mACGhr19046712 for ; Wed, 12 Nov 2008 16:43:53 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mACGhrpT046710 for perforce@freebsd.org; Wed, 12 Nov 2008 16:43:53 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Wed, 12 Nov 2008 16:43:53 GMT Message-Id: <200811121643.mACGhrpT046710@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 152874 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Nov 2008 16:43:54 -0000 http://perforce.freebsd.org/chv.cgi?CH=152874 Change 152874 by rwatson@rwatson_cinnamon on 2008/11/12 16:43:29 BSM errors are stored in an 8-bit unsigned char, so tweak non-Solaris assignments down into that space, use u_char as the type, and don't worry about byte order conversions. Affected files ... .. //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#2 edit .. //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#2 edit Differences ... ==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#2 (text+ko) ==== @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#1 $ + * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#2 $ */ #include @@ -56,7 +56,7 @@ * error numbers, and sometimes error numbers don't exist in more than one * operating system. These routines convert between BSM and local error * number spaces, subject to the above realities. BSM error numbers are - * always stored in network byte order. + * stored in a single 8-bit character, so don't have a byte order. */ struct bsm_errors { @@ -269,11 +269,10 @@ static const int bsm_errors_count = sizeof(bsm_errors) / sizeof(bsm_errors[0]); int -au_bsm_to_errno(int bsm_error) +au_bsm_to_errno(u_char bsm_error) { int i; - bsm_error = be32toh(bsm_error); for (i = 0; i < bsm_errors_count; i++) { if (bsm_errors[i].be_bsm_error == bsm_error) return (bsm_errors[i].be_os_error); @@ -286,7 +285,7 @@ return (EINVAL); } -int +u_char au_errno_to_bsm(int error) { int i; @@ -295,5 +294,5 @@ if (bsm_errors[i].be_os_error == error) return (htobe32(bsm_errors[i].be_bsm_error)); } - return (htobe32(BSM_UNKNOWNERR)); + return (BSM_UNKNOWNERR); } ==== //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#2 (text+ko) ==== @@ -26,7 +26,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#1 $ + * $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#2 $ */ #ifndef _BSM_AUDIT_ERRNO_H_ @@ -168,26 +168,26 @@ * that these errors are added to Solaris, we will deprecate the OpenBSM * numbers in the same way we do for audit event constants. */ -#define BSM_EPROCLIM 5000 /* FreeBSD-specific. */ -#define BSM_EBADRPC 5001 /* FreeBSD-specific. */ -#define BSM_ERPCMISMATCH 5002 /* FreeBSD-specific. */ -#define BSM_EPROGUNAVAIL 5003 /* FreeBSD-specific. */ -#define BSM_EPROGMISMATCH 5004 /* FreeBSD-specific. */ -#define BSM_EPROCUNAVAIL 5005 /* FreeBSD-specific. */ -#define BSM_EFTYPE 5006 /* FreeBSD-specific. */ -#define BSM_EAUTH 5007 /* FreeBSD-specific. */ -#define BSM_ENEEDAUTH 5008 /* FreeBSD-specific. */ -#define BSM_ENOATTR 5009 /* FreeBSD-specific. */ -#define BSM_EDOOFUS 5010 /* FreeBSD-specific. */ -#define BSM_ELAST 5011 /* FreeBSD-specific. */ -#define BSM_EJUSTRETURN 5012 /* FreeBSD-specific. */ -#define BSM_ENOIOCTL 5013 /* FreeBSD-specific. */ -#define BSM_EDIRIOCTL 5014 /* FreeBSD-specific. */ +#define BSM_EPROCLIM 200 /* FreeBSD-specific. */ +#define BSM_EBADRPC 201 /* FreeBSD-specific. */ +#define BSM_ERPCMISMATCH 202 /* FreeBSD-specific. */ +#define BSM_EPROGUNAVAIL 203 /* FreeBSD-specific. */ +#define BSM_EPROGMISMATCH 204 /* FreeBSD-specific. */ +#define BSM_EPROCUNAVAIL 205 /* FreeBSD-specific. */ +#define BSM_EFTYPE 206 /* FreeBSD-specific. */ +#define BSM_EAUTH 207 /* FreeBSD-specific. */ +#define BSM_ENEEDAUTH 208 /* FreeBSD-specific. */ +#define BSM_ENOATTR 209 /* FreeBSD-specific. */ +#define BSM_EDOOFUS 210 /* FreeBSD-specific. */ +#define BSM_ELAST 211 /* FreeBSD-specific. */ +#define BSM_EJUSTRETURN 212 /* FreeBSD-specific. */ +#define BSM_ENOIOCTL 213 /* FreeBSD-specific. */ +#define BSM_EDIRIOCTL 214 /* FreeBSD-specific. */ /* * In the event that OpenBSM doesn't have a file representation of a local * error number, use this. */ -#define BSM_UNKNOWNERR 10000 /* OpenBSM-specific. */ +#define BSM_UNKNOWNERR 245 /* OpenBSM-specific. */ #endif /* !_BSM_AUDIT_ERRNO_H_ */