From 56692a6701c4847d0cd80457c5adb98e5eaa6ced Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 16 Dec 2012 10:43:51 +0000 Subject: ipcs: add --human readable size conversion option Introduces new function ipc_print_size() which will call size_to_human_string(), and handles the occasional '([k]bytes)' printing if default size format is requested. Reviewed-by: Karel Zak Signed-off-by: Sami Kerola --- sys-utils/ipcutils.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sys-utils/ipcutils.h') diff --git a/sys-utils/ipcutils.h b/sys-utils/ipcutils.h index 28b35c136..6383124ff 100644 --- a/sys-utils/ipcutils.h +++ b/sys-utils/ipcutils.h @@ -78,6 +78,14 @@ union semun { # define KEY key #endif +/* Size printing in ipcs is using these. */ +enum { + IPC_UNIT_DEFAULT, + IPC_UNIT_BYTES, + IPC_UNIT_KB, + IPC_UNIT_HUMAN +}; + struct ipc_limits { uint64_t shmmni; /* max number of segments */ uint64_t shmmax; /* max segment size */ @@ -110,6 +118,7 @@ struct ipc_stat { }; extern void ipc_print_perms(FILE *f, struct ipc_stat *is); +extern void ipc_print_size(int unit, char *msg, size_t size, const char *end, int width); /* See 'struct shmid_kernel' in kernel sources */ -- cgit v1.2.3-55-g7522