github.com/razvanm/vanadium-go-1.3@v0.0.0-20160721203343-4a65068e5915/src/runtime/os_plan9.h (about) 1 // Copyright 2010 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Plan 9-specific system calls 6 int32 runtime·pread(int32 fd, void *buf, int32 nbytes, int64 offset); 7 int32 runtime·pwrite(int32 fd, void *buf, int32 nbytes, int64 offset); 8 int64 runtime·seek(int32 fd, int64 offset, int32 whence); 9 void runtime·exits(int8* msg); 10 intptr runtime·brk_(void*); 11 int32 runtime·sleep(int32 ms); 12 int32 runtime·rfork(int32 flags); 13 int32 runtime·plan9_semacquire(uint32 *addr, int32 block); 14 int32 runtime·plan9_tsemacquire(uint32 *addr, int32 ms); 15 int32 runtime·plan9_semrelease(uint32 *addr, int32 count); 16 int32 runtime·notify(void (*fn)(void*, int8*)); 17 int32 runtime·noted(int32); 18 int64 runtime·nsec(int64*); 19 void runtime·sigtramp(void*, int8*); 20 void runtime·sigpanic(void); 21 void runtime·goexitsall(int8*); 22 void runtime·setfpmasks(void); 23 void runtime·tstart_plan9(M *newm); 24 25 /* open */ 26 enum 27 { 28 OREAD = 0, 29 OWRITE = 1, 30 ORDWR = 2, 31 OEXEC = 3, 32 OTRUNC = 16, 33 OCEXEC = 32, 34 ORCLOSE = 64, 35 OEXCL = 0x1000 36 }; 37 38 /* rfork */ 39 enum 40 { 41 RFNAMEG = (1<<0), 42 RFENVG = (1<<1), 43 RFFDG = (1<<2), 44 RFNOTEG = (1<<3), 45 RFPROC = (1<<4), 46 RFMEM = (1<<5), 47 RFNOWAIT = (1<<6), 48 RFCNAMEG = (1<<10), 49 RFCENVG = (1<<11), 50 RFCFDG = (1<<12), 51 RFREND = (1<<13), 52 RFNOMNT = (1<<14) 53 }; 54 55 /* notify */ 56 enum 57 { 58 NCONT = 0, 59 NDFLT = 1 60 }; 61 62 typedef struct Tos Tos; 63 typedef intptr _Plink; 64 65 struct Tos { 66 struct TosProf /* Per process profiling */ 67 { 68 _Plink *pp; /* known to be 0(ptr) */ 69 _Plink *next; /* known to be 4(ptr) */ 70 _Plink *last; 71 _Plink *first; 72 uint32 pid; 73 uint32 what; 74 } prof; 75 uint64 cyclefreq; /* cycle clock frequency if there is one, 0 otherwise */ 76 int64 kcycles; /* cycles spent in kernel */ 77 int64 pcycles; /* cycles spent in process (kernel + user) */ 78 uint32 pid; /* might as well put the pid here */ 79 uint32 clock; 80 /* top of stack is here */ 81 }; 82 83 enum { 84 NSIG = 14, /* number of signals in runtime·SigTab array */ 85 ERRMAX = 128, /* max length of note string */ 86 87 /* Notes in runtime·sigtab that are handled by runtime·sigpanic. */ 88 SIGRFAULT = 2, 89 SIGWFAULT = 3, 90 SIGINTDIV = 4, 91 SIGFLOAT = 5, 92 SIGTRAP = 6, 93 };