netlib.narod.ru< Назад | Оглавление | Далее >

include/linux/shm.h

17035 #ifndef _LINUX_SHM_H_
17036 #define _LINUX_SHM_H_
17037 
17038 #include <linux/ipc.h>
17039 
17040 #include <asm/shmparam.h>
17041 
 Комментарий
17042 struct shmid_ds {
17043   struct ipc_perm    shm_perm;     /* operation perms */
17044   int                shm_segsz;    /* seg sz (bytes) */
17045   __kernel_time_t    shm_atime;    /* last attach time */
17046   __kernel_time_t    shm_dtime;    /* last detach time */
17047   __kernel_time_t    shm_ctime;    /* last change time */
17048   __kernel_ipc_pid_t shm_cpid;     /* pid of creator */
17049   __kernel_ipc_pid_t shm_lpid;     /* pid of last op */
17050   unsigned short     shm_nattch;   /* #current attaches*/
17051   unsigned short     shm_unused;   /* compatibility */
17052   void               *shm_unused2; /* ditto - for DIPC */
17053   void               *shm_unused3; /* unused */
17054 };
17055 
 Комментарий
17056 struct shmid_kernel
17057 {
17058   struct shmid_ds       u;
17059   /* the following are private */
17060   unsigned long         shm_npages; /* seg sz (pages) */
17061   /* array of ptrs to frames -> SHMMAX */
17062   unsigned long         *shm_pages;
17063   /* descriptors for attaches */
17064   struct vm_area_struct *attaches;
17065 };
17066 
17067 /* permission flag for shmget */
17068 #define SHM_R       0400 /*or S_IRUGO from linux/stat.h*/
17069 #define SHM_W       0200 /*or S_IWUGO from linux/stat.h*/
17070 
17071 /* mode for attach */
17072 #define SHM_RDONLY 010000  /* read-only access */
17073 #define SHM_RND    020000  /* round attach addr to
17074                               SHMLBA boundary */
17075 #define SHM_REMAP  040000  /*take over region on attach*/
17076 
17077 /* super user shmctl commands */
17078 #define SHM_LOCK        11
17079 #define SHM_UNLOCK      12
17080 
17081 /* ipcs ctl commands */
17082 #define SHM_STAT        13
17083 #define SHM_INFO        14
17084 
17085 struct  shminfo {
17086   int shmmax;
17087   int shmmin;
17088   int shmmni;
17089   int shmseg;
17090   int shmall;
17091 };
17092 
17093 struct shm_info {
17094   int used_ids;
17095   unsigned long shm_tot;  /* total allocated shm */
17096   unsigned long shm_rss;  /* total resident shm */
17097   unsigned long shm_swp;  /* total swapped shm */
17098   unsigned long swap_attempts;
17099   unsigned long swap_successes;
17100 };
17101 
17102 #ifdef __KERNEL__
17103 
17104 /* shm_mode upper byte flags */
17105 /* segment will be destroyed on last detach */
17106 #define SHM_DEST        01000
17107 /* segment will not be swapped */
17108 #define SHM_LOCKED      02000
17109 
17110 asmlinkage int sys_shmget(key_t key, int size,
17111                           int flag);
17112 asmlinkage int sys_shmat(int shmid, char *shmaddr,
17113                          int shmflg,unsigned long *addr);
17114 asmlinkage int sys_shmdt (char *shmaddr);
17115 asmlinkage int sys_shmctl (int shmid, int cmd,
17116                            struct shmid_ds *buf);
17117 extern void shm_unuse(unsigned long entry,
17118                       unsigned long page);
17119 
17120 #endif /* __KERNEL__ */
17121 
17122 #endif /* _LINUX_SHM_H_ */

netlib.narod.ru< Назад | Оглавление | Далее >

Сайт управляется системой uCoz