Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Apr 2011 22:09:16 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Garrett Cooper <yanefbsd@gmail.com>
Cc:        standards@freebsd.org
Subject:   Re: shmatt_t not present in FreeBSD?
Message-ID:  <20110425200916.GA96366@stack.nl>
In-Reply-To: <AANLkTilbgY6Le93-k2jRe-0FhEtZlym43I7dJyrwQN2M@mail.gmail.com>
References:  <AANLkTilbgY6Le93-k2jRe-0FhEtZlym43I7dJyrwQN2M@mail.gmail.com>

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

[-- Attachment #1 --]
On Sat, Jun 19, 2010 at 11:38:33PM -0700, Garrett Cooper wrote:
> I'm making some good progress on fixing up open_posix_testsuite to be
> more POSIX compliant and I noticed that shmatt_t is missing on
> FreeBSD. Is there any particular reason why it's missing?

> http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/shm.h.html

Probably because it was not added yet.

The attached patch builds, but I am not sure if the change from signed
to unsigned will break anything.

-- 
Jilles Tjoelker

[-- Attachment #2 --]
Index: lib/libc/sys/shmctl.2
===================================================================
--- lib/libc/sys/shmctl.2	(revision 220954)
+++ lib/libc/sys/shmctl.2	(working copy)
@@ -102,7 +102,7 @@
     size_t          shm_segsz;  /* size of segment in bytes */
     pid_t           shm_lpid;   /* process ID of last shared memory op */
     pid_t           shm_cpid;   /* process ID of creator */
-    int             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() */
Index: sys/compat/freebsd32/freebsd32_ipc.h
===================================================================
--- sys/compat/freebsd32/freebsd32_ipc.h	(revision 220954)
+++ sys/compat/freebsd32/freebsd32_ipc.h	(working copy)
@@ -72,7 +72,7 @@
 	int32_t		shm_segsz;
 	pid_t		shm_lpid;
 	pid_t		shm_cpid;
-	int		shm_nattch;
+	unsigned int	shm_nattch;
 	int32_t		shm_atime;
 	int32_t		shm_dtime;
 	int32_t		shm_ctime;
Index: sys/sys/shm.h
===================================================================
--- sys/sys/shm.h	(revision 220954)
+++ sys/sys/shm.h	(working copy)
@@ -90,12 +90,14 @@
 };
 #endif
 
+typedef unsigned int shmatt_t;
+
 struct shmid_ds {
 	struct ipc_perm shm_perm;	/* operation permission structure */
 	size_t          shm_segsz;	/* size of segment in bytes */
 	pid_t           shm_lpid;   /* process ID of last shared memory op */
 	pid_t           shm_cpid;	/* process ID of creator */
-	int		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() */
Index: usr.bin/ipcs/ipcs.c
===================================================================
--- usr.bin/ipcs/ipcs.c	(revision 220954)
+++ usr.bin/ipcs/ipcs.c	(working copy)
@@ -448,7 +448,7 @@
 		    group_from_gid(kshmptr->u.shm_perm.cgid, 0));
 
 	if (option & OUTSTANDING)
-		printf(" %12d",
+		printf(" %12u",
 		    kshmptr->u.shm_nattch);
 
 	if (option & BIGGEST)

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