[PATCH 01/13] ipcs: add data structures to read state from /proc & /sys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 sys-utils/ipcs.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c
index 2fbca08..ca10c3d 100644
--- a/sys-utils/ipcs.c
+++ b/sys-utils/ipcs.c
@@ -106,6 +106,67 @@ union semun {
 #define TIME 4
 #define PID 5
 
+/* Structures that are populated by using /proc and /sys data.  The
+ * struct type names are aligned with with kernel similar structures in
+ * kernel code. */
+struct ipc_stat {
+	int		id;
+	key_t		key;
+	uid_t		uid;		/* current uid */
+	gid_t		gid;		/* current gid */
+	uid_t		cuid;		/* creator uid */
+	gid_t		cgid;		/* creator gid */
+	unsigned int	mode;
+};
+struct sem_data {
+	struct ipc_stat	sem_perm;
+	time_t		sem_otime;
+	time_t		sem_ctime;
+	unsigned long	sem_nsems;
+	struct sem_data	*next;
+};
+struct shm_data {
+	struct ipc_stat	shm_perm;
+	unsigned long	shm_nattch;
+	unsigned long	shm_segsz;
+	time_t		shm_atim;
+	time_t		shm_dtim;
+	time_t		shm_ctim;
+	pid_t		shm_cprid;
+	pid_t		shm_lprid;
+	unsigned long	shm_rss;
+	unsigned long	shm_swp;
+	struct shm_data	*next;
+};
+struct msg_data {
+	struct ipc_stat	msg_perm;
+	time_t		q_stime;
+	time_t		q_rtime;
+	time_t		q_ctime;
+	unsigned long	q_qnum;
+	unsigned long	q_cbytes;
+	pid_t		q_lspid;
+	pid_t		q_lrpid;
+	struct msg_data	*next;
+};
+struct proc_limits {
+	int		shmmni;		/* max number of segments */
+	size_t		shmmax;		/* max segment size (constant) */
+	size_t		shmall;		/* max total shared memory */
+	size_t		shmmin;		/* min segment size (constant) */
+
+	int		semmni;		/* max number of arrays */
+	int		semmsl;		/* max semaphores per array */
+	int		semmns;		/* max semaphores system wide */
+	int		semopm;		/* max ops per semop call */
+	unsigned int	semvmx;		/* semaphore max value (constant) */
+
+	int		msgmni;		/* max queues system wide*/
+	size_t		msgmax;		/* max size of message */
+	int		msgmnb;		/* default max size of queue */
+};
+/* End of the /proc & /sys structures */
+
 void do_shm (char format);
 void do_sem (char format);
 void do_msg (char format);
-- 
1.7.12.3

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux