Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


shm.h
01: #ifndef _LINUX_SHM_H_
02: #define _LINUX_SHM_H_
03: 
04: #include <linux/ipc.h>
05: #include <linux/errno.h>
06: #include <unistd.h>
07: 
08: /*
09:  * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can
10:  * be increased by sysctl
11:  */
12: 
13: #define SHMMAX 0x2000000                 /* max shared seg size (bytes) */
14: #define SHMMIN 1                         /* min shared seg size (bytes) */
15: #define SHMMNI 4096                      /* max num of segs system wide */
16: #define SHMALL (SHMMAX/getpagesize()*(SHMMNI/16))
17: #define SHMSEG SHMMNI                    /* max shared segs per process */
18: 
19: 
20: /* Obsolete, used only for backwards compatibility and libc5 compiles */
21: struct shmid_ds {
22:         struct ipc_perm         shm_perm;       /* operation perms */
23:         int                     shm_segsz;      /* size of segment (bytes) */
24:         __kernel_time_t         shm_atime;      /* last attach time */
25:         __kernel_time_t         shm_dtime;      /* last detach time */
26:         __kernel_time_t         shm_ctime;      /* last change time */
27:         __kernel_ipc_pid_t      shm_cpid;       /* pid of creator */
28:         __kernel_ipc_pid_t      shm_lpid;       /* pid of last operator */
29:         unsigned short          shm_nattch;     /* no. of current attaches */
30:         unsigned short          shm_unused;     /* compatibility */
31:         void                    *shm_unused2;   /* ditto - used by DIPC */
32:         void                    *shm_unused3;   /* unused */
33: };
34: 
35: /* Include the definition of shmid64_ds and shminfo64 */
36: #include <asm/shmbuf.h>
37: 
38: /* permission flag for shmget */
39: #define SHM_R           0400    /* or S_IRUGO from <linux/stat.h> */
40: #define SHM_W           0200    /* or S_IWUGO from <linux/stat.h> */
41: 
42: /* mode for attach */
43: #define SHM_RDONLY      010000  /* read-only access */
44: #define SHM_RND         020000  /* round attach address to SHMLBA boundary */
45: #define SHM_REMAP       040000  /* take-over region on attach */
46: #define SHM_EXEC        0100000 /* execution access */
47: 
48: /* super user shmctl commands */
49: #define SHM_LOCK        11
50: #define SHM_UNLOCK      12
51: 
52: /* ipcs ctl commands */
53: #define SHM_STAT        13
54: #define SHM_INFO        14
55: 
56: /* Obsolete, used only for backwards compatibility */
57: struct  shminfo {
58:         int shmmax;
59:         int shmmin;
60:         int shmmni;
61:         int shmseg;
62:         int shmall;
63: };
64: 
65: struct shm_info {
66:         int used_ids;
67:         unsigned long shm_tot;  /* total allocated shm */
68:         unsigned long shm_rss;  /* total resident shm */
69:         unsigned long shm_swp;  /* total swapped shm */
70:         unsigned long swap_attempts;
71:         unsigned long swap_successes;
72: };
73: 
74: 
75: #endif /* _LINUX_SHM_H_ */
76: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/