sysctl.h (37931) | sysctl.h (38517) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Karels at Berkeley Software Design, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Karels at Berkeley Software Design, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 |
37 * $Id: sysctl.h,v 1.60 1998/04/24 04:15:52 dg Exp $ | 37 * $Id: sysctl.h,v 1.61 1998/07/28 22:34:12 joerg Exp $ |
38 */ 39 40#ifndef _SYS_SYSCTL_H_ 41#define _SYS_SYSCTL_H_ 42 43#include <sys/_posix.h> 44 45/* --- 49 unchanged lines hidden (view full) --- 95/* 96 * This describes the access space for a sysctl request. This is needed 97 * so that we can use the interface from the kernel or from user-space. 98 */ 99struct sysctl_req { 100 struct proc *p; 101 int lock; 102 void *oldptr; | 38 */ 39 40#ifndef _SYS_SYSCTL_H_ 41#define _SYS_SYSCTL_H_ 42 43#include <sys/_posix.h> 44 45/* --- 49 unchanged lines hidden (view full) --- 95/* 96 * This describes the access space for a sysctl request. This is needed 97 * so that we can use the interface from the kernel or from user-space. 98 */ 99struct sysctl_req { 100 struct proc *p; 101 int lock; 102 void *oldptr; |
103 int oldlen; 104 int oldidx; 105 int (*oldfunc)(struct sysctl_req *, const void *, int); | 103 size_t oldlen; 104 size_t oldidx; 105 int (*oldfunc)(struct sysctl_req *, const void *, size_t); |
106 void *newptr; | 106 void *newptr; |
107 int newlen; 108 int newidx; 109 int (*newfunc)(struct sysctl_req *, void *, int); | 107 size_t newlen; 108 size_t newidx; 109 int (*newfunc)(struct sysctl_req *, void *, size_t); |
110}; 111 112/* 113 * This describes one "oid" in the MIB tree. Potentially more nodes can 114 * be hidden behind it, expanded by the handler. 115 */ 116struct sysctl_oid { 117 int oid_number; --- 4 unchanged lines hidden (view full) --- 122 int (*oid_handler) SYSCTL_HANDLER_ARGS; 123 const char *oid_fmt; 124}; 125 126#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l) 127#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l) 128 129int sysctl_handle_int SYSCTL_HANDLER_ARGS; | 110}; 111 112/* 113 * This describes one "oid" in the MIB tree. Potentially more nodes can 114 * be hidden behind it, expanded by the handler. 115 */ 116struct sysctl_oid { 117 int oid_number; --- 4 unchanged lines hidden (view full) --- 122 int (*oid_handler) SYSCTL_HANDLER_ARGS; 123 const char *oid_fmt; 124}; 125 126#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l) 127#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l) 128 129int sysctl_handle_int SYSCTL_HANDLER_ARGS; |
130int sysctl_handle_long SYSCTL_HANDLER_ARGS; 131int sysctl_handle_intptr SYSCTL_HANDLER_ARGS; |
|
130int sysctl_handle_string SYSCTL_HANDLER_ARGS; 131int sysctl_handle_opaque SYSCTL_HANDLER_ARGS; 132 133/* This is the "raw" function for a mib-oid */ 134#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ 135 static const struct sysctl_oid sysctl__##parent##_##name = { \ 136 nbr, kind, a1, a2, #name, handler, fmt }; \ 137 TEXT_SET(sysctl_##parent, sysctl__##parent##_##name) --- 10 unchanged lines hidden (view full) --- 148 SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|access, \ 149 arg, len, sysctl_handle_string, "A", descr) 150 151/* This is a integer, if ptr is NULL, val is returned */ 152#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \ 153 SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \ 154 ptr, val, sysctl_handle_int, "I", descr) 155 | 132int sysctl_handle_string SYSCTL_HANDLER_ARGS; 133int sysctl_handle_opaque SYSCTL_HANDLER_ARGS; 134 135/* This is the "raw" function for a mib-oid */ 136#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \ 137 static const struct sysctl_oid sysctl__##parent##_##name = { \ 138 nbr, kind, a1, a2, #name, handler, fmt }; \ 139 TEXT_SET(sysctl_##parent, sysctl__##parent##_##name) --- 10 unchanged lines hidden (view full) --- 150 SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|access, \ 151 arg, len, sysctl_handle_string, "A", descr) 152 153/* This is a integer, if ptr is NULL, val is returned */ 154#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \ 155 SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \ 156 ptr, val, sysctl_handle_int, "I", descr) 157 |
158/* This is a integer, if ptr is NULL, val is returned */ 159#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \ 160 SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \ 161 ptr, val, sysctl_handle_long, "L", descr) 162 163/* This is a integer, if ptr is NULL, val is returned */ 164#define SYSCTL_INTPTR(parent, nbr, name, access, ptr, val, descr) \ 165 SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \ 166 ptr, val, sysctl_handle_intptr, "P", descr) 167 |
|
156/* This is anything, specified by a pointer and a lenth */ 157#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ 158 SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \ 159 ptr, len, sysctl_handle_opaque, fmt, descr) 160 161/* This is a struct, specified by a pointer and type */ 162#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \ 163 SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \ --- 279 unchanged lines hidden (view full) --- 443} 444 445#ifdef KERNEL 446 447extern char machine[]; 448extern char osrelease[]; 449extern char ostype[]; 450 | 168/* This is anything, specified by a pointer and a lenth */ 169#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ 170 SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \ 171 ptr, len, sysctl_handle_opaque, fmt, descr) 172 173/* This is a struct, specified by a pointer and type */ 174#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \ 175 SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|access, \ --- 279 unchanged lines hidden (view full) --- 455} 456 457#ifdef KERNEL 458 459extern char machine[]; 460extern char osrelease[]; 461extern char ostype[]; 462 |
451int kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen, int *retval); 452int userland_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen, int *retval); | 463int kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen, size_t *retval); 464int userland_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen, size_t *retval); |
453/* 454int sysctl_clockrate __P((char *, size_t*)); 455int sysctl_file __P((char *, size_t*)); 456int sysctl_doproc __P((int *, u_int, char *, size_t*)); 457int sysctl_doprof __P((int *, u_int, void *, size_t *, void *, size_t)); 458*/ 459 460#else /* !KERNEL */ 461#include <sys/cdefs.h> 462 463__BEGIN_DECLS 464int sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); 465int sysctlbyname __P((const char *, void *, size_t *, void *, size_t)); 466__END_DECLS 467#endif /* KERNEL */ 468 469#endif /* !_SYS_SYSCTL_H_ */ | 465/* 466int sysctl_clockrate __P((char *, size_t*)); 467int sysctl_file __P((char *, size_t*)); 468int sysctl_doproc __P((int *, u_int, char *, size_t*)); 469int sysctl_doprof __P((int *, u_int, void *, size_t *, void *, size_t)); 470*/ 471 472#else /* !KERNEL */ 473#include <sys/cdefs.h> 474 475__BEGIN_DECLS 476int sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); 477int sysctlbyname __P((const char *, void *, size_t *, void *, size_t)); 478__END_DECLS 479#endif /* KERNEL */ 480 481#endif /* !_SYS_SYSCTL_H_ */ |