summaryrefslogtreecommitdiffstats
path: root/sys-utils/ipcutils.h
diff options
context:
space:
mode:
authorSami Kerola2012-12-16 11:43:51 +0100
committerKarel Zak2012-12-19 11:04:53 +0100
commit56692a6701c4847d0cd80457c5adb98e5eaa6ced (patch)
tree41c51e5c4c825322263c028c29cbf9c52325a4a3 /sys-utils/ipcutils.h
parentipcs: assist debugging (diff)
downloadkernel-qcow2-util-linux-56692a6701c4847d0cd80457c5adb98e5eaa6ced.tar.gz
kernel-qcow2-util-linux-56692a6701c4847d0cd80457c5adb98e5eaa6ced.tar.xz
kernel-qcow2-util-linux-56692a6701c4847d0cd80457c5adb98e5eaa6ced.zip
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 <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/ipcutils.h')
-rw-r--r--sys-utils/ipcutils.h9
1 files changed, 9 insertions, 0 deletions
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
*/