portfns.h (11624B)
1 // Plan 9 VX: avoid Unix reserved words 2 #define log _klog 3 #define malloc _kmalloc 4 #define encrypt _kencrypt 5 #undef timeradd 6 #define timeradd _ktimeradd 7 #define reboot _kreboot 8 #undef _assert 9 #define _assert __kassert 10 #define rand _krand 11 #define memrchr _kmemrchr 12 13 void _assert(char*); 14 void accounttime(void); 15 Timer* addclock0link(void (*)(void), int); 16 int addphysseg(Physseg*); 17 void addbootfile(char*, uchar*, ulong); 18 void addwatchdog(Watchdog*); 19 Block* adjustblock(Block*, int); 20 void alarmkproc(void*); 21 Block* allocb(int); 22 int anyhigher(void); 23 int anyready(void); 24 Image* attachimage(int, Chan*, ulong, ulong); 25 Page* auxpage(void); 26 Block* bl2mem(uchar*, Block*, int); 27 int blocklen(Block*); 28 void bootlinks(void); 29 void cachedel(Image*, ulong); 30 void cachepage(Page*, Image*); 31 void callwithureg(void(*)(Ureg*)); 32 char* chanpath(Chan*); 33 int canlock(Lock*); 34 int canpage(Proc*); 35 int __canqlock(QLock*); 36 int __canrlock(RWlock*); 37 void chandevinit(void); 38 void chandevreset(void); 39 void chandevshutdown(void); 40 void chanfree(Chan*); 41 void checkalarms(void); 42 void checkb(Block*, char*); 43 void cinit(void); 44 Chan* cclone(Chan*); 45 void cclose(Chan*); 46 void ccloseq(Chan*); 47 void closeegrp(Egrp*); 48 void closefgrp(Fgrp*); 49 void closepgrp(Pgrp*); 50 void closergrp(Rgrp*); 51 long clrfpintr(void); 52 void cmderror(Cmdbuf*, char*); 53 int cmount(Chan**, Chan*, int, char*); 54 void confinit(void); 55 int consactive(void); 56 void (*consdebug)(void); 57 void copen(Chan*); 58 Block* concatblock(Block*); 59 Block* copyblock(Block*, int); 60 void copypage(Page*, Page*); 61 void countpagerefs(ulong*, int); 62 int cread(Chan*, uchar*, int, vlong); 63 void cunmount(Chan*, Chan*); 64 void cupdate(Chan*, uchar*, int, vlong); 65 void cwrite(Chan*, uchar*, int, vlong); 66 ulong dbgpc(Proc*); 67 long decref(Ref*); 68 int decrypt(void*, void*, int); 69 void delay(int); 70 Proc* dequeueproc(Schedq*, Proc*); 71 Chan* devattach(int, char*); 72 Block* devbread(Chan*, long, ulong); 73 long devbwrite(Chan*, Block*, ulong); 74 Chan* devclone(Chan*); 75 int devconfig(int, char *, DevConf *); 76 void devcreate(Chan*, char*, int, ulong); 77 void devdir(Chan*, Qid, char*, vlong, char*, long, Dir*); 78 long devdirread(Chan*, char*, long, Dirtab*, int, Devgen*); 79 Devgen devgen; 80 void devinit(void); 81 int devno(int, int); 82 Chan* devopen(Chan*, int, Dirtab*, int, Devgen*); 83 void devpermcheck(char*, ulong, int); 84 void devpower(int); 85 void devremove(Chan*); 86 void devreset(void); 87 void devshutdown(void); 88 int devstat(Chan*, uchar*, int, Dirtab*, int, Devgen*); 89 Walkqid* devwalk(Chan*, Chan*, char**, int, Dirtab*, int, Devgen*); 90 int devwstat(Chan*, uchar*, int); 91 void drawactive(int); 92 void drawcmap(void); 93 void dumpaproc(Proc*); 94 void dumpregs(Ureg*); 95 void dumpstack(void); 96 Fgrp* dupfgrp(Fgrp*); 97 int duppage(Page*); 98 void dupswap(Page*); 99 void edfinit(Proc*); 100 char* edfadmit(Proc*); 101 int edfready(Proc*); 102 void edfrecord(Proc*); 103 void edfrun(Proc*, int); 104 void edfstop(Proc*); 105 void edfyield(void); 106 int emptystr(char*); 107 int encrypt(void*, void*, int); 108 void envcpy(Egrp*, Egrp*); 109 int eqchan(Chan*, Chan*, int); 110 int eqchantdqid(Chan*, int, int, Qid, int); 111 int eqqid(Qid, Qid); 112 void error(char*); 113 long execregs(ulong, ulong, ulong); 114 void exhausted(char*); 115 void exit(int); 116 uvlong fastticks(uvlong*); 117 uvlong fastticks2ns(uvlong); 118 uvlong fastticks2us(uvlong); 119 int fault(ulong, int); 120 void fdclose(int, int); 121 Chan* fdtochan(int, int, int, int); 122 int findmount(Chan**, Mhead**, int, int, Qid); 123 int fixfault(Segment*, ulong, int, int); 124 void flushmmu(void); 125 void forceclosefgrp(void); 126 void forkchild(Proc*, Ureg*); 127 void forkret(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(ulong, ulong*, ulong*, ulong*); 134 ulong getmalloctag(void*); 135 ulong getrealloctag(void*); 136 char* getconfenv(void); 137 int haswaitq(void*); 138 long hostdomainwrite(char*, int); 139 long hostownerwrite(char*, int); 140 void hzsched(void); 141 Block* iallocb(int); 142 void iallocsummary(void); 143 long ibrk(ulong, int); 144 void ilock(Lock*); 145 void iunlock(Lock*); 146 long incref(Ref*); 147 void initseg(void); 148 int iprint(char*, ...); 149 void isdir(Chan*); 150 int iseve(void); 151 int islo(void); 152 Segment* isoverlap(Proc*, ulong, int); 153 int ispages(void*); 154 int isphysseg(char*); 155 void ixsummary(void); 156 int kbdcr2nl(Queue*, int); 157 int kbdgetmap(uint, int*, int*, Rune*); 158 int kbdputc(Queue*, int); 159 void kbdputmap(ushort, ushort, Rune); 160 void kickpager(void); 161 void killbig(char*); 162 void kproc(char*, void(*)(void*), void*); 163 void kprocchild(Proc*, void (*)(void*), void*); 164 void (*kproftimer)(ulong); 165 void ksetenv(char*, char*, int); 166 void kstrcpy(char*, char*, int); 167 void kstrdup(char**, char*); 168 long latin1(Rune*, int); 169 int __lock(Lock*); 170 void logopen(Log*); 171 void logclose(Log*); 172 char* logctl(Log*, int, char**, Logflag*); 173 void logn(Log*, int, void*, int); 174 long logread(Log*, void*, ulong, long); 175 void log(Log*, int, char*, ...); 176 Cmdtab* lookupcmd(Cmdbuf*, Cmdtab*, int); 177 Page* lookpage(Image*, ulong); 178 #define MS2NS(n) (((vlong)(n))*1000000LL) 179 void machinit(void); 180 void* mallocz(ulong, int); 181 void* malloc(ulong); 182 void* mallocalign(ulong, ulong, long, ulong); 183 void mallocsummary(void); 184 Block* mem2bl(uchar*, int); 185 void mfreeseg(Segment*, ulong, int); 186 void microdelay(int); 187 uvlong mk64fract(uvlong, uvlong); 188 void mkqid(Qid*, vlong, ulong, int); 189 void mmurelease(Proc*); 190 void mmuswitch(Proc*); 191 Chan* mntauth(Chan*, char*); 192 long mntversion(Chan*, char*, int, int); 193 void mouseresize(void); 194 void mountfree(Mount*); 195 ulong ms2tk(ulong); 196 ulong msize(void*); 197 ulong ms2tk(ulong); 198 uvlong ms2fastticks(ulong); 199 void mul64fract(uvlong*, uvlong, uvlong); 200 void muxclose(Mnt*); 201 Chan* namec(char*, int, int, ulong); 202 void nameerror(char*, char*); 203 Chan* newchan(void); 204 int newfd(Chan*); 205 Mhead* newmhead(Chan*); 206 Mount* newmount(Mhead*, Chan*, int, char*); 207 Page* newpage(int, Segment **, ulong); 208 Path* newpath(char*); 209 Pgrp* newpgrp(void); 210 Rgrp* newrgrp(void); 211 Proc* newproc(void); 212 void nexterror(void); 213 int notify(Ureg*); 214 int nrand(int); 215 uvlong ns2fastticks(uvlong); 216 void* okaddr(ulong, ulong, int); 217 int openmode(ulong); 218 Block* packblock(Block*); 219 Block* padblock(Block*, int); 220 void pagechainhead(Page*); 221 void pageinit(void); 222 ulong pagenumber(Page*); 223 void pagersummary(void); 224 void panic(char*, ...); 225 Cmdbuf* parsecmd(char *a, int n); 226 void pathclose(Path*); 227 ulong perfticks(void); 228 void pexit(char*, int); 229 void pgrpcpy(Pgrp*, Pgrp*); 230 void pgrpnote(ulong, char*, long, int); 231 void pio(Segment *, ulong, ulong, Page **); 232 #define poperror() up->nerrlab-- 233 void portcountpagerefs(ulong*, int); 234 int postnote(Proc*, int, char*, int); 235 int pprint(char*, ...); 236 int preempted(void); 237 void prflush(void); 238 void printinit(void); 239 ulong procalarm(ulong); 240 void procctl(Proc*); 241 void procdump(void); 242 int procfdprint(Chan*, int, int, char*, int); 243 int procindex(ulong); 244 void procinit0(void); 245 void procflushseg(Segment*); 246 void procpriority(Proc*, int, int); 247 Proc* proctab(int); 248 extern void (*proctrace)(Proc*, int, vlong); 249 void procwired(Proc*, int); 250 Pte* ptealloc(void); 251 Pte* ptecpy(Pte*); 252 int pullblock(Block**, int); 253 Block* pullupblock(Block*, int); 254 Block* pullupqueue(Queue*, int); 255 void putimage(Image*); 256 void putmhead(Mhead*); 257 void putmmu(ulong, ulong, Page*); 258 void putpage(Page*); 259 void putseg(Segment*); 260 void putstrn(char*, int); 261 void putswap(Page*); 262 ulong pwait(Waitmsg*); 263 void qaddlist(Queue*, Block*); 264 Block* qbread(Queue*, int); 265 long qbwrite(Queue*, Block*); 266 Queue* qbypass(void (*)(void*, Block*), void*); 267 int qcanread(Queue*); 268 void qclose(Queue*); 269 int qconsume(Queue*, void*, int); 270 Block* qcopy(Queue*, int, ulong); 271 int qdiscard(Queue*, int); 272 void qflush(Queue*); 273 void qfree(Queue*); 274 int qfull(Queue*); 275 Block* qget(Queue*); 276 void qhangup(Queue*, char*); 277 int qisclosed(Queue*); 278 int qiwrite(Queue*, void*, int); 279 int qlen(Queue*); 280 void __qlock(QLock*); 281 Queue* qopen(int, int, void (*)(void*), void*); 282 int qpass(Queue*, Block*); 283 int qpassnolim(Queue*, Block*); 284 int qproduce(Queue*, void*, int); 285 void qputback(Queue*, Block*); 286 long qread(Queue*, void*, int); 287 Block* qremove(Queue*); 288 void qreopen(Queue*); 289 void qsetlimit(Queue*, int); 290 void __qunlock(QLock*); 291 int qwindow(Queue*); 292 int qwrite(Queue*, void*, int); 293 void qnoblock(Queue*, int); 294 int rand(void); 295 void randominit(void); 296 ulong randomread(void*, ulong); 297 void rdb(void); 298 int readnum(ulong, char*, ulong, ulong, int); 299 int readstr(ulong, char*, ulong, char*); 300 void ready(Proc*); 301 void rebootcmd(int, char**); 302 void reboot(void*, void*, ulong); 303 void relocateseg(Segment*, ulong); 304 void renameuser(char*, char*); 305 void resched(char*); 306 void resrcwait(char*); 307 int return0(void*); 308 void __rlock(RWlock*); 309 long rtctime(void); 310 void __runlock(RWlock*); 311 Proc* runproc(void); 312 void savefpregs(FPsave*); 313 void sched(void); 314 void scheddump(void); 315 void schedinit(void); 316 void (*screenputs)(char*, int); 317 long seconds(void); 318 ulong segattach(Proc*, ulong, char *, ulong, ulong); 319 void segclock(ulong); 320 void segpage(Segment*, Page*); 321 int setcolor(ulong, ulong, ulong, ulong); 322 void setkernur(Ureg*, Proc*); 323 void setmalloctag(void*, ulong); 324 void setrealloctag(void*, ulong); 325 void setregisters(Ureg*, char*, char*, int); 326 void setswapchan(Chan*); 327 char* skipslash(char*); 328 void sleep(Rendez*, int(*)(void*), void*); 329 void* smalloc(ulong); 330 int splhi(void); 331 int spllo(void); 332 void splx(int); 333 void splxpc(int); 334 char* srvname(Chan*); 335 int swapcount(ulong); 336 int swapfull(void); 337 void swapinit(void); 338 void timeradd(Timer*); 339 void timerdel(Timer*); 340 void timersinit(void); 341 void timerintr(Ureg*, Tval); 342 void timerset(Tval); 343 ulong tk2ms(ulong); 344 #define TK2MS(x) ((x)*(1000/HZ)) 345 uvlong tod2fastticks(vlong); 346 vlong todget(vlong*); 347 void todsetfreq(vlong); 348 void todinit(void); 349 void todset(vlong, vlong, int); 350 Block* trimblock(Block*, int, int); 351 void tsleep(Rendez*, int (*)(void*), void*, ulong); 352 int uartctl(Uart*, char*); 353 int uartgetc(void); 354 void uartkick(void*); 355 void uartmouse(Uart*, int (*)(Queue*, int), int); 356 void uartsetmouseputc(Uart*, int (*)(Queue*, int)); 357 void uartputc(int); 358 void uartputs(char*, int); 359 void uartrecv(Uart*, char); 360 int uartstageoutput(Uart*); 361 void unbreak(Proc*); 362 void uncachepage(Page*); 363 long unionread(Chan*, void*, long); 364 void __unlock(Lock*); 365 uvlong us2fastticks(uvlong); 366 void userinit(void); 367 ulong userpc(void); 368 long userwrite(char*, int); 369 void validaddr(ulong, ulong, int); 370 void validname(char*, int); 371 char* validnamedup(char*, int); 372 void validstat(uchar*, int); 373 void* vmemchr(void*, int, int); 374 Proc* wakeup(Rendez*); 375 int walk(Chan**, char**, int, int, int*); 376 void __wlock(RWlock*); 377 void __wunlock(RWlock*); 378 void* xalloc(ulong); 379 void* xallocz(ulong, int); 380 void xfree(void*); 381 void xhole(ulong, ulong); 382 void xinit(void); 383 int xmerge(void*, void*); 384 void* xspanalloc(ulong, int, ulong); 385 void xsummary(void); 386 void yield(void); 387 Segment* data2txt(Segment*); 388 Segment* dupseg(Segment**, int, int); 389 Segment* newseg(int, ulong, ulong); 390 Segment* seg(Proc*, ulong, int); 391 void hnputv(void*, uvlong); 392 void hnputl(void*, uint); 393 void hnputs(void*, ushort); 394 uvlong nhgetv(void*); 395 uint nhgetl(void*); 396 ushort nhgets(void*); 397 void _xinc(long*); 398 long _xdec(long*); 399 long lcycles(void); 400 401 402 // Plan 9 VX additions 403 void echo(char*, int); 404 long kbind(char*, char*, int); 405 Chan* knamec(char*, int, int, ulong); 406 void ksrvadd(Chan*, Chan*); 407 ulong msec(void); 408 void _ready(Proc*); 409 Proc* _runproc(void); 410 void uartecho(char*, int); 411 void vx32sysr1(void); 412 void vxnewproc(Proc*); 413 void mmusize(int); 414 void plimitproc(void*); 415 void ploadproc(void*);