kern/104436: [PATCH] sys/sem.h should include sys/types.h
John Baldwin
jhb at freebsd.org
Tue Oct 17 10:50:29 PDT 2006
The following reply was made to PR kern/104436; it has been noted by GNATS.
From: John Baldwin <jhb at freebsd.org>
To: Bruce Evans <bde at zeta.org.au>
Cc: Cheng-Lung Sung <clsung at freebsd.org>, FreeBSD-gnats-submit at freebsd.org
Subject: Re: kern/104436: [PATCH] sys/sem.h should include sys/types.h
Date: Tue, 17 Oct 2006 13:43:22 -0400
On Monday 16 October 2006 22:41, Bruce Evans wrote:
> On Tue, 17 Oct 2006, Cheng-Lung Sung wrote:
>
> > On Mon, Oct 16, 2006 at 02:31:24PM -0400, John Baldwin wrote:
> >> Is this better?
> >> ...
> > Thanks, I didn't go through the whole sem.h.
> > Also, it seems we should put these parts before 'sturct semid_ds'.
> > or say, after we include sys/ipc.h (which include sys/_types.h)
>
> Yes, that is especially needed for time_t, since it is the only one of
> the typedef'ed types used early in sys/sem.h. The others might be needed
> later when the non-typedefed types are cleaned up. (sys/ipc.h needs
> cleaning up more. It still spells uid_t as "unsigned short", but uids
> aren't that short...)
I know Robert wants to fix that, but hasn't due to the ABI breakage that
would ensue.
How's this, it removes extra includes of cdefs.h and _types.h (ipc.h
already includes them), moves the typedefs earlier and includes them
in the _KERNEL case (consistent with ipc.h) and fixes the whitespace
in the typedefs.
Index: sem.h
===================================================================
RCS file: /usr/cvs/src/sys/sys/sem.h,v
retrieving revision 1.29
diff -u -r1.29 sem.h
--- sem.h 17 Nov 2004 13:12:06 -0000 1.29
+++ sem.h 17 Oct 2006 17:41:20 -0000
@@ -12,6 +12,21 @@
#include <sys/ipc.h>
+#ifndef _PID_T_DECLARED
+typedef __pid_t pid_t;
+#define _PID_T_DECLARED
+#endif
+
+#ifndef _SIZE_T_DECLARED
+typedef __size_t size_t;
+#define _SIZE_T_DECLARED
+#endif
+
+#ifndef _TIME_T_DECLARED
+typedef __time_t time_t;
+#define _TIME_T_DECLARED
+#endif
+
struct sem;
struct semid_ds {
@@ -100,21 +115,8 @@
* Process sem_undo vectors at proc exit.
*/
void semexit(struct proc *p);
-#endif /* _KERNEL */
-#ifndef _KERNEL
-#include <sys/cdefs.h>
-#include <sys/_types.h>
-
-#ifndef _SIZE_T_DECLARED
-typedef __size_t size_t;
-#define _SIZE_T_DECLARED
-#endif
-
-#ifndef _PID_T_DECLARED
-typedef __pid_t pid_t;
-#define _PID_T_DECLARED
-#endif
+#else /* ! _KERNEL */
__BEGIN_DECLS
int semsys(int, ...);
@@ -122,6 +124,7 @@
int semget(key_t, int, int);
int semop(int, struct sembuf *, size_t);
__END_DECLS
+
#endif /* !_KERNEL */
#endif /* !_SYS_SEM_H_ */
--
John Baldwin
More information about the freebsd-bugs
mailing list