commit 1637a9ba1e97d97b1869b84511ec553bc914bcd2
Author: Sascha Wildner <saw@online.de>
Date:   Sun Jan 17 20:28:27 2010 +0100

    Adjust shared memory (shm) functions and headers to POSIX (bump?).

diff --git a/lib/libc/gen/shmat.c b/lib/libc/gen/shmat.c
index ccd1b76..93dbe00 100644
--- a/lib/libc/gen/shmat.c
+++ b/lib/libc/gen/shmat.c
@@ -1,6 +1,5 @@
 /*
  * $FreeBSD: src/lib/libc/gen/shmat.c,v 1.4 1999/08/27 23:58:56 peter Exp $
- * $DragonFly: src/lib/libc/gen/shmat.c,v 1.4 2005/11/19 22:32:53 swildner Exp $
  */
 
 #include <sys/types.h>
@@ -8,7 +7,7 @@
 #include <sys/shm.h>
 
 void *
-shmat(int shmid, void *shmaddr, int shmflg)
+shmat(int shmid, const void *shmaddr, int shmflg)
 {
 	return ((void *)shmsys(0, shmid, shmaddr, shmflg));
 }
diff --git a/lib/libc/gen/shmdt.c b/lib/libc/gen/shmdt.c
index 827f909..1606bca 100644
--- a/lib/libc/gen/shmdt.c
+++ b/lib/libc/gen/shmdt.c
@@ -1,13 +1,12 @@
 /*
  * $FreeBSD: src/lib/libc/gen/shmdt.c,v 1.4 1999/08/27 23:58:57 peter Exp $
- * $DragonFly: src/lib/libc/gen/shmdt.c,v 1.3 2005/11/13 00:07:42 swildner Exp $
  */
 
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
 
-int shmdt(void *shmaddr)
+int shmdt(const void *shmaddr)
 {
 	return (shmsys(2, shmaddr));
 }
diff --git a/lib/libc/gen/shmget.c b/lib/libc/gen/shmget.c
index 099c34c..9ba2bf4 100644
--- a/lib/libc/gen/shmget.c
+++ b/lib/libc/gen/shmget.c
@@ -1,13 +1,12 @@
 /*
  * $FreeBSD: src/lib/libc/gen/shmget.c,v 1.4 1999/08/27 23:58:57 peter Exp $
- * $DragonFly: src/lib/libc/gen/shmget.c,v 1.3 2005/11/13 00:07:42 swildner Exp $
  */
 
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
 
-int shmget(key_t key, int size, int shmflg)
+int shmget(key_t key, size_t size, int shmflg)
 {
 	return (shmsys(3, key, size, shmflg));
 }
diff --git a/lib/libc/sys/shmat.2 b/lib/libc/sys/shmat.2
index ea64294..aa0ab9a 100644
--- a/lib/libc/sys/shmat.2
+++ b/lib/libc/sys/shmat.2
@@ -24,9 +24,8 @@
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\" $FreeBSD: src/lib/libc/sys/shmat.2,v 1.8.2.6 2001/12/14 18:34:01 ru Exp $
-.\" $DragonFly: src/lib/libc/sys/shmat.2,v 1.2 2003/06/17 04:26:47 dillon Exp $
 .\"
-.Dd August 2, 1995
+.Dd January 17, 2010
 .Dt SHMAT 2
 .Os
 .Sh NAME
@@ -41,9 +40,9 @@
 .In sys/ipc.h
 .In sys/shm.h
 .Ft void *
-.Fn shmat "int shmid" "void *addr" "int flag"
+.Fn shmat "int shmid" "const void *addr" "int flag"
 .Ft int
-.Fn shmdt "void *addr"
+.Fn shmdt "const void *addr"
 .Sh DESCRIPTION
 .Fn Shmat
 attaches the shared memory segment identified by
diff --git a/lib/libc/sys/shmctl.2 b/lib/libc/sys/shmctl.2
index fcabedc..b87dc61 100644
--- a/lib/libc/sys/shmctl.2
+++ b/lib/libc/sys/shmctl.2
@@ -24,9 +24,8 @@
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\" $FreeBSD: src/lib/libc/sys/shmctl.2,v 1.9.2.4 2001/12/14 18:34:01 ru Exp $
-.\" $DragonFly: src/lib/libc/sys/shmctl.2,v 1.2 2003/06/17 04:26:47 dillon Exp $
 .\"
-.Dd July 17, 1995
+.Dd January 17, 2010
 .Dt SHMCTL 2
 .Os
 .Sh NAME
@@ -97,12 +96,14 @@ struct is defined as follows:
 .\" with nroff, but otherwise it's straight from sys/shm.h
 .\"
 .Bd -literal
+typedef unsigned int shmatt_t;
+
 struct shmid_ds {
     struct ipc_perm shm_perm;   /* operation permission structure */
-    int             shm_segsz;  /* size of segment in bytes */
-    pid_t           shm_lpid;   /* process ID of last shared memory op */
+    size_t          shm_segsz;  /* size of segment in bytes */
+    pid_t           shm_lpid;   /* process ID of last shm operation */
     pid_t           shm_cpid;   /* process ID of creator */
-    short           shm_nattch; /* number of current attaches */
+    shmatt_t        shm_nattch; /* number of current attaches */
     time_t          shm_atime;  /* time of last shmat() */
     time_t          shm_dtime;  /* time of last shmdt() */
     time_t          shm_ctime;  /* time of last change by shmctl() */
diff --git a/lib/libc/sys/shmget.2 b/lib/libc/sys/shmget.2
index 5e9a0ba..69e4394 100644
--- a/lib/libc/sys/shmget.2
+++ b/lib/libc/sys/shmget.2
@@ -26,7 +26,7 @@
 .\" $FreeBSD: src/lib/libc/sys/shmget.2,v 1.8.2.6 2001/12/14 18:34:01 ru Exp $
 .\" $DragonFly: src/lib/libc/sys/shmget.2,v 1.2 2003/06/17 04:26:47 dillon Exp $
 .\"
-.Dd July 3, 1995
+.Dd January 17, 2010
 .Dt SHMGET 2
 .Os
 .Sh NAME
@@ -40,7 +40,7 @@
 .In sys/ipc.h
 .In sys/shm.h
 .Ft int
-.Fn shmget "key_t key" "int size" "int flag"
+.Fn shmget "key_t key" "size_t size" "int flag"
 .Sh DESCRIPTION
 Based on the values of
 .Fa key
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 1b5080d..09f2191 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -361,11 +361,12 @@
 			    int msgflg); }
 227	STD	BSD	{ int msgrcv(int msqid, void *msgp, size_t msgsz, \
 			    long msgtyp, int msgflg); }
-228	STD	BSD	{ int shmat(int shmid, void *shmaddr, int shmflg); }
+228	STD	BSD	{ int shmat(int shmid, const void *shmaddr, \
+			    int shmflg); }
 229	STD	BSD	{ int shmctl(int shmid, int cmd, \
 			    struct shmid_ds *buf); }
-230	STD	BSD	{ int shmdt(void *shmaddr); }
-231	STD	BSD	{ int shmget(key_t key, int size, int shmflg); }
+230	STD	BSD	{ int shmdt(const void *shmaddr); }
+231	STD	BSD	{ int shmget(key_t key, size_t size, int shmflg); }
 ;
 232	STD	POSIX	{ int clock_gettime(clockid_t clock_id, \
 			    struct timespec *tp); }
diff --git a/sys/sys/shm.h b/sys/sys/shm.h
index 178f097..a9db1ac 100644
--- a/sys/sys/shm.h
+++ b/sys/sys/shm.h
@@ -1,5 +1,4 @@
 /* $FreeBSD: src/sys/sys/shm.h,v 1.14 1999/12/29 04:24:46 peter Exp $ */
-/* $DragonFly: src/sys/sys/shm.h,v 1.6 2006/09/30 20:03:44 swildner Exp $ */
 /*	$NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $	*/
 
 /*
@@ -51,13 +50,14 @@
 #define SHM_R       (IPC_R)
 #define SHM_W       (IPC_W)
 
+typedef unsigned int	shmatt_t;
 
 struct shmid_ds {
 	struct ipc_perm shm_perm;	/* operation permission structure */
-	int             shm_segsz;	/* size of segment in bytes */
-	pid_t           shm_lpid;   /* process ID of last shared memory op */
+	size_t          shm_segsz;	/* size of segment in bytes */
+	pid_t           shm_lpid;	/* process ID of last shm operation */
 	pid_t           shm_cpid;	/* process ID of creator */
-	short		shm_nattch;	/* number of current attaches */
+	shmatt_t	shm_nattch;	/* number of current attaches */
 	time_t          shm_atime;	/* time of last shmat() */
 	time_t          shm_dtime;	/* time of last shmdt() */
 	time_t          shm_ctime;	/* time of last change by shmctl() */
@@ -96,10 +96,10 @@ void	shmfork (struct proc *, struct proc *);
 
 __BEGIN_DECLS
 int shmsys (int, ...);
-void *shmat  (int, void *, int);
-int shmget (key_t, int, int);
+void *shmat  (int, const void *, int);
+int shmget (key_t, size_t, int);
 int shmctl (int, int, struct shmid_ds *);
-int shmdt  (void *);
+int shmdt  (const void *);
 __END_DECLS
 
 #endif /* !_KERNEL */
