portfns.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. void _assert(char*);
  10. void accounttime(void);
  11. void acsched(void);
  12. void addbootfile(char*, uchar*, uint32_t);
  13. Timer* addclock0link(void (*)(void), int);
  14. int addconsdev(Queue*, void (*fn)(char*,int), int, int);
  15. int addkbdq(Queue*, int);
  16. int addphysseg(Physseg*);
  17. void addwaitstat(uintptr pc, uvlong t0, int type);
  18. void addwatchdog(Watchdog*);
  19. int adec(int*);
  20. Block* adjustblock(Block*, int);
  21. int ainc(int*);
  22. void alarmkproc(void*);
  23. Block* allocb(int);
  24. void* alloczio(Segment*, long);
  25. int anyhigher(void);
  26. int anyready(void);
  27. Image* attachimage(int, Chan*, int, uintptr, usize);
  28. Page* auxpage(usize);
  29. Block* bl2mem(uchar*, Block*, int);
  30. int blocklen(Block*);
  31. void bootlinks(void);
  32. void cachedel(Image*, uint32_t);
  33. void cachepage(Page*, Image*);
  34. void callwithureg(void (*)(Ureg*));
  35. int canlock(Lock*);
  36. int canpage(Proc*);
  37. int canqlock(QLock*);
  38. int canrlock(RWlock*);
  39. Chan* cclone(Chan*);
  40. void cclose(Chan*);
  41. void ccloseq(Chan*);
  42. void chanfree(Chan*);
  43. char* chanpath(Chan*);
  44. void checkalarms(void);
  45. void checkb(Block*, char*);
  46. void clearwaitstats(void);
  47. void closeegrp(Egrp*);
  48. void closefgrp(Fgrp*);
  49. void closepgrp(Pgrp*);
  50. void closergrp(Rgrp*);
  51. void cmderror(Cmdbuf*, char*);
  52. int cmount(Chan**, Chan*, int, char*);
  53. Block* concatblock(Block*);
  54. void confinit(void);
  55. int consactive(void);
  56. void (*consdebug)(void);
  57. void (*consputs)(char*, int);
  58. Block* copyblock(Block*, int);
  59. void copypage(Page*, Page*);
  60. void cunmount(Chan*, Chan*);
  61. Segment* data2txt(Segment*);
  62. uintptr dbgpc(Proc*);
  63. int decrypt(void*, void*, int);
  64. void delay(int);
  65. void delconsdevs(void);
  66. Proc* dequeueproc(Sched*, Schedq*, Proc*);
  67. Chan* devattach(int, char*);
  68. Block* devbread(Chan*, long, vlong);
  69. long devbwrite(Chan*, Block*, vlong);
  70. Chan* devclone(Chan*);
  71. int devconfig(int, char *, DevConf *);
  72. void devcreate(Chan*, char*, int, int);
  73. void devdir(Chan*, Qid, char*, vlong, char*, long, Dir*);
  74. long devdirread(Chan*, char*, long, Dirtab*, int, Devgen*);
  75. Devgen devgen;
  76. void devinit(void);
  77. Chan* devopen(Chan*, int, Dirtab*, int, Devgen*);
  78. void devpermcheck(char*, int, int);
  79. void devpower(int);
  80. void devremove(Chan*);
  81. void devreset(void);
  82. void devshutdown(void);
  83. long devstat(Chan*, uchar*, long, Dirtab*, int, Devgen*);
  84. Dev* devtabget(int, int);
  85. void devtabinit(void);
  86. long devtabread(Chan*, void*, long, vlong);
  87. void devtabreset(void);
  88. void devtabshutdown(void);
  89. Walkqid* devwalk(Chan*, Chan*, char**, int, Dirtab*, int, Devgen*);
  90. long devwstat(Chan*, uchar*, long);
  91. int devzread(Chan*, Kzio*, int, usize, vlong);
  92. int devzwrite(Chan*, Kzio*, int, vlong);
  93. void drawactive(int);
  94. void drawcmap(void);
  95. void dumpaproc(Proc*);
  96. void dumpregs(Ureg*);
  97. void dumpstack(void);
  98. void dumpzseg(Segment*);
  99. Fgrp* dupfgrp(Fgrp*);
  100. int duppage(Page*);
  101. Segment* dupseg(Segment**, int, int);
  102. void dupswap(Page*);
  103. char* edfadmit(Proc*);
  104. void edfinit(Proc*);
  105. int edfready(Proc*);
  106. void edfrecord(Proc*);
  107. void edfrun(Proc*, int);
  108. void edfstop(Proc*);
  109. void edfyield(void);
  110. int emptystr(char*);
  111. int encrypt(void*, void*, int);
  112. void envcpy(Egrp*, Egrp*);
  113. int eqchanddq(Chan*, int, uint, Qid, int);
  114. int eqqid(Qid, Qid);
  115. void error(char*);
  116. void exhausted(char*);
  117. void exit(int);
  118. uvlong fastticks(uvlong*);
  119. uvlong fastticks2ns(uvlong);
  120. uvlong fastticks2us(uvlong);
  121. int fault(uintptr, int);
  122. void fdclose(int, int);
  123. Chan* fdtochan(int, int, int, int);
  124. int findmount(Chan**, Mhead**, int, uint, Qid);
  125. int fixfault(Segment*, uintptr, int, int, int);
  126. void fmtinit(void);
  127. void forceclosefgrp(void);
  128. void free(void*);
  129. void freeb(Block*);
  130. void freeblist(Block*);
  131. int freebroken(void);
  132. void freepte(Segment*, Pte*);
  133. void getcolor(uint32_t, uint32_t*, uint32_t*, uint32_t*);
  134. char* getconfenv(void);
  135. int getpgszi(uint32_t);
  136. Segment* getzkseg(void);
  137. void gotolabel(Label*);
  138. int haswaitq(void*);
  139. void hnputl(void*, uint);
  140. void hnputs(void*, ushort);
  141. void hnputv(void*, uvlong);
  142. long hostdomainwrite(char*, long);
  143. long hostownerwrite(char*, long);
  144. void hzsched(void);
  145. Block* iallocb(int);
  146. void iallocsummary(void);
  147. void ilock(Lock*);
  148. void initimage(void);
  149. int iprint(char*, ...);
  150. void isdir(Chan*);
  151. int iseve(void);
  152. int islo(void);
  153. Segment* isoverlap(Proc*, uintptr, usize);
  154. int isphysseg(char*);
  155. void iunlock(Lock*);
  156. void ixsummary(void);
  157. int kbdcr2nl(Queue*, int);
  158. int kbdgetmap(int, int*, int*, Rune*);
  159. int kbdputc(Queue*, int);
  160. void kbdputmap(ushort, ushort, Rune);
  161. void kickpager(int, int);
  162. void killbig(char*);
  163. void kproc(char*, void(*)(void*), void*);
  164. void kprocchild(Proc*, void (*)(void*), void*);
  165. void (*kproftimer)(uintptr);
  166. void ksetenv(char*, char*, int);
  167. void kstrcpy(char*, char*, int);
  168. void kstrdup(char**, char*);
  169. long latin1(Rune*, int);
  170. int lock(Lock*);
  171. void log(Log*, int, char*, ...);
  172. void logclose(Log*);
  173. char* logctl(Log*, int, char**, Logflag*);
  174. void logn(Log*, int, void*, int);
  175. void logopen(Log*);
  176. long logread(Log*, void*, uint32_t, long);
  177. Page* lookpage(Image*, uint32_t);
  178. Cmdtab* lookupcmd(Cmdbuf*, Cmdtab*, int);
  179. void mallocinit(void);
  180. long mallocreadsummary(Chan*, void*, long, long);
  181. void mallocsummary(void);
  182. Block* mem2bl(uchar*, int);
  183. void (*mfcinit)(void);
  184. void (*mfcopen)(Chan*);
  185. int (*mfcread)(Chan*, uchar*, int, vlong);
  186. void (*mfcupdate)(Chan*, uchar*, int, vlong);
  187. void (*mfcwrite)(Chan*, uchar*, int, vlong);
  188. void mfreeseg(Segment*, uintptr, int);
  189. void microdelay(int);
  190. uvlong mk64fract(uvlong, uvlong);
  191. void mkqid(Qid*, vlong, uint32_t, int);
  192. void mmuflush(void);
  193. void mmuput(uintptr, Page*, uint);
  194. void mmurelease(Proc*);
  195. void mmuswitch(Proc*);
  196. Chan* mntauth(Chan*, char*);
  197. usize mntversion(Chan*, u32int, char*, usize);
  198. void mountfree(Mount*);
  199. uvlong ms2fastticks(uint32_t);
  200. #define MS2NS(n) (((vlong)(n))*1000000LL)
  201. uint32_t ms2tk(uint32_t);
  202. void mul64fract(uvlong*, uvlong, uvlong);
  203. void muxclose(Mnt*);
  204. void (*mwait)(void *);
  205. Chan* namec(char*, int, int, int);
  206. void nameerror(char*, char*);
  207. Chan* newchan(void);
  208. int newfd(Chan*);
  209. Mhead* newmhead(Chan*);
  210. Mount* newmount(Mhead*, Chan*, int, char*);
  211. Page* newpage(int, Segment **, uintptr, usize, int);
  212. Path* newpath(char*);
  213. Pgrp* newpgrp(void);
  214. Proc* newproc(void);
  215. Rgrp* newrgrp(void);
  216. Segment* newseg(int, uintptr, u64int);
  217. void newzmap(Segment*);
  218. void nexterror(void);
  219. uint nhgetl(void*);
  220. ushort nhgets(void*);
  221. uvlong nhgetv(void*);
  222. void nixprepage(int);
  223. int nrand(int);
  224. uvlong ns2fastticks(uvlong);
  225. int okaddr(uintptr, long, int);
  226. int openmode(int);
  227. Block* packblock(Block*);
  228. Block* padblock(Block*, int);
  229. void pagechainhead(Page*);
  230. void pageinit(void);
  231. uint32_t pagenumber(Page*);
  232. uvlong pagereclaim(Image*);
  233. void pagersummary(void);
  234. void pageunchain(Page*);
  235. void panic(char*, ...);
  236. Cmdbuf* parsecmd(char *a, int n);
  237. void pathclose(Path*);
  238. uint32_t perfticks(void);
  239. void pexit(char*, int);
  240. Page* pgalloc(usize, int);
  241. void pgfree(Page*);
  242. void pgrpcpy(Pgrp*, Pgrp*);
  243. void pgrpnote(uint32_t, char*, long, int);
  244. uintmem physalloc(u64int, int*, void*);
  245. void physdump(void);
  246. void physfree(uintmem, u64int);
  247. void physinit(uintmem, u64int);
  248. void* phystag(uintmem);
  249. void pio(Segment*, uintptr, uint32_t, Page**, int);
  250. #define poperror() up->nerrlab--
  251. void portmwait(void*);
  252. int postnote(Proc*, int, char*, int);
  253. int pprint(char*, ...);
  254. int preempted(void);
  255. void prflush(void);
  256. void printinit(void);
  257. uint32_t procalarm(uint32_t);
  258. void procctl(Proc*);
  259. void procdump(void);
  260. int procfdprint(Chan*, int, int, char*, int);
  261. void procflushseg(Segment*);
  262. void procinit0(void);
  263. void procpriority(Proc*, int, int);
  264. void procrestore(Proc*);
  265. void procsave(Proc*);
  266. void (*proctrace)(Proc*, int, vlong);
  267. void proctracepid(Proc*);
  268. void procwired(Proc*, int);
  269. void psdecref(Proc*);
  270. Proc* psincref(int);
  271. int psindex(int);
  272. void psinit(int);
  273. Pte* ptealloc(Segment*);
  274. Pte* ptecpy(Segment*,Pte*);
  275. int pullblock(Block**, int);
  276. Block* pullupblock(Block*, int);
  277. Block* pullupqueue(Queue*, int);
  278. void putimage(Image*);
  279. void putmhead(Mhead*);
  280. void putpage(Page*);
  281. void putseg(Segment*);
  282. void putstrn(char*, int);
  283. void putswap(Page*);
  284. int pwait(Waitmsg*);
  285. void qaddlist(Queue*, Block*);
  286. Block* qbread(Queue*, int);
  287. long qbwrite(Queue*, Block*);
  288. Queue* qbypass(void (*)(void*, Block*), void*);
  289. int qcanread(Queue*);
  290. void qclose(Queue*);
  291. int qconsume(Queue*, void*, int);
  292. Block* qcopy(Queue*, int, uint32_t);
  293. int qdiscard(Queue*, int);
  294. void qflush(Queue*);
  295. void qfree(Queue*);
  296. int qfull(Queue*);
  297. Block* qget(Queue*);
  298. void qhangup(Queue*, char*);
  299. int qisclosed(Queue*);
  300. int qiwrite(Queue*, void*, int);
  301. int qlen(Queue*);
  302. void qlock(QLock*);
  303. void qnoblock(Queue*, int);
  304. Queue* qopen(int, int, void (*)(void*), void*);
  305. int qpass(Queue*, Block*);
  306. int qpassnolim(Queue*, Block*);
  307. int qproduce(Queue*, void*, int);
  308. void qputback(Queue*, Block*);
  309. long qread(Queue*, void*, int);
  310. Block* qremove(Queue*);
  311. void qreopen(Queue*);
  312. void qsetlimit(Queue*, int);
  313. void qunlock(QLock*);
  314. int qwindow(Queue*);
  315. int qwrite(Queue*, void*, int);
  316. int rand(void);
  317. void randominit(void);
  318. uint32_t randomread(void*, uint32_t);
  319. void rdb(void);
  320. int readnum(uint32_t, char*, uint32_t, uint32_t, int);
  321. long readstr(long, char*, long, char*);
  322. void ready(Proc*);
  323. long readzio(Kzio[], int, void*, long);
  324. void reboot(void*, void*, long);
  325. void rebootcmd(int, char**);
  326. void relocateseg(Segment*, uintptr);
  327. void renameuser(char*, char*);
  328. void resched(char*);
  329. void resrcwait(char*);
  330. int return0(void*);
  331. void rlock(RWlock*);
  332. long rtctime(void);
  333. int runac(Mach *m, void(*func)(void), int flushtlb, void *a, long n);
  334. void runlock(RWlock*);
  335. Proc* runproc(void);
  336. void sched(void);
  337. void scheddump(void);
  338. void schedinit(void);
  339. long seconds(void);
  340. Segment* seg(Proc*, uintptr, int);
  341. void segclock(uintptr);
  342. Sem* segmksem(Segment*, int*);
  343. void segpage(Segment*, Page*);
  344. uintmem segppn(Segment*, uintmem);
  345. int semadec(int*);
  346. int semainc(int*);
  347. char* seprintpagestats(char*, char*);
  348. char* seprintphysstats(char*, char*);
  349. int setcolor(uint32_t, uint32_t, uint32_t, uint32_t);
  350. void setkernur(Ureg*, Proc*);
  351. int setlabel(Label*);
  352. void setregisters(Ureg*, char*, char*, int);
  353. char* skipslash(char*);
  354. void sleep(Rendez*, int (*)(void*), void*);
  355. void* smalloc(uint32_t);
  356. char* srvname(Chan*);
  357. void startwaitstats(int);
  358. int swapcount(uint32_t);
  359. void swapinit(void);
  360. void syscallfmt(int, va_list list);
  361. void sysretfmt(int, va_list, Ar0*, uvlong, uvlong);
  362. void sysrforkchild(Proc*, Proc*);
  363. void timeradd(Timer*);
  364. void timerdel(Timer*);
  365. void timerintr(Ureg*, vlong);
  366. void timerset(uvlong);
  367. void timersinit(void);
  368. uint32_t tk2ms(uint32_t);
  369. #define TK2MS(x) ((x)*(1000/HZ))
  370. uvlong tod2fastticks(vlong);
  371. vlong todget(vlong*);
  372. void todinit(void);
  373. void todset(vlong, vlong, int);
  374. void todsetfreq(vlong);
  375. Block* trimblock(Block*, int, int);
  376. void tsleep(Rendez*, int (*)(void*), void*, long);
  377. Uart* uartconsole(int, char*);
  378. int uartctl(Uart*, char*);
  379. int uartgetc(void);
  380. void uartkick(void*);
  381. void uartputc(int);
  382. void uartputs(char*, int);
  383. void uartrecv(Uart*, char);
  384. int uartstageoutput(Uart*);
  385. void unbreak(Proc*);
  386. void uncachepage(Page*);
  387. void unlock(Lock*);
  388. void userinit(void);
  389. uintptr userpc(Ureg*);
  390. long userwrite(char*, long);
  391. void* validaddr(void*, long, int);
  392. void validname(char*, int);
  393. char* validnamedup(char*, int);
  394. void validstat(uchar*, usize);
  395. void* vmemchr(void*, int, int);
  396. Proc* wakeup(Rendez*);
  397. int walk(Chan**, char**, int, int, int*);
  398. void wlock(RWlock*);
  399. void wunlock(RWlock*);
  400. void yield(void);
  401. uintptr zgetaddr(Segment*);
  402. void zgrow(Segment*);
  403. int ziofmt(Fmt*);
  404. int zputaddr(Segment*, uintptr);
  405. ulong µs(void);
  406. #pragma varargck argpos iprint 1
  407. #pragma varargck argpos panic 1
  408. #pragma varargck argpos pprint 1