vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

sysfile.ed (2134B)


      1 ,s!lock(f)!lock(\&f->ref.lk)!g
      2 ,s!lock(c)!lock(\&c->ref.lk)!g
      3 ,s!Chan \*c;!Chan *c = 0;!g
      4 ,s!ref(c)!ref(\&c->ref)!g
      5 ,s!^read(!doread(!
      6 ,s!return read(!return doread(!g
      7 /use varargs/,/va_end/c
      8 	// Plan 9 VX replaced dodgy varargs code
      9 	v = *(vlong*)&arg[3];
     10 .
     11 ,s!^write(!dowrite(!
     12 ,s!return write(!return dowrite(!g
     13 /use varargs/,/va_end/c
     14 	// Plan 9 VX replaced dodgy varargs code
     15 	v = *(vlong*)&arg[3];
     16 .
     17 g/^sys_/ s/ulong \*)/ulong *u)/
     18 g/va_list/d
     19 /^sysfd2path/s/ulong/uint32/
     20 /^syspipe/s/ulong/uint32/
     21 /^sysdup/s/ulong/uint32/
     22 /^sysopen/s/ulong/uint32/
     23 /^sysclose/s/ulong/uint32/
     24 /^doread/s/ulong/uint32/
     25 /^sys_read/s/ulong/uint32/
     26 /^syspread/s/ulong/uint32/
     27 /^dowrite/s/ulong/uint32/
     28 /^sys_write/s/ulong/uint32/
     29 /^syspwrite/s/ulong/uint32/
     30 /^sseek/s/ulong/uint32/
     31 /ulong/s/ulong/uint32/
     32 /^sysseek/s/ulong/uint32/
     33 /^sysoseek/s/ulong/uint32/
     34 .,/^}/g/ulong/s/ulong/uint32/
     35 /^sysfstat/s/ulong/uint32/
     36 /^sysstat/s/ulong/uint32/
     37 /^syschdir/s/ulong/uint32/
     38 /^sysbind/s/ulong/uint32/
     39 /^sysmount/s/ulong/uint32/
     40 /^sys_mount/s/ulong/uint32/
     41 /^sysunmount/s/ulong/uint32/
     42 /^syscreate/s/ulong/uint32/
     43 /^sysremove/s/ulong/uint32/
     44 /^syswstat/s/ulong/uint32/
     45 /^sysfwstat/s/ulong/uint32/
     46 /^sys_stat/s/ulong/uint32/
     47 /^sys_fstat/s/ulong/uint32/
     48 /^sys_wstat/s/ulong/uint32/
     49 /^sys_fwstat/s/ulong/uint32/
     50 /^syspassfd/s/ulong/uint32/
     51 /^syspassfd/.
     52 /^{/a
     53 	char *buf;
     54 .
     55 /validaddr/s/validaddr/buf = uvalidaddr/
     56 /(char\*)arg\[1\]/s/(char\*)arg\[1\]/buf/
     57 /^syspipe/.
     58 /^{/a
     59 	int *ufd;
     60 .
     61 /validaddr/s/validaddr/ufd = uvalidaddr/
     62 /((long\*)arg\[0\]/s/((long\*)arg\[0\])/ufd/
     63 /((long\*)arg\[0\]/s/((long\*)arg\[0\])/ufd/
     64 /^sysopen/.
     65 /^{/a
     66 	char *name;
     67 .
     68 /validaddr/s/validaddr/name = uvalidaddr/
     69 /(char\*)arg\[0\]/s/(char\*)arg\[0\]/name/
     70 /^dowrite/.
     71 /^{/a
     72 	uchar *p;
     73 .
     74 /validaddr/s/validaddr/p = uvalidaddr/
     75 /(void\*)arg\[1\]/s/(void\*)arg\[1\]/name/
     76 /^sseek/s/(/(vlong *ret, /
     77 /^sysseek/.
     78 /validaddr/s/validaddr\(.*\);/sseek(uvalidaddr&, arg);/
     79 /sseek/d
     80 $a
     81 
     82 // Plan 9 VX additions
     83 long
     84 kbind(char *new, char *old, int flag)
     85 {
     86 	return bindmount(1, 0, -1, -1, new, old, flag, nil);
     87 }
     88 
     89 long
     90 syspassfd(ulong *u)
     91 {
     92 	error("passfd unimplemented");
     93 	return -1;
     94 }
     95 
     96 .