Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Nov 2002 17:02:44 -0500 (EST)
From:      Craig Rodrigues <rodrigc@attbi.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   standards/45274: msgsnd() improperly prototyped
Message-ID:  <200211132202.gADM2iFt014838@dibbler.ne.client2.attbi.com>

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

>Number:         45274
>Category:       standards
>Synopsis:       msgsnd() improperly prototyped
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 13 14:10:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Craig Rodrigues
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD dibbler.ne.client2.attbi.com 5.0-CURRENT FreeBSD 5.0-CURRENT #5: Thu Oct 31 19:26:04 EST 2002 rodrigc@dibbler.ne.client2.attbi.com:/usr/obj/usr/src/sys/MYKERNEL1 i386


	
>Description:
According to:
http://www.opengroup.org/onlinepubs/007904975/basedefs/sys/msg.h.html

the prototype for msgsnd() should be:

int       msgsnd(int, const void *, size_t, int);

but FreeBSD's prototype in <sys/msg.h> is missing the const qualifier:

int msgsnd(int, void *, size_t, int);

>How-To-Repeat:
	
>Fix:

Apply the following patch.  Since syscalls.master is changed,
src/sys/kern/makesyscalls.sh must be re-run.


--- src/sys/kern/syscalls.master.orig	Wed Nov 13 14:33:25 2002
+++ src/sys/kern/syscalls.master	Wed Nov 13 14:33:35 2002
@@ -357,7 +357,7 @@
 224	MNOSTD	BSD	{ int msgctl(int msqid, int cmd, \
 			    struct msqid_ds *buf); }
 225	MNOSTD	BSD	{ int msgget(key_t key, int msgflg); }
-226	MNOSTD	BSD	{ int msgsnd(int msqid, void *msgp, size_t msgsz, \
+226	MNOSTD	BSD	{ int msgsnd(int msqid, const void *msgp, size_t msgsz, \
 			    int msgflg); }
 227	MNOSTD	BSD	{ int msgrcv(int msqid, void *msgp, size_t msgsz, \
 			    long msgtyp, int msgflg); }
--- src/sys/kern/sysv_msg.c.orig	Tue Aug 13 04:00:36 2002
+++ src/sys/kern/sysv_msg.c	Wed Nov 13 15:14:51 2002
@@ -566,7 +566,7 @@
 #ifndef _SYS_SYSPROTO_H_
 struct msgsnd_args {
 	int	msqid;
-	void	*msgp;
+	const void	*msgp;
 	size_t	msgsz;
 	int	msgflg;
 };
@@ -581,7 +581,7 @@
 	register struct msgsnd_args *uap;
 {
 	int msqid = uap->msqid;
-	void *user_msgp = uap->msgp;
+	const void *user_msgp = uap->msgp;
 	size_t msgsz = uap->msgsz;
 	int msgflg = uap->msgflg;
 	int segs_needed, error = 0;
--- src/sys/sys/msg.h.orig	Wed Nov 13 14:11:49 2002
+++ src/sys/sys/msg.h	Wed Nov 13 14:12:02 2002
@@ -98,7 +98,7 @@
 int msgsys(int, ...);
 int msgctl(int, int, struct msqid_ds *);
 int msgget(key_t, int);
-int msgsnd(int, void *, size_t, int);
+int msgsnd(int, const void *, size_t, int);
 int msgrcv(int, void*, size_t, long, int);
 __END_DECLS
 #endif
--- src/lib/libc/gen/msgsnd.3.orig	Wed Nov 13 14:22:30 2002
+++ src/lib/libc/gen/msgsnd.3	Wed Nov 13 14:23:27 2002
@@ -44,7 +44,7 @@
 .In sys/ipc.h
 .In sys/msg.h
 .Ft int
-.Fn msgsnd "int msqid" "void *msgp" "size_t msgsz" "int msgflg"
+.Fn msgsnd "int msqid" "const void *msgp" "size_t msgsz" "int msgflg"
 .Sh DESCRIPTION
 The
 .Fn msgsnd
>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?200211132202.gADM2iFt014838>