/*
Copyright (c) 1993 Xerox Corporation.  All rights reserved.
*/
/*
 */

#ifndef ←←XR←sys←shm←h
#define ←←XR←sys←shm←h

#include <config/PCR←OS.h>

#include <xr/XR←sys←types.h>
#include <xr/XR←sys←ipc.h>

#include <sys/shm.h>

/*
 *	Shared Memory Operation Flags.
 */

#define	XR←SHM←RDONLY	010000	/* attach read-only (else read-write) */
#define	XR←SHM←RND	020000	/* round attach address to SHMLBA */

/*
 * Shmctl Command Definitions.
 */

#define XR←SHM←LOCK	3	/* Lock segment in core */
#define XR←SHM←UNLOCK	4	/* Unlock segment */

/*
 *	Implementation Constants.
 */
#define	XR←SHMLBA	0x1000	/* segment low boundary address multiple */
				/* (SHMLBA must be a power of 2) */

/*
 *	Structure Definitions.
 */

/*
 *	There is a shared mem id data structure for each segment in the system.
 */

struct XR←shmid←ds {
	struct XR←ipc←perm shm←perm;	/* operation permission struct */
	unsigned int	shm←segsz;	/* size of segment in bytes */
	unsigned short	shm←lpid;	/* pid of last shmop */
	unsigned short	shm←cpid;	/* pid of creator */
	unsigned short	shm←nattch;	/* number of current attaches */
	XR←time←t	shm←atime;	/* last shmat time */
	XR←time←t	shm←dtime;	/* last shmdt time */
	XR←time←t	shm←ctime;	/* last change time */
	void		*shm←amp;	/* segment anon←map pointer */
};

#if defined(PCR←OS←SUNOS4)

#   define XR←sys←shm←FlagsToHost(flags)	(flags)
#   define XR←sys←shm←CmdToHost(cmd)		(cmd)

extern void
XR←sys←shm←DSToHost(struct shmid←ds *hds, struct XR←shmid←ds *xds);

extern void
XR←sys←shm←DSFromHost(struct XR←shmid←ds *xds, struct shmid←ds *hds);

#elif defined(PCR←OS←SUNOS5)

#   define XR←sys←shm←FlagsToHost(flags)	(flags)

extern int
XR←sys←shm←CmdToHost(int cmd);

extern void
XR←sys←shm←DSToHost(struct shmid←ds *hds, struct XR←shmid←ds *xds);

extern void
XR←sys←shm←DSFromHost(struct XR←shmid←ds *xds, struct shmid←ds *hds);

#else
#   error os ?
#endif




#endif /*!←←XR←sys←shm←h*/