Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/sysctl.h
Show All 36 Lines | |||||
#ifndef _SYS_SYSCTL_H_ | #ifndef _SYS_SYSCTL_H_ | ||||
#define _SYS_SYSCTL_H_ | #define _SYS_SYSCTL_H_ | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#endif | #endif | ||||
struct thread; | struct thread; | ||||
kib: I think this line should be moved under #ifdef _KERNEL, if you are cleaning the header for… | |||||
Done Inline ActionsExcellent suggestion. imp: Excellent suggestion. | |||||
/* | /* | ||||
* Definitions for sysctl call. The sysctl call uses a hierarchical name | * Definitions for sysctl call. The sysctl call uses a hierarchical name | ||||
* for objects that can be examined or modified. The name is expressed as | * for objects that can be examined or modified. The name is expressed as | ||||
* a sequence of integers. Like a file path name, the meaning of each | * a sequence of integers. Like a file path name, the meaning of each | ||||
* component depends on its place in the hierarchy. The top-level and kern | * component depends on its place in the hierarchy. The top-level and kern | ||||
* identifiers are defined here, and other identifiers are defined in the | * identifiers are defined here, and other identifiers are defined in the | ||||
* respective subsystem header files. | * respective subsystem header files. | ||||
*/ | */ | ||||
#define CTL_MAXNAME 24 /* largest number of components supported */ | #define CTL_MAXNAME 24 /* largest number of components supported */ | ||||
/* | /* | ||||
* Each subsystem defined by sysctl defines a list of variables | * Each subsystem defined by sysctl defines a list of variables | ||||
* for that subsystem. Each name is either a node with further | * for that subsystem. Each name is either a node with further | ||||
* levels defined below it, or it is a leaf of some particular | * levels defined below it, or it is a leaf of some particular | ||||
* type given below. Each sysctl level defines a set of name/type | * type given below. Each sysctl level defines a set of name/type | ||||
* pairs to be used by sysctl(8) in manipulating the subsystem. | * pairs to be used by sysctl(8) in manipulating the subsystem. | ||||
*/ | */ | ||||
struct ctlname { | struct ctlname { | ||||
Not Done Inline ActionsI am not sure why this structure is defined for userspace. More, I tried to find a use for it in src/ and failed (but I only grepped, I did not tried to compile world with the definition removed). kib: I am not sure why this structure is defined for userspace.
More, I tried to find a use for it… | |||||
Done Inline ActionsWorld and kernel both build w/o it. I'm going to remove it as a separate commit. imp: World and kernel both build w/o it. I'm going to remove it as a separate commit. | |||||
char *ctl_name; /* subsystem name */ | char *ctl_name; /* subsystem name */ | ||||
int ctl_type; /* type of name */ | int ctl_type; /* type of name */ | ||||
}; | }; | ||||
#define CTLTYPE 0xf /* mask for the type */ | #define CTLTYPE 0xf /* mask for the type */ | ||||
#define CTLTYPE_NODE 1 /* name is a node */ | #define CTLTYPE_NODE 1 /* name is a node */ | ||||
#define CTLTYPE_INT 2 /* name describes an integer */ | #define CTLTYPE_INT 2 /* name describes an integer */ | ||||
#define CTLTYPE_STRING 3 /* name describes a string */ | #define CTLTYPE_STRING 3 /* name describes a string */ | ||||
▲ Show 20 Lines • Show All 1,102 Lines • ▼ Show 20 Lines | int kern___sysctlbyname(struct thread *td, const char *name, | ||||
size_t namelen, void *old, size_t *oldlenp, void *new, | size_t namelen, void *old, size_t *oldlenp, void *new, | ||||
size_t newlen, size_t *retval, int flags, bool inkernel); | size_t newlen, size_t *retval, int flags, bool inkernel); | ||||
struct sbuf; | struct sbuf; | ||||
struct sbuf *sbuf_new_for_sysctl(struct sbuf *, char *, int, | struct sbuf *sbuf_new_for_sysctl(struct sbuf *, char *, int, | ||||
struct sysctl_req *); | struct sysctl_req *); | ||||
#else /* !_KERNEL */ | #else /* !_KERNEL */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
#include <sys/_types.h> | |||||
#ifndef _SIZE_T_DECLARED | |||||
typedef __size_t size_t; | |||||
#define _SIZE_T_DECLARED | |||||
#endif | |||||
__BEGIN_DECLS | __BEGIN_DECLS | ||||
int sysctl(const int *, u_int, void *, size_t *, const void *, size_t); | int sysctl(const int *, unsigned int, void *, size_t *, const void *, size_t); | ||||
int sysctlbyname(const char *, void *, size_t *, const void *, size_t); | int sysctlbyname(const char *, void *, size_t *, const void *, size_t); | ||||
int sysctlnametomib(const char *, int *, size_t *); | int sysctlnametomib(const char *, int *, size_t *); | ||||
__END_DECLS | __END_DECLS | ||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#endif /* !_SYS_SYSCTL_H_ */ | #endif /* !_SYS_SYSCTL_H_ */ |
I think this line should be moved under #ifdef _KERNEL, if you are cleaning the header for userspace.