root/include/linux/shm.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef _LINUX_SHM_H_
   2 #define _LINUX_SHM_H_
   3 
   4 #include <linux/ipc.h>
   5 
   6 #include <asm/shmparam.h>
   7 
   8 struct shmid_ds {
   9         struct ipc_perm shm_perm;       /* operation perms */
  10         int     shm_segsz;              /* size of segment (bytes) */
  11         time_t  shm_atime;              /* last attach time */
  12         time_t  shm_dtime;              /* last detach time */
  13         time_t  shm_ctime;              /* last change time */
  14         unsigned short  shm_cpid;       /* pid of creator */
  15         unsigned short  shm_lpid;       /* pid of last operator */
  16         short   shm_nattch;             /* no. of current attaches */
  17         /* the following are private */
  18         unsigned short   shm_npages;    /* size of segment (pages) */
  19         unsigned long   *shm_pages;     /* array of ptrs to frames -> SHMMAX */ 
  20         struct vm_area_struct *attaches; /* descriptors for attaches */
  21 };
  22 
  23 /* permission flag for shmget */
  24 #define SHM_R           0400    /* or S_IRUGO from <linux/stat.h> */
  25 #define SHM_W           0200    /* or S_IWUGO from <linux/stat.h> */
  26 
  27 /* mode for attach */
  28 #define SHM_RDONLY      010000  /* read-only access */
  29 #define SHM_RND         020000  /* round attach address to SHMLBA boundary */
  30 #define SHM_REMAP       040000  /* take-over region on attach */
  31 
  32 /* super user shmctl commands */
  33 #define SHM_LOCK        11
  34 #define SHM_UNLOCK      12
  35 
  36 struct  shminfo {
  37     int shmmax; 
  38     int shmmin; 
  39     int shmmni; 
  40     int shmseg; 
  41     int shmall; 
  42 };
  43 
  44 #ifdef __KERNEL__
  45 
  46 /* shm_mode upper byte flags */
  47 #define SHM_DEST        01000   /* segment will be destroyed on last detach */
  48 #define SHM_LOCKED      02000   /* segment will not be swapped */
  49 
  50 /* ipcs ctl commands */
  51 #define SHM_STAT        13
  52 #define SHM_INFO        14
  53 struct shm_info {
  54         int   used_ids;
  55         ulong shm_tot; /* total allocated shm */
  56         ulong shm_rss; /* total resident shm */
  57         ulong shm_swp; /* total swapped shm */
  58         ulong swap_attempts;
  59         ulong swap_successes;
  60 };
  61 
  62 asmlinkage int sys_shmget (key_t key, int size, int flag);
  63 asmlinkage int sys_shmat (int shmid, char *shmaddr, int shmflg, ulong *addr);
  64 asmlinkage int sys_shmdt (char *shmaddr);
  65 asmlinkage int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf);
  66 
  67 #endif /* __KERNEL__ */
  68 
  69 #endif /* _LINUX_SHM_H_ */
  70 

/* [previous][next][first][last][top][bottom][index][help] */