1// +build ignore 2 3// We still need editing by hands. 4// go tool cgo -godefs types_openbsd.go | sed 's/\*int64/int64/' | sed 's/\*byte/int64/' > process_openbsd_amd64.go 5 6/* 7Input to cgo -godefs. 8*/ 9 10// +godefs map struct_pargs int64 /* pargs */ 11// +godefs map struct_proc int64 /* proc */ 12// +godefs map struct_user int64 /* user */ 13// +godefs map struct_vnode int64 /* vnode */ 14// +godefs map struct_vnode int64 /* vnode */ 15// +godefs map struct_filedesc int64 /* filedesc */ 16// +godefs map struct_vmspace int64 /* vmspace */ 17// +godefs map struct_pcb int64 /* pcb */ 18// +godefs map struct_thread int64 /* thread */ 19// +godefs map struct___sigset [16]byte /* sigset */ 20 21package process 22 23/* 24#include <sys/types.h> 25#include <sys/sysctl.h> 26#include <sys/user.h> 27 28enum { 29 sizeofPtr = sizeof(void*), 30}; 31 32 33*/ 34import "C" 35 36// Machine characteristics; for internal use. 37 38const ( 39 CTLKern = 1 // "high kernel": proc, limits 40 KernProc = 66 // struct: process entries 41 KernProcAll = 0 42 KernProcPID = 1 // by process id 43 KernProcProc = 8 // only return procs 44 KernProcPathname = 12 // path to executable 45 KernProcArgs = 55 // get/set arguments/proctitle 46 KernProcArgv = 1 47 KernProcEnv = 3 48) 49 50const ( 51 ArgMax = 256 * 1024 // sys/syslimits.h:#define ARG_MAX 52) 53 54const ( 55 sizeofPtr = C.sizeofPtr 56 sizeofShort = C.sizeof_short 57 sizeofInt = C.sizeof_int 58 sizeofLong = C.sizeof_long 59 sizeofLongLong = C.sizeof_longlong 60) 61 62const ( 63 sizeOfKinfoVmentry = C.sizeof_struct_kinfo_vmentry 64 sizeOfKinfoProc = C.sizeof_struct_kinfo_proc 65) 66 67// from sys/proc.h 68const ( 69 SIDL = 1 /* Process being created by fork. */ 70 SRUN = 2 /* Currently runnable. */ 71 SSLEEP = 3 /* Sleeping on an address. */ 72 SSTOP = 4 /* Process debugging or suspension. */ 73 SZOMB = 5 /* Awaiting collection by parent. */ 74 SDEAD = 6 /* Thread is almost gone */ 75 SONPROC = 7 /* Thread is currently on a CPU. */ 76) 77 78// Basic types 79 80type ( 81 _C_short C.short 82 _C_int C.int 83 _C_long C.long 84 _C_long_long C.longlong 85) 86 87// Time 88 89type Timespec C.struct_timespec 90 91type Timeval C.struct_timeval 92 93// Processes 94 95type Rusage C.struct_rusage 96 97type Rlimit C.struct_rlimit 98 99type KinfoProc C.struct_kinfo_proc 100 101type Priority C.struct_priority 102 103type KinfoVmentry C.struct_kinfo_vmentry 104