From owner-freebsd-hackers Wed Mar 27 19: 8:36 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from gull.prod.itd.earthlink.net (gull.mail.pas.earthlink.net [207.217.120.84]) by hub.freebsd.org (Postfix) with ESMTP id 6A2B637B400; Wed, 27 Mar 2002 19:08:20 -0800 (PST) Received: from pool0516.cvx22-bradley.dialup.earthlink.net ([209.179.200.6] helo=mindspring.com) by gull.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16qQG4-0007Vp-00; Wed, 27 Mar 2002 19:07:25 -0800 Message-ID: <3CA288D7.E8D042A@mindspring.com> Date: Wed, 27 Mar 2002 19:07:03 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: BOUWSMA Beery Cc: hackers@freebsd.org, Jonathan Buzzard , "Garrett A. Wollman" Subject: Re: How to correctly detect POSIX 1003.1b features on FreeBSD? References: <20020312140904.A799@bbn.com> <3C8E742C.7C2E63B8@mindspring.com> <20020312193514.A2226@bbn.com> <20020313005940.GB32410@elvis.mu.org> <20020312201314.A2345@bbn.com> <3C8EB31E.19382903@mindspring.com> <20020312214007.A2526@bbn.com> <200203201907.g2KJ71R03929@beerswilling.netscum.dyndns.dk> <3C990F76.B66BEBF9@mindspring.com> <200203272243.g2RMh0Q01586@beerswilling.netscum.dyndns.dk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG BOUWSMA Beery wrote: > > Moin, moin! > %s wrote on %.3s, %lld Sep 1993 Your mailer is misconfigured... > > o The mlockall() function takes a flags argument that > > is an inclusive OR of one of several manifest > > constants. > > > > So basically, if you test for the manifest constants before > > making a call that uses them, then you are safe, e.g.: [ ... ] > /usr/bin/gcc -s -o radioclkd radioclkd.o > radioclkd.o: In function `Catch': > radioclkd.o(.text+0xd73): undefined reference to `munlockall' > radioclkd.o: In function `main': > radioclkd.o(.text+0x11e3): undefined reference to `mlockall' > *** Error code 1 FreeBSD is broken. It defines the manifests in scope, but specifically avoids the generation of the system call stubs by include "munlockall.o" and "mlockall.o" in /usr/src2/lib/libc/alpha/sys/Makefile.inc and /usr/src2/lib/libc/i386/sys/Makefile.inc in the "NOASM=" list of objects. Most of these objects have wrappers that are defined in the directory /usr/src2/lib/libc/gen or elsewhere in .c files. Actually, the undefined reference, and the fact that there was a "SYS_munlockall" defined in /usr/include/sys/syscalls.h should have been enough to send you to the libc sources. In any case, there are two possible explanations: o Listing these object files in the "NOASM=" was a mistake. Fix it by removing them from the "NOASM=" lines. o Listing these object files in the "NOASM=" was a bungled attempt to remove these system calls from the namespace, because they were incompletely implemented, and the bungling was in not "#if 0" outing the code and the manifest constants defined for the calls. Fix it by either completing the removal by changing the header files, OR Fix it by completing the implementation, and remove them from the "NOASM=" lines. In either case, my feature test code, though inelegant (as I said it was when I posted it), is correct. That leaves the FreeBSD code, and your code. You need to determine whether or not this was an error in the inclusion process for the calls, or an error in the exclusion process for the calls, befor you will know which is the right thing to do. Alternately, you could just implement the calls for FreeBSD, rather than leaving them stubbed out in the kernel, and then it's irrelevent what the intent was. Patches for implementing one of the options are welcome: o "#if 0" out the manigfests and function prototypes, until the implementation is complete. o Remove the object files from the "NOASM=" list, so that the stubbed-out system calls are defined in libc, even though they are stubbed out. Note: This seems wrong to me o Finish the implementation of the stubbed out system calls, and remove the object files from the "NOASM=" list so that they are properly defined. Pretty trivial to do the first two. The last one is harder; I personally can't really see a lot of value in having the system calls int he first place, so I imagine if the code is going to get done, it will be done by someone who wants to use them. Say someone who wants this badly enough to feature-test for the calls in code they are writing, instead of ignoring them... ;^). -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message