[PATCH] sys/sem.h should include sys/types.h




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@xxxxxxxxxxxxxxxxxxxxxxxx:/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 <sys/sem.h>
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 <sys/types.h>
#include <sys/ipc.h>

struct sem;

_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • [PATCH] sys/sem.h should include sys/types.h
    ... if we only compile a program which do not include sys/types.h, it will fail. ...
    (freebsd-current)
  • Re: gcc 4 signed vs unsigned char
    ... > instead of using int, short, long ... ... My main aim is portability among platforms. ... types the compile would fail, which is actualy better than it silently ...
    (comp.lang.c)
  • Re: I request inclusion of reiser4 in the mainline kernel
    ... > should fail not warn? ... I don't care if it fails or warns at compile time, ... int znode_is_loaded; ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: int or bool?
    ... > What does it provide that int does not and are the two ... > entirely interchangable in conditional expressions? ... it will fail to compile. ...
    (comp.lang.cpp)
  • Re: Null MDE / MDB failure
    ... Yes we do know about the auto correct - all machines have this switched ... Then open the database in the older version and compile ... > differences on the machines that do fail. ... We use Access 2k to get to the MDE ...
    (microsoft.public.access.forms)