Attachment 'gpf_audit.diff'

Download

   1 --- //depot/vendor/freebsd/src/contrib/openbsm/bin/praudit/praudit.1	2008-12-02 23:35:38.000000000 0000
   2 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/bin/praudit/praudit.1	2010-08-06 18:10:43.000000000 0000
   3 @@ -77,6 +77,9 @@
   4  record and event type are displayed.
   5  This option is exclusive from
   6  .Fl r .
   7 +.It Fl c
   8 +Don't map user credentials to the local base system and print them in raw, 
   9 +numeric form instead. This option is useful when auditing NFS RPCs.
  10  .It Fl x
  11  Print audit records in the XML output format.
  12  .El
  13 --- //depot/vendor/freebsd/src/contrib/openbsm/bin/praudit/praudit.c	2008-12-02 23:35:38.000000000 0000
  14 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/bin/praudit/praudit.c	2010-08-06 18:10:43.000000000 0000
  15 @@ -50,6 +50,7 @@
  16  static char	*del = ",";	/* Default delimiter. */
  17  static int	 oneline = 0;
  18  static int	 raw = 0;
  19 +static int	 rawcred = 0;
  20  static int	 shortfrm = 0;
  21  static int	 partial = 0;
  22  static int	 xml = 0;
  23 @@ -58,7 +59,7 @@
  24  usage(void)
  25  {
  26  
  27 -	fprintf(stderr, "usage: praudit [-lpx] [-r | -s] [-d del] "
  28 +	fprintf(stderr, "usage: praudit [-lpxc] [-r | -s] [-d del] "
  29  	    "[file ...]\n");
  30  	exit(1);
  31  }
  32 @@ -93,10 +94,10 @@
  33  				break;
  34  			if (xml)
  35  				au_print_tok_xml(stdout, &tok, del, raw,
  36 -				    shortfrm);
  37 +				    shortfrm, rawcred);
  38  			else
  39  				au_print_tok(stdout, &tok, del, raw,
  40 -				    shortfrm);
  41 +				    shortfrm, rawcred);
  42  			bytesread += tok.len;
  43  			if (oneline) {
  44  				if (!xml)
  45 @@ -119,8 +120,12 @@
  46  	int i;
  47  	FILE *fp;
  48  
  49 -	while ((ch = getopt(argc, argv, "d:lprsx")) != -1) {
  50 +	while ((ch = getopt(argc, argv, "d:lprcsx")) != -1) {
  51  		switch(ch) {
  52 +		case 'c':
  53 +			rawcred = 1;
  54 +			break;
  55 +
  56  		case 'd':
  57  			del = optarg;
  58  			break;
  59 --- //depot/vendor/freebsd/src/contrib/openbsm/bsm/libbsm.h	2009-04-19 16:37:15.000000000 0000
  60 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/bsm/libbsm.h	2010-08-07 16:49:25.000000000 0000
  61 @@ -502,17 +502,21 @@
  62  	au_tidaddr64_t	tid;
  63  } au_proc64ex_t;
  64  
  65 +typedef struct {
  66 +	u_int32_t	protocol;
  67 +} au_protocol_t;
  68 +
  69  /*
  70 - * error status            1 byte
  71 + * error status            4 byte
  72   * return value            4 bytes/8 bytes (32-bit/64-bit value)
  73   */
  74  typedef struct {
  75 -	u_char		status;
  76 +	u_int32_t	status;
  77  	u_int32_t	ret;
  78  } au_ret32_t;
  79  
  80  typedef struct {
  81 -	u_char		err;
  82 +	u_int32_t	err;
  83  	u_int64_t	val;
  84  } au_ret64_t;
  85  
  86 @@ -661,6 +665,10 @@
  87  	char		*text;
  88  } au_text_t;
  89  
  90 +typedef struct {
  91 +	u_int32_t	vtype;
  92 +} au_vtype_t;
  93 +
  94  /*
  95   * zonename length	2 bytes
  96   * zonename text	N bytes + 1 NULL terminator
  97 @@ -723,6 +731,7 @@
  98  		au_proc32ex_t		proc32_ex;
  99  		au_proc64_t		proc64;
 100  		au_proc64ex_t		proc64_ex;
 101 +		au_protocol_t		prot;
 102  		au_ret32_t		ret32;
 103  		au_ret64_t		ret64;
 104  		au_seq_t		seq;
 105 @@ -735,6 +744,7 @@
 106  		au_subject64_t		subj64;
 107  		au_subject64ex_t	subj64_ex;
 108  		au_text_t		text;
 109 +		au_vtype_t		vtype;
 110  		au_kevent_t		kevent;
 111  		au_invalid_t		invalid;
 112  		au_trailer_t		trail;
 113 @@ -820,9 +830,9 @@
 114  int			 au_fetch_tok(tokenstr_t *tok, u_char *buf, int len);
 115  //XXX The following interface has different prototype from BSM
 116  void			 au_print_tok(FILE *outfp, tokenstr_t *tok,
 117 -			    char *del, char raw, char sfrm);
 118 +			    char *del, char raw, char sfrm, char rawcred);
 119  void			 au_print_tok_xml(FILE *outfp, tokenstr_t *tok,
 120 -			    char *del, char raw, char sfrm);
 121 +			    char *del, char raw, char sfrm, char rawcred);
 122  
 123  /* 
 124   * Functions relating to XML output.
 125 @@ -836,16 +846,16 @@
 126   * the FreeBSD and Mac OS X kernels)
 127   */
 128  int	 au_bsm_to_domain(u_short bsm_domain, int *local_domainp);
 129 -int	 au_bsm_to_errno(u_char bsm_error, int *errorp);
 130 +int	 au_bsm_to_errno(int bsm_error, int *errorp);
 131  int	 au_bsm_to_fcntl_cmd(u_short bsm_fcntl_cmd, int *local_fcntl_cmdp);
 132  int	 au_bsm_to_socket_type(u_short bsm_socket_type,
 133  	    int *local_socket_typep);
 134  u_short	 au_domain_to_bsm(int local_domain);
 135 -u_char	 au_errno_to_bsm(int local_errno);
 136 +int	 au_errno_to_bsm(int local_errno);
 137  u_short	 au_fcntl_cmd_to_bsm(int local_fcntl_command); 
 138  u_short	 au_socket_type_to_bsm(int local_socket_type);
 139  
 140 -const char	 *au_strerror(u_char bsm_error);
 141 +const char	 *au_strerror(int bsm_error);
 142  __END_DECLS
 143  
 144  /*
 145 --- //depot/vendor/freebsd/src/contrib/openbsm/etc/audit_event	2009-08-02 10:35:25.000000000 0000
 146 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/etc/audit_event	2010-07-08 19:00:38.000000000 0000
 147 @@ -360,6 +360,71 @@
 148  360:AUE_DARWIN_SYSCTL_NONADMIN:sysctl() - non-admin:ot
 149  361:AUE_DARWIN_COPYFILE:copyfile():fr,fw
 150  #
 151 +# NFS-specific kernel events
 152 +#
 153 +2000:AUE_NFS_NULL:nfsrv_null():ot
 154 +2001:AUE_NFS_GETATTR:nfsrv_getattr():fa
 155 +2002:AUE_NFS_SETATTR:nfsrv_setattr():fm
 156 +2003:AUE_NFS_LOOKUP:nfsrv_lookup():fa,ad
 157 +2004:AUE_NFS_ACCESS:nfsrv_access():fa
 158 +2005:AUE_NFS_READLINK:nfsrv_readlink():fr
 159 +2006:AUE_NFS_READ:nfsrv_read():fr
 160 +2007:AUE_NFS_WRITE:nfsrv_write():fw
 161 +2008:AUE_NFS_CREATE:nfsrv_create():fc,ad
 162 +2009:AUE_NFS_MKDIR:nfsrv_mkdir():fc,ad
 163 +2010:AUE_NFS_SYMLINK:nfsrv_symlink():fc,ad
 164 +2011:AUE_NFS_MKNOD:nfsrv_mknod():fc,ad
 165 +2012:AUE_NFS_REMOVE:nfsrv_remove():fd
 166 +2013:AUE_NFS_RMDIR:nfsrv_rmdir():fd
 167 +2014:AUE_NFS_RENAME:nfsrv_rename():fc,fd
 168 +2015:AUE_NFS_LINK:nfsrv_link():fc
 169 +2016:AUE_NFS_READDIR:nfsrv_readdir():fr
 170 +2017:AUE_NFS_READDIR_PLUS:nfsrv_readdirplus():fr,ad
 171 +2018:AUE_NFS_STATFS:nfsrv_statfs():fa
 172 +2019:AUE_NFS_FSINFO:nfsrv_fsinfo():ot
 173 +2020:AUE_NFS_PATHCONF:nfsrv_pathconf():fa
 174 +2021:AUE_NFS_COMMIT:nfsrv_commit():fw
 175 +2022:AUE_NFS_NOOP:nfsrv_noop():no
 176 +#
 177 +# NFSv4 specific RPC events
 178 +#
 179 +2023:AUE_NFS_CLOSE:nfsrv_close():cl
 180 +2024:AUE_NFS_DELEGPURGE:nfsrv_delegpurge():ad
 181 +2025:AUE_NFS_DELEGRETURN:nfsrv_delegreturn():ad
 182 +2026:AUE_NFSv4_GETFH:nfsrv4_getfh():ad
 183 +2027:AUE_NFS_LOCK:nfsrv_lock():fm
 184 +2028:AUE_NFS_LOCKT:nfsrv_lockt():fm
 185 +2029:AUE_NFS_LOCKU:nfsrv_locku():fm
 186 +2030:AUE_NFS_LOOKUPP:nfsrv_lookupp():fa,ad
 187 +2031:AUE_NFS_NVERIFY:nfsrv_nverify():fa
 188 +2032:AUE_NFS_OPEN:nfsrv_open():fa
 189 +2033:AUE_NFS_OPENATTR:nfsrv_openattr():fa
 190 +2034:AUE_NFS_OPENCONFIRM:nfsrv_openconfirm():fa
 191 +2035:AUE_NFS_OPENDOWNGRADE:nfsrv_opendowngrade():fm
 192 +2036:AUE_NFS_PUTFH:nfsrv_putfh():ad
 193 +2037:AUE_NFS_PUTPUBFH:nfsrv_putpubfh():ad
 194 +2038:AUE_NFS_PUTROOTFH:nfsrv_putrootfh():ad
 195 +2039:AUE_NFS_RENEW:nfsrv_renew():ad
 196 +2040:AUE_NFS_RESTOREFH:nfsrv_restorefh():ad
 197 +2041:AUE_NFS_SAVEFH:nfsrv_savefh():ad
 198 +2042:AUE_NFS_SECINFO:nfsrv_secinfo():ot
 199 +2043:AUE_NFS_SETCLIENTID:nfsrv_setclientid():aa
 200 +2044:AUE_NFS_SETCLIENTIDCFRM:nfsrv_setclientidcfrm():aa
 201 +2045:AUE_NFS_VERIFY:nfsrv_verify():fa
 202 +2046:AUE_NFS_RELEASELCKOWN:nfsrv_releaselckown():ad
 203 +2047:AUE_NFS_OPEN_R:nfsrv_open() - read:fr
 204 +2048:AUE_NFS_OPEN_RC:nfsrv_open() - read, creat:fr,fc,fa,fm
 205 +2049:AUE_NFS_OPEN_RTC:nfsrv_open() - read, trunc, creat:fr,fd,fc,fa,fm
 206 +2050:AUE_NFS_OPEN_RT:nfsrv_open() - read, trunc:fr,fd,fa,fm
 207 +2051:AUE_NFS_OPEN_RW:nfsrv_open() - read, write:fr,fw
 208 +2052:AUE_NFS_OPEN_RWC:nfsrv_open() - read, write, creat:fr,fw,fc,fa,fm
 209 +2053:AUE_NFS_OPEN_RWTC:nfsrv_open() - read, write, trunc, creat:fr,fw,fd,fc,fa,fm
 210 +2054:AUE_NFS_OPEN_RWT:nfsrv_open() - read, write, trunc:fr,fw,fd,fa,fm
 211 +2055:AUE_NFS_OPEN_W:nfsrv_open() - write:fw
 212 +2056:AUE_NFS_OPEN_WC:nfsrv_open() - write, creat:fw,fc,fa,fm
 213 +2057:AUE_NFS_OPEN_WTC:nfsrv_open() - write, trunc, creat:fw,fd,fc,fa,fm
 214 +2058:AUE_NFS_OPEN_WT:nfsrv_open() - write, trunc:fw,fd,fa,fm
 215 +#
 216  # OpenBSM-specific kernel events.
 217  #
 218  43001:AUE_GETFSSTAT:getfsstat(2):fa
 219 --- //depot/vendor/freebsd/src/contrib/openbsm/libbsm/au_errno.3	2009-03-03 17:37:22.000000000 0000
 220 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/libbsm/au_errno.3	2010-08-06 18:10:43.000000000 0000
 221 @@ -77,7 +77,11 @@
 222  function converts a BSM error value to a string, generally by converting first to a
 223  local error number and using the local
 224  .Xr strerror 3
 225 -function, but will also work for errors that are not locally defined.
 226 +function, but will also work for errors that are not locally defined. It will also 
 227 +work for BSM errors limited to specific kernel modules that cannot be serviced 
 228 +by
 229 +.Xr strerror 3 ,
 230 +such as NFSv4 error values.
 231  .Sh RETURN VALULES
 232  On success,
 233  .Fn au_bsm_to_errno
 234 --- //depot/vendor/freebsd/src/contrib/openbsm/libbsm/bsm_errno.c	2009-07-17 14:37:30.000000000 0000
 235 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/libbsm/bsm_errno.c	2010-08-16 13:30:34.000000000 0000
 236 @@ -31,6 +31,8 @@
 237  
 238  #include <sys/types.h>
 239  
 240 +#include <fs/nfs/nfsproto.h>
 241 +
 242  #include <config/config.h>
 243  
 244  #include <bsm/audit_errno.h>
 245 @@ -43,17 +45,17 @@
 246   * Different operating systems use different numeric constants for different
 247   * error numbers, and sometimes error numbers don't exist in more than one
 248   * operating system.  These routines convert between BSM and local error
 249 - * number spaces, subject to the above realities.  BSM error numbers are
 250 - * stored in a single 8-bit character, so don't have a byte order.
 251 + * number spaces, subject to the above realities.
 252   *
 253   * Don't include string definitions when this code is compiled into a kernel.
 254   */
 255  struct bsm_errno {
 256  	int		 be_bsm_errno;
 257  	int		 be_local_errno;
 258 +	char		 be_use_strerror;
 259  #if !defined(KERNEL) && !defined(_KERNEL)
 260  	const char	*be_strerror;
 261 -#endif
 262 +#endif	
 263  };
 264  
 265  #define	ERRNO_NO_LOCAL_MAPPING	-600
 266 @@ -80,610 +82,953 @@
 267   * string using strerror(3).
 268   */
 269  static const struct bsm_errno bsm_errnos[] = {
 270 -	{ BSM_ERRNO_ESUCCESS, 0, ES("Success") },
 271 -	{ BSM_ERRNO_EPERM, EPERM, ES("Operation not permitted") },
 272 -	{ BSM_ERRNO_ENOENT, ENOENT, ES("No such file or directory") },
 273 -	{ BSM_ERRNO_ESRCH, ESRCH, ES("No such process") },
 274 -	{ BSM_ERRNO_EINTR, EINTR, ES("Interrupted system call") },
 275 -	{ BSM_ERRNO_EIO, EIO, ES("Input/output error") },
 276 -	{ BSM_ERRNO_ENXIO, ENXIO, ES("Device not configured") },
 277 -	{ BSM_ERRNO_E2BIG, E2BIG, ES("Argument list too long") },
 278 -	{ BSM_ERRNO_ENOEXEC, ENOEXEC, ES("Exec format error") },
 279 -	{ BSM_ERRNO_EBADF, EBADF, ES("Bad file descriptor") },
 280 -	{ BSM_ERRNO_ECHILD, ECHILD, ES("No child processes") },
 281 -	{ BSM_ERRNO_EAGAIN, EAGAIN, ES("Resource temporarily unavailable") },
 282 -	{ BSM_ERRNO_ENOMEM, ENOMEM, ES("Cannot allocate memory") },
 283 -	{ BSM_ERRNO_EACCES, EACCES, ES("Permission denied") },
 284 -	{ BSM_ERRNO_EFAULT, EFAULT, ES("Bad address") },
 285 -	{ BSM_ERRNO_ENOTBLK, ENOTBLK, ES("Block device required") },
 286 -	{ BSM_ERRNO_EBUSY, EBUSY, ES("Device busy") },
 287 -	{ BSM_ERRNO_EEXIST, EEXIST, ES("File exists") },
 288 -	{ BSM_ERRNO_EXDEV, EXDEV, ES("Cross-device link") },
 289 -	{ BSM_ERRNO_ENODEV, ENODEV, ES("Operation not supported by device") },
 290 -	{ BSM_ERRNO_ENOTDIR, ENOTDIR, ES("Not a directory") },
 291 -	{ BSM_ERRNO_EISDIR, EISDIR, ES("Is a directory") },
 292 -	{ BSM_ERRNO_EINVAL, EINVAL, ES("Invalid argument") },
 293 -	{ BSM_ERRNO_ENFILE, ENFILE, ES("Too many open files in system") },
 294 -	{ BSM_ERRNO_EMFILE, EMFILE, ES("Too many open files") },
 295 -	{ BSM_ERRNO_ENOTTY, ENOTTY, ES("Inappropriate ioctl for device") },
 296 -	{ BSM_ERRNO_ETXTBSY, ETXTBSY, ES("Text file busy") },
 297 -	{ BSM_ERRNO_EFBIG, EFBIG, ES("File too large") },
 298 -	{ BSM_ERRNO_ENOSPC, ENOSPC, ES("No space left on device") },
 299 -	{ BSM_ERRNO_ESPIPE, ESPIPE, ES("Illegal seek") },
 300 -	{ BSM_ERRNO_EROFS, EROFS, ES("Read-only file system") },
 301 -	{ BSM_ERRNO_EMLINK, EMLINK, ES("Too many links") },
 302 -	{ BSM_ERRNO_EPIPE, EPIPE, ES("Broken pipe") },
 303 -	{ BSM_ERRNO_EDOM, EDOM, ES("Numerical argument out of domain") },
 304 -	{ BSM_ERRNO_ERANGE, ERANGE, ES("Result too large") },
 305 -	{ BSM_ERRNO_ENOMSG, ENOMSG, ES("No message of desired type") },
 306 -	{ BSM_ERRNO_EIDRM, EIDRM, ES("Identifier removed") },
 307 +	{ BSM_ERRNO_ESUCCESS, 0, 1, ES("Success") },
 308 +	{ BSM_ERRNO_EPERM, EPERM, 1, ES("Operation not permitted") },
 309 +	{ BSM_ERRNO_ENOENT, ENOENT, 1, ES("No such file or directory") },
 310 +	{ BSM_ERRNO_ESRCH, ESRCH, 1, ES("No such process") },
 311 +	{ BSM_ERRNO_EINTR, EINTR, 1, ES("Interrupted system call") },
 312 +	{ BSM_ERRNO_EIO, EIO, 1, ES("Input/output error") },
 313 +	{ BSM_ERRNO_ENXIO, ENXIO, 1, ES("Device not configured") },
 314 +	{ BSM_ERRNO_E2BIG, E2BIG, 1, ES("Argument list too long") },
 315 +	{ BSM_ERRNO_ENOEXEC, ENOEXEC, 1, ES("Exec format error") },
 316 +	{ BSM_ERRNO_EBADF, EBADF, 1, ES("Bad file descriptor") },
 317 +	{ BSM_ERRNO_ECHILD, ECHILD, 1, ES("No child processes") },
 318 +	{ BSM_ERRNO_EAGAIN, EAGAIN, 1, ES("Resource temporarily unavailable") },
 319 +	{ BSM_ERRNO_ENOMEM, ENOMEM, 1, ES("Cannot allocate memory") },
 320 +	{ BSM_ERRNO_EACCES, EACCES, 1, ES("Permission denied") },
 321 +	{ BSM_ERRNO_EFAULT, EFAULT, 1, ES("Bad address") },
 322 +	{ BSM_ERRNO_ENOTBLK, ENOTBLK, 1, ES("Block device required") },
 323 +	{ BSM_ERRNO_EBUSY, EBUSY, 1, ES("Device busy") },
 324 +	{ BSM_ERRNO_EEXIST, EEXIST, 1, ES("File exists") },
 325 +	{ BSM_ERRNO_EXDEV, EXDEV, 1, ES("Cross-device link") },
 326 +	{ BSM_ERRNO_ENODEV, ENODEV, 1, ES("Operation not supported by device") },
 327 +	{ BSM_ERRNO_ENOTDIR, ENOTDIR, 1, ES("Not a directory") },
 328 +	{ BSM_ERRNO_EISDIR, EISDIR, 1, ES("Is a directory") },
 329 +	{ BSM_ERRNO_EINVAL, EINVAL, 1, ES("Invalid argument") },
 330 +	{ BSM_ERRNO_ENFILE, ENFILE, 1, ES("Too many open files in system") },
 331 +	{ BSM_ERRNO_EMFILE, EMFILE, 1, ES("Too many open files") },
 332 +	{ BSM_ERRNO_ENOTTY, ENOTTY, 1, ES("Inappropriate ioctl for device") },
 333 +	{ BSM_ERRNO_ETXTBSY, ETXTBSY, 1, ES("Text file busy") },
 334 +	{ BSM_ERRNO_EFBIG, EFBIG, 1, ES("File too large") },
 335 +	{ BSM_ERRNO_ENOSPC, ENOSPC, 1, ES("No space left on device") },
 336 +	{ BSM_ERRNO_ESPIPE, ESPIPE, 1, ES("Illegal seek") },
 337 +	{ BSM_ERRNO_EROFS, EROFS, 1, ES("Read-only file system") },
 338 +	{ BSM_ERRNO_EMLINK, EMLINK, 1, ES("Too many links") },
 339 +	{ BSM_ERRNO_EPIPE, EPIPE, 1, ES("Broken pipe") },
 340 +	{ BSM_ERRNO_EDOM, EDOM, 1, ES("Numerical argument out of domain") },
 341 +	{ BSM_ERRNO_ERANGE, ERANGE, 1, ES("Result too large") },
 342 +	{ BSM_ERRNO_ENOMSG, ENOMSG, 1, ES("No message of desired type") },
 343 +	{ BSM_ERRNO_EIDRM, EIDRM, 1, ES("Identifier removed") },
 344  	{ BSM_ERRNO_ECHRNG,
 345  #ifdef ECHRNG
 346  	ECHRNG,
 347  #else
 348  	ERRNO_NO_LOCAL_MAPPING,
 349  #endif
 350 -	ES("Channel number out of range") },
 351 +	1, ES("Channel number out of range") },
 352  	{ BSM_ERRNO_EL2NSYNC,
 353  #ifdef EL2NSYNC
 354  	EL2NSYNC,
 355  #else
 356  	ERRNO_NO_LOCAL_MAPPING,
 357  #endif
 358 -	ES("Level 2 not synchronized") },
 359 +	1, ES("Level 2 not synchronized") },
 360  	{ BSM_ERRNO_EL3HLT,
 361  #ifdef EL3HLT
 362  	EL3HLT,
 363  #else
 364  	ERRNO_NO_LOCAL_MAPPING,
 365  #endif
 366 -	ES("Level 3 halted") },
 367 +	1, ES("Level 3 halted") },
 368  	{ BSM_ERRNO_EL3RST,
 369  #ifdef EL3RST
 370  	EL3RST,
 371  #else
 372  	ERRNO_NO_LOCAL_MAPPING,
 373  #endif
 374 -	ES("Level 3 reset") },
 375 +	1, ES("Level 3 reset") },
 376  	{ BSM_ERRNO_ELNRNG,
 377  #ifdef ELNRNG
 378  	ELNRNG,
 379  #else
 380  	ERRNO_NO_LOCAL_MAPPING,
 381  #endif
 382 -	ES("Link number out of range") },
 383 +	1, ES("Link number out of range") },
 384  	{ BSM_ERRNO_EUNATCH,
 385  #ifdef EUNATCH
 386  	EUNATCH,
 387  #else
 388  	ERRNO_NO_LOCAL_MAPPING,
 389  #endif
 390 -	ES("Protocol driver not attached") },
 391 +	1, ES("Protocol driver not attached") },
 392  	{ BSM_ERRNO_ENOCSI,
 393  #ifdef ENOCSI
 394  	ENOCSI,
 395  #else
 396  	ERRNO_NO_LOCAL_MAPPING,
 397  #endif
 398 -	ES("No CSI structure available") },
 399 +	1, ES("No CSI structure available") },
 400  	{ BSM_ERRNO_EL2HLT,
 401  #ifdef EL2HLT
 402  	EL2HLT,
 403  #else
 404  	ERRNO_NO_LOCAL_MAPPING,
 405  #endif
 406 -	ES("Level 2 halted") },
 407 -	{ BSM_ERRNO_EDEADLK, EDEADLK, ES("Resource deadlock avoided") },
 408 -	{ BSM_ERRNO_ENOLCK, ENOLCK, ES("No locks available") },
 409 -	{ BSM_ERRNO_ECANCELED, ECANCELED, ES("Operation canceled") },
 410 -	{ BSM_ERRNO_ENOTSUP, ENOTSUP, ES("Operation not supported") },
 411 -	{ BSM_ERRNO_EDQUOT, EDQUOT, ES("Disc quota exceeded") },
 412 +	1, ES("Level 2 halted") },
 413 +	{ BSM_ERRNO_EDEADLK, EDEADLK, 1, ES("Resource deadlock avoided") },
 414 +	{ BSM_ERRNO_ENOLCK, ENOLCK, 1, ES("No locks available") },
 415 +	{ BSM_ERRNO_ECANCELED, ECANCELED, 1, ES("Operation canceled") },
 416 +	{ BSM_ERRNO_ENOTSUP, ENOTSUP, 1, ES("Operation not supported") },
 417 +	{ BSM_ERRNO_EDQUOT, EDQUOT, 1, ES("Disc quota exceeded") },
 418  	{ BSM_ERRNO_EBADE,
 419  #ifdef EBADE
 420  	EBADE,
 421  #else
 422  	ERRNO_NO_LOCAL_MAPPING,
 423  #endif
 424 -	ES("Invalid exchange") },
 425 +	1, ES("Invalid exchange") },
 426  	{ BSM_ERRNO_EBADR,
 427  #ifdef EBADR
 428  	EBADR,
 429  #else
 430  	ERRNO_NO_LOCAL_MAPPING,
 431  #endif
 432 -	ES("Invalid request descriptor") },
 433 +	1, ES("Invalid request descriptor") },
 434  	{ BSM_ERRNO_EXFULL,
 435  #ifdef EXFULL
 436  	EXFULL,
 437  #else
 438  	ERRNO_NO_LOCAL_MAPPING,
 439  #endif
 440 -	ES("Exchange full") },
 441 +	1, ES("Exchange full") },
 442  	{ BSM_ERRNO_ENOANO,
 443  #ifdef ENOANO
 444  	ENOANO,
 445  #else
 446  	ERRNO_NO_LOCAL_MAPPING,
 447  #endif
 448 -	ES("No anode") },
 449 +	1, ES("No anode") },
 450  	{ BSM_ERRNO_EBADRQC,
 451  #ifdef EBADRQC
 452  	EBADRQC,
 453  #else
 454  	ERRNO_NO_LOCAL_MAPPING,
 455  #endif
 456 -	ES("Invalid request descriptor") },
 457 +	1, ES("Invalid request descriptor") },
 458  	{ BSM_ERRNO_EBADSLT,
 459  #ifdef EBADSLT
 460  	EBADSLT,
 461  #else
 462  	ERRNO_NO_LOCAL_MAPPING,
 463  #endif
 464 -	ES("Invalid slot") },
 465 +	1, ES("Invalid slot") },
 466  	{ BSM_ERRNO_EDEADLOCK,
 467  #ifdef EDEADLOCK
 468  	EDEADLOCK,
 469  #else
 470  	ERRNO_NO_LOCAL_MAPPING,
 471  #endif
 472 -	ES("Resource deadlock avoided") },
 473 +	1, ES("Resource deadlock avoided") },
 474  	{ BSM_ERRNO_EBFONT,
 475  #ifdef EBFONT
 476  	EBFONT,
 477  #else
 478  	ERRNO_NO_LOCAL_MAPPING,
 479  #endif
 480 -	ES("Bad font file format") },
 481 +	1, ES("Bad font file format") },
 482  	{ BSM_ERRNO_EOWNERDEAD,
 483  #ifdef EOWNERDEAD
 484  	EOWNERDEAD,
 485  #else
 486  	ERRNO_NO_LOCAL_MAPPING,
 487  #endif
 488 -	ES("Process died with the lock") },
 489 +	1, ES("Process died with the lock") },
 490  	{ BSM_ERRNO_ENOTRECOVERABLE,
 491  #ifdef ENOTRECOVERABLE
 492  	ENOTRECOVERABLE,
 493  #else
 494  	ERRNO_NO_LOCAL_MAPPING,
 495  #endif
 496 -	ES("Lock is not recoverable") },
 497 +	1, ES("Lock is not recoverable") },
 498  	{ BSM_ERRNO_ENOSTR,
 499  #ifdef ENOSTR
 500  	ENOSTR,
 501  #else
 502  	ERRNO_NO_LOCAL_MAPPING,
 503  #endif
 504 -	ES("Device not a stream") },
 505 +	1, ES("Device not a stream") },
 506  	{ BSM_ERRNO_ENONET,
 507  #ifdef ENONET
 508  	ENONET,
 509  #else
 510  	ERRNO_NO_LOCAL_MAPPING,
 511  #endif
 512 -	ES("Machine is not on the network") },
 513 +	1, ES("Machine is not on the network") },
 514  	{ BSM_ERRNO_ENOPKG,
 515  #ifdef ENOPKG
 516  	ENOPKG,
 517  #else
 518  	ERRNO_NO_LOCAL_MAPPING,
 519  #endif
 520 -	ES("Package not installed") },
 521 +	1, ES("Package not installed") },
 522  	{ BSM_ERRNO_EREMOTE, EREMOTE,
 523 -	    ES("Too many levels of remote in path") },
 524 +	    1, ES("Too many levels of remote in path") },
 525  	{ BSM_ERRNO_ENOLINK,
 526  #ifdef ENOLINK
 527  	ENOLINK,
 528  #else
 529  	ERRNO_NO_LOCAL_MAPPING,
 530  #endif
 531 -	ES("Link has been severed") },
 532 +	1, ES("Link has been severed") },
 533  	{ BSM_ERRNO_EADV,
 534  #ifdef EADV
 535  	EADV,
 536  #else
 537  	ERRNO_NO_LOCAL_MAPPING,
 538  #endif
 539 -	ES("Advertise error") },
 540 +	1, ES("Advertise error") },
 541  	{ BSM_ERRNO_ESRMNT,
 542  #ifdef ESRMNT
 543  	ESRMNT,
 544  #else
 545  	ERRNO_NO_LOCAL_MAPPING,
 546  #endif
 547 -	ES("srmount error") },
 548 +	1, ES("srmount error") },
 549  	{ BSM_ERRNO_ECOMM,
 550  #ifdef ECOMM
 551  	ECOMM,
 552  #else
 553  	ERRNO_NO_LOCAL_MAPPING,
 554  #endif
 555 -	ES("Communication error on send") },
 556 +	1, ES("Communication error on send") },
 557  	{ BSM_ERRNO_EPROTO,
 558  #ifdef EPROTO
 559  	EPROTO,
 560  #else
 561  	ERRNO_NO_LOCAL_MAPPING,
 562  #endif
 563 -	ES("Protocol error") },
 564 +	1, ES("Protocol error") },
 565  	{ BSM_ERRNO_ELOCKUNMAPPED,
 566  #ifdef ELOCKUNMAPPED
 567  	ELOCKUNMAPPED,
 568  #else
 569  	ERRNO_NO_LOCAL_MAPPING,
 570  #endif
 571 -	ES("Locked lock was unmapped") },
 572 +	1, ES("Locked lock was unmapped") },
 573  	{ BSM_ERRNO_ENOTACTIVE,
 574  #ifdef ENOTACTIVE
 575  	ENOTACTIVE,
 576  #else
 577  	ERRNO_NO_LOCAL_MAPPING,
 578  #endif
 579 -	ES("Facility is not active") },
 580 +	1, ES("Facility is not active") },
 581  	{ BSM_ERRNO_EMULTIHOP,
 582  #ifdef EMULTIHOP
 583  	EMULTIHOP,
 584  #else
 585  	ERRNO_NO_LOCAL_MAPPING,
 586  #endif
 587 -	ES("Multihop attempted") },
 588 +	1, ES("Multihop attempted") },
 589  	{ BSM_ERRNO_EBADMSG,
 590  #ifdef EBADMSG
 591  	EBADMSG,
 592  #else
 593  	ERRNO_NO_LOCAL_MAPPING,
 594  #endif
 595 -	ES("Bad message") },
 596 -	{ BSM_ERRNO_ENAMETOOLONG, ENAMETOOLONG, ES("File name too long") },
 597 +	1, ES("Bad message") },
 598 +	{ BSM_ERRNO_ENAMETOOLONG, ENAMETOOLONG, 1, ES("File name too long") },
 599  	{ BSM_ERRNO_EOVERFLOW, EOVERFLOW,
 600 -	    ES("Value too large to be stored in data type") },
 601 +	    1, ES("Value too large to be stored in data type") },
 602  	{ BSM_ERRNO_ENOTUNIQ,
 603  #ifdef ENOTUNIQ
 604  	ENOTUNIQ,
 605  #else
 606  	ERRNO_NO_LOCAL_MAPPING,
 607  #endif
 608 -	ES("Given log name not unique") },
 609 +	1, ES("Given log name not unique") },
 610  	{ BSM_ERRNO_EBADFD,
 611  #ifdef EBADFD
 612  	EBADFD,
 613  #else
 614  	ERRNO_NO_LOCAL_MAPPING,
 615  #endif
 616 -	ES("Given f.d. invalid for this operation") },
 617 +	1, ES("Given f.d. invalid for this operation") },
 618  	{ BSM_ERRNO_EREMCHG,
 619  #ifdef EREMCHG
 620  	EREMCHG,
 621  #else
 622  	ERRNO_NO_LOCAL_MAPPING,
 623  #endif
 624 -	ES("Remote address changed") },
 625 +	1, ES("Remote address changed") },
 626  	{ BSM_ERRNO_ELIBACC,
 627  #ifdef ELIBACC
 628  	ELIBACC,
 629  #else
 630  	ERRNO_NO_LOCAL_MAPPING,
 631  #endif
 632 -	ES("Can't access a needed shared lib") },
 633 +	1, ES("Can't access a needed shared lib") },
 634  	{ BSM_ERRNO_ELIBBAD,
 635  #ifdef ELIBBAD
 636  	ELIBBAD,
 637  #else
 638  	ERRNO_NO_LOCAL_MAPPING,
 639  #endif
 640 -	ES("Accessing a corrupted shared lib") },
 641 +	1, ES("Accessing a corrupted shared lib") },
 642  	{ BSM_ERRNO_ELIBSCN,
 643  #ifdef ELIBSCN
 644  	ELIBSCN,
 645  #else
 646  	ERRNO_NO_LOCAL_MAPPING,
 647  #endif
 648 -	ES(".lib section in a.out corrupted") },
 649 +	1, ES(".lib section in a.out corrupted") },
 650  	{ BSM_ERRNO_ELIBMAX,
 651  #ifdef ELIBMAX
 652  	ELIBMAX,
 653  #else
 654  	ERRNO_NO_LOCAL_MAPPING,
 655  #endif
 656 -	ES("Attempting to link in too many libs") },
 657 +	1, ES("Attempting to link in too many libs") },
 658  	{ BSM_ERRNO_ELIBEXEC,
 659  #ifdef ELIBEXEC
 660  	ELIBEXEC,
 661  #else
 662  	ERRNO_NO_LOCAL_MAPPING,
 663  #endif
 664 -	ES("Attempting to exec a shared library") },
 665 -	{ BSM_ERRNO_EILSEQ, EILSEQ, ES("Illegal byte sequence") },
 666 -	{ BSM_ERRNO_ENOSYS, ENOSYS, ES("Function not implemented") },
 667 -	{ BSM_ERRNO_ELOOP, ELOOP, ES("Too many levels of symbolic links") },
 668 +	1, ES("Attempting to exec a shared library") },
 669 +	{ BSM_ERRNO_EILSEQ, EILSEQ, 1, ES("Illegal byte sequence") },
 670 +	{ BSM_ERRNO_ENOSYS, ENOSYS, 1, ES("Function not implemented") },
 671 +	{ BSM_ERRNO_ELOOP, ELOOP, 1, ES("Too many levels of symbolic links") },
 672  	{ BSM_ERRNO_ERESTART,
 673  #ifdef ERESTART
 674  	ERESTART,
 675  #else
 676  	ERRNO_NO_LOCAL_MAPPING,
 677  #endif
 678 -	ES("Restart syscall") },
 679 +	1, ES("Restart syscall") },
 680  	{ BSM_ERRNO_ESTRPIPE,
 681  #ifdef ESTRPIPE
 682  	ESTRPIPE,
 683  #else
 684  	ERRNO_NO_LOCAL_MAPPING,
 685  #endif
 686 -	ES("If pipe/FIFO, don't sleep in stream head") },
 687 -	{ BSM_ERRNO_ENOTEMPTY, ENOTEMPTY, ES("Directory not empty") },
 688 -	{ BSM_ERRNO_EUSERS, EUSERS, ES("Too many users") },
 689 +	1, ES("If pipe/FIFO, don't sleep in stream head") },
 690 +	{ BSM_ERRNO_ENOTEMPTY, ENOTEMPTY, 1, ES("Directory not empty") },
 691 +	{ BSM_ERRNO_EUSERS, EUSERS, 1, ES("Too many users") },
 692  	{ BSM_ERRNO_ENOTSOCK, ENOTSOCK,
 693 -	    ES("Socket operation on non-socket") },
 694 +	    1, ES("Socket operation on non-socket") },
 695  	{ BSM_ERRNO_EDESTADDRREQ, EDESTADDRREQ,
 696 -	    ES("Destination address required") },
 697 -	{ BSM_ERRNO_EMSGSIZE, EMSGSIZE, ES("Message too long") },
 698 +	    1, ES("Destination address required") },
 699 +	{ BSM_ERRNO_EMSGSIZE, EMSGSIZE, 1, ES("Message too long") },
 700  	{ BSM_ERRNO_EPROTOTYPE, EPROTOTYPE,
 701 -	    ES("Protocol wrong type for socket") },
 702 -	{ BSM_ERRNO_ENOPROTOOPT, ENOPROTOOPT, ES("Protocol not available") },
 703 +	    1, ES("Protocol wrong type for socket") },
 704 +	{ BSM_ERRNO_ENOPROTOOPT, ENOPROTOOPT, 1, ES("Protocol not available") },
 705  	{ BSM_ERRNO_EPROTONOSUPPORT, EPROTONOSUPPORT,
 706 -	    ES("Protocol not supported") },
 707 +	    1, ES("Protocol not supported") },
 708  	{ BSM_ERRNO_ESOCKTNOSUPPORT, ESOCKTNOSUPPORT,
 709 -	    ES("Socket type not supported") },
 710 -	{ BSM_ERRNO_EOPNOTSUPP, EOPNOTSUPP, ES("Operation not supported") },
 711 +	    1, ES("Socket type not supported") },
 712 +	{ BSM_ERRNO_EOPNOTSUPP, EOPNOTSUPP, 1, ES("Operation not supported") },
 713  	{ BSM_ERRNO_EPFNOSUPPORT, EPFNOSUPPORT,
 714 -	    ES("Protocol family not supported") },
 715 +	    1, ES("Protocol family not supported") },
 716  	{ BSM_ERRNO_EAFNOSUPPORT, EAFNOSUPPORT,
 717 -	    ES("Address family not supported by protocol family") },
 718 -	{ BSM_ERRNO_EADDRINUSE, EADDRINUSE, ES("Address already in use") },
 719 +	    1, ES("Address family not supported by protocol family") },
 720 +	{ BSM_ERRNO_EADDRINUSE, EADDRINUSE, 1, ES("Address already in use") },
 721  	{ BSM_ERRNO_EADDRNOTAVAIL, EADDRNOTAVAIL,
 722 -	    ES("Can't assign requested address") },
 723 -	{ BSM_ERRNO_ENETDOWN, ENETDOWN, ES("Network is down") },
 724 +	    1, ES("Can't assign requested address") },
 725 +	{ BSM_ERRNO_ENETDOWN, ENETDOWN, 1, ES("Network is down") },
 726  	{ BSM_ERRNO_ENETRESET, ENETRESET,
 727 -	    ES("Network dropped connection on reset") },
 728 +	    1, ES("Network dropped connection on reset") },
 729  	{ BSM_ERRNO_ECONNABORTED, ECONNABORTED,
 730 -	    ES("Software caused connection abort") },
 731 -	{ BSM_ERRNO_ECONNRESET, ECONNRESET, ES("Connection reset by peer") },
 732 -	{ BSM_ERRNO_ENOBUFS, ENOBUFS, ES("No buffer space available") },
 733 -	{ BSM_ERRNO_EISCONN, EISCONN, ES("Socket is already connected") },
 734 -	{ BSM_ERRNO_ENOTCONN, ENOTCONN, ES("Socket is not connected") },
 735 +	    1, ES("Software caused connection abort") },
 736 +	{ BSM_ERRNO_ECONNRESET, ECONNRESET, 1, ES("Connection reset by peer") },
 737 +	{ BSM_ERRNO_ENOBUFS, ENOBUFS, 1, ES("No buffer space available") },
 738 +	{ BSM_ERRNO_EISCONN, EISCONN, 1, ES("Socket is already connected") },
 739 +	{ BSM_ERRNO_ENOTCONN, ENOTCONN, 1, ES("Socket is not connected") },
 740  	{ BSM_ERRNO_ESHUTDOWN, ESHUTDOWN,
 741 -	    ES("Can't send after socket shutdown") },
 742 +	    1, ES("Can't send after socket shutdown") },
 743  	{ BSM_ERRNO_ETOOMANYREFS, ETOOMANYREFS,
 744 -	    ES("Too many references: can't splice") },
 745 -	{ BSM_ERRNO_ETIMEDOUT, ETIMEDOUT, ES("Operation timed out") },
 746 -	{ BSM_ERRNO_ECONNREFUSED, ECONNREFUSED, ES("Connection refused") },
 747 -	{ BSM_ERRNO_EHOSTDOWN, EHOSTDOWN, ES("Host is down") },
 748 -	{ BSM_ERRNO_EHOSTUNREACH, EHOSTUNREACH, ES("No route to host") },
 749 -	{ BSM_ERRNO_EALREADY, EALREADY, ES("Operation already in progress") },
 750 +	    1, ES("Too many references: can't splice") },
 751 +	{ BSM_ERRNO_ETIMEDOUT, ETIMEDOUT, 1, ES("Operation timed out") },
 752 +	{ BSM_ERRNO_ECONNREFUSED, ECONNREFUSED, 1, ES("Connection refused") },
 753 +	{ BSM_ERRNO_EHOSTDOWN, EHOSTDOWN, 1, ES("Host is down") },
 754 +	{ BSM_ERRNO_EHOSTUNREACH, EHOSTUNREACH, 1, ES("No route to host") },
 755 +	{ BSM_ERRNO_EALREADY, EALREADY, 1, ES("Operation already in progress") },
 756  	{ BSM_ERRNO_EINPROGRESS, EINPROGRESS,
 757 -	    ES("Operation now in progress") },
 758 -	{ BSM_ERRNO_ESTALE, ESTALE, ES("Stale NFS file handle") },
 759 +	    1, ES("Operation now in progress") },
 760 +	{ BSM_ERRNO_ESTALE, ESTALE, 1, ES("Stale NFS file handle") },
 761  	{ BSM_ERRNO_EPROCLIM,
 762  #ifdef EPROCLIM
 763  	EPROCLIM,
 764  #else
 765  	ERRNO_NO_LOCAL_MAPPING,
 766  #endif
 767 -	ES("Too many processes") },
 768 +	1, ES("Too many processes") },
 769  	{ BSM_ERRNO_EBADRPC,
 770  #ifdef EBADRPC
 771  	EBADRPC,
 772  #else
 773  	ERRNO_NO_LOCAL_MAPPING,
 774  #endif
 775 -	ES("RPC struct is bad") },
 776 +	1, ES("RPC struct is bad") },
 777  	{ BSM_ERRNO_ERPCMISMATCH,
 778  #ifdef ERPCMISMATCH
 779  	ERPCMISMATCH,
 780  #else
 781  	ERRNO_NO_LOCAL_MAPPING,
 782  #endif
 783 -	ES("RPC version wrong") },
 784 +	1, ES("RPC version wrong") },
 785  	{ BSM_ERRNO_EPROGUNAVAIL,
 786  #ifdef EPROGUNAVAIL
 787  	EPROGUNAVAIL,
 788  #else
 789  	ERRNO_NO_LOCAL_MAPPING,
 790  #endif
 791 -	ES("RPC prog. not avail") },
 792 +	1, ES("RPC prog. not avail") },
 793  	{ BSM_ERRNO_EPROGMISMATCH,
 794  #ifdef EPROGMISMATCH
 795  	EPROGMISMATCH,
 796  #else
 797  	ERRNO_NO_LOCAL_MAPPING,
 798  #endif
 799 -	ES("RPC version wrong") },
 800 +	1, ES("RPC version wrong") },
 801  	{ BSM_ERRNO_EPROCUNAVAIL,
 802  #ifdef EPROCUNAVAIL
 803  	EPROCUNAVAIL,
 804  #else
 805  	ERRNO_NO_LOCAL_MAPPING,
 806  #endif
 807 -	ES("Bad procedure for program") },
 808 +	1, ES("Bad procedure for program") },
 809  	{ BSM_ERRNO_EFTYPE,
 810  #ifdef EFTYPE
 811  	EFTYPE,
 812  #else
 813  	ERRNO_NO_LOCAL_MAPPING,
 814  #endif
 815 -	ES("Inappropriate file type or format") },
 816 +	1, ES("Inappropriate file type or format") },
 817  	{ BSM_ERRNO_EAUTH,
 818  #ifdef EAUTH
 819  	EAUTH,
 820  #else
 821  	ERRNO_NO_LOCAL_MAPPING,
 822  #endif
 823 -	ES("Authenticateion error") },
 824 +	1, ES("Authenticateion error") },
 825  	{ BSM_ERRNO_ENEEDAUTH,
 826  #ifdef ENEEDAUTH
 827  	ENEEDAUTH,
 828  #else
 829  	ERRNO_NO_LOCAL_MAPPING,
 830  #endif
 831 -	ES("Need authenticator") },
 832 +	1, ES("Need authenticator") },
 833  	{ BSM_ERRNO_ENOATTR,
 834  #ifdef ENOATTR
 835  	ENOATTR,
 836  #else
 837  	ERRNO_NO_LOCAL_MAPPING,
 838  #endif
 839 -	ES("Attribute not found") },
 840 +	1, ES("Attribute not found") },
 841  	{ BSM_ERRNO_EDOOFUS,
 842  #ifdef EDOOFUS
 843  	EDOOFUS,
 844  #else
 845  	ERRNO_NO_LOCAL_MAPPING,
 846  #endif
 847 -	ES("Programming error") },
 848 +	1, ES("Programming error") },
 849  	{ BSM_ERRNO_EJUSTRETURN,
 850  #ifdef EJUSTRETURN
 851  	EJUSTRETURN,
 852  #else
 853  	ERRNO_NO_LOCAL_MAPPING,
 854  #endif
 855 -	ES("Just return") },
 856 +	1, ES("Just return") },
 857  	{ BSM_ERRNO_ENOIOCTL,
 858  #ifdef ENOIOCTL
 859  	ENOIOCTL,
 860  #else
 861  	ERRNO_NO_LOCAL_MAPPING,
 862  #endif
 863 -	ES("ioctl not handled by this layer") },
 864 +	1, ES("ioctl not handled by this layer") },
 865  	{ BSM_ERRNO_EDIRIOCTL,
 866  #ifdef EDIRIOCTL
 867  	EDIRIOCTL,
 868  #else
 869  	ERRNO_NO_LOCAL_MAPPING,
 870  #endif
 871 -	ES("do direct ioctl in GEOM") },
 872 +	1, ES("do direct ioctl in GEOM") },
 873  	{ BSM_ERRNO_EPWROFF,
 874  #ifdef EPWROFF
 875  	EPWROFF,
 876  #else
 877  	ERRNO_NO_LOCAL_MAPPING,
 878  #endif
 879 -	ES("Device power is off") },
 880 +	1, ES("Device power is off") },
 881  	{ BSM_ERRNO_EDEVERR,
 882  #ifdef EDEVERR
 883  	EDEVERR,
 884  #else
 885  	ERRNO_NO_LOCAL_MAPPING,
 886  #endif
 887 -	ES("Device error") },
 888 +	1, ES("Device error") },
 889  	{ BSM_ERRNO_EBADEXEC,
 890  #ifdef EBADEXEC
 891  	EBADEXEC,
 892  #else
 893  	ERRNO_NO_LOCAL_MAPPING,
 894  #endif
 895 -	ES("Bad executable") },
 896 +	1, ES("Bad executable") },
 897  	{ BSM_ERRNO_EBADARCH,
 898  #ifdef EBADARCH
 899  	EBADARCH,
 900  #else
 901  	ERRNO_NO_LOCAL_MAPPING,
 902  #endif
 903 -	ES("Bad CPU type in executable") },
 904 +	1, ES("Bad CPU type in executable") },
 905  	{ BSM_ERRNO_ESHLIBVERS,
 906  #ifdef ESHLIBVERS
 907  	ESHLIBVERS,
 908  #else
 909  	ERRNO_NO_LOCAL_MAPPING,
 910  #endif
 911 -	ES("Shared library version mismatch") },
 912 +	1, ES("Shared library version mismatch") },
 913  	{ BSM_ERRNO_EBADMACHO,
 914  #ifdef EBADMACHO
 915  	EBADMACHO,
 916  #else
 917  	ERRNO_NO_LOCAL_MAPPING,
 918  #endif
 919 -	ES("Malformed Macho file") },
 920 +	1, ES("Malformed Macho file") },
 921  	{ BSM_ERRNO_EPOLICY,
 922  #ifdef EPOLICY
 923  	EPOLICY,
 924  #else
 925  	ERRNO_NO_LOCAL_MAPPING,
 926  #endif
 927 -	ES("Operation failed by policy") },
 928 +	1, ES("Operation failed by policy") },
 929  	{ BSM_ERRNO_EDOTDOT,
 930  #ifdef EDOTDOT
 931  	EDOTDOT,
 932  #else
 933  	ERRNO_NO_LOCAL_MAPPING,
 934  #endif
 935 -	ES("RFS specific error") },
 936 +	1, ES("RFS specific error") },
 937  	{ BSM_ERRNO_EUCLEAN,
 938  #ifdef EUCLEAN
 939  	EUCLEAN,
 940  #else
 941  	ERRNO_NO_LOCAL_MAPPING,
 942  #endif
 943 -	ES("Structure needs cleaning") },
 944 +	1, ES("Structure needs cleaning") },
 945  	{ BSM_ERRNO_ENOTNAM,
 946  #ifdef ENOTNAM
 947  	ENOTNAM,
 948  #else
 949  	ERRNO_NO_LOCAL_MAPPING,
 950  #endif
 951 -	ES("Not a XENIX named type file") },
 952 +	1, ES("Not a XENIX named type file") },
 953  	{ BSM_ERRNO_ENAVAIL,
 954  #ifdef ENAVAIL
 955  	ENAVAIL,
 956  #else
 957  	ERRNO_NO_LOCAL_MAPPING,
 958  #endif
 959 -	ES("No XENIX semaphores available") },
 960 +	1, ES("No XENIX semaphores available") },
 961  	{ BSM_ERRNO_EISNAM,
 962  #ifdef EISNAM
 963  	EISNAM,
 964  #else
 965  	ERRNO_NO_LOCAL_MAPPING,
 966  #endif
 967 -	ES("Is a named type file") },
 968 +	1, ES("Is a named type file") },
 969  	{ BSM_ERRNO_EREMOTEIO,
 970  #ifdef EREMOTEIO
 971  	EREMOTEIO,
 972  #else
 973  	ERRNO_NO_LOCAL_MAPPING,
 974  #endif
 975 -	ES("Remote I/O error") },
 976 +	1, ES("Remote I/O error") },
 977  	{ BSM_ERRNO_ENOMEDIUM,
 978  #ifdef ENOMEDIUM
 979  	ENOMEDIUM,
 980  #else
 981  	ERRNO_NO_LOCAL_MAPPING,
 982  #endif
 983 -	ES("No medium found") },
 984 +	1, ES("No medium found") },
 985  	{ BSM_ERRNO_EMEDIUMTYPE,
 986  #ifdef EMEDIUMTYPE
 987  	EMEDIUMTYPE,
 988  #else
 989  	ERRNO_NO_LOCAL_MAPPING,
 990  #endif
 991 -	ES("Wrong medium type") },
 992 +	1, ES("Wrong medium type") },
 993  	{ BSM_ERRNO_ENOKEY,
 994  #ifdef ENOKEY
 995  	ENOKEY,
 996  #else
 997  	ERRNO_NO_LOCAL_MAPPING,
 998  #endif
 999 -	ES("Required key not available") },
1000 +	1, ES("Required key not available") },
1001  	{ BSM_ERRNO_EKEYEXPIRED,
1002  #ifdef EKEEXPIRED
1003  	EKEYEXPIRED,
1004  #else
1005  	ERRNO_NO_LOCAL_MAPPING,
1006  #endif
1007 -	ES("Key has expired") },
1008 +	1, ES("Key has expired") },
1009  	{ BSM_ERRNO_EKEYREVOKED,
1010  #ifdef EKEYREVOKED
1011  	EKEYREVOKED,
1012  #else
1013  	ERRNO_NO_LOCAL_MAPPING,
1014  #endif
1015 -	ES("Key has been revoked") },
1016 +	1, ES("Key has been revoked") },
1017  	{ BSM_ERRNO_EKEYREJECTED,
1018 -#ifdef EKEREJECTED
1019 +#ifdef EKEYREJECTED
1020  	EKEYREJECTED,
1021  #else
1022  	ERRNO_NO_LOCAL_MAPPING,
1023  #endif
1024 -	ES("Key was rejected by service") },
1025 +	1, ES("Key was rejected by service") },
1026 +	{ BSM_NFS_ERRNO_WFLUSH,
1027 +#ifdef NFSERR_WFLUSH
1028 +	NFSERR_WFLUSH,
1029 +#else
1030 +	ERRNO_NO_LOCAL_MAPPING,
1031 +#endif
1032 +	0, ES("The server's write cache used in the WRITECACHE call got flushed to disk") },
1033 +	{ BSM_NFS_ERRNO_BADHANDLE,
1034 +#ifdef NFSERR_BADHANDLE
1035 +	NFSERR_BADHANDLE,
1036 +#else
1037 +	ERRNO_NO_LOCAL_MAPPING,
1038 +#endif
1039 +	0, ES("Illegal NFS filehandle") },
1040 +	{ BSM_NFS_ERRNO_NOT_SYNC,
1041 +#ifdef NFSERR_NOT_SYNC
1042 +	NFSERR_NOT_SYNC,
1043 +#else
1044 +	ERRNO_NO_LOCAL_MAPPING,
1045 +#endif
1046 +	0, ES("Update synchronization mismatch detected during a SETATTR operation") },
1047 +	{ BSM_NFS_ERRNO_BAD_COOKIE,
1048 +#ifdef NFSERR_BAD_COOKIE
1049 +	NFSERR_BAD_COOKIE,
1050 +#else
1051 +	ERRNO_NO_LOCAL_MAPPING,
1052 +#endif
1053 +	0, ES("READDIR cookie is stale") },
1054 +	{ BSM_NFS_ERRNO_NOTSUPP,
1055 +#ifdef NFSERR_NOTSUPP
1056 +	NFSERR_NOTSUPP,
1057 +#else
1058 +	ERRNO_NO_LOCAL_MAPPING,
1059 +#endif
1060 +	0, ES("operation not supported") },
1061 +	{ BSM_NFS_ERRNO_TOOSMALL,
1062 +#ifdef NFSERR_TOOSMALL
1063 +	NFSERR_TOOSMALL,
1064 +#else
1065 +	ERRNO_NO_LOCAL_MAPPING,
1066 +#endif
1067 +	0, ES("response limit exceeded") },
1068 +	{ BSM_NFS_ERRNO_SERVERFAULT,
1069 +#ifdef NFSERR_SERVERFAULT
1070 +	NFSERR_SERVERFAULT,
1071 +#else
1072 +	ERRNO_NO_LOCAL_MAPPING,
1073 +#endif
1074 +	0, ES("undefined server error") },
1075 +	{ BSM_NFS_ERRNO_BADTYPE,
1076 +#ifdef NFSERR_BADTYPE
1077 +	NFSERR_BADTYPE,
1078 +#else
1079 +	ERRNO_NO_LOCAL_MAPPING,
1080 +#endif
1081 +	0, ES("type invalid for CREATE") },
1082 +	{ BSM_NFS_ERRNO_DELAY,
1083 +#ifdef NFSERR_DELAY
1084 +	NFSERR_DELAY,
1085 +#else
1086 +	ERRNO_NO_LOCAL_MAPPING,
1087 +#endif
1088 +	0, ES("file \"busy\" - retry") },
1089 +	{ BSM_NFS_ERRNO_SAME,
1090 +#ifdef NFSERR_SAME
1091 +	NFSERR_SAME,
1092 +#else
1093 +	ERRNO_NO_LOCAL_MAPPING,
1094 +#endif
1095 +	0, ES("nverify says attrs same") },
1096 +	{ BSM_NFS_ERRNO_DENIED,
1097 +#ifdef NFSERR_DENIED
1098 +	NFSERR_DENIED,
1099 +#else
1100 +	ERRNO_NO_LOCAL_MAPPING,
1101 +#endif
1102 +	0, ES("lock unavailable") },
1103 +	{ BSM_NFS_ERRNO_EXPIRED,
1104 +#ifdef NFSERR_EXPIRED
1105 +	NFSERR_EXPIRED,
1106 +#else
1107 +	ERRNO_NO_LOCAL_MAPPING,
1108 +#endif
1109 +	0, ES("lock lease expired") },
1110 +	{ BSM_NFS_ERRNO_LOCKED,
1111 +#ifdef NFSERR_LOCKED
1112 +	NFSERR_LOCKED,
1113 +#else
1114 +	ERRNO_NO_LOCAL_MAPPING,
1115 +#endif
1116 +	0, ES("I/O failed due to lock") },
1117 +	{ BSM_NFS_ERRNO_GRACE,
1118 +#ifdef NFSERR_GRACE
1119 +	NFSERR_GRACE,
1120 +#else
1121 +	ERRNO_NO_LOCAL_MAPPING,
1122 +#endif
1123 +	0, ES("in grace period") },
1124 +	{ BSM_NFS_ERRNO_FHEXPIRED,
1125 +#ifdef NFSERR_FHEXPIRED
1126 +	NFSERR_FHEXPIRED,
1127 +#else
1128 +	ERRNO_NO_LOCAL_MAPPING,
1129 +#endif
1130 +	0, ES("filehandle expired") },
1131 +	{ BSM_NFS_ERRNO_SHAREDENIED,
1132 +#ifdef NFSERR_SHAREDENIED
1133 +	NFSERR_SHAREDENIED,
1134 +#else
1135 +	ERRNO_NO_LOCAL_MAPPING,
1136 +#endif
1137 +	0, ES("share reserve denied") },
1138 +	{ BSM_NFS_ERRNO_WRONGSEC,
1139 +#ifdef NFSERR_WRONGSEC
1140 +	NFSERR_WRONGSEC,
1141 +#else
1142 +	ERRNO_NO_LOCAL_MAPPING,
1143 +#endif
1144 +	0, ES("wrong security flavor") },
1145 +	{ BSM_NFS_ERRNO_CLIDINUSE,
1146 +#ifdef NFSERR_CLIDINUSE
1147 +	NFSERR_CLIDINUSE,
1148 +#else
1149 +	ERRNO_NO_LOCAL_MAPPING,
1150 +#endif
1151 +	0, ES("clientid in use") },
1152 +	{ BSM_NFS_ERRNO_RESOURCE,
1153 +#ifdef NFSERR_RESOURCE
1154 +	NFSERR_RESOURCE,
1155 +#else
1156 +	ERRNO_NO_LOCAL_MAPPING,
1157 +#endif
1158 +	0, ES("resource exhaustion") },
1159 +	{ BSM_NFS_ERRNO_MOVED,
1160 +#ifdef NFSERR_MOVED
1161 +	NFSERR_MOVED,
1162 +#else
1163 +	ERRNO_NO_LOCAL_MAPPING,
1164 +#endif
1165 +	0, ES("filesystem relocated") },
1166 +	{ BSM_NFS_ERRNO_NOFILEHANDLE,
1167 +#ifdef NFSERR_NOFILEHANDLE
1168 +	NFSERR_NOFILEHANDLE,
1169 +#else
1170 +	ERRNO_NO_LOCAL_MAPPING,
1171 +#endif
1172 +	0, ES("current FH is not set") },
1173 +	{ BSM_NFS_ERRNO_MINORVERMISMATCH,
1174 +#ifdef NFSERR_MINORVERMISMATCH
1175 +	NFSERR_MINORVERMISMATCH,
1176 +#else
1177 +	ERRNO_NO_LOCAL_MAPPING,
1178 +#endif
1179 +	0, ES("minor vers not supp") },
1180 +	{ BSM_NFS_ERRNO_STALECLIENTID,
1181 +#ifdef NFSERR_STALECLIENTID
1182 +	NFSERR_STALECLIENTID,
1183 +#else
1184 +	ERRNO_NO_LOCAL_MAPPING,
1185 +#endif
1186 +	0, ES("server has rebooted") },
1187 +	{ BSM_NFS_ERRNO_STALESTATEID,
1188 +#ifdef NFSERR_STALESTATEID
1189 +	NFSERR_STALESTATEID,
1190 +#else
1191 +	ERRNO_NO_LOCAL_MAPPING,
1192 +#endif
1193 +	0, ES("server has rebooted") },
1194 +	{ BSM_NFS_ERRNO_OLDSTATEID,
1195 +#ifdef NFSERR_OLDSTATEID
1196 +	NFSERR_OLDSTATEID,
1197 +#else
1198 +	ERRNO_NO_LOCAL_MAPPING,
1199 +#endif
1200 +	0, ES("state is out of sync") },
1201 +	{ BSM_NFS_ERRNO_BADSTATEID,
1202 +#ifdef NFSERR_BADSTATEID
1203 +	NFSERR_BADSTATEID,
1204 +#else
1205 +	ERRNO_NO_LOCAL_MAPPING,
1206 +#endif
1207 +	0, ES("incorrect stateid") },
1208 +	{ BSM_NFS_ERRNO_BADSEQID,
1209 +#ifdef NFSERR_BADSEQID
1210 +	NFSERR_BADSEQID,
1211 +#else
1212 +	ERRNO_NO_LOCAL_MAPPING,
1213 +#endif
1214 +	0, ES("request is out of seq") },
1215 +	{ BSM_NFS_ERRNO_NOTSAME,
1216 +#ifdef NFSERR_NOTSAME
1217 +	NFSERR_NOTSAME,
1218 +#else
1219 +	ERRNO_NO_LOCAL_MAPPING,
1220 +#endif
1221 +	0, ES("verify - attrs not same") },
1222 +	{ BSM_NFS_ERRNO_LOCKRANGE,
1223 +#ifdef NFSERR_LOCKRANGE
1224 +	NFSERR_LOCKRANGE,
1225 +#else
1226 +	ERRNO_NO_LOCAL_MAPPING,
1227 +#endif
1228 +	0, ES("lock range not supported") },
1229 +	{ BSM_NFS_ERRNO_SYMLINK,
1230 +#ifdef NFSERR_SYMLINK
1231 +	NFSERR_SYMLINK,
1232 +#else
1233 +	ERRNO_NO_LOCAL_MAPPING,
1234 +#endif
1235 +	0, ES("should be file/directory") },
1236 +	{ BSM_NFS_ERRNO_RESTOREFH,
1237 +#ifdef NFSERR_RESTOREFH
1238 +	NFSERR_RESTOREFH,
1239 +#else
1240 +	ERRNO_NO_LOCAL_MAPPING,
1241 +#endif
1242 +	0, ES("no saved filehandle") },
1243 +	{ BSM_NFS_ERRNO_LEASEMOVED,
1244 +#ifdef NFSERR_LEASEMOVED
1245 +	NFSERR_LEASEMOVED,
1246 +#else
1247 +	ERRNO_NO_LOCAL_MAPPING,
1248 +#endif
1249 +	0, ES("some filesystem moved") },
1250 +	{ BSM_NFS_ERRNO_ATTRNOTSUPP,
1251 +#ifdef NFSERR_ATTRNOTSUPP
1252 +	NFSERR_ATTRNOTSUPP,
1253 +#else
1254 +	ERRNO_NO_LOCAL_MAPPING,
1255 +#endif
1256 +	0, ES("recommended attr not sup") },
1257 +	{ BSM_NFS_ERRNO_NOGRACE,
1258 +#ifdef NFSERR_NOGRACE
1259 +	NFSERR_NOGRACE,
1260 +#else
1261 +	ERRNO_NO_LOCAL_MAPPING,
1262 +#endif
1263 +	0, ES("reclaim outside of grace") },
1264 +	{ BSM_NFS_ERRNO_RECLAIMBAD,
1265 +#ifdef NFSERR_RECLAIMBAD
1266 +	NFSERR_RECLAIMBAD,
1267 +#else
1268 +	ERRNO_NO_LOCAL_MAPPING,
1269 +#endif
1270 +	0, ES("reclaim error at server") },
1271 +	{ BSM_NFS_ERRNO_RECLAIMCONFLICT,
1272 +#ifdef NFSERR_RECLAIMCONFLICT
1273 +	NFSERR_RECLAIMCONFLICT,
1274 +#else
1275 +	ERRNO_NO_LOCAL_MAPPING,
1276 +#endif
1277 +	0, ES("conflict on reclaim") },
1278 +	{ BSM_NFS_ERRNO_BADXDR,
1279 +#ifdef NFSERR_BADXDR
1280 +	NFSERR_BADXDR,
1281 +#else
1282 +	ERRNO_NO_LOCAL_MAPPING,
1283 +#endif
1284 +	0, ES("XDR decode failed") },
1285 +	{ BSM_NFS_ERRNO_LOCKSHELD,
1286 +#ifdef NFSERR_LOCKSHELD
1287 +	NFSERR_LOCKSHELD,
1288 +#else
1289 +	ERRNO_NO_LOCAL_MAPPING,
1290 +#endif
1291 +	0, ES("file locks held at CLOSE") },
1292 +	{ BSM_NFS_ERRNO_OPENMODE,
1293 +#ifdef NFSERR_OPENMODE
1294 +	NFSERR_OPENMODE,
1295 +#else
1296 +	ERRNO_NO_LOCAL_MAPPING,
1297 +#endif
1298 +	0, ES("conflict in OPEN and I/O") },
1299 +	{ BSM_NFS_ERRNO_BADOWNER,
1300 +#ifdef NFSERR_BADOWNER
1301 +	NFSERR_BADOWNER,
1302 +#else
1303 +	ERRNO_NO_LOCAL_MAPPING,
1304 +#endif
1305 +	0, ES("owner translation bad") },
1306 +	{ BSM_NFS_ERRNO_BADCHAR,
1307 +#ifdef NFSERR_BADCHAR
1308 +	NFSERR_BADCHAR,
1309 +#else
1310 +	ERRNO_NO_LOCAL_MAPPING,
1311 +#endif
1312 +	0, ES("utf-8 char not supported") },
1313 +	{ BSM_NFS_ERRNO_BADNAME,
1314 +#ifdef NFSERR_BADNAME
1315 +	NFSERR_BADNAME,
1316 +#else
1317 +	ERRNO_NO_LOCAL_MAPPING,
1318 +#endif
1319 +	0, ES("name not supported") },
1320 +	{ BSM_NFS_ERRNO_BADRANGE,
1321 +#ifdef NFSERR_BADRANGE
1322 +	NFSERR_BADRANGE,
1323 +#else
1324 +	ERRNO_NO_LOCAL_MAPPING,
1325 +#endif
1326 +	0, ES("lock range not supported") },
1327 +	{ BSM_NFS_ERRNO_LOCKNOTSUPP,
1328 +#ifdef NFSERR_LOCKNOTSUPP
1329 +	NFSERR_LOCKNOTSUPP,
1330 +#else
1331 +	ERRNO_NO_LOCAL_MAPPING,
1332 +#endif
1333 +	0, ES("no atomic up/downgrade") },
1334 +	{ BSM_NFS_ERRNO_OPILLEGAL,
1335 +#ifdef NFSERR_OPILLEGAL
1336 +	NFSERR_OPILLEGAL,
1337 +#else
1338 +	ERRNO_NO_LOCAL_MAPPING,
1339 +#endif
1340 +	0, ES("undefined operation") },
1341 +	{ BSM_NFS_ERRNO_DEADLOCK,
1342 +#ifdef NFSERR_DEADLOCK
1343 +	NFSERR_DEADLOCK,
1344 +#else
1345 +	ERRNO_NO_LOCAL_MAPPING,
1346 +#endif
1347 +	0, ES("file locking deadlock") },
1348 +	{ BSM_NFS_ERRNO_FILEOPEN,
1349 +#ifdef NFSERR_FILEOPEN
1350 +	NFSERR_FILEOPEN,
1351 +#else
1352 +	ERRNO_NO_LOCAL_MAPPING,
1353 +#endif
1354 +	0, ES("open file blocks op") },
1355 +	{ BSM_NFS_ERRNO_ADMINREVOKED,
1356 +#ifdef NFSERR_ADMINREVOKED
1357 +	NFSERR_ADMINREVOKED,
1358 +#else
1359 +	ERRNO_NO_LOCAL_MAPPING,
1360 +#endif
1361 +	0, ES("lockowner state revoked") },
1362 +	{ BSM_NFS_ERRNO_CBPATHDOWN,
1363 +#ifdef NFSERR_CBPATHDOWN
1364 +	NFSERR_CBPATHDOWN,
1365 +#else
1366 +	ERRNO_NO_LOCAL_MAPPING,
1367 +#endif
1368 +	0, ES("callback path down") },
1369  };
1370  static const int bsm_errnos_count = sizeof(bsm_errnos) / sizeof(bsm_errnos[0]);
1371  
1372 @@ -703,7 +1048,7 @@
1373   * Conversion to the BSM errno space isn't allowed to fail; we simply map to
1374   * BSM_ERRNO_UNKNOWN and let the remote endpoint deal with it.
1375   */
1376 -u_char
1377 +int
1378  au_errno_to_bsm(int local_errno)
1379  {
1380  	const struct bsm_errno *bsme;
1381 @@ -715,7 +1060,7 @@
1382  }
1383  
1384  static const struct bsm_errno *
1385 -bsm_lookup_errno_bsm(u_char bsm_errno)
1386 +bsm_lookup_errno_bsm(int bsm_errno)
1387  {
1388  	int i;
1389  
1390 @@ -732,7 +1077,7 @@
1391   * appropriate local mapping.
1392   */
1393  int
1394 -au_bsm_to_errno(u_char bsm_errno, int *errorp)
1395 +au_bsm_to_errno(int bsm_errno, int *errorp)
1396  {
1397  	const struct bsm_errno *bsme;
1398  
1399 @@ -745,14 +1090,14 @@
1400  
1401  #if !defined(KERNEL) && !defined(_KERNEL)
1402  const char *
1403 -au_strerror(u_char bsm_errno)
1404 +au_strerror(int bsm_errno)
1405  {
1406  	const struct bsm_errno *bsme;
1407  
1408  	bsme = bsm_lookup_errno_bsm(bsm_errno);
1409  	if (bsme == NULL)
1410  		return ("Unrecognized BSM error");
1411 -	if (bsme->be_local_errno != ERRNO_NO_LOCAL_MAPPING)
1412 +	if (bsme->be_local_errno != ERRNO_NO_LOCAL_MAPPING && bsme->be_use_strerror != 0)
1413  		return (strerror(bsme->be_local_errno));
1414  	return (bsme->be_strerror);
1415  }
1416 --- //depot/vendor/freebsd/src/contrib/openbsm/libbsm/bsm_io.c	2009-07-17 14:37:30.000000000 0000
1417 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/libbsm/bsm_io.c	2010-08-07 16:49:25.000000000 0000
1418 @@ -60,6 +60,7 @@
1419  
1420  #include <sys/stat.h>
1421  #include <sys/socket.h>
1422 +#include <sys/vnode.h>
1423  
1424  #include <bsm/libbsm.h>
1425  
1426 @@ -587,12 +588,14 @@
1427   * Prints a user value.
1428   */
1429  static void
1430 -print_user(FILE *fp, u_int32_t usr, char raw)
1431 +print_user(FILE *fp, u_int32_t usr, char raw, char rawcred)
1432  {
1433  	struct passwd *pwent;
1434  
1435  	if (raw)
1436  		fprintf(fp, "%d", usr);
1437 +	else if (rawcred)
1438 +		fprintf(fp, "%d", usr);
1439  	else {
1440  		pwent = getpwuid(usr);
1441  		if (pwent != NULL)
1442 @@ -606,12 +609,14 @@
1443   * Prints a group value.
1444   */
1445  static void
1446 -print_group(FILE *fp, u_int32_t grp, char raw)
1447 +print_group(FILE *fp, u_int32_t grp, char raw, char rawcred)
1448  {
1449  	struct group *grpent;
1450  
1451  	if (raw)
1452  		fprintf(fp, "%d", grp);
1453 +	else if (rawcred)
1454 +		fprintf(fp, "%d", grp);
1455  	else {
1456  		grpent = getgrgid(grp);
1457  		if (grpent != NULL)
1458 @@ -773,10 +778,48 @@
1459  }
1460  
1461  /*
1462 + * prints a string value for the protocol used
1463 + */
1464 +static void
1465 +print_protocol(FILE *fp, int protocol, char raw)
1466 +{
1467 +	char *protocols[] = {
1468 +			"NFSv2",
1469 +			"NFSv3",
1470 +			"NFSv4",
1471 +			"Unknown Protocol"
1472 +	};
1473 +	char *prot;
1474 +	
1475 +	if (raw)
1476 +		fprintf(fp, "%u", protocol);
1477 +	else {
1478 +		switch (protocol) {
1479 +		case ND_NFSV2:
1480 +			prot = protocols[0];
1481 +			break;
1482 +			
1483 +		case ND_NFSV3:
1484 +			prot = protocols[1];
1485 +			break;
1486 +			
1487 +		case ND_NFSV4:
1488 +			prot = protocols[2];
1489 +			break;
1490 +			
1491 +		default:
1492 +			prot = protocols[3];
1493 +			break;
1494 +		}
1495 +		fprintf(fp, "%s", prot);
1496 +	}
1497 +}
1498 +
1499 +/*
1500   * Prints return value as success or failure.
1501   */
1502  static void
1503 -print_retval(FILE *fp, u_char status, char raw)
1504 +print_retval(FILE *fp, int status, char raw)
1505  {
1506  	int error;
1507  
1508 @@ -785,21 +828,55 @@
1509  	else {
1510  		/*
1511  		 * Convert to a local error number and print the OS's version
1512 -		 * of the error string if possible.  We may want to provide
1513 -		 * an au_strerror(3) in the future so that we can print
1514 -		 * strings for non-local errors.
1515 +		 * of the error string if possible.
1516 +		 * We are now using au_strerror(3) because strerror(3) may fail 
1517 +		 * to map error codes to error messages for some security events
1518 +		 * such as NFS RPCs.
1519  		 */
1520  		if (au_bsm_to_errno(status, &error) == 0) {
1521  			if (error == 0)
1522  				fprintf(fp, "success");
1523  			else
1524 -				fprintf(fp, "failure : %s", strerror(error));
1525 +				fprintf(fp, "failure : %s", au_strerror(status));
1526  		} else
1527  			fprintf(fp, "failure: Unknown error: %d", status);
1528  	}
1529  }
1530  
1531  /*
1532 + * prints a string value for a vnode type
1533 + */
1534 +static void
1535 +print_vtype(FILE *fp, int vtype, char raw)
1536 +{
1537 +	char *vtypes[] = {
1538 +			"VNON",
1539 +			"VREG",
1540 +			"VDIR",
1541 +			"VBLK",
1542 +			"VCHR",
1543 +			"VLNK",
1544 +			"VSOCK",
1545 +			"VFIFO",
1546 +			"VBAD",
1547 +			"VMARKER"
1548 +	};
1549 +	char *vt;
1550 +	
1551 +	if (raw)
1552 +		fprintf(fp, "%u", vtype);
1553 +	else {
1554 +		if (vtype != VCHR && vtype != VBLK && vtype != VSOCK && vtype != VFIFO
1555 +		    && vtype != VNON && vtype != VREG && vtype != VDIR && vtype != VLNK
1556 +		    && vtype != VBAD && vtype != VMARKER)
1557 +			vt = vtypes[VBAD];
1558 +		else
1559 +			vt = vtypes[vtype];
1560 +		fprintf(fp, "%s", vt);
1561 +	}
1562 +}
1563 +
1564 +/*
1565   * Prints the exit value.
1566   */
1567  static void
1568 @@ -1645,7 +1722,7 @@
1569  
1570  static void
1571  print_attr32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
1572 -    __unused char sfrm, int xml)
1573 +    __unused char sfrm, int xml, char rawcred)
1574  {
1575  
1576  	print_tok_type(fp, tok->id, "attribute", raw, xml);
1577 @@ -1654,10 +1731,10 @@
1578  		print_4_bytes(fp, tok->tt.attr32.mode, "%o");
1579  		close_attr(fp);
1580  		open_attr(fp, "uid");
1581 -		print_user(fp, tok->tt.attr32.uid, raw);
1582 +		print_user(fp, tok->tt.attr32.uid, raw, rawcred);
1583  		close_attr(fp);
1584  		open_attr(fp, "gid");
1585 -		print_group(fp, tok->tt.attr32.gid, raw);
1586 +		print_group(fp, tok->tt.attr32.gid, raw, rawcred);
1587  		close_attr(fp);
1588  		open_attr(fp, "fsid");
1589  		print_4_bytes(fp, tok->tt.attr32.fsid, "%u");
1590 @@ -1673,9 +1750,9 @@
1591  		print_delim(fp, del);
1592  		print_4_bytes(fp, tok->tt.attr32.mode, "%o");
1593  		print_delim(fp, del);
1594 -		print_user(fp, tok->tt.attr32.uid, raw);
1595 +		print_user(fp, tok->tt.attr32.uid, raw, rawcred);
1596  		print_delim(fp, del);
1597 -		print_group(fp, tok->tt.attr32.gid, raw);
1598 +		print_group(fp, tok->tt.attr32.gid, raw, rawcred);
1599  		print_delim(fp, del);
1600  		print_4_bytes(fp, tok->tt.attr32.fsid, "%u");
1601  		print_delim(fp, del);
1602 @@ -1727,7 +1804,7 @@
1603  
1604  static void
1605  print_attr64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
1606 -    __unused char sfrm, int xml)
1607 +    __unused char sfrm, int xml, char rawcred)
1608  {
1609  
1610  	print_tok_type(fp, tok->id, "attribute", raw, xml);
1611 @@ -1736,10 +1813,10 @@
1612  		print_4_bytes(fp, tok->tt.attr64.mode, "%o");
1613  		close_attr(fp);
1614  		open_attr(fp, "uid");
1615 -		print_user(fp, tok->tt.attr64.uid, raw);
1616 +		print_user(fp, tok->tt.attr64.uid, raw, rawcred);
1617  		close_attr(fp);
1618  		open_attr(fp, "gid");
1619 -		print_group(fp, tok->tt.attr64.gid, raw);
1620 +		print_group(fp, tok->tt.attr64.gid, raw, rawcred);
1621  		close_attr(fp);
1622  		open_attr(fp, "fsid");
1623  		print_4_bytes(fp, tok->tt.attr64.fsid, "%u");
1624 @@ -1755,9 +1832,9 @@
1625  		print_delim(fp, del);
1626  		print_4_bytes(fp, tok->tt.attr64.mode, "%o");
1627  		print_delim(fp, del);
1628 -		print_user(fp, tok->tt.attr64.uid, raw);
1629 +		print_user(fp, tok->tt.attr64.uid, raw, rawcred);
1630  		print_delim(fp, del);
1631 -		print_group(fp, tok->tt.attr64.gid, raw);
1632 +		print_group(fp, tok->tt.attr64.gid, raw, rawcred);
1633  		print_delim(fp, del);
1634  		print_4_bytes(fp, tok->tt.attr64.fsid, "%u");
1635  		print_delim(fp, del);
1636 @@ -2010,7 +2087,7 @@
1637  
1638  static void
1639  print_newgroups_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
1640 -    __unused char sfrm, int xml)
1641 +    __unused char sfrm, int xml, char rawcred)
1642  {
1643  	int i;
1644  
1645 @@ -2018,12 +2095,12 @@
1646  	for (i = 0; i < tok->tt.grps.no; i++) {
1647  		if (xml) {
1648  			fprintf(fp, "<gid>");
1649 -			print_group(fp, tok->tt.grps.list[i], raw);
1650 +			print_group(fp, tok->tt.grps.list[i], raw, rawcred);
1651  			fprintf(fp, "</gid>");
1652  			close_tag(fp, tok->id);
1653  		} else {
1654  			print_delim(fp, del);
1655 -			print_group(fp, tok->tt.grps.list[i], raw);
1656 +			print_group(fp, tok->tt.grps.list[i], raw, rawcred);
1657  		}
1658  	}
1659  }
1660 @@ -2316,22 +2393,22 @@
1661  
1662  static void
1663  print_ipcperm_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
1664 -    __unused char sfrm, int xml)
1665 +    __unused char sfrm, int xml, char rawcred)
1666  {
1667  
1668  	print_tok_type(fp, tok->id, "IPC perm", raw, xml);
1669  	if (xml) {
1670  		open_attr(fp, "uid");
1671 -		print_user(fp, tok->tt.ipcperm.uid, raw);
1672 +		print_user(fp, tok->tt.ipcperm.uid, raw, rawcred);
1673  		close_attr(fp);
1674  		open_attr(fp, "gid");
1675 -		print_group(fp, tok->tt.ipcperm.gid, raw);
1676 +		print_group(fp, tok->tt.ipcperm.gid, raw, rawcred);
1677  		close_attr(fp);
1678  		open_attr(fp, "creator-uid");
1679 -		print_user(fp, tok->tt.ipcperm.puid, raw);
1680 +		print_user(fp, tok->tt.ipcperm.puid, raw, rawcred);
1681  		close_attr(fp);
1682  		open_attr(fp, "creator-gid");
1683 -		print_group(fp, tok->tt.ipcperm.pgid, raw);
1684 +		print_group(fp, tok->tt.ipcperm.pgid, raw, rawcred);
1685  		close_attr(fp);
1686  		open_attr(fp, "mode");
1687  		print_4_bytes(fp, tok->tt.ipcperm.mode, "%o");
1688 @@ -2345,13 +2422,13 @@
1689  		close_tag(fp, tok->id);
1690  	} else {
1691  		print_delim(fp, del);
1692 -		print_user(fp, tok->tt.ipcperm.uid, raw);
1693 +		print_user(fp, tok->tt.ipcperm.uid, raw, rawcred);
1694  		print_delim(fp, del);
1695 -		print_group(fp, tok->tt.ipcperm.gid, raw);
1696 +		print_group(fp, tok->tt.ipcperm.gid, raw, rawcred);
1697  		print_delim(fp, del);
1698 -		print_user(fp, tok->tt.ipcperm.puid, raw);
1699 +		print_user(fp, tok->tt.ipcperm.puid, raw, rawcred);
1700  		print_delim(fp, del);
1701 -		print_group(fp, tok->tt.ipcperm.pgid, raw);
1702 +		print_group(fp, tok->tt.ipcperm.pgid, raw, rawcred);
1703  		print_delim(fp, del);
1704  		print_4_bytes(fp, tok->tt.ipcperm.mode, "%o");
1705  		print_delim(fp, del);
1706 @@ -2528,25 +2605,25 @@
1707  
1708  static void
1709  print_process32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
1710 -    __unused char sfrm, int xml)
1711 +    __unused char sfrm, int xml, char rawcred)
1712  {
1713  
1714  	print_tok_type(fp, tok->id, "process", raw, xml);
1715  	if (xml) {
1716  		open_attr(fp, "audit-uid");
1717 -		print_user(fp, tok->tt.proc32.auid, raw);
1718 +		print_user(fp, tok->tt.proc32.auid, raw, rawcred);
1719  		close_attr(fp);
1720  		open_attr(fp, "uid");
1721 -		print_user(fp, tok->tt.proc32.euid, raw);
1722 +		print_user(fp, tok->tt.proc32.euid, raw, rawcred);
1723  		close_attr(fp);
1724  		open_attr(fp, "gid");
1725 -		print_group(fp, tok->tt.proc32.egid, raw);
1726 +		print_group(fp, tok->tt.proc32.egid, raw, rawcred);
1727  		close_attr(fp);
1728  		open_attr(fp, "ruid");
1729 -		print_user(fp, tok->tt.proc32.ruid, raw);
1730 +		print_user(fp, tok->tt.proc32.ruid, raw, rawcred);
1731  		close_attr(fp);
1732  		open_attr(fp, "rgid");
1733 -		print_group(fp, tok->tt.proc32.rgid, raw);
1734 +		print_group(fp, tok->tt.proc32.rgid, raw, rawcred);
1735  		close_attr(fp);
1736  		open_attr(fp, "pid");
1737  		print_4_bytes(fp, tok->tt.proc32.pid, "%u");
1738 @@ -2561,15 +2638,15 @@
1739  		close_tag(fp, tok->id);
1740  	} else {
1741  		print_delim(fp, del);
1742 -		print_user(fp, tok->tt.proc32.auid, raw);
1743 +		print_user(fp, tok->tt.proc32.auid, raw, rawcred);
1744  		print_delim(fp, del);
1745 -		print_user(fp, tok->tt.proc32.euid, raw);
1746 +		print_user(fp, tok->tt.proc32.euid, raw, rawcred);
1747  		print_delim(fp, del);
1748 -		print_group(fp, tok->tt.proc32.egid, raw);
1749 +		print_group(fp, tok->tt.proc32.egid, raw, rawcred);
1750  		print_delim(fp, del);
1751 -		print_user(fp, tok->tt.proc32.ruid, raw);
1752 +		print_user(fp, tok->tt.proc32.ruid, raw, rawcred);
1753  		print_delim(fp, del);
1754 -		print_group(fp, tok->tt.proc32.rgid, raw);
1755 +		print_group(fp, tok->tt.proc32.rgid, raw, rawcred);
1756  		print_delim(fp, del);
1757  		print_4_bytes(fp, tok->tt.proc32.pid, "%u");
1758  		print_delim(fp, del);
1759 @@ -2641,24 +2718,24 @@
1760  
1761  static void
1762  print_process64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
1763 -    __unused char sfrm, int xml)
1764 +    __unused char sfrm, int xml, char rawcred)
1765  {
1766  	print_tok_type(fp, tok->id, "process", raw, xml);
1767  	if (xml) {
1768  		open_attr(fp, "audit-uid");
1769 -		print_user(fp, tok->tt.proc64.auid, raw);
1770 +		print_user(fp, tok->tt.proc64.auid, raw, rawcred);
1771  		close_attr(fp);
1772  		open_attr(fp, "uid");
1773 -		print_user(fp, tok->tt.proc64.euid, raw);
1774 +		print_user(fp, tok->tt.proc64.euid, raw, rawcred);
1775  		close_attr(fp);
1776  		open_attr(fp, "gid");
1777 -		print_group(fp, tok->tt.proc64.egid, raw);
1778 +		print_group(fp, tok->tt.proc64.egid, raw, rawcred);
1779  		close_attr(fp);
1780  		open_attr(fp, "ruid");
1781 -		print_user(fp, tok->tt.proc64.ruid, raw);
1782 +		print_user(fp, tok->tt.proc64.ruid, raw, rawcred);
1783  		close_attr(fp);
1784  		open_attr(fp, "rgid");
1785 -		print_group(fp, tok->tt.proc64.rgid, raw);
1786 +		print_group(fp, tok->tt.proc64.rgid, raw, rawcred);
1787  		close_attr(fp);
1788  		open_attr(fp, "pid");
1789  		print_4_bytes(fp, tok->tt.proc64.pid, "%u");
1790 @@ -2673,15 +2750,15 @@
1791  		close_tag(fp, tok->id);
1792  	} else {
1793  		print_delim(fp, del);
1794 -		print_user(fp, tok->tt.proc64.auid, raw);
1795 +		print_user(fp, tok->tt.proc64.auid, raw, rawcred);
1796  		print_delim(fp, del);
1797 -		print_user(fp, tok->tt.proc64.euid, raw);
1798 +		print_user(fp, tok->tt.proc64.euid, raw, rawcred);
1799  		print_delim(fp, del);
1800 -		print_group(fp, tok->tt.proc64.egid, raw);
1801 +		print_group(fp, tok->tt.proc64.egid, raw, rawcred);
1802  		print_delim(fp, del);
1803 -		print_user(fp, tok->tt.proc64.ruid, raw);
1804 +		print_user(fp, tok->tt.proc64.ruid, raw, rawcred);
1805  		print_delim(fp, del);
1806 -		print_group(fp, tok->tt.proc64.rgid, raw);
1807 +		print_group(fp, tok->tt.proc64.rgid, raw, rawcred);
1808  		print_delim(fp, del);
1809  		print_4_bytes(fp, tok->tt.proc64.pid, "%u");
1810  		print_delim(fp, del);
1811 @@ -2768,25 +2845,25 @@
1812  
1813  static void
1814  print_process32ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
1815 -    __unused char sfrm, int xml)
1816 +    __unused char sfrm, int xml, char rawcred)
1817  {
1818  
1819  	print_tok_type(fp, tok->id, "process_ex", raw, xml);
1820  	if (xml) {
1821  		open_attr(fp, "audit-uid");
1822 -		print_user(fp, tok->tt.proc32_ex.auid, raw);
1823 +		print_user(fp, tok->tt.proc32_ex.auid, raw, rawcred);
1824  		close_attr(fp);
1825  		open_attr(fp, "uid");
1826 -		print_user(fp, tok->tt.proc32_ex.euid, raw);
1827 +		print_user(fp, tok->tt.proc32_ex.euid, raw, rawcred);
1828  		close_attr(fp);
1829  		open_attr(fp, "gid");
1830 -		print_group(fp, tok->tt.proc32_ex.egid, raw);
1831 +		print_group(fp, tok->tt.proc32_ex.egid, raw, rawcred);
1832  		close_attr(fp);
1833  		open_attr(fp, "ruid");
1834 -		print_user(fp, tok->tt.proc32_ex.ruid, raw);
1835 +		print_user(fp, tok->tt.proc32_ex.ruid, raw, rawcred);
1836  		close_attr(fp);
1837  		open_attr(fp, "rgid");
1838 -		print_group(fp, tok->tt.proc32_ex.rgid, raw);
1839 +		print_group(fp, tok->tt.proc32_ex.rgid, raw, rawcred);
1840  		close_attr(fp);
1841  		open_attr(fp, "pid");
1842  		print_4_bytes(fp, tok->tt.proc32_ex.pid, "%u");
1843 @@ -2802,15 +2879,15 @@
1844  		close_tag(fp, tok->id);
1845  	} else {
1846  		print_delim(fp, del);
1847 -		print_user(fp, tok->tt.proc32_ex.auid, raw);
1848 +		print_user(fp, tok->tt.proc32_ex.auid, raw, rawcred);
1849  		print_delim(fp, del);
1850 -		print_user(fp, tok->tt.proc32_ex.euid, raw);
1851 +		print_user(fp, tok->tt.proc32_ex.euid, raw, rawcred);
1852  		print_delim(fp, del);
1853 -		print_group(fp, tok->tt.proc32_ex.egid, raw);
1854 +		print_group(fp, tok->tt.proc32_ex.egid, raw, rawcred);
1855  		print_delim(fp, del);
1856 -		print_user(fp, tok->tt.proc32_ex.ruid, raw);
1857 +		print_user(fp, tok->tt.proc32_ex.ruid, raw, rawcred);
1858  		print_delim(fp, del);
1859 -		print_group(fp, tok->tt.proc32_ex.rgid, raw);
1860 +		print_group(fp, tok->tt.proc32_ex.rgid, raw, rawcred);
1861  		print_delim(fp, del);
1862  		print_4_bytes(fp, tok->tt.proc32_ex.pid, "%u");
1863  		print_delim(fp, del);
1864 @@ -2898,24 +2975,24 @@
1865  
1866  static void
1867  print_process64ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
1868 -    __unused char sfrm, int xml)
1869 +    __unused char sfrm, int xml, char rawcred)
1870  {
1871  	print_tok_type(fp, tok->id, "process_ex", raw, xml);
1872  	if (xml) {
1873  		open_attr(fp, "audit-uid");
1874 -		print_user(fp, tok->tt.proc64_ex.auid, raw);
1875 +		print_user(fp, tok->tt.proc64_ex.auid, raw, rawcred);
1876  		close_attr(fp);
1877  		open_attr(fp, "uid");
1878 -		print_user(fp, tok->tt.proc64_ex.euid, raw);
1879 +		print_user(fp, tok->tt.proc64_ex.euid, raw, rawcred);
1880  		close_attr(fp);
1881  		open_attr(fp, "gid");
1882 -		print_group(fp, tok->tt.proc64_ex.egid, raw);
1883 +		print_group(fp, tok->tt.proc64_ex.egid, raw, rawcred);
1884  		close_attr(fp);
1885  		open_attr(fp, "ruid");
1886 -		print_user(fp, tok->tt.proc64_ex.ruid, raw);
1887 +		print_user(fp, tok->tt.proc64_ex.ruid, raw, rawcred);
1888  		close_attr(fp);
1889  		open_attr(fp, "rgid");
1890 -		print_group(fp, tok->tt.proc64_ex.rgid, raw);
1891 +		print_group(fp, tok->tt.proc64_ex.rgid, raw, rawcred);
1892  		close_attr(fp);
1893  		open_attr(fp, "pid");
1894  		print_4_bytes(fp, tok->tt.proc64_ex.pid, "%u");
1895 @@ -2931,15 +3008,15 @@
1896  		close_tag(fp, tok->id);
1897  	} else {
1898  		print_delim(fp, del);
1899 -		print_user(fp, tok->tt.proc64_ex.auid, raw);
1900 +		print_user(fp, tok->tt.proc64_ex.auid, raw, rawcred);
1901  		print_delim(fp, del);
1902 -		print_user(fp, tok->tt.proc64_ex.euid, raw);
1903 +		print_user(fp, tok->tt.proc64_ex.euid, raw, rawcred);
1904  		print_delim(fp, del);
1905 -		print_group(fp, tok->tt.proc64_ex.egid, raw);
1906 +		print_group(fp, tok->tt.proc64_ex.egid, raw, rawcred);
1907  		print_delim(fp, del);
1908 -		print_user(fp, tok->tt.proc64_ex.ruid, raw);
1909 +		print_user(fp, tok->tt.proc64_ex.ruid, raw, rawcred);
1910  		print_delim(fp, del);
1911 -		print_group(fp, tok->tt.proc64_ex.rgid, raw);
1912 +		print_group(fp, tok->tt.proc64_ex.rgid, raw, rawcred);
1913  		print_delim(fp, del);
1914  		print_4_bytes(fp, tok->tt.proc64_ex.pid, "%u");
1915  		print_delim(fp, del);
1916 @@ -2953,7 +3030,39 @@
1917  }
1918  
1919  /*
1920 - * errno                        1 byte
1921 + * protocol			4 bytes
1922 + */
1923 +static int
1924 +fetch_protocol_tok(tokenstr_t *tok, u_char *buf, int len)
1925 +{
1926 +	int err = 0;
1927 +
1928 +	READ_TOKEN_U_INT32(buf, len, tok->tt.prot.protocol, tok->len, err);
1929 +	if (err)
1930 +		return (-1);
1931 +
1932 +	return (0);
1933 +}
1934 +
1935 +static void
1936 +print_protocol_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
1937 +    __unused char sfrm, int xml)
1938 +{
1939 +
1940 +	print_tok_type(fp, tok->id, "protocol", raw, xml);
1941 +	if (xml) {
1942 +		open_attr(fp, "protocol");
1943 +		print_protocol(fp, tok->tt.prot.protocol, raw);
1944 +		close_attr(fp);
1945 +		close_tag(fp, tok->id);
1946 +	} else {
1947 +		print_delim(fp, del);
1948 +		print_protocol(fp, tok->tt.prot.protocol, raw);
1949 +	}
1950 +}
1951 +
1952 +/*
1953 + * errno                4 bytes
1954   * return value         4 bytes
1955   */
1956  static int
1957 @@ -2961,7 +3070,7 @@
1958  {
1959  	int err = 0;
1960  
1961 -	READ_TOKEN_U_CHAR(buf, len, tok->tt.ret32.status, tok->len, err);
1962 +	READ_TOKEN_U_INT32(buf, len, tok->tt.ret32.status, tok->len, err);
1963  	if (err)
1964  		return (-1);
1965  
1966 @@ -2999,7 +3108,7 @@
1967  {
1968  	int err = 0;
1969  
1970 -	READ_TOKEN_U_CHAR(buf, len, tok->tt.ret64.err, tok->len, err);
1971 +	READ_TOKEN_U_INT32(buf, len, tok->tt.ret64.err, tok->len, err);
1972  	if (err)
1973  		return (-1);
1974  
1975 @@ -3362,25 +3471,25 @@
1976  
1977  static void
1978  print_subject32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
1979 -    __unused char sfrm, int xml)
1980 +    __unused char sfrm, int xml, char rawcred)
1981  {
1982  
1983  	print_tok_type(fp, tok->id, "subject", raw, xml);
1984  	if (xml) {
1985  		open_attr(fp, "audit-uid");
1986 -		print_user(fp, tok->tt.subj32.auid, raw);
1987 +		print_user(fp, tok->tt.subj32.auid, raw, rawcred);
1988  		close_attr(fp);
1989  		open_attr(fp, "uid");
1990 -		print_user(fp, tok->tt.subj32.euid, raw);
1991 +		print_user(fp, tok->tt.subj32.euid, raw, rawcred);
1992  		close_attr(fp);
1993  		open_attr(fp, "gid");
1994 -		print_group(fp, tok->tt.subj32.egid, raw);
1995 +		print_group(fp, tok->tt.subj32.egid, raw, rawcred);
1996  		close_attr(fp);
1997  		open_attr(fp, "ruid");
1998 -		print_user(fp, tok->tt.subj32.ruid, raw);
1999 +		print_user(fp, tok->tt.subj32.ruid, raw, rawcred);
2000  		close_attr(fp);
2001  		open_attr(fp, "rgid");
2002 -		print_group(fp, tok->tt.subj32.rgid, raw);
2003 +		print_group(fp, tok->tt.subj32.rgid, raw, rawcred);
2004  		close_attr(fp);
2005  		open_attr(fp,"pid");
2006  		print_4_bytes(fp, tok->tt.subj32.pid, "%u");
2007 @@ -3395,15 +3504,15 @@
2008  		close_tag(fp, tok->id);
2009  	} else {
2010  		print_delim(fp, del);
2011 -		print_user(fp, tok->tt.subj32.auid, raw);
2012 +		print_user(fp, tok->tt.subj32.auid, raw, rawcred);
2013  		print_delim(fp, del);
2014 -		print_user(fp, tok->tt.subj32.euid, raw);
2015 +		print_user(fp, tok->tt.subj32.euid, raw, rawcred);
2016  		print_delim(fp, del);
2017 -		print_group(fp, tok->tt.subj32.egid, raw);
2018 +		print_group(fp, tok->tt.subj32.egid, raw, rawcred);
2019  		print_delim(fp, del);
2020 -		print_user(fp, tok->tt.subj32.ruid, raw);
2021 +		print_user(fp, tok->tt.subj32.ruid, raw, rawcred);
2022  		print_delim(fp, del);
2023 -		print_group(fp, tok->tt.subj32.rgid, raw);
2024 +		print_group(fp, tok->tt.subj32.rgid, raw, rawcred);
2025  		print_delim(fp, del);
2026  		print_4_bytes(fp, tok->tt.subj32.pid, "%u");
2027  		print_delim(fp, del);
2028 @@ -3474,25 +3583,25 @@
2029  
2030  static void
2031  print_subject64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
2032 -    __unused char sfrm, int xml)
2033 +    __unused char sfrm, int xml, char rawcred)
2034  {
2035  
2036  	print_tok_type(fp, tok->id, "subject", raw, xml);
2037  	if (xml) {
2038  		open_attr(fp, "audit-uid");
2039 -		print_user(fp, tok->tt.subj64.auid, raw);
2040 +		print_user(fp, tok->tt.subj64.auid, raw, rawcred);
2041  		close_attr(fp);
2042  		open_attr(fp, "uid");
2043 -		print_user(fp, tok->tt.subj64.euid, raw);
2044 +		print_user(fp, tok->tt.subj64.euid, raw, rawcred);
2045  		close_attr(fp);
2046  		open_attr(fp, "gid");
2047 -		print_group(fp, tok->tt.subj64.egid, raw);
2048 +		print_group(fp, tok->tt.subj64.egid, raw, rawcred);
2049  		close_attr(fp);
2050  		open_attr(fp, "ruid");
2051 -		print_user(fp, tok->tt.subj64.ruid, raw);
2052 +		print_user(fp, tok->tt.subj64.ruid, raw, rawcred);
2053  		close_attr(fp);
2054  		open_attr(fp, "rgid");
2055 -		print_group(fp, tok->tt.subj64.rgid, raw);
2056 +		print_group(fp, tok->tt.subj64.rgid, raw, rawcred);
2057  		close_attr(fp);
2058  		open_attr(fp, "pid");
2059  		print_4_bytes(fp, tok->tt.subj64.pid, "%u");
2060 @@ -3507,15 +3616,15 @@
2061  		close_tag(fp, tok->id);
2062  	} else {
2063  		print_delim(fp, del);
2064 -		print_user(fp, tok->tt.subj64.auid, raw);
2065 +		print_user(fp, tok->tt.subj64.auid, raw, rawcred);
2066  		print_delim(fp, del);
2067 -		print_user(fp, tok->tt.subj64.euid, raw);
2068 +		print_user(fp, tok->tt.subj64.euid, raw, rawcred);
2069  		print_delim(fp, del);
2070 -		print_group(fp, tok->tt.subj64.egid, raw);
2071 +		print_group(fp, tok->tt.subj64.egid, raw, rawcred);
2072  		print_delim(fp, del);
2073 -		print_user(fp, tok->tt.subj64.ruid, raw);
2074 +		print_user(fp, tok->tt.subj64.ruid, raw, rawcred);
2075  		print_delim(fp, del);
2076 -		print_group(fp, tok->tt.subj64.rgid, raw);
2077 +		print_group(fp, tok->tt.subj64.rgid, raw, rawcred);
2078  		print_delim(fp, del);
2079  		print_4_bytes(fp, tok->tt.subj64.pid, "%u");
2080  		print_delim(fp, del);
2081 @@ -3601,25 +3710,25 @@
2082  
2083  static void
2084  print_subject32ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
2085 -    __unused char sfrm, int xml)
2086 +    __unused char sfrm, int xml, char rawcred)
2087  {
2088  
2089  	print_tok_type(fp, tok->id, "subject_ex", raw, xml);
2090  	if (xml) {
2091  		open_attr(fp, "audit-uid");
2092 -		print_user(fp, tok->tt.subj32_ex.auid, raw);
2093 +		print_user(fp, tok->tt.subj32_ex.auid, raw, rawcred);
2094  		close_attr(fp);
2095  		open_attr(fp, "uid");
2096 -		print_user(fp, tok->tt.subj32_ex.euid, raw);
2097 +		print_user(fp, tok->tt.subj32_ex.euid, raw, rawcred);
2098  		close_attr(fp);
2099  		open_attr(fp, "gid");
2100 -		print_group(fp, tok->tt.subj32_ex.egid, raw);
2101 +		print_group(fp, tok->tt.subj32_ex.egid, raw, rawcred);
2102  		close_attr(fp);
2103  		open_attr(fp, "ruid");
2104 -		print_user(fp, tok->tt.subj32_ex.ruid, raw);
2105 +		print_user(fp, tok->tt.subj32_ex.ruid, raw, rawcred);
2106  		close_attr(fp);
2107  		open_attr(fp, "rgid");
2108 -		print_group(fp, tok->tt.subj32_ex.rgid, raw);
2109 +		print_group(fp, tok->tt.subj32_ex.rgid, raw, rawcred);
2110  		close_attr(fp);
2111  		open_attr(fp, "pid");
2112  		print_4_bytes(fp, tok->tt.subj32_ex.pid, "%u");
2113 @@ -3635,15 +3744,15 @@
2114  		close_tag(fp, tok->id);
2115  	} else {
2116  		print_delim(fp, del);
2117 -		print_user(fp, tok->tt.subj32_ex.auid, raw);
2118 +		print_user(fp, tok->tt.subj32_ex.auid, raw, rawcred);
2119  		print_delim(fp, del);
2120 -		print_user(fp, tok->tt.subj32_ex.euid, raw);
2121 +		print_user(fp, tok->tt.subj32_ex.euid, raw, rawcred);
2122  		print_delim(fp, del);
2123 -		print_group(fp, tok->tt.subj32_ex.egid, raw);
2124 +		print_group(fp, tok->tt.subj32_ex.egid, raw, rawcred);
2125  		print_delim(fp, del);
2126 -		print_user(fp, tok->tt.subj32_ex.ruid, raw);
2127 +		print_user(fp, tok->tt.subj32_ex.ruid, raw, rawcred);
2128  		print_delim(fp, del);
2129 -		print_group(fp, tok->tt.subj32_ex.rgid, raw);
2130 +		print_group(fp, tok->tt.subj32_ex.rgid, raw, rawcred);
2131  		print_delim(fp, del);
2132  		print_4_bytes(fp, tok->tt.subj32_ex.pid, "%u");
2133  		print_delim(fp, del);
2134 @@ -3730,24 +3839,24 @@
2135  
2136  static void
2137  print_subject64ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
2138 -    __unused char sfrm, int xml)
2139 +    __unused char sfrm, int xml, char rawcred)
2140  {
2141  	print_tok_type(fp, tok->id, "subject_ex", raw, xml);
2142  	if (xml) {
2143  		open_attr(fp, "audit-uid");
2144 -		print_user(fp, tok->tt.subj64_ex.auid, raw);
2145 +		print_user(fp, tok->tt.subj64_ex.auid, raw, rawcred);
2146  		close_attr(fp);
2147  		open_attr(fp, "uid");
2148 -		print_user(fp, tok->tt.subj64_ex.euid, raw);
2149 +		print_user(fp, tok->tt.subj64_ex.euid, raw, rawcred);
2150  		close_attr(fp);
2151  		open_attr(fp, "gid");
2152 -		print_group(fp, tok->tt.subj64_ex.egid, raw);
2153 +		print_group(fp, tok->tt.subj64_ex.egid, raw, rawcred);
2154  		close_attr(fp);
2155  		open_attr(fp, "ruid");
2156 -		print_user(fp, tok->tt.subj64_ex.ruid, raw);
2157 +		print_user(fp, tok->tt.subj64_ex.ruid, raw, rawcred);
2158  		close_attr(fp);
2159  		open_attr(fp, "rgid");
2160 -		print_group(fp, tok->tt.subj64_ex.rgid, raw);
2161 +		print_group(fp, tok->tt.subj64_ex.rgid, raw, rawcred);
2162  		close_attr(fp);
2163  		open_attr(fp, "pid");
2164  		print_4_bytes(fp, tok->tt.subj64_ex.pid, "%u");
2165 @@ -3763,15 +3872,15 @@
2166  		close_tag(fp, tok->id);
2167  	} else {
2168  		print_delim(fp, del);
2169 -		print_user(fp, tok->tt.subj64_ex.auid, raw);
2170 +		print_user(fp, tok->tt.subj64_ex.auid, raw, rawcred);
2171  		print_delim(fp, del);
2172 -		print_user(fp, tok->tt.subj64_ex.euid, raw);
2173 +		print_user(fp, tok->tt.subj64_ex.euid, raw, rawcred);
2174  		print_delim(fp, del);
2175 -		print_group(fp, tok->tt.subj64_ex.egid, raw);
2176 +		print_group(fp, tok->tt.subj64_ex.egid, raw, rawcred);
2177  		print_delim(fp, del);
2178 -		print_user(fp, tok->tt.subj64_ex.ruid, raw);
2179 +		print_user(fp, tok->tt.subj64_ex.ruid, raw, rawcred);
2180  		print_delim(fp, del);
2181 -		print_group(fp, tok->tt.subj64_ex.rgid, raw);
2182 +		print_group(fp, tok->tt.subj64_ex.rgid, raw, rawcred);
2183  		print_delim(fp, del);
2184  		print_4_bytes(fp, tok->tt.subj64_ex.pid, "%u");
2185  		print_delim(fp, del);
2186 @@ -3821,6 +3930,39 @@
2187  }
2188  
2189  /*
2190 + * vtype			4 bytes
2191 + */
2192 +static int
2193 +fetch_vtype_tok(tokenstr_t *tok, u_char *buf, int len)
2194 +{
2195 +	int err = 0;
2196 +
2197 +	READ_TOKEN_U_INT32(buf, len, tok->tt.vtype.vtype, tok->len, err);
2198 +	if (err)
2199 +		return (-1);
2200 +
2201 +	return (0);
2202 +}
2203 +
2204 +
2205 +static void
2206 +print_vtype_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
2207 +    __unused char sfrm, int xml)
2208 +{
2209 +
2210 +	print_tok_type(fp, tok->id, "vnode type", raw, xml);
2211 +	if (xml) {
2212 +		open_attr(fp, "vtype");
2213 +		print_vtype(fp, tok->tt.vtype.vtype, raw);
2214 +		close_attr(fp);
2215 +		close_tag(fp, tok->id);
2216 +	} else {
2217 +		print_delim(fp, del);
2218 +		print_vtype(fp, tok->tt.vtype.vtype, raw);
2219 +	}
2220 +}
2221 +
2222 +/*
2223   * socket domain           2 bytes
2224   * socket type             2 bytes
2225   * address type            2 bytes
2226 @@ -4107,6 +4249,9 @@
2227  	case AUT_PROCESS64_EX:
2228  		return (fetch_process64ex_tok(tok, buf, len));
2229  
2230 +	case AUT_PROTOCOL:
2231 +		return (fetch_protocol_tok(tok, buf, len));
2232 +
2233  	case AUT_RETURN32:
2234  		return (fetch_return32_tok(tok, buf, len));
2235  
2236 @@ -4143,6 +4288,9 @@
2237  	case AUT_TEXT:
2238  		return (fetch_text_tok(tok, buf, len));
2239  
2240 +	case AUT_VTYPE:
2241 +		return (fetch_vtype_tok(tok, buf, len));
2242 +
2243  	case AUT_SOCKET_EX:
2244  		return (fetch_socketex32_tok(tok, buf, len));
2245  
2246 @@ -4161,7 +4309,7 @@
2247   * 'prints' the token out to outfp.
2248   */
2249  void
2250 -au_print_tok(FILE *outfp, tokenstr_t *tok, char *del, char raw, char sfrm)
2251 +au_print_tok(FILE *outfp, tokenstr_t *tok, char *del, char raw, char sfrm, char rawcred)
2252  {
2253  
2254  	switch(tok->id) {
2255 @@ -4198,11 +4346,11 @@
2256  		return;
2257  
2258  	case AUT_ATTR32:
2259 -		print_attr32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2260 +		print_attr32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN, rawcred);
2261  		return;
2262  
2263  	case AUT_ATTR64:
2264 -		print_attr64_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2265 +		print_attr64_tok(outfp, tok, del, raw, sfrm, AU_PLAIN, rawcred);
2266  		return;
2267  
2268  	case AUT_EXIT:
2269 @@ -4222,7 +4370,7 @@
2270  		return;
2271  
2272  	case AUT_NEWGROUPS:
2273 -		print_newgroups_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2274 +		print_newgroups_tok(outfp, tok, del, raw, sfrm, AU_PLAIN, rawcred);
2275  		return;
2276  
2277  	case AUT_IN_ADDR:
2278 @@ -4242,7 +4390,7 @@
2279  		return;
2280  
2281  	case AUT_IPC_PERM:
2282 -		print_ipcperm_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2283 +		print_ipcperm_tok(outfp, tok, del, raw, sfrm, AU_PLAIN, rawcred);
2284  		return;
2285  
2286  	case AUT_IPORT:
2287 @@ -4258,19 +4406,23 @@
2288  		return;
2289  
2290  	case AUT_PROCESS32:
2291 -		print_process32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2292 +		print_process32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN, rawcred);
2293  		return;
2294  
2295  	case AUT_PROCESS32_EX:
2296 -		print_process32ex_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2297 +		print_process32ex_tok(outfp, tok, del, raw, sfrm, AU_PLAIN, rawcred);
2298  		return;
2299  
2300  	case AUT_PROCESS64:
2301 -		print_process64_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2302 +		print_process64_tok(outfp, tok, del, raw, sfrm, AU_PLAIN, rawcred);
2303  		return;
2304  
2305  	case AUT_PROCESS64_EX:
2306 -		print_process64ex_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2307 +		print_process64ex_tok(outfp, tok, del, raw, sfrm, AU_PLAIN, rawcred);
2308 +		return;
2309 +
2310 +	case AUT_PROTOCOL:
2311 +		print_protocol_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2312  		return;
2313  
2314  	case AUT_RETURN32:
2315 @@ -4302,25 +4454,29 @@
2316  		return;
2317  
2318  	case AUT_SUBJECT32:
2319 -		print_subject32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2320 +		print_subject32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN, rawcred);
2321  		return;
2322  
2323  	case AUT_SUBJECT64:
2324 -		print_subject64_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2325 +		print_subject64_tok(outfp, tok, del, raw, sfrm, AU_PLAIN, rawcred);
2326  		return;
2327  
2328  	case AUT_SUBJECT32_EX:
2329 -		print_subject32ex_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2330 +		print_subject32ex_tok(outfp, tok, del, raw, sfrm, AU_PLAIN, rawcred);
2331  		return;
2332  
2333  	case AUT_SUBJECT64_EX:
2334 -		print_subject64ex_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2335 +		print_subject64ex_tok(outfp, tok, del, raw, sfrm, AU_PLAIN, rawcred);
2336  		return;
2337  
2338  	case AUT_TEXT:
2339  		print_text_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2340  		return;
2341  
2342 +	case AUT_VTYPE:
2343 +		print_vtype_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2344 +		return;
2345 +
2346  	case AUT_SOCKET_EX:
2347  		print_socketex32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
2348  		return;
2349 @@ -4339,7 +4495,7 @@
2350   */
2351  void
2352  au_print_tok_xml(FILE *outfp, tokenstr_t *tok, char *del, char raw,
2353 -    char sfrm)
2354 +    char sfrm, char rawcred)
2355  {
2356  
2357  	switch(tok->id) {
2358 @@ -4376,11 +4532,11 @@
2359  		return;
2360  
2361  	case AUT_ATTR32:
2362 -		print_attr32_tok(outfp, tok, del, raw, sfrm, AU_XML);
2363 +		print_attr32_tok(outfp, tok, del, raw, sfrm, AU_XML, rawcred);
2364  		return;
2365  
2366  	case AUT_ATTR64:
2367 -		print_attr64_tok(outfp, tok, del, raw, sfrm, AU_XML);
2368 +		print_attr64_tok(outfp, tok, del, raw, sfrm, AU_XML, rawcred);
2369  		return;
2370  
2371  	case AUT_EXIT:
2372 @@ -4400,7 +4556,7 @@
2373  		return;
2374  
2375  	case AUT_NEWGROUPS:
2376 -		print_newgroups_tok(outfp, tok, del, raw, sfrm, AU_XML);
2377 +		print_newgroups_tok(outfp, tok, del, raw, sfrm, AU_XML, rawcred);
2378  		return;
2379  
2380  	case AUT_IN_ADDR:
2381 @@ -4420,7 +4576,7 @@
2382  		return;
2383  
2384  	case AUT_IPC_PERM:
2385 -		print_ipcperm_tok(outfp, tok, del, raw, sfrm, AU_XML);
2386 +		print_ipcperm_tok(outfp, tok, del, raw, sfrm, AU_XML, rawcred);
2387  		return;
2388  
2389  	case AUT_IPORT:
2390 @@ -4436,19 +4592,23 @@
2391  		return;
2392  
2393  	case AUT_PROCESS32:
2394 -		print_process32_tok(outfp, tok, del, raw, sfrm, AU_XML);
2395 +		print_process32_tok(outfp, tok, del, raw, sfrm, AU_XML, rawcred);
2396  		return;
2397  
2398  	case AUT_PROCESS32_EX:
2399 -		print_process32ex_tok(outfp, tok, del, raw, sfrm, AU_XML);
2400 +		print_process32ex_tok(outfp, tok, del, raw, sfrm, AU_XML, rawcred);
2401  		return;
2402  
2403  	case AUT_PROCESS64:
2404 -		print_process64_tok(outfp, tok, del, raw, sfrm, AU_XML);
2405 +		print_process64_tok(outfp, tok, del, raw, sfrm, AU_XML, rawcred);
2406  		return;
2407  
2408  	case AUT_PROCESS64_EX:
2409 -		print_process64ex_tok(outfp, tok, del, raw, sfrm, AU_XML);
2410 +		print_process64ex_tok(outfp, tok, del, raw, sfrm, AU_XML, rawcred);
2411 +		return;
2412 +
2413 +	case AUT_PROTOCOL:
2414 +		print_protocol_tok(outfp, tok, del, raw, sfrm, AU_XML);
2415  		return;
2416  
2417  	case AUT_RETURN32:
2418 @@ -4476,25 +4636,29 @@
2419  		return;
2420  
2421  	case AUT_SUBJECT32:
2422 -		print_subject32_tok(outfp, tok, del, raw, sfrm, AU_XML);
2423 +		print_subject32_tok(outfp, tok, del, raw, sfrm, AU_XML, rawcred);
2424  		return;
2425  
2426  	case AUT_SUBJECT64:
2427 -		print_subject64_tok(outfp, tok, del, raw, sfrm, AU_XML);
2428 +		print_subject64_tok(outfp, tok, del, raw, sfrm, AU_XML, rawcred);
2429  		return;
2430  
2431  	case AUT_SUBJECT32_EX:
2432 -		print_subject32ex_tok(outfp, tok, del, raw, sfrm, AU_XML);
2433 +		print_subject32ex_tok(outfp, tok, del, raw, sfrm, AU_XML, rawcred);
2434  		return;
2435  
2436  	case AUT_SUBJECT64_EX:
2437 -		print_subject64ex_tok(outfp, tok, del, raw, sfrm, AU_XML);
2438 +		print_subject64ex_tok(outfp, tok, del, raw, sfrm, AU_XML, rawcred);
2439  		return;
2440  
2441  	case AUT_TEXT:
2442  		print_text_tok(outfp, tok, del, raw, sfrm, AU_XML);
2443  		return;
2444  
2445 +	case AUT_VTYPE:
2446 +		print_vtype_tok(outfp, tok, del, raw, sfrm, AU_XML);
2447 +		return;
2448 +
2449  	case AUT_SOCKET_EX:
2450  		print_socketex32_tok(outfp, tok, del, raw, sfrm, AU_XML);
2451  		return;
2452 --- //depot/vendor/freebsd/src/contrib/openbsm/sys/bsm/audit_errno.h	2009-01-14 11:35:39.000000000 0000
2453 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/sys/bsm/audit_errno.h	2010-08-06 18:10:43.000000000 0000
2454 @@ -206,9 +206,62 @@
2455  #define	BSM_ERRNO_EKEYREJECTED		222	/* Linux-specific. */
2456  
2457  /*
2458 + * NFS specific error numbers
2459 + */
2460 +#define BSM_NFS_ERRNO_WFLUSH		300
2461 +#define BSM_NFS_ERRNO_BADHANDLE		301
2462 +#define BSM_NFS_ERRNO_NOT_SYNC		302
2463 +#define BSM_NFS_ERRNO_BAD_COOKIE	303
2464 +#define BSM_NFS_ERRNO_NOTSUPP		304
2465 +#define BSM_NFS_ERRNO_TOOSMALL		305
2466 +#define BSM_NFS_ERRNO_SERVERFAULT	306
2467 +#define BSM_NFS_ERRNO_BADTYPE		307
2468 +#define BSM_NFS_ERRNO_DELAY		308
2469 +#define BSM_NFS_ERRNO_SAME		309
2470 +#define BSM_NFS_ERRNO_DENIED		310
2471 +#define BSM_NFS_ERRNO_EXPIRED		311
2472 +#define BSM_NFS_ERRNO_LOCKED		312
2473 +#define BSM_NFS_ERRNO_GRACE		313
2474 +#define BSM_NFS_ERRNO_FHEXPIRED		314
2475 +#define BSM_NFS_ERRNO_SHAREDENIED	315
2476 +#define BSM_NFS_ERRNO_WRONGSEC		316
2477 +#define BSM_NFS_ERRNO_CLIDINUSE		317
2478 +#define BSM_NFS_ERRNO_RESOURCE		318
2479 +#define BSM_NFS_ERRNO_MOVED		319
2480 +#define BSM_NFS_ERRNO_NOFILEHANDLE	320
2481 +#define BSM_NFS_ERRNO_MINORVERMISMATCH	321
2482 +#define BSM_NFS_ERRNO_STALECLIENTID	322
2483 +#define BSM_NFS_ERRNO_STALESTATEID	323
2484 +#define BSM_NFS_ERRNO_OLDSTATEID	324
2485 +#define BSM_NFS_ERRNO_BADSTATEID	325
2486 +#define BSM_NFS_ERRNO_BADSEQID		326
2487 +#define BSM_NFS_ERRNO_NOTSAME		327
2488 +#define BSM_NFS_ERRNO_LOCKRANGE		328
2489 +#define BSM_NFS_ERRNO_SYMLINK		329
2490 +#define BSM_NFS_ERRNO_RESTOREFH		330
2491 +#define BSM_NFS_ERRNO_LEASEMOVED	331
2492 +#define BSM_NFS_ERRNO_ATTRNOTSUPP	332
2493 +#define BSM_NFS_ERRNO_NOGRACE		333
2494 +#define BSM_NFS_ERRNO_RECLAIMBAD	334
2495 +#define BSM_NFS_ERRNO_RECLAIMCONFLICT	335
2496 +#define BSM_NFS_ERRNO_BADXDR		336
2497 +#define BSM_NFS_ERRNO_LOCKSHELD		337
2498 +#define BSM_NFS_ERRNO_OPENMODE		338
2499 +#define BSM_NFS_ERRNO_BADOWNER		339
2500 +#define BSM_NFS_ERRNO_BADCHAR		340
2501 +#define BSM_NFS_ERRNO_BADNAME		341
2502 +#define BSM_NFS_ERRNO_BADRANGE		342
2503 +#define BSM_NFS_ERRNO_LOCKNOTSUPP	343
2504 +#define BSM_NFS_ERRNO_OPILLEGAL		344
2505 +#define BSM_NFS_ERRNO_DEADLOCK		345
2506 +#define BSM_NFS_ERRNO_FILEOPEN		346
2507 +#define BSM_NFS_ERRNO_ADMINREVOKED	347
2508 +#define BSM_NFS_ERRNO_CBPATHDOWN	348
2509 +
2510 +/*
2511   * In the event that OpenBSM doesn't have a file representation of a local
2512   * error number, use this.
2513   */
2514 -#define	BSM_ERRNO_UNKNOWN		250	/* OpenBSM-specific. */
2515 +#define	BSM_ERRNO_UNKNOWN		1000	/* OpenBSM-specific. */
2516  
2517  #endif /* !_BSM_AUDIT_ERRNO_H_ */
2518 --- //depot/vendor/freebsd/src/contrib/openbsm/sys/bsm/audit_record.h	2009-04-19 16:37:15.000000000 0000
2519 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/contrib/openbsm/sys/bsm/audit_record.h	2010-08-07 16:49:25.000000000 0000
2520 @@ -125,6 +125,10 @@
2521  #define	AUT_SOCKINET128		0x81		/* XXX */
2522  #define	AUT_SOCKUNIX		0x82		/* XXX */
2523  
2524 +/* Yet more token identifiers */
2525 +#define AUT_PROTOCOL		0x83
2526 +#define AUT_VTYPE		0x84
2527 +
2528  /* print values for the arbitrary token */
2529  #define AUP_BINARY      0
2530  #define AUP_OCTAL       1
2531 @@ -170,6 +174,11 @@
2532  
2533  #define	AUT_TRAILER_MAGIC	0xb105
2534  
2535 +/* NFS specific stuff */
2536 +#define ND_NFSV2                0x00000004
2537 +#define ND_NFSV3                0x00000008
2538 +#define ND_NFSV4                0x00000010
2539 +
2540  /* BSM library calls */
2541  
2542  __BEGIN_DECLS
2543 @@ -284,12 +293,12 @@
2544   * BSM library routines for converting between local and BSM constant spaces.
2545   */
2546  int	 au_bsm_to_domain(u_short bsm_domain, int *local_domainp);
2547 -int	 au_bsm_to_errno(u_char bsm_error, int *errorp);
2548 +int	 au_bsm_to_errno(int bsm_error, int *errorp);
2549  int	 au_bsm_to_fcntl_cmd(u_short bsm_fcntl_cmd, int *local_fcntl_cmdp);
2550  int	 au_bsm_to_socket_type(u_short bsm_socket_type,
2551  	    int *local_socket_typep);
2552  u_short	 au_domain_to_bsm(int local_domain);
2553 -u_char	 au_errno_to_bsm(int local_errno);
2554 +int	 au_errno_to_bsm(int local_errno);
2555  u_short	 au_fcntl_cmd_to_bsm(int local_fcntl_command);
2556  u_short	 au_socket_type_to_bsm(int local_socket_type);
2557  
2558 --- //depot/vendor/freebsd/src/share/man/man9/VOP_VPTOFH.9	2010-04-14 19:35:30.000000000 0000
2559 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/share/man/man9/VOP_VPTOFH.9	2010-08-02 17:57:28.000000000 0000
2560 @@ -38,7 +38,7 @@
2561  .In sys/param.h
2562  .In sys/vnode.h
2563  .Ft int
2564 -.Fn VOP_VPTOFH "struct vnode *vp" "struct fid *fhp"
2565 +.Fn VOP_VPTOFH "struct vnode *vp" "struct fid *fhp" "struct vnode *dvp"
2566  .Sh DESCRIPTION
2567  This is used by the NFS server to create an opaque filehandle which
2568  uniquely identifies the file and which can be used by an NFS client
2569 @@ -50,10 +50,15 @@
2570  The vnode to make a filehandle for.
2571  .It Fa fhp
2572  Return parameter for the filehandle.
2573 +.It Fa dvp
2574 +The directory vnode that contains a dirent for vp, NULL otherwise.
2575 +This is used to store a hint that will facilitate the work of
2576 +.Xr vn_fullpath_nocache 9 .
2577  .El
2578  .Sh SEE ALSO
2579  .Xr VFS 9 ,
2580  .Xr VFS_FHTOVP 9 ,
2581 +.Xr vn_fullpath_nocache 9 ,
2582  .Xr vnode 9
2583  .Sh AUTHORS
2584  This manual page was written by
2585 --- //depot/vendor/freebsd/src/sys/bsm/audit_errno.h	2009-01-14 10:50:16.000000000 0000
2586 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/bsm/audit_errno.h	2010-08-06 18:10:43.000000000 0000
2587 @@ -207,9 +207,62 @@
2588  #define	BSM_ERRNO_EKEYREJECTED		222	/* Linux-specific. */
2589  
2590  /*
2591 + * NFS specific error numbers
2592 + */
2593 +#define BSM_NFS_ERRNO_WFLUSH		300
2594 +#define BSM_NFS_ERRNO_BADHANDLE		301
2595 +#define BSM_NFS_ERRNO_NOT_SYNC		302
2596 +#define BSM_NFS_ERRNO_BAD_COOKIE	303
2597 +#define BSM_NFS_ERRNO_NOTSUPP		304
2598 +#define BSM_NFS_ERRNO_TOOSMALL		305
2599 +#define BSM_NFS_ERRNO_SERVERFAULT	306
2600 +#define BSM_NFS_ERRNO_BADTYPE		307
2601 +#define BSM_NFS_ERRNO_DELAY		308
2602 +#define BSM_NFS_ERRNO_SAME		309
2603 +#define BSM_NFS_ERRNO_DENIED		310
2604 +#define BSM_NFS_ERRNO_EXPIRED		311
2605 +#define BSM_NFS_ERRNO_LOCKED		312
2606 +#define BSM_NFS_ERRNO_GRACE		313
2607 +#define BSM_NFS_ERRNO_FHEXPIRED		314
2608 +#define BSM_NFS_ERRNO_SHAREDENIED	315
2609 +#define BSM_NFS_ERRNO_WRONGSEC		316
2610 +#define BSM_NFS_ERRNO_CLIDINUSE		317
2611 +#define BSM_NFS_ERRNO_RESOURCE		318
2612 +#define BSM_NFS_ERRNO_MOVED		319
2613 +#define BSM_NFS_ERRNO_NOFILEHANDLE	320
2614 +#define BSM_NFS_ERRNO_MINORVERMISMATCH	321
2615 +#define BSM_NFS_ERRNO_STALECLIENTID	322
2616 +#define BSM_NFS_ERRNO_STALESTATEID	323
2617 +#define BSM_NFS_ERRNO_OLDSTATEID	324
2618 +#define BSM_NFS_ERRNO_BADSTATEID	325
2619 +#define BSM_NFS_ERRNO_BADSEQID		326
2620 +#define BSM_NFS_ERRNO_NOTSAME		327
2621 +#define BSM_NFS_ERRNO_LOCKRANGE		328
2622 +#define BSM_NFS_ERRNO_SYMLINK		329
2623 +#define BSM_NFS_ERRNO_RESTOREFH		330
2624 +#define BSM_NFS_ERRNO_LEASEMOVED	331
2625 +#define BSM_NFS_ERRNO_ATTRNOTSUPP	332
2626 +#define BSM_NFS_ERRNO_NOGRACE		333
2627 +#define BSM_NFS_ERRNO_RECLAIMBAD	334
2628 +#define BSM_NFS_ERRNO_RECLAIMCONFLICT	335
2629 +#define BSM_NFS_ERRNO_BADXDR		336
2630 +#define BSM_NFS_ERRNO_LOCKSHELD		337
2631 +#define BSM_NFS_ERRNO_OPENMODE		338
2632 +#define BSM_NFS_ERRNO_BADOWNER		339
2633 +#define BSM_NFS_ERRNO_BADCHAR		340
2634 +#define BSM_NFS_ERRNO_BADNAME		341
2635 +#define BSM_NFS_ERRNO_BADRANGE		342
2636 +#define BSM_NFS_ERRNO_LOCKNOTSUPP	343
2637 +#define BSM_NFS_ERRNO_OPILLEGAL		344
2638 +#define BSM_NFS_ERRNO_DEADLOCK		345
2639 +#define BSM_NFS_ERRNO_FILEOPEN		346
2640 +#define BSM_NFS_ERRNO_ADMINREVOKED	347
2641 +#define BSM_NFS_ERRNO_CBPATHDOWN	348
2642 +
2643 +/*
2644   * In the event that OpenBSM doesn't have a file representation of a local
2645   * error number, use this.
2646   */
2647 -#define	BSM_ERRNO_UNKNOWN		250	/* OpenBSM-specific. */
2648 +#define	BSM_ERRNO_UNKNOWN		1000	/* OpenBSM-specific. */
2649  
2650  #endif /* !_BSM_AUDIT_ERRNO_H_ */
2651 --- //depot/vendor/freebsd/src/sys/bsm/audit_kevents.h	2009-09-29 21:30:13.000000000 0000
2652 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/bsm/audit_kevents.h	2010-07-08 19:00:38.000000000 0000
2653 @@ -385,6 +385,70 @@
2654  #define	AUE_DARWIN_COPYFILE	361	/* Darwin-specific. */
2655  
2656  /*
2657 + * NFS RPC events
2658 + */
2659 +#define	AUE_NFS_NULL 2000
2660 +#define	AUE_NFS_GETATTR 2001
2661 +#define	AUE_NFS_SETATTR 2002
2662 +#define	AUE_NFS_LOOKUP 2003
2663 +#define	AUE_NFS_ACCESS 2004
2664 +#define	AUE_NFS_READLINK 2005
2665 +#define	AUE_NFS_READ 2006
2666 +#define	AUE_NFS_WRITE 2007
2667 +#define	AUE_NFS_CREATE 2008
2668 +#define	AUE_NFS_MKDIR 2009
2669 +#define	AUE_NFS_SYMLINK 2010
2670 +#define	AUE_NFS_MKNOD 2011
2671 +#define	AUE_NFS_REMOVE 2012
2672 +#define	AUE_NFS_RMDIR 2013
2673 +#define	AUE_NFS_RENAME 2014
2674 +#define	AUE_NFS_LINK 2015
2675 +#define	AUE_NFS_READDIR 2016
2676 +#define	AUE_NFS_READDIR_PLUS 2017
2677 +#define	AUE_NFS_STATFS 2018
2678 +#define	AUE_NFS_FSINFO 2019
2679 +#define	AUE_NFS_PATHCONF 2020
2680 +#define	AUE_NFS_COMMIT 2021
2681 +#define	AUE_NFS_NOOP 2022
2682 +/* NFSv4 specific RPC events */
2683 +#define	AUE_NFS_CLOSE 2023
2684 +#define	AUE_NFS_DELEGPURGE 2024
2685 +#define	AUE_NFS_DELEGRETURN 2025
2686 +#define	AUE_NFSv4_GETFH 2026
2687 +#define	AUE_NFS_LOCK 2027
2688 +#define	AUE_NFS_LOCKT 2028
2689 +#define	AUE_NFS_LOCKU 2029
2690 +#define	AUE_NFS_LOOKUPP 2030
2691 +#define	AUE_NFS_NVERIFY 2031
2692 +#define	AUE_NFS_OPEN 2032
2693 +#define	AUE_NFS_OPENATTR 2033
2694 +#define	AUE_NFS_OPENCONFIRM 2034
2695 +#define	AUE_NFS_OPENDOWNGRADE 2035
2696 +#define	AUE_NFS_PUTFH 2036
2697 +#define	AUE_NFS_PUTPUBFH 2037
2698 +#define	AUE_NFS_PUTROOTFH 2038
2699 +#define	AUE_NFS_RENEW 2039
2700 +#define	AUE_NFS_RESTOREFH 2040
2701 +#define	AUE_NFS_SAVEFH 2041
2702 +#define	AUE_NFS_SECINFO 2042
2703 +#define	AUE_NFS_SETCLIENTID 2043
2704 +#define	AUE_NFS_SETCLIENTIDCFRM 2044
2705 +#define	AUE_NFS_VERIFY 2045
2706 +#define	AUE_NFS_RELEASELCKOWN 2046
2707 +#define	AUE_NFS_OPEN_R 2047
2708 +#define	AUE_NFS_OPEN_RC 2048
2709 +#define	AUE_NFS_OPEN_RTC 2049
2710 +#define	AUE_NFS_OPEN_RT 2050
2711 +#define	AUE_NFS_OPEN_RW 2051
2712 +#define	AUE_NFS_OPEN_RWC 2052
2713 +#define	AUE_NFS_OPEN_RWTC 2053
2714 +#define	AUE_NFS_OPEN_RWT 2054
2715 +#define	AUE_NFS_OPEN_W 2055
2716 +#define	AUE_NFS_OPEN_WC 2056
2717 +#define	AUE_NFS_OPEN_WTC 2057
2718 +#define	AUE_NFS_OPEN_WT 2058
2719 +
2720 +/*
2721   * Audit event identifiers added as part of OpenBSM, generally corresponding
2722   * to events in FreeBSD, Darwin, and Linux that were not present in Solaris.
2723   * These often duplicate events added to the Solaris set by Darwin, but use
2724 --- //depot/vendor/freebsd/src/sys/bsm/audit_record.h	2009-04-19 14:55:18.000000000 0000
2725 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/bsm/audit_record.h	2010-08-16 13:30:34.000000000 0000
2726 @@ -126,6 +126,10 @@
2727  #define	AUT_SOCKINET128		0x81		/* XXX */
2728  #define	AUT_SOCKUNIX		0x82		/* XXX */
2729  
2730 +/* Yet more token identifiers */
2731 +#define AUT_PROTOCOL		0x83
2732 +#define AUT_VTYPE		0x84
2733 +
2734  /* print values for the arbitrary token */
2735  #define AUP_BINARY      0
2736  #define AUP_OCTAL       1
2737 @@ -171,6 +175,11 @@
2738  
2739  #define	AUT_TRAILER_MAGIC	0xb105
2740  
2741 +/* NFS specific stuff */
2742 +#define ND_NFSV2                0x00000004
2743 +#define ND_NFSV3                0x00000008
2744 +#define ND_NFSV4                0x00000010
2745 +
2746  /* BSM library calls */
2747  
2748  __BEGIN_DECLS
2749 @@ -247,9 +256,10 @@
2750  	    au_tid_addr_t *tid);
2751  token_t	*au_to_process64_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,
2752  	    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid);
2753 -token_t	*au_to_return(char status, uint32_t ret);
2754 -token_t	*au_to_return32(char status, uint32_t ret);
2755 -token_t	*au_to_return64(char status, uint64_t ret);
2756 +token_t *au_to_protocol(u_int32_t protocol);
2757 +token_t	*au_to_return(u_int32_t status, uint32_t ret);
2758 +token_t	*au_to_return32(u_int32_t status, uint32_t ret);
2759 +token_t	*au_to_return64(u_int32_t status, uint64_t ret);
2760  token_t	*au_to_seq(long audit_count);
2761  token_t	*au_to_socket_ex(u_short so_domain, u_short so_type,
2762  	    struct sockaddr *sa_local, struct sockaddr *sa_remote);
2763 @@ -277,6 +287,7 @@
2764  token_t	*au_to_exec_env(char **envp);
2765  #endif
2766  token_t	*au_to_text(const char *text);
2767 +token_t *au_to_vtype(u_int32_t vtype);
2768  token_t	*au_to_kevent(struct kevent *kev);
2769  token_t	*au_to_trailer(int rec_size);
2770  token_t	*au_to_zonename(const char *zonename);
2771 @@ -285,12 +296,12 @@
2772   * BSM library routines for converting between local and BSM constant spaces.
2773   */
2774  int	 au_bsm_to_domain(u_short bsm_domain, int *local_domainp);
2775 -int	 au_bsm_to_errno(u_char bsm_error, int *errorp);
2776 +int	 au_bsm_to_errno(int bsm_error, int *errorp);
2777  int	 au_bsm_to_fcntl_cmd(u_short bsm_fcntl_cmd, int *local_fcntl_cmdp);
2778  int	 au_bsm_to_socket_type(u_short bsm_socket_type,
2779  	    int *local_socket_typep);
2780  u_short	 au_domain_to_bsm(int local_domain);
2781 -u_char	 au_errno_to_bsm(int local_errno);
2782 +int	 au_errno_to_bsm(int local_errno);
2783  u_short	 au_fcntl_cmd_to_bsm(int local_fcntl_command);
2784  u_short	 au_socket_type_to_bsm(int local_socket_type);
2785  
2786 --- //depot/vendor/freebsd/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c	2009-09-26 00:15:13.000000000 0000
2787 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c	2010-05-24 11:27:15.000000000 0000
2788 @@ -1176,7 +1176,7 @@
2789  
2790  	err = zfsctl_traverse_begin(&vp, LK_SHARED | LK_RETRY);
2791  	if (err == 0)
2792 -		err = VOP_VPTOFH(vp, (void *)ap->a_fid);
2793 +		err = VOP_VPTOFH(vp, (void *)ap->a_fid, NULL);
2794  	zfsctl_traverse_end(vp, err);
2795  	return (err);
2796  }
2797 --- //depot/vendor/freebsd/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c	2010-04-15 16:45:14.000000000 0000
2798 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c	2010-05-27 14:41:11.000000000 0000
2799 @@ -112,6 +112,7 @@
2800  	.vfs_sync =		zfs_sync,
2801  	.vfs_checkexp =		zfs_checkexp,
2802  	.vfs_fhtovp =		zfs_fhtovp,
2803 +	.vfs_fhhint =		vfs_stdfhhint,
2804  };
2805  
2806  VFS_SET(zfs_vfsops, zfs, VFCF_JAIL | VFCF_DELEGADMIN);
2807 --- //depot/vendor/freebsd/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	2010-04-15 16:45:14.000000000 0000
2808 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c	2010-08-02 17:57:28.000000000 0000
2809 @@ -40,6 +40,7 @@
2810  #include <sys/uio.h>
2811  #include <sys/atomic.h>
2812  #include <sys/namei.h>
2813 +#include <sys/dirent.h>
2814  #include <sys/mman.h>
2815  #include <sys/cmn_err.h>
2816  #include <sys/errno.h>
2817 @@ -3771,7 +3772,7 @@
2818  
2819  	ZFS_ENTER(zfsvfs);
2820  	ZFS_VERIFY_ZP(zp);
2821 -	gen = (uint32_t)zp->z_gen;
2822 +	gen = (uint32_t)zp->z_gen;	
2823  
2824  	size = (zfsvfs->z_parent != zfsvfs) ? LONG_FID_LEN : SHORT_FID_LEN;
2825  	fidp->fid_len = size;
2826 @@ -4454,6 +4455,7 @@
2827  	struct vop_fid_args /* {
2828  		struct vnode *a_vp;
2829  		struct fid *a_fid;
2830 +		struct vnode *a_dvp;
2831  	} */ *ap;
2832  {
2833  
2834 @@ -4963,6 +4965,169 @@
2835  	return (EOPNOTSUPP);
2836  }
2837  
2838 +/* 
2839 + * XXXgpf: should relocate them someplace else
2840 + * I just dont know where:S 
2841 + */
2842 +#define PARENTHINT 0x0001
2843 +#define EXHAUSTSEARCH 0x0002
2844 +#define WANTNAME 0x0004
2845 +
2846 +/*
2847 + * VOP_GETPARENT
2848 + * 
2849 + * int VOP_GETPARENT(struct vnode *vp, struct vnode **dvp, uint64_t hint, 
2850 + * 	int flags, char *buf, int *buflen);
2851 + * 
2852 + * Find a parent directory -dvp- with vp as a child. The parent hint is used to 
2853 + * facilitate the search.
2854 + * 
2855 + * Flags should be set to:
2856 + * 	- PARENTHINT: if a hint ino_t of a directory is supplied to facilitate the search
2857 + * 	- EXHAUSTSEARCH: if we are willing to search the whole filesystem to find the directory
2858 + * 	- WANTNAME: if we want to copy the name used to reference the file inside the dir, to buf
2859 + * 
2860 + * ZFS note: only WANTNAME & PARENTHINT are actually used in ZFS code
2861 + * 
2862 + * Locks: vp should be locked on entry and will still be locked on exit.
2863 + * On success, dvp will be locked and have its reference count incremented.
2864 + * 
2865 + */
2866 +int
2867 +zfs_freebsd_getparent(struct vop_getparent_args *ap)
2868 +/*
2869 +vop_getparent {
2870 +	IN struct vnode *a_vp;
2871 +	OUT struct vnode **a_vpp;
2872 +	IN uint64_t a_hint;
2873 +	IN int a_flags;
2874 +	INOUT char *a_buf;
2875 +	INOUT int *a_buflen;
2876 +};
2877 +*/
2878 +{
2879 +	znode_t	*zp;
2880 +	struct mount *mp;
2881 +	struct vnode *dvp;
2882 +	char *dirbuf;
2883 +	int error;
2884 +	ino_t parent;
2885 +	
2886 +	KASSERT(ap->a_vp != NULL, ("VOP_GEPARENT: null vp"));
2887 +	if (ap->a_flags & WANTPARENT)
2888 +		KASSERT(ap->a_buf != NULL, ("VOP_GEPARENT: null buffer"));
2889 +
2890 +	zp = VTOZ(ap->a_vp);
2891 +	mp = ap->a_vp->v_mount;
2892 +	dvp = NULL;
2893 +	dirbuf = NULL;
2894 +
2895 +	if (zp->z_phys == NULL) {
2896 +		error = ENOENT;
2897 +		goto out;
2898 +	}
2899 +	parent = zp->z_phys->zp_parent;
2900 +tryparent:
2901 +	/* grab directory vnode that should contain this znode */
2902 +	error = VFS_VGET(mp, parent, LK_SHARED, &dvp);
2903 +	if (error) {
2904 +		error = ENOENT;
2905 +		goto out;
2906 +	}
2907 +	/* scan the directory for a matching dirent */
2908 +	else {
2909 +		struct uio io;
2910 +		struct iovec iov;
2911 +		struct dirent *dp, *edp;
2912 +		struct thread *td;
2913 +		u_int64_t dirbuflen;
2914 +		int error, eofflag;
2915 +		char foundit;
2916 +
2917 +		foundit = 0;
2918 +		dirbuflen = ((struct znode *)dvp->v_data)->z_blksz;
2919 +		dirbuf = malloc(dirbuflen, M_TEMP, M_WAITOK);
2920 +		td = curthread;
2921 +		
2922 +		/* prep the call to VOP_READDIR() */
2923 +		iov.iov_base = dirbuf;
2924 +		iov.iov_len = dirbuflen;
2925 +		io.uio_iov = &iov;
2926 +		io.uio_iovcnt = 1;
2927 +		io.uio_offset = 0;
2928 +		io.uio_resid = dirbuflen;
2929 +		io.uio_segflg = UIO_SYSSPACE;
2930 +		io.uio_rw = UIO_READ;
2931 +		io.uio_td = td;
2932 +		eofflag = 0;
2933 +
2934 +		error = VOP_READDIR(dvp, &io, td->td_ucred, &eofflag, NULL, NULL);
2935 +		if (error) {
2936 +			error = EIO;
2937 +			goto out;
2938 +		}
2939 +
2940 +		/* search for the correct znode number inside the directory */
2941 +		edp = (struct dirent *)&dirbuf[dirbuflen - io.uio_resid];
2942 +		for (dp = (struct dirent *)dirbuf; dp < edp; ) {
2943 +			if (dp->d_reclen > 0) {	
2944 +				/* found it */
2945 +				if (zp->z_id == ((struct dirent *)dp)->d_fileno) {
2946 +					if (ap->a_flags & WANTNAME) {
2947 +						char *pch;
2948 +						int len;
2949 +
2950 +						pch = ((struct dirent *)dp)->d_name;
2951 +						len = strlen(pch);
2952 +
2953 +						if (len >= *(ap->a_buflen)) {
2954 +							error = ENOMEM;
2955 +							goto out;
2956 +						}
2957 +
2958 +						strlcpy(ap->a_buf, ((struct dirent *)dp)->d_name, *(ap->a_buflen));
2959 +						*(ap->a_buflen) -= len + 1;
2960 +					}
2961 +					foundit = 1;
2962 +					break;
2963 +				}
2964 +				dp = (struct dirent *)((char *)dp + dp->d_reclen);
2965 +			} 
2966 +			else {
2967 +				error = EIO;
2968 +				break;
2969 +			}
2970 +		}
2971 +
2972 +		if (foundit == 0 && error == 0)
2973 +			error = ENOENT;
2974 +	}
2975 +
2976 +out:
2977 +	if (dirbuf != NULL) {
2978 +		free(dirbuf, M_TEMP);
2979 +		dirbuf = NULL;
2980 +	}
2981 +	
2982 +	if (error && dvp != NULL) {
2983 +		vput(dvp);
2984 +		dvp = NULL;
2985 +	}
2986 +
2987 +	/* if an error occured and we have been supplied with a parenthint, try it out */
2988 +	if (error && (ap->a_flags & PARENTHINT) && parent != ap->a_hint) {
2989 +		parent = ap->a_hint;		
2990 +		goto tryparent;
2991 +	}
2992 +
2993 +	if (error == 0 && dvp != NULL)
2994 +		*(ap->a_vpp) = dvp;
2995 +	else
2996 +		*(ap->a_vpp) = NULL;
2997 +
2998 +	return (error);
2999 +}
3000 +
3001  struct vop_vector zfs_vnodeops;
3002  struct vop_vector zfs_fifoops;
3003  
3004 @@ -5005,6 +5170,7 @@
3005  	.vop_getacl =		zfs_freebsd_getacl,
3006  	.vop_setacl =		zfs_freebsd_setacl,
3007  	.vop_aclcheck =		zfs_freebsd_aclcheck,
3008 +	.vop_getparent = 	zfs_freebsd_getparent,
3009  };
3010  
3011  struct vop_vector zfs_fifoops = {
3012 --- //depot/vendor/freebsd/src/sys/fs/cd9660/cd9660_vfsops.c	2010-01-23 22:40:07.000000000 0000
3013 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/cd9660/cd9660_vfsops.c	2010-05-27 14:41:11.000000000 0000
3014 @@ -84,6 +84,7 @@
3015  	.vfs_statfs =		cd9660_statfs,
3016  	.vfs_unmount =		cd9660_unmount,
3017  	.vfs_vget =		cd9660_vget,
3018 +	.vfs_fhhint =		vfs_stdfhhint,
3019  };
3020  VFS_SET(cd9660_vfsops, cd9660, VFCF_READONLY);
3021  MODULE_VERSION(cd9660, 1);
3022 --- //depot/vendor/freebsd/src/sys/fs/ext2fs/ext2_vfsops.c	2010-01-14 14:35:14.000000000 0000
3023 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/ext2fs/ext2_vfsops.c	2010-05-27 14:41:11.000000000 0000
3024 @@ -86,6 +86,7 @@
3025  	.vfs_sync =		ext2_sync,
3026  	.vfs_unmount =		ext2_unmount,
3027  	.vfs_vget =		ext2_vget,
3028 +	.vfs_fhhint =		vfs_stdfhhint,
3029  };
3030  
3031  VFS_SET(ext2fs_vfsops, ext2fs, 0);
3032 --- //depot/vendor/freebsd/src/sys/fs/hpfs/hpfs_vfsops.c	2009-05-11 15:35:16.000000000 0000
3033 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/hpfs/hpfs_vfsops.c	2010-05-27 14:41:11.000000000 0000
3034 @@ -538,5 +538,6 @@
3035  	.vfs_statfs =		hpfs_statfs,
3036  	.vfs_unmount =		hpfs_unmount,
3037  	.vfs_vget =		hpfs_vget,
3038 +	.vfs_fhhint =		vfs_stdfhhint,
3039  };
3040  VFS_SET(hpfs_vfsops, hpfs, 0);
3041 --- //depot/vendor/freebsd/src/sys/fs/msdosfs/msdosfs_vfsops.c	2010-04-02 15:25:18.000000000 0000
3042 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/msdosfs/msdosfs_vfsops.c	2010-05-27 14:41:11.000000000 0000
3043 @@ -986,6 +986,7 @@
3044  	.vfs_statfs =		msdosfs_statfs,
3045  	.vfs_sync =		msdosfs_sync,
3046  	.vfs_unmount =		msdosfs_unmount,
3047 +	.vfs_fhhint =		vfs_stdfhhint,
3048  };
3049  
3050  VFS_SET(msdosfs_vfsops, msdosfs, 0);
3051 --- //depot/vendor/freebsd/src/sys/fs/nfs/nfs.h	2009-06-20 17:15:14.000000000 0000
3052 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfs/nfs.h	2010-07-08 19:00:38.000000000 0000
3053 @@ -273,6 +273,10 @@
3054  
3055  #define	LCL_GSS		LCL_KERBV	/* Or of all mechs */
3056  
3057 +/* flags for auditing the open RPC */
3058 +#define NFS_CREATE		0x00000010
3059 +#define NFS_TRUNC		0x00000020
3060 +
3061  /*
3062   * Bits for flags in nfslock and nfsstate.
3063   * The access, deny, NFSLCK_READ and NFSLCK_WRITE bits must be defined as
3064 --- //depot/vendor/freebsd/src/sys/fs/nfs/nfs_var.h	2010-04-24 22:55:19.000000000 0000
3065 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfs/nfs_var.h	2010-06-25 00:45:44.000000000 0000
3066 @@ -308,6 +308,7 @@
3067      NFSPATHLEN_T *);
3068  void nfsd_init(void);
3069  int nfsd_checkrootexp(struct nfsrv_descript *);
3070 +void nfsrv_auditpath(vnode_t vp, vnode_t dvp, char *fname, fhandle_t *fhp, int n);
3071  
3072  /* nfs_clvfsops.c */
3073  
3074 @@ -512,7 +513,7 @@
3075      NFSPROC_T *);
3076  int nfsvno_setattr(vnode_t, struct nfsvattr *, struct ucred *,
3077      NFSPROC_T *, struct nfsexstuff *);
3078 -int nfsvno_getfh(vnode_t, fhandle_t *, NFSPROC_T *);
3079 +int nfsvno_getfh(vnode_t, fhandle_t *, NFSPROC_T *, vnode_t);
3080  int nfsvno_accchk(vnode_t, accmode_t, struct ucred *,
3081      struct nfsexstuff *, NFSPROC_T *, int, int, u_int32_t *);
3082  int nfsvno_namei(struct nfsrv_descript *, struct nameidata *,
3083 --- //depot/vendor/freebsd/src/sys/fs/nfsserver/nfs_nfsdkrpc.c	2009-06-17 23:00:24.000000000 0000
3084 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdkrpc.c	2010-07-06 21:25:27.000000000 0000
3085 @@ -42,6 +42,7 @@
3086  #include <rpc/rpc.h>
3087  #include <rpc/rpcsec_gss.h>
3088  
3089 +#include <security/audit/audit.h>
3090  #include <security/mac/mac_framework.h>
3091  
3092  NFSDLOCKMUTEX;
3093 @@ -108,6 +109,7 @@
3094  	struct nfsrv_descript nd;
3095  	struct nfsrvcache *rp = NULL;
3096  	int cacherep, credflavor;
3097 +	int nfsprot;
3098  
3099  	memset(&nd, 0, sizeof(nd));
3100  	if (rqst->rq_vers == NFS_VER2) {
3101 @@ -233,6 +235,12 @@
3102  		cacherep = nfs_proc(&nd, rqst->rq_xid, xprt->xp_socket,
3103  		    xprt->xp_sockref, &rp);
3104  	} else {
3105 +		nfsprot = nd.nd_flag & (ND_NFSV2 | ND_NFSV3 | ND_NFSV4);
3106 +		AUDIT_NFS_ENTER(NFSPROC_NULL, nd.nd_cred, curthread, nfsprot);
3107 +		AUDIT_ARG_PROTOCOL(nfsprot);
3108 +		if (nd.nd_nam != NULL)
3109 +			AUDIT_ARG_SOCKADDR_IN((struct sockaddr_in *)nd.nd_nam);
3110 +		AUDIT_NFS_EXIT(0, curthread);		
3111  		NFSMGET(nd.nd_mreq);
3112  		nd.nd_mreq->m_len = 0;
3113  		cacherep = RC_REPLY;
3114 --- //depot/vendor/freebsd/src/sys/fs/nfsserver/nfs_nfsdport.c	2010-04-04 23:22:57.000000000 0000
3115 +++ //depot/projects/soc2010/gpf_audit/freebsd/src/sys/fs/nfsserver/nfs_nfsdport.c	2010-07-08 13:04:03.000000000 0000
3116 @@ -44,6 +44,7 @@
3117  #include <sys/sysctl.h>
3118  #include <nlm/nlm_prot.h>
3119  #include <nlm/nlm.h>
3120 +#include <security/audit/audit.h>
3121  
3122  extern u_int32_t newnfs_true, newnfs_false, newnfs_xdrneg1;
3123  extern int nfsv4root_set;
3124 @@ -118,13 +119,13 @@
3125   * Get a file handle for a vnode.
3126   */
3127  int
3128 -nfsvno_getfh(struct vnode *vp, fhandle_t *fhp, struct thread *p)
3129 +nfsvno_getfh(struct vnode *vp, fhandle_t *fhp, struct thread *p, struct vnode *dvp)
3130  {
3131  	int error;
3132  
3133  	NFSBZERO((caddr_t)fhp, sizeof(fhandle_t));
3134  	fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
3135 -	error = VOP_VPTOFH(vp, &fhp->fh_fid);
3136 +	error = VOP_VPTOFH(vp, &fhp->fh_fid, dvp);
3137  	return (error);
3138  }
3139  
3140 @@ -636,6 +637,7 @@
3141  	uiop->uio_resid = len;
3142  	uiop->uio_rw = UIO_READ;
3143  	uiop->uio_segflg = UIO_SYSSPACE;
3144 +	AUDIT_ARG_FFLAGS(IO_NODELOCKED | ioflag);
3145  	error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred);
3146  	FREE((caddr_t)iv2, M_TEMP);
3147  	if (error) {
3148 @@ -701,6 +703,7 @@
3149  	uiop->uio_segflg = UIO_SYSSPACE;
3150  	NFSUIOPROC(uiop, p);
3151  	uiop->uio_offset = off;
3152 +	AUDIT_ARG_FFLAGS(ioflags);
3153  	error = VOP_WRITE(vp, uiop, ioflags, cred);
3154  	FREE((caddr_t)iv, M_TEMP);
3155  	return (error);
3156 @@ -721,6 +724,7 @@
3157  	if (!error && ndp->ni_vp == NULL) {
3158  		if (nvap->na_type == VREG || nvap->na_type == VSOCK) {
3159  			vrele(ndp->ni_startdir);
3160 +			AUDIT_ARG_MODE(nvap->na_vattr.va_mode);			
3161  			error = VOP_CREATE(ndp->ni_dvp,
3162  			    &ndp->ni_vp, &ndp->ni_cnd, &nvap->na_vattr);
3163  			vput(ndp->ni_dvp);
3164 @@ -752,6 +756,7 @@
3165  				return (error);
3166  			}
3167  			nvap->na_rdev = rdev;
3168 +			AUDIT_ARG_MODE(nvap->na_vattr.va_mode);
3169  			error = VOP_MKNOD(ndp->ni_dvp, &ndp->ni_vp,
3170  			    &ndp->ni_cnd, &nvap->na_vattr);
3171  			vput(ndp->ni_dvp);
3172 @@ -767,6 +772,8 @@
3173  			return (ENXIO);
3174  		}
3175  		*vpp = ndp->ni_vp;
3176 +		if (!error)
3177 +			AUDIT_ARG_VNODE1(ndp->ni_vp);
3178  	} else {
3179  		/*
3180  		 * Handle cases where error is already set and/or
3181 @@ -826,11 +833,13 @@
3182  		vput(ndp->ni_dvp);
3183  		return (NFSERR_BADTYPE);
3184  	}
3185 +	AUDIT_ARG_MODE(nvap->na_vattr.va_mode);
3186  	if (vtyp == VSOCK) {
3187 -		vrele(ndp->ni_startdir);
3188 +		vrele(ndp->ni_startdir);		
3189  		error = VOP_CREATE(ndp->ni_dvp, &ndp->ni_vp,
3190  		    &ndp->ni_cnd, &nvap->na_vattr);
3191  		vput(ndp->ni_dvp);
3192 +		nfsrv_auditpath(NULL, ndp->ni_dvp, ndp->ni_cnd.cn_pnbuf, NULL, 1);
3193  		nfsvno_relpathbuf(ndp);
3194  	} else {
3195  		if (nvap->na_type != VFIFO &&
3196 @@ -843,6 +852,7 @@
3197  		error = VOP_MKNOD(ndp->ni_dvp, &ndp->ni_vp,
3198  		    &ndp->ni_cnd, &nvap->na_vattr);
3199  		vput(ndp->ni_dvp);
3200 +		nfsrv_auditpath(NULL, ndp->ni_dvp, ndp->ni_cnd.cn_pnbuf, NULL, 1);
3201  		nfsvno_relpathbuf(ndp);
3202  		if (error)
3203  			vrele(ndp->ni_startdir);
3204 @@ -851,6 +861,9 @@
3205  		 * see any reason to do the lookup.
3206  		 */
3207  	}
3208 +	if (!error)
3209 +		AUDIT_ARG_VNODE1(ndp->ni_vp);
3210 +
3211  	return (error);
3212  }
3213  
3214 @@ -872,10 +885,13 @@
3215  		nfsvno_relpathbuf(ndp);
3216  		return (EEXIST);
3217  	}
3218 +	AUDIT_ARG_MODE(nvap->na_vattr.va_mode);
3219  	error = VOP_MKDIR(ndp->ni_dvp, &ndp->ni_vp, &ndp->ni_cnd,
3220  	    &nvap->na_vattr);
3221  	vput(ndp->ni_dvp);
3222  	nfsvno_relpathbuf(ndp);
3223 +	if (!error)
3224 +		AUDIT_ARG_VNODE1(ndp->ni_vp);
3225  	return (error);
3226  }
3227  
3228 @@ -888,7 +904,9 @@
3229      struct nfsexstuff *exp)
3230  {
3231  	int error = 0;
3232 -
3233 +	
3234 +	AUDIT_ARG_UPATH2(curthread, pathcp);
3235 +	AUDIT_ARG_MODE(nvap->na_vattr.va_mode);
3236  	if (ndp->ni_vp) {
3237  		vrele(ndp->ni_startdir);
3238  		nfsvno_relpathbuf(ndp);
3239 @@ -899,19 +917,21 @@
3240  		vrele(ndp->ni_vp);
3241  		return (EEXIST);