Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Dec 1995 14:57:13 -0500
From:      tsingle@sunland.gsfc.nasa.gov (Tim Singletary)
To:        hackers@freebsd.org
Subject:   /usr/include/sys/shm.h vs `man 2 shmget'
Message-ID:  <199512221957.OAA10601@sunward.gsfc.nasa.gov.gsfc743>

next in thread | raw e-mail | index | archive | help
In FreeBSD 2.1, `man 2 shmget' refers to SHM_R and SHM_W.  But these
names aren't defined anywhere.  Instead, /usr/include/sys/ipc.h
defines IPC_R and IPC_W.

Checking other versions of unix I find:

Solaris, SunOS, and HPUX define SHM_R and SHM_W in /usr/include/sys/shm.h
They don't define IPC_R or IPC_W anywhere.

OSF1 defines SHM_R and SHM_W in /usr/include/sys/shm.h and IPC_R and
IPC_W in /usr/include/sys/ipc.h.  Furthermore, OSF1's
/usr/include/sys/shm.h defines `#define SHM_R IPC_R' and
`#define SHM_W IPC_W'.

For maximum portability I recommend the following patch to 
/usr/include/sys/shm.h: 

=begin==============
*** shm.h-org	Sun Oct  2 13:24:54 1994
--- shm.h	Fri Dec 22 09:51:50 1995
***************
*** 44,49 ****
--- 44,51 ----
  #define SHM_RDONLY  010000  /* Attach read-only (else read-write) */
  #define SHM_RND     020000  /* Round attach address to SHMLBA */
  #define SHMLBA      CLBYTES /* Segment low boundry address multiple */
+ #define SHM_R       IPC_R
+ #define SHM_W       IPC_W
  
  struct shmid_ds {
  	struct ipc_perm shm_perm;	/* operation permission structure */
=end================

tim



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