Discussion:
[9fans] syscall tracing: errstr
(too old to reply)
Yaroslav
2012-08-23 17:10:15 UTC
Permalink
Anybody else noticed ratrace reporting an older errstr?

209051 mv Wstat 8cfe 0xdfffcef4/"bz" 0xc708 51 = -1 './bw' file does
not exist 1345738572648442848 1345738572649648848

I double checked: the wstat definitely returns Eperm on the wire:

Twstat tag 15 fid 1352 stat 'bw' '' '' '' q (ffffffffffffffff
4294967295 dalA) m 037777777777 at -1 mt -1 l -1 t 65535 d -1
Rerror tag 15 ename permission denied

Looking at /n/sources/plan9/sys/src/9/pc/trap.c:729,731 -- maybe
sysretfmt() should take up->syserrstr not up->errstr?




---------- Forwarded message ----------
From: Yaroslav <***@gmail.com>
Date: 2012/8/23
Subject: Re: [9fans] APE rename: wstat for 'none'
are you sure?
; touch bz
; ratrace -c mv bz bw >[2=1]| grep -v 'Stat|Brk'
you forgot auth/none...

; ratrace -c auth/none mv bz bw >[2=1]| grep -v ' none |Stat|Brk'
209051 mv Wstat 8cfe 0xdfffcef4/"bz" 0xc708 51 = -1 './bw' file does
not exist 1345738572648442848 1345738572649648848
209051 mv Open 3e05 0xdfffcef4/"bz" 0x0 = 3 "" 1345738572649753608
1345738572650669632
209051 mv Create 3e0d 0xdfffdef4/"./bw" 0x1 0x1b6 = 4 ""
1345738572651647673 1345738572653507377
209051 mv Pread 8d16 3 0xdfffae8c 8192 -1/"" 8192 -1 = 0 file does not
exist 1345738572653614652 1345738572654039559
209051 mv Close 3e15 3 = 0 "" 1345738572654426753 1345738572654851661
209051 mv Fwstat 8d1e 4 0xc708 49 = -1 './bw' file does not exist
1345738572655401443 1345738572655739187
209051 mv Remove 3dfd 0xdfffcef4/"bz" = 0 "" 1345738572656063524
1345738572656922558
209051 mv Close 3e15 4 = 0 "" 1345738572657094365 1345738572657555310
209051 mv Open 3e05 0xbbe4/"#c/pid" 0x0 = 3 "" 1345738572657805897
1345738572657894733
209051 mv Pread 8d16 3 0xdfffeefc 20 -1 0xdfffeefc/".....209051." 20
-1 = 12 "" 1345738572658193929 1345738572658201471
209051 mv Close 3e15 3 = 0 "" 1345738572658351488 1345738572658359031
209051 mv Exits 3e1d 0/""
--
- Yaroslav
erik quanstrom
2012-08-23 17:45:49 UTC
Permalink
Post by Yaroslav
Anybody else noticed ratrace reporting an older errstr?
yes. i see the same thing. should be using up->syserrstr not up->errstr, i think.

i took the liberty of removing any system call that's been dead for more than a decade. :-)

the format of ratrace output is still essentially unparsable, and it's not utf-8 safe.

- erik


; diffy -c ../port/*fmt*.c
/n/dump/2012/0823/sys/src/9/port/syscallfmt.c:80,86 - ../port/syscallfmt.c:80,85
p = va_arg(list, uintptr);
fmtprint(&fmt, "%#p", p);
break;
- case _ERRSTR: /* deprecated */
case CHDIR:
case EXITS:
case REMOVE:
/n/dump/2012/0823/sys/src/9/port/syscallfmt.c:124,136 - ../port/syscallfmt.c:123,128
argv++;
}
break;
- case _FSESSION: /* deprecated */
- case _FSTAT: /* deprecated */
- case _FWSTAT: /* obsolete */
- i[0] = va_arg(list, int);
- a = va_arg(list, char*);
- fmtprint(&fmt, "%d %#p", i[0], a);
- break;
case FAUTH:
i[0] = va_arg(list, int);
a = va_arg(list, char*);
/n/dump/2012/0823/sys/src/9/port/syscallfmt.c:144,159 - ../port/syscallfmt.c:136,141
v = va_arg(list, void*);
fmtprint(&fmt, "%#p", v);
break;
- case _MOUNT: /* deprecated */
- i[0] = va_arg(list, int);
- fmtprint(&fmt, "%d ", i[0]);
- a = va_arg(list, char*);
- fmtuserstring(&fmt, a, " ");
- i[0] = va_arg(list, int);
- fmtprint(&fmt, "%#ux ", i[0]);
- a = va_arg(list, char*);
- fmtuserstring(&fmt, a, "");
- break;
case OPEN:
a = va_arg(list, char*);
fmtuserstring(&fmt, a, " ");
/n/dump/2012/0823/sys/src/9/port/syscallfmt.c:160,182 - ../port/syscallfmt.c:142,151
i[0] = va_arg(list, int);
fmtprint(&fmt, "%#ux", i[0]);
break;
- case OSEEK: /* deprecated */
- i[0] = va_arg(list, int);
- l = va_arg(list, long);
- i[1] = va_arg(list, int);
- fmtprint(&fmt, "%d %ld %d", i[0], l, i[1]);
- break;
case SLEEP:
l = va_arg(list, long);
fmtprint(&fmt, "%ld", l);
break;
- case _STAT: /* obsolete */
- case _WSTAT: /* obsolete */
- a = va_arg(list, char*);
- fmtuserstring(&fmt, a, " ");
- a = va_arg(list, char*);
- fmtprint(&fmt, "%#p", a);
- break;
case RFORK:
i[0] = va_arg(list, int);
fmtprint(&fmt, "%#ux", i[0]);
/n/dump/2012/0823/sys/src/9/port/syscallfmt.c:203,209 - ../port/syscallfmt.c:172,177
break;
case NOTIFY:
case SEGDETACH:
- case _WAIT: /* deprecated */
v = va_arg(list, void*);
fmtprint(&fmt, "%#p", v);
break;
/n/dump/2012/0823/sys/src/9/port/syscallfmt.c:274,291 - ../port/syscallfmt.c:242,255
a = va_arg(list, char*);
fmtuserstring(&fmt, a, "");
break;
- case _READ: /* deprecated */
case PREAD:
i[0] = va_arg(list, int);
v = va_arg(list, void*);
l = va_arg(list, long);
fmtprint(&fmt, "%d %#p %ld", i[0], v, l);
- if(syscallno == PREAD){
- vl = va_arg(list, vlong);
- fmtprint(&fmt, " %lld", vl);
- }
+ vl = va_arg(list, vlong);
+ fmtprint(&fmt, " %lld", vl);
break;
- case _WRITE: /* deprecated */
case PWRITE:
i[0] = va_arg(list, int);
v = va_arg(list, void*);
/n/dump/2012/0823/sys/src/9/port/syscallfmt.c:294,303 - ../port/syscallfmt.c:258,265
len = MIN(l, 64);
fmtrwdata(&fmt, v, len, " ");
fmtprint(&fmt, "%ld", l);
- if(syscallno == PWRITE){
- vl = va_arg(list, vlong);
- fmtprint(&fmt, " %lld", vl);
- }
+ vl = va_arg(list, vlong);
+ fmtprint(&fmt, " %lld", vl);
break;
}

/n/dump/2012/0823/sys/src/9/port/syscallfmt.c:323,336 - ../port/syscallfmt.c:285,297
switch(syscallno){
default:
if(ret == -1)
- errstr = up->errstr;
+ errstr = up->syserrstr;
fmtprint(&fmt, " = %ld", ret);
break;
case ALARM:
- case _WRITE:
case PWRITE:
if(ret == -1)
- errstr = up->errstr;
+ errstr = up->syserrstr;
fmtprint(&fmt, " = %ld", ret);
break;
case EXEC:
/n/dump/2012/0823/sys/src/9/port/syscallfmt.c:338,344 - ../port/syscallfmt.c:299,305
case SEGATTACH:
case RENDEZVOUS:
if((void *)ret == (void*)-1)
- errstr = up->errstr;
+ errstr = up->syserrstr;
fmtprint(&fmt, " = %#p", (void *)ret);
break;
case AWAIT:
/n/dump/2012/0823/sys/src/9/port/syscallfmt.c:350,359 - ../port/syscallfmt.c:311,319
}
else{
fmtprint(&fmt, "%#p/\"\" %lud = %ld", a, l, ret);
- errstr = up->errstr;
+ errstr = up->syserrstr;
}
break;
- case _ERRSTR:
case ERRSTR:
a = va_arg(list, char*);
if(syscallno == _ERRSTR)
/n/dump/2012/0823/sys/src/9/port/syscallfmt.c:366,372 - ../port/syscallfmt.c:326,332
}
else{
fmtprint(&fmt, "\"\" %lud = %ld", l, ret);
- errstr = up->errstr;
+ errstr = up->syserrstr;
}
break;
case FD2PATH:
/n/dump/2012/0823/sys/src/9/port/syscallfmt.c:380,389 - ../port/syscallfmt.c:340,348
}
else{
fmtprint(&fmt, "\"\" %lud = %ld", l, ret);
- errstr = up->errstr;
+ errstr = up->syserrstr;
}
break;
- case _READ:
case PREAD:
i = va_arg(list, int);
USED(i);
/n/dump/2012/0823/sys/src/9/port/syscallfmt.c:395,401 - ../port/syscallfmt.c:354,360
}
else{
fmtprint(&fmt, "/\"\"");
- errstr = up->errstr;
+ errstr = up->syserrstr;
}
fmtprint(&fmt, " %ld", l);
if(syscallno == PREAD){
ron minnich
2012-08-27 04:10:15 UTC
Permalink
People occasionally pull old binaries from the archive and they still
run. I think it'd be nice if they could still be traced as well as
still run.

If a syscall is supported, then it should be possible to trace it.

ron
erik quanstrom
2012-08-27 06:27:42 UTC
Permalink
Post by ron minnich
People occasionally pull old binaries from the archive and they still
run. I think it'd be nice if they could still be traced as well as
still run.
If a syscall is supported, then it should be possible to trace it.
that sounds good as a slogan, but the pre 9p2000 calls were depricated
about a decade ago. i can't think of reasons to support them. it just leads
to dead and untested code, which threatens to persists for all time, like ttys. ☺

it's surprising how much junk code i removed from *nix* which was there
to support calls depricated before nix ever ran a up.

compatability is good. but too much of a good thing—that's usually a
different story.

- erik
erik quanstrom
2012-08-28 16:18:00 UTC
Permalink
against 9, not nix. Did you remove those system deprecated system
calls when you removed support for printing them?
i think we're in noisy agreement, and that's probablly my fault.
sorry.

i'd removed the _X syscalls about 3 months ago from both nix
and plan 9 since they really seem useless at this point (especially
in nix) and therefore i removed it from the tracing.

- erik
ron minnich
2012-08-28 19:36:34 UTC
Permalink
Post by erik quanstrom
i'd removed the _X syscalls about 3 months ago from both nix
and plan 9 since they really seem useless at this point (especially
in nix) and therefore i removed it from the tracing.
definitely makes sense if the calls are gone not to print them ...

ron
ron minnich
2012-08-28 16:02:08 UTC
Permalink
I'll say it again: if a syscall is supported, it should be possible to
trace it. If you remove a system call from Plan 9, then by all means
remove the syscallfmt support, of course. But if a system call is
still valid, and can be called, deprecated or not, I don't see the
point of not being able to trace it. I note that your patch was
against 9, not nix. Did you remove those system deprecated system
calls when you removed support for printing them?

ron

Loading...