Bug 842244

Summary: Macro L_cuserid missing in /usr/include/stdio.h in F17
Product: [Fedora] Fedora Reporter: Joachim Backes <joachim.backes>
Component: glibcAssignee: Jeff Law <law>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: fweimer, jakub, law, pfrankli, schwab
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-23 15:46:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joachim Backes 2012-07-23 08:37:47 UTC
Description of problem:
The man page of getlogin(3) says that L_cuserid is  declared  in
<stdio.h>. But if I try to compile (gcc-4.7.0-5.fc17.x86_64) a little
source using L_cuserid

#include <unistd.h>
#include <stdio.h>
main () {
fprintf (stderr,"L_cuserid = %d",L_cuserid);
}


I get an error:

x.c: In function ‘main’:
x.c:4:34: error: ‘L_cuserid’ undeclared (first use in this function)
x.c:4:34: note: each undeclared identifier is reported only once for
each function it appears in

The source compiles correctly if I use -D_XOPEN_SOURCE or -D_GNU_SOURCE

Version-Release number of selected component (if applicable):
glibc-headers-2.15-51.fc17.x86_64

How reproducible:
always

Steps to Reproduce:
1.compile the above source
2.
3.
  
Actual results:
syntax error

Expected results:
compiles without any additional defines (such as the manpage says)

Additional info:

Installed on my box:

glibc-devel-2.15-51.fc17.x86_64
glibc-2.15-51.fc17.x86_64
glibc-2.15-51.fc17.i686
glibc-common-2.15-51.fc17.x86_64
glibc-headers-2.15-51.fc17.x86_64
glibc-devel-2.15-51.fc17.i686
gcc-java-4.7.0-5.fc17.x86_64
gcc-4.7.0-5.fc17.x86_64
gcc-c++-4.7.0-5.fc17.x86_64

Comment 1 Jeff Law 2012-07-23 15:46:51 UTC
The cuserid interfaces are documented as needing feature test macros in the man page:

  Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

       getlogin_r(): _REENTRANT || _POSIX_C_SOURCE >= 199506L
       cuserid(): _XOPEN_SOURCE

ie, it is expected that you need to define _XOPEN_SOURCE to use cuserid/L_cuserid.