delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/01/12/13:10:14

X-Spam-Check-By: sourceware.org
Message-ID: <43C69B77.1070304@users.sourceforge.net>
Date: Thu, 12 Jan 2006 12:09:59 -0600
From: "Yaakov S (Cygwin Ports)" <yselkowitz AT users DOT sourceforge DOT net>
User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Define _POSIX_SOURCE in cygwin's features.h?
References: <20060112173104 DOT GA30011 AT trixie DOT casa DOT cgf DOT cx>
In-Reply-To: <20060112173104.GA30011@trixie.casa.cgf.cx>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Christopher Faylor wrote:
> Someone on the cygwin irc channel had a problem building a package which
> would have been solved if Cygwin defined _POSIX_SOURCE.
> 
> I know that Cygwin is not fully POSIX compliant (I really really do) but
> I'm wondering if setting _POSIX_SOURCE in the cygwin headers wouldn't
> solve more porting problems than it creates.

I think it would be the opposite.

1) In glibc, _POSIX_SOURCE is defined by features.h based on a number of
conditions[1].  The newlib/Cygwin features.h isn't nearly so thorough.

[1]
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/include/features.h?cvsroot=glibc

2) After running a grep of /usr/include, it looks like arbitrarily
defining _POSIX_SOURCE in Cygwin would cause a significant number of
constants and functions to never be defined (and AFAICS there would be
no simple way to undef it within code), without actually adding
anything, for example:

/usr/include/dirent.h:#if !defined(MAXNAMLEN) && !defined(_POSIX_SOURCE)
/usr/include/fnmatch.h:#ifndef _POSIX_SOURCE
/usr/include/glob.h:#ifndef _POSIX_SOURCE
/usr/include/grp.h:#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
/usr/include/grp.h:#ifndef _POSIX_SOURCE
/usr/include/pwd.h:#ifndef _POSIX_SOURCE
/usr/include/pwd.h:#ifndef _POSIX_SOURCE
/usr/include/sys/dirent.h:#ifndef _POSIX_SOURCE
/usr/include/sys/fcntl.h:#ifndef        _POSIX_SOURCE
/usr/include/sys/fcntl.h:#ifndef        _POSIX_SOURCE
/usr/include/sys/fcntl.h:#ifndef        _POSIX_SOURCE
/usr/include/sys/fcntl.h:#ifndef        _POSIX_SOURCE
/usr/include/sys/fcntl.h:#ifndef        _POSIX_SOURCE
/usr/include/sys/select.h:#if !defined (_POSIX_SOURCE) && !defined
(__INSIDE_CYGWIN_NET__)
/usr/include/sys/stat.h:#ifndef _POSIX_SOURCE
/usr/include/sys/types.h:# ifndef       _POSIX_SOURCE
/usr/include/sys/types.h:# if !(defined (_POSIX_SOURCE) || defined
(_WINSOCK_H) || defined (__USE_W32_SOCKETS))
/usr/include/sys/unistd.h:#ifndef        _POSIX_SOURCE

3) I think that, in many cases, _POSIX_SOURCE is defined in code if
desired (and that would have been the best solution in the
aforementioned case).

4) I'm sure I remember a few times that, even when _POSIX_SOURCE was
defined in code, I had to #ifndef __CYGWIN__ that define due to compile
errors; I can't remember having to manually add such a define, however.

My $0.02, YMMV.


Yaakov

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDxpt3piWmPGlmQSMRAp2sAJ0TxKcHtdl7UCIk1+V3hvF121CRiQCgwnF5
JwyP3gsv3xzBvADntvAgyfo=
=CWnC
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019