svn commit: r258768 - in head: lib/libc/sys share/man/man4 sys/amd64/conf sys/conf sys/i386/conf sys/ia64/conf sys/kern sys/pc98/conf sys/powerpc/conf sys/sparc64/conf usr.sbin/rwhod

Pawel Jakub Dawidek pjd at FreeBSD.org
Sat Nov 30 15:08:39 UTC 2013


Author: pjd
Date: Sat Nov 30 15:08:35 2013
New Revision: 258768
URL: http://svnweb.freebsd.org/changeset/base/258768

Log:
  Make process descriptors standard part of the kernel. rwhod(8) already
  requires process descriptors to work and having PROCDESC in GENERIC
  seems not enough, especially that we hope to have more and more consumers
  in the base.
  
  MFC after:	3 days

Modified:
  head/lib/libc/sys/pdfork.2
  head/share/man/man4/capsicum.4
  head/share/man/man4/procdesc.4
  head/sys/amd64/conf/GENERIC
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/i386/conf/GENERIC
  head/sys/ia64/conf/GENERIC
  head/sys/kern/kern_descrip.c
  head/sys/kern/kern_exit.c
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_sig.c
  head/sys/kern/sys_procdesc.c
  head/sys/pc98/conf/GENERIC
  head/sys/powerpc/conf/GENERIC
  head/sys/sparc64/conf/GENERIC
  head/usr.sbin/rwhod/rwhod.c

Modified: head/lib/libc/sys/pdfork.2
==============================================================================
--- head/lib/libc/sys/pdfork.2	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/lib/libc/sys/pdfork.2	Sat Nov 30 15:08:35 2013	(r258768)
@@ -125,12 +125,6 @@ is set; if the process is still alive an
 the last reference to the process descriptor, the process will be terminated
 with the signal
 .Dv SIGKILL .
-.Pp
-.Nm
-and associated functions depend on
-.Cd "options PROCDESC"
-described in
-.Xr procdesc 4 .
 .Sh RETURN VALUES
 .Fn pdfork
 returns a PID, 0 or -1, as

Modified: head/share/man/man4/capsicum.4
==============================================================================
--- head/share/man/man4/capsicum.4	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/share/man/man4/capsicum.4	Sat Nov 30 15:08:35 2013	(r258768)
@@ -35,7 +35,6 @@
 .Sh SYNOPSIS
 .Cd "options CAPABILITY_MODE"
 .Cd "options CAPABILITIES"
-.Cd "options PROCDESC"
 .Sh DESCRIPTION
 .Nm
 is a lightweight OS capability and sandbox framework implementing a hybrid

Modified: head/share/man/man4/procdesc.4
==============================================================================
--- head/share/man/man4/procdesc.4	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/share/man/man4/procdesc.4	Sat Nov 30 15:08:35 2013	(r258768)
@@ -35,8 +35,6 @@
 .Sh NAME
 .Nm procdesc
 .Nd process descriptor facility
-.Sh SYNOPSIS
-.Cd "options PROCDESC"
 .Sh DESCRIPTION
 .Nm
 is a file-descriptor-oriented interface to process signalling and control,

Modified: head/sys/amd64/conf/GENERIC
==============================================================================
--- head/sys/amd64/conf/GENERIC	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/sys/amd64/conf/GENERIC	Sat Nov 30 15:08:35 2013	(r258768)
@@ -66,7 +66,6 @@ options 	HWPMC_HOOKS		# Necessary kernel
 options 	AUDIT			# Security event auditing
 options 	CAPABILITY_MODE		# Capsicum capability mode
 options 	CAPABILITIES		# Capsicum capabilities
-options 	PROCDESC		# Support for process descriptors
 options 	MAC			# TrustedBSD MAC Framework
 options 	KDTRACE_FRAME		# Ensure frames are compiled in
 options 	KDTRACE_HOOKS		# Kernel DTrace hooks

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/sys/conf/NOTES	Sat Nov 30 15:08:35 2013	(r258768)
@@ -1167,9 +1167,6 @@ options 	MAC_TEST
 options 	CAPABILITIES	# fine-grained rights on file descriptors
 options 	CAPABILITY_MODE	# sandboxes with no global namespace access
 
-# Support for process descriptors
-options		PROCDESC
-
 

 #####################################################################
 # CLOCK OPTIONS

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/sys/conf/options	Sat Nov 30 15:08:35 2013	(r258768)
@@ -165,7 +165,6 @@ PPC_DEBUG	opt_ppc.h
 PPC_PROBE_CHIPSET	opt_ppc.h
 PPS_SYNC	opt_ntp.h
 PREEMPTION	opt_sched.h
-PROCDESC	opt_procdesc.h
 QUOTA
 SCHED_4BSD	opt_sched.h
 SCHED_STATS	opt_sched.h

Modified: head/sys/i386/conf/GENERIC
==============================================================================
--- head/sys/i386/conf/GENERIC	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/sys/i386/conf/GENERIC	Sat Nov 30 15:08:35 2013	(r258768)
@@ -67,7 +67,6 @@ options 	HWPMC_HOOKS		# Necessary kernel
 options 	AUDIT			# Security event auditing
 options 	CAPABILITY_MODE		# Capsicum capability mode
 options 	CAPABILITIES		# Capsicum capabilities
-options 	PROCDESC		# Support for process descriptors
 options 	MAC			# TrustedBSD MAC Framework
 options 	KDTRACE_HOOKS		# Kernel DTrace hooks
 options 	DDB_CTF			# Kernel ELF linker loads CTF data

Modified: head/sys/ia64/conf/GENERIC
==============================================================================
--- head/sys/ia64/conf/GENERIC	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/sys/ia64/conf/GENERIC	Sat Nov 30 15:08:35 2013	(r258768)
@@ -46,7 +46,6 @@ options 	NFS_ROOT	# NFS usable as root d
 options 	P1003_1B_SEMAPHORES	# POSIX-style semaphores
 options 	PREEMPTION	# Enable kernel thread preemption
 options 	PRINTF_BUFR_SIZE=128  # Printf buffering to limit interspersion
-options 	PROCDESC	# Support for process descriptors
 options 	PROCFS		# Process filesystem (/proc)
 options 	PSEUDOFS	# Pseudo-filesystem framework
 options 	SCHED_ULE	# ULE scheduler

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/sys/kern/kern_descrip.c	Sat Nov 30 15:08:35 2013	(r258768)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
 #include "opt_compat.h"
 #include "opt_ddb.h"
 #include "opt_ktrace.h"
-#include "opt_procdesc.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -3115,11 +3114,9 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE
 			tp = fp->f_data;
 			break;
 
-#ifdef PROCDESC
 		case DTYPE_PROCDESC:
 			kif->kf_type = KF_TYPE_PROCDESC;
 			break;
-#endif
 
 		default:
 			kif->kf_type = KF_TYPE_UNKNOWN;
@@ -3485,12 +3482,10 @@ kern_proc_filedesc_out(struct proc *p,  
 			data = fp->f_data;
 			break;
 
-#ifdef PROCDESC
 		case DTYPE_PROCDESC:
 			type = KF_TYPE_PROCDESC;
 			data = fp->f_data;
 			break;
-#endif
 
 		default:
 			type = KF_TYPE_UNKNOWN;

Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/sys/kern/kern_exit.c	Sat Nov 30 15:08:35 2013	(r258768)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_compat.h"
 #include "opt_ktrace.h"
-#include "opt_procdesc.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -500,9 +499,7 @@ exit1(struct thread *td, int rv)
 	 * procdesc_exit() to serialize concurrent calls to close() and
 	 * exit().
 	 */
-#ifdef PROCDESC
 	if (p->p_procdesc == NULL || procdesc_exit(p)) {
-#endif
 		/*
 		 * Notify parent that we're gone.  If parent has the
 		 * PS_NOCLDWAIT flag set, or if the handler is set to SIG_IGN,
@@ -539,10 +536,8 @@ exit1(struct thread *td, int rv)
 			else	/* LINUX thread */
 				kern_psignal(p->p_pptr, p->p_sigparent);
 		}
-#ifdef PROCDESC
 	} else
 		PROC_LOCK(p->p_pptr);
-#endif
 	sx_xunlock(&proctree_lock);
 
 	/*
@@ -807,10 +802,8 @@ proc_reap(struct thread *td, struct proc
 	clear_orphan(p);
 	PROC_UNLOCK(p);
 	leavepgrp(p);
-#ifdef PROCDESC
 	if (p->p_procdesc != NULL)
 		procdesc_reap(p);
-#endif
 	sx_xunlock(&proctree_lock);
 
 	/*

Modified: head/sys/kern/kern_fork.c
==============================================================================
--- head/sys/kern/kern_fork.c	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/sys/kern/kern_fork.c	Sat Nov 30 15:08:35 2013	(r258768)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_ktrace.h"
 #include "opt_kstack_pages.h"
-#include "opt_procdesc.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -118,7 +117,6 @@ sys_pdfork(td, uap)
 	struct thread *td;
 	struct pdfork_args *uap;
 {
-#ifdef PROCDESC
 	int error, fd;
 	struct proc *p2;
 
@@ -135,9 +133,6 @@ sys_pdfork(td, uap)
 		error = copyout(&fd, uap->fdp, sizeof(fd));
 	}
 	return (error);
-#else
-	return (ENOSYS);
-#endif
 }
 
 /* ARGSUSED */
@@ -655,7 +650,6 @@ do_fork(struct thread *td, int flags, st
 		    p2->p_vmspace->vm_ssize);
 	}
 
-#ifdef PROCDESC
 	/*
 	 * Associate the process descriptor with the process before anything
 	 * can happen that might cause that process to need the descriptor.
@@ -663,7 +657,6 @@ do_fork(struct thread *td, int flags, st
 	 */
 	if (flags & RFPROCDESC)
 		procdesc_new(p2, pdflags);
-#endif
 
 	/*
 	 * Both processes are set up, now check if any loadable modules want
@@ -758,9 +751,7 @@ fork1(struct thread *td, int flags, int 
 	int error;
 	static int curfail;
 	static struct timeval lastfail;
-#ifdef PROCDESC
 	struct file *fp_procdesc = NULL;
-#endif
 
 	/* Check for the undefined or unimplemented flags. */
 	if ((flags & ~(RFFLAGS | RFTSIGFLAGS(RFTSIGMASK))) != 0)
@@ -778,7 +769,6 @@ fork1(struct thread *td, int flags, int 
 	if ((flags & RFTSIGZMB) != 0 && (u_int)RFTSIGNUM(flags) > _SIG_MAXSIG)
 		return (EINVAL);
 
-#ifdef PROCDESC
 	if ((flags & RFPROCDESC) != 0) {
 		/* Can't not create a process yet get a process descriptor. */
 		if ((flags & RFPROC) == 0)
@@ -788,7 +778,6 @@ fork1(struct thread *td, int flags, int 
 		if (procdescp == NULL)
 			return (EINVAL);
 	}
-#endif
 
 	p1 = td->td_proc;
 
@@ -801,7 +790,6 @@ fork1(struct thread *td, int flags, int 
 		return (fork_norfproc(td, flags));
 	}
 
-#ifdef PROCDESC
 	/*
 	 * If required, create a process descriptor in the parent first; we
 	 * will abandon it if something goes wrong. We don't finit() until
@@ -812,7 +800,6 @@ fork1(struct thread *td, int flags, int 
 		if (error != 0)
 			return (error);
 	}
-#endif
 
 	mem_charged = 0;
 	vm2 = NULL;
@@ -919,12 +906,10 @@ fork1(struct thread *td, int flags, int 
 		 * Return child proc pointer to parent.
 		 */
 		*procp = newproc;
-#ifdef PROCDESC
 		if (flags & RFPROCDESC) {
 			procdesc_finit(newproc->p_procdesc, fp_procdesc);
 			fdrop(fp_procdesc, td);
 		}
-#endif
 		racct_proc_fork_done(newproc);
 		return (0);
 	}
@@ -944,12 +929,10 @@ fail1:
 	if (vm2 != NULL)
 		vmspace_free(vm2);
 	uma_zfree(proc_zone, newproc);
-#ifdef PROCDESC
 	if ((flags & RFPROCDESC) != 0 && fp_procdesc != NULL) {
 		fdclose(td->td_proc->p_fd, fp_procdesc, *procdescp, td);
 		fdrop(fp_procdesc, td);
 	}
-#endif
 	pause("fork", hz / 2);
 	return (error);
 }

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/sys/kern/kern_sig.c	Sat Nov 30 15:08:35 2013	(r258768)
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
 #include "opt_compat.h"
 #include "opt_ktrace.h"
 #include "opt_core.h"
-#include "opt_procdesc.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1723,7 +1722,6 @@ sys_pdkill(td, uap)
 	struct thread *td;
 	struct pdkill_args *uap;
 {
-#ifdef PROCDESC
 	struct proc *p;
 	cap_rights_t rights;
 	int error;
@@ -1743,9 +1741,6 @@ sys_pdkill(td, uap)
 		kern_psignal(p, uap->signum);
 	PROC_UNLOCK(p);
 	return (error);
-#else
-	return (ENOSYS);
-#endif
 }
 
 #if defined(COMPAT_43)

Modified: head/sys/kern/sys_procdesc.c
==============================================================================
--- head/sys/kern/sys_procdesc.c	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/sys/kern/sys_procdesc.c	Sat Nov 30 15:08:35 2013	(r258768)
@@ -61,8 +61,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include "opt_procdesc.h"
-
 #include <sys/param.h>
 #include <sys/capability.h>
 #include <sys/fcntl.h>
@@ -85,8 +83,6 @@ __FBSDID("$FreeBSD$");
 
 #include <vm/uma.h>
 
-#ifdef PROCDESC
-
 FEATURE(process_descriptors, "Process Descriptors");
 
 static uma_zone_t procdesc_zone;
@@ -522,14 +518,3 @@ procdesc_chown(struct file *fp, uid_t ui
 
 	return (EOPNOTSUPP);
 }
-
-#else /* !PROCDESC */
-
-int
-sys_pdgetpid(struct thread *td, struct pdgetpid_args *uap)
-{
-
-	return (ENOSYS);
-}
-
-#endif /* PROCDESC */

Modified: head/sys/pc98/conf/GENERIC
==============================================================================
--- head/sys/pc98/conf/GENERIC	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/sys/pc98/conf/GENERIC	Sat Nov 30 15:08:35 2013	(r258768)
@@ -65,7 +65,6 @@ options 	HWPMC_HOOKS		# Necessary kernel
 options 	AUDIT			# Security event auditing
 options 	CAPABILITY_MODE		# Capsicum capability mode
 options 	CAPABILITIES		# Capsicum capabilities
-options 	PROCDESC		# Support for process descriptors
 options 	MAC			# TrustedBSD MAC Framework
 options 	INCLUDE_CONFIG_FILE     # Include this file in kernel
 options 	KDB			# Kernel debugger related code

Modified: head/sys/powerpc/conf/GENERIC
==============================================================================
--- head/sys/powerpc/conf/GENERIC	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/sys/powerpc/conf/GENERIC	Sat Nov 30 15:08:35 2013	(r258768)
@@ -70,7 +70,6 @@ options 	HWPMC_HOOKS		# Necessary kernel
 options 	AUDIT			# Security event auditing
 options 	CAPABILITY_MODE		# Capsicum capability mode
 options 	CAPABILITIES		# Capsicum capabilities
-options 	PROCDESC		# Support for process descriptors
 options 	MAC			# TrustedBSD MAC Framework
 options 	KDTRACE_HOOKS		# Kernel DTrace hooks
 options 	DDB_CTF			# Kernel ELF linker loads CTF data

Modified: head/sys/sparc64/conf/GENERIC
==============================================================================
--- head/sys/sparc64/conf/GENERIC	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/sys/sparc64/conf/GENERIC	Sat Nov 30 15:08:35 2013	(r258768)
@@ -63,7 +63,6 @@ options 	HWPMC_HOOKS		# Necessary kernel
 options 	AUDIT			# Security event auditing
 options 	CAPABILITY_MODE		# Capsicum capability mode
 options 	CAPABILITIES		# Capsicum capabilities
-options 	PROCDESC		# Support for process descriptors
 options 	MAC			# TrustedBSD MAC Framework
 options 	INCLUDE_CONFIG_FILE	# Include this file in kernel
 

Modified: head/usr.sbin/rwhod/rwhod.c
==============================================================================
--- head/usr.sbin/rwhod/rwhod.c	Sat Nov 30 14:39:56 2013	(r258767)
+++ head/usr.sbin/rwhod/rwhod.c	Sat Nov 30 15:08:35 2013	(r258768)
@@ -281,7 +281,7 @@ main(int argc, char *argv[])
 		} else if (pid_child_receiver == -1) {
 			if (errno == ENOSYS) {
 				syslog(LOG_ERR,
-				    "The pdfork(2) system call is not available; recompile the kernel with options PROCDESC");
+				    "The pdfork(2) system call is not available - kernel too old.");
 			} else {
 				syslog(LOG_ERR, "pdfork: %m");
 			}


More information about the svn-src-all mailing list