[15643] in Athena Bugs

home help back first fref pref prev next nref lref last post

sun4 8.1.11: system header files: _POSIX_SOURCE and /usr/include/sys/stat.h

daemon@ATHENA.MIT.EDU (Darrin B. Jewell)
Tue Nov 4 08:35:59 1997

To: bugs@MIT.EDU
Cc: jewell@MIT.EDU
Date: Tue, 04 Nov 1997 08:35:30 EST
From: "Darrin B. Jewell" <jewell@MIT.EDU>

System name:		portnoy
Type and version:	SPARC/5 8.1.11 (with mkserv)
Display type:		cgthree

What were you trying to do?

Compile the following program:

#define _POSIX_SOURCE
#include <sys/types.h>
#include <sys/stat.h>
int
main(int argc, char *argv[])
{
  time_t t;
  int r;
  struct stat stat_buf;
  r = stat(".",&stat_buf);
  t = stat_buf.st_mtime;
  return(0);
}

Example compile:

%gcc foo.c
foo.c: In function `main':
foo.c:14: structure has no member named `tv_sec'

What's wrong:
  I think the system header files are broken when
_POSIX_SOURCE is defined.
  
What should have happened:
  The program should have compiled without error.
(I think; Please correct me if I'm wrong.)

Please describe any relevant documentation references:
  the POSIX Specification, Part 1: The C Language API
     (ISO/IEC 9945-1 / ANSI/IEEE std 1003.1)
  second edition 1996-07-12

home help back first fref pref prev next nref lref last post