[PATCH] SHM: tweak /proc/sysvipc/shm banner

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <akpm@...>
Cc: <linux-kernel@...>
Date: Tuesday, April 22, 2008 - 6:31 pm

"size" field and everything after in banner isn't aligned properly on 64-bit archs.

Before:
       key      shmid perms       size  cpid  lpid nattch   uid   gid  cuid  cgid      atime      dtime      ctime
         0          0     0               4194304  4749     0      0  1000  1000  1000  1000          0          0 1208902917

After:
       key      shmid perms                  size  cpid  lpid nattch   uid   gid  cuid  cgid      atime      dtime      ctime
         0          0     0               4194304  4745     0      0  1000  1000  1000  1000          0          0 1208902637

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 ipc/shm.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -106,9 +106,14 @@ void shm_exit_ns(struct ipc_namespace *ns)
 
 void __init shm_init (void)
 {
+	char *banner;
+
 	shm_init_ns(&init_ipc_ns);
-	ipc_init_proc_interface("sysvipc/shm",
-				"       key      shmid perms       size  cpid  lpid nattch   uid   gid  cuid  cgid      atime      dtime      ctime\n",
+	if (sizeof(size_t) <= sizeof(int))
+		banner = "       key      shmid perms       size  cpid  lpid nattch   uid   gid  cuid  cgid      atime      dtime      ctime\n";
+	else
+		banner = "       key      shmid perms                  size  cpid  lpid nattch   uid   gid  cuid  cgid      atime      dtime      ctime\n";
+	ipc_init_proc_interface("sysvipc/shm", banner,
 				IPC_SHM_IDS, sysvipc_shm_proc_show);
 }
 

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] SHM: tweak /proc/sysvipc/shm banner, Alexey Dobriyan, (Tue Apr 22, 6:31 pm)