File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / sys / h / shm.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b

/* @(#)shm.h	6.1 */
/*
**	IPC Shared Memory Facility.
*/

/*
**	Implementation Constants.
*/

#define	SHMLBA	NBPG 		/* segment low boundary address multiple */
#define	P0MASK	0xc0000000	/* P0 address mask */

/*
**	Permission Definitions.
*/

#define	SHM_R	0x0100	/* read permission */
#define	SHM_W	0x0080	/* write permission */

/*
**	ipc_perm Mode Definitions.
*/

#define	SHM_CLEAR	0x0200	/* clear segment on next attach */
#define	SHM_DEST	0x0400	/* destroy segment when # attached = 0 */

/*
**	Message Operation Flags.
*/

#define	SHM_RDONLY	0x1000	/* attach read-only (else read-write) */
#define	SHM_RND		0x2000	/* round attach address to SHMLBA */

/* 
 * 	Defines for shared memory limits
 */

#define SHMMAX	(128*NBPG) 	/* max. shared memory segment size */
#define SHMMIN	1		/* min. shared memory segment size */
#define SHMMNI	100		/* max. no. shared memory identifers */
#define SHMSEG	6		/* max. attached shared memory segs per proc */
#define SHMBRK 	16		/* gap (clicks) between data and shared mem */
#define SHMALL 	1024		/* max shared memory clicks system wide */

/*
 *	Defines for swapping
 */

#define DMSHM		1024	/* page segment size for disk addresses */
#define NSHMDAD		12	/* number of shared memory disk addresses */
#define	SHM_SWAP	0x010	/* shared memory segment swapped out */
#define SHM_UNLINK	0x020	/* proc unlinked from shared memory segment */


/*
**	Structure Definitions.
*/

/*
**	There is a shmem data structure for each segment in the system.
*/

struct shmid_ds {
	struct ipc_perm	shm_perm;	/* operation permission struct */
	int		shm_segsz;	/* segment size */
	struct proc	*shm_proc;	/* ptr to linked proc, if loaded */
	short		shm_pidx;	/* shm_pt index of that proc */
	u_short		shm_lpid;	/* pid of last shmop */
	u_short		shm_cpid;	/* pid of creator */
	u_short		shm_cnattch;	/* # attached in memory */
	u_short		shm_nattch;	/* current # attached */
	time_t		shm_atime;	/* last shmat time */
	time_t		shm_dtime;	/* last shmdt time */
	time_t		shm_ctime;	/* last change time */
	swblk_t		shm_daddr[NSHMDAD]; /* disk add. of DMSHM pages */
	swblk_t		shm_ptdaddr;	/* disk add. of page tables */
	short		shm_rssize;	/* resident size */
	short		shm_poip;	/* page out in progress count */
	u_char		shm_status;	/* status - e.g. swapped out */
};

struct	shminfo {
	int	shmmax,	/* max shared memory segment size */
		shmmin,	/* min shared memory segment size */
		shmmni,	/* # of shared memory identifiers */
		shmseg,	/* max attached shared memory segments per process */
		shmbrk,	/* gap (in clicks) between data and shared memory */
		shmall;	/* max total shared memory system wide (in clicks) */
};

struct shm_pt {
	u_int		shm_sva;	/* starting virtual page address */
	struct	shmid_ds *shm_shmp;	/* ptr to associated shmem */
	struct 	proc 	*shm_link;	/* next proc sharing this segment */
	short		shm_idx;	/* shm_pt index of that proc */
	struct	pte 	*shm_spte;	/* starting pte entry  */
	struct	pte 	*shm_epte;	/* ending pte entry */
	int		shm_sflg;	/* status flag */
};
struct shm_pt *vtoshmpt();

#ifdef KERNEL
struct shmid_ds *shmem, *shmemNSHMEM;
int	dmshm, nshmem;	
#endif KERNEL

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.