9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] panic(?) and error(?)
@ 2002-08-25 14:22 Lucio De Re
  0 siblings, 0 replies; 6+ messages in thread
From: Lucio De Re @ 2002-08-25 14:22 UTC (permalink / raw)
  To: 9fans mailing list

I'd like some descriptions for functions error() and panic() as used
in /sys/src/cmd/9660srv/main.c and /sys/src/cmd/upas/fs/fs.c
respectively - and elsewhere, no doubt.

The arguments are different and I'm having difficulty understanding
whether they are functionally similar but retained for historical
reasons (what would be the "modern" equivalent?) or whether in fact
the choice depends on the context.

I note that 9660srv closes fds 0 and 1 and reopens them in the most
harmless manner (/dev/null), which upas/fs does not do and I wonder
if these are influencing the choice of error reporting.

Of course, I do have the source to consult, but little guidance on
where to look, even.

++L


^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [9fans] panic(?) and error(?)
@ 2002-08-25 14:43 presotto
  2002-08-25 15:14 ` Lucio De Re
  2002-08-25 15:27 ` Lucio De Re
  0 siblings, 2 replies; 6+ messages in thread
From: presotto @ 2002-08-25 14:43 UTC (permalink / raw)
  To: 9fans

Error() in upas/fs.c just exits the process after printing a message.
I didn't use sysfatal() because I want to kill off the entire process
group on error and sysfatal doesn't.  If I'ld used the thread package
I wouldn't have needed to do it that way.

It is totally unrelated to the error() in the kernel nor
error() in 9660srv.  They implements an exception
stack so that they can cleanly back out of errors without
crashing.

The similarity in name implies nothing about similarity in
function.


^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [9fans] panic(?) and error(?)
@ 2002-08-25 15:31 presotto
  2002-08-25 15:47 ` Lucio De Re
  0 siblings, 1 reply; 6+ messages in thread
From: presotto @ 2002-08-25 15:31 UTC (permalink / raw)
  To: 9fans

Try using grep.  It's amazingly useful since we (bel labs
crowd) use the convention of starting our routine defnitions
with the name on the left margin:

% cd /sys/src/cmd/9660srv
% grep -n '^(panic|error)' *.c
main.c:223: error(char *p)
main.c:558: panic(int rflag, char *fmt, ...)
% cd /sys/src/cmd/upas/fs
% grep -n '^(panic|error)' *.c
fs.c:1259: error(char *s)

Works well in the editor also.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-08-25 15:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-25 14:22 [9fans] panic(?) and error(?) Lucio De Re
2002-08-25 14:43 presotto
2002-08-25 15:14 ` Lucio De Re
2002-08-25 15:27 ` Lucio De Re
2002-08-25 15:31 presotto
2002-08-25 15:47 ` Lucio De Re

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).