From owner-freebsd-standards@FreeBSD.ORG Sun Feb 5 07:30:10 2012 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AE4A1065676 for ; Sun, 5 Feb 2012 07:30:10 +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 556638FC20 for ; Sun, 5 Feb 2012 07:30:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q157UA0M073767 for ; Sun, 5 Feb 2012 07:30:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q157UADm073763; Sun, 5 Feb 2012 07:30:10 GMT (envelope-from gnats) Resent-Date: Sun, 5 Feb 2012 07:30:10 GMT Resent-Message-Id: <201202050730.q157UADm073763@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-standards@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Eric Wong Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6612A106566B for ; Sun, 5 Feb 2012 07:20:06 +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 4FBCA8FC0A for ; Sun, 5 Feb 2012 07:20:06 +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 q157K5dt080871 for ; Sun, 5 Feb 2012 07:20:05 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q157K569080870; Sun, 5 Feb 2012 07:20:05 GMT (envelope-from nobody) Message-Id: <201202050720.q157K569080870@red.freebsd.org> Date: Sun, 5 Feb 2012 07:20:05 GMT From: Eric Wong To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: standards/164787: dirfd() function not available when _POSIX_C_SOURCE is defined X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Feb 2012 07:30:10 -0000 >Number: 164787 >Category: standards >Synopsis: dirfd() function not available when _POSIX_C_SOURCE is defined >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: Sun Feb 05 07:30:09 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Eric Wong >Release: 8.2-RELEASE >Organization: >Environment: FreeBSD f82 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011 root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: dirfd(3) is now specified in POSIX.1-2008, so it should be available when the _POSIX_C_SOURCE macro is defined to >= 200809L However, /usr/include/dirent.h only exposes the dirfd() macro if __BSD_VISIBLE is defined. However, __BSD_VISIBLE appears to be false if _POSIX_C_SOURCE is defined. >How-To-Repeat: /* * To build + link: * gcc -o dirfdtest dirfdtest.c * having _POSIX_C_SOURCE defined will cause this to fail link */ #define _POSIX_C_SOURCE 200809L #include int main(void) { DIR *dir = opendir("."); dirfd(dir); return 0; } >Fix: It's probably best to add dirfd() as a function to libc, allowing the opacity of the struct _dir_desc to be preserved. >Release-Note: >Audit-Trail: >Unformatted: