svn commit: r306564 - in head: sys/sys usr.bin/kdump

John Baldwin jhb at FreeBSD.org
Sat Oct 1 22:08:09 UTC 2016


Author: jhb
Date: Sat Oct  1 22:08:07 2016
New Revision: 306564
URL: https://svnweb.freebsd.org/changeset/base/306564

Log:
  Expose kernel-only errno values if _WANT_KERNEL_ERRNO is defined.
  
  The kernel uses a few negative errno values for internal conditions
  such as requesting a system call restart.  Normally these errno values
  are not exposed to userland.  However, kdump needs access to these
  values as some of then can be present in a ktrace system call return
  record.  Previously kdump was defining _KERNEL to gain access to ehse
  values, but was then having to manually declare 'errno' (and doing it
  incorrectly).  Now, kdump uses _WANT_KERNEL_ERRNO instead of _KERNEL
  and uses the system-provided declaration of errno.

Modified:
  head/sys/sys/errno.h
  head/usr.bin/kdump/kdump.c

Modified: head/sys/sys/errno.h
==============================================================================
--- head/sys/sys/errno.h	Sat Oct  1 22:03:41 2016	(r306563)
+++ head/sys/sys/errno.h	Sat Oct  1 22:08:07 2016	(r306564)
@@ -184,7 +184,7 @@ __END_DECLS
 #define	ELAST		96		/* Must be equal largest errno */
 #endif /* _POSIX_SOURCE */
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_WANT_KERNEL_ERRNO)
 /* pseudo-errors returned inside kernel to modify return to process */
 #define	ERESTART	(-1)		/* restart syscall */
 #define	EJUSTRETURN	(-2)		/* don't modify regs, just return */

Modified: head/usr.bin/kdump/kdump.c
==============================================================================
--- head/usr.bin/kdump/kdump.c	Sat Oct  1 22:03:41 2016	(r306563)
+++ head/usr.bin/kdump/kdump.c	Sat Oct  1 22:08:07 2016	(r306564)
@@ -41,10 +41,7 @@ static char sccsid[] = "@(#)kdump.c	8.1 
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#define _KERNEL
-extern int errno;
-#include <sys/errno.h>
-#undef _KERNEL
+#define _WANT_KERNEL_ERRNO
 #include <sys/param.h>
 #include <sys/capsicum.h>
 #include <sys/errno.h>


More information about the svn-src-head mailing list