From owner-freebsd-bugs@FreeBSD.ORG Mon Apr 25 08:20:19 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE1B41065674 for ; Mon, 25 Apr 2011 08:20:18 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B9BA38FC15 for ; Mon, 25 Apr 2011 08:20:18 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p3P8KIcX028892 for ; Mon, 25 Apr 2011 08:20:18 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p3P8KImM028888; Mon, 25 Apr 2011 08:20:18 GMT (envelope-from gnats) Resent-Date: Mon, 25 Apr 2011 08:20:18 GMT Resent-Message-Id: <201104250820.p3P8KImM028888@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Robert Andersson Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76CBA106564A for ; Mon, 25 Apr 2011 08:15:51 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 650D98FC13 for ; Mon, 25 Apr 2011 08:15:51 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p3P8Fo3W030510 for ; Mon, 25 Apr 2011 08:15:50 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p3P8FoLj030509; Mon, 25 Apr 2011 08:15:50 GMT (envelope-from nobody) Message-Id: <201104250815.p3P8FoLj030509@red.freebsd.org> Date: Mon, 25 Apr 2011 08:15:50 GMT From: Robert Andersson To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/156637: sys/types.h can't be included when _XOPEN_SOURCE is defined X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2011 08:20:19 -0000 >Number: 156637 >Category: misc >Synopsis: sys/types.h can't be included when _XOPEN_SOURCE is defined >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Apr 25 08:20:18 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Robert Andersson >Release: FreeBSD 8.2-RELEASE i386 >Organization: >Environment: System: FreeBSD maya 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Fri Feb 18 02:24:46 UTC 2011 root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: When including with _XOPEN_SOURCE defined to 500 or higher, compila tion will fail with a message similar to this one (using clang, gcc fails with a similar message): In file included from main.c:3: /usr/include/sys/file.h:161:2: error: unknown type name 'u_int' u_int xf_flag; /* flags (see fcntl.h) */ u_int is defined in types.h, but it is wrapped in a #if __BSD_VISIBLE. __BSD_VISIBLE is defined in cdefs.h only if _POSIX_C_SOURCE is not defined (whic h it is if _XOPEN_SOURCE is defined). I found the following (short) thread about this problem from 2009: http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg69469.html >How-To-Repeat: Try to compile the following code: #define _XOPEN_SOURCE 500 #include int main(int argc, char *argv[]) { return 0; } >Fix: I'm not sure what the correct solution is. Any one of the following would solve the problem: * sys/file.h should not use u_int * The relevant parts of sys/file.h should be wrapped in #if __BSD_VISIBLE * The definition of u_int should not be wrapped in #if __BSD_VISIBLE * _XOPEN_SOURCE >= 500 should not imply _POSIX_C_SOURCE * _POSIX_C_SOURCE should not stop __BSD_VISIBLE from being defined. >Release-Note: >Audit-Trail: >Unformatted: