Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Jan 2003 14:43:03 -0500 (EST)
From:      Craig Rodrigues <rodrigc@attbi.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   standards/47471: Update <sys/sem.h> to latest POSIX standard
Message-ID:  <200301251943.h0PJh3xb060834@h00609772adf0.ne.client2.attbi.com>

next in thread | raw e-mail | index | archive | help

>Number:         47471
>Category:       standards
>Synopsis:       Update <sys/sem.h> to latest POSIX standard
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 25 11:50:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Craig Rodrigues
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD h00609772adf0.ne.client2.attbi.com 5.0-CURRENT FreeBSD 5.0-CURRENT #13: Fri Jan 3 13:39:46 EST 2003 rodrigc@h00609772adf0.ne.client2.attbi.com:/usr/obj/usr/src/sys/MYKERNEL1 i386


	
>Description:

- including <sys/sem.h> should define pid_t and size_t
- third parameter to semop() should be size_t

See:
http://www.opengroup.org/onlinepubs/007904975/basedefs/sys/sem.h.html

>How-To-Repeat:
	
>Fix:


Index: lib/libc/sys/semop.2
===================================================================
RCS file: /home/ncvs/src/lib/libc/sys/semop.2,v
retrieving revision 1.17
diff -u -r1.17 semop.2
--- lib/libc/sys/semop.2	2002/12/18 09:22:31	1.17
+++ lib/libc/sys/semop.2	2003/01/25 19:38:39
@@ -38,7 +38,7 @@
 .In sys/ipc.h
 .In sys/sem.h
 .Ft int
-.Fn semop "int semid" "struct sembuf *array" "unsigned nops"
+.Fn semop "int semid" "struct sembuf *array" "size_t nops"
 .Sh DESCRIPTION
 The
 .Fn semop
Index: sys/kern/syscalls.master
===================================================================
RCS file: /home/ncvs/src/sys/kern/syscalls.master,v
retrieving revision 1.140
diff -u -r1.140 syscalls.master
--- sys/kern/syscalls.master	2003/01/04 11:41:12	1.140
+++ sys/kern/syscalls.master	2003/01/25 19:38:40
@@ -352,7 +352,7 @@
 			    union semun *arg); }
 221	MNOSTD	BSD	{ int semget(key_t key, int nsems, int semflg); }
 222	MNOSTD	BSD	{ int semop(int semid, struct sembuf *sops, \
-			    u_int nsops); }
+			    size_t nsops); }
 223	UNIMPL	NOHIDE	semconfig
 224	MNOSTD	BSD	{ int msgctl(int msqid, int cmd, \
 			    struct msqid_ds *buf); }
Index: sys/kern/sysv_sem.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/sysv_sem.c,v
retrieving revision 1.57
diff -u -r1.57 sysv_sem.c
--- sys/kern/sysv_sem.c	2003/01/21 08:55:55	1.57
+++ sys/kern/sysv_sem.c	2003/01/25 19:38:40
@@ -858,7 +858,7 @@
 struct semop_args {
 	int	semid;
 	struct	sembuf *sops;
-	u_int	nsops;
+	size_t	nsops;
 };
 #endif
 
@@ -871,14 +871,15 @@
 	struct semop_args *uap;
 {
 	int semid = uap->semid;
-	u_int nsops = uap->nsops;
+	size_t nsops = uap->nsops;
 	struct sembuf *sops;
 	struct semid_ds *semaptr;
 	struct sembuf *sopptr = 0;
 	struct sem *semptr = 0;
 	struct sem_undo *suptr;
 	struct mtx *sema_mtxp;
-	int i, j, error;
+	size_t i, j;
+	int error;
 	int do_wakeup, do_undos;
 
 	DPRINTF(("call to semop(%d, 0x%x, %u)\n", semid, sops, nsops));
Index: sys/sys/sem.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/sem.h,v
retrieving revision 1.25
diff -u -r1.25 sem.h
--- sys/sys/sem.h	2002/03/19 20:18:41	1.25
+++ sys/sys/sem.h	2003/01/25 19:38:41
@@ -96,12 +96,23 @@
 
 #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
+
 __BEGIN_DECLS
 int semsys(int, ...);
 int semctl(int, int, int, ...);
 int semget(key_t, int, int);
-int semop(int, struct sembuf *,unsigned);
+int semop(int, struct sembuf *,size_t);
 __END_DECLS
 #endif /* !_KERNEL */
 

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301251943.h0PJh3xb060834>