Changeset View
Changeset View
Standalone View
Standalone View
head/sys/sys/user.h
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
* platforms after you have added new variables. Note that if you change | * platforms after you have added new variables. Note that if you change | ||||
* the value of KINFO_PROC_SIZE, then many userland programs will stop | * the value of KINFO_PROC_SIZE, then many userland programs will stop | ||||
* working until they are recompiled! | * working until they are recompiled! | ||||
* | * | ||||
* Once you have added the new field, you will need to add code to initialize | * Once you have added the new field, you will need to add code to initialize | ||||
* it in two places: function fill_kinfo_proc in sys/kern/kern_proc.c and | * it in two places: function fill_kinfo_proc in sys/kern/kern_proc.c and | ||||
* function kvm_proclist in lib/libkvm/kvm_proc.c . | * function kvm_proclist in lib/libkvm/kvm_proc.c . | ||||
*/ | */ | ||||
#define KI_NSPARE_INT 4 | #define KI_NSPARE_INT 2 | ||||
#define KI_NSPARE_LONG 12 | #define KI_NSPARE_LONG 12 | ||||
#define KI_NSPARE_PTR 6 | #define KI_NSPARE_PTR 6 | ||||
#ifndef _KERNEL | #ifndef _KERNEL | ||||
#ifndef KINFO_PROC_SIZE | #ifndef KINFO_PROC_SIZE | ||||
#error "Unknown architecture" | #error "Unknown architecture" | ||||
#endif | #endif | ||||
#endif /* !_KERNEL */ | #endif /* !_KERNEL */ | ||||
Show All 34 Lines | struct kinfo_proc { | ||||
pid_t ki_pid; /* Process identifier */ | pid_t ki_pid; /* Process identifier */ | ||||
pid_t ki_ppid; /* parent process id */ | pid_t ki_ppid; /* parent process id */ | ||||
pid_t ki_pgid; /* process group id */ | pid_t ki_pgid; /* process group id */ | ||||
pid_t ki_tpgid; /* tty process group id */ | pid_t ki_tpgid; /* tty process group id */ | ||||
pid_t ki_sid; /* Process session ID */ | pid_t ki_sid; /* Process session ID */ | ||||
pid_t ki_tsid; /* Terminal session ID */ | pid_t ki_tsid; /* Terminal session ID */ | ||||
short ki_jobc; /* job control counter */ | short ki_jobc; /* job control counter */ | ||||
short ki_spare_short1; /* unused (just here for alignment) */ | short ki_spare_short1; /* unused (just here for alignment) */ | ||||
dev_t ki_tdev; /* controlling tty dev */ | uint32_t ki_tdev_freebsd11; /* controlling tty dev */ | ||||
sigset_t ki_siglist; /* Signals arrived but not delivered */ | sigset_t ki_siglist; /* Signals arrived but not delivered */ | ||||
sigset_t ki_sigmask; /* Current signal mask */ | sigset_t ki_sigmask; /* Current signal mask */ | ||||
sigset_t ki_sigignore; /* Signals being ignored */ | sigset_t ki_sigignore; /* Signals being ignored */ | ||||
sigset_t ki_sigcatch; /* Signals being caught by user */ | sigset_t ki_sigcatch; /* Signals being caught by user */ | ||||
uid_t ki_uid; /* effective user id */ | uid_t ki_uid; /* effective user id */ | ||||
uid_t ki_ruid; /* Real user id */ | uid_t ki_ruid; /* Real user id */ | ||||
uid_t ki_svuid; /* Saved effective user id */ | uid_t ki_svuid; /* Saved effective user id */ | ||||
gid_t ki_rgid; /* Real group id */ | gid_t ki_rgid; /* Real group id */ | ||||
Show All 36 Lines | struct kinfo_proc { | ||||
char ki_moretdname[MAXCOMLEN-TDNAMLEN+1]; /* more thread name */ | char ki_moretdname[MAXCOMLEN-TDNAMLEN+1]; /* more thread name */ | ||||
/* | /* | ||||
* When adding new variables, take space for char-strings from the | * When adding new variables, take space for char-strings from the | ||||
* front of ki_sparestrings, and ints from the end of ki_spareints. | * front of ki_sparestrings, and ints from the end of ki_spareints. | ||||
* That way the spare room from both arrays will remain contiguous. | * That way the spare room from both arrays will remain contiguous. | ||||
*/ | */ | ||||
char ki_sparestrings[46]; /* spare string space */ | char ki_sparestrings[46]; /* spare string space */ | ||||
int ki_spareints[KI_NSPARE_INT]; /* spare room for growth */ | int ki_spareints[KI_NSPARE_INT]; /* spare room for growth */ | ||||
uint64_t ki_tdev; /* controlling tty dev */ | |||||
int ki_oncpu; /* Which cpu we are on */ | int ki_oncpu; /* Which cpu we are on */ | ||||
int ki_lastcpu; /* Last cpu we were on */ | int ki_lastcpu; /* Last cpu we were on */ | ||||
int ki_tracer; /* Pid of tracing process */ | int ki_tracer; /* Pid of tracing process */ | ||||
int ki_flag2; /* P2_* flags */ | int ki_flag2; /* P2_* flags */ | ||||
int ki_fibnum; /* Default FIB number */ | int ki_fibnum; /* Default FIB number */ | ||||
u_int ki_cr_flags; /* Credential flags */ | u_int ki_cr_flags; /* Credential flags */ | ||||
int ki_jid; /* Process jail ID */ | int ki_jid; /* Process jail ID */ | ||||
int ki_numthreads; /* XXXKSE number of threads in total */ | int ki_numthreads; /* XXXKSE number of threads in total */ | ||||
▲ Show 20 Lines • Show All 137 Lines • ▼ Show 20 Lines | |||||
struct kinfo_file { | struct kinfo_file { | ||||
int kf_structsize; /* Variable size of record. */ | int kf_structsize; /* Variable size of record. */ | ||||
int kf_type; /* Descriptor type. */ | int kf_type; /* Descriptor type. */ | ||||
int kf_fd; /* Array index. */ | int kf_fd; /* Array index. */ | ||||
int kf_ref_count; /* Reference count. */ | int kf_ref_count; /* Reference count. */ | ||||
int kf_flags; /* Flags. */ | int kf_flags; /* Flags. */ | ||||
int kf_pad0; /* Round to 64 bit alignment. */ | int kf_pad0; /* Round to 64 bit alignment. */ | ||||
int64_t kf_offset; /* Seek location. */ | int64_t kf_offset; /* Seek location. */ | ||||
int kf_vnode_type; /* Vnode type. */ | |||||
int kf_sock_domain; /* Socket domain. */ | |||||
int kf_sock_type; /* Socket type. */ | |||||
int kf_sock_protocol; /* Socket protocol. */ | |||||
struct sockaddr_storage kf_sa_local; /* Socket address. */ | |||||
struct sockaddr_storage kf_sa_peer; /* Peer address. */ | |||||
union { | union { | ||||
struct { | struct { | ||||
uint32_t kf_spareint; | |||||
/* Socket domain. */ | |||||
int kf_sock_domain0; | |||||
/* Socket type. */ | |||||
int kf_sock_type0; | |||||
/* Socket protocol. */ | |||||
int kf_sock_protocol0; | |||||
/* Socket address. */ | |||||
struct sockaddr_storage kf_sa_local; | |||||
/* Peer address. */ | |||||
struct sockaddr_storage kf_sa_peer; | |||||
/* Address of so_pcb. */ | /* Address of so_pcb. */ | ||||
uint64_t kf_sock_pcb; | uint64_t kf_sock_pcb; | ||||
/* Address of inp_ppcb. */ | /* Address of inp_ppcb. */ | ||||
uint64_t kf_sock_inpcb; | uint64_t kf_sock_inpcb; | ||||
/* Address of unp_conn. */ | /* Address of unp_conn. */ | ||||
uint64_t kf_sock_unpconn; | uint64_t kf_sock_unpconn; | ||||
/* Send buffer state. */ | /* Send buffer state. */ | ||||
uint16_t kf_sock_snd_sb_state; | uint16_t kf_sock_snd_sb_state; | ||||
/* Receive buffer state. */ | /* Receive buffer state. */ | ||||
uint16_t kf_sock_rcv_sb_state; | uint16_t kf_sock_rcv_sb_state; | ||||
/* Round to 64 bit alignment. */ | /* Round to 64 bit alignment. */ | ||||
uint32_t kf_sock_pad0; | uint32_t kf_sock_pad0; | ||||
} kf_sock; | } kf_sock; | ||||
struct { | struct { | ||||
/* Vnode type. */ | |||||
int kf_file_type; | |||||
/* Space for future use */ | |||||
int kf_spareint[3]; | |||||
uint64_t kf_spareint64[30]; | |||||
/* Vnode filesystem id. */ | |||||
uint64_t kf_file_fsid; | |||||
/* File device. */ | |||||
uint64_t kf_file_rdev; | |||||
/* Global file id. */ | /* Global file id. */ | ||||
uint64_t kf_file_fileid; | uint64_t kf_file_fileid; | ||||
/* File size. */ | /* File size. */ | ||||
uint64_t kf_file_size; | uint64_t kf_file_size; | ||||
/* Vnode filesystem id. */ | /* Vnode filesystem id, FreeBSD 11 compat. */ | ||||
uint32_t kf_file_fsid; | uint32_t kf_file_fsid_freebsd11; | ||||
/* File device. */ | /* File device, FreeBSD 11 compat. */ | ||||
uint32_t kf_file_rdev; | uint32_t kf_file_rdev_freebsd11; | ||||
/* File mode. */ | /* File mode. */ | ||||
uint16_t kf_file_mode; | uint16_t kf_file_mode; | ||||
/* Round to 64 bit alignment. */ | /* Round to 64 bit alignment. */ | ||||
uint16_t kf_file_pad0; | uint16_t kf_file_pad0; | ||||
uint32_t kf_file_pad1; | uint32_t kf_file_pad1; | ||||
} kf_file; | } kf_file; | ||||
struct { | struct { | ||||
uint32_t kf_spareint[4]; | |||||
uint64_t kf_spareint64[32]; | |||||
uint32_t kf_sem_value; | uint32_t kf_sem_value; | ||||
uint16_t kf_sem_mode; | uint16_t kf_sem_mode; | ||||
} kf_sem; | } kf_sem; | ||||
struct { | struct { | ||||
uint32_t kf_spareint[4]; | |||||
uint64_t kf_spareint64[32]; | |||||
uint64_t kf_pipe_addr; | uint64_t kf_pipe_addr; | ||||
uint64_t kf_pipe_peer; | uint64_t kf_pipe_peer; | ||||
uint32_t kf_pipe_buffer_cnt; | uint32_t kf_pipe_buffer_cnt; | ||||
/* Round to 64 bit alignment. */ | /* Round to 64 bit alignment. */ | ||||
uint32_t kf_pipe_pad0[3]; | uint32_t kf_pipe_pad0[3]; | ||||
} kf_pipe; | } kf_pipe; | ||||
struct { | struct { | ||||
uint32_t kf_pts_dev; | uint32_t kf_spareint[4]; | ||||
uint64_t kf_spareint64[32]; | |||||
uint32_t kf_pts_dev_freebsd11; | |||||
uint32_t kf_pts_pad0; | |||||
uint64_t kf_pts_dev; | |||||
/* Round to 64 bit alignment. */ | /* Round to 64 bit alignment. */ | ||||
uint32_t kf_pts_pad0[7]; | uint32_t kf_pts_pad1[4]; | ||||
} kf_pts; | } kf_pts; | ||||
struct { | struct { | ||||
uint32_t kf_spareint[4]; | |||||
uint64_t kf_spareint64[32]; | |||||
pid_t kf_pid; | pid_t kf_pid; | ||||
} kf_proc; | } kf_proc; | ||||
} kf_un; | } kf_un; | ||||
uint16_t kf_status; /* Status flags. */ | uint16_t kf_status; /* Status flags. */ | ||||
uint16_t kf_pad1; /* Round to 32 bit alignment. */ | uint16_t kf_pad1; /* Round to 32 bit alignment. */ | ||||
int _kf_ispare0; /* Space for more stuff. */ | int _kf_ispare0; /* Space for more stuff. */ | ||||
cap_rights_t kf_cap_rights; /* Capability rights. */ | cap_rights_t kf_cap_rights; /* Capability rights. */ | ||||
uint64_t _kf_cap_spare; /* Space for future cap_rights_t. */ | uint64_t _kf_cap_spare; /* Space for future cap_rights_t. */ | ||||
/* Truncated before copyout in sysctl */ | /* Truncated before copyout in sysctl */ | ||||
char kf_path[PATH_MAX]; /* Path to file, if any. */ | char kf_path[PATH_MAX]; /* Path to file, if any. */ | ||||
}; | }; | ||||
#ifndef _KERNEL | |||||
#define kf_vnode_type kf_un.kf_file.kf_file_type | |||||
#define kf_sock_domain kf_un.kf_sock.kf_sock_domain0 | |||||
#define kf_sock_type kf_un.kf_sock.kf_sock_type0 | |||||
#define kf_sock_protocol kf_un.kf_sock.kf_sock_protocol0 | |||||
#endif | |||||
/* | /* | ||||
* The KERN_PROC_VMMAP sysctl allows a process to dump the VM layout of | * The KERN_PROC_VMMAP sysctl allows a process to dump the VM layout of | ||||
* another process as a series of entries. | * another process as a series of entries. | ||||
*/ | */ | ||||
#define KVME_TYPE_NONE 0 | #define KVME_TYPE_NONE 0 | ||||
#define KVME_TYPE_DEFAULT 1 | #define KVME_TYPE_DEFAULT 1 | ||||
#define KVME_TYPE_VNODE 2 | #define KVME_TYPE_VNODE 2 | ||||
Show All 33 Lines | struct kinfo_ovmentry { | ||||
int kve_private_resident; /* Number of private pages. */ | int kve_private_resident; /* Number of private pages. */ | ||||
int kve_protection; /* Protection bitmask. */ | int kve_protection; /* Protection bitmask. */ | ||||
int kve_ref_count; /* VM obj ref count. */ | int kve_ref_count; /* VM obj ref count. */ | ||||
int kve_shadow_count; /* VM obj shadow count. */ | int kve_shadow_count; /* VM obj shadow count. */ | ||||
char kve_path[PATH_MAX]; /* Path to VM obj, if any. */ | char kve_path[PATH_MAX]; /* Path to VM obj, if any. */ | ||||
void *_kve_pspare[8]; /* Space for more stuff. */ | void *_kve_pspare[8]; /* Space for more stuff. */ | ||||
off_t kve_offset; /* Mapping offset in object */ | off_t kve_offset; /* Mapping offset in object */ | ||||
uint64_t kve_fileid; /* inode number if vnode */ | uint64_t kve_fileid; /* inode number if vnode */ | ||||
dev_t kve_fsid; /* dev_t of vnode location */ | uint32_t kve_fsid; /* dev_t of vnode location */ | ||||
int _kve_ispare[3]; /* Space for more stuff. */ | int _kve_ispare[3]; /* Space for more stuff. */ | ||||
}; | }; | ||||
#if defined(__amd64__) || defined(__i386__) | #if defined(__amd64__) || defined(__i386__) | ||||
#define KINFO_VMENTRY_SIZE 1160 | #define KINFO_VMENTRY_SIZE 1160 | ||||
#endif | #endif | ||||
struct kinfo_vmentry { | struct kinfo_vmentry { | ||||
int kve_structsize; /* Variable size of record. */ | int kve_structsize; /* Variable size of record. */ | ||||
int kve_type; /* Type of map entry. */ | int kve_type; /* Type of map entry. */ | ||||
uint64_t kve_start; /* Starting address. */ | uint64_t kve_start; /* Starting address. */ | ||||
uint64_t kve_end; /* Finishing address. */ | uint64_t kve_end; /* Finishing address. */ | ||||
uint64_t kve_offset; /* Mapping offset in object */ | uint64_t kve_offset; /* Mapping offset in object */ | ||||
uint64_t kve_vn_fileid; /* inode number if vnode */ | uint64_t kve_vn_fileid; /* inode number if vnode */ | ||||
uint32_t kve_vn_fsid; /* dev_t of vnode location */ | uint32_t kve_vn_fsid_freebsd11; /* dev_t of vnode location */ | ||||
int kve_flags; /* Flags on map entry. */ | int kve_flags; /* Flags on map entry. */ | ||||
int kve_resident; /* Number of resident pages. */ | int kve_resident; /* Number of resident pages. */ | ||||
int kve_private_resident; /* Number of private pages. */ | int kve_private_resident; /* Number of private pages. */ | ||||
int kve_protection; /* Protection bitmask. */ | int kve_protection; /* Protection bitmask. */ | ||||
int kve_ref_count; /* VM obj ref count. */ | int kve_ref_count; /* VM obj ref count. */ | ||||
int kve_shadow_count; /* VM obj shadow count. */ | int kve_shadow_count; /* VM obj shadow count. */ | ||||
int kve_vn_type; /* Vnode type. */ | int kve_vn_type; /* Vnode type. */ | ||||
uint64_t kve_vn_size; /* File size. */ | uint64_t kve_vn_size; /* File size. */ | ||||
uint32_t kve_vn_rdev; /* Device id if device. */ | uint32_t kve_vn_rdev_freebsd11; /* Device id if device. */ | ||||
uint16_t kve_vn_mode; /* File mode. */ | uint16_t kve_vn_mode; /* File mode. */ | ||||
uint16_t kve_status; /* Status flags. */ | uint16_t kve_status; /* Status flags. */ | ||||
int _kve_ispare[12]; /* Space for more stuff. */ | uint64_t kve_vn_fsid; /* dev_t of vnode location */ | ||||
uint64_t kve_vn_rdev; /* Device id if device. */ | |||||
int _kve_ispare[8]; /* Space for more stuff. */ | |||||
/* Truncated before copyout in sysctl */ | /* Truncated before copyout in sysctl */ | ||||
char kve_path[PATH_MAX]; /* Path to VM obj, if any. */ | char kve_path[PATH_MAX]; /* Path to VM obj, if any. */ | ||||
}; | }; | ||||
/* | /* | ||||
* The "vm.objects" sysctl provides a list of all VM objects in the system | * The "vm.objects" sysctl provides a list of all VM objects in the system | ||||
* via an array of these entries. | * via an array of these entries. | ||||
*/ | */ | ||||
struct kinfo_vmobject { | struct kinfo_vmobject { | ||||
int kvo_structsize; /* Variable size of record. */ | int kvo_structsize; /* Variable size of record. */ | ||||
int kvo_type; /* Object type: KVME_TYPE_*. */ | int kvo_type; /* Object type: KVME_TYPE_*. */ | ||||
uint64_t kvo_size; /* Object size in pages. */ | uint64_t kvo_size; /* Object size in pages. */ | ||||
uint64_t kvo_vn_fileid; /* inode number if vnode. */ | uint64_t kvo_vn_fileid; /* inode number if vnode. */ | ||||
uint32_t kvo_vn_fsid; /* dev_t of vnode location. */ | uint32_t kvo_vn_fsid_freebsd11; /* dev_t of vnode location. */ | ||||
int kvo_ref_count; /* Reference count. */ | int kvo_ref_count; /* Reference count. */ | ||||
int kvo_shadow_count; /* Shadow count. */ | int kvo_shadow_count; /* Shadow count. */ | ||||
int kvo_memattr; /* Memory attribute. */ | int kvo_memattr; /* Memory attribute. */ | ||||
uint64_t kvo_resident; /* Number of resident pages. */ | uint64_t kvo_resident; /* Number of resident pages. */ | ||||
uint64_t kvo_active; /* Number of active pages. */ | uint64_t kvo_active; /* Number of active pages. */ | ||||
uint64_t kvo_inactive; /* Number of inactive pages. */ | uint64_t kvo_inactive; /* Number of inactive pages. */ | ||||
uint64_t _kvo_qspare[8]; | uint64_t kvo_vn_fsid; | ||||
uint64_t _kvo_qspare[7]; | |||||
uint32_t _kvo_ispare[8]; | uint32_t _kvo_ispare[8]; | ||||
char kvo_path[PATH_MAX]; /* Pathname, if any. */ | char kvo_path[PATH_MAX]; /* Pathname, if any. */ | ||||
}; | }; | ||||
/* | /* | ||||
* The KERN_PROC_KSTACK sysctl allows a process to dump the kernel stacks of | * The KERN_PROC_KSTACK sysctl allows a process to dump the kernel stacks of | ||||
* another process as a series of entries. Each stack is represented by a | * another process as a series of entries. Each stack is represented by a | ||||
* series of symbol names and offsets as generated by stack_sbuf_print(9). | * series of symbol names and offsets as generated by stack_sbuf_print(9). | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |