Date: Fri, 27 Feb 1998 10:16:11 GMT From: Simon Marlow <simonm@dcs.gla.ac.uk> To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/5866: /usr/include/sys/time.h and _POSIX_SOURCE don't mix Message-ID: <199802271016.KAA07921@solander.dcs.gla.ac.uk>
next in thread | raw e-mail | index | archive | help
>Number: 5866 >Category: bin >Synopsis: can't include <sys/time.h> with _POSIX_SOURCE defined >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Feb 27 02:20:01 PST 1998 >Last-Modified: >Originator: Simon Marlow >Organization: University of Glasgow >Release: FreeBSD 3.0-CURRENT (25 Feb) >Environment: 3.0-CURRENT only, stable doesn't have this problem. >Description: <sys/time.h> uses some types from <sys/types.h> which aren't defined under _POSIX_SOURCE, and doesn't protect the relevant sections with #ifndef _POSIX_SOURCE. >How-To-Repeat: $ cat >test.c #define _POSIX_SOURCE #include <sys/time.h> ^D $ gcc test.c In file included from test.c:2: /usr/include/sys/time.h:120: parse error before `timecounter_get_t' /usr/include/sys/time.h:120: warning: data definition has no type or storage class /usr/include/sys/time.h:125: parse error before `timecounter_get_t' /usr/include/sys/time.h:125: warning: no semicolon at end of struct or union /usr/include/sys/time.h:142: parse error before `}' >Fix: I don't have access to the POSIX spec, so I have no idea what the right thing to do is. Here's a guess: *** time.h~ Wed Feb 25 16:47:38 1998 --- time.h Fri Feb 27 10:02:46 1998 *************** *** 116,121 **** --- 116,123 ---- * called attoseconds, it comes from "atten" for 18 in Danish/Swedish. */ + #ifndef _POSIX_SOURCE + struct timecounter; typedef u_int timecounter_get_t __P((struct timecounter *)); typedef u_int64_t timecounter_delta_t __P((void)); *************** *** 140,145 **** --- 142,148 ---- struct timecounter *other; struct timecounter *tweak; }; + #endif /* !_POSIX_SOURCE */ /* Operations on timevals. */ #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802271016.KAA07921>