From owner-freebsd-commit Sat Oct 7 18:41:22 1995 Return-Path: owner-commit Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id SAA09021 for freebsd-commit-outgoing; Sat, 7 Oct 1995 18:41:22 -0700 Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id SAA09006 for cvs-all-outgoing; Sat, 7 Oct 1995 18:41:14 -0700 Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id SAA08992 for cvs-sys-outgoing; Sat, 7 Oct 1995 18:41:11 -0700 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.34]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id SAA08977 ; Sat, 7 Oct 1995 18:40:39 -0700 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id LAA10967; Sun, 8 Oct 1995 11:35:48 +1000 Date: Sun, 8 Oct 1995 11:35:48 +1000 From: Bruce Evans Message-Id: <199510080135.LAA10967@godzilla.zeta.org.au> To: CVS-commiters@freefall.freebsd.org, cvs-sys@freefall.freebsd.org, swallace@freefall.freebsd.org Subject: Re: cvs commit: src/sys/kern kern_exit.c uipc_syscalls.c Sender: owner-commit@FreeBSD.org Precedence: bulk > Modified: sys/kern kern_exit.c uipc_syscalls.c > Log: > Remove compat_43 psuedo-argument hack, and replace with a better hack. > Instead of using a fake "compat" argument, pass a real compat int to function > if COMPAT_43 is defined. Functions involved: wait4, accept, recvfrom, > getsockname. The global changes related to this get in my way a bit. I include everywhere necessary, and yesterday's changes caused errors for about 200 out of 220 syscalls. Most were for redefined arg structs. I hoped to reduce the number of changes by leaving the old bogusly placed arg struct declarations alone until later (I have about 500K of diffs for prototype-related changes in 350 files to commit when the 2.1 release stops getting in the way of current development). Some of the errors were for real inconsistencies. E.g., fcntl() is declared as having type `int fcntl(int fd, int cmd, void *arg)' in syscalls.master but its type is actually `int fcntl(int fd, int cmd, ...)' although it is documented as having type `int fcntl(int fd, int cmd, int arg)' in fcntl.1. The version with `int arg' is implemented (using bogus casts that fail when ints are 32 bits and pointers is 64 bits to convert `arg' to a pointer when the actual arg was a pointer). This breaks messily when there is a correct prototype in scope. In 4.4lite2 and presumably in NetBSD, fcntl() is implemented to support the `void *' version. The bogus handling of types is enshrined in syscallarg() and SCARG() macros. Many changes are required, and the type system is abused more than before :-(. The correct way to handle all this is to pass around `void *' args and cast them to pointers to the appropriate structs. If inline functions are allowed, then the casts and the uap's can be hidden inside automatically generated inline functions so that the sources look simple. > With the compat psuedo-argument, this introduces an argument structure > that can have two possible sizes depending on compat options. I was just looking at the compat kludge when I gave up on this last night. > This makes life difficult for lkm modules like ibcs2, which would > have to guess what size used in kernel when compiled. Also, > the prototype generator for these structures cannot generate proper sizes. > > Now there is only one fixed structure and makes everybody happy. Good. There is no such thing as a variant struct, `compat' is `#if defined(COMPAT_43) || defined(COMPAT_IBCS2)' in although it is used in all cases. The args struct declarations in are another thing that break when is included enough. > I recommend these changes be introduced to 2.1 so that ibcs2, linux > lkm's generated for 2.2 can still run on a 2.1 kernel. This area will change a lot soon. I doubt that 2.2 lkms will remain compatible for long. I think mine are already calling functions that don't exist in current, and I only added a few functions because the existing ones cause type mismatches if prototypes are in scope. ibcs2 currently causes about 200 lines of warnings here (with prototypes for all the syscall functions are in scope). These are mainly for passing args of the wrong type to fcntl(), ioctl() and lseek(). This is particularly annoying because the args must be repacked for these functions and it would be easy to pack them into the correct structs. Have you fixed some of these problems? There are suites of syscall type mismatches for the standard syscalls and for each emulated suite of syscalls. I hope to only have to fix the standard ones. Bruce