diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-26 23:21:47 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-26 23:21:47 +0000 |
| commit | f0ed376eda5d5c25d270e5100a881fb2d801bee6 (patch) | |
| tree | 79166b700c497fbe798b6031e5bbff97e0933573 /util-linux/ipcs.c | |
| parent | 670a6626cabc1498f32b35f959591f8621d8447e (diff) | |
| download | busybox-w32-f0ed376eda5d5c25d270e5100a881fb2d801bee6.tar.gz busybox-w32-f0ed376eda5d5c25d270e5100a881fb2d801bee6.tar.bz2 busybox-w32-f0ed376eda5d5c25d270e5100a881fb2d801bee6.zip | |
remove bb_printf and the like
Diffstat (limited to 'util-linux/ipcs.c')
| -rw-r--r-- | util-linux/ipcs.c | 196 |
1 files changed, 98 insertions, 98 deletions
diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c index ba81ea97c..b81d07d6d 100644 --- a/util-linux/ipcs.c +++ b/util-linux/ipcs.c | |||
| @@ -103,25 +103,25 @@ static void print_perms(int id, struct ipc_perm *ipcp) | |||
| 103 | struct passwd *pw; | 103 | struct passwd *pw; |
| 104 | struct group *gr; | 104 | struct group *gr; |
| 105 | 105 | ||
| 106 | bb_printf("%-10d %-10o", id, ipcp->mode & 0777); | 106 | printf("%-10d %-10o", id, ipcp->mode & 0777); |
| 107 | 107 | ||
| 108 | if ((pw = getpwuid(ipcp->cuid))) | 108 | if ((pw = getpwuid(ipcp->cuid))) |
| 109 | bb_printf(" %-10s", pw->pw_name); | 109 | printf(" %-10s", pw->pw_name); |
| 110 | else | 110 | else |
| 111 | bb_printf(" %-10d", ipcp->cuid); | 111 | printf(" %-10d", ipcp->cuid); |
| 112 | if ((gr = getgrgid(ipcp->cgid))) | 112 | if ((gr = getgrgid(ipcp->cgid))) |
| 113 | bb_printf(" %-10s", gr->gr_name); | 113 | printf(" %-10s", gr->gr_name); |
| 114 | else | 114 | else |
| 115 | bb_printf(" %-10d", ipcp->cgid); | 115 | printf(" %-10d", ipcp->cgid); |
| 116 | 116 | ||
| 117 | if ((pw = getpwuid(ipcp->uid))) | 117 | if ((pw = getpwuid(ipcp->uid))) |
| 118 | bb_printf(" %-10s", pw->pw_name); | 118 | printf(" %-10s", pw->pw_name); |
| 119 | else | 119 | else |
| 120 | bb_printf(" %-10d", ipcp->uid); | 120 | printf(" %-10d", ipcp->uid); |
| 121 | if ((gr = getgrgid(ipcp->gid))) | 121 | if ((gr = getgrgid(ipcp->gid))) |
| 122 | bb_printf(" %-10s\n", gr->gr_name); | 122 | printf(" %-10s\n", gr->gr_name); |
| 123 | else | 123 | else |
| 124 | bb_printf(" %-10d\n", ipcp->gid); | 124 | printf(" %-10d\n", ipcp->gid); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | 127 | ||
| @@ -136,18 +136,18 @@ static void do_shm(void) | |||
| 136 | 136 | ||
| 137 | maxid = shmctl(0, SHM_INFO, (struct shmid_ds *) (void *) &shm_info); | 137 | maxid = shmctl(0, SHM_INFO, (struct shmid_ds *) (void *) &shm_info); |
| 138 | if (maxid < 0) { | 138 | if (maxid < 0) { |
| 139 | bb_printf("kernel not configured for %s\n", "shared memory"); | 139 | printf("kernel not configured for %s\n", "shared memory"); |
| 140 | return; | 140 | return; |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | switch (format) { | 143 | switch (format) { |
| 144 | case LIMITS: | 144 | case LIMITS: |
| 145 | bb_printf("------ Shared Memory %s --------\n", "Limits"); | 145 | printf("------ Shared Memory %s --------\n", "Limits"); |
| 146 | if ((shmctl(0, IPC_INFO, (struct shmid_ds *) (void *) &shminfo)) < 0) | 146 | if ((shmctl(0, IPC_INFO, (struct shmid_ds *) (void *) &shminfo)) < 0) |
| 147 | return; | 147 | return; |
| 148 | /* glibc 2.1.3 and all earlier libc's have ints as fields | 148 | /* glibc 2.1.3 and all earlier libc's have ints as fields |
| 149 | of struct shminfo; glibc 2.1.91 has unsigned long; ach */ | 149 | of struct shminfo; glibc 2.1.91 has unsigned long; ach */ |
| 150 | bb_printf("max number of segments = %lu\n" | 150 | printf("max number of segments = %lu\n" |
| 151 | "max seg size (kbytes) = %lu\n" | 151 | "max seg size (kbytes) = %lu\n" |
| 152 | "max total shared memory (pages) = %lu\n" | 152 | "max total shared memory (pages) = %lu\n" |
| 153 | "min seg size (bytes) = %lu\n", | 153 | "min seg size (bytes) = %lu\n", |
| @@ -158,8 +158,8 @@ static void do_shm(void) | |||
| 158 | return; | 158 | return; |
| 159 | 159 | ||
| 160 | case STATUS: | 160 | case STATUS: |
| 161 | bb_printf("------ Shared Memory %s --------\n", "Status"); | 161 | printf("------ Shared Memory %s --------\n", "Status"); |
| 162 | bb_printf( "segments allocated %d\n" | 162 | printf( "segments allocated %d\n" |
| 163 | "pages allocated %ld\n" | 163 | "pages allocated %ld\n" |
| 164 | "pages resident %ld\n" | 164 | "pages resident %ld\n" |
| 165 | "pages swapped %ld\n" | 165 | "pages swapped %ld\n" |
| @@ -172,26 +172,26 @@ static void do_shm(void) | |||
| 172 | return; | 172 | return; |
| 173 | 173 | ||
| 174 | case CREATOR: | 174 | case CREATOR: |
| 175 | bb_printf("------ Shared Memory %s --------\n", "Segment Creators/Owners"); | 175 | printf("------ Shared Memory %s --------\n", "Segment Creators/Owners"); |
| 176 | bb_printf( "%-10s %-10s %-10s %-10s %-10s %-10s\n", | 176 | printf( "%-10s %-10s %-10s %-10s %-10s %-10s\n", |
| 177 | "shmid", "perms", "cuid", "cgid", "uid", "gid"); | 177 | "shmid", "perms", "cuid", "cgid", "uid", "gid"); |
| 178 | break; | 178 | break; |
| 179 | 179 | ||
| 180 | case TIME: | 180 | case TIME: |
| 181 | bb_printf("------ Shared Memory %s --------\n", "Attach/Detach/Change Times"); | 181 | printf("------ Shared Memory %s --------\n", "Attach/Detach/Change Times"); |
| 182 | bb_printf( "%-10s %-10s %-20s %-20s %-20s\n", | 182 | printf( "%-10s %-10s %-20s %-20s %-20s\n", |
| 183 | "shmid", "owner", "attached", "detached", "changed"); | 183 | "shmid", "owner", "attached", "detached", "changed"); |
| 184 | break; | 184 | break; |
| 185 | 185 | ||
| 186 | case PID: | 186 | case PID: |
| 187 | bb_printf("------ Shared Memory %s --------\n", "Creator/Last-op"); | 187 | printf("------ Shared Memory %s --------\n", "Creator/Last-op"); |
| 188 | bb_printf( "%-10s %-10s %-10s %-10s\n", | 188 | printf( "%-10s %-10s %-10s %-10s\n", |
| 189 | "shmid", "owner", "cpid", "lpid"); | 189 | "shmid", "owner", "cpid", "lpid"); |
| 190 | break; | 190 | break; |
| 191 | 191 | ||
| 192 | default: | 192 | default: |
| 193 | bb_printf("------ Shared Memory %s --------\n", "Segments"); | 193 | printf("------ Shared Memory %s --------\n", "Segments"); |
| 194 | bb_printf( "%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n", | 194 | printf( "%-10s %-10s %-10s %-10s %-10s %-10s %-12s\n", |
| 195 | "key", "shmid", "owner", "perms", "bytes", "nattch", | 195 | "key", "shmid", "owner", "perms", "bytes", "nattch", |
| 196 | "status"); | 196 | "status"); |
| 197 | break; | 197 | break; |
| @@ -209,32 +209,32 @@ static void do_shm(void) | |||
| 209 | switch (format) { | 209 | switch (format) { |
| 210 | case TIME: | 210 | case TIME: |
| 211 | if (pw) | 211 | if (pw) |
| 212 | bb_printf("%-10d %-10.10s", shmid, pw->pw_name); | 212 | printf("%-10d %-10.10s", shmid, pw->pw_name); |
| 213 | else | 213 | else |
| 214 | bb_printf("%-10d %-10d", shmid, ipcp->uid); | 214 | printf("%-10d %-10d", shmid, ipcp->uid); |
| 215 | /* ctime uses static buffer: use separate calls */ | 215 | /* ctime uses static buffer: use separate calls */ |
| 216 | bb_printf(" %-20.16s", shmseg.shm_atime | 216 | printf(" %-20.16s", shmseg.shm_atime |
| 217 | ? ctime(&shmseg.shm_atime) + 4 : "Not set"); | 217 | ? ctime(&shmseg.shm_atime) + 4 : "Not set"); |
| 218 | bb_printf(" %-20.16s", shmseg.shm_dtime | 218 | printf(" %-20.16s", shmseg.shm_dtime |
| 219 | ? ctime(&shmseg.shm_dtime) + 4 : "Not set"); | 219 | ? ctime(&shmseg.shm_dtime) + 4 : "Not set"); |
| 220 | bb_printf(" %-20.16s\n", shmseg.shm_ctime | 220 | printf(" %-20.16s\n", shmseg.shm_ctime |
| 221 | ? ctime(&shmseg.shm_ctime) + 4 : "Not set"); | 221 | ? ctime(&shmseg.shm_ctime) + 4 : "Not set"); |
| 222 | break; | 222 | break; |
| 223 | case PID: | 223 | case PID: |
| 224 | if (pw) | 224 | if (pw) |
| 225 | bb_printf("%-10d %-10.10s", shmid, pw->pw_name); | 225 | printf("%-10d %-10.10s", shmid, pw->pw_name); |
| 226 | else | 226 | else |
| 227 | bb_printf("%-10d %-10d", shmid, ipcp->uid); | 227 | printf("%-10d %-10d", shmid, ipcp->uid); |
| 228 | bb_printf(" %-10d %-10d\n", shmseg.shm_cpid, shmseg.shm_lpid); | 228 | printf(" %-10d %-10d\n", shmseg.shm_cpid, shmseg.shm_lpid); |
| 229 | break; | 229 | break; |
| 230 | 230 | ||
| 231 | default: | 231 | default: |
| 232 | bb_printf("0x%08x ", ipcp->KEY); | 232 | printf("0x%08x ", ipcp->KEY); |
| 233 | if (pw) | 233 | if (pw) |
| 234 | bb_printf("%-10d %-10.10s", shmid, pw->pw_name); | 234 | printf("%-10d %-10.10s", shmid, pw->pw_name); |
| 235 | else | 235 | else |
| 236 | bb_printf("%-10d %-10d", shmid, ipcp->uid); | 236 | printf("%-10d %-10d", shmid, ipcp->uid); |
| 237 | bb_printf(" %-10o %-10lu %-10ld %-6s %-6s\n", ipcp->mode & 0777, | 237 | printf(" %-10o %-10lu %-10ld %-6s %-6s\n", ipcp->mode & 0777, |
| 238 | /* | 238 | /* |
| 239 | * earlier: int, Austin has size_t | 239 | * earlier: int, Austin has size_t |
| 240 | */ | 240 | */ |
| @@ -264,17 +264,17 @@ static void do_sem(void) | |||
| 264 | arg.array = (ushort *) (void *) &seminfo; | 264 | arg.array = (ushort *) (void *) &seminfo; |
| 265 | maxid = semctl(0, 0, SEM_INFO, arg); | 265 | maxid = semctl(0, 0, SEM_INFO, arg); |
| 266 | if (maxid < 0) { | 266 | if (maxid < 0) { |
| 267 | bb_printf("kernel not configured for %s\n", "semaphores"); | 267 | printf("kernel not configured for %s\n", "semaphores"); |
| 268 | return; | 268 | return; |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | switch (format) { | 271 | switch (format) { |
| 272 | case LIMITS: | 272 | case LIMITS: |
| 273 | bb_printf("------ Semaphore %s --------\n", "Limits"); | 273 | printf("------ Semaphore %s --------\n", "Limits"); |
| 274 | arg.array = (ushort *) (void *) &seminfo; /* damn union */ | 274 | arg.array = (ushort *) (void *) &seminfo; /* damn union */ |
| 275 | if ((semctl(0, 0, IPC_INFO, arg)) < 0) | 275 | if ((semctl(0, 0, IPC_INFO, arg)) < 0) |
| 276 | return; | 276 | return; |
| 277 | bb_printf("max number of arrays = %d\n" | 277 | printf("max number of arrays = %d\n" |
| 278 | "max semaphores per array = %d\n" | 278 | "max semaphores per array = %d\n" |
| 279 | "max semaphores system wide = %d\n" | 279 | "max semaphores system wide = %d\n" |
| 280 | "max ops per semop call = %d\n" | 280 | "max ops per semop call = %d\n" |
| @@ -285,21 +285,21 @@ static void do_sem(void) | |||
| 285 | return; | 285 | return; |
| 286 | 286 | ||
| 287 | case STATUS: | 287 | case STATUS: |
| 288 | bb_printf("------ Semaphore %s --------\n", "Status"); | 288 | printf("------ Semaphore %s --------\n", "Status"); |
| 289 | bb_printf( "used arrays = %d\n" | 289 | printf( "used arrays = %d\n" |
| 290 | "allocated semaphores = %d\n", | 290 | "allocated semaphores = %d\n", |
| 291 | seminfo.semusz, seminfo.semaem); | 291 | seminfo.semusz, seminfo.semaem); |
| 292 | return; | 292 | return; |
| 293 | 293 | ||
| 294 | case CREATOR: | 294 | case CREATOR: |
| 295 | bb_printf("------ Semaphore %s --------\n", "Arrays Creators/Owners"); | 295 | printf("------ Semaphore %s --------\n", "Arrays Creators/Owners"); |
| 296 | bb_printf( "%-10s %-10s %-10s %-10s %-10s %-10s\n", | 296 | printf( "%-10s %-10s %-10s %-10s %-10s %-10s\n", |
| 297 | "semid", "perms", "cuid", "cgid", "uid", "gid"); | 297 | "semid", "perms", "cuid", "cgid", "uid", "gid"); |
| 298 | break; | 298 | break; |
| 299 | 299 | ||
| 300 | case TIME: | 300 | case TIME: |
| 301 | bb_printf("------ Shared Memory %s --------\n", "Operation/Change Times"); | 301 | printf("------ Shared Memory %s --------\n", "Operation/Change Times"); |
| 302 | bb_printf( "%-8s %-10s %-26.24s %-26.24s\n", | 302 | printf( "%-8s %-10s %-26.24s %-26.24s\n", |
| 303 | "shmid", "owner", "last-op", "last-changed"); | 303 | "shmid", "owner", "last-op", "last-changed"); |
| 304 | break; | 304 | break; |
| 305 | 305 | ||
| @@ -307,8 +307,8 @@ static void do_sem(void) | |||
| 307 | break; | 307 | break; |
| 308 | 308 | ||
| 309 | default: | 309 | default: |
| 310 | bb_printf("------ Semaphore %s --------\n", "Arrays"); | 310 | printf("------ Semaphore %s --------\n", "Arrays"); |
| 311 | bb_printf( "%-10s %-10s %-10s %-10s %-10s\n", | 311 | printf( "%-10s %-10s %-10s %-10s %-10s\n", |
| 312 | "key", "semid", "owner", "perms", "nsems"); | 312 | "key", "semid", "owner", "perms", "nsems"); |
| 313 | break; | 313 | break; |
| 314 | } | 314 | } |
| @@ -326,25 +326,25 @@ static void do_sem(void) | |||
| 326 | switch (format) { | 326 | switch (format) { |
| 327 | case TIME: | 327 | case TIME: |
| 328 | if (pw) | 328 | if (pw) |
| 329 | bb_printf("%-8d %-10.10s", semid, pw->pw_name); | 329 | printf("%-8d %-10.10s", semid, pw->pw_name); |
| 330 | else | 330 | else |
| 331 | bb_printf("%-8d %-10d", semid, ipcp->uid); | 331 | printf("%-8d %-10d", semid, ipcp->uid); |
| 332 | /* ctime uses static buffer: use separate calls */ | 332 | /* ctime uses static buffer: use separate calls */ |
| 333 | bb_printf(" %-26.24s", semary.sem_otime | 333 | printf(" %-26.24s", semary.sem_otime |
| 334 | ? ctime(&semary.sem_otime) : "Not set"); | 334 | ? ctime(&semary.sem_otime) : "Not set"); |
| 335 | bb_printf(" %-26.24s\n", semary.sem_ctime | 335 | printf(" %-26.24s\n", semary.sem_ctime |
| 336 | ? ctime(&semary.sem_ctime) : "Not set"); | 336 | ? ctime(&semary.sem_ctime) : "Not set"); |
| 337 | break; | 337 | break; |
| 338 | case PID: | 338 | case PID: |
| 339 | break; | 339 | break; |
| 340 | 340 | ||
| 341 | default: | 341 | default: |
| 342 | bb_printf("0x%08x ", ipcp->KEY); | 342 | printf("0x%08x ", ipcp->KEY); |
| 343 | if (pw) | 343 | if (pw) |
| 344 | bb_printf("%-10d %-10.9s", semid, pw->pw_name); | 344 | printf("%-10d %-10.9s", semid, pw->pw_name); |
| 345 | else | 345 | else |
| 346 | bb_printf("%-10d %-9d", semid, ipcp->uid); | 346 | printf("%-10d %-9d", semid, ipcp->uid); |
| 347 | bb_printf(" %-10o %-10ld\n", ipcp->mode & 0777, | 347 | printf(" %-10o %-10ld\n", ipcp->mode & 0777, |
| 348 | /* | 348 | /* |
| 349 | * glibc-2.1.3 and earlier has unsigned short; | 349 | * glibc-2.1.3 and earlier has unsigned short; |
| 350 | * glibc-2.1.91 has variation between | 350 | * glibc-2.1.91 has variation between |
| @@ -368,7 +368,7 @@ static void do_msg(void) | |||
| 368 | 368 | ||
| 369 | maxid = msgctl(0, MSG_INFO, (struct msqid_ds *) (void *) &msginfo); | 369 | maxid = msgctl(0, MSG_INFO, (struct msqid_ds *) (void *) &msginfo); |
| 370 | if (maxid < 0) { | 370 | if (maxid < 0) { |
| 371 | bb_printf("kernel not configured for %s\n", "message queues"); | 371 | printf("kernel not configured for %s\n", "message queues"); |
| 372 | return; | 372 | return; |
| 373 | } | 373 | } |
| 374 | 374 | ||
| @@ -376,42 +376,42 @@ static void do_msg(void) | |||
| 376 | case LIMITS: | 376 | case LIMITS: |
| 377 | if ((msgctl(0, IPC_INFO, (struct msqid_ds *) (void *) &msginfo)) < 0) | 377 | if ((msgctl(0, IPC_INFO, (struct msqid_ds *) (void *) &msginfo)) < 0) |
| 378 | return; | 378 | return; |
| 379 | bb_printf("------ Message%s --------\n", "s: Limits"); | 379 | printf("------ Message%s --------\n", "s: Limits"); |
| 380 | bb_printf( "max queues system wide = %d\n" | 380 | printf( "max queues system wide = %d\n" |
| 381 | "max size of message (bytes) = %d\n" | 381 | "max size of message (bytes) = %d\n" |
| 382 | "default max size of queue (bytes) = %d\n", | 382 | "default max size of queue (bytes) = %d\n", |
| 383 | msginfo.msgmni, msginfo.msgmax, msginfo.msgmnb); | 383 | msginfo.msgmni, msginfo.msgmax, msginfo.msgmnb); |
| 384 | return; | 384 | return; |
| 385 | 385 | ||
| 386 | case STATUS: | 386 | case STATUS: |
| 387 | bb_printf("------ Message%s --------\n", "s: Status"); | 387 | printf("------ Message%s --------\n", "s: Status"); |
| 388 | bb_printf( "allocated queues = %d\n" | 388 | printf( "allocated queues = %d\n" |
| 389 | "used headers = %d\n" | 389 | "used headers = %d\n" |
| 390 | "used space = %d bytes\n", | 390 | "used space = %d bytes\n", |
| 391 | msginfo.msgpool, msginfo.msgmap, msginfo.msgtql); | 391 | msginfo.msgpool, msginfo.msgmap, msginfo.msgtql); |
| 392 | return; | 392 | return; |
| 393 | 393 | ||
| 394 | case CREATOR: | 394 | case CREATOR: |
| 395 | bb_printf("------ Message%s --------\n", " Queues: Creators/Owners"); | 395 | printf("------ Message%s --------\n", " Queues: Creators/Owners"); |
| 396 | bb_printf( "%-10s %-10s %-10s %-10s %-10s %-10s\n", | 396 | printf( "%-10s %-10s %-10s %-10s %-10s %-10s\n", |
| 397 | "msqid", "perms", "cuid", "cgid", "uid", "gid"); | 397 | "msqid", "perms", "cuid", "cgid", "uid", "gid"); |
| 398 | break; | 398 | break; |
| 399 | 399 | ||
| 400 | case TIME: | 400 | case TIME: |
| 401 | bb_printf("------ Message%s --------\n", " Queues Send/Recv/Change Times"); | 401 | printf("------ Message%s --------\n", " Queues Send/Recv/Change Times"); |
| 402 | bb_printf( "%-8s %-10s %-20s %-20s %-20s\n", | 402 | printf( "%-8s %-10s %-20s %-20s %-20s\n", |
| 403 | "msqid", "owner", "send", "recv", "change"); | 403 | "msqid", "owner", "send", "recv", "change"); |
| 404 | break; | 404 | break; |
| 405 | 405 | ||
| 406 | case PID: | 406 | case PID: |
| 407 | bb_printf("------ Message%s --------\n", " Queues PIDs"); | 407 | printf("------ Message%s --------\n", " Queues PIDs"); |
| 408 | bb_printf( "%-10s %-10s %-10s %-10s\n", | 408 | printf( "%-10s %-10s %-10s %-10s\n", |
| 409 | "msqid", "owner", "lspid", "lrpid"); | 409 | "msqid", "owner", "lspid", "lrpid"); |
| 410 | break; | 410 | break; |
| 411 | 411 | ||
| 412 | default: | 412 | default: |
| 413 | bb_printf("------ Message%s --------\n", " Queues"); | 413 | printf("------ Message%s --------\n", " Queues"); |
| 414 | bb_printf( "%-10s %-10s %-10s %-10s %-12s %-12s\n", | 414 | printf( "%-10s %-10s %-10s %-10s %-12s %-12s\n", |
| 415 | "key", "msqid", "owner", "perms", "used-bytes", "messages"); | 415 | "key", "msqid", "owner", "perms", "used-bytes", "messages"); |
| 416 | break; | 416 | break; |
| 417 | } | 417 | } |
| @@ -428,31 +428,31 @@ static void do_msg(void) | |||
| 428 | switch (format) { | 428 | switch (format) { |
| 429 | case TIME: | 429 | case TIME: |
| 430 | if (pw) | 430 | if (pw) |
| 431 | bb_printf("%-8d %-10.10s", msqid, pw->pw_name); | 431 | printf("%-8d %-10.10s", msqid, pw->pw_name); |
| 432 | else | 432 | else |
| 433 | bb_printf("%-8d %-10d", msqid, ipcp->uid); | 433 | printf("%-8d %-10d", msqid, ipcp->uid); |
| 434 | bb_printf(" %-20.16s", msgque.msg_stime | 434 | printf(" %-20.16s", msgque.msg_stime |
| 435 | ? ctime(&msgque.msg_stime) + 4 : "Not set"); | 435 | ? ctime(&msgque.msg_stime) + 4 : "Not set"); |
| 436 | bb_printf(" %-20.16s", msgque.msg_rtime | 436 | printf(" %-20.16s", msgque.msg_rtime |
| 437 | ? ctime(&msgque.msg_rtime) + 4 : "Not set"); | 437 | ? ctime(&msgque.msg_rtime) + 4 : "Not set"); |
| 438 | bb_printf(" %-20.16s\n", msgque.msg_ctime | 438 | printf(" %-20.16s\n", msgque.msg_ctime |
| 439 | ? ctime(&msgque.msg_ctime) + 4 : "Not set"); | 439 | ? ctime(&msgque.msg_ctime) + 4 : "Not set"); |
| 440 | break; | 440 | break; |
| 441 | case PID: | 441 | case PID: |
| 442 | if (pw) | 442 | if (pw) |
| 443 | bb_printf("%-8d %-10.10s", msqid, pw->pw_name); | 443 | printf("%-8d %-10.10s", msqid, pw->pw_name); |
| 444 | else | 444 | else |
| 445 | bb_printf("%-8d %-10d", msqid, ipcp->uid); | 445 | printf("%-8d %-10d", msqid, ipcp->uid); |
| 446 | bb_printf(" %5d %5d\n", msgque.msg_lspid, msgque.msg_lrpid); | 446 | printf(" %5d %5d\n", msgque.msg_lspid, msgque.msg_lrpid); |
| 447 | break; | 447 | break; |
| 448 | 448 | ||
| 449 | default: | 449 | default: |
| 450 | bb_printf("0x%08x ", ipcp->KEY); | 450 | printf("0x%08x ", ipcp->KEY); |
| 451 | if (pw) | 451 | if (pw) |
| 452 | bb_printf("%-10d %-10.10s", msqid, pw->pw_name); | 452 | printf("%-10d %-10.10s", msqid, pw->pw_name); |
| 453 | else | 453 | else |
| 454 | bb_printf("%-10d %-10d", msqid, ipcp->uid); | 454 | printf("%-10d %-10d", msqid, ipcp->uid); |
| 455 | bb_printf(" %-10o %-12ld %-12ld\n", ipcp->mode & 0777, | 455 | printf(" %-10o %-12ld %-12ld\n", ipcp->mode & 0777, |
| 456 | /* | 456 | /* |
| 457 | * glibc-2.1.3 and earlier has unsigned short; | 457 | * glibc-2.1.3 and earlier has unsigned short; |
| 458 | * glibc-2.1.91 has variation between | 458 | * glibc-2.1.91 has variation between |
| @@ -476,7 +476,7 @@ static void print_shm(int shmid) | |||
| 476 | return; | 476 | return; |
| 477 | } | 477 | } |
| 478 | 478 | ||
| 479 | bb_printf("\nShared memory Segment shmid=%d\n" | 479 | printf("\nShared memory Segment shmid=%d\n" |
| 480 | "uid=%d\tgid=%d\tcuid=%d\tcgid=%d\n" | 480 | "uid=%d\tgid=%d\tcuid=%d\tcgid=%d\n" |
| 481 | "mode=%#o\taccess_perms=%#o\n" | 481 | "mode=%#o\taccess_perms=%#o\n" |
| 482 | "bytes=%ld\tlpid=%d\tcpid=%d\tnattch=%ld\n", | 482 | "bytes=%ld\tlpid=%d\tcpid=%d\tnattch=%ld\n", |
| @@ -485,11 +485,11 @@ static void print_shm(int shmid) | |||
| 485 | ipcp->mode, ipcp->mode & 0777, | 485 | ipcp->mode, ipcp->mode & 0777, |
| 486 | (long) shmds.shm_segsz, shmds.shm_lpid, shmds.shm_cpid, | 486 | (long) shmds.shm_segsz, shmds.shm_lpid, shmds.shm_cpid, |
| 487 | (long) shmds.shm_nattch); | 487 | (long) shmds.shm_nattch); |
| 488 | bb_printf("att_time=%-26.24s\n", | 488 | printf("att_time=%-26.24s\n", |
| 489 | shmds.shm_atime ? ctime(&shmds.shm_atime) : "Not set"); | 489 | shmds.shm_atime ? ctime(&shmds.shm_atime) : "Not set"); |
| 490 | bb_printf("det_time=%-26.24s\n", | 490 | printf("det_time=%-26.24s\n", |
| 491 | shmds.shm_dtime ? ctime(&shmds.shm_dtime) : "Not set"); | 491 | shmds.shm_dtime ? ctime(&shmds.shm_dtime) : "Not set"); |
| 492 | bb_printf("change_time=%-26.24s\n\n", ctime(&shmds.shm_ctime)); | 492 | printf("change_time=%-26.24s\n\n", ctime(&shmds.shm_ctime)); |
| 493 | } | 493 | } |
| 494 | 494 | ||
| 495 | 495 | ||
| @@ -503,7 +503,7 @@ static void print_msg(int msqid) | |||
| 503 | return; | 503 | return; |
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | bb_printf("\nMessage Queue msqid=%d\n" | 506 | printf("\nMessage Queue msqid=%d\n" |
| 507 | "uid=%d\tgid=%d\tcuid=%d\tcgid=%d\tmode=%#o\n" | 507 | "uid=%d\tgid=%d\tcuid=%d\tcgid=%d\tmode=%#o\n" |
| 508 | "cbytes=%ld\tqbytes=%ld\tqnum=%ld\tlspid=%d\tlrpid=%d\n", | 508 | "cbytes=%ld\tqbytes=%ld\tqnum=%ld\tlspid=%d\tlrpid=%d\n", |
| 509 | msqid, ipcp->uid, ipcp->gid, ipcp->cuid, ipcp->cgid, ipcp->mode, | 509 | msqid, ipcp->uid, ipcp->gid, ipcp->cuid, ipcp->cgid, ipcp->mode, |
| @@ -516,11 +516,11 @@ static void print_msg(int msqid) | |||
| 516 | (long) buf.msg_cbytes, (long) buf.msg_qbytes, | 516 | (long) buf.msg_cbytes, (long) buf.msg_qbytes, |
| 517 | (long) buf.msg_qnum, buf.msg_lspid, buf.msg_lrpid); | 517 | (long) buf.msg_qnum, buf.msg_lspid, buf.msg_lrpid); |
| 518 | 518 | ||
| 519 | bb_printf("send_time=%-26.24s\n", | 519 | printf("send_time=%-26.24s\n", |
| 520 | buf.msg_stime ? ctime(&buf.msg_stime) : "Not set"); | 520 | buf.msg_stime ? ctime(&buf.msg_stime) : "Not set"); |
| 521 | bb_printf("rcv_time=%-26.24s\n", | 521 | printf("rcv_time=%-26.24s\n", |
| 522 | buf.msg_rtime ? ctime(&buf.msg_rtime) : "Not set"); | 522 | buf.msg_rtime ? ctime(&buf.msg_rtime) : "Not set"); |
| 523 | bb_printf("change_time=%-26.24s\n\n", | 523 | printf("change_time=%-26.24s\n\n", |
| 524 | buf.msg_ctime ? ctime(&buf.msg_ctime) : "Not set"); | 524 | buf.msg_ctime ? ctime(&buf.msg_ctime) : "Not set"); |
| 525 | } | 525 | } |
| 526 | 526 | ||
| @@ -537,7 +537,7 @@ static void print_sem(int semid) | |||
| 537 | return; | 537 | return; |
| 538 | } | 538 | } |
| 539 | 539 | ||
| 540 | bb_printf("\nSemaphore Array semid=%d\n" | 540 | printf("\nSemaphore Array semid=%d\n" |
| 541 | "uid=%d\t gid=%d\t cuid=%d\t cgid=%d\n" | 541 | "uid=%d\t gid=%d\t cuid=%d\t cgid=%d\n" |
| 542 | "mode=%#o, access_perms=%#o\n" | 542 | "mode=%#o, access_perms=%#o\n" |
| 543 | "nsems = %ld\n" | 543 | "nsems = %ld\n" |
| @@ -547,7 +547,7 @@ static void print_sem(int semid) | |||
| 547 | ipcp->mode, ipcp->mode & 0777, | 547 | ipcp->mode, ipcp->mode & 0777, |
| 548 | (long) semds.sem_nsems, | 548 | (long) semds.sem_nsems, |
| 549 | semds.sem_otime ? ctime(&semds.sem_otime) : "Not set"); | 549 | semds.sem_otime ? ctime(&semds.sem_otime) : "Not set"); |
| 550 | bb_printf("ctime = %-26.24s\n" | 550 | printf("ctime = %-26.24s\n" |
| 551 | "%-10s %-10s %-10s %-10s %-10s\n", | 551 | "%-10s %-10s %-10s %-10s %-10s\n", |
| 552 | ctime(&semds.sem_ctime), | 552 | ctime(&semds.sem_ctime), |
| 553 | "semnum", "value", "ncount", "zcount", "pid"); | 553 | "semnum", "value", "ncount", "zcount", "pid"); |
| @@ -563,9 +563,9 @@ static void print_sem(int semid) | |||
| 563 | if (val < 0 || ncnt < 0 || zcnt < 0 || pid < 0) { | 563 | if (val < 0 || ncnt < 0 || zcnt < 0 || pid < 0) { |
| 564 | bb_perror_msg_and_die("semctl"); | 564 | bb_perror_msg_and_die("semctl"); |
| 565 | } | 565 | } |
| 566 | bb_printf("%-10d %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid); | 566 | printf("%-10d %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid); |
| 567 | } | 567 | } |
| 568 | bb_printf("\n"); | 568 | puts(""); |
| 569 | } | 569 | } |
| 570 | 570 | ||
| 571 | int ipcs_main(int argc, char **argv) | 571 | int ipcs_main(int argc, char **argv) |
| @@ -597,34 +597,34 @@ int ipcs_main(int argc, char **argv) | |||
| 597 | if (flags & flag_print) { | 597 | if (flags & flag_print) { |
| 598 | if (flags & flag_shm) { | 598 | if (flags & flag_shm) { |
| 599 | print_shm(id); | 599 | print_shm(id); |
| 600 | bb_fflush_stdout_and_exit(0); | 600 | fflush_stdout_and_exit(0); |
| 601 | } | 601 | } |
| 602 | if (flags & flag_sem) { | 602 | if (flags & flag_sem) { |
| 603 | print_sem(id); | 603 | print_sem(id); |
| 604 | bb_fflush_stdout_and_exit(0); | 604 | fflush_stdout_and_exit(0); |
| 605 | } | 605 | } |
| 606 | if (flags & flag_msg) { | 606 | if (flags & flag_msg) { |
| 607 | print_msg(id); | 607 | print_msg(id); |
| 608 | bb_fflush_stdout_and_exit(0); | 608 | fflush_stdout_and_exit(0); |
| 609 | } | 609 | } |
| 610 | bb_show_usage(); | 610 | bb_show_usage(); |
| 611 | } | 611 | } |
| 612 | 612 | ||
| 613 | if (!(flags & (flag_shm | flag_msg | flag_sem))) | 613 | if (!(flags & (flag_shm | flag_msg | flag_sem))) |
| 614 | flags |= flag_msg | flag_shm | flag_sem; | 614 | flags |= flag_msg | flag_shm | flag_sem; |
| 615 | bb_printf("\n"); | 615 | puts(""); |
| 616 | 616 | ||
| 617 | if (flags & flag_shm) { | 617 | if (flags & flag_shm) { |
| 618 | do_shm(); | 618 | do_shm(); |
| 619 | bb_printf("\n"); | 619 | puts(""); |
| 620 | } | 620 | } |
| 621 | if (flags & flag_sem) { | 621 | if (flags & flag_sem) { |
| 622 | do_sem(); | 622 | do_sem(); |
| 623 | bb_printf("\n"); | 623 | puts(""); |
| 624 | } | 624 | } |
| 625 | if (flags & flag_msg) { | 625 | if (flags & flag_msg) { |
| 626 | do_msg(); | 626 | do_msg(); |
| 627 | bb_printf("\n"); | 627 | puts(""); |
| 628 | } | 628 | } |
| 629 | return EXIT_SUCCESS; | 629 | fflush_stdout_and_exit(0); |
| 630 | } | 630 | } |
