aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorJames Byrne <james.byrne@origamienergy.com>2019-07-02 11:35:03 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-07-02 11:35:03 +0200
commit6937487be73cd4563b876413277a295a5fe2f32c (patch)
treef16cc9999a7c827891e6ec8d99c699fc791008ee /util-linux
parentcaecfdc20d450686cd1f7e9b5f650322f894b3c2 (diff)
downloadbusybox-w32-6937487be73cd4563b876413277a295a5fe2f32c.tar.gz
busybox-w32-6937487be73cd4563b876413277a295a5fe2f32c.tar.bz2
busybox-w32-6937487be73cd4563b876413277a295a5fe2f32c.zip
libbb: reduce the overhead of single parameter bb_error_msg() calls
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/acpid.c2
-rw-r--r--util-linux/dmesg.c4
-rw-r--r--util-linux/eject.c2
-rw-r--r--util-linux/fdformat.c2
-rw-r--r--util-linux/fdisk.c2
-rw-r--r--util-linux/flock.c2
-rw-r--r--util-linux/fsck_minix.c2
-rw-r--r--util-linux/getopt.c6
-rw-r--r--util-linux/hwclock.c4
-rw-r--r--util-linux/ipcs.c8
-rw-r--r--util-linux/last.c2
-rw-r--r--util-linux/losetup.c4
-rw-r--r--util-linux/mdev.c10
-rw-r--r--util-linux/mesg.c2
-rw-r--r--util-linux/mkfs_ext2.c6
-rw-r--r--util-linux/mkfs_minix.c22
-rw-r--r--util-linux/mkfs_reiser.c2
-rw-r--r--util-linux/mkfs_vfat.c6
-rw-r--r--util-linux/mkswap.c2
-rw-r--r--util-linux/mount.c40
-rw-r--r--util-linux/nsenter.c2
-rw-r--r--util-linux/rdate.c6
-rw-r--r--util-linux/readprofile.c4
-rw-r--r--util-linux/rtcwake.c2
-rw-r--r--util-linux/setpriv.c8
-rw-r--r--util-linux/switch_root.c6
-rw-r--r--util-linux/uevent.c4
-rw-r--r--util-linux/unshare.c2
28 files changed, 85 insertions, 79 deletions
diff --git a/util-linux/acpid.c b/util-linux/acpid.c
index 7274b6866..95f8150e2 100644
--- a/util-linux/acpid.c
+++ b/util-linux/acpid.c
@@ -148,7 +148,7 @@ static void process_event(const char *event)
148 const char *args[] = { "run-parts", handler, NULL }; 148 const char *args[] = { "run-parts", handler, NULL };
149 149
150 // log the event 150 // log the event
151 bb_error_msg("%s", event); 151 bb_simple_error_msg(event);
152 152
153 // spawn handler 153 // spawn handler
154 // N.B. run-parts would require scripts to have #!/bin/sh 154 // N.B. run-parts would require scripts to have #!/bin/sh
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index b797c7b2a..a1f269142 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -74,7 +74,7 @@ int dmesg_main(int argc UNUSED_PARAM, char **argv)
74 opts = getopt32(argv, "cs:+n:+r", &len, &level); 74 opts = getopt32(argv, "cs:+n:+r", &len, &level);
75 if (opts & OPT_n) { 75 if (opts & OPT_n) {
76 if (klogctl(8, NULL, (long) level)) 76 if (klogctl(8, NULL, (long) level))
77 bb_perror_msg_and_die("klogctl"); 77 bb_simple_perror_msg_and_die("klogctl");
78 return EXIT_SUCCESS; 78 return EXIT_SUCCESS;
79 } 79 }
80 80
@@ -88,7 +88,7 @@ int dmesg_main(int argc UNUSED_PARAM, char **argv)
88 buf = xmalloc(len); 88 buf = xmalloc(len);
89 len = klogctl(3 + (opts & OPT_c), buf, len); /* read ring buffer */ 89 len = klogctl(3 + (opts & OPT_c), buf, len); /* read ring buffer */
90 if (len < 0) 90 if (len < 0)
91 bb_perror_msg_and_die("klogctl"); 91 bb_simple_perror_msg_and_die("klogctl");
92 if (len == 0) 92 if (len == 0)
93 return EXIT_SUCCESS; 93 return EXIT_SUCCESS;
94 94
diff --git a/util-linux/eject.c b/util-linux/eject.c
index 749e2c986..3ccb4ae89 100644
--- a/util-linux/eject.c
+++ b/util-linux/eject.c
@@ -70,7 +70,7 @@ static void eject_scsi(const char *dev)
70 sg_io_hdr_t io_hdr; 70 sg_io_hdr_t io_hdr;
71 71
72 if ((ioctl(dev_fd, SG_GET_VERSION_NUM, &i) < 0) || (i < 30000)) 72 if ((ioctl(dev_fd, SG_GET_VERSION_NUM, &i) < 0) || (i < 30000))
73 bb_error_msg_and_die("not a sg device or old sg driver"); 73 bb_simple_error_msg_and_die("not a sg device or old sg driver");
74 74
75 memset(&io_hdr, 0, sizeof(sg_io_hdr_t)); 75 memset(&io_hdr, 0, sizeof(sg_io_hdr_t));
76 io_hdr.interface_id = 'S'; 76 io_hdr.interface_id = 'S';
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c
index ff3bc4870..e1c8561d6 100644
--- a/util-linux/fdformat.c
+++ b/util-linux/fdformat.c
@@ -117,7 +117,7 @@ int fdformat_main(int argc UNUSED_PARAM, char **argv)
117 read_bytes = safe_read(fd, data, n); 117 read_bytes = safe_read(fd, data, n);
118 if (read_bytes != n) { 118 if (read_bytes != n) {
119 if (read_bytes < 0) { 119 if (read_bytes < 0) {
120 bb_perror_msg(bb_msg_read_error); 120 bb_simple_perror_msg(bb_msg_read_error);
121 } 121 }
122 bb_error_msg_and_die("problem reading cylinder %d, " 122 bb_error_msg_and_die("problem reading cylinder %d, "
123 "expected %d, read %d", cyl, n, read_bytes); 123 "expected %d, read %d", cyl, n, read_bytes);
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 58e93bb92..f28d4fdd2 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -511,7 +511,7 @@ static sector_t bb_BLKGETSIZE_sectors(int fd)
511 * we support can't record more than 32 bit 511 * we support can't record more than 32 bit
512 * sector counts or offsets 512 * sector counts or offsets
513 */ 513 */
514 bb_error_msg("device has more than 2^32 sectors, can't use all of them"); 514 bb_simple_error_msg("device has more than 2^32 sectors, can't use all of them");
515 v64 = (uint32_t)-1L; 515 v64 = (uint32_t)-1L;
516 } 516 }
517 return v64; 517 return v64;
diff --git a/util-linux/flock.c b/util-linux/flock.c
index 130627e93..12c16013c 100644
--- a/util-linux/flock.c
+++ b/util-linux/flock.c
@@ -73,7 +73,7 @@ int flock_main(int argc UNUSED_PARAM, char **argv)
73 ) { 73 ) {
74 argv++; 74 argv++;
75 if (argv[1]) 75 if (argv[1])
76 bb_error_msg_and_die("-c takes only one argument"); 76 bb_simple_error_msg_and_die("-c takes only one argument");
77 opt |= OPT_c; 77 opt |= OPT_c;
78 } 78 }
79 79
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index f523da945..40b86d01b 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -321,7 +321,7 @@ static void die(const char *str)
321{ 321{
322 if (termios_set) 322 if (termios_set)
323 tcsetattr_stdin_TCSANOW(&sv_termios); 323 tcsetattr_stdin_TCSANOW(&sv_termios);
324 bb_error_msg_and_die("%s", str); 324 bb_simple_error_msg_and_die(str);
325} 325}
326 326
327static void push_filename(const char *name) 327static void push_filename(const char *name)
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 1666d3d30..db7db6ff8 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -308,7 +308,7 @@ static struct option *add_long_options(struct option *long_options, char *option
308 } 308 }
309 tokptr[tlen] = '\0'; 309 tokptr[tlen] = '\0';
310 if (tlen == 0) 310 if (tlen == 0)
311 bb_error_msg_and_die("empty long option specified"); 311 bb_simple_error_msg_and_die("empty long option specified");
312 } 312 }
313 long_options = xrealloc_vector(long_options, 4, long_nr); 313 long_options = xrealloc_vector(long_options, 4, long_nr);
314 long_options[long_nr].has_arg = arg_opt; 314 long_options[long_nr].has_arg = arg_opt;
@@ -380,7 +380,7 @@ int getopt_main(int argc, char **argv)
380 puts(" --"); 380 puts(" --");
381 return 0; 381 return 0;
382 } 382 }
383 bb_error_msg_and_die("missing optstring argument"); 383 bb_simple_error_msg_and_die("missing optstring argument");
384 } 384 }
385 385
386 if (argv[1][0] != '-' || compatible) { 386 if (argv[1][0] != '-' || compatible) {
@@ -416,7 +416,7 @@ int getopt_main(int argc, char **argv)
416 if (!optstr) { 416 if (!optstr) {
417 optstr = argv[++n]; 417 optstr = argv[++n];
418 if (!optstr) 418 if (!optstr)
419 bb_error_msg_and_die("missing optstring argument"); 419 bb_simple_error_msg_and_die("missing optstring argument");
420 } 420 }
421 421
422 argv[n] = name ? name : argv[0]; 422 argv[n] = name ? name : argv[0];
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 29f51021e..dc97d8fb4 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -132,7 +132,7 @@ static void to_sys_clock(const char **pp_rtcname, int utc)
132 tv.tv_sec = read_rtc(pp_rtcname, NULL, utc); 132 tv.tv_sec = read_rtc(pp_rtcname, NULL, utc);
133 tv.tv_usec = 0; 133 tv.tv_usec = 0;
134 if (settimeofday(&tv, &tz)) 134 if (settimeofday(&tv, &tz))
135 bb_perror_msg_and_die("settimeofday"); 135 bb_simple_perror_msg_and_die("settimeofday");
136} 136}
137 137
138static void from_sys_clock(const char **pp_rtcname, int utc) 138static void from_sys_clock(const char **pp_rtcname, int utc)
@@ -284,7 +284,7 @@ static void set_system_clock_timezone(int utc)
284 if (!utc) 284 if (!utc)
285 tv.tv_sec += tz.tz_minuteswest * 60; 285 tv.tv_sec += tz.tz_minuteswest * 60;
286 if (settimeofday(&tv, &tz)) 286 if (settimeofday(&tv, &tz))
287 bb_perror_msg_and_die("settimeofday"); 287 bb_simple_perror_msg_and_die("settimeofday");
288} 288}
289 289
290//usage:#define hwclock_trivial_usage 290//usage:#define hwclock_trivial_usage
diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c
index 4863a5c29..df86cfb9d 100644
--- a/util-linux/ipcs.c
+++ b/util-linux/ipcs.c
@@ -467,7 +467,7 @@ static void print_shm(int shmid)
467 struct ipc_perm *ipcp = &shmds.shm_perm; 467 struct ipc_perm *ipcp = &shmds.shm_perm;
468 468
469 if (shmctl(shmid, IPC_STAT, &shmds) == -1) { 469 if (shmctl(shmid, IPC_STAT, &shmds) == -1) {
470 bb_perror_msg("shmctl"); 470 bb_simple_perror_msg("shmctl");
471 return; 471 return;
472 } 472 }
473 473
@@ -493,7 +493,7 @@ static void print_msg(int msqid)
493 struct ipc_perm *ipcp = &buf.msg_perm; 493 struct ipc_perm *ipcp = &buf.msg_perm;
494 494
495 if (msgctl(msqid, IPC_STAT, &buf) == -1) { 495 if (msgctl(msqid, IPC_STAT, &buf) == -1) {
496 bb_perror_msg("msgctl"); 496 bb_simple_perror_msg("msgctl");
497 return; 497 return;
498 } 498 }
499 499
@@ -527,7 +527,7 @@ static void print_sem(int semid)
527 527
528 arg.buf = &semds; 528 arg.buf = &semds;
529 if (semctl(semid, 0, IPC_STAT, arg)) { 529 if (semctl(semid, 0, IPC_STAT, arg)) {
530 bb_perror_msg("semctl"); 530 bb_simple_perror_msg("semctl");
531 return; 531 return;
532 } 532 }
533 533
@@ -555,7 +555,7 @@ static void print_sem(int semid)
555 zcnt = semctl(semid, i, GETZCNT, arg); 555 zcnt = semctl(semid, i, GETZCNT, arg);
556 pid = semctl(semid, i, GETPID, arg); 556 pid = semctl(semid, i, GETPID, arg);
557 if (val < 0 || ncnt < 0 || zcnt < 0 || pid < 0) { 557 if (val < 0 || ncnt < 0 || zcnt < 0 || pid < 0) {
558 bb_perror_msg_and_die("semctl"); 558 bb_simple_perror_msg_and_die("semctl");
559 } 559 }
560 printf("%-10u %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid); 560 printf("%-10u %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid);
561 } 561 }
diff --git a/util-linux/last.c b/util-linux/last.c
index 689aa7a34..24ce7a8d8 100644
--- a/util-linux/last.c
+++ b/util-linux/last.c
@@ -100,7 +100,7 @@ int last_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
100 pos = lseek(file, pos - sizeof(ut), SEEK_SET); 100 pos = lseek(file, pos - sizeof(ut), SEEK_SET);
101 while ((n = full_read(file, &ut, sizeof(ut))) > 0) { 101 while ((n = full_read(file, &ut, sizeof(ut))) > 0) {
102 if (n != sizeof(ut)) { 102 if (n != sizeof(ut)) {
103 bb_perror_msg_and_die("short read"); 103 bb_simple_perror_msg_and_die("short read");
104 } 104 }
105 n = index_in_strings(_ut_lin, ut.ut_line); 105 n = index_in_strings(_ut_lin, ut.ut_line);
106 if (n == _TILDE) { /* '~' */ 106 if (n == _TILDE) { /* '~' */
diff --git a/util-linux/losetup.c b/util-linux/losetup.c
index 5dc757074..cc6c2b1d5 100644
--- a/util-linux/losetup.c
+++ b/util-linux/losetup.c
@@ -118,13 +118,13 @@ int losetup_main(int argc UNUSED_PARAM, char **argv)
118 118
119 n = get_free_loop(); 119 n = get_free_loop();
120 if (n == -1) 120 if (n == -1)
121 bb_error_msg_and_die("no free loop devices"); 121 bb_simple_error_msg_and_die("no free loop devices");
122 if (n < 0) /* n == -2: no /dev/loop-control, use legacy method */ 122 if (n < 0) /* n == -2: no /dev/loop-control, use legacy method */
123 n = 0; 123 n = 0;
124 /* or: n >= 0: the number of next free loopdev, just verify it */ 124 /* or: n >= 0: the number of next free loopdev, just verify it */
125 do { 125 do {
126 if (n > MAX_LOOP_NUM) 126 if (n > MAX_LOOP_NUM)
127 bb_error_msg_and_die("no free loop devices"); 127 bb_simple_error_msg_and_die("no free loop devices");
128 sprintf(dev, LOOP_FORMAT, n++); 128 sprintf(dev, LOOP_FORMAT, n++);
129 s = query_loop(dev); 129 s = query_loop(dev);
130 free(s); 130 free(s);
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 9cb3586f1..207a112c1 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -250,18 +250,24 @@
250 250
251#if DEBUG_LVL >= 1 251#if DEBUG_LVL >= 1
252# define dbg1(...) do { if (G.verbose) bb_error_msg(__VA_ARGS__); } while(0) 252# define dbg1(...) do { if (G.verbose) bb_error_msg(__VA_ARGS__); } while(0)
253# define dbg1s(msg) do { if (G.verbose) bb_simple_error_msg(msg); } while(0)
253#else 254#else
254# define dbg1(...) ((void)0) 255# define dbg1(...) ((void)0)
256# define dbg1s(msg) ((void)0)
255#endif 257#endif
256#if DEBUG_LVL >= 2 258#if DEBUG_LVL >= 2
257# define dbg2(...) do { if (G.verbose >= 2) bb_error_msg(__VA_ARGS__); } while(0) 259# define dbg2(...) do { if (G.verbose >= 2) bb_error_msg(__VA_ARGS__); } while(0)
260# define dbg2s(msg) do { if (G.verbose >= 2) bb_simple_error_msg(msg); } while(0)
258#else 261#else
259# define dbg2(...) ((void)0) 262# define dbg2(...) ((void)0)
263# define dbg2s(msg) ((void)0)
260#endif 264#endif
261#if DEBUG_LVL >= 3 265#if DEBUG_LVL >= 3
262# define dbg3(...) do { if (G.verbose >= 3) bb_error_msg(__VA_ARGS__); } while(0) 266# define dbg3(...) do { if (G.verbose >= 3) bb_error_msg(__VA_ARGS__); } while(0)
267# define dbg3s(msg) do { if (G.verbose >= 3) bb_simple_error_msg(msg); } while(0)
263#else 268#else
264# define dbg3(...) ((void)0) 269# define dbg3(...) ((void)0)
270# define dbg3s(msg) ((void)0)
265#endif 271#endif
266 272
267 273
@@ -1021,7 +1027,7 @@ wait_for_seqfile(unsigned expected_seq)
1021 /* seed file: write out seq ASAP */ 1027 /* seed file: write out seq ASAP */
1022 xwrite_str(seq_fd, utoa(expected_seq)); 1028 xwrite_str(seq_fd, utoa(expected_seq));
1023 xlseek(seq_fd, 0, SEEK_SET); 1029 xlseek(seq_fd, 0, SEEK_SET);
1024 dbg2("first seq written"); 1030 dbg2s("first seq written");
1025 break; 1031 break;
1026 } 1032 }
1027 seqbufnum = atoll(seqbuf); 1033 seqbufnum = atoll(seqbuf);
@@ -1165,7 +1171,7 @@ static void daemon_loop(char *temp, int fd)
1165 1171
1166 len = safe_read(fd, netbuf, sizeof(netbuf) - 1); 1172 len = safe_read(fd, netbuf, sizeof(netbuf) - 1);
1167 if (len < 0) { 1173 if (len < 0) {
1168 bb_perror_msg_and_die("read"); 1174 bb_simple_perror_msg_and_die("read");
1169 } 1175 }
1170 end = netbuf + len; 1176 end = netbuf + len;
1171 *end = '\0'; 1177 *end = '\0';
diff --git a/util-linux/mesg.c b/util-linux/mesg.c
index c7b696853..8c032555b 100644
--- a/util-linux/mesg.c
+++ b/util-linux/mesg.c
@@ -65,7 +65,7 @@ int mesg_main(int argc UNUSED_PARAM, char **argv)
65 */ 65 */
66 66
67 if (!isatty(STDIN_FILENO)) 67 if (!isatty(STDIN_FILENO))
68 bb_error_msg_and_die("not a tty"); 68 bb_simple_error_msg_and_die("not a tty");
69 69
70 xfstat(STDIN_FILENO, &sb, "stdin"); 70 xfstat(STDIN_FILENO, &sb, "stdin");
71 if (c == 0) { 71 if (c == 0) {
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
index 845ba0a24..d568f4be5 100644
--- a/util-linux/mkfs_ext2.c
+++ b/util-linux/mkfs_ext2.c
@@ -266,7 +266,7 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
266 // N.B. what if we format a file? find_mount_point will return false negative since 266 // N.B. what if we format a file? find_mount_point will return false negative since
267 // it is loop block device which is mounted! 267 // it is loop block device which is mounted!
268 if (find_mount_point(argv[0], 0)) 268 if (find_mount_point(argv[0], 0))
269 bb_error_msg_and_die("can't format mounted filesystem"); 269 bb_simple_error_msg_and_die("can't format mounted filesystem");
270 270
271 // get size in kbytes 271 // get size in kbytes
272 kilobytes = get_volume_size_in_bytes(fd, argv[1], 1024, /*extend:*/ !(option_mask32 & OPT_n)) / 1024; 272 kilobytes = get_volume_size_in_bytes(fd, argv[1], 1024, /*extend:*/ !(option_mask32 & OPT_n)) / 1024;
@@ -326,11 +326,11 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
326 kilobytes >>= (blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE); 326 kilobytes >>= (blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE);
327 nblocks = kilobytes; 327 nblocks = kilobytes;
328 if (nblocks != kilobytes) 328 if (nblocks != kilobytes)
329 bb_error_msg_and_die("block count doesn't fit in 32 bits"); 329 bb_simple_error_msg_and_die("block count doesn't fit in 32 bits");
330#define kilobytes kilobytes_unused_after_this 330#define kilobytes kilobytes_unused_after_this
331 // Experimentally, standard mke2fs won't work on images smaller than 60k 331 // Experimentally, standard mke2fs won't work on images smaller than 60k
332 if (nblocks < 60) 332 if (nblocks < 60)
333 bb_error_msg_and_die("need >= 60 blocks"); 333 bb_simple_error_msg_and_die("need >= 60 blocks");
334 334
335 // How many reserved blocks? 335 // How many reserved blocks?
336 if (reserved_percent > 50) 336 if (reserved_percent > 50)
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index e191acbd0..8f791cf66 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -262,7 +262,7 @@ static int get_free_block(void)
262 int blk; 262 int blk;
263 263
264 if (G.used_good_blocks + 1 >= MAX_GOOD_BLOCKS) 264 if (G.used_good_blocks + 1 >= MAX_GOOD_BLOCKS)
265 bb_error_msg_and_die("too many bad blocks"); 265 bb_simple_error_msg_and_die("too many bad blocks");
266 if (G.used_good_blocks) 266 if (G.used_good_blocks)
267 blk = G.good_blocks_table[G.used_good_blocks - 1] + 1; 267 blk = G.good_blocks_table[G.used_good_blocks - 1] + 1;
268 else 268 else
@@ -270,7 +270,7 @@ static int get_free_block(void)
270 while (blk < SB_ZONES && zone_in_use(blk)) 270 while (blk < SB_ZONES && zone_in_use(blk))
271 blk++; 271 blk++;
272 if (blk >= SB_ZONES) 272 if (blk >= SB_ZONES)
273 bb_error_msg_and_die("not enough good blocks"); 273 bb_simple_error_msg_and_die("not enough good blocks");
274 G.good_blocks_table[G.used_good_blocks] = blk; 274 G.good_blocks_table[G.used_good_blocks] = blk;
275 G.used_good_blocks++; 275 G.used_good_blocks++;
276 return blk; 276 return blk;
@@ -342,7 +342,7 @@ static void make_bad_inode(void)
342 goto end_bad; 342 goto end_bad;
343 } 343 }
344 } 344 }
345 bb_error_msg_and_die("too many bad blocks"); 345 bb_simple_error_msg_and_die("too many bad blocks");
346 end_bad: 346 end_bad:
347 if (ind) 347 if (ind)
348 write_block(ind, (char *) ind_block); 348 write_block(ind, (char *) ind_block);
@@ -398,7 +398,7 @@ static void make_bad_inode2(void)
398 } 398 }
399 } 399 }
400 /* Could make triple indirect block here */ 400 /* Could make triple indirect block here */
401 bb_error_msg_and_die("too many bad blocks"); 401 bb_simple_error_msg_and_die("too many bad blocks");
402 end_bad: 402 end_bad:
403 if (ind) 403 if (ind)
404 write_block(ind, (char *) ind_block); 404 write_block(ind, (char *) ind_block);
@@ -514,7 +514,7 @@ static void check_blocks(void)
514 if (got == try) 514 if (got == try)
515 continue; 515 continue;
516 if (G.currently_testing < SB_FIRSTZONE) 516 if (G.currently_testing < SB_FIRSTZONE)
517 bb_error_msg_and_die("bad blocks before data-area: cannot make fs"); 517 bb_simple_error_msg_and_die("bad blocks before data-area: cannot make fs");
518 mark_zone(G.currently_testing); 518 mark_zone(G.currently_testing);
519 G.badblocks++; 519 G.badblocks++;
520 G.currently_testing++; 520 G.currently_testing++;
@@ -588,7 +588,7 @@ static void setup_tables(void)
588 SB_ZMAPS = sb_zmaps; 588 SB_ZMAPS = sb_zmaps;
589 /* new SB_ZMAPS, need to recalc NORM_FIRSTZONE */ 589 /* new SB_ZMAPS, need to recalc NORM_FIRSTZONE */
590 } while (--i); 590 } while (--i);
591 bb_error_msg_and_die("incompatible size/inode count, try different -i N"); 591 bb_simple_error_msg_and_die("incompatible size/inode count, try different -i N");
592 got_it: 592 got_it:
593 593
594 SB_FIRSTZONE = norm_firstzone; 594 SB_FIRSTZONE = norm_firstzone;
@@ -623,10 +623,10 @@ int mkfs_minix_main(int argc UNUSED_PARAM, char **argv)
623 G.magic = MINIX1_SUPER_MAGIC2; 623 G.magic = MINIX1_SUPER_MAGIC2;
624 624
625 if (INODE_SIZE1 * MINIX1_INODES_PER_BLOCK != BLOCK_SIZE) 625 if (INODE_SIZE1 * MINIX1_INODES_PER_BLOCK != BLOCK_SIZE)
626 bb_error_msg_and_die("bad inode size"); 626 bb_simple_error_msg_and_die("bad inode size");
627#if ENABLE_FEATURE_MINIX2 627#if ENABLE_FEATURE_MINIX2
628 if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE) 628 if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
629 bb_error_msg_and_die("bad inode size"); 629 bb_simple_error_msg_and_die("bad inode size");
630#endif 630#endif
631 631
632 opt = getopt32(argv, "ci:l:n:+v", &str_i, &listfile, &G.namelen); 632 opt = getopt32(argv, "ci:l:n:+v", &str_i, &listfile, &G.namelen);
@@ -644,7 +644,7 @@ int mkfs_minix_main(int argc UNUSED_PARAM, char **argv)
644#if ENABLE_FEATURE_MINIX2 644#if ENABLE_FEATURE_MINIX2
645 version2 = 1; 645 version2 = 1;
646#else 646#else
647 bb_error_msg_and_die("not compiled with minix v2 support"); 647 bb_simple_error_msg_and_die("not compiled with minix v2 support");
648#endif 648#endif
649 } 649 }
650 650
@@ -654,14 +654,14 @@ int mkfs_minix_main(int argc UNUSED_PARAM, char **argv)
654 654
655 /* Check if it is mounted */ 655 /* Check if it is mounted */
656 if (find_mount_point(G.device_name, 0)) 656 if (find_mount_point(G.device_name, 0))
657 bb_error_msg_and_die("can't format mounted filesystem"); 657 bb_simple_error_msg_and_die("can't format mounted filesystem");
658 658
659 xmove_fd(xopen(G.device_name, O_RDWR), dev_fd); 659 xmove_fd(xopen(G.device_name, O_RDWR), dev_fd);
660 660
661 G.total_blocks = get_volume_size_in_bytes(dev_fd, argv[1], 1024, /*extend:*/ 1) / 1024; 661 G.total_blocks = get_volume_size_in_bytes(dev_fd, argv[1], 1024, /*extend:*/ 1) / 1024;
662 662
663 if (G.total_blocks < 10) 663 if (G.total_blocks < 10)
664 bb_error_msg_and_die("must have at least 10 blocks"); 664 bb_simple_error_msg_and_die("must have at least 10 blocks");
665 665
666 if (version2) { 666 if (version2) {
667 G.magic = MINIX2_SUPER_MAGIC2; 667 G.magic = MINIX2_SUPER_MAGIC2;
diff --git a/util-linux/mkfs_reiser.c b/util-linux/mkfs_reiser.c
index b4c8dda6f..d2eaf5f94 100644
--- a/util-linux/mkfs_reiser.c
+++ b/util-linux/mkfs_reiser.c
@@ -178,7 +178,7 @@ int mkfs_reiser_main(int argc UNUSED_PARAM, char **argv)
178 // N.B. what if we format a file? find_mount_point will return false negative since 178 // N.B. what if we format a file? find_mount_point will return false negative since
179 // it is loop block device which is mounted! 179 // it is loop block device which is mounted!
180 if (find_mount_point(argv[0], 0)) 180 if (find_mount_point(argv[0], 0))
181 bb_error_msg_and_die("can't format mounted filesystem"); 181 bb_simple_error_msg_and_die("can't format mounted filesystem");
182 182
183 // open the device, get size in blocks 183 // open the device, get size in blocks
184 blocks = get_volume_size_in_bytes(fd, argv[1], blocksize, /*extend:*/ 1) / blocksize; 184 blocks = get_volume_size_in_bytes(fd, argv[1], blocksize, /*extend:*/ 1) / blocksize;
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c
index b760fb2aa..16c1fac00 100644
--- a/util-linux/mkfs_vfat.c
+++ b/util-linux/mkfs_vfat.c
@@ -278,7 +278,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
278 if (!S_ISBLK(st.st_mode)) { 278 if (!S_ISBLK(st.st_mode)) {
279 if (!S_ISREG(st.st_mode)) { 279 if (!S_ISREG(st.st_mode)) {
280 if (!argv[1]) 280 if (!argv[1])
281 bb_error_msg_and_die("image size must be specified"); 281 bb_simple_error_msg_and_die("image size must be specified");
282 } 282 }
283 // not a block device, skip bad sectors check 283 // not a block device, skip bad sectors check
284 opts &= ~OPT_c; 284 opts &= ~OPT_c;
@@ -399,7 +399,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
399 // "mkdosfs -v -F 32 image5k 5" is the minimum: 399 // "mkdosfs -v -F 32 image5k 5" is the minimum:
400 // 2 sectors for FATs and 2 data sectors 400 // 2 sectors for FATs and 2 data sectors
401 if ((off_t)(volume_size_sect - reserved_sect) < 4) 401 if ((off_t)(volume_size_sect - reserved_sect) < 4)
402 bb_error_msg_and_die("the image is too small for FAT32"); 402 bb_simple_error_msg_and_die("the image is too small for FAT32");
403 sect_per_fat = 1; 403 sect_per_fat = 1;
404 while (1) { 404 while (1) {
405 while (1) { 405 while (1) {
@@ -439,7 +439,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
439 } 439 }
440 next: 440 next:
441 if (sect_per_clust == 128) 441 if (sect_per_clust == 128)
442 bb_error_msg_and_die("can't make FAT32 with >128 sectors/cluster"); 442 bb_simple_error_msg_and_die("can't make FAT32 with >128 sectors/cluster");
443 sect_per_clust *= 2; 443 sect_per_clust *= 2;
444 sect_per_fat = (sect_per_fat / 2) | 1; 444 sect_per_fat = (sect_per_fat / 2) | 1;
445 } 445 }
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index 38413606d..9e51a1dcc 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -75,7 +75,7 @@ static void mkswap_selinux_setcontext(int fd, const char *path)
75 } 75 }
76 return; 76 return;
77 error: 77 error:
78 bb_perror_msg_and_die("SELinux relabeling failed"); 78 bb_simple_perror_msg_and_die("SELinux relabeling failed");
79} 79}
80#else 80#else
81# define mkswap_selinux_setcontext(fd, path) ((void)0) 81# define mkswap_selinux_setcontext(fd, path) ((void)0)
diff --git a/util-linux/mount.c b/util-linux/mount.c
index e6bad7c2c..84c85c057 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -483,7 +483,7 @@ static void FAST_FUNC update_mtab_entry_on_move(const struct mntent *mp)
483 483
484 mountTable = setmntent(bb_path_mtab_file, "r"); 484 mountTable = setmntent(bb_path_mtab_file, "r");
485 if (!mountTable) { 485 if (!mountTable) {
486 bb_perror_msg(bb_path_mtab_file); 486 bb_simple_perror_msg(bb_path_mtab_file);
487 return; 487 return;
488 } 488 }
489 489
@@ -511,7 +511,7 @@ static void FAST_FUNC update_mtab_entry_on_move(const struct mntent *mp)
511 } 511 }
512 endmntent(mountTable); 512 endmntent(mountTable);
513 } else if (errno != EROFS) 513 } else if (errno != EROFS)
514 bb_perror_msg(bb_path_mtab_file); 514 bb_simple_perror_msg(bb_path_mtab_file);
515 515
516 if (ENABLE_FEATURE_CLEAN_UP) { 516 if (ENABLE_FEATURE_CLEAN_UP) {
517 for (i = 0; i < count; i++) { 517 for (i = 0; i < count; i++) {
@@ -739,7 +739,7 @@ static int mount_it_now(struct mntent *mp, unsigned long vfsflags, char *filtero
739 // Abort entirely if permission denied. 739 // Abort entirely if permission denied.
740 740
741 if (rc && errno == EPERM) 741 if (rc && errno == EPERM)
742 bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); 742 bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
743 743
744 // If the mount was successful, and we're maintaining an old-style 744 // If the mount was successful, and we're maintaining an old-style
745 // mtab file by hand, add the new entry to it now. 745 // mtab file by hand, add the new entry to it now.
@@ -751,7 +751,7 @@ static int mount_it_now(struct mntent *mp, unsigned long vfsflags, char *filtero
751 int i; 751 int i;
752 752
753 if (!mountTable) { 753 if (!mountTable) {
754 bb_perror_msg(bb_path_mtab_file); 754 bb_simple_perror_msg(bb_path_mtab_file);
755 goto ret; 755 goto ret;
756 } 756 }
757 757
@@ -1288,18 +1288,18 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
1288 s = strchr(hostname, ','); 1288 s = strchr(hostname, ',');
1289 if (s) { 1289 if (s) {
1290 *s = '\0'; 1290 *s = '\0';
1291 bb_error_msg("warning: multiple hostnames not supported"); 1291 bb_simple_error_msg("warning: multiple hostnames not supported");
1292 } 1292 }
1293 1293
1294 server_addr.sin_family = AF_INET; 1294 server_addr.sin_family = AF_INET;
1295 if (!inet_aton(hostname, &server_addr.sin_addr)) { 1295 if (!inet_aton(hostname, &server_addr.sin_addr)) {
1296 hp = gethostbyname(hostname); 1296 hp = gethostbyname(hostname);
1297 if (hp == NULL) { 1297 if (hp == NULL) {
1298 bb_herror_msg("%s", hostname); 1298 bb_simple_herror_msg(hostname);
1299 goto fail; 1299 goto fail;
1300 } 1300 }
1301 if (hp->h_length != (int)sizeof(struct in_addr)) { 1301 if (hp->h_length != (int)sizeof(struct in_addr)) {
1302 bb_error_msg_and_die("only IPv4 is supported"); 1302 bb_simple_error_msg_and_die("only IPv4 is supported");
1303 } 1303 }
1304 memcpy(&server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr)); 1304 memcpy(&server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr));
1305 } 1305 }
@@ -1389,7 +1389,7 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
1389 else if (is_prefixed_with(opteq, "udp")) 1389 else if (is_prefixed_with(opteq, "udp"))
1390 tcp = 0; 1390 tcp = 0;
1391 else 1391 else
1392 bb_error_msg("warning: unrecognized proto= option"); 1392 bb_simple_error_msg("warning: unrecognized proto= option");
1393 continue; 1393 continue;
1394 case 20: // "addr" - ignore 1394 case 20: // "addr" - ignore
1395 continue; 1395 continue;
@@ -1522,7 +1522,7 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
1522 if (nfs_mount_version >= 3) 1522 if (nfs_mount_version >= 3)
1523 nolock = !val; 1523 nolock = !val;
1524 else 1524 else
1525 bb_error_msg("warning: option nolock is not supported"); 1525 bb_simple_error_msg("warning: option nolock is not supported");
1526 break; 1526 break;
1527 case 11: //rdirplus 1527 case 11: //rdirplus
1528 nordirplus = !val; 1528 nordirplus = !val;
@@ -1590,11 +1590,11 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
1590 } else { 1590 } else {
1591 hp = gethostbyname(mounthost); 1591 hp = gethostbyname(mounthost);
1592 if (hp == NULL) { 1592 if (hp == NULL) {
1593 bb_herror_msg("%s", mounthost); 1593 bb_simple_herror_msg(mounthost);
1594 goto fail; 1594 goto fail;
1595 } 1595 }
1596 if (hp->h_length != (int)sizeof(struct in_addr)) { 1596 if (hp->h_length != (int)sizeof(struct in_addr)) {
1597 bb_error_msg_and_die("only IPv4 is supported"); 1597 bb_simple_error_msg_and_die("only IPv4 is supported");
1598 } 1598 }
1599 mount_server_addr.sin_family = AF_INET; 1599 mount_server_addr.sin_family = AF_INET;
1600 memcpy(&mount_server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr)); 1600 memcpy(&mount_server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr));
@@ -1767,18 +1767,18 @@ static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *fi
1767 /* Create nfs socket for kernel */ 1767 /* Create nfs socket for kernel */
1768 if (tcp) { 1768 if (tcp) {
1769 if (nfs_mount_version < 3) { 1769 if (nfs_mount_version < 3) {
1770 bb_error_msg("NFS over TCP is not supported"); 1770 bb_simple_error_msg("NFS over TCP is not supported");
1771 goto fail; 1771 goto fail;
1772 } 1772 }
1773 fsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); 1773 fsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
1774 } else 1774 } else
1775 fsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); 1775 fsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
1776 if (fsock < 0) { 1776 if (fsock < 0) {
1777 bb_perror_msg("nfs socket"); 1777 bb_simple_perror_msg("nfs socket");
1778 goto fail; 1778 goto fail;
1779 } 1779 }
1780 if (bindresvport(fsock, 0) < 0) { 1780 if (bindresvport(fsock, 0) < 0) {
1781 bb_perror_msg("nfs bindresvport"); 1781 bb_simple_perror_msg("nfs bindresvport");
1782 goto fail; 1782 goto fail;
1783 } 1783 }
1784 if (port == 0) { 1784 if (port == 0) {
@@ -2047,9 +2047,9 @@ static int singlemount(struct mntent *mp, int ignore_busy)
2047 ); 2047 );
2048 if (loopfd < 0) { 2048 if (loopfd < 0) {
2049 if (errno == EPERM || errno == EACCES) 2049 if (errno == EPERM || errno == EACCES)
2050 bb_error_msg(bb_msg_perm_denied_are_you_root); 2050 bb_simple_error_msg(bb_msg_perm_denied_are_you_root);
2051 else 2051 else
2052 bb_perror_msg("can't setup loop device"); 2052 bb_simple_perror_msg("can't setup loop device");
2053 return errno; 2053 return errno;
2054 } 2054 }
2055 2055
@@ -2255,7 +2255,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
2255 // argument when we get it. 2255 // argument when we get it.
2256 if (argv[1]) { 2256 if (argv[1]) {
2257 if (nonroot) 2257 if (nonroot)
2258 bb_error_msg_and_die(bb_msg_you_must_be_root); 2258 bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
2259 mtpair->mnt_fsname = argv[0]; 2259 mtpair->mnt_fsname = argv[0];
2260 mtpair->mnt_dir = argv[1]; 2260 mtpair->mnt_dir = argv[1];
2261 mtpair->mnt_type = fstype; 2261 mtpair->mnt_type = fstype;
@@ -2272,7 +2272,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
2272 2272
2273 cmdopt_flags = parse_mount_options(cmdopts, NULL); 2273 cmdopt_flags = parse_mount_options(cmdopts, NULL);
2274 if (nonroot && (cmdopt_flags & ~MS_SILENT)) // Non-root users cannot specify flags 2274 if (nonroot && (cmdopt_flags & ~MS_SILENT)) // Non-root users cannot specify flags
2275 bb_error_msg_and_die(bb_msg_you_must_be_root); 2275 bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
2276 2276
2277 // If we have a shared subtree flag, don't worry about fstab or mtab. 2277 // If we have a shared subtree flag, don't worry about fstab or mtab.
2278 if (ENABLE_FEATURE_MOUNT_FLAGS 2278 if (ENABLE_FEATURE_MOUNT_FLAGS
@@ -2337,7 +2337,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
2337 // No, mount -a won't mount anything, 2337 // No, mount -a won't mount anything,
2338 // even user mounts, for mere humans 2338 // even user mounts, for mere humans
2339 if (nonroot) 2339 if (nonroot)
2340 bb_error_msg_and_die(bb_msg_you_must_be_root); 2340 bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
2341 2341
2342 // Does type match? (NULL matches always) 2342 // Does type match? (NULL matches always)
2343 if (!fstype_matches(mtcur->mnt_type, fstype)) 2343 if (!fstype_matches(mtcur->mnt_type, fstype))
@@ -2417,7 +2417,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
2417 // fstab must have "users" or "user" 2417 // fstab must have "users" or "user"
2418 l = parse_mount_options(mtcur->mnt_opts, NULL); 2418 l = parse_mount_options(mtcur->mnt_opts, NULL);
2419 if (!(l & MOUNT_USERS)) 2419 if (!(l & MOUNT_USERS))
2420 bb_error_msg_and_die(bb_msg_you_must_be_root); 2420 bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
2421 } 2421 }
2422 2422
2423 //util-linux-2.12 does not do this check. 2423 //util-linux-2.12 does not do this check.
diff --git a/util-linux/nsenter.c b/util-linux/nsenter.c
index 4eeaa9f3e..304f2d748 100644
--- a/util-linux/nsenter.c
+++ b/util-linux/nsenter.c
@@ -257,7 +257,7 @@ int nsenter_main(int argc UNUSED_PARAM, char **argv)
257 257
258 if (opts & OPT_setgid) { 258 if (opts & OPT_setgid) {
259 if (setgroups(0, NULL) < 0 && setgroups_failed) 259 if (setgroups(0, NULL) < 0 && setgroups_failed)
260 bb_perror_msg_and_die("setgroups"); 260 bb_simple_perror_msg_and_die("setgroups");
261 xsetgid(gid); 261 xsetgid(gid);
262 } 262 }
263 if (opts & OPT_setuid) 263 if (opts & OPT_setuid)
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index 70f829e7f..41aade5ea 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -33,7 +33,7 @@ enum { RFC_868_BIAS = 2208988800UL };
33 33
34static void socket_timeout(int sig UNUSED_PARAM) 34static void socket_timeout(int sig UNUSED_PARAM)
35{ 35{
36 bb_error_msg_and_die("timeout connecting to time server"); 36 bb_simple_error_msg_and_die("timeout connecting to time server");
37} 37}
38 38
39static time_t askremotedate(const char *host) 39static time_t askremotedate(const char *host)
@@ -94,10 +94,10 @@ int rdate_main(int argc UNUSED_PARAM, char **argv)
94 94
95 if (!(flags & 2)) { /* no -p (-s may be present) */ 95 if (!(flags & 2)) { /* no -p (-s may be present) */
96 if (time(NULL) == remote_time) 96 if (time(NULL) == remote_time)
97 bb_error_msg("current time matches remote time"); 97 bb_simple_error_msg("current time matches remote time");
98 else 98 else
99 if (stime(&remote_time) < 0) 99 if (stime(&remote_time) < 0)
100 bb_perror_msg_and_die("can't set time of day"); 100 bb_simple_perror_msg_and_die("can't set time of day");
101 } 101 }
102 102
103 if (flags != 1) /* not lone -s */ 103 if (flags != 1) /* not lone -s */
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c
index cab2c4319..c4ea374be 100644
--- a/util-linux/readprofile.c
+++ b/util-linux/readprofile.c
@@ -142,7 +142,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
142 small++; 142 small++;
143 } 143 }
144 if (big > small) { 144 if (big > small) {
145 bb_error_msg("assuming reversed byte order, " 145 bb_simple_error_msg("assuming reversed byte order, "
146 "use -n to force native byte order"); 146 "use -n to force native byte order");
147 BUILD_BUG_ON(sizeof(*p) > 8); 147 BUILD_BUG_ON(sizeof(*p) > 8);
148 for (p = buf; p < buf+len; p++) { 148 for (p = buf; p < buf+len; p++) {
@@ -204,7 +204,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
204 } 204 }
205 205
206 if (indx >= len) 206 if (indx >= len)
207 bb_error_msg_and_die("profile address out of range. " 207 bb_simple_error_msg_and_die("profile address out of range. "
208 "Wrong map file?"); 208 "Wrong map file?");
209 209
210 this = 0; 210 this = 0;
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c
index 29c440b82..cad0f9d64 100644
--- a/util-linux/rtcwake.c
+++ b/util-linux/rtcwake.c
@@ -230,7 +230,7 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv)
230 do { 230 do {
231 ssize_t ret = safe_read(fd, &data, sizeof(data)); 231 ssize_t ret = safe_read(fd, &data, sizeof(data));
232 if (ret < 0) { 232 if (ret < 0) {
233 bb_perror_msg("rtc read"); 233 bb_simple_perror_msg("rtc read");
234 break; 234 break;
235 } 235 }
236 } while (!(data & RTC_AF)); 236 } while (!(data & RTC_AF));
diff --git a/util-linux/setpriv.c b/util-linux/setpriv.c
index b69b8cbb6..e5cf96957 100644
--- a/util-linux/setpriv.c
+++ b/util-linux/setpriv.c
@@ -164,7 +164,7 @@ static void set_inh_caps(char *capstring)
164 } 164 }
165 165
166 if (capset(&caps.header, caps.data) != 0) 166 if (capset(&caps.header, caps.data) != 0)
167 bb_perror_msg_and_die("capset"); 167 bb_simple_perror_msg_and_die("capset");
168} 168}
169 169
170static void set_ambient_caps(char *string) 170static void set_ambient_caps(char *string)
@@ -178,10 +178,10 @@ static void set_ambient_caps(char *string)
178 idx = parse_cap(cap); 178 idx = parse_cap(cap);
179 if (cap[0] == '+') { 179 if (cap[0] == '+') {
180 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, idx, 0, 0) < 0) 180 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, idx, 0, 0) < 0)
181 bb_perror_msg("cap_ambient_raise"); 181 bb_simple_perror_msg("cap_ambient_raise");
182 } else { 182 } else {
183 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_LOWER, idx, 0, 0) < 0) 183 if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_LOWER, idx, 0, 0) < 0)
184 bb_perror_msg("cap_ambient_lower"); 184 bb_simple_perror_msg("cap_ambient_lower");
185 } 185 }
186 cap = strtok(NULL, ","); 186 cap = strtok(NULL, ",");
187 } 187 }
@@ -236,7 +236,7 @@ static int dump(void)
236 unsigned idx = CAP_TO_INDEX(i); 236 unsigned idx = CAP_TO_INDEX(i);
237 if (idx >= caps.u32s) { 237 if (idx >= caps.u32s) {
238 printf("\nindex: %u u32s: %u capability: %u\n", idx, caps.u32s, i); 238 printf("\nindex: %u u32s: %u capability: %u\n", idx, caps.u32s, i);
239 bb_error_msg_and_die("unsupported capability"); 239 bb_simple_error_msg_and_die("unsupported capability");
240 } 240 }
241 if (caps.data[idx].inheritable & CAP_TO_MASK(i)) { 241 if (caps.data[idx].inheritable & CAP_TO_MASK(i)) {
242 printf_cap(fmt, i); 242 printf_cap(fmt, i);
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index ae9d412d1..a483893ed 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -117,7 +117,7 @@ static void drop_capset(int cap_idx)
117 getcaps(&caps); 117 getcaps(&caps);
118 caps.data[CAP_TO_INDEX(cap_idx)].inheritable &= ~CAP_TO_MASK(cap_idx); 118 caps.data[CAP_TO_INDEX(cap_idx)].inheritable &= ~CAP_TO_MASK(cap_idx);
119 if (capset(&caps.header, caps.data) != 0) 119 if (capset(&caps.header, caps.data) != 0)
120 bb_perror_msg_and_die("capset"); 120 bb_simple_perror_msg_and_die("capset");
121} 121}
122 122
123static void drop_bounding_set(int cap_idx) 123static void drop_bounding_set(int cap_idx)
@@ -253,7 +253,7 @@ int switch_root_main(int argc UNUSED_PARAM, char **argv)
253 if ((unsigned)stfs.f_type != RAMFS_MAGIC 253 if ((unsigned)stfs.f_type != RAMFS_MAGIC
254 && (unsigned)stfs.f_type != TMPFS_MAGIC 254 && (unsigned)stfs.f_type != TMPFS_MAGIC
255 ) { 255 ) {
256 bb_error_msg_and_die("root filesystem is not ramfs/tmpfs"); 256 bb_simple_error_msg_and_die("root filesystem is not ramfs/tmpfs");
257 } 257 }
258 258
259 if (!dry_run) { 259 if (!dry_run) {
@@ -263,7 +263,7 @@ int switch_root_main(int argc UNUSED_PARAM, char **argv)
263 // Overmount / with newdir and chroot into it 263 // Overmount / with newdir and chroot into it
264 if (mount(".", "/", NULL, MS_MOVE, NULL)) { 264 if (mount(".", "/", NULL, MS_MOVE, NULL)) {
265 // For example, fails when newroot is not a mountpoint 265 // For example, fails when newroot is not a mountpoint
266 bb_perror_msg_and_die("error moving root"); 266 bb_simple_perror_msg_and_die("error moving root");
267 } 267 }
268 } 268 }
269 xchroot("."); 269 xchroot(".");
diff --git a/util-linux/uevent.c b/util-linux/uevent.c
index 2f8990ed9..7a1d7d4a7 100644
--- a/util-linux/uevent.c
+++ b/util-linux/uevent.c
@@ -75,12 +75,12 @@ int uevent_main(int argc UNUSED_PARAM, char **argv)
75 MAP_PRIVATE | MAP_ANON, 75 MAP_PRIVATE | MAP_ANON,
76 /* ignored: */ -1, 0); 76 /* ignored: */ -1, 0);
77 if (netbuf == MAP_FAILED) 77 if (netbuf == MAP_FAILED)
78 bb_perror_msg_and_die("mmap"); 78 bb_simple_perror_msg_and_die("mmap");
79 79
80 // Here we block, possibly for a very long time 80 // Here we block, possibly for a very long time
81 len = safe_read(fd, netbuf, BUFFER_SIZE - 1); 81 len = safe_read(fd, netbuf, BUFFER_SIZE - 1);
82 if (len < 0) 82 if (len < 0)
83 bb_perror_msg_and_die("read"); 83 bb_simple_perror_msg_and_die("read");
84 end = netbuf + len; 84 end = netbuf + len;
85 *end = '\0'; 85 *end = '\0';
86 86
diff --git a/util-linux/unshare.c b/util-linux/unshare.c
index 61fc71197..a943e7b03 100644
--- a/util-linux/unshare.c
+++ b/util-linux/unshare.c
@@ -239,7 +239,7 @@ int unshare_main(int argc UNUSED_PARAM, char **argv)
239 if (setgrp_str) { 239 if (setgrp_str) {
240 if (strcmp(setgrp_str, "allow") == 0) { 240 if (strcmp(setgrp_str, "allow") == 0) {
241 if (opts & OPT_map_root) { 241 if (opts & OPT_map_root) {
242 bb_error_msg_and_die( 242 bb_simple_error_msg_and_die(
243 "--setgroups=allow and --map-root-user " 243 "--setgroups=allow and --map-root-user "
244 "are mutually exclusive" 244 "are mutually exclusive"
245 ); 245 );