From owner-freebsd-hackers Tue Mar 12 17:48:54 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from pintail.mail.pas.earthlink.net (pintail.mail.pas.earthlink.net [207.217.120.122]) by hub.freebsd.org (Postfix) with ESMTP id 946E037B405 for ; Tue, 12 Mar 2002 17:48:50 -0800 (PST) Received: from pool0381.cvx40-bradley.dialup.earthlink.net ([216.244.43.126] helo=mindspring.com) by pintail.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 16kxsl-0003ZN-00; Tue, 12 Mar 2002 17:48:48 -0800 Message-ID: <3C8EAFE7.962590B3@mindspring.com> Date: Tue, 12 Mar 2002 17:48:23 -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: Craig Rodrigues Cc: freebsd-hackers@FreeBSD.ORG 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> 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 Craig Rodrigues wrote: > % gcc test.c > /tmp/cc6AHohn.o: In function `main': > /tmp/cc6AHohn.o(.text+0x11): undefined reference to `sigqueue' > /tmp/cc6AHohn.o(.text+0x22): undefined reference to `sigtimedwait' > /tmp/cc6AHohn.o(.text+0x31): undefined reference to `sigwaitinfo' > > If I look in signal.h, I find: > #ifdef _P1003_1B_VISIBLE > > __BEGIN_DECLS > int sigqueue __P((_BSD_PID_T_, int, const union sigval)); > int sigtimedwait __P((const sigset_t *, siginfo_t *, const struct timespec *)); > int sigwaitinfo __P((const sigset_t *, siginfo_t *)); > __END_DECLS > > #endif FreeBSD 4.5 doesn't define these externs in the _P1003_1B_VISIBLE case. The system call slots are reserved, but not defined. THe same is true of the Linux emulation. So: 1) Upgrade your FreeBSD; FreeBSD 4.3 gets this wrong. 2) Don't use these functions in FreeBSD. > So, apparently _P1003_1B_VISIBLE is somehow being defined by the > header files, but these particular functions are not available. The 4.3 header file is incorrectly conditioning the prototypes on the manifest constant you are using. According to my copy of the SUS v2, this is part of the queued signals interface extension for the POSIX RT extensions. THe correct feature test macro for this is: #ifdef _POSIX_REALTIME_SIGNALS A correct workaround, if that doesn't work, is: #if defined(_POSIX_REALTIME_SIGNALS) && defined(SIGRTMIN) The "bash" shell uses "SIGRTMIN". If you use *just* that, then your code will be broken on AIX, just like "bash" is broken on AIX. > Can someone tell me how I can detect if these functions are available > on a system at compile time? I cannot use an autoconf type of test, > and need to use a preprocessor macro type of test. > > It seems to me that this particular definition of _P1003_1B_VISIBLE > is broken if it is enabling symbols in header files to appear > which cannot be linked on a generically configured FreeBSD system. Yes. It's both broken in 4.3, and your uise of it instead of the real manifest constant, _POSIX_REALTIME_SIGNALS, is also broken. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message