From owner-freebsd-standards Sun Dec 8 7:11:42 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CCDC637B401 for ; Sun, 8 Dec 2002 07:11:40 -0800 (PST) Received: from popelschnipser.de (ultrakoreggd.org [217.160.78.206]) by mx1.FreeBSD.org (Postfix) with SMTP id 4D9A643EB2 for ; Sun, 8 Dec 2002 07:11:39 -0800 (PST) (envelope-from marc@informatik.uni-bremen.de) Received: (qmail 3802 invoked by uid 1048); 8 Dec 2002 15:11:38 -0000 Received: from marc@informatik.uni-bremen.de by p10089345 by uid 1045 with qmail-scanner-1.15 (clamscan: 0.54. spamassassin: 2.42. Clear:. Processed in 0.269665 secs); 08 Dec 2002 15:11:38 -0000 Received: from unknown (HELO ?192.168.100.100?) (217.227.199.133) by ultrakoreggd.org with SMTP; 8 Dec 2002 15:11:37 -0000 Date: Sun, 08 Dec 2002 16:11:37 +0100 From: Marc Recht To: freebsd-standards@freebsd.org Subject: POSIX and the real life or FreeBSD too strict ? Message-ID: <584000000.1039360297@leeloo.intern.geht.de> X-Mailer: Mulberry/3.0.0b9 (Linux/x86) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="==========2265712778==========" Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --==========2265712778========== Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi! While working with some third-party applications, which require the=20 availabilty of POSIX functions, I became conviced that FreeBSD is (way) too strict. IMHO no non-POSIX is=20 available isn't workable in the real world and isn't neccessary regarding=20 the standard. (IMHO it isn't even in the spirit of the standard..) If I=20 catched the standard correctly it demands only that the POSIX=20 function/defines/headers are available not that others are not. (Please=20 correct me if I'm wrong.) And, most important, it isn't done on the other UNIX implementations out=20 there (at least none I know about..). So we get needlessly a lot of=20 uncompileable code. Which forces vendors to do extra work to deal with=20 specifically. Are there any plans to change FreeBSD's behaviour to be less strict ? Best regards, Marc "Premature optimization is the root of all evil." -- Donald E. Knuth --==========2265712778========== Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE982Ep7YQCetAaG3MRAu0lAJ919CadDJUAxALMKjANn4afWyt9nwCcD+wf nSkaBj4LUBk8qmOsLBa0inQ= =LR3n -----END PGP SIGNATURE----- --==========2265712778==========-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sun Dec 8 12:39:58 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DAE3C37B401 for ; Sun, 8 Dec 2002 12:39:56 -0800 (PST) Received: from HAL9000.homeunix.com (12-232-220-15.client.attbi.com [12.232.220.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7506F43EBE for ; Sun, 8 Dec 2002 12:39:55 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id gB8Kdnas000765; Sun, 8 Dec 2002 12:39:49 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id gB8Kdn4x000764; Sun, 8 Dec 2002 12:39:49 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Date: Sun, 8 Dec 2002 12:39:49 -0800 From: David Schultz To: Marc Recht Cc: freebsd-standards@FreeBSD.ORG Subject: Re: POSIX and the real life or FreeBSD too strict ? Message-ID: <20021208203949.GA535@HAL9000.homeunix.com> Mail-Followup-To: Marc Recht , freebsd-standards@FreeBSD.ORG References: <584000000.1039360297@leeloo.intern.geht.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <584000000.1039360297@leeloo.intern.geht.de> Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thus spake Marc Recht : > I became conviced that FreeBSD is (way) too strict. IMHO no non-POSIX is > available isn't workable in the real world and isn't neccessary regarding > the standard. (IMHO it isn't even in the spirit of the standard..) If I > catched the standard correctly it demands only that the POSIX > function/defines/headers are available not that others are not. (Please > correct me if I'm wrong.) > And, most important, it isn't done on the other UNIX implementations out > there (at least none I know about..). So we get needlessly a lot of > uncompileable code. Which forces vendors to do extra work to deal with > specifically. > Are there any plans to change FreeBSD's behaviour to be less strict ? What you're asking for is reasonable, but there's a problem of namespace pollution. A application that uses only POSIX features is supposed to compile on a conforming implementation when _POSIX_C_SOURCE is appropriately defined. If standard headers add extra symbols and macros that are not specified in POSIX, you can't make that guarantee due to potential name conflicts. The whole point of using _POSIX_SOURCE is to turn of extensions that might break things. By the way, Solaris also has the behavior you're complaining about, but there is a workaround. If you define _POSIX_C_SOURCE, you get precisely the features specified in POSIX, and if you additionally define __EXTENSIONS__, you get everything. I'm not sure what ``other UNIX implementations'' you've been looking at, but a cursory glance at glibc reveals that it is in the same boat as FreeBSD. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sun Dec 8 13:13:46 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3EC0737B401 for ; Sun, 8 Dec 2002 13:13:44 -0800 (PST) Received: from popelschnipser.de (ultrakoreggd.org [217.160.78.206]) by mx1.FreeBSD.org (Postfix) with SMTP id 7158843EA9 for ; Sun, 8 Dec 2002 13:13:37 -0800 (PST) (envelope-from marc@informatik.uni-bremen.de) Received: (qmail 11457 invoked by uid 1048); 8 Dec 2002 21:13:35 -0000 Received: from marc@informatik.uni-bremen.de by p10089345 by uid 1045 with qmail-scanner-1.15 (clamscan: 0.54. spamassassin: 2.42. Clear:. Processed in 0.762984 secs); 08 Dec 2002 21:13:35 -0000 Received: from unknown (HELO ?192.168.100.100?) (217.227.199.133) by ultrakoreggd.org with SMTP; 8 Dec 2002 21:13:34 -0000 Date: Sun, 08 Dec 2002 22:13:33 +0100 From: Marc Recht To: David Schultz Cc: freebsd-standards@FreeBSD.ORG Subject: Re: POSIX and the real life or FreeBSD too strict ? Message-ID: <758430000.1039382013@leeloo.intern.geht.de> In-Reply-To: <20021208203949.GA535@HAL9000.homeunix.com> References: <584000000.1039360297@leeloo.intern.geht.de> <20021208203949.GA535@HAL9000.homeunix.com> X-Mailer: Mulberry/3.0.0b9 (Linux/x86) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="==========1354966650==========" Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --==========1354966650========== Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > What you're asking for is reasonable, but there's a problem of > namespace pollution. A application that uses only POSIX features > is supposed to compile on a conforming implementation when > _POSIX_C_SOURCE is appropriately defined. If standard headers add > extra symbols and macros that are not specified in POSIX, you > can't make that guarantee due to potential name conflicts. The > whole point of using _POSIX_SOURCE is to turn of extensions that > might break things. I don't say that there might be a perfect solution, but breaking source=20 compatibility to other UNIX implementation is IMHO worse. > By the way, Solaris also has the behavior you're complaining > about, but there is a workaround. If you define _POSIX_C_SOURCE, Hmm, not from my last experiences.. (But, I'm not doing that much on=20 Solaris.) > you get precisely the features specified in POSIX, and if you > additionally define __EXTENSIONS__, you get everything. I'm not IMHO something like that is absolutly neccessary. > sure what ``other UNIX implementations'' you've been looking at, > but a cursory glance at glibc reveals that it is in the same boat > as FreeBSD. I've tried the following two sources on FreeBSD-current (today), FreeBSD=20 4.7-RC, NetBSD 1.6 (gcc2.95), Solaris 8/Sparc (gcc 3.0) and Gentoo Linux (gcc 3.2, today). gcc -D_POSIX_C_SOURCE=3D200112L -D_XOPEN_SOURCE_=3D600=20 -D_XOPEN_SOURCE_EXTENDED=3D1 On -current both sources can't be compiled. On FreeBSD 4.x the first can't=20 be compiled (because of _SC_PAGE_SIZE). All other OSes compiled them just=20 fine. 1) #include #include int main() { long l =3D 0; l =3D sysconf(_SC_PAGE_SIZE); printf ("\nsize: %ld\n", l); return 0; } 2) #include #include int main() { return 0; } Regards, Marc "Premature optimization is the root of all evil." -- Donald E. Knuth --==========1354966650========== Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE987X97YQCetAaG3MRAsMwAKCIrNAx4UU25nrBSdMqoFG9xfDKFACfWcXM Diqjdhj5yUPwYnpmY3Mm57A= =GgMd -----END PGP SIGNATURE----- --==========1354966650==========-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sun Dec 8 13:44: 0 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 753DF37B401 for ; Sun, 8 Dec 2002 13:43:59 -0800 (PST) Received: from HAL9000.homeunix.com (12-232-220-15.client.attbi.com [12.232.220.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id C99EF43EB2 for ; Sun, 8 Dec 2002 13:43:58 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id gB8Lhvas001061; Sun, 8 Dec 2002 13:43:57 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id gB8LhvdK001060; Sun, 8 Dec 2002 13:43:57 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Date: Sun, 8 Dec 2002 13:43:57 -0800 From: David Schultz To: Marc Recht Cc: freebsd-standards@FreeBSD.ORG Subject: Re: POSIX and the real life or FreeBSD too strict ? Message-ID: <20021208214357.GA945@HAL9000.homeunix.com> Mail-Followup-To: Marc Recht , freebsd-standards@FreeBSD.ORG References: <584000000.1039360297@leeloo.intern.geht.de> <20021208203949.GA535@HAL9000.homeunix.com> <758430000.1039382013@leeloo.intern.geht.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <758430000.1039382013@leeloo.intern.geht.de> Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thus spake Marc Recht : > I've tried the following two sources on FreeBSD-current (today), FreeBSD > 4.7-RC, NetBSD 1.6 (gcc2.95), > Solaris 8/Sparc (gcc 3.0) and Gentoo Linux (gcc 3.2, today). > gcc -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE_=600 > -D_XOPEN_SOURCE_EXTENDED=1 > On -current both sources can't be compiled. On FreeBSD 4.x the first can't > be compiled (because of _SC_PAGE_SIZE). All other OSes compiled them just > fine. If you say -D_XOPEN_SOURCE=600 instead of -D_XOPEN_SOURCE_=600, the first test works fine. ;-) The second one looks like a bug in FreeBSD. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sun Dec 8 14:33:18 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8107037B401 for ; Sun, 8 Dec 2002 14:33:17 -0800 (PST) Received: from popelschnipser.de (ultrakoreggd.org [217.160.78.206]) by mx1.FreeBSD.org (Postfix) with SMTP id E47E943EB2 for ; Sun, 8 Dec 2002 14:33:15 -0800 (PST) (envelope-from marc@informatik.uni-bremen.de) Received: (qmail 13117 invoked by uid 1048); 8 Dec 2002 22:33:14 -0000 Received: from marc@informatik.uni-bremen.de by p10089345 by uid 1045 with qmail-scanner-1.15 (clamscan: 0.54. spamassassin: 2.42. Clear:. Processed in 0.267805 secs); 08 Dec 2002 22:33:14 -0000 Received: from unknown (HELO ?192.168.100.100?) (217.227.199.133) by ultrakoreggd.org with SMTP; 8 Dec 2002 22:33:14 -0000 Date: Sun, 08 Dec 2002 23:33:12 +0100 From: Marc Recht To: David Schultz Cc: freebsd-standards@FreeBSD.ORG Subject: Re: POSIX and the real life or FreeBSD too strict ? Message-ID: <794560000.1039386792@leeloo.intern.geht.de> In-Reply-To: <20021208214357.GA945@HAL9000.homeunix.com> References: <584000000.1039360297@leeloo.intern.geht.de> <20021208203949.GA535@HAL9000.homeunix.com> <758430000.1039382013@leeloo.intern.geht.de> <20021208214357.GA945@HAL9000.homeunix.com> X-Mailer: Mulberry/3.0.0b9 (Linux/x86) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="==========1984251422==========" Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --==========1984251422========== Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > If you say -D_XOPEN_SOURCE=3D600 instead of -D_XOPEN_SOURCE_=3D600, > the first test works fine. ;-) Argh, too much copying between the systems. That was the rewritten one.. l=20 =3D sysconf has been l =3D getpagesize(); before. Which gives you (Wall): implicit declaration of function=20 `getpagesize'. But, _only_ on FreeBSD 5-current. > The second one looks like a bug in FreeBSD. For me, too. Regards, Marc "Premature optimization is the root of all evil." -- Donald E. Knuth --==========1984251422========== Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE988ip7YQCetAaG3MRAjQ0AJ9gK7u5DAjqjJsq6nLE8WkBFT/xyACcCSfZ m3eZsvTBVlvyjXPdRRuA8cM= =14Ff -----END PGP SIGNATURE----- --==========1984251422==========-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sun Dec 8 16:13:58 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8710837B401 for ; Sun, 8 Dec 2002 16:13:57 -0800 (PST) Received: from espresso.q9media.com (espresso.q9media.com [65.39.129.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id B9F2543EB2 for ; Sun, 8 Dec 2002 16:13:56 -0800 (PST) (envelope-from mike@espresso.q9media.com) Received: by espresso.q9media.com (Postfix, from userid 1002) id 55B179C10; Sun, 8 Dec 2002 19:04:04 -0500 (EST) Date: Sun, 8 Dec 2002 19:04:04 -0500 From: Mike Barcroft To: Marc Recht Cc: David Schultz , freebsd-standards@FreeBSD.ORG Subject: Re: POSIX and the real life or FreeBSD too strict ? Message-ID: <20021208190404.H74206@espresso.q9media.com> References: <584000000.1039360297@leeloo.intern.geht.de> <20021208203949.GA535@HAL9000.homeunix.com> <758430000.1039382013@leeloo.intern.geht.de> <20021208214357.GA945@HAL9000.homeunix.com> <794560000.1039386792@leeloo.intern.geht.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <794560000.1039386792@leeloo.intern.geht.de>; from marc@informatik.uni-bremen.de on Sun, Dec 08, 2002 at 11:33:12PM +0100 Organization: The FreeBSD Project Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Marc Recht writes: > > If you say -D_XOPEN_SOURCE=600 instead of -D_XOPEN_SOURCE_=600, > > the first test works fine. ;-) > Argh, too much copying between the systems. That was the rewritten one.. l > = sysconf has been > l = getpagesize(); > before. Which gives you (Wall): implicit declaration of function > `getpagesize'. But, _only_ on FreeBSD 5-current. Did you even look at the header to find out why? The conditional says `#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE'. From this, one might draw the conclusion that getpagesize() was supported in X/Open up until version 500 (SUSv2). Now, compare this to the actual standards and one finds that in SUSv2 getpagesize() was marked LEGACY and in SUSv3 it was removed. If you want SUSv2 functions, use _XOPEN_SOURCE=500 and an appropriate _POSIX_C_SOURCE version. > > The second one looks like a bug in FreeBSD. > For me, too. As I explained in another thread in -current, requesting a standard and then using headers outside that standard's scope is unsupported. This is why no one has bother to change u_int to unsigned int in most non-standard headers. As for the extention to allow POSIX and BSD object to both be visible by defining an extra constant, I don't think this is a very good idea. You end up with each OS having a different escape word, each being unportable. A much more portable solution would be not to request a specific standard at all if one requires things outside that standard's scope. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sun Dec 8 16:16:56 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CD3B137B401 for ; Sun, 8 Dec 2002 16:16:55 -0800 (PST) Received: from HAL9000.homeunix.com (12-232-220-15.client.attbi.com [12.232.220.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0EB6943EC2 for ; Sun, 8 Dec 2002 16:16:50 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id gB90Gjas001678; Sun, 8 Dec 2002 16:16:46 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id gB90GjFP001677; Sun, 8 Dec 2002 16:16:45 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Date: Sun, 8 Dec 2002 16:16:45 -0800 From: David Schultz To: Marc Recht Cc: freebsd-standards@FreeBSD.ORG Subject: Re: POSIX and the real life or FreeBSD too strict ? Message-ID: <20021209001645.GA1618@HAL9000.homeunix.com> Mail-Followup-To: Marc Recht , freebsd-standards@FreeBSD.ORG References: <584000000.1039360297@leeloo.intern.geht.de> <20021208203949.GA535@HAL9000.homeunix.com> <758430000.1039382013@leeloo.intern.geht.de> <20021208214357.GA945@HAL9000.homeunix.com> <794560000.1039386792@leeloo.intern.geht.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <794560000.1039386792@leeloo.intern.geht.de> Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thus spake Marc Recht : > >If you say -D_XOPEN_SOURCE=600 instead of -D_XOPEN_SOURCE_=600, > >the first test works fine. ;-) > Argh, too much copying between the systems. That was the rewritten one.. l > = sysconf has been > l = getpagesize(); > before. Which gives you (Wall): implicit declaration of function > `getpagesize'. But, _only_ on FreeBSD 5-current. Yes, but Solaris 8 and glibc disagree about whether _XOPEN_SOURCE_EXTENDED is required. As for FreeBSD, I think your general complaint about it being too picky is invalid; everyone else does things the same way, and standards even require that no extra symbols are defined by standard headers unless otherwise requested. But you seem to have discovered that not all of the appropriate functions are declared when _XOPEN_SOURCE is defined. In addition to getpagesize(), brk() and chroot() should be declared when _XOPEN_SOURCE is defined, for example. For the most part, these are interfaces that originally appeared in BSD and later made it into SUS, and the FreeBSD headers were never updated properly. If you have the time, you could come up with a patch to move the appropriate functions from an '#if __BSD_VISIBLE' to an '#if __BSD_VISIBLE || __XSI_VISIBLE'. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sun Dec 8 17:10:18 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 402DA37B401 for ; Sun, 8 Dec 2002 17:10:17 -0800 (PST) Received: from HAL9000.homeunix.com (12-232-220-15.client.attbi.com [12.232.220.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id 71DB243EBE for ; Sun, 8 Dec 2002 17:10:16 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id gB91AFas001906; Sun, 8 Dec 2002 17:10:15 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id gB91AFD1001905; Sun, 8 Dec 2002 17:10:15 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Date: Sun, 8 Dec 2002 17:10:15 -0800 From: David Schultz To: Marc Recht , freebsd-standards@FreeBSD.ORG Subject: Re: POSIX and the real life or FreeBSD too strict ? Message-ID: <20021209011015.GA1859@HAL9000.homeunix.com> Mail-Followup-To: Marc Recht , freebsd-standards@FreeBSD.ORG References: <584000000.1039360297@leeloo.intern.geht.de> <20021208203949.GA535@HAL9000.homeunix.com> <758430000.1039382013@leeloo.intern.geht.de> <20021208214357.GA945@HAL9000.homeunix.com> <794560000.1039386792@leeloo.intern.geht.de> <20021209001645.GA1618@HAL9000.homeunix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021209001645.GA1618@HAL9000.homeunix.com> Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Thus spake David Schultz : > If you have the time, you could come up with a patch to move the > appropriate functions from an '#if __BSD_VISIBLE' to an > '#if __BSD_VISIBLE || __XSI_VISIBLE'. Scratch that, I'm running an old -CURRENT: RCS file: /cvs/src/include/unistd.h,v ---------------------------- revision 1.64 date: 2002/11/12 14:41:49; author: mike; state: Exp; lines: +18 -11 Fix XSI (X/Open) namespace support. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Dec 9 1: 0:34 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A7D1037B401 for ; Mon, 9 Dec 2002 01:00:32 -0800 (PST) Received: from popelschnipser.de (ultrakoreggd.org [217.160.78.206]) by mx1.FreeBSD.org (Postfix) with SMTP id 640FB43EB2 for ; Mon, 9 Dec 2002 01:00:25 -0800 (PST) (envelope-from marc@informatik.uni-bremen.de) Received: (qmail 25239 invoked by uid 1048); 9 Dec 2002 09:00:18 -0000 Received: from marc@informatik.uni-bremen.de by p10089345 by uid 1045 with qmail-scanner-1.15 (clamscan: 0.54. spamassassin: 2.42. Clear:. Processed in 0.416538 secs); 09 Dec 2002 09:00:18 -0000 Received: from unknown (HELO ?192.168.100.100?) (217.227.198.245) by ultrakoreggd.org with SMTP; 9 Dec 2002 09:00:17 -0000 Date: Mon, 09 Dec 2002 10:00:16 +0100 From: Marc Recht To: Mike Barcroft Cc: David Schultz , freebsd-standards@FreeBSD.org Subject: Re: POSIX and the real life or FreeBSD too strict ? Message-ID: <1000970000.1039424416@leeloo.intern.geht.de> In-Reply-To: <20021208190404.H74206@espresso.q9media.com> References: <584000000.1039360297@leeloo.intern.geht.de> <20021208203949.GA535@HAL9000.homeunix.com> <758430000.1039382013@leeloo.intern.geht.de> <20021208214357.GA945@HAL9000.homeunix.com> <794560000.1039386792@leeloo.intern.geht.de> <20021208190404.H74206@espresso.q9media.com> X-Mailer: Mulberry/3.0.0b9 (Linux/x86) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="==========2026292363==========" Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --==========2026292363========== Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > Did you even look at the header to find out why? The conditional says Yes. > `#if __XSI_VISIBLE <=3D 500 || __BSD_VISIBLE'. From this, one might > draw the conclusion that getpagesize() was supported in X/Open up > until version 500 (SUSv2). Now, compare this to the actual standards > and one finds that in SUSv2 getpagesize() was marked LEGACY and in > SUSv3 it was removed. If you want SUSv2 functions, use > _XOPEN_SOURCE=3D500 and an appropriate _POSIX_C_SOURCE version. You didn't get my point. I know exactly why it fails. _But_ the on other=20 systems I've tried it doesn't (call it broken or not). > As I explained in another thread in -current, requesting a standard > and then using headers outside that standard's scope is unsupported. > This is why no one has bother to change u_int to unsigned int in > most non-standard headers. > > As for the extention to allow POSIX and BSD object to both be visible > by defining an extra constant, I don't think this is a very good idea. > You end up with each OS having a different escape word, each being > unportable. A much more portable solution would be not to request a > specific standard at all if one requires things outside that > standard's scope. But what gains us a standard if nobody except us cares about it ? Regards, Marc "Premature optimization is the root of all evil." -- Donald E. Knuth --==========2026292363========== Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE99Fug7YQCetAaG3MRAjRlAJoCRUGtxiYzV3Q3YvUzsAa9iBrEqwCfUb8w zfzLW7zeaAY7AVwvob5yKD0= =aEtz -----END PGP SIGNATURE----- --==========2026292363==========-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Dec 9 1: 5:34 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C1F7C37B401 for ; Mon, 9 Dec 2002 01:05:32 -0800 (PST) Received: from popelschnipser.de (ultrakoreggd.org [217.160.78.206]) by mx1.FreeBSD.org (Postfix) with SMTP id 4415F43EC2 for ; Mon, 9 Dec 2002 01:05:31 -0800 (PST) (envelope-from marc@informatik.uni-bremen.de) Received: (qmail 25390 invoked by uid 1048); 9 Dec 2002 09:05:30 -0000 Received: from marc@informatik.uni-bremen.de by p10089345 by uid 1045 with qmail-scanner-1.15 (clamscan: 0.54. spamassassin: 2.42. Clear:. Processed in 0.262019 secs); 09 Dec 2002 09:05:30 -0000 Received: from unknown (HELO ?192.168.100.100?) (217.227.198.245) by ultrakoreggd.org with SMTP; 9 Dec 2002 09:05:29 -0000 Date: Mon, 09 Dec 2002 10:05:28 +0100 From: Marc Recht To: David Schultz Cc: freebsd-standards@FreeBSD.ORG Subject: Re: POSIX and the real life or FreeBSD too strict ? Message-ID: <1004540000.1039424728@leeloo.intern.geht.de> In-Reply-To: <20021209001645.GA1618@HAL9000.homeunix.com> References: <584000000.1039360297@leeloo.intern.geht.de> <20021208203949.GA535@HAL9000.homeunix.com> <758430000.1039382013@leeloo.intern.geht.de> <20021208214357.GA945@HAL9000.homeunix.com> <794560000.1039386792@leeloo.intern.geht.de> <20021209001645.GA1618@HAL9000.homeunix.com> X-Mailer: Mulberry/3.0.0b9 (Linux/x86) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="==========2355080028==========" Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --==========2355080028========== Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > Yes, but Solaris 8 and glibc disagree about whether > _XOPEN_SOURCE_EXTENDED is required. As for FreeBSD, I think your > general complaint about it being too picky is invalid; everyone > else does things the same way, and standards even require that no My experience is that others do it a little bit different. (Thefore this=20 thread..:)) Even FreeBSD 4.x does it different. > extra symbols are defined by standard headers unless otherwise IIRC then the standards says that no strictly conforming POSIX application=20 should be broken my system extensions. It doesn't describe how the system=20 should do that.. Regards, Marc "Premature optimization is the root of all evil." -- Donald E. Knuth --==========2355080028========== Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE99FzY7YQCetAaG3MRAhd2AJ44K94/tNRxQfmgWucHu976O/JzyQCgisbF w0Hs+TWXa84gIuMTdEEiwAc= =nes5 -----END PGP SIGNATURE----- --==========2355080028==========-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Dec 9 1:12:23 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3A1F037B401 for ; Mon, 9 Dec 2002 01:12:22 -0800 (PST) Received: from popelschnipser.de (ultrakoreggd.org [217.160.78.206]) by mx1.FreeBSD.org (Postfix) with SMTP id 9F0C143EBE for ; Mon, 9 Dec 2002 01:12:20 -0800 (PST) (envelope-from marc@informatik.uni-bremen.de) Received: (qmail 25536 invoked by uid 1048); 9 Dec 2002 09:12:19 -0000 Received: from marc@informatik.uni-bremen.de by p10089345 by uid 1045 with qmail-scanner-1.15 (clamscan: 0.54. spamassassin: 2.42. Clear:. Processed in 0.269912 secs); 09 Dec 2002 09:12:19 -0000 Received: from unknown (HELO ?192.168.100.100?) (217.227.198.245) by ultrakoreggd.org with SMTP; 9 Dec 2002 09:12:19 -0000 Date: Mon, 09 Dec 2002 10:12:17 +0100 From: Marc Recht To: Mike Barcroft Cc: David Schultz , freebsd-standards@FreeBSD.org Subject: Re: POSIX and the real life or FreeBSD too strict ? Message-ID: <1010050000.1039425137@leeloo.intern.geht.de> In-Reply-To: <20021208190404.H74206@espresso.q9media.com> References: <584000000.1039360297@leeloo.intern.geht.de> <20021208203949.GA535@HAL9000.homeunix.com> <758430000.1039382013@leeloo.intern.geht.de> <20021208214357.GA945@HAL9000.homeunix.com> <794560000.1039386792@leeloo.intern.geht.de> <20021208190404.H74206@espresso.q9media.com> X-Mailer: Mulberry/3.0.0b9 (Linux/x86) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="==========1793468691==========" Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --==========1793468691========== Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline [Sorry, missed that.] > As for the extention to allow POSIX and BSD object to both be visible > by defining an extra constant, I don't think this is a very good idea. > You end up with each OS having a different escape word, each being IMHO that extra define gains us much. It makes porting applications easier, = because I could just do: setenv CFLAGS "-D__EXTENSIONS" ./configure I don't have to change in the third-party app anything. The extra define=20 would cost us nothing and the manual could warn about it, like "You're=20 leaving POSIX island now.". > unportable. A much more portable solution would be not to request a > specific standard at all if one requires things outside that > standard's scope. But then you have to change third-party code. Regards, Marc "Premature optimization is the root of all evil." -- Donald E. Knuth --==========1793468691========== Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE99F5x7YQCetAaG3MRAv+EAJsGcekKBBR/VjsoG0ezmoDiIkwRswCfdCE4 oHGS7/MhvVULlKffJ1upRV4= =4X4C -----END PGP SIGNATURE----- --==========1793468691==========-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Dec 9 1:14:25 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9017737B406 for ; Mon, 9 Dec 2002 01:14:23 -0800 (PST) Received: from popelschnipser.de (ultrakoreggd.org [217.160.78.206]) by mx1.FreeBSD.org (Postfix) with SMTP id 2460043EA9 for ; Mon, 9 Dec 2002 01:14:22 -0800 (PST) (envelope-from marc@informatik.uni-bremen.de) Received: (qmail 25598 invoked by uid 1048); 9 Dec 2002 09:14:21 -0000 Received: from marc@informatik.uni-bremen.de by p10089345 by uid 1045 with qmail-scanner-1.15 (clamscan: 0.54. spamassassin: 2.42. Clear:. Processed in 0.551589 secs); 09 Dec 2002 09:14:21 -0000 Received: from unknown (HELO ?192.168.100.100?) (217.227.198.245) by ultrakoreggd.org with SMTP; 9 Dec 2002 09:14:20 -0000 Date: Mon, 09 Dec 2002 10:14:19 +0100 From: Marc Recht To: Mike Barcroft Cc: David Schultz , freebsd-standards@FreeBSD.org Subject: Re: POSIX and the real life or FreeBSD too strict ? Message-ID: <1012690000.1039425259@leeloo.intern.geht.de> X-Mailer: Mulberry/3.0.0b9 (Linux/x86) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="==========2115260060==========" Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --==========2115260060========== Content-Type: text/plain; charset=us-ascii; FORMAT=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > Did you even look at the header to find out why? The conditional says Yes. > `#if __XSI_VISIBLE <=3D 500 || __BSD_VISIBLE'. From this, one might > draw the conclusion that getpagesize() was supported in X/Open up > until version 500 (SUSv2). Now, compare this to the actual standards > and one finds that in SUSv2 getpagesize() was marked LEGACY and in > SUSv3 it was removed. If you want SUSv2 functions, use > _XOPEN_SOURCE=3D500 and an appropriate _POSIX_C_SOURCE version. You didn't get my point. I know exactly why it fails. _But_ the on other=20 systems I've tried it doesn't (call it broken or not). > As I explained in another thread in -current, requesting a standard > and then using headers outside that standard's scope is unsupported. > This is why no one has bother to change u_int to unsigned int in > most non-standard headers. > > As for the extention to allow POSIX and BSD object to both be visible > by defining an extra constant, I don't think this is a very good idea. > You end up with each OS having a different escape word, each being > unportable. A much more portable solution would be not to request a > specific standard at all if one requires things outside that > standard's scope. But what gains us a standard if nobody except us cares about it ? Regards, Marc "Premature optimization is the root of all evil." -- Donald E. Knuth --==========2115260060========== Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE99F7r7YQCetAaG3MRAuQqAJ9Jkd+GhE31j8ag+Vi9H25isYyJHwCfWLKu P+QLvibH2lhXNKa9BjM1p1o= =yLgK -----END PGP SIGNATURE----- --==========2115260060==========-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Dec 9 2:20: 6 2002 Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8591837B401 for ; Mon, 9 Dec 2002 02:20:02 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A1DE043EB2 for ; Mon, 9 Dec 2002 02:20:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gB9AK1x3021855 for ; Mon, 9 Dec 2002 02:20:01 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gB9AK1De021854; Mon, 9 Dec 2002 02:20:01 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 58E4737B401 for ; Mon, 9 Dec 2002 02:18:37 -0800 (PST) Received: from qostest.ip.tele.dk (qostest.ip.tele.dk [193.89.107.156]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9FFE543EB2 for ; Mon, 9 Dec 2002 02:18:36 -0800 (PST) (envelope-from ssch@qostest.ip.tele.dk) Received: from qostest.ip.tele.dk (localhost [127.0.0.1]) by qostest.ip.tele.dk (8.12.3/8.12.3) with ESMTP id gB9AIZNY012770; Mon, 9 Dec 2002 11:18:35 +0100 (CET) (envelope-from ssch@qostest.ip.tele.dk) Received: (from ssch@localhost) by qostest.ip.tele.dk (8.12.3/8.12.3/Submit) id gB9AHxoc012767; Mon, 9 Dec 2002 11:17:59 +0100 (CET) Message-Id: <200212091017.gB9AHxoc012767@qostest.ip.tele.dk> Date: Mon, 9 Dec 2002 11:17:59 +0100 (CET) From: steff@tdc.dk Reply-To: steff@tdc.dk To: FreeBSD-gnats-submit@FreeBSD.org Cc: steff@tdc.dk X-Send-Pr-Version: 3.113 Subject: standards/46119: Priority problems for SCHED_OTHER using pthreads Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >Number: 46119 >Category: standards >Synopsis: Priority problems for SCHED_OTHER using pthreads >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-standards >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Dec 09 02:20:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: Steffen Schumacher >Release: FreeBSD 4.6.1-RC2 i386 >Organization: TDC Tele Danmark A/S >Environment: Tested on two platforms.. System: FreeBSD XxXxX.ip.tele.dk 4.6.1-RC2 FreeBSD 4.6.1-RC2 #0: Thu Jul 18 08:24:45 GMT 2002 root@freebsd-stable.sentex.ca:/usr/src/sys/compile/GENERIC i386 Pentium 3 750 MHz, 384 MB ram (basic home office pc) System2: FreeBSD xXxXxX.ip.tele.dk 4.7-STABLE FreeBSD 4.7-STABLE #1: Tue Oct 29 16:24:29 CET 2002 root@xXxXxXxX.ip.tele.dk:/usr/src/sys/compile/QOSRC i386 Intel XEON 2.4 GHz, 1GB ram (Rack-server type pc) >Description: The POSIX functions sched_get_priority_max and sched_get_priority_min, is used for retrieving the max and min priority for a given scheduling policy. When you compile and execute a C++ program containing the line {cout << "max SCHED_OTHER = " << sched_get_priority_max(SCHED_OTHER) << ", min SCHED_OTHER = " << sched_get_priority_min(SCHED_OTHER) << endl;} the output is "max SCHED_OTHER = 20, , min SCHED_OTHER = -20". However, when I try to set the priority for a pthread_attr_t to anything not within the range [0:31], the value is reset to 15. This suggests that fx. -15 is not a valid value for the priority of a SCHED_OTHER policed thread, even though the POSIX functions sched_get_priority_min/max has a different opinion. I've tried to bypass the routines that set the priority for the pthread_attr_t-object using a sort of hack, and this actually enables me to set the value to what ever I wan't (since I'm bypassing any kind of errorchecking). But when I attempt to create a thread using this pthread_attr_t-object the core is dumped. So basically, I can't create threads with priorities other then [0:31] eventhough sched_get_priority_min/max says I should be able to. >How-To-Repeat: #include #include #include #include //This is our own copy of the struct defined in the freebsd-cvs repository, in the pthread library, prefixed with 'snuf_' struct snuf_pthread_attr { int sched_policy; int sched_inherit; int sched_interval; int prio; int suspend; int flags; void *arg_attr; void (*cleanup_attr) (); void *stackaddr_attr; size_t stacksize_attr; size_t guardsize_attr; }; void main() { pthread_t dummy; pthread_attr_t p_attr; struct sched_param schedparam; pthread_attr_init(&p_attr); pthread_attr_setdetachstate(&p_attr,PTHREAD_CREATE_DETACHED); pthread_attr_setinheritsched(&p_attr,PTHREAD_EXPLICIT_SCHED); int code = pthread_attr_setschedpolicy(&p_attr, SCHED_OTHER); if ( code != 0 ) { printf("Policy couldn't be set: %d\n", code ); if ( code == EINVAL ) { printf( "[EINVAL].\n" ); exit( 0 ); } if ( code == ENOTSUP ) { printf( "[ENOTSUP].\n" ); exit( 0 ); } } cout << "max SCHED_OTHER = " << sched_get_priority_max(SCHED_OTHER) << ", min SCHED_OTHER = " << sched_get_priority_min(SCHED_OTHER) << endl; schedparam.sched_priority = -15; //Attempting to set priority to -15 pthread_attr_setschedparam(&p_attr, &schedparam); if ( code != 0 ) { printf("pthread_attr_setschedparam failed: %d\n", code ); if ( code == EINVAL ) { printf( "[EINVAL].\n" ); exit( 0 ); } if ( code == ENOTSUP ) { printf( "[ENOTSUP].\n" ); exit( 0 ); } } //Read the value of the structmember prio using the snuf-struct.. cout << "address: " << p_attr << " prio would be: " << ((snuf_pthread_attr *)(p_attr))->prio << endl; //You can attempt to set the value of prio without any of the errorchecking provided by pthread_attr_setschedparam function //but this should first be attempted when you've certified that the pthread_attr_setschedparam isn't able to set the priovalue //to anything other then [0:31] //((snuf_pthread_attr *)(p_attr))->prio = 0; //Reading the value of the parameter: code = pthread_attr_getschedparam(&p_attr, &schedparam); if ( code != 0 ) { printf("Thread pthread_attr_getschedparam Failed: %d\n", code ); if ( code == EINVAL ) { printf( "[EINVAL] -> Report this as a bug.\n" ); exit( 0 ); } } cout << "Read the schedparam.prio to: " << schedparam.priority << endl; cout << "CREATING THREAD NOW!!!!\n"; code = pthread_create(&dummy, &p_attr, (void *(*)(void*))(INSERT_YOUR_OWN_FUNCTION_HERE), (void*)0); if ( code != 0 ) { printf("Thread Creation Failed: %d\n", code ); if ( code == EAGAIN ) { printf( "[EAGAIN] -> Report this as a bug.\n" ); exit( 0 ); } } pthread_attr_destroy(&p_attr); sleep(10); //Sleeping so that the program doesn't exit right away.. } >Fix: Well that really depends wether its the sched_get_priority_min/max macros that is incorrect or its the core functions of freeBSD. My knowledge of FreeBSD or any kind of UNIX type-OS dates only 4 months back, so I'm not really the right person to ask about this. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Dec 12 15:50: 4 2002 Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9215F37B401 for ; Thu, 12 Dec 2002 15:50:03 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 478C043EB2 for ; Thu, 12 Dec 2002 15:50:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gBCNo2x3054556 for ; Thu, 12 Dec 2002 15:50:02 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gBCNo25j054555; Thu, 12 Dec 2002 15:50:02 -0800 (PST) Date: Thu, 12 Dec 2002 15:50:02 -0800 (PST) Message-Id: <200212122350.gBCNo25j054555@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org Cc: From: Cedric Ware Subject: Re: standards/43780: PATCH: long long functions in stdlib.h should be wrappered with __STRICT_ANSI__ Reply-To: Cedric Ware Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG The following reply was made to PR standards/43780; it has been noted by GNATS. From: Cedric Ware To: freebsd-gnats-submit@FreeBSD.org, freebsd@bilogic.org Cc: Subject: Re: standards/43780: PATCH: long long functions in stdlib.h should be wrappered with __STRICT_ANSI__ Date: Fri, 13 Dec 2002 00:44:48 +0100 Hello, > > Compiling code that includes stdlib.h with the GCC options -ansi -pedantic > > reports the following warnings on two lines of stdlib.h: > > /usr/include/stdlib.h:110: warning: ANSI C does not support `long long' > > /usr/include/stdlib.h:114: warning: ANSI C does not support `long long' > > These lines are the strtoll and strtoull functions. > > This is fixed in -CURRENT. I'll try to get the change MFC'd for 4.8 (it's too > late to do it for 4.7). If I may butt in, wouldn't the timing be just about right? Thank you, Cedric Ware. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Dec 12 17:44:47 2002 Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A02BE37B401; Thu, 12 Dec 2002 17:44:46 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4AE5343EB2; Thu, 12 Dec 2002 17:44:46 -0800 (PST) (envelope-from tjr@FreeBSD.org) Received: from freefall.freebsd.org (tjr@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gBD1ikx3088945; Thu, 12 Dec 2002 17:44:46 -0800 (PST) (envelope-from tjr@freefall.freebsd.org) Received: (from tjr@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gBD1ijMu088940; Thu, 12 Dec 2002 17:44:45 -0800 (PST) Date: Thu, 12 Dec 2002 17:44:45 -0800 (PST) From: "Tim J. Robbins" Message-Id: <200212130144.gBD1ijMu088940@freefall.freebsd.org> To: freebsd@bilogic.org, tjr@FreeBSD.org, freebsd-standards@FreeBSD.org Subject: Re: standards/43780: PATCH: long long functions in stdlib.h should be wrappered with __STRICT_ANSI__ Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Synopsis: PATCH: long long functions in stdlib.h should be wrappered with __STRICT_ANSI__ State-Changed-From-To: open->closed State-Changed-By: tjr State-Changed-When: Thu Dec 12 17:42:17 PST 2002 State-Changed-Why: Fixed in revision 1.16.2.5 of stdlib.h. Thanks for pointing this out. http://www.freebsd.org/cgi/query-pr.cgi?pr=43780 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Dec 12 17:50: 3 2002 Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DD14A37B404 for ; Thu, 12 Dec 2002 17:50:02 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7E34D43EA9 for ; Thu, 12 Dec 2002 17:50:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gBD1o2x3089037 for ; Thu, 12 Dec 2002 17:50:02 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gBD1o2jl089036; Thu, 12 Dec 2002 17:50:02 -0800 (PST) Date: Thu, 12 Dec 2002 17:50:02 -0800 (PST) Message-Id: <200212130150.gBD1o2jl089036@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org Cc: From: Tim Robbins Subject: Re: standards/43780: PATCH: long long functions in stdlib.h should be wrappered with __STRICT_ANSI__ Reply-To: Tim Robbins Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG The following reply was made to PR standards/43780; it has been noted by GNATS. From: Tim Robbins To: Cedric Ware Cc: freebsd-gnats-submit@FreeBSD.org, freebsd@bilogic.org Subject: Re: standards/43780: PATCH: long long functions in stdlib.h should be wrappered with __STRICT_ANSI__ Date: Fri, 13 Dec 2002 12:42:05 +1100 On Thu, Dec 12, 2002 at 03:50:02PM -0800, Cedric Ware wrote: > If I may butt in, wouldn't the timing be just about right? Thanks for the reminder. I've just committed a patch that should fix this problem. Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Fri Dec 13 8:50:47 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0A7BA37B401 for ; Fri, 13 Dec 2002 08:50:47 -0800 (PST) Received: from espresso.q9media.com (espresso.q9media.com [65.39.129.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id BAFB743EC5 for ; Fri, 13 Dec 2002 08:50:46 -0800 (PST) (envelope-from mike@espresso.q9media.com) Received: by espresso.q9media.com (Postfix, from userid 1002) id 9A39D9C10; Fri, 13 Dec 2002 11:40:38 -0500 (EST) Date: Fri, 13 Dec 2002 11:40:38 -0500 From: Mike Barcroft To: standards@FreeBSD.org Subject: strerror() Message-ID: <20021213114038.A61753@espresso.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Organization: The FreeBSD Project Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I'm working on fixing strerror_r() in light of PR 44356. I'm wondering if anyone can explain why strerror() has an inline itoa procedure, instead of using snprintf(3). The comment says: /* Do this by hand, so we don't link to stdio(3). */ ...and the commit log says: revision 5.6 date: 1991/05/04 13:45:45; author: bostic; state: Exp; lines: +20 -6 don't include stdio(3), do itoa inline I thought it may have been to make strerror() async-signal-safe, but POSIX doesn't list it as an async-signal-safe function. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Fri Dec 13 9: 3:11 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A526737B401; Fri, 13 Dec 2002 09:03:08 -0800 (PST) Received: from mailhub.fokus.gmd.de (mailhub.fokus.gmd.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id DF20E43EB2; Fri, 13 Dec 2002 09:03:06 -0800 (PST) (envelope-from brandt@fokus.gmd.de) Received: from beagle (beagle [193.175.132.100]) by mailhub.fokus.gmd.de (8.11.6/8.11.6) with ESMTP id gBDH34J18110; Fri, 13 Dec 2002 18:03:04 +0100 (MET) Date: Fri, 13 Dec 2002 18:03:04 +0100 (CET) From: Harti Brandt To: Mike Barcroft Cc: standards@FreeBSD.ORG Subject: Re: strerror() In-Reply-To: <20021213114038.A61753@espresso.q9media.com> Message-ID: <20021213175700.W904-100000@beagle.fokus.gmd.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, 13 Dec 2002, Mike Barcroft wrote: MB> MB>I'm working on fixing strerror_r() in light of PR 44356. I'm MB>wondering if anyone can explain why strerror() has an inline itoa MB>procedure, instead of using snprintf(3). The comment says: MB>/* Do this by hand, so we don't link to stdio(3). */ MB>...and the commit log says: MB>revision 5.6 MB>date: 1991/05/04 13:45:45; author: bostic; state: Exp; lines: +20 -6 MB>don't include stdio(3), do itoa inline MB> MB>I thought it may have been to make strerror() async-signal-safe, but MB>POSIX doesn't list it as an async-signal-safe function. That is probably because programs that use strerror() but don't use any of the stdio functions don't get all the stdio-cruft linked in. harti -- harti brandt, http://www.fokus.gmd.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.gmd.de, brandt@fokus.fhg.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Fri Dec 13 10: 8:19 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9A2AC37B401 for ; Fri, 13 Dec 2002 10:08:10 -0800 (PST) Received: from espresso.q9media.com (espresso.q9media.com [65.39.129.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0FB6743EDA for ; Fri, 13 Dec 2002 10:08:10 -0800 (PST) (envelope-from mike@espresso.q9media.com) Received: by espresso.q9media.com (Postfix, from userid 1002) id B7AEA9BC3; Fri, 13 Dec 2002 12:58:16 -0500 (EST) Date: Fri, 13 Dec 2002 12:58:16 -0500 From: Mike Barcroft To: standards@FreeBSD.org Subject: strerror.diff and se-regress.shar for review Message-ID: <20021213125816.C61753@espresso.q9media.com> References: <20021213114038.A61753@espresso.q9media.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="cWoXeonUoKmBZSoM" Content-Disposition: inline In-Reply-To: <20021213114038.A61753@espresso.q9media.com>; from mike@FreeBSD.org on Fri, Dec 13, 2002 at 11:40:38AM -0500 Organization: The FreeBSD Project Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --cWoXeonUoKmBZSoM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Attached is my patch to resolved PR 44356 (strerror.diff). I've also taken the liberty of moving strerror()/strerror_r()'s regression tests into src/tools/regression/lib/libc (se-regress.shar). Comments appreciated. Best regards, Mike Barcroft --cWoXeonUoKmBZSoM Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="strerror.diff" Rearrange strerror() so that its itoa procedure can be used with strerror_r(). Doing this allows us to ensure that strerror_r() always fills the supplied buffer regardless of EINVAL or ERANGE errors. strerror()'s semantics have changed slightly such that an argument of 0 is now considered invalid and errno is set to EINVAL. Remove internal regression test for strerror() and strerror_r(). This will be reincarnated in src/tools/regression/lib/libc/string. In strerror(3), add a comment about strerror()'s bogus return type. PR: 44356 Index: strerror.3 =================================================================== RCS file: /work/repo/src/lib/libc/string/strerror.3,v retrieving revision 1.20 diff -u -r1.20 strerror.3 --- strerror.3 24 Oct 2002 01:24:26 -0000 1.20 +++ strerror.3 13 Dec 2002 16:45:51 -0000 @@ -115,7 +115,7 @@ unchanged and returns .Er EINVAL . Error numbers recognized by this implementation fall in -the range 0 \(<= +the range 0 \(< .Fa errnum < .Fa sys_nerr . @@ -168,6 +168,11 @@ .Fn strerror function will return its result in a static buffer which may be overwritten by subsequent calls. +.Pp +The return type for +.Fn strerror +is missing a type-qualifier; it should actually be +.Vt const char * . .Pp The .Fn perror Index: strerror.c =================================================================== RCS file: /work/repo/src/lib/libc/string/strerror.c,v retrieving revision 1.8 diff -u -r1.8 strerror.c --- strerror.c 3 Jul 2002 06:28:04 -0000 1.8 +++ strerror.c 13 Dec 2002 17:23:14 -0000 @@ -37,108 +37,62 @@ #include __FBSDID("$FreeBSD: src/lib/libc/string/strerror.c,v 1.8 2002/07/03 06:28:04 mini Exp $"); +#include #include #include -#include - -int -strerror_r(int errnum, char *strerrbuf, size_t buflen) -{ - int len; - if ((errnum >= 0) && (errnum < sys_nerr)) { - len = strlcpy(strerrbuf, (char *)sys_errlist[errnum], buflen); - return ((len < buflen) ? 0 : ERANGE); - } - return (EINVAL); -} - -char * -strerror(num) - int num; +#define UPREFIX "Unknown error: " +/* + * Define a buffer size big enough to describe a 64-bit signed integer + * converted to ASCII decimal (19 bytes), with an optional leading sign + * (1 byte), finally we get the prefix and a trailing NUL from UPREFIX. + */ +#define EBUFSIZE (20 + sizeof(UPREFIX)) + +/* Don't link to stdio(3) to avoid bloat for statically linked binaries. */ +static void +errstr(int num, char *buf, size_t len) { - char *p, *t; - unsigned int uerr; - static char const unknown_prefix[] = "Unknown error: "; - - /* - * Define a buffer size big enough to describe a 64-bit - * number in ASCII decimal (19), with optional leading sign - * (+1) and trailing NUL (+1). - */ -# define NUMLEN 21 -# define EBUFLEN (sizeof unknown_prefix + NUMLEN) - char tmp[NUMLEN]; /* temporary number */ - static char ebuf[EBUFLEN]; /* error message */ - - if ((num >= 0) && (num < sys_nerr)) - return ((char *)sys_errlist[num]); - - /* - * Set errno to EINVAL per P1003.1-200x Draft June 14, 2001. - */ - errno = EINVAL; + unsigned int uerr; + char *p, *t; + char tmp[EBUFSIZE]; - /* - * Print unknown errno by hand so we don't link to stdio(3). - * This collects the ASCII digits in reverse order. - */ - uerr = (num > 0) ? num : -num; + if (strlcpy(buf, UPREFIX, len) >= len) + return; t = tmp; + uerr = (num >= 0) ? num : -num; do { *t++ = "0123456789"[uerr % 10]; } while (uerr /= 10); if (num < 0) *t++ = '-'; - - /* - * Copy the "unknown" message and the number into the caller - * supplied buffer, inverting the number string. - */ - strcpy(ebuf, unknown_prefix); - for (p = ebuf + sizeof unknown_prefix - 1; t > tmp; ) + for (p = buf + strlen(UPREFIX); t > tmp && p < buf + len - 1;) *p++ = *--t; *p = '\0'; - return (ebuf); } -#ifdef STANDALONE_TEST +int +strerror_r(int errnum, char *strerrbuf, size_t buflen) +{ + int retval; -#include + retval = 0; + if (errnum < 1 || errnum >= sys_nerr) { + errstr(errnum, strerrbuf, buflen); + retval = EINVAL; + } else if (strlcpy(strerrbuf, sys_errlist[errnum], buflen) >= buflen) + retval = ERANGE; + return (retval); +} -main() +char * +strerror(int num) { - char mybuf[64]; - int ret; - - errno = 0; + static char ebuf[EBUFSIZE]; - printf("strerror(0) yeilds: %s\n", strerror(0)); - printf("strerror(1) yeilds: %s\n", strerror(1)); - printf("strerror(47) yeilds: %s\n", strerror(47)); - printf("strerror(sys_nerr - 1) yeilds: %s\n", strerror(sys_nerr - 1)); - printf("errno = %d\n", errno); errno = 0; - - printf("strerror(sys_nerr) yeilds: %s\n", strerror(sys_nerr)); - printf("errno = %d\n", errno); errno = 0; - - printf("strerror(437) yeilds: %s\n", strerror(437)); - printf("errno = %d\n", errno); errno = 0; - - printf("strerror(LONG_MAX) yeilds: %s\n", strerror(LONG_MAX)); - printf("strerror(LONG_MIN) yeilds: %s\n", strerror(LONG_MIN)); - printf("strerror(ULONG_MAX) yeilds: %s\n", strerror(ULONG_MAX)); - - memset(mybuf, '*', 63); mybuf[63] = '\0'; - strerror_r(11, mybuf, 64); - printf("strerror_r(11) yeilds: %s\n", mybuf); - - memset(mybuf, '*', 63); mybuf[63] = '\0'; - ret = strerror_r(1234, mybuf, 64); - printf("strerror_r(1234) returns %d (%s)\n", ret, mybuf); - - memset(mybuf, '*', 63); mybuf[63] = '\0'; - ret = strerror_r(1, mybuf, 10); - printf("strerror_r on short buffer returns %d (%s)\n", ret, mybuf); + if (num > 0 && num < sys_nerr) + return ((char *)sys_errlist[num]); + errno = EINVAL; + errstr(num, ebuf, sizeof(ebuf)); + return (ebuf); } -#endif --cWoXeonUoKmBZSoM Content-Type: application/x-shar Content-Disposition: attachment; filename="se-regress.shar" # Apply this in src/tools/regression/lib/libc # # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # string # string/Makefile # string/test-strerror.c # echo c - string mkdir -p string > /dev/null 2>&1 echo x - string/Makefile sed 's/^X//' >string/Makefile << 'END-of-string/Makefile' X# $FreeBSD$ X XTESTS= test-strerror X X.PHONY: tests Xtests: ${TESTS} X for p in ${TESTS}; do ${.OBJDIR}/$$p; done X X.PHONY: clean Xclean: X -rm -f ${TESTS} END-of-string/Makefile echo x - string/test-strerror.c sed 's/^X//' >string/test-strerror.c << 'END-of-string/test-strerror.c' X/*- X * Copyright (c) 2001 Wes Peters X * All rights reserved. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X * SUCH DAMAGE. X * X * $FreeBSD$ X */ X X#include X#include X#include X#include X#include X#include X Xint Xmain(void) X{ X char buf[64]; X char *sret; X int iret; X X /* X * strerror() failure tests. X */ X errno = 0; X sret = strerror(0); X assert(strcmp(sret, "Unknown error: 0") == 0); X assert(errno == EINVAL); X X errno = 0; X sret = strerror(INT_MAX); X snprintf(buf, sizeof(buf), "Unknown error: %d", INT_MAX); X assert(strcmp(sret, buf) == 0); X assert(errno == EINVAL); X X /* X * strerror() success tests. X */ X errno = 0; X sret = strerror(EPERM); X assert(strcmp(sret, "Operation not permitted") == 0); X assert(errno == 0); X X errno = 0; X sret = strerror(EPFNOSUPPORT); X assert(strcmp(sret, "Protocol family not supported") == 0); X assert(errno == 0); X X errno = 0; X sret = strerror(ELAST); X assert(errno == 0); X X printf("PASS strerror()\n"); X X /* X * strerror_r() failure tests. X */ X memset(buf, '*', sizeof(buf)); X iret = strerror_r(0, buf, sizeof(buf)); X assert(strcmp(buf, "Unknown error: 0") == 0); X assert(iret == EINVAL); X X memset(buf, '*', sizeof(buf)); X /* One byte too short. */ X iret = strerror_r(EPERM, buf, strlen("Operation not permitted")); X assert(strcmp(buf, "Operation not permitte") == 0); X assert(iret == ERANGE); X X memset(buf, '*', sizeof(buf)); X /* One byte too short. */ X iret = strerror_r(-1, buf, strlen("Unknown error: -1")); X assert(strcmp(buf, "Unknown error: -") == 0); X assert(iret == EINVAL); X X memset(buf, '*', sizeof(buf)); X /* Two bytes too short. */ X iret = strerror_r(-2, buf, strlen("Unknown error: -2") - 1); X assert(strcmp(buf, "Unknown error: ") == 0); X assert(iret == EINVAL); X X memset(buf, '*', sizeof(buf)); X /* Three bytes too short. */ X iret = strerror_r(-2, buf, strlen("Unknown error: -2") - 2); X assert(strcmp(buf, "Unknown error:") == 0); X assert(iret == EINVAL); X X memset(buf, '*', sizeof(buf)); X /* One byte too short. */ X iret = strerror_r(12345, buf, strlen("Unknown error: 12345")); X assert(strcmp(buf, "Unknown error: 1234") == 0); X assert(iret == EINVAL); X X /* X * strerror_r() success tests. X */ X memset(buf, '*', sizeof(buf)); X iret = strerror_r(EDEADLK, buf, sizeof(buf)); X assert(strcmp(buf, "Resource deadlock avoided") == 0); X assert(iret == 0); X X memset(buf, '*', sizeof(buf)); X iret = strerror_r(EPROCLIM, buf, sizeof(buf)); X assert(strcmp(buf, "Too many processes") == 0); X assert(iret == 0); X X printf("PASS strerror_r()\n"); X X exit(0); X} END-of-string/test-strerror.c exit --cWoXeonUoKmBZSoM-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sat Dec 14 13:44:49 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CDDEA37B401 for ; Sat, 14 Dec 2002 13:44:47 -0800 (PST) Received: from web13405.mail.yahoo.com (web13405.mail.yahoo.com [216.136.175.63]) by mx1.FreeBSD.org (Postfix) with SMTP id 863C043E4A for ; Sat, 14 Dec 2002 13:44:47 -0800 (PST) (envelope-from giffunip@yahoo.com) Message-ID: <20021214214447.42560.qmail@web13405.mail.yahoo.com> Received: from [200.24.79.218] by web13405.mail.yahoo.com via HTTP; Sat, 14 Dec 2002 22:44:47 CET Date: Sat, 14 Dec 2002 22:44:47 +0100 (CET) From: "=?iso-8859-1?q?Pedro=20F.=20Giffuni?=" Subject: Open Group's hdrchk test suite To: freebsd-standards@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, I was looking for some stuff related to the new TenDRA C project (http://www.tendra.org) and I found the following tool: Open Group's hdrchk =================== The hdrchk test suite is available from the Open Group at ftp://ftp.rdg.opengroup.org/pub/unsupported/stdtools/hdrchk/ fwiw, the result for Linux's glibc is here: http://www.gnu.org/software/libc/CONFORMANCE enjoy, Pedro. ______________________________________________________________________ Yahoo! Foto: salva, ritocca, condividi e ordina stampe professionali http://it.yahoo.com/mail_it/foot/?http://it.photos.yahoo.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message