macOS libc headers: add sys/sysctl.h
libcxx depends on it
This commit is contained in:
378
lib/libc/include/x86_64-macos-gnu/bsm/audit.h
Normal file
378
lib/libc/include/x86_64-macos-gnu/bsm/audit.h
Normal file
@@ -0,0 +1,378 @@
|
||||
/*-
|
||||
* Copyright (c) 2005-2009 Apple Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Apple Inc. ("Apple") nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit.h#10 $
|
||||
*/
|
||||
|
||||
#ifndef _BSM_AUDIT_H
|
||||
#define _BSM_AUDIT_H
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define AUDIT_RECORD_MAGIC 0x828a0f1b
|
||||
#define MAX_AUDIT_RECORDS 20
|
||||
#define MAXAUDITDATA (0x8000 - 1)
|
||||
#define MAX_AUDIT_RECORD_SIZE MAXAUDITDATA
|
||||
#define MIN_AUDIT_FILE_SIZE (512 * 1024)
|
||||
|
||||
/*
|
||||
* Minimum noumber of free blocks on the filesystem containing the audit
|
||||
* log necessary to avoid a hard log rotation. DO NOT SET THIS VALUE TO 0
|
||||
* as the kernel does an unsigned compare, plus we want to leave a few blocks
|
||||
* free so userspace can terminate the log, etc.
|
||||
*/
|
||||
#define AUDIT_HARD_LIMIT_FREE_BLOCKS 4
|
||||
|
||||
/*
|
||||
* Triggers for the audit daemon.
|
||||
*/
|
||||
#define AUDIT_TRIGGER_MIN 1
|
||||
#define AUDIT_TRIGGER_LOW_SPACE 1 /* Below low watermark. */
|
||||
#define AUDIT_TRIGGER_ROTATE_KERNEL 2 /* Kernel requests rotate. */
|
||||
#define AUDIT_TRIGGER_READ_FILE 3 /* Re-read config file. */
|
||||
#define AUDIT_TRIGGER_CLOSE_AND_DIE 4 /* Terminate audit. */
|
||||
#define AUDIT_TRIGGER_NO_SPACE 5 /* Below min free space. */
|
||||
#define AUDIT_TRIGGER_ROTATE_USER 6 /* User requests rotate. */
|
||||
#define AUDIT_TRIGGER_INITIALIZE 7 /* User initialize of auditd. */
|
||||
#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 /* User expiration of trails. */
|
||||
#define AUDIT_TRIGGER_MAX 8
|
||||
|
||||
/*
|
||||
* The special device filename (FreeBSD).
|
||||
*/
|
||||
#define AUDITDEV_FILENAME "audit"
|
||||
#define AUDIT_TRIGGER_FILE ("/dev/" AUDITDEV_FILENAME)
|
||||
|
||||
/*
|
||||
* Pre-defined audit IDs
|
||||
*/
|
||||
#define AU_DEFAUDITID (uid_t)(-1)
|
||||
#define AU_DEFAUDITSID 0
|
||||
#define AU_ASSIGN_ASID -1
|
||||
|
||||
/*
|
||||
* IPC types.
|
||||
*/
|
||||
#define AT_IPC_MSG ((unsigned char)1) /* Message IPC id. */
|
||||
#define AT_IPC_SEM ((unsigned char)2) /* Semaphore IPC id. */
|
||||
#define AT_IPC_SHM ((unsigned char)3) /* Shared mem IPC id. */
|
||||
|
||||
/*
|
||||
* Audit conditions.
|
||||
*/
|
||||
#define AUC_UNSET 0
|
||||
#define AUC_AUDITING 1
|
||||
#define AUC_NOAUDIT 2
|
||||
#define AUC_DISABLED -1
|
||||
|
||||
/*
|
||||
* auditon(2) commands.
|
||||
*/
|
||||
#define A_OLDGETPOLICY 2
|
||||
#define A_OLDSETPOLICY 3
|
||||
#define A_GETKMASK 4
|
||||
#define A_SETKMASK 5
|
||||
#define A_OLDGETQCTRL 6
|
||||
#define A_OLDSETQCTRL 7
|
||||
#define A_GETCWD 8
|
||||
#define A_GETCAR 9
|
||||
#define A_GETSTAT 12
|
||||
#define A_SETSTAT 13
|
||||
#define A_SETUMASK 14
|
||||
#define A_SETSMASK 15
|
||||
#define A_OLDGETCOND 20
|
||||
#define A_OLDSETCOND 21
|
||||
#define A_GETCLASS 22
|
||||
#define A_SETCLASS 23
|
||||
#define A_GETPINFO 24
|
||||
#define A_SETPMASK 25
|
||||
#define A_SETFSIZE 26
|
||||
#define A_GETFSIZE 27
|
||||
#define A_GETPINFO_ADDR 28
|
||||
#define A_GETKAUDIT 29
|
||||
#define A_SETKAUDIT 30
|
||||
#define A_SENDTRIGGER 31
|
||||
#define A_GETSINFO_ADDR 32
|
||||
#define A_GETPOLICY 33
|
||||
#define A_SETPOLICY 34
|
||||
#define A_GETQCTRL 35
|
||||
#define A_SETQCTRL 36
|
||||
#define A_GETCOND 37
|
||||
#define A_SETCOND 38
|
||||
#define A_GETSFLAGS 39
|
||||
#define A_SETSFLAGS 40
|
||||
#define A_GETCTLMODE 41
|
||||
#define A_SETCTLMODE 42
|
||||
#define A_GETEXPAFTER 43
|
||||
#define A_SETEXPAFTER 44
|
||||
|
||||
/*
|
||||
* Audit policy controls.
|
||||
*/
|
||||
#define AUDIT_CNT 0x0001
|
||||
#define AUDIT_AHLT 0x0002
|
||||
#define AUDIT_ARGV 0x0004
|
||||
#define AUDIT_ARGE 0x0008
|
||||
#define AUDIT_SEQ 0x0010
|
||||
#define AUDIT_WINDATA 0x0020
|
||||
#define AUDIT_USER 0x0040
|
||||
#define AUDIT_GROUP 0x0080
|
||||
#define AUDIT_TRAIL 0x0100
|
||||
#define AUDIT_PATH 0x0200
|
||||
#define AUDIT_SCNT 0x0400
|
||||
#define AUDIT_PUBLIC 0x0800
|
||||
#define AUDIT_ZONENAME 0x1000
|
||||
#define AUDIT_PERZONE 0x2000
|
||||
|
||||
/*
|
||||
* Default audit queue control parameters.
|
||||
*/
|
||||
#define AQ_HIWATER 100
|
||||
#define AQ_MAXHIGH 10000
|
||||
#define AQ_LOWATER 10
|
||||
#define AQ_BUFSZ MAXAUDITDATA
|
||||
#define AQ_MAXBUFSZ 1048576
|
||||
|
||||
/*
|
||||
* Default minimum percentage free space on file system.
|
||||
*/
|
||||
#define AU_FS_MINFREE 20
|
||||
|
||||
/*
|
||||
* Type definitions used indicating the length of variable length addresses
|
||||
* in tokens containing addresses, such as header fields.
|
||||
*/
|
||||
#define AU_IPv4 4
|
||||
#define AU_IPv6 16
|
||||
|
||||
/*
|
||||
* Reserved audit class mask indicating which classes are unable to have
|
||||
* events added or removed by unentitled processes.
|
||||
*/
|
||||
#define AU_CLASS_MASK_RESERVED 0x10000000
|
||||
|
||||
/*
|
||||
* Audit control modes
|
||||
*/
|
||||
#define AUDIT_CTLMODE_NORMAL ((unsigned char)1)
|
||||
#define AUDIT_CTLMODE_EXTERNAL ((unsigned char)2)
|
||||
|
||||
/*
|
||||
* Audit file expire_after op modes
|
||||
*/
|
||||
#define AUDIT_EXPIRE_OP_AND ((unsigned char)0)
|
||||
#define AUDIT_EXPIRE_OP_OR ((unsigned char)1)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
typedef uid_t au_id_t;
|
||||
typedef pid_t au_asid_t;
|
||||
typedef u_int16_t au_event_t;
|
||||
typedef u_int16_t au_emod_t;
|
||||
typedef u_int32_t au_class_t;
|
||||
typedef u_int64_t au_asflgs_t __attribute__ ((aligned(8)));
|
||||
typedef unsigned char au_ctlmode_t;
|
||||
|
||||
struct au_tid {
|
||||
dev_t port;
|
||||
u_int32_t machine;
|
||||
};
|
||||
typedef struct au_tid au_tid_t;
|
||||
|
||||
struct au_tid_addr {
|
||||
dev_t at_port;
|
||||
u_int32_t at_type;
|
||||
u_int32_t at_addr[4];
|
||||
};
|
||||
typedef struct au_tid_addr au_tid_addr_t;
|
||||
|
||||
struct au_mask {
|
||||
unsigned int am_success; /* Success bits. */
|
||||
unsigned int am_failure; /* Failure bits. */
|
||||
};
|
||||
typedef struct au_mask au_mask_t;
|
||||
|
||||
struct auditinfo {
|
||||
au_id_t ai_auid; /* Audit user ID. */
|
||||
au_mask_t ai_mask; /* Audit masks. */
|
||||
au_tid_t ai_termid; /* Terminal ID. */
|
||||
au_asid_t ai_asid; /* Audit session ID. */
|
||||
};
|
||||
typedef struct auditinfo auditinfo_t;
|
||||
|
||||
struct auditinfo_addr {
|
||||
au_id_t ai_auid; /* Audit user ID. */
|
||||
au_mask_t ai_mask; /* Audit masks. */
|
||||
au_tid_addr_t ai_termid; /* Terminal ID. */
|
||||
au_asid_t ai_asid; /* Audit session ID. */
|
||||
au_asflgs_t ai_flags; /* Audit session flags. */
|
||||
};
|
||||
typedef struct auditinfo_addr auditinfo_addr_t;
|
||||
|
||||
struct auditpinfo {
|
||||
pid_t ap_pid; /* ID of target process. */
|
||||
au_id_t ap_auid; /* Audit user ID. */
|
||||
au_mask_t ap_mask; /* Audit masks. */
|
||||
au_tid_t ap_termid; /* Terminal ID. */
|
||||
au_asid_t ap_asid; /* Audit session ID. */
|
||||
};
|
||||
typedef struct auditpinfo auditpinfo_t;
|
||||
|
||||
struct auditpinfo_addr {
|
||||
pid_t ap_pid; /* ID of target process. */
|
||||
au_id_t ap_auid; /* Audit user ID. */
|
||||
au_mask_t ap_mask; /* Audit masks. */
|
||||
au_tid_addr_t ap_termid; /* Terminal ID. */
|
||||
au_asid_t ap_asid; /* Audit session ID. */
|
||||
au_asflgs_t ap_flags; /* Audit session flags. */
|
||||
};
|
||||
typedef struct auditpinfo_addr auditpinfo_addr_t;
|
||||
|
||||
struct au_session {
|
||||
auditinfo_addr_t *as_aia_p; /* Ptr to full audit info. */
|
||||
au_mask_t as_mask; /* Process Audit Masks. */
|
||||
};
|
||||
typedef struct au_session au_session_t;
|
||||
|
||||
struct au_expire_after {
|
||||
time_t age; /* Age after which trail files should be expired */
|
||||
size_t size; /* Aggregate trail size when files should be expired */
|
||||
unsigned char op_type; /* Operator used with the above values to determine when files should be expired */
|
||||
};
|
||||
typedef struct au_expire_after au_expire_after_t;
|
||||
|
||||
/*
|
||||
* Contents of token_t are opaque outside of libbsm.
|
||||
*/
|
||||
typedef struct au_token token_t;
|
||||
|
||||
/*
|
||||
* Kernel audit queue control parameters:
|
||||
* Default: Maximum:
|
||||
* aq_hiwater: AQ_HIWATER (100) AQ_MAXHIGH (10000)
|
||||
* aq_lowater: AQ_LOWATER (10) <aq_hiwater
|
||||
* aq_bufsz: AQ_BUFSZ (32767) AQ_MAXBUFSZ (1048576)
|
||||
* aq_delay: 20 20000 (not used)
|
||||
*/
|
||||
struct au_qctrl {
|
||||
int aq_hiwater; /* Max # of audit recs in queue when */
|
||||
/* threads with new ARs get blocked. */
|
||||
|
||||
int aq_lowater; /* # of audit recs in queue when */
|
||||
/* blocked threads get unblocked. */
|
||||
|
||||
int aq_bufsz; /* Max size of audit record for audit(2). */
|
||||
int aq_delay; /* Queue delay (not used). */
|
||||
int aq_minfree; /* Minimum filesystem percent free space. */
|
||||
};
|
||||
typedef struct au_qctrl au_qctrl_t;
|
||||
|
||||
/*
|
||||
* Structure for the audit statistics.
|
||||
*/
|
||||
struct audit_stat {
|
||||
unsigned int as_version;
|
||||
unsigned int as_numevent;
|
||||
int as_generated;
|
||||
int as_nonattrib;
|
||||
int as_kernel;
|
||||
int as_audit;
|
||||
int as_auditctl;
|
||||
int as_enqueue;
|
||||
int as_written;
|
||||
int as_wblocked;
|
||||
int as_rblocked;
|
||||
int as_dropped;
|
||||
int as_totalsize;
|
||||
unsigned int as_memused;
|
||||
};
|
||||
typedef struct audit_stat au_stat_t;
|
||||
|
||||
/*
|
||||
* Structure for the audit file statistics.
|
||||
*/
|
||||
struct audit_fstat {
|
||||
u_int64_t af_filesz;
|
||||
u_int64_t af_currsz;
|
||||
};
|
||||
typedef struct audit_fstat au_fstat_t;
|
||||
|
||||
/*
|
||||
* Audit to event class mapping.
|
||||
*/
|
||||
struct au_evclass_map {
|
||||
au_event_t ec_number;
|
||||
au_class_t ec_class;
|
||||
};
|
||||
typedef struct au_evclass_map au_evclass_map_t;
|
||||
|
||||
/*
|
||||
* Audit system calls.
|
||||
*/
|
||||
#if !defined(_KERNEL) && !defined(KERNEL)
|
||||
int audit(const void *, int);
|
||||
int auditon(int, void *, int);
|
||||
int auditctl(const char *);
|
||||
int getauid(au_id_t *);
|
||||
int setauid(const au_id_t *);
|
||||
int getaudit_addr(struct auditinfo_addr *, int);
|
||||
int setaudit_addr(const struct auditinfo_addr *, int);
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <Availability.h>
|
||||
|
||||
/*
|
||||
* getaudit()/setaudit() are deprecated and have been replaced with
|
||||
* wrappers to the getaudit_addr()/setaudit_addr() syscalls above.
|
||||
*/
|
||||
|
||||
int getaudit(struct auditinfo *)
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8,
|
||||
__IPHONE_2_0, __IPHONE_6_0);
|
||||
int setaudit(const struct auditinfo *)
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8,
|
||||
__IPHONE_2_0, __IPHONE_6_0);
|
||||
#else
|
||||
|
||||
int getaudit(struct auditinfo *);
|
||||
int setaudit(const struct auditinfo *);
|
||||
#endif /* !__APPLE__ */
|
||||
|
||||
#ifdef __APPLE_API_PRIVATE
|
||||
#include <mach/port.h>
|
||||
mach_port_name_t audit_session_self(void);
|
||||
au_asid_t audit_session_join(mach_port_name_t port);
|
||||
int audit_session_port(au_asid_t asid, mach_port_name_t *portname);
|
||||
#endif /* __APPLE_API_PRIVATE */
|
||||
|
||||
#endif /* defined(_KERNEL) || defined(KERNEL) */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_BSM_AUDIT_H */
|
||||
396
lib/libc/include/x86_64-macos-gnu/sys/event.h
Normal file
396
lib/libc/include/x86_64-macos-gnu/sys/event.h
Normal file
@@ -0,0 +1,396 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2019 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*-
|
||||
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/sys/event.h,v 1.5.2.5 2001/12/14 19:21:22 jlemon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_EVENT_H_
|
||||
#define _SYS_EVENT_H_
|
||||
|
||||
#include <machine/types.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* Filter types
|
||||
*/
|
||||
#define EVFILT_READ (-1)
|
||||
#define EVFILT_WRITE (-2)
|
||||
#define EVFILT_AIO (-3) /* attached to aio requests */
|
||||
#define EVFILT_VNODE (-4) /* attached to vnodes */
|
||||
#define EVFILT_PROC (-5) /* attached to struct proc */
|
||||
#define EVFILT_SIGNAL (-6) /* attached to struct proc */
|
||||
#define EVFILT_TIMER (-7) /* timers */
|
||||
#define EVFILT_MACHPORT (-8) /* Mach portsets */
|
||||
#define EVFILT_FS (-9) /* Filesystem events */
|
||||
#define EVFILT_USER (-10) /* User events */
|
||||
#define EVFILT_VM (-12) /* Virtual memory events */
|
||||
#define EVFILT_EXCEPT (-15) /* Exception events */
|
||||
|
||||
#define EVFILT_SYSCOUNT 17
|
||||
#define EVFILT_THREADMARKER EVFILT_SYSCOUNT /* Internal use only */
|
||||
|
||||
#pragma pack(4)
|
||||
|
||||
struct kevent {
|
||||
uintptr_t ident; /* identifier for this event */
|
||||
int16_t filter; /* filter for event */
|
||||
uint16_t flags; /* general flags */
|
||||
uint32_t fflags; /* filter-specific flags */
|
||||
intptr_t data; /* filter-specific data */
|
||||
void *udata; /* opaque user data identifier */
|
||||
};
|
||||
|
||||
|
||||
#pragma pack()
|
||||
|
||||
struct kevent64_s {
|
||||
uint64_t ident; /* identifier for this event */
|
||||
int16_t filter; /* filter for event */
|
||||
uint16_t flags; /* general flags */
|
||||
uint32_t fflags; /* filter-specific flags */
|
||||
int64_t data; /* filter-specific data */
|
||||
uint64_t udata; /* opaque user data identifier */
|
||||
uint64_t ext[2]; /* filter-specific extensions */
|
||||
};
|
||||
|
||||
|
||||
#define EV_SET(kevp, a, b, c, d, e, f) do { \
|
||||
struct kevent *__kevp__ = (kevp); \
|
||||
__kevp__->ident = (a); \
|
||||
__kevp__->filter = (b); \
|
||||
__kevp__->flags = (c); \
|
||||
__kevp__->fflags = (d); \
|
||||
__kevp__->data = (e); \
|
||||
__kevp__->udata = (f); \
|
||||
} while(0)
|
||||
|
||||
#define EV_SET64(kevp, a, b, c, d, e, f, g, h) do { \
|
||||
struct kevent64_s *__kevp__ = (kevp); \
|
||||
__kevp__->ident = (a); \
|
||||
__kevp__->filter = (b); \
|
||||
__kevp__->flags = (c); \
|
||||
__kevp__->fflags = (d); \
|
||||
__kevp__->data = (e); \
|
||||
__kevp__->udata = (f); \
|
||||
__kevp__->ext[0] = (g); \
|
||||
__kevp__->ext[1] = (h); \
|
||||
} while(0)
|
||||
|
||||
|
||||
/* kevent system call flags */
|
||||
#define KEVENT_FLAG_NONE 0x000000 /* no flag value */
|
||||
#define KEVENT_FLAG_IMMEDIATE 0x000001 /* immediate timeout */
|
||||
#define KEVENT_FLAG_ERROR_EVENTS 0x000002 /* output events only include change errors */
|
||||
|
||||
|
||||
/* actions */
|
||||
#define EV_ADD 0x0001 /* add event to kq (implies enable) */
|
||||
#define EV_DELETE 0x0002 /* delete event from kq */
|
||||
#define EV_ENABLE 0x0004 /* enable event */
|
||||
#define EV_DISABLE 0x0008 /* disable event (not reported) */
|
||||
|
||||
/* flags */
|
||||
#define EV_ONESHOT 0x0010 /* only report one occurrence */
|
||||
#define EV_CLEAR 0x0020 /* clear event state after reporting */
|
||||
#define EV_RECEIPT 0x0040 /* force immediate event output */
|
||||
/* ... with or without EV_ERROR */
|
||||
/* ... use KEVENT_FLAG_ERROR_EVENTS */
|
||||
/* on syscalls supporting flags */
|
||||
|
||||
#define EV_DISPATCH 0x0080 /* disable event after reporting */
|
||||
#define EV_UDATA_SPECIFIC 0x0100 /* unique kevent per udata value */
|
||||
|
||||
#define EV_DISPATCH2 (EV_DISPATCH | EV_UDATA_SPECIFIC)
|
||||
/* ... in combination with EV_DELETE */
|
||||
/* will defer delete until udata-specific */
|
||||
/* event enabled. EINPROGRESS will be */
|
||||
/* returned to indicate the deferral */
|
||||
|
||||
#define EV_VANISHED 0x0200 /* report that source has vanished */
|
||||
/* ... only valid with EV_DISPATCH2 */
|
||||
|
||||
#define EV_SYSFLAGS 0xF000 /* reserved by system */
|
||||
#define EV_FLAG0 0x1000 /* filter-specific flag */
|
||||
#define EV_FLAG1 0x2000 /* filter-specific flag */
|
||||
|
||||
/* returned values */
|
||||
#define EV_EOF 0x8000 /* EOF detected */
|
||||
#define EV_ERROR 0x4000 /* error, data contains errno */
|
||||
|
||||
/*
|
||||
* Filter specific flags for EVFILT_READ
|
||||
*
|
||||
* The default behavior for EVFILT_READ is to make the "read" determination
|
||||
* relative to the current file descriptor read pointer.
|
||||
*
|
||||
* The EV_POLL flag indicates the determination should be made via poll(2)
|
||||
* semantics. These semantics dictate always returning true for regular files,
|
||||
* regardless of the amount of unread data in the file.
|
||||
*
|
||||
* On input, EV_OOBAND specifies that filter should actively return in the
|
||||
* presence of OOB on the descriptor. It implies that filter will return
|
||||
* if there is OOB data available to read OR when any other condition
|
||||
* for the read are met (for example number of bytes regular data becomes >=
|
||||
* low-watermark).
|
||||
* If EV_OOBAND is not set on input, it implies that the filter should not actively
|
||||
* return for out of band data on the descriptor. The filter will then only return
|
||||
* when some other condition for read is met (ex: when number of regular data bytes
|
||||
* >=low-watermark OR when socket can't receive more data (SS_CANTRCVMORE)).
|
||||
*
|
||||
* On output, EV_OOBAND indicates the presence of OOB data on the descriptor.
|
||||
* If it was not specified as an input parameter, then the data count is the
|
||||
* number of bytes before the current OOB marker, else data count is the number
|
||||
* of bytes beyond OOB marker.
|
||||
*/
|
||||
#define EV_POLL EV_FLAG0
|
||||
#define EV_OOBAND EV_FLAG1
|
||||
|
||||
/*
|
||||
* data/hint fflags for EVFILT_USER, shared with userspace
|
||||
*/
|
||||
|
||||
/*
|
||||
* On input, NOTE_TRIGGER causes the event to be triggered for output.
|
||||
*/
|
||||
#define NOTE_TRIGGER 0x01000000
|
||||
|
||||
/*
|
||||
* On input, the top two bits of fflags specifies how the lower twenty four
|
||||
* bits should be applied to the stored value of fflags.
|
||||
*
|
||||
* On output, the top two bits will always be set to NOTE_FFNOP and the
|
||||
* remaining twenty four bits will contain the stored fflags value.
|
||||
*/
|
||||
#define NOTE_FFNOP 0x00000000 /* ignore input fflags */
|
||||
#define NOTE_FFAND 0x40000000 /* and fflags */
|
||||
#define NOTE_FFOR 0x80000000 /* or fflags */
|
||||
#define NOTE_FFCOPY 0xc0000000 /* copy fflags */
|
||||
#define NOTE_FFCTRLMASK 0xc0000000 /* mask for operations */
|
||||
#define NOTE_FFLAGSMASK 0x00ffffff
|
||||
|
||||
|
||||
/*
|
||||
* data/hint fflags for EVFILT_{READ|WRITE}, shared with userspace
|
||||
*
|
||||
* The default behavior for EVFILT_READ is to make the determination
|
||||
* realtive to the current file descriptor read pointer.
|
||||
*/
|
||||
#define NOTE_LOWAT 0x00000001 /* low water mark */
|
||||
|
||||
/* data/hint flags for EVFILT_EXCEPT, shared with userspace */
|
||||
#define NOTE_OOB 0x00000002 /* OOB data */
|
||||
|
||||
/*
|
||||
* data/hint fflags for EVFILT_VNODE, shared with userspace
|
||||
*/
|
||||
#define NOTE_DELETE 0x00000001 /* vnode was removed */
|
||||
#define NOTE_WRITE 0x00000002 /* data contents changed */
|
||||
#define NOTE_EXTEND 0x00000004 /* size increased */
|
||||
#define NOTE_ATTRIB 0x00000008 /* attributes changed */
|
||||
#define NOTE_LINK 0x00000010 /* link count changed */
|
||||
#define NOTE_RENAME 0x00000020 /* vnode was renamed */
|
||||
#define NOTE_REVOKE 0x00000040 /* vnode access was revoked */
|
||||
#define NOTE_NONE 0x00000080 /* No specific vnode event: to test for EVFILT_READ activation*/
|
||||
#define NOTE_FUNLOCK 0x00000100 /* vnode was unlocked by flock(2) */
|
||||
|
||||
/*
|
||||
* data/hint fflags for EVFILT_PROC, shared with userspace
|
||||
*
|
||||
* Please note that EVFILT_PROC and EVFILT_SIGNAL share the same knote list
|
||||
* that hangs off the proc structure. They also both play games with the hint
|
||||
* passed to KNOTE(). If NOTE_SIGNAL is passed as a hint, then the lower bits
|
||||
* of the hint contain the signal. IF NOTE_FORK is passed, then the lower bits
|
||||
* contain the PID of the child (but the pid does not get passed through in
|
||||
* the actual kevent).
|
||||
*/
|
||||
enum {
|
||||
eNoteReapDeprecated __deprecated_enum_msg("This kqueue(2) EVFILT_PROC flag is deprecated") = 0x10000000
|
||||
};
|
||||
|
||||
#define NOTE_EXIT 0x80000000 /* process exited */
|
||||
#define NOTE_FORK 0x40000000 /* process forked */
|
||||
#define NOTE_EXEC 0x20000000 /* process exec'd */
|
||||
#define NOTE_REAP ((unsigned int)eNoteReapDeprecated /* 0x10000000 */ ) /* process reaped */
|
||||
#define NOTE_SIGNAL 0x08000000 /* shared with EVFILT_SIGNAL */
|
||||
#define NOTE_EXITSTATUS 0x04000000 /* exit status to be returned, valid for child process only */
|
||||
#define NOTE_EXIT_DETAIL 0x02000000 /* provide details on reasons for exit */
|
||||
|
||||
#define NOTE_PDATAMASK 0x000fffff /* mask for signal & exit status */
|
||||
#define NOTE_PCTRLMASK (~NOTE_PDATAMASK)
|
||||
|
||||
/*
|
||||
* If NOTE_EXITSTATUS is present, provide additional info about exiting process.
|
||||
*/
|
||||
enum {
|
||||
eNoteExitReparentedDeprecated __deprecated_enum_msg("This kqueue(2) EVFILT_PROC flag is no longer sent") = 0x00080000
|
||||
};
|
||||
#define NOTE_EXIT_REPARENTED ((unsigned int)eNoteExitReparentedDeprecated) /* exited while reparented */
|
||||
|
||||
/*
|
||||
* If NOTE_EXIT_DETAIL is present, these bits indicate specific reasons for exiting.
|
||||
*/
|
||||
#define NOTE_EXIT_DETAIL_MASK 0x00070000
|
||||
#define NOTE_EXIT_DECRYPTFAIL 0x00010000
|
||||
#define NOTE_EXIT_MEMORY 0x00020000
|
||||
#define NOTE_EXIT_CSERROR 0x00040000
|
||||
|
||||
|
||||
/*
|
||||
* data/hint fflags for EVFILT_VM, shared with userspace.
|
||||
*/
|
||||
#define NOTE_VM_PRESSURE 0x80000000 /* will react on memory pressure */
|
||||
#define NOTE_VM_PRESSURE_TERMINATE 0x40000000 /* will quit on memory pressure, possibly after cleaning up dirty state */
|
||||
#define NOTE_VM_PRESSURE_SUDDEN_TERMINATE 0x20000000 /* will quit immediately on memory pressure */
|
||||
#define NOTE_VM_ERROR 0x10000000 /* there was an error */
|
||||
|
||||
|
||||
/*
|
||||
* data/hint fflags for EVFILT_TIMER, shared with userspace.
|
||||
* The default is a (repeating) interval timer with the data
|
||||
* specifying the timeout interval in milliseconds.
|
||||
*
|
||||
* All timeouts are implicitly EV_CLEAR events.
|
||||
*/
|
||||
#define NOTE_SECONDS 0x00000001 /* data is seconds */
|
||||
#define NOTE_USECONDS 0x00000002 /* data is microseconds */
|
||||
#define NOTE_NSECONDS 0x00000004 /* data is nanoseconds */
|
||||
#define NOTE_ABSOLUTE 0x00000008 /* absolute timeout */
|
||||
/* ... implicit EV_ONESHOT, timeout uses the gettimeofday epoch */
|
||||
#define NOTE_LEEWAY 0x00000010 /* ext[1] holds leeway for power aware timers */
|
||||
#define NOTE_CRITICAL 0x00000020 /* system does minimal timer coalescing */
|
||||
#define NOTE_BACKGROUND 0x00000040 /* system does maximum timer coalescing */
|
||||
#define NOTE_MACH_CONTINUOUS_TIME 0x00000080
|
||||
/*
|
||||
* NOTE_MACH_CONTINUOUS_TIME:
|
||||
* with NOTE_ABSOLUTE: causes the timer to continue to tick across sleep,
|
||||
* still uses gettimeofday epoch
|
||||
* with NOTE_MACHTIME and NOTE_ABSOLUTE: uses mach continuous time epoch
|
||||
* without NOTE_ABSOLUTE (interval timer mode): continues to tick across sleep
|
||||
*/
|
||||
#define NOTE_MACHTIME 0x00000100 /* data is mach absolute time units */
|
||||
/* timeout uses the mach absolute time epoch */
|
||||
|
||||
|
||||
/*
|
||||
* data/hint fflags for EVFILT_MACHPORT, shared with userspace.
|
||||
*
|
||||
* Only portsets are supported at this time.
|
||||
*
|
||||
* The fflags field can optionally contain the MACH_RCV_MSG, MACH_RCV_LARGE,
|
||||
* and related trailer receive options as defined in <mach/message.h>.
|
||||
* The presence of these flags directs the kevent64() call to attempt to receive
|
||||
* the message during kevent delivery, rather than just indicate that a message exists.
|
||||
* On setup, The ext[0] field contains the receive buffer pointer and ext[1] contains
|
||||
* the receive buffer length. Upon event delivery, the actual received message size
|
||||
* is returned in ext[1]. As with mach_msg(), the buffer must be large enough to
|
||||
* receive the message and the requested (or default) message trailers. In addition,
|
||||
* the fflags field contains the return code normally returned by mach_msg().
|
||||
*
|
||||
* If MACH_RCV_MSG is specified, and the ext[1] field specifies a zero length, the
|
||||
* system call argument specifying an ouput area (kevent_qos) will be consulted. If
|
||||
* the system call specified an output data area, the user-space address
|
||||
* of the received message is carved from that provided output data area (if enough
|
||||
* space remains there). The address and length of each received message is
|
||||
* returned in the ext[0] and ext[1] fields (respectively) of the corresponding kevent.
|
||||
*
|
||||
* IF_MACH_RCV_VOUCHER_CONTENT is specified, the contents of the message voucher is
|
||||
* extracted (as specified in the xflags field) and stored in ext[2] up to ext[3]
|
||||
* length. If the input length is zero, and the system call provided a data area,
|
||||
* the space for the voucher content is carved from the provided space and its
|
||||
* address and length is returned in ext[2] and ext[3] respectively.
|
||||
*
|
||||
* If no message receipt options were provided in the fflags field on setup, no
|
||||
* message is received by this call. Instead, on output, the data field simply
|
||||
* contains the name of the actual port detected with a message waiting.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DEPRECATED!!!!!!!!!
|
||||
* NOTE_TRACK, NOTE_TRACKERR, and NOTE_CHILD are no longer supported as of 10.5
|
||||
*/
|
||||
/* additional flags for EVFILT_PROC */
|
||||
#define NOTE_TRACK 0x00000001 /* follow across forks */
|
||||
#define NOTE_TRACKERR 0x00000002 /* could not track child */
|
||||
#define NOTE_CHILD 0x00000004 /* am a child process */
|
||||
|
||||
|
||||
|
||||
/* Temporay solution for BootX to use inode.h till kqueue moves to vfs layer */
|
||||
#include <sys/queue.h>
|
||||
struct knote;
|
||||
SLIST_HEAD(klist, knote);
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
struct timespec;
|
||||
|
||||
__BEGIN_DECLS
|
||||
int kqueue(void);
|
||||
int kevent(int kq,
|
||||
const struct kevent *changelist, int nchanges,
|
||||
struct kevent *eventlist, int nevents,
|
||||
const struct timespec *timeout);
|
||||
int kevent64(int kq,
|
||||
const struct kevent64_s *changelist, int nchanges,
|
||||
struct kevent64_s *eventlist, int nevents,
|
||||
unsigned int flags,
|
||||
const struct timespec *timeout);
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* !_SYS_EVENT_H_ */
|
||||
76
lib/libc/include/x86_64-macos-gnu/sys/lock.h
Normal file
76
lib/libc/include/x86_64-macos-gnu/sys/lock.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */
|
||||
/*
|
||||
* Copyright (c) 1995
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code contains ideas from software contributed to Berkeley by
|
||||
* Avadis Tevanian, Jr., Michael Wayne Young, and the Mach Operating
|
||||
* System project at Carnegie-Mellon University.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)lock.h 8.12 (Berkeley) 5/19/95
|
||||
*/
|
||||
|
||||
#ifndef _SYS_LOCK_H_
|
||||
#define _SYS_LOCK_H_
|
||||
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
|
||||
#endif /* _SYS_LOCK_H_ */
|
||||
223
lib/libc/include/x86_64-macos-gnu/sys/proc.h
Normal file
223
lib/libc/include/x86_64-macos-gnu/sys/proc.h
Normal file
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2018 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */
|
||||
/*-
|
||||
* Copyright (c) 1986, 1989, 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)proc.h 8.15 (Berkeley) 5/19/95
|
||||
*/
|
||||
|
||||
#ifndef _SYS_PROC_H_
|
||||
#define _SYS_PROC_H_
|
||||
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/select.h> /* For struct selinfo. */
|
||||
#include <sys/queue.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/time.h>
|
||||
#include <mach/boolean.h>
|
||||
|
||||
|
||||
|
||||
struct session;
|
||||
struct pgrp;
|
||||
struct proc;
|
||||
|
||||
/* Exported fields for kern sysctls */
|
||||
struct extern_proc {
|
||||
union {
|
||||
struct {
|
||||
struct proc *__p_forw; /* Doubly-linked run/sleep queue. */
|
||||
struct proc *__p_back;
|
||||
} p_st1;
|
||||
struct timeval __p_starttime; /* process start time */
|
||||
} p_un;
|
||||
#define p_forw p_un.p_st1.__p_forw
|
||||
#define p_back p_un.p_st1.__p_back
|
||||
#define p_starttime p_un.__p_starttime
|
||||
struct vmspace *p_vmspace; /* Address space. */
|
||||
struct sigacts *p_sigacts; /* Signal actions, state (PROC ONLY). */
|
||||
int p_flag; /* P_* flags. */
|
||||
char p_stat; /* S* process status. */
|
||||
pid_t p_pid; /* Process identifier. */
|
||||
pid_t p_oppid; /* Save parent pid during ptrace. XXX */
|
||||
int p_dupfd; /* Sideways return value from fdopen. XXX */
|
||||
/* Mach related */
|
||||
caddr_t user_stack; /* where user stack was allocated */
|
||||
void *exit_thread; /* XXX Which thread is exiting? */
|
||||
int p_debugger; /* allow to debug */
|
||||
boolean_t sigwait; /* indication to suspend */
|
||||
/* scheduling */
|
||||
u_int p_estcpu; /* Time averaged value of p_cpticks. */
|
||||
int p_cpticks; /* Ticks of cpu time. */
|
||||
fixpt_t p_pctcpu; /* %cpu for this process during p_swtime */
|
||||
void *p_wchan; /* Sleep address. */
|
||||
char *p_wmesg; /* Reason for sleep. */
|
||||
u_int p_swtime; /* Time swapped in or out. */
|
||||
u_int p_slptime; /* Time since last blocked. */
|
||||
struct itimerval p_realtimer; /* Alarm timer. */
|
||||
struct timeval p_rtime; /* Real time. */
|
||||
u_quad_t p_uticks; /* Statclock hits in user mode. */
|
||||
u_quad_t p_sticks; /* Statclock hits in system mode. */
|
||||
u_quad_t p_iticks; /* Statclock hits processing intr. */
|
||||
int p_traceflag; /* Kernel trace points. */
|
||||
struct vnode *p_tracep; /* Trace to vnode. */
|
||||
int p_siglist; /* DEPRECATED. */
|
||||
struct vnode *p_textvp; /* Vnode of executable. */
|
||||
int p_holdcnt; /* If non-zero, don't swap. */
|
||||
sigset_t p_sigmask; /* DEPRECATED. */
|
||||
sigset_t p_sigignore; /* Signals being ignored. */
|
||||
sigset_t p_sigcatch; /* Signals being caught by user. */
|
||||
u_char p_priority; /* Process priority. */
|
||||
u_char p_usrpri; /* User-priority based on p_cpu and p_nice. */
|
||||
char p_nice; /* Process "nice" value. */
|
||||
char p_comm[MAXCOMLEN + 1];
|
||||
struct pgrp *p_pgrp; /* Pointer to process group. */
|
||||
struct user *p_addr; /* Kernel virtual addr of u-area (PROC ONLY). */
|
||||
u_short p_xstat; /* Exit status for wait; also stop signal. */
|
||||
u_short p_acflag; /* Accounting flags. */
|
||||
struct rusage *p_ru; /* Exit information. XXX */
|
||||
};
|
||||
|
||||
|
||||
/* Status values. */
|
||||
#define SIDL 1 /* Process being created by fork. */
|
||||
#define SRUN 2 /* Currently runnable. */
|
||||
#define SSLEEP 3 /* Sleeping on an address. */
|
||||
#define SSTOP 4 /* Process debugging or suspension. */
|
||||
#define SZOMB 5 /* Awaiting collection by parent. */
|
||||
|
||||
/* These flags are kept in extern_proc.p_flag. */
|
||||
#define P_ADVLOCK 0x00000001 /* Process may hold POSIX adv. lock */
|
||||
#define P_CONTROLT 0x00000002 /* Has a controlling terminal */
|
||||
#define P_LP64 0x00000004 /* Process is LP64 */
|
||||
#define P_NOCLDSTOP 0x00000008 /* No SIGCHLD when children stop */
|
||||
|
||||
#define P_PPWAIT 0x00000010 /* Parent waiting for chld exec/exit */
|
||||
#define P_PROFIL 0x00000020 /* Has started profiling */
|
||||
#define P_SELECT 0x00000040 /* Selecting; wakeup/waiting danger */
|
||||
#define P_CONTINUED 0x00000080 /* Process was stopped and continued */
|
||||
|
||||
#define P_SUGID 0x00000100 /* Has set privileges since last exec */
|
||||
#define P_SYSTEM 0x00000200 /* Sys proc: no sigs, stats or swap */
|
||||
#define P_TIMEOUT 0x00000400 /* Timing out during sleep */
|
||||
#define P_TRACED 0x00000800 /* Debugged process being traced */
|
||||
|
||||
#define P_DISABLE_ASLR 0x00001000 /* Disable address space layout randomization */
|
||||
#define P_WEXIT 0x00002000 /* Working on exiting */
|
||||
#define P_EXEC 0x00004000 /* Process called exec. */
|
||||
|
||||
/* Should be moved to machine-dependent areas. */
|
||||
#define P_OWEUPC 0x00008000 /* Owe process an addupc() call at next ast. */
|
||||
|
||||
#define P_AFFINITY 0x00010000 /* xxx */
|
||||
#define P_TRANSLATED 0x00020000 /* xxx */
|
||||
#define P_CLASSIC P_TRANSLATED /* xxx */
|
||||
|
||||
#define P_DELAYIDLESLEEP 0x00040000 /* Process is marked to delay idle sleep on disk IO */
|
||||
#define P_CHECKOPENEVT 0x00080000 /* check if a vnode has the OPENEVT flag set on open */
|
||||
|
||||
#define P_DEPENDENCY_CAPABLE 0x00100000 /* process is ok to call vfs_markdependency() */
|
||||
#define P_REBOOT 0x00200000 /* Process called reboot() */
|
||||
#define P_RESV6 0x00400000 /* used to be P_TBE */
|
||||
#define P_RESV7 0x00800000 /* (P_SIGEXC)signal exceptions */
|
||||
|
||||
#define P_THCWD 0x01000000 /* process has thread cwd */
|
||||
#define P_RESV9 0x02000000 /* (P_VFORK)process has vfork children */
|
||||
#define P_ADOPTPERSONA 0x04000000 /* process adopted a persona (used to be P_NOATTACH) */
|
||||
#define P_RESV11 0x08000000 /* (P_INVFORK) proc in vfork */
|
||||
|
||||
#define P_NOSHLIB 0x10000000 /* no shared libs are in use for proc */
|
||||
/* flag set on exec */
|
||||
#define P_FORCEQUOTA 0x20000000 /* Force quota for root */
|
||||
#define P_NOCLDWAIT 0x40000000 /* No zombies when chil procs exit */
|
||||
#define P_NOREMOTEHANG 0x80000000 /* Don't hang on remote FS ops */
|
||||
|
||||
#define P_INMEM 0 /* Obsolete: retained for compilation */
|
||||
#define P_NOSWAP 0 /* Obsolete: retained for compilation */
|
||||
#define P_PHYSIO 0 /* Obsolete: retained for compilation */
|
||||
#define P_FSTRACE 0 /* Obsolete: retained for compilation */
|
||||
#define P_SSTEP 0 /* Obsolete: retained for compilation */
|
||||
|
||||
#define P_DIRTY_TRACK 0x00000001 /* track dirty state */
|
||||
#define P_DIRTY_ALLOW_IDLE_EXIT 0x00000002 /* process can be idle-exited when clean */
|
||||
#define P_DIRTY_DEFER 0x00000004 /* defer initial opt-in to idle-exit */
|
||||
#define P_DIRTY 0x00000008 /* process is dirty */
|
||||
#define P_DIRTY_SHUTDOWN 0x00000010 /* process is dirty during shutdown */
|
||||
#define P_DIRTY_TERMINATED 0x00000020 /* process has been marked for termination */
|
||||
#define P_DIRTY_BUSY 0x00000040 /* serialization flag */
|
||||
#define P_DIRTY_MARKED 0x00000080 /* marked dirty previously */
|
||||
#define P_DIRTY_AGING_IN_PROGRESS 0x00000100 /* aging in one of the 'aging bands' */
|
||||
#define P_DIRTY_LAUNCH_IN_PROGRESS 0x00000200 /* launch is in progress */
|
||||
#define P_DIRTY_DEFER_ALWAYS 0x00000400 /* defer going to idle-exit after every dirty->clean transition.
|
||||
* For legacy jetsam policy only. This is the default with the other policies.*/
|
||||
|
||||
#define P_DIRTY_IS_DIRTY (P_DIRTY | P_DIRTY_SHUTDOWN)
|
||||
#define P_DIRTY_IDLE_EXIT_ENABLED (P_DIRTY_TRACK|P_DIRTY_ALLOW_IDLE_EXIT)
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* !_SYS_PROC_H_ */
|
||||
775
lib/libc/include/x86_64-macos-gnu/sys/sysctl.h
Normal file
775
lib/libc/include/x86_64-macos-gnu/sys/sysctl.h
Normal file
@@ -0,0 +1,775 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2019 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Mike Karels at Berkeley Software Design, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
/*
|
||||
* NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
|
||||
* support for mandatory and extensible security protections. This notice
|
||||
* is included in support of clause 2.2 (b) of the Apple Public License,
|
||||
* Version 2.0.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SYSCTL_H_
|
||||
#define _SYS_SYSCTL_H_
|
||||
|
||||
/*
|
||||
* These are for the eproc structure defined below.
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/ucred.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/vm.h>
|
||||
|
||||
|
||||
/*
|
||||
* Definitions for sysctl call. The sysctl call uses a hierarchical name
|
||||
* 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
|
||||
* component depends on its place in the hierarchy. The top-level and kern
|
||||
* identifiers are defined here, and other identifiers are defined in the
|
||||
* respective subsystem header files.
|
||||
*/
|
||||
|
||||
#define CTL_MAXNAME 12 /* largest number of components supported */
|
||||
|
||||
/*
|
||||
* Each subsystem defined by sysctl defines a list of variables
|
||||
* for that subsystem. Each name is either a node with further
|
||||
* levels defined below it, or it is a leaf of some particular
|
||||
* type given below. Each sysctl level defines a set of name/type
|
||||
* pairs to be used by sysctl(1) in manipulating the subsystem.
|
||||
*
|
||||
* When declaring new sysctl names, use the CTLFLAG_LOCKED flag in the
|
||||
* type to indicate that all necessary locking will be handled
|
||||
* within the sysctl.
|
||||
*
|
||||
* Any sysctl defined without CTLFLAG_LOCKED is considered legacy
|
||||
* and will be protected by a global mutex.
|
||||
*
|
||||
* Note: This is not optimal, so it is best to handle locking
|
||||
* yourself, if you are able to do so. A simple design
|
||||
* pattern for use to avoid in a single function known
|
||||
* to potentially be in the paging path ot doing a DMA
|
||||
* to physical memory in a user space process is:
|
||||
*
|
||||
* lock
|
||||
* perform operation vs. local buffer
|
||||
* unlock
|
||||
* SYSCTL_OUT(rey, local buffer, length)
|
||||
*
|
||||
* ...this assumes you are not using a deep call graph
|
||||
* or are unable to pass a local buffer address as a
|
||||
* parameter into your deep call graph.
|
||||
*
|
||||
* Note that very large user buffers can fail the wire
|
||||
* if to do so would require more physical pages than
|
||||
* are available (the caller will get an ENOMEM error,
|
||||
* see sysctl_mem_hold() for details).
|
||||
*/
|
||||
struct ctlname {
|
||||
char *ctl_name; /* subsystem name */
|
||||
int ctl_type; /* type of name */
|
||||
};
|
||||
|
||||
#define CTLTYPE 0xf /* Mask for the type */
|
||||
#define CTLTYPE_NODE 1 /* name is a node */
|
||||
#define CTLTYPE_INT 2 /* name describes an integer */
|
||||
#define CTLTYPE_STRING 3 /* name describes a string */
|
||||
#define CTLTYPE_QUAD 4 /* name describes a 64-bit number */
|
||||
#define CTLTYPE_OPAQUE 5 /* name describes a structure */
|
||||
#define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */
|
||||
|
||||
#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */
|
||||
#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */
|
||||
#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR)
|
||||
#define CTLFLAG_NOLOCK 0x20000000 /* XXX Don't Lock */
|
||||
#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */
|
||||
#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */
|
||||
#define CTLFLAG_MASKED 0x04000000 /* deprecated variable, do not display */
|
||||
#define CTLFLAG_NOAUTO 0x02000000 /* do not auto-register */
|
||||
#define CTLFLAG_KERN 0x01000000 /* valid inside the kernel */
|
||||
#define CTLFLAG_LOCKED 0x00800000 /* node will handle locking itself */
|
||||
#define CTLFLAG_OID2 0x00400000 /* struct sysctl_oid has version info */
|
||||
|
||||
/*
|
||||
* USE THIS instead of a hardwired number from the categories below
|
||||
* to get dynamically assigned sysctl entries using the linker-set
|
||||
* technology. This is the way nearly all new sysctl variables should
|
||||
* be implemented.
|
||||
*
|
||||
* e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
|
||||
*
|
||||
* Note that linker set technology will automatically register all nodes
|
||||
* declared like this on kernel initialization, UNLESS they are defined
|
||||
* in I/O-Kit. In this case, you have to call sysctl_register_oid()
|
||||
* manually - just like in a KEXT.
|
||||
*/
|
||||
#define OID_AUTO (-1)
|
||||
#define OID_AUTO_START 100 /* conventional */
|
||||
|
||||
|
||||
#define SYSCTL_DEF_ENABLED
|
||||
|
||||
#ifdef SYSCTL_DEF_ENABLED
|
||||
/*
|
||||
* Top-level identifiers
|
||||
*/
|
||||
#define CTL_UNSPEC 0 /* unused */
|
||||
#define CTL_KERN 1 /* "high kernel": proc, limits */
|
||||
#define CTL_VM 2 /* virtual memory */
|
||||
#define CTL_VFS 3 /* file system, mount type is next */
|
||||
#define CTL_NET 4 /* network, see socket.h */
|
||||
#define CTL_DEBUG 5 /* debugging parameters */
|
||||
#define CTL_HW 6 /* generic cpu/io */
|
||||
#define CTL_MACHDEP 7 /* machine dependent */
|
||||
#define CTL_USER 8 /* user-level */
|
||||
#define CTL_MAXID 9 /* number of valid top-level ids */
|
||||
|
||||
#define CTL_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "kern", CTLTYPE_NODE }, \
|
||||
{ "vm", CTLTYPE_NODE }, \
|
||||
{ "vfs", CTLTYPE_NODE }, \
|
||||
{ "net", CTLTYPE_NODE }, \
|
||||
{ "debug", CTLTYPE_NODE }, \
|
||||
{ "hw", CTLTYPE_NODE }, \
|
||||
{ "machdep", CTLTYPE_NODE }, \
|
||||
{ "user", CTLTYPE_NODE }, \
|
||||
}
|
||||
|
||||
/*
|
||||
* CTL_KERN identifiers
|
||||
*/
|
||||
#define KERN_OSTYPE 1 /* string: system version */
|
||||
#define KERN_OSRELEASE 2 /* string: system release */
|
||||
#define KERN_OSREV 3 /* int: system revision */
|
||||
#define KERN_VERSION 4 /* string: compile time info */
|
||||
#define KERN_MAXVNODES 5 /* int: max vnodes */
|
||||
#define KERN_MAXPROC 6 /* int: max processes */
|
||||
#define KERN_MAXFILES 7 /* int: max open files */
|
||||
#define KERN_ARGMAX 8 /* int: max arguments to exec */
|
||||
#define KERN_SECURELVL 9 /* int: system security level */
|
||||
#define KERN_HOSTNAME 10 /* string: hostname */
|
||||
#define KERN_HOSTID 11 /* int: host identifier */
|
||||
#define KERN_CLOCKRATE 12 /* struct: struct clockrate */
|
||||
#define KERN_VNODE 13 /* struct: vnode structures */
|
||||
#define KERN_PROC 14 /* struct: process entries */
|
||||
#define KERN_FILE 15 /* struct: file entries */
|
||||
#define KERN_PROF 16 /* node: kernel profiling info */
|
||||
#define KERN_POSIX1 17 /* int: POSIX.1 version */
|
||||
#define KERN_NGROUPS 18 /* int: # of supplemental group ids */
|
||||
#define KERN_JOB_CONTROL 19 /* int: is job control available */
|
||||
#define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */
|
||||
#define KERN_BOOTTIME 21 /* struct: time kernel was booted */
|
||||
#define KERN_NISDOMAINNAME 22 /* string: YP domain name */
|
||||
#define KERN_DOMAINNAME KERN_NISDOMAINNAME
|
||||
#define KERN_MAXPARTITIONS 23 /* int: number of partitions/disk */
|
||||
#define KERN_KDEBUG 24 /* int: kernel trace points */
|
||||
#define KERN_UPDATEINTERVAL 25 /* int: update process sleep time */
|
||||
#define KERN_OSRELDATE 26 /* int: OS release date */
|
||||
#define KERN_NTP_PLL 27 /* node: NTP PLL control */
|
||||
#define KERN_BOOTFILE 28 /* string: name of booted kernel */
|
||||
#define KERN_MAXFILESPERPROC 29 /* int: max open files per proc */
|
||||
#define KERN_MAXPROCPERUID 30 /* int: max processes per uid */
|
||||
#define KERN_DUMPDEV 31 /* dev_t: device to dump on */
|
||||
#define KERN_IPC 32 /* node: anything related to IPC */
|
||||
#define KERN_DUMMY 33 /* unused */
|
||||
#define KERN_PS_STRINGS 34 /* int: address of PS_STRINGS */
|
||||
#define KERN_USRSTACK32 35 /* int: address of USRSTACK */
|
||||
#define KERN_LOGSIGEXIT 36 /* int: do we log sigexit procs? */
|
||||
#define KERN_SYMFILE 37 /* string: kernel symbol filename */
|
||||
#define KERN_PROCARGS 38
|
||||
/* 39 was KERN_PCSAMPLES... now obsolete */
|
||||
#define KERN_NETBOOT 40 /* int: are we netbooted? 1=yes,0=no */
|
||||
/* 41 was KERN_PANICINFO : panic UI information (deprecated) */
|
||||
#define KERN_SYSV 42 /* node: System V IPC information */
|
||||
#define KERN_AFFINITY 43 /* xxx */
|
||||
#define KERN_TRANSLATE 44 /* xxx */
|
||||
#define KERN_CLASSIC KERN_TRANSLATE /* XXX backwards compat */
|
||||
#define KERN_EXEC 45 /* xxx */
|
||||
#define KERN_CLASSICHANDLER KERN_EXEC /* XXX backwards compatibility */
|
||||
#define KERN_AIOMAX 46 /* int: max aio requests */
|
||||
#define KERN_AIOPROCMAX 47 /* int: max aio requests per process */
|
||||
#define KERN_AIOTHREADS 48 /* int: max aio worker threads */
|
||||
#ifdef __APPLE_API_UNSTABLE
|
||||
#define KERN_PROCARGS2 49
|
||||
#endif /* __APPLE_API_UNSTABLE */
|
||||
#define KERN_COREFILE 50 /* string: corefile format string */
|
||||
#define KERN_COREDUMP 51 /* int: whether to coredump at all */
|
||||
#define KERN_SUGID_COREDUMP 52 /* int: whether to dump SUGID cores */
|
||||
#define KERN_PROCDELAYTERM 53 /* int: set/reset current proc for delayed termination during shutdown */
|
||||
#define KERN_SHREG_PRIVATIZABLE 54 /* int: can shared regions be privatized ? */
|
||||
/* 55 was KERN_PROC_LOW_PRI_IO... now deprecated */
|
||||
#define KERN_LOW_PRI_WINDOW 56 /* int: set/reset throttle window - milliseconds */
|
||||
#define KERN_LOW_PRI_DELAY 57 /* int: set/reset throttle delay - milliseconds */
|
||||
#define KERN_POSIX 58 /* node: posix tunables */
|
||||
#define KERN_USRSTACK64 59 /* LP64 user stack query */
|
||||
#define KERN_NX_PROTECTION 60 /* int: whether no-execute protection is enabled */
|
||||
#define KERN_TFP 61 /* Task for pid settings */
|
||||
#define KERN_PROCNAME 62 /* setup process program name(2*MAXCOMLEN) */
|
||||
#define KERN_THALTSTACK 63 /* for compat with older x86 and does nothing */
|
||||
#define KERN_SPECULATIVE_READS 64 /* int: whether speculative reads are disabled */
|
||||
#define KERN_OSVERSION 65 /* for build number i.e. 9A127 */
|
||||
#define KERN_SAFEBOOT 66 /* are we booted safe? */
|
||||
/* 67 was KERN_LCTX (login context) */
|
||||
#define KERN_RAGEVNODE 68
|
||||
#define KERN_TTY 69 /* node: tty settings */
|
||||
#define KERN_CHECKOPENEVT 70 /* spi: check the VOPENEVT flag on vnodes at open time */
|
||||
#define KERN_THREADNAME 71 /* set/get thread name */
|
||||
#define KERN_MAXID 72 /* number of valid kern ids */
|
||||
/*
|
||||
* Don't add any more sysctls like this. Instead, use the SYSCTL_*() macros
|
||||
* and OID_AUTO. This will have the added benefit of not having to recompile
|
||||
* sysctl(8) to pick up your changes.
|
||||
*/
|
||||
|
||||
|
||||
#if defined(__LP64__)
|
||||
#define KERN_USRSTACK KERN_USRSTACK64
|
||||
#else
|
||||
#define KERN_USRSTACK KERN_USRSTACK32
|
||||
#endif
|
||||
|
||||
|
||||
/* KERN_RAGEVNODE types */
|
||||
#define KERN_RAGE_PROC 1
|
||||
#define KERN_RAGE_THREAD 2
|
||||
#define KERN_UNRAGE_PROC 3
|
||||
#define KERN_UNRAGE_THREAD 4
|
||||
|
||||
/* KERN_OPENEVT types */
|
||||
#define KERN_OPENEVT_PROC 1
|
||||
#define KERN_UNOPENEVT_PROC 2
|
||||
|
||||
/* KERN_TFP types */
|
||||
#define KERN_TFP_POLICY 1
|
||||
|
||||
/* KERN_TFP_POLICY values . All policies allow task port for self */
|
||||
#define KERN_TFP_POLICY_DENY 0 /* Deny Mode: None allowed except privileged */
|
||||
#define KERN_TFP_POLICY_DEFAULT 2 /* Default Mode: related ones allowed and upcall authentication */
|
||||
|
||||
/* KERN_KDEBUG types */
|
||||
#define KERN_KDEFLAGS 1
|
||||
#define KERN_KDDFLAGS 2
|
||||
#define KERN_KDENABLE 3
|
||||
#define KERN_KDSETBUF 4
|
||||
#define KERN_KDGETBUF 5
|
||||
#define KERN_KDSETUP 6
|
||||
#define KERN_KDREMOVE 7
|
||||
#define KERN_KDSETREG 8
|
||||
#define KERN_KDGETREG 9
|
||||
#define KERN_KDREADTR 10
|
||||
#define KERN_KDPIDTR 11
|
||||
#define KERN_KDTHRMAP 12
|
||||
/* Don't use 13 as it is overloaded with KERN_VNODE */
|
||||
#define KERN_KDPIDEX 14
|
||||
#define KERN_KDSETRTCDEC 15 /* obsolete */
|
||||
#define KERN_KDGETENTROPY 16 /* obsolete */
|
||||
#define KERN_KDWRITETR 17
|
||||
#define KERN_KDWRITEMAP 18
|
||||
#define KERN_KDTEST 19
|
||||
/* 20 unused */
|
||||
#define KERN_KDREADCURTHRMAP 21
|
||||
#define KERN_KDSET_TYPEFILTER 22
|
||||
#define KERN_KDBUFWAIT 23
|
||||
#define KERN_KDCPUMAP 24
|
||||
/* 25 - 26 unused */
|
||||
#define KERN_KDWRITEMAP_V3 27
|
||||
#define KERN_KDWRITETR_V3 28
|
||||
|
||||
#define CTL_KERN_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "ostype", CTLTYPE_STRING }, \
|
||||
{ "osrelease", CTLTYPE_STRING }, \
|
||||
{ "osrevision", CTLTYPE_INT }, \
|
||||
{ "version", CTLTYPE_STRING }, \
|
||||
{ "maxvnodes", CTLTYPE_INT }, \
|
||||
{ "maxproc", CTLTYPE_INT }, \
|
||||
{ "maxfiles", CTLTYPE_INT }, \
|
||||
{ "argmax", CTLTYPE_INT }, \
|
||||
{ "securelevel", CTLTYPE_INT }, \
|
||||
{ "hostname", CTLTYPE_STRING }, \
|
||||
{ "hostid", CTLTYPE_INT }, \
|
||||
{ "clockrate", CTLTYPE_STRUCT }, \
|
||||
{ "vnode", CTLTYPE_STRUCT }, \
|
||||
{ "proc", CTLTYPE_STRUCT }, \
|
||||
{ "file", CTLTYPE_STRUCT }, \
|
||||
{ "profiling", CTLTYPE_NODE }, \
|
||||
{ "posix1version", CTLTYPE_INT }, \
|
||||
{ "ngroups", CTLTYPE_INT }, \
|
||||
{ "job_control", CTLTYPE_INT }, \
|
||||
{ "saved_ids", CTLTYPE_INT }, \
|
||||
{ "boottime", CTLTYPE_STRUCT }, \
|
||||
{ "nisdomainname", CTLTYPE_STRING }, \
|
||||
{ "maxpartitions", CTLTYPE_INT }, \
|
||||
{ "kdebug", CTLTYPE_INT }, \
|
||||
{ "update", CTLTYPE_INT }, \
|
||||
{ "osreldate", CTLTYPE_INT }, \
|
||||
{ "ntp_pll", CTLTYPE_NODE }, \
|
||||
{ "bootfile", CTLTYPE_STRING }, \
|
||||
{ "maxfilesperproc", CTLTYPE_INT }, \
|
||||
{ "maxprocperuid", CTLTYPE_INT }, \
|
||||
{ "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \
|
||||
{ "ipc", CTLTYPE_NODE }, \
|
||||
{ "dummy", CTLTYPE_INT }, \
|
||||
{ "dummy", CTLTYPE_INT }, \
|
||||
{ "usrstack", CTLTYPE_INT }, \
|
||||
{ "logsigexit", CTLTYPE_INT }, \
|
||||
{ "symfile",CTLTYPE_STRING },\
|
||||
{ "procargs",CTLTYPE_STRUCT },\
|
||||
{ "dummy", CTLTYPE_INT }, /* deprecated pcsamples */ \
|
||||
{ "netboot", CTLTYPE_INT }, \
|
||||
{ "dummy", CTLTYPE_INT }, /* deprecated: panicinfo */ \
|
||||
{ "sysv", CTLTYPE_NODE }, \
|
||||
{ "dummy", CTLTYPE_INT }, \
|
||||
{ "dummy", CTLTYPE_INT }, \
|
||||
{ "exec", CTLTYPE_NODE }, \
|
||||
{ "aiomax", CTLTYPE_INT }, \
|
||||
{ "aioprocmax", CTLTYPE_INT }, \
|
||||
{ "aiothreads", CTLTYPE_INT }, \
|
||||
{ "procargs2",CTLTYPE_STRUCT }, \
|
||||
{ "corefile",CTLTYPE_STRING }, \
|
||||
{ "coredump", CTLTYPE_INT }, \
|
||||
{ "sugid_coredump", CTLTYPE_INT }, \
|
||||
{ "delayterm", CTLTYPE_INT }, \
|
||||
{ "shreg_private", CTLTYPE_INT }, \
|
||||
{ "proc_low_pri_io", CTLTYPE_INT }, \
|
||||
{ "low_pri_window", CTLTYPE_INT }, \
|
||||
{ "low_pri_delay", CTLTYPE_INT }, \
|
||||
{ "posix", CTLTYPE_NODE }, \
|
||||
{ "usrstack64", CTLTYPE_QUAD }, \
|
||||
{ "nx", CTLTYPE_INT }, \
|
||||
{ "tfp", CTLTYPE_NODE }, \
|
||||
{ "procname", CTLTYPE_STRING }, \
|
||||
{ "threadsigaltstack", CTLTYPE_INT }, \
|
||||
{ "speculative_reads_disabled", CTLTYPE_INT }, \
|
||||
{ "osversion", CTLTYPE_STRING }, \
|
||||
{ "safeboot", CTLTYPE_INT }, \
|
||||
{ "dummy", CTLTYPE_INT }, /* deprecated: lctx */ \
|
||||
{ "rage_vnode", CTLTYPE_INT }, \
|
||||
{ "tty", CTLTYPE_NODE }, \
|
||||
{ "check_openevt", CTLTYPE_INT }, \
|
||||
{ "thread_name", CTLTYPE_STRING } \
|
||||
}
|
||||
|
||||
/*
|
||||
* CTL_VFS identifiers
|
||||
*/
|
||||
#define CTL_VFS_NAMES { \
|
||||
{ "vfsconf", CTLTYPE_STRUCT } \
|
||||
}
|
||||
|
||||
/*
|
||||
* KERN_PROC subtypes
|
||||
*/
|
||||
#define KERN_PROC_ALL 0 /* everything */
|
||||
#define KERN_PROC_PID 1 /* by process id */
|
||||
#define KERN_PROC_PGRP 2 /* by process group id */
|
||||
#define KERN_PROC_SESSION 3 /* by session of pid */
|
||||
#define KERN_PROC_TTY 4 /* by controlling tty */
|
||||
#define KERN_PROC_UID 5 /* by effective uid */
|
||||
#define KERN_PROC_RUID 6 /* by real uid */
|
||||
#define KERN_PROC_LCID 7 /* by login context id */
|
||||
|
||||
/*
|
||||
* KERN_VFSNSPACE subtypes
|
||||
*/
|
||||
#define KERN_VFSNSPACE_HANDLE_PROC 1
|
||||
#define KERN_VFSNSPACE_UNHANDLE_PROC 2
|
||||
|
||||
/*
|
||||
* KERN_PROC subtype ops return arrays of augmented proc structures:
|
||||
*/
|
||||
|
||||
struct _pcred {
|
||||
char pc_lock[72]; /* opaque content */
|
||||
struct ucred *pc_ucred; /* Current credentials. */
|
||||
uid_t p_ruid; /* Real user id. */
|
||||
uid_t p_svuid; /* Saved effective user id. */
|
||||
gid_t p_rgid; /* Real group id. */
|
||||
gid_t p_svgid; /* Saved effective group id. */
|
||||
int p_refcnt; /* Number of references. */
|
||||
};
|
||||
|
||||
struct _ucred {
|
||||
int32_t cr_ref; /* reference count */
|
||||
uid_t cr_uid; /* effective user id */
|
||||
short cr_ngroups; /* number of groups */
|
||||
gid_t cr_groups[NGROUPS]; /* groups */
|
||||
};
|
||||
|
||||
struct kinfo_proc {
|
||||
struct extern_proc kp_proc; /* proc structure */
|
||||
struct eproc {
|
||||
struct proc *e_paddr; /* address of proc */
|
||||
struct session *e_sess; /* session pointer */
|
||||
struct _pcred e_pcred; /* process credentials */
|
||||
struct _ucred e_ucred; /* current credentials */
|
||||
struct vmspace e_vm; /* address space */
|
||||
pid_t e_ppid; /* parent process id */
|
||||
pid_t e_pgid; /* process group id */
|
||||
short e_jobc; /* job control counter */
|
||||
dev_t e_tdev; /* controlling tty dev */
|
||||
pid_t e_tpgid; /* tty process group id */
|
||||
struct session *e_tsess; /* tty session pointer */
|
||||
#define WMESGLEN 7
|
||||
char e_wmesg[WMESGLEN + 1]; /* wchan message */
|
||||
segsz_t e_xsize; /* text size */
|
||||
short e_xrssize; /* text rss */
|
||||
short e_xccount; /* text references */
|
||||
short e_xswrss;
|
||||
int32_t e_flag;
|
||||
#define EPROC_CTTY 0x01 /* controlling tty vnode active */
|
||||
#define EPROC_SLEADER 0x02 /* session leader */
|
||||
#define COMAPT_MAXLOGNAME 12
|
||||
char e_login[COMAPT_MAXLOGNAME]; /* short setlogin() name */
|
||||
int32_t e_spare[4];
|
||||
} kp_eproc;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* KERN_IPC identifiers
|
||||
*/
|
||||
#define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */
|
||||
#define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */
|
||||
#define KIPC_SOMAXCONN 3 /* int: max length of connection q */
|
||||
#define KIPC_MAX_LINKHDR 4 /* int: max length of link header */
|
||||
#define KIPC_MAX_PROTOHDR 5 /* int: max length of network header */
|
||||
#define KIPC_MAX_HDR 6 /* int: max total length of headers */
|
||||
#define KIPC_MAX_DATALEN 7 /* int: max length of data? */
|
||||
#define KIPC_MBSTAT 8 /* struct: mbuf usage statistics */
|
||||
#define KIPC_NMBCLUSTERS 9 /* int: maximum mbuf clusters */
|
||||
#define KIPC_SOQLIMITCOMPAT 10 /* int: socket queue limit */
|
||||
|
||||
/*
|
||||
* CTL_VM identifiers
|
||||
*/
|
||||
#define VM_METER 1 /* struct vmmeter */
|
||||
#define VM_LOADAVG 2 /* struct loadavg */
|
||||
/*
|
||||
* Note: "3" was skipped sometime ago and should probably remain unused
|
||||
* to avoid any new entry from being accepted by older kernels...
|
||||
*/
|
||||
#define VM_MACHFACTOR 4 /* struct loadavg with mach factor*/
|
||||
#define VM_SWAPUSAGE 5 /* total swap usage */
|
||||
#define VM_MAXID 6 /* number of valid vm ids */
|
||||
|
||||
#define CTL_VM_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "vmmeter", CTLTYPE_STRUCT }, \
|
||||
{ "loadavg", CTLTYPE_STRUCT }, \
|
||||
{ 0, 0 }, /* placeholder for "3" (see comment above) */ \
|
||||
{ "dummy", CTLTYPE_INT }, \
|
||||
{ "swapusage", CTLTYPE_STRUCT } \
|
||||
}
|
||||
|
||||
struct xsw_usage {
|
||||
u_int64_t xsu_total;
|
||||
u_int64_t xsu_avail;
|
||||
u_int64_t xsu_used;
|
||||
u_int32_t xsu_pagesize;
|
||||
boolean_t xsu_encrypted;
|
||||
};
|
||||
|
||||
#ifdef __APPLE_API_PRIVATE
|
||||
/* Load average structure. Use of fixpt_t assume <sys/types.h> in scope. */
|
||||
/* XXX perhaps we should protect fixpt_t, and define it here (or discard it) */
|
||||
struct loadavg {
|
||||
fixpt_t ldavg[3];
|
||||
long fscale;
|
||||
};
|
||||
extern struct loadavg averunnable;
|
||||
#define LSCALE 1000 /* scaling for "fixed point" arithmetic */
|
||||
|
||||
#endif /* __APPLE_API_PRIVATE */
|
||||
|
||||
|
||||
/*
|
||||
* CTL_HW identifiers
|
||||
*/
|
||||
#define HW_MACHINE 1 /* string: machine class */
|
||||
#define HW_MODEL 2 /* string: specific machine model */
|
||||
#define HW_NCPU 3 /* int: number of cpus */
|
||||
#define HW_BYTEORDER 4 /* int: machine byte order */
|
||||
#define HW_PHYSMEM 5 /* int: total memory */
|
||||
#define HW_USERMEM 6 /* int: non-kernel memory */
|
||||
#define HW_PAGESIZE 7 /* int: software page size */
|
||||
#define HW_DISKNAMES 8 /* strings: disk drive names */
|
||||
#define HW_DISKSTATS 9 /* struct: diskstats[] */
|
||||
#define HW_EPOCH 10 /* int: 0 for Legacy, else NewWorld */
|
||||
#define HW_FLOATINGPT 11 /* int: has HW floating point? */
|
||||
#define HW_MACHINE_ARCH 12 /* string: machine architecture */
|
||||
#define HW_VECTORUNIT 13 /* int: has HW vector unit? */
|
||||
#define HW_BUS_FREQ 14 /* int: Bus Frequency */
|
||||
#define HW_CPU_FREQ 15 /* int: CPU Frequency */
|
||||
#define HW_CACHELINE 16 /* int: Cache Line Size in Bytes */
|
||||
#define HW_L1ICACHESIZE 17 /* int: L1 I Cache Size in Bytes */
|
||||
#define HW_L1DCACHESIZE 18 /* int: L1 D Cache Size in Bytes */
|
||||
#define HW_L2SETTINGS 19 /* int: L2 Cache Settings */
|
||||
#define HW_L2CACHESIZE 20 /* int: L2 Cache Size in Bytes */
|
||||
#define HW_L3SETTINGS 21 /* int: L3 Cache Settings */
|
||||
#define HW_L3CACHESIZE 22 /* int: L3 Cache Size in Bytes */
|
||||
#define HW_TB_FREQ 23 /* int: Bus Frequency */
|
||||
#define HW_MEMSIZE 24 /* uint64_t: physical ram size */
|
||||
#define HW_AVAILCPU 25 /* int: number of available CPUs */
|
||||
#define HW_MAXID 26 /* number of valid hw ids */
|
||||
|
||||
#define CTL_HW_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "machine", CTLTYPE_STRING }, \
|
||||
{ "model", CTLTYPE_STRING }, \
|
||||
{ "ncpu", CTLTYPE_INT }, \
|
||||
{ "byteorder", CTLTYPE_INT }, \
|
||||
{ "physmem", CTLTYPE_INT }, \
|
||||
{ "usermem", CTLTYPE_INT }, \
|
||||
{ "pagesize", CTLTYPE_INT }, \
|
||||
{ "disknames", CTLTYPE_STRUCT }, \
|
||||
{ "diskstats", CTLTYPE_STRUCT }, \
|
||||
{ "epoch", CTLTYPE_INT }, \
|
||||
{ "floatingpoint", CTLTYPE_INT }, \
|
||||
{ "machinearch", CTLTYPE_STRING }, \
|
||||
{ "vectorunit", CTLTYPE_INT }, \
|
||||
{ "busfrequency", CTLTYPE_INT }, \
|
||||
{ "cpufrequency", CTLTYPE_INT }, \
|
||||
{ "cachelinesize", CTLTYPE_INT }, \
|
||||
{ "l1icachesize", CTLTYPE_INT }, \
|
||||
{ "l1dcachesize", CTLTYPE_INT }, \
|
||||
{ "l2settings", CTLTYPE_INT }, \
|
||||
{ "l2cachesize", CTLTYPE_INT }, \
|
||||
{ "l3settings", CTLTYPE_INT }, \
|
||||
{ "l3cachesize", CTLTYPE_INT }, \
|
||||
{ "tbfrequency", CTLTYPE_INT }, \
|
||||
{ "memsize", CTLTYPE_QUAD }, \
|
||||
{ "availcpu", CTLTYPE_INT } \
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX This information should be moved to the man page.
|
||||
*
|
||||
* These are the support HW selectors for sysctlbyname. Parameters that are byte counts or frequencies are 64 bit numbers.
|
||||
* All other parameters are 32 bit numbers.
|
||||
*
|
||||
* hw.memsize - The number of bytes of physical memory in the system.
|
||||
*
|
||||
* hw.ncpu - The maximum number of processors that could be available this boot.
|
||||
* Use this value for sizing of static per processor arrays; i.e. processor load statistics.
|
||||
*
|
||||
* hw.activecpu - The number of processors currently available for executing threads.
|
||||
* Use this number to determine the number threads to create in SMP aware applications.
|
||||
* This number can change when power management modes are changed.
|
||||
*
|
||||
* hw.physicalcpu - The number of physical processors available in the current power management mode.
|
||||
* hw.physicalcpu_max - The maximum number of physical processors that could be available this boot
|
||||
*
|
||||
* hw.logicalcpu - The number of logical processors available in the current power management mode.
|
||||
* hw.logicalcpu_max - The maximum number of logical processors that could be available this boot
|
||||
*
|
||||
* hw.tbfrequency - This gives the time base frequency used by the OS and is the basis of all timing services.
|
||||
* In general is is better to use mach's or higher level timing services, but this value
|
||||
* is needed to convert the PPC Time Base registers to real time.
|
||||
*
|
||||
* hw.cpufrequency - These values provide the current, min and max cpu frequency. The min and max are for
|
||||
* hw.cpufrequency_max - all power management modes. The current frequency is the max frequency in the current mode.
|
||||
* hw.cpufrequency_min - All frequencies are in Hz.
|
||||
*
|
||||
* hw.busfrequency - These values provide the current, min and max bus frequency. The min and max are for
|
||||
* hw.busfrequency_max - all power management modes. The current frequency is the max frequency in the current mode.
|
||||
* hw.busfrequency_min - All frequencies are in Hz.
|
||||
*
|
||||
* hw.cputype - These values provide the mach-o cpu type and subtype. A complete list is in <mach/machine.h>
|
||||
* hw.cpusubtype - These values should be used to determine what processor family the running cpu is from so that
|
||||
* the best binary can be chosen, or the best dynamic code generated. They should not be used
|
||||
* to determine if a given processor feature is available.
|
||||
* hw.cputhreadtype - This value will be present if the processor supports threads. Like hw.cpusubtype this selector
|
||||
* should not be used to infer features, and only used to name the processors thread architecture.
|
||||
* The values are defined in <mach/machine.h>
|
||||
*
|
||||
* hw.byteorder - Gives the byte order of the processor. 4321 for big endian, 1234 for little.
|
||||
*
|
||||
* hw.pagesize - Gives the size in bytes of the pages used by the processor and VM system.
|
||||
*
|
||||
* hw.cachelinesize - Gives the size in bytes of the processor's cache lines.
|
||||
* This value should be use to control the strides of loops that use cache control instructions
|
||||
* like dcbz, dcbt or dcbst.
|
||||
*
|
||||
* hw.l1dcachesize - These values provide the size in bytes of the L1, L2 and L3 caches. If a cache is not present
|
||||
* hw.l1icachesize - then the selector will return and error.
|
||||
* hw.l2cachesize -
|
||||
* hw.l3cachesize -
|
||||
*
|
||||
* hw.packages - Gives the number of processor packages.
|
||||
*
|
||||
* These are the selectors for optional processor features for specific processors. Selectors that return errors are not support
|
||||
* on the system. Supported features will return 1 if they are recommended or 0 if they are supported but are not expected to help .
|
||||
* performance. Future versions of these selectors may return larger values as necessary so it is best to test for non zero.
|
||||
*
|
||||
* For PowerPC:
|
||||
*
|
||||
* hw.optional.floatingpoint - Floating Point Instructions
|
||||
* hw.optional.altivec - AltiVec Instructions
|
||||
* hw.optional.graphicsops - Graphics Operations
|
||||
* hw.optional.64bitops - 64-bit Instructions
|
||||
* hw.optional.fsqrt - HW Floating Point Square Root Instruction
|
||||
* hw.optional.stfiwx - Store Floating Point as Integer Word Indexed Instructions
|
||||
* hw.optional.dcba - Data Cache Block Allocate Instruction
|
||||
* hw.optional.datastreams - Data Streams Instructions
|
||||
* hw.optional.dcbtstreams - Data Cache Block Touch Steams Instruction Form
|
||||
*
|
||||
* For x86 Architecture:
|
||||
*
|
||||
* hw.optional.floatingpoint - Floating Point Instructions
|
||||
* hw.optional.mmx - Original MMX vector instructions
|
||||
* hw.optional.sse - Streaming SIMD Extensions
|
||||
* hw.optional.sse2 - Streaming SIMD Extensions 2
|
||||
* hw.optional.sse3 - Streaming SIMD Extensions 3
|
||||
* hw.optional.supplementalsse3 - Supplemental Streaming SIMD Extensions 3
|
||||
* hw.optional.x86_64 - 64-bit support
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* CTL_USER definitions
|
||||
*/
|
||||
#define USER_CS_PATH 1 /* string: _CS_PATH */
|
||||
#define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */
|
||||
#define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */
|
||||
#define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */
|
||||
#define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */
|
||||
#define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */
|
||||
#define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */
|
||||
#define USER_LINE_MAX 8 /* int: LINE_MAX */
|
||||
#define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */
|
||||
#define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */
|
||||
#define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */
|
||||
#define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */
|
||||
#define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */
|
||||
#define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */
|
||||
#define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */
|
||||
#define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */
|
||||
#define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */
|
||||
#define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */
|
||||
#define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */
|
||||
#define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */
|
||||
#define USER_MAXID 21 /* number of valid user ids */
|
||||
|
||||
#define CTL_USER_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "cs_path", CTLTYPE_STRING }, \
|
||||
{ "bc_base_max", CTLTYPE_INT }, \
|
||||
{ "bc_dim_max", CTLTYPE_INT }, \
|
||||
{ "bc_scale_max", CTLTYPE_INT }, \
|
||||
{ "bc_string_max", CTLTYPE_INT }, \
|
||||
{ "coll_weights_max", CTLTYPE_INT }, \
|
||||
{ "expr_nest_max", CTLTYPE_INT }, \
|
||||
{ "line_max", CTLTYPE_INT }, \
|
||||
{ "re_dup_max", CTLTYPE_INT }, \
|
||||
{ "posix2_version", CTLTYPE_INT }, \
|
||||
{ "posix2_c_bind", CTLTYPE_INT }, \
|
||||
{ "posix2_c_dev", CTLTYPE_INT }, \
|
||||
{ "posix2_char_term", CTLTYPE_INT }, \
|
||||
{ "posix2_fort_dev", CTLTYPE_INT }, \
|
||||
{ "posix2_fort_run", CTLTYPE_INT }, \
|
||||
{ "posix2_localedef", CTLTYPE_INT }, \
|
||||
{ "posix2_sw_dev", CTLTYPE_INT }, \
|
||||
{ "posix2_upe", CTLTYPE_INT }, \
|
||||
{ "stream_max", CTLTYPE_INT }, \
|
||||
{ "tzname_max", CTLTYPE_INT } \
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* CTL_DEBUG definitions
|
||||
*
|
||||
* Second level identifier specifies which debug variable.
|
||||
* Third level identifier specifies which stucture component.
|
||||
*/
|
||||
#define CTL_DEBUG_NAME 0 /* string: variable name */
|
||||
#define CTL_DEBUG_VALUE 1 /* int: variable value */
|
||||
#define CTL_DEBUG_MAXID 20
|
||||
|
||||
|
||||
#if (CTL_MAXID != 9) || (KERN_MAXID != 72) || (VM_MAXID != 6) || (HW_MAXID != 26) || (USER_MAXID != 21) || (CTL_DEBUG_MAXID != 20)
|
||||
#error Use the SYSCTL_*() macros and OID_AUTO instead!
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
int sysctl(int *, u_int, void *, size_t *, void *, size_t);
|
||||
int sysctlbyname(const char *, void *, size_t *, void *, size_t);
|
||||
int sysctlnametomib(const char *, int *, size_t *);
|
||||
__END_DECLS
|
||||
|
||||
|
||||
|
||||
#endif /* SYSCTL_DEF_ENABLED */
|
||||
|
||||
|
||||
#endif /* !_SYS_SYSCTL_H_ */
|
||||
116
lib/libc/include/x86_64-macos-gnu/sys/ucred.h
Normal file
116
lib/libc/include/x86_64-macos-gnu/sys/ucred.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ucred.h 8.4 (Berkeley) 1/9/95
|
||||
*/
|
||||
/*
|
||||
* NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
|
||||
* support for mandatory and extensible security protections. This notice
|
||||
* is included in support of clause 2.2 (b) of the Apple Public License,
|
||||
* Version 2.0.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_UCRED_H_
|
||||
#define _SYS_UCRED_H_
|
||||
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/param.h>
|
||||
#include <bsm/audit.h>
|
||||
|
||||
struct label;
|
||||
|
||||
#ifdef __APPLE_API_UNSTABLE
|
||||
struct ucred;
|
||||
struct posix_cred;
|
||||
|
||||
#ifndef _KAUTH_CRED_T
|
||||
#define _KAUTH_CRED_T
|
||||
typedef struct ucred *kauth_cred_t;
|
||||
typedef struct posix_cred *posix_cred_t;
|
||||
#endif /* !_KAUTH_CRED_T */
|
||||
|
||||
/*
|
||||
* Credential flags that can be set on a credential
|
||||
*/
|
||||
#define CRF_NOMEMBERD 0x00000001 /* memberd opt out by setgroups() */
|
||||
#define CRF_MAC_ENFORCE 0x00000002 /* force entry through MAC Framework */
|
||||
/* also forces credential cache miss */
|
||||
|
||||
/*
|
||||
* This is the external representation of struct ucred.
|
||||
*/
|
||||
struct xucred {
|
||||
u_int cr_version; /* structure layout version */
|
||||
uid_t cr_uid; /* effective user id */
|
||||
short cr_ngroups; /* number of advisory groups */
|
||||
gid_t cr_groups[NGROUPS]; /* advisory group list */
|
||||
};
|
||||
#define XUCRED_VERSION 0
|
||||
|
||||
#define cr_gid cr_groups[0]
|
||||
#define NOCRED ((kauth_cred_t )0) /* no credential available */
|
||||
#define FSCRED ((kauth_cred_t )-1) /* filesystem credential */
|
||||
|
||||
#define IS_VALID_CRED(_cr) ((_cr) != NOCRED && (_cr) != FSCRED)
|
||||
|
||||
#endif /* __APPLE_API_UNSTABLE */
|
||||
|
||||
#endif /* !_SYS_UCRED_H_ */
|
||||
89
lib/libc/include/x86_64-macos-gnu/sys/vm.h
Normal file
89
lib/libc/include/x86_64-macos-gnu/sys/vm.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vm.h 8.5 (Berkeley) 5/11/95
|
||||
*/
|
||||
/* HISTORY
|
||||
* 05-Jun-95 Mac Gillon (mgillon) at NeXT
|
||||
* 4.4 code uses this file to import MACH API
|
||||
*/
|
||||
|
||||
#ifndef _SYS_VM_H
|
||||
#define _SYS_VM_H
|
||||
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
|
||||
#include <sys/_types/_caddr_t.h> /* caddr_t */
|
||||
#include <sys/_types/_int32_t.h> /* int32_t */
|
||||
|
||||
/* just to keep kinfo_proc happy */
|
||||
/* NOTE: Pointer fields are size variant for LP64 */
|
||||
struct vmspace {
|
||||
int32_t dummy;
|
||||
caddr_t dummy2;
|
||||
int32_t dummy3[5];
|
||||
caddr_t dummy4[3];
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* _SYS_VM_H */
|
||||
Reference in New Issue
Block a user