From owner-freebsd-current@FreeBSD.ORG Sun Oct 15 13:56:40 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DA15016A412; Sun, 15 Oct 2006 13:56:40 +0000 (UTC) (envelope-from clsung@FreeBSD.csie.nctu.edu.tw) Received: from FreeBSD.csie.nctu.edu.tw (freebsd.csie.nctu.edu.tw [140.113.17.209]) by mx1.FreeBSD.org (Postfix) with ESMTP id 64B5E43D49; Sun, 15 Oct 2006 13:56:40 +0000 (GMT) (envelope-from clsung@FreeBSD.csie.nctu.edu.tw) Received: from localhost (localhost.csie.nctu.edu.tw [127.0.0.1]) by FreeBSD.csie.nctu.edu.tw (Postfix) with ESMTP id 4F9FA7E908; Sun, 15 Oct 2006 21:57:11 +0800 (CST) Received: from FreeBSD.csie.nctu.edu.tw ([127.0.0.1]) by localhost (FreeBSD.csie.nctu.edu.tw [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jJoBqNjAdz1R; Sun, 15 Oct 2006 21:57:10 +0800 (CST) Received: by FreeBSD.csie.nctu.edu.tw (Postfix, from userid 1038) id A28897E98D; Sun, 15 Oct 2006 21:57:10 +0800 (CST) To: FreeBSD-gnats-submit@freebsd.org From: Cheng-Lung Sung X-send-pr-version: 3.113 X-GNATS-Notify: Message-Id: <20061015135710.A28897E98D@FreeBSD.csie.nctu.edu.tw> Date: Sun, 15 Oct 2006 21:57:10 +0800 (CST) Cc: freebsd-hackers@freebsd.org, freebsd-current@freebsd.org Subject: [PATCH] sys/sem.h should include sys/types.h X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Cheng-Lung Sung List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Oct 2006 13:56:41 -0000 >Submitter-Id: current-users >Originator: Cheng-Lung Sung >Organization: FreeBSD @ Taiwan >Confidential: no >Synopsis: [PATCH] sys/sem.h should include sys/types.h >Severity: non-critical >Priority: low >Category: kern >Class: sw-bug >Release: FreeBSD 6.1-PRERELEASE i386 >Environment: System: FreeBSD.csie.nctu.edu.tw 6.1-STABLE FreeBSD 6.1-STABLE #9: Thu May 11 14:31:45 CST 2006 root@FreeBSD.csie.nctu.edu.tw:/home/usr.obj/usr/src/sys/FREEBSD i386 >Description: - sys/sem.h has included sys/ipc.h, which includes sys/_types.h but it (and its including files) does not include sys/types.h - therefore, in sys/sem.h struct semid_ds declares "time_t sem_otime;" ...etc - if we only compile a program which do not include sys/types.h, it will fail. >How-To-Repeat: test the following program (copy from devel/ruby-sysvipc), named conftest.c: 1: #include 2: 3: /*top*/ 4: int 5: main () 6: { 7: if ((union semun *) 0) 8: return 0; 9: if (sizeof (union semun)) 10: return 0; 11: ; 12: return 0; 13: } We will got the following result: In file included from conftest.c:1: /usr/include/sys/sem.h:21: error: syntax error before "time_t" /usr/include/sys/sem.h:23: error: syntax error before "time_t" >Fix: Index: sys/sys/sem.h =================================================================== RCS file: /home/ncvs/src/sys/sys/sem.h,v retrieving revision 1.29 diff -u -r1.29 sem.h --- sys/sys/sem.h 17 Nov 2004 13:12:06 -0000 1.29 +++ sys/sys/sem.h 15 Oct 2006 13:47:37 -0000 @@ -10,6 +10,7 @@ #ifndef _SYS_SEM_H_ #define _SYS_SEM_H_ +#include #include struct sem;