DataMuseum.dk

Presents historical artifacts from the history of:

RC9000

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about RC9000

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: @ T s

⟦92621579d⟧ TextFile

    Length: 5331 (0x14d3)
    Types: TextFile
    Notes: @(#)shm.h 13.4 (RC International) 91/10/09 */
    Names: »shm.h«

Derivation

└─⟦50656ff4a⟧ Bits:30010538 TX 3.1 Coldstart
    └─⟦bbf173f5c⟧ »0004« 
        └─⟦this⟧ »./bsd/usr/include/sys/shm.h« 

TextFile

/*	@(#)shm.h	13.4 (RC International) 91/10/09	*/

#ifndef _SHM_H
#define _SHM_H

/*	IPC Shared Memory Facility	*/

#include <rc/param.h>

/*	Implementation Constants	*/

#define SHMLBA	CLBYTES		/* segment low boundary address multiple */

/*
 * Define # disk extents of DMSHM (vm_swvol.c) size required
 * to hold largest possible shared memory segment.
 */

#define	NSHMDAD	4		/* (SHMMAX)/(DMSHM*DEV_BSIZE) */


/*	Permission Definitions	*/

#define	SHM_R	0400		/* read permission */
#define	SHM_W	0200		/* write permission */

/*	ipc_perm Mode Definitions	*/

#define	SHM_CLEAR	01000	/* clear segment on next attach */
#define	SHM_DEST	02000	/* destroy segment when # attached = 0 */
#define	SHM_SEMA	04000	/* Special semaphore memory requested */

/*	Message Operation Flags	*/

#define	SHM_RDONLY	010000	/* attach read-only (else read-write) */
#define	SHM_RND		020000	/* round attach address to SHMBLA */

/*
 * Structure Definitions
 */

/*	semaphores on memory board definition	*/

struct shmsema_id
{
    struct shmsema_id	*next;  /* pointer to next sema def.	*/
    caddr_t		addr;	/* ph addres of semaphore block */
};

/*
 * The shared memory id data structure-
 * There is on of these for every possible shared memory segment
 * in the system.
 */
	
struct	shmid_ds	/* shared memory data structure */
{
    struct ipc_perm shm_perm;		/* operation permission struct
					 * MUST BE FIRST -- GROT XXXX
					 */
    swblk_t	shm_daddr[NSHMDAD];	/* disk addrs of DMSHM-page segs */
    union { /* selected on SHM_SEMA flag in shm_perm. */
	swblk_t	u_shm_ptdaddr;			/* disk address of page table */
	struct shmsema_id *u_shmsema_ptr;	/* mem. semaphores addresses */
    } s_u;
#define shm_ptdaddr s_u.u_shm_ptdaddr
#define shmsema_ptr s_u.u_shmsema_ptr
    struct shmat_ds *shm_attlist;	/* in memory attach list for segment */
    int		shm_cpid;	/* creator pid */
    int		shm_lpid;	/* pid of last operation */
    time_t	shm_atime;	/* last attach time */
    time_t	shm_dtime;	/* last detach time */
    time_t	shm_ctime;	/* last change time */
				/* Times measured in secs since */
				/* 00:00:00 GMT, Jan. 1, 1970 */
    int		shm_segsz;	/* size of segment (bytes) */
    short	shm_size;	/* size of segment (pages) */
    short	shm_rssize;	/* resident set size (pages) */
    short	shm_swrss;	/* swapped resident set size (pages) */
    short	shm_poip;	/* page out in progress count */
    u_char	shm_nattch;	/* number of attaches */
    u_char	shm_cnattch;	/* in memory # attached */
    char	shm_flag;	/* flags */
};

/*
 * Flag definitions for shm_flag
 */

#define	SHMLOCK	0x01		/* shmid_ds struct is locked */
#define	SHMWANT	0x02		/* someone wants lock on struct */
#define	SHMKILL	0x04		/* segment poisoned by pagein error */

/*
 * Shared memory attach structure-
 * One for every possible attach point in the system (shmseg * nproc)
 */

struct	shmat_ds
{
	struct proc	*shm_procaddr;	/* associated process table */
	struct shmid_ds	*shm_shmptr;	/* associated shmid_ds structure */
	struct shmat_ds	*shm_proclink;	/* next active attach structure for
					 *	proc at shm_procaddr
					 */
	struct shmat_ds	*shm_shmlink;	/* next attach structure for shared
					 * data segment described by shm_shmptr
					 */
	u_int		shm_base;	/* virtual base and top page nos for */
	u_int		shm_top;	/* proc at shm_procaddr */
	struct pte	*shm_shmbr;	/* page table base for this segment */
	short		shm_shmpt;	/* shm page table size */
	short		shm_ptoff;	/* offset of shm_base into shm_shmbr */
	char		shm_sflg;	/* process specific attach flags */
};

/*
 * Flag definitions for shm_sflg
 */

#define	SHMRDONLY	0x01		/* segment attached read only */	
#define	SHMATTACH	0x02		/* segment on shmid_ds attach list */


/*	Define shared memory limits structure	*/

struct shminfo
{
    int	shmmax;	/* max shared memory segment size */
    int	shmmin;	/* min shared memory segment size */
    int	shmmni;	/* # of shared memory identifiers */
    int	shmseg;	/* max attached shared memory segments per process */
		/* NOTE: must not exceed U_MAXSHM in user.h */
    int	shmbrk;	/* gap (in clicks) used between data and shared memory */
};

/*	Shared memory accounting structure	*/

struct	shmstat
{
    int	shmsegtot;	/* total # shm segments in use */
    int	shmswpo;	/* # of shm segment swap outs */
    int	shmswpi;	/* # of shm segment swap ins */
};

/*
 * The following manifest constants define the parameters
 * for the ipc shared memory subsystem
 */

#define	SHMMAX	1024*NBPG	/* max shared memory seg size (bytes) =4Mb */
#define	SHMMIN	4		/* min shared memory seg size (bytes) */
#define	SHMMNI	30		/* max # shared memory segs system wide */
#define	SHMSEG	16		/* max # attached shared memory segs/proc */
				/* SHMSEG MUST NOT EXCEED U_MAXSHM in user.h */
#define	SHMBRK	8192*CLSIZE	/* default # pages between end of ds
				 * and start of shm region.
				 */
#define SHMSTK	NPTEPG*CLSIZE	/* # pages between end of shm region and 
				 * top of ss, to prevent sharing of page
				 * table pages between stack and shm region.
				 */


#if defined(__STDC__)

extern int shmctl(int, int, ...);
extern int shmget(key_t, int, int);
extern char *shmat(int, void *, int);
extern int shmdt(void *);

#else /* Not __STDC__ */

extern int shmctl(), shmdt(), shmget();
extern char *shmat();

#endif /* __STDC__ */


#endif /* _SHM_H */