From owner-freebsd-current Sun Jun 16 19:12:43 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id TAA04656 for current-outgoing; Sun, 16 Jun 1996 19:12:43 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id TAA04642 for ; Sun, 16 Jun 1996 19:12:35 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id MAA11393; Mon, 17 Jun 1996 12:02:21 +1000 Date: Mon, 17 Jun 1996 12:02:21 +1000 From: Bruce Evans Message-Id: <199606170202.MAA11393@godzilla.zeta.org.au> To: bde@zeta.org.au, fcurrent@jraynard.demon.co.uk Subject: Re: ktrace [Was: 2.2-960612-SNAP resolver problems] Cc: freebsd-current@freebsd.org, j@uriah.heep.sax.de, nate@sri.MT.net Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >The error message is not particularly informative, either:- >ktrace -f foobar ls >ktrace: Ù¿ïÙ¿ï"Ù¿ï)Ù¿ï: Function not implemented. >but this at least can easily be fixed:- >--- ktrace.c.orig Sun Jun 16 23:59:12 1996 >+++ ktrace.c Sun Jun 16 23:59:58 1996 >@@ -174,7 +174,10 @@ > error(name) > char *name; > { >- (void)fprintf(stderr, "ktrace: %s: %s.\n", name, strerror(errno)); >+ if (errno == ENOSYS) >+ noktrace(); >+ else >+ (void)fprintf(stderr, "ktrace: %s: %s.\n", name, strerror(errno)); > exit(1); > } Why doesn't it get a SIGSYS? Answer: someone "fixed" the ktrace syscall to always exist and return ENOSYS if KTRACE is not configured. This breaks the usual handling of unimplemented syscalls, which is to generate SIGSYS and return EINVAL. Grepping for ENOSYS in /sys/kern shows the same bug in oquota() and ENOSYS being confused with ENOTTY in pipe_ioctl(). Grepping for ENOSYS in /sys shows that ENOSYS otherwise used only in (presumably unfinished parts of) the ibcs2 and linux emulators. Bruce