Add some FEATURE macros for various features (AUDIT/CAM/IPC/KTR/MAC/NFS/NTP/

PMC/SYSV/...).

No FreeBSD version bump, the userland application to query the features will
be committed last and can serve as an indication of the availablility if
needed.

Sponsored by:   Google Summer of Code 2010
Submitted by:   kibab
Reviewed by:    arch@ (parts by rwatson, trasz, jhb)
X-MFC after:    to be determined in last commit with code from this project
This commit is contained in:
Alexander Leidinger 2011-02-25 10:11:01 +00:00
parent fb4f617201
commit de5b19526b
23 changed files with 60 additions and 0 deletions

View File

@ -51,6 +51,9 @@ __FBSDID("$FreeBSD$");
#include <sys/libkern.h>
#include <cam/cam_queue.h>
#include <cam/cam_xpt.h>
FEATURE(scbus, "SCSI devices support");
#endif
static int camstatusentrycomp(const void *key, const void *member);

View File

@ -73,6 +73,8 @@ __FBSDID("$FreeBSD$");
#include <fs/nfsclient/nfs.h>
#include <fs/nfsclient/nfsdiskless.h>
FEATURE(nfscl, "NFSv4 client");
extern int nfscl_ticks;
extern struct timeval nfsboottime;
extern struct nfsstats newnfsstats;

View File

@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$");
#include <nlm/nlm_prot.h>
#include <nlm/nlm.h>
FEATURE(nfsd, "NFSv4 server");
extern u_int32_t newnfs_true, newnfs_false, newnfs_xdrneg1;
extern int nfsrv_useacl;
extern int newnfs_numnfsd;

View File

@ -37,10 +37,14 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/dtrace_bsd.h>
#include <sys/sysctl.h>
#define KDTRACE_PROC_SIZE 64
#define KDTRACE_THREAD_SIZE 256
FEATURE(kdtrace_hooks,
"Kernel DTrace hooks which are required to load DTrace kernel modules");
MALLOC_DEFINE(M_KDTRACE, "kdtrace", "DTrace hooks");
/* Return the DTrace process data size compiled in the kernel hooks. */

View File

@ -80,6 +80,8 @@ __FBSDID("$FreeBSD$");
#define KTR_CPU PCPU_GET(cpuid)
#endif
FEATURE(ktr, "Kernel support for KTR kernel tracing facility");
SYSCTL_NODE(_debug, OID_AUTO, ktr, CTLFLAG_RD, 0, "KTR options");
int ktr_cpumask = KTR_CPUMASK;

View File

@ -83,6 +83,8 @@ static MALLOC_DEFINE(M_KTRACE, "KTRACE", "KTRACE");
#ifdef KTRACE
FEATURE(ktrace, "Kernel support for system-call tracing");
#ifndef KTRACE_REQUEST_POOL
#define KTRACE_REQUEST_POOL 100
#endif

View File

@ -1299,6 +1299,10 @@ lockstatus(struct lock *lk)
}
#ifdef INVARIANT_SUPPORT
FEATURE(invariant_support,
"Support for modules compiled with INVARIANTS option");
#ifndef INVARIANTS
#undef _lockmgr_assert
#endif

View File

@ -51,6 +51,10 @@ __FBSDID("$FreeBSD$");
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
#ifdef PPS_SYNC
FEATURE(pps_sync, "Support usage of external PPS signal by kernel PLL");
#endif
/*
* Single-precision macros for 64-bit machines
*/

View File

@ -37,8 +37,10 @@ __FBSDID("$FreeBSD$");
#include <sys/pmc.h>
#include <sys/pmckern.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#ifdef HWPMC_HOOKS
FEATURE(hwpmc_hooks, "Kernel support for HW PMC");
#define PMC_KERNEL_VERSION PMC_VERSION
#else
#define PMC_KERNEL_VERSION 0

View File

@ -69,6 +69,11 @@ __FBSDID("$FreeBSD$");
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
#ifdef REGRESSION
FEATURE(regression,
"Kernel support for interfaces nessesary for regression testing (SECURITY RISK!)");
#endif
#if defined(INET) || defined(INET6)
#include <netinet/in.h>
#include <netinet/in_pcb.h>

View File

@ -41,12 +41,16 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/sysctl.h>
#include <sys/kernel.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/posix4.h>
#include <sys/resource.h>
#include <sys/sched.h>
FEATURE(kposix_priority_scheduling, "POSIX P1003.1B realtime extensions");
/* ksched: Real-time extension to support POSIX priority scheduling.
*/

View File

@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <sys/endian.h>
#include <sys/errno.h>
#include <sys/mbuf.h>
@ -40,6 +41,8 @@ __FBSDID("$FreeBSD$");
#include <sys/mchain.h>
FEATURE(libmchain, "mchain library");
MODULE_VERSION(libmchain, 1);
#define MBERROR(format, ...) printf("%s(%d): "format, __func__ , \

View File

@ -39,6 +39,9 @@ __FBSDID("$FreeBSD$");
#include <sys/sbuf.h>
#include <sys/stack.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
FEATURE(stack, "Support for capturing kernel stack");
static MALLOC_DEFINE(M_STACK, "stack", "Stack Traces");

View File

@ -72,6 +72,8 @@ __FBSDID("$FreeBSD$");
#include <security/mac/mac_framework.h>
FEATURE(sysv_msg, "System V message queues support");
static MALLOC_DEFINE(M_MSG, "msg", "SVID compatible message queues");
static int msginit(void);

View File

@ -62,6 +62,8 @@ __FBSDID("$FreeBSD$");
#include <security/mac/mac_framework.h>
FEATURE(sysv_sem, "System V semaphores support");
static MALLOC_DEFINE(M_SEM, "sem", "SVID compatible semaphores");
#ifdef SEM_DEBUG

View File

@ -95,6 +95,8 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_page.h>
#include <vm/vm_pager.h>
FEATURE(sysv_shm, "System V shared memory segments support");
static MALLOC_DEFINE(M_SHM, "shm", "SVID compatible shared memory segments");
static int shmget_allocate_segment(struct thread *td,

View File

@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/lock.h>
@ -57,6 +58,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_page.h>
#include <vm/vm_object.h>
FEATURE(zero_copy_sockets, "Zero copy sockets support");
struct netsend_cow_stats {
int attempted;

View File

@ -82,6 +82,8 @@ __FBSDID("$FreeBSD$");
#include <sys/vnode.h>
#include <machine/atomic.h>
FEATURE(p1003_1b_mqueue, "POSIX P1003.1B message queues support");
/*
* Limits and constants
*/

View File

@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
#include <security/mac/mac_framework.h>
FEATURE(p1003_1b_semaphores, "POSIX1003.1B semaphores support");
/*
* TODO
*

View File

@ -78,6 +78,8 @@ __FBSDID("$FreeBSD$");
#include <nfsclient/nfsm_subs.h>
#include <nfsclient/nfsdiskless.h>
FEATURE(nfsclient, "NFS client");
MALLOC_DEFINE(M_NFSREQ, "nfsclient_req", "NFS request header");
MALLOC_DEFINE(M_NFSBIGFH, "nfsclient_bigfh", "NFS version 3 file handle");
MALLOC_DEFINE(M_NFSDIROFF, "nfsclient_diroff", "NFS directory offset data");

View File

@ -97,6 +97,8 @@ __FBSDID("$FreeBSD$");
#include <nfs/xdr_subs.h>
#include <nfsserver/nfsm_subs.h>
FEATURE(nfsserver, "NFS server");
#ifdef NFSRV_DEBUG
#define nfsdbprintf(info) printf info
#else

View File

@ -72,6 +72,8 @@ __FBSDID("$FreeBSD$");
#include <vm/uma.h>
FEATURE(audit, "BSM audit support");
static uma_zone_t audit_record_zone;
static MALLOC_DEFINE(M_AUDITCRED, "audit_cred", "Audit cred storage");
MALLOC_DEFINE(M_AUDITDATA, "audit_data", "Audit data storage");

View File

@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mac.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <sys/sysproto.h>
#include <sys/sysent.h>
#include <sys/vnode.h>
@ -72,6 +73,8 @@ __FBSDID("$FreeBSD$");
#ifdef MAC
FEATURE(mac, "Mandatory Access Control Framework support");
int
__mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap)
{