From owner-freebsd-hackers Wed Oct 9 19:22:30 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6BB3337B401; Wed, 9 Oct 2002 19:22:28 -0700 (PDT) Received: from dibbler.ne.client2.attbi.com (dibbler.ne.client2.attbi.com [24.61.41.247]) by mx1.FreeBSD.org (Postfix) with ESMTP id AB37E43E4A; Wed, 9 Oct 2002 19:22:27 -0700 (PDT) (envelope-from rodrigc@attbi.com) Received: from dibbler.ne.client2.attbi.com (localhost.ne.attbi.com [127.0.0.1]) by dibbler.ne.client2.attbi.com (8.12.6/8.12.5) with ESMTP id g9A2N8CK010097; Wed, 9 Oct 2002 22:23:08 -0400 (EDT) (envelope-from rodrigc@dibbler.ne.client2.attbi.com) Received: (from rodrigc@localhost) by dibbler.ne.client2.attbi.com (8.12.6/8.12.6/Submit) id g9A2N8Ed010096; Wed, 9 Oct 2002 22:23:08 -0400 (EDT) Date: Wed, 9 Oct 2002 22:23:07 -0400 From: Craig Rodrigues To: freebsd-standards@freebsd.org Cc: freebsd-hackers@freebsd.org Subject: Problem detecting POSIX symbolic constants Message-ID: <20021009222307.A9894@attbi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i 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 Hi, Earlier this year on the FreeBSD hackers mailing list: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=278142+0+/usr/local/www/db/text/2002/freebsd-hackers/20020317.freebsd-hackers I was advised by Terry Lambert to use: #ifdef _POSIX_REALTIME_SIGNALS to detect if sigqueue(), sigtimedwait, sigwaitinfo() were defined. I made this change to the FreeBSD configuration for ACE, a C++ library used for systems programming ( http://www.cs.wustl.edu/~schmidt/ACE.html ). The change I made worked fine in -STABLE. However, in -CURRENT, this test breaks, because _POSIX_REALTIME_SIGNALS is defined, but it is -1. According to the letter of the law: http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap02.html "The following symbolic constants shall either be undefined or defined with a value other than -1." So, this is legal way to implement these macros. It just breaks my code. :) Can I appeal to the freebsd-standards team to leave these macros undefined instead of defining them to -1? #ifdef/#ifndef is a pretty common way to detect if a feature is available on a system, especially when used in conjunction with something like autoconf. If that is not an option, then what is the correct way for me to write my code? Keep in mind that code in ACE must be very portable, and work on platforms which may not adhere 100% to the letter of the POSIX law. Unfortunately ACE does not use autoconf, so these configurations need to be hardcoded. Here is my code, from config-freebsd-pthread.h from ACE: 210 #include 211 #include 212 /* POSIX Realtime signals are not fully implemented in FreeBSD. 213 When they are implemented, then _POSIX_REALTIME_SIGNALS will be 214 defined, as specified in the POSIX standard. 215 Refer to e-mail thread on freebsd-hackers mailing list, March 2002. */ 216 #ifdef _POSIX_REALTIME_SIGNALS 217 # define ACE_HAS_AIO_CALLS 218 # ifndef SIGRTMIN 219 # define SIGRTMIN 32 220 # endif /* SIGRTMIN */ 221 # ifndef SIGRTMAX 222 # define SIGRTMAX (_SIG_MAXSIG - 1) 223 # endif /* SIGRTMAX */ 224 #endif /* _POSIX_REALTIME_SIGNALS */ Thanks. -- Craig Rodrigues http://www.gis.net/~craigr rodrigc@attbi.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message