aboutsummaryrefslogtreecommitdiff
path: root/miscutils
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 /miscutils
parentcaecfdc20d450686cd1f7e9b5f650322f894b3c2 (diff)
downloadbusybox-6937487be73cd4563b876413277a295a5fe2f32c.tar.gz
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 'miscutils')
-rw-r--r--miscutils/bc.c12
-rw-r--r--miscutils/chat.c2
-rw-r--r--miscutils/crond.c4
-rw-r--r--miscutils/crontab.c2
-rw-r--r--miscutils/dc.c4
-rw-r--r--miscutils/devfsd.c15
-rw-r--r--miscutils/devmem.c8
-rw-r--r--miscutils/fbsplash.c2
-rw-r--r--miscutils/flash_eraseall.c6
-rw-r--r--miscutils/hdparm.c12
-rw-r--r--miscutils/hexedit.c2
-rw-r--r--miscutils/i2c_tools.c44
-rw-r--r--miscutils/inotifyd.c2
-rw-r--r--miscutils/nandwrite.c10
-rw-r--r--miscutils/rfkill.c2
-rw-r--r--miscutils/rx.c6
-rw-r--r--miscutils/time.c2
-rw-r--r--miscutils/ubi_tools.c10
-rw-r--r--miscutils/ubirename.c2
19 files changed, 76 insertions, 71 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index aba51e5f8..7ac30dd53 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -893,7 +893,7 @@ static void fflush_and_check(void)
{
fflush_all();
if (ferror(stdout) || ferror(stderr))
- bb_perror_msg_and_die("output error");
+ bb_simple_perror_msg_and_die("output error");
}
#if ENABLE_FEATURE_CLEAN_UP
@@ -908,7 +908,7 @@ static void quit(void) NORETURN;
static void quit(void)
{
if (ferror(stdin))
- bb_perror_msg_and_die("input error");
+ bb_simple_perror_msg_and_die("input error");
fflush_and_check();
dbg_exec("quit(): exiting with exitcode SUCCESS");
exit(0);
@@ -2576,7 +2576,7 @@ static void xc_read_line(BcVec *vec, FILE *fp)
goto get_char;
if (c == EOF) {
if (ferror(fp))
- bb_perror_msg_and_die("input error");
+ bb_simple_perror_msg_and_die("input error");
// Note: EOF does not append '\n'
break;
}
@@ -6925,9 +6925,9 @@ static BC_STATUS zxc_vm_process(const char *text)
ip = (void*)G.prog.exestack.v;
#if SANITY_CHECKS
if (G.prog.exestack.len != 1) // should have only main's IP
- bb_error_msg_and_die("BUG:call stack");
+ bb_simple_error_msg_and_die("BUG:call stack");
if (ip->func != BC_PROG_MAIN)
- bb_error_msg_and_die("BUG:not MAIN");
+ bb_simple_error_msg_and_die("BUG:not MAIN");
#endif
f = xc_program_func_BC_PROG_MAIN();
// bc discards strings, constants and code after each
@@ -6943,7 +6943,7 @@ static BC_STATUS zxc_vm_process(const char *text)
if (IS_BC) {
#if SANITY_CHECKS
if (G.prog.results.len != 0) // should be empty
- bb_error_msg_and_die("BUG:data stack");
+ bb_simple_error_msg_and_die("BUG:data stack");
#endif
IF_BC(bc_vec_pop_all(&f->strs);)
IF_BC(bc_vec_pop_all(&f->consts);)
diff --git a/miscutils/chat.c b/miscutils/chat.c
index 5183d1369..a04565063 100644
--- a/miscutils/chat.c
+++ b/miscutils/chat.c
@@ -307,7 +307,7 @@ int chat_main(int argc UNUSED_PARAM, char **argv)
} else if (DIR_SAY == key) {
// just print argument verbatim
// TODO: should we use full_write() to avoid unistd/stdio conflict?
- bb_error_msg("%s", arg);
+ bb_simple_error_msg(arg);
}
// next, please!
argv++;
diff --git a/miscutils/crond.c b/miscutils/crond.c
index b533a3991..2e8ca8b68 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -731,7 +731,7 @@ fork_job(const char *user, int mailFd, CronLine *line, bool run_sendmail)
logmode = sv_logmode;
if (pid < 0) {
- bb_perror_msg("vfork");
+ bb_simple_perror_msg("vfork");
err:
pid = 0;
} /* else: PARENT, FORK SUCCESS */
@@ -861,7 +861,7 @@ static pid_t start_one_job(const char *user, CronLine *line)
bb_error_msg_and_die("can't execute '%s' for user %s", shell, user);
}
if (pid < 0) {
- bb_perror_msg("vfork");
+ bb_simple_perror_msg("vfork");
err:
pid = 0;
}
diff --git a/miscutils/crontab.c b/miscutils/crontab.c
index 96dc4741a..c71d914fc 100644
--- a/miscutils/crontab.c
+++ b/miscutils/crontab.c
@@ -107,7 +107,7 @@ int crontab_main(int argc UNUSED_PARAM, char **argv)
if (sanitize_env_if_suid()) { /* Clears dangerous stuff, sets PATH */
/* Run by non-root */
if (opt_ler & (OPT_u|OPT_c))
- bb_error_msg_and_die(bb_msg_you_must_be_root);
+ bb_simple_error_msg_and_die(bb_msg_you_must_be_root);
}
if (opt_ler & OPT_u) {
diff --git a/miscutils/dc.c b/miscutils/dc.c
index 5aef64b60..ef93c20ba 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -39,14 +39,14 @@ static unsigned check_under(void)
{
unsigned p = pointer;
if (p == 0)
- bb_error_msg_and_die("stack underflow");
+ bb_simple_error_msg_and_die("stack underflow");
return p - 1;
}
static void push(double a)
{
if (pointer >= STACK_SIZE)
- bb_error_msg_and_die("stack overflow");
+ bb_simple_error_msg_and_die("stack overflow");
stack[pointer++] = a;
}
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index e4d104d0c..f3d935b2e 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -344,14 +344,19 @@ static const char bb_msg_variable_not_found[] ALIGN1 = "variable: %s not found";
/* Busybox stuff */
#if ENABLE_DEVFSD_VERBOSE || ENABLE_DEBUG
#define info_logger(p, fmt, args...) bb_info_msg(fmt, ## args)
+#define simple_info_logger(p, msg) bb_simple_info_msg(msg)
#define msg_logger(p, fmt, args...) bb_error_msg(fmt, ## args)
+#define simple_msg_logger(p, msg) bb_simple_error_msg(msg)
#define msg_logger_and_die(p, fmt, args...) bb_error_msg_and_die(fmt, ## args)
+#define simple_msg_logger_and_die(p, msg) bb_simple_error_msg_and_die(msg)
#define error_logger(p, fmt, args...) bb_perror_msg(fmt, ## args)
#define error_logger_and_die(p, fmt, args...) bb_perror_msg_and_die(fmt, ## args)
#else
#define info_logger(p, fmt, args...)
#define msg_logger(p, fmt, args...)
+#define simple_msg_logger(p, msg)
#define msg_logger_and_die(p, fmt, args...) exit(EXIT_FAILURE)
+#define simple_msg_logger_and_die(p, msg) exit(EXIT_FAILURE)
#define error_logger(p, fmt, args...)
#define error_logger_and_die(p, fmt, args...) exit(EXIT_FAILURE)
#endif
@@ -727,7 +732,7 @@ static int do_servicing(int fd, unsigned long event_mask)
caught_sighup = FALSE;
return c_sighup;
}
- msg_logger_and_die(LOG_ERR, "read error on control file");
+ simple_msg_logger_and_die(LOG_ERR, "read error on control file");
} /* End Function do_servicing */
static void service_name(const struct devfsd_notify_struct *info)
@@ -786,7 +791,7 @@ static void service_name(const struct devfsd_notify_struct *info)
action_compat(info, entry->action.what);
break;
default:
- msg_logger_and_die(LOG_ERR, "Unknown action");
+ simple_msg_logger_and_die(LOG_ERR, "Unknown action");
}
}
} /* End Function service_name */
@@ -1691,7 +1696,7 @@ int st_expr_expand(char *output, unsigned int length, const char *input,
}
return FALSE;
st_expr_expand_out:
- info_logger(LOG_INFO, bb_msg_small_buffer);
+ simple_info_logger(LOG_INFO, bb_msg_small_buffer);
return FALSE;
} /* End Function st_expr_expand */
@@ -1775,7 +1780,7 @@ static const char *expand_variable(char *buffer, unsigned int length,
return input + len;
}
if (ch != ':' || ptr[1] != '-') {
- info_logger(LOG_INFO, "illegal char in var name");
+ simple_info_logger(LOG_INFO, "illegal char in var name");
return NULL;
}
/* It's that handy "${var:-word}" expression. Check if var is defined */
@@ -1838,7 +1843,7 @@ static const char *expand_variable(char *buffer, unsigned int length,
*out_pos += len;
return input;
expand_variable_out:
- info_logger(LOG_INFO, bb_msg_small_buffer);
+ simple_info_logger(LOG_INFO, bb_msg_small_buffer);
return NULL;
} /* End Function expand_variable */
diff --git a/miscutils/devmem.c b/miscutils/devmem.c
index 51ac3f22f..e8dce5225 100644
--- a/miscutils/devmem.c
+++ b/miscutils/devmem.c
@@ -89,7 +89,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
fd,
target & ~(off_t)(page_size - 1));
if (map_base == MAP_FAILED)
- bb_perror_msg_and_die("mmap");
+ bb_simple_perror_msg_and_die("mmap");
// printf("Memory mapped at address %p.\n", map_base);
@@ -110,7 +110,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
read_result = *(volatile uint64_t*)virt_addr;
break;
default:
- bb_error_msg_and_die("bad width");
+ bb_simple_error_msg_and_die("bad width");
}
// printf("Value at address 0x%"OFF_FMT"X (%p): 0x%llX\n",
// target, virt_addr,
@@ -136,7 +136,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
// read_result = *(volatile uint64_t*)virt_addr;
break;
default:
- bb_error_msg_and_die("bad width");
+ bb_simple_error_msg_and_die("bad width");
}
// printf("Written 0x%llX; readback 0x%llX\n",
// (unsigned long long)writeval,
@@ -145,7 +145,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
if (ENABLE_FEATURE_CLEAN_UP) {
if (munmap(map_base, mapped_size) == -1)
- bb_perror_msg_and_die("munmap");
+ bb_simple_perror_msg_and_die("munmap");
close(fd);
}
diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
index bba22d6d1..141957809 100644
--- a/miscutils/fbsplash.c
+++ b/miscutils/fbsplash.c
@@ -183,7 +183,7 @@ static void fb_open(const char *strfb_device)
(G.scr_var.yres_virtual ?: G.scr_var.yres) * G.scr_fix.line_length,
PROT_WRITE, MAP_SHARED, fbfd, 0);
if (G.addr == MAP_FAILED)
- bb_perror_msg_and_die("mmap");
+ bb_simple_perror_msg_and_die("mmap");
// point to the start of the visible screen
G.addr += G.scr_var.yoffset * G.scr_fix.line_length + G.scr_var.xoffset * G.bytes_per_pixel;
diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c
index a3dabdadb..c76d9a699 100644
--- a/miscutils/flash_eraseall.c
+++ b/miscutils/flash_eraseall.c
@@ -120,7 +120,7 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv)
if (clmlen > 8)
clmlen = 8;
if (clmlen == 0)
- bb_error_msg_and_die("autoplacement selected and no empty space in oob");
+ bb_simple_error_msg_and_die("autoplacement selected and no empty space in oob");
} else {
/* Legacy mode */
switch (meminfo.oobsize) {
@@ -168,9 +168,9 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv)
if (errno == EOPNOTSUPP) {
flags |= OPTION_N;
if (flags & IS_NAND)
- bb_error_msg_and_die("bad block check not available");
+ bb_simple_error_msg_and_die("bad block check not available");
} else {
- bb_perror_msg_and_die("MEMGETBADBLOCK error");
+ bb_simple_perror_msg_and_die("MEMGETBADBLOCK error");
}
}
}
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 342e240fa..b453efba9 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -810,7 +810,7 @@ static void identify(uint16_t *val)
like_std = 3;
} else
/* "Unknown device type:\n\tbits 15&14 of general configuration word 0 both set to 1.\n" */
- bb_error_msg_and_die("unknown device type");
+ bb_simple_error_msg_and_die("unknown device type");
printf("%sremovable media\n", !(val[GEN_CONFIG] & MEDIA_REMOVABLE) ? "non-" : "");
/* Info from the specific configuration word says whether or not the
@@ -1440,7 +1440,7 @@ static void flush_buffer_cache(/*int fd*/ void)
sleep(1);
if (ioctl(fd, HDIO_DRIVE_CMD, NULL) && errno != EINVAL) { /* await completion */
if (ENABLE_IOCTL_HEX2STR_ERROR) /* To be coherent with ioctl_or_warn */
- bb_perror_msg("HDIO_DRIVE_CMD");
+ bb_simple_perror_msg("HDIO_DRIVE_CMD");
else
bb_perror_msg("ioctl %#x failed", HDIO_DRIVE_CMD);
}
@@ -1506,7 +1506,7 @@ static void do_time(int cache /*,int fd*/)
char *buf = xmalloc(TIMING_BUF_BYTES);
if (mlock(buf, TIMING_BUF_BYTES))
- bb_perror_msg_and_die("mlock");
+ bb_simple_perror_msg_and_die("mlock");
/* Clear out the device request queues & give them time to complete.
* NB: *small* delay. User is expected to have a clue and to not run
@@ -1857,7 +1857,7 @@ static void process_dev(char *devname)
char buf[512];
flush_buffer_cache();
if (-1 == read(fd, buf, sizeof(buf)))
- bb_perror_msg("read of 512 bytes failed");
+ bb_simple_perror_msg("read of 512 bytes failed");
}
#endif /* HDIO_DRIVE_CMD */
if (getset_mult || get_identity) {
@@ -1865,7 +1865,7 @@ static void process_dev(char *devname)
if (ioctl(fd, HDIO_GET_MULTCOUNT, &multcount)) {
/* To be coherent with ioctl_or_warn. */
if (getset_mult && ENABLE_IOCTL_HEX2STR_ERROR)
- bb_perror_msg("HDIO_GET_MULTCOUNT");
+ bb_simple_perror_msg("HDIO_GET_MULTCOUNT");
else
bb_perror_msg("ioctl %#x failed", HDIO_GET_MULTCOUNT);
} else if (getset_mult) {
@@ -1985,7 +1985,7 @@ static void process_dev(char *devname)
} else if (errno == -ENOMSG)
puts(" no identification info available");
else if (ENABLE_IOCTL_HEX2STR_ERROR) /* To be coherent with ioctl_or_warn */
- bb_perror_msg("HDIO_GET_IDENTITY");
+ bb_simple_perror_msg("HDIO_GET_IDENTITY");
else
bb_perror_msg("ioctl %#x failed", HDIO_GET_IDENTITY);
}
diff --git a/miscutils/hexedit.c b/miscutils/hexedit.c
index 5c2f4a555..898d77376 100644
--- a/miscutils/hexedit.c
+++ b/miscutils/hexedit.c
@@ -193,7 +193,7 @@ static int remap(unsigned cur_pos)
);
if (G.baseaddr == MAP_FAILED) {
restore_term();
- bb_perror_msg_and_die("mmap");
+ bb_simple_perror_msg_and_die("mmap");
}
G.current_byte = G.baseaddr + cur_pos;
diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
index 7a2e8534a..82a559f74 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -344,7 +344,7 @@ static void get_funcs_matrix(int fd, unsigned long *funcs)
static void check_funcs_test_end(int funcs, int pec, const char *err)
{
if (pec && !(funcs & (I2C_FUNC_SMBUS_PEC | I2C_FUNC_I2C)))
- bb_error_msg("warning: adapter does not support PEC");
+ bb_simple_error_msg("warning: adapter does not support PEC");
if (err)
bb_error_msg_and_die(
@@ -392,7 +392,7 @@ static void check_read_funcs(int fd, int mode, int data_addr, int pec)
break;
#endif /* ENABLE_I2CDUMP */
default:
- bb_error_msg_and_die("internal error");
+ bb_simple_error_msg_and_die("internal error");
}
check_funcs_test_end(funcs, pec, err);
}
@@ -438,7 +438,7 @@ static void confirm_or_abort(void)
{
fprintf(stderr, "Continue? [y/N] ");
if (!bb_ask_y_confirmation())
- bb_error_msg_and_die("aborting");
+ bb_simple_error_msg_and_die("aborting");
}
/*
@@ -449,20 +449,20 @@ static void confirm_or_abort(void)
*/
static void confirm_action(int bus_addr, int mode, int data_addr, int pec)
{
- bb_error_msg("WARNING! This program can confuse your I2C bus");
+ bb_simple_error_msg("WARNING! This program can confuse your I2C bus");
/* Don't let the user break his/her EEPROMs */
if (bus_addr >= 0x50 && bus_addr <= 0x57 && pec) {
- bb_error_msg_and_die("this is I2C not smbus - using PEC on I2C "
+ bb_simple_error_msg_and_die("this is I2C not smbus - using PEC on I2C "
"devices may result in data loss, aborting");
}
if (mode == I2C_SMBUS_BYTE && data_addr >= 0 && pec)
- bb_error_msg("WARNING! May interpret a write byte command "
+ bb_simple_error_msg("WARNING! May interpret a write byte command "
"with PEC as a write byte data command");
if (pec)
- bb_error_msg("PEC checking enabled");
+ bb_simple_error_msg("PEC checking enabled");
confirm_or_abort();
}
@@ -507,7 +507,7 @@ int i2cget_main(int argc UNUSED_PARAM, char **argv)
case 'w': mode = I2C_SMBUS_WORD_DATA; break;
case 'c': mode = I2C_SMBUS_BYTE; break;
default:
- bb_error_msg("invalid mode");
+ bb_simple_error_msg("invalid mode");
bb_show_usage();
}
pec = argv[3][1] == 'p';
@@ -529,7 +529,7 @@ int i2cget_main(int argc UNUSED_PARAM, char **argv)
if (data_addr >= 0) {
status = i2c_smbus_write_byte(fd, data_addr);
if (status < 0)
- bb_error_msg("warning - write failed");
+ bb_simple_error_msg("warning - write failed");
}
status = i2c_smbus_read_byte(fd);
break;
@@ -542,7 +542,7 @@ int i2cget_main(int argc UNUSED_PARAM, char **argv)
close(fd);
if (status < 0)
- bb_perror_msg_and_die("read failed");
+ bb_simple_perror_msg_and_die("read failed");
printf("0x%0*x\n", mode == I2C_SMBUS_WORD_DATA ? 4 : 2, status);
@@ -611,7 +611,7 @@ int i2cset_main(int argc, char **argv)
case 'i': mode = I2C_SMBUS_I2C_BLOCK_DATA;
break;
default:
- bb_error_msg("invalid mode");
+ bb_simple_error_msg("invalid mode");
bb_show_usage();
}
@@ -620,11 +620,11 @@ int i2cset_main(int argc, char **argv)
|| mode == I2C_SMBUS_I2C_BLOCK_DATA
) {
if (pec && mode == I2C_SMBUS_I2C_BLOCK_DATA)
- bb_error_msg_and_die(
+ bb_simple_error_msg_and_die(
"PEC not supported for I2C "
"block writes");
if (opts & opt_m)
- bb_error_msg_and_die(
+ bb_simple_error_msg_and_die(
"mask not supported for block "
"writes");
}
@@ -685,7 +685,7 @@ int i2cset_main(int argc, char **argv)
}
if (tmpval < 0)
- bb_perror_msg_and_die("can't read old value");
+ bb_simple_perror_msg_and_die("can't read old value");
val = (val & mask) | (tmpval & ~mask);
@@ -724,7 +724,7 @@ int i2cset_main(int argc, char **argv)
break;
}
if (status < 0)
- bb_perror_msg_and_die("write failed");
+ bb_simple_perror_msg_and_die("write failed");
if (pec)
i2c_set_pec(fd, 0); /* Clear PEC. */
@@ -978,12 +978,12 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
case 's': mode = I2C_SMBUS_BLOCK_DATA; break;
case 'i': mode = I2C_SMBUS_I2C_BLOCK_DATA; break;
default:
- bb_error_msg_and_die("invalid mode");
+ bb_simple_error_msg_and_die("invalid mode");
}
if (argv[2][1] == 'p') {
if (argv[2][0] == 'W' || argv[2][0] == 'i') {
- bb_error_msg_and_die(
+ bb_simple_error_msg_and_die(
"pec not supported for -W and -i");
} else {
pec = 1;
@@ -994,7 +994,7 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
if (opts & opt_r) {
first = strtol(opt_r_str, &dash, 0);
if (dash == opt_r_str || *dash != '-' || first > 0xff)
- bb_error_msg_and_die("invalid range");
+ bb_simple_error_msg_and_die("invalid range");
last = xstrtou_range(++dash, 0, first, 0xff);
/* Range is not available for every mode. */
@@ -1007,7 +1007,7 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
break;
/* Fall through */
default:
- bb_error_msg_and_die(
+ bb_simple_error_msg_and_die(
"range not compatible with selected mode");
}
}
@@ -1032,7 +1032,7 @@ int i2cdump_main(int argc UNUSED_PARAM, char **argv)
if (mode == I2C_SMBUS_BYTE) {
res = i2c_smbus_write_byte(fd, first);
if (res < 0)
- bb_perror_msg_and_die("write start address");
+ bb_simple_perror_msg_and_die("write start address");
}
dump_data(fd, mode, first, last, block, blen);
@@ -1398,7 +1398,7 @@ static void check_i2c_func(int fd)
get_funcs_matrix(fd, &funcs);
if (!(funcs & I2C_FUNC_I2C))
- bb_error_msg_and_die("adapter does not support I2C transfers");
+ bb_simple_error_msg_and_die("adapter does not support I2C transfers");
}
//usage:#define i2ctransfer_trivial_usage
@@ -1451,7 +1451,7 @@ int i2ctransfer_main(int argc UNUSED_PARAM, char **argv)
char *end;
if (nmsgs >= I2C_RDWR_IOCTL_MAX_MSGS)
- bb_error_msg_and_die("too many messages, max: "I2C_RDWR_IOCTL_MAX_MSGS_STR);
+ bb_simple_error_msg_and_die("too many messages, max: "I2C_RDWR_IOCTL_MAX_MSGS_STR);
flags = 0;
arg_ptr = *argv;
diff --git a/miscutils/inotifyd.c b/miscutils/inotifyd.c
index ec0321941..8bff86ae5 100644
--- a/miscutils/inotifyd.c
+++ b/miscutils/inotifyd.c
@@ -117,7 +117,7 @@ int inotifyd_main(int argc, char **argv)
// open inotify
pfd.fd = inotify_init();
if (pfd.fd < 0)
- bb_perror_msg_and_die("no kernel support");
+ bb_simple_perror_msg_and_die("no kernel support");
// setup watches
while (*++argv) {
diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c
index 09bcaaf63..f111c6363 100644
--- a/miscutils/nandwrite.c
+++ b/miscutils/nandwrite.c
@@ -101,7 +101,7 @@ static unsigned next_good_eraseblock(int fd, struct mtd_info_user *meminfo,
if (block_offset >= meminfo->size) {
if (IS_NANDWRITE)
- bb_error_msg_and_die("not enough space in MTD device");
+ bb_simple_error_msg_and_die("not enough space in MTD device");
return block_offset; /* let the caller exit */
}
offs = block_offset;
@@ -174,7 +174,7 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
meminfo_writesize = meminfo.writesize;
if (mtdoffset & (meminfo_writesize - 1))
- bb_error_msg_and_die("start address is not page aligned");
+ bb_simple_error_msg_and_die("start address is not page aligned");
filebuf = xmalloc(meminfo_writesize);
oobbuf = xmalloc(meminfo.oobsize);
@@ -248,9 +248,9 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
}
if (cnt < meminfo_writesize) {
if (IS_NANDDUMP)
- bb_error_msg_and_die("short read");
+ bb_simple_error_msg_and_die("short read");
if (!(opts & OPT_p))
- bb_error_msg_and_die("input size is not rounded up to page size, "
+ bb_simple_error_msg_and_die("input size is not rounded up to page size, "
"use -p to zero pad");
/* zero pad to end of write block */
memset(filebuf + cnt, 0, meminfo_writesize - cnt);
@@ -273,7 +273,7 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
/* We filled entire MTD, but did we reach EOF on input? */
if (full_read(STDIN_FILENO, filebuf, meminfo_writesize) != 0) {
/* no */
- bb_error_msg_and_die("not enough space in MTD device");
+ bb_simple_error_msg_and_die("not enough space in MTD device");
}
}
diff --git a/miscutils/rfkill.c b/miscutils/rfkill.c
index 766bad8c7..db7c83750 100644
--- a/miscutils/rfkill.c
+++ b/miscutils/rfkill.c
@@ -88,7 +88,7 @@ int rfkill_main(int argc UNUSED_PARAM, char **argv)
rf_fd = device_open("/dev/rfkill", mode);
if (rf_fd < 0)
- bb_perror_msg_and_die("/dev/rfkill");
+ bb_simple_perror_msg_and_die("/dev/rfkill");
if (rf_opt & OPT_l) {
while (full_read(rf_fd, &event, sizeof(event)) == RFKILL_EVENT_SIZE_V1) {
diff --git a/miscutils/rx.c b/miscutils/rx.c
index 874a3f0a3..319ec1d49 100644
--- a/miscutils/rx.c
+++ b/miscutils/rx.c
@@ -120,7 +120,7 @@ static int receive(/*int read_fd, */int file_fd)
/* Write previously received block */
errno = 0;
if (full_write(file_fd, blockBuf, blockLength) != blockLength) {
- bb_perror_msg(bb_msg_write_error);
+ bb_simple_perror_msg(bb_msg_write_error);
goto fatal;
}
@@ -150,7 +150,7 @@ static int receive(/*int read_fd, */int file_fd)
goto timeout;
if (blockNo != (255 - blockNoOnesCompl)) {
- bb_error_msg("bad block ones compl");
+ bb_simple_error_msg("bad block ones compl");
goto error;
}
@@ -229,7 +229,7 @@ static int receive(/*int read_fd, */int file_fd)
do_crc = 0;
goto timeout;
}
- bb_error_msg("too many errors; giving up");
+ bb_simple_error_msg("too many errors; giving up");
fatal:
/* 5 CAN followed by 5 BS. Don't try too hard... */
safe_write(write_fd, "\030\030\030\030\030\010\010\010\010\010", 10);
diff --git a/miscutils/time.c b/miscutils/time.c
index 064888ab8..d15d363f3 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -88,7 +88,7 @@ static void resuse_end(pid_t pid, resource_t *resp)
* returns the child process, set the time the command finished. */
while ((caught = wait3(&resp->waitstatus, 0, &resp->ru)) != pid) {
if (caught == -1 && errno != EINTR) {
- bb_perror_msg("wait");
+ bb_simple_perror_msg("wait");
return;
}
}
diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c
index dc7af25a4..8318df0f9 100644
--- a/miscutils/ubi_tools.c
+++ b/miscutils/ubi_tools.c
@@ -234,10 +234,10 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
// bb_error_msg_and_die("%s invalid maximum size calculated", "UBI");
} else
if (!(opts & OPTION_s))
- bb_error_msg_and_die("size not specified");
+ bb_simple_error_msg_and_die("size not specified");
if (!(opts & OPTION_N))
- bb_error_msg_and_die("name not specified");
+ bb_simple_error_msg_and_die("name not specified");
/* the structure is memset(0) above */
mkvol_req.vol_id = vol_id;
@@ -264,7 +264,7 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
//usage: "\n -N VOLNAME Volume name"
if (do_rmvol) {
if (!(opts & (OPTION_n|OPTION_N)))
- bb_error_msg_and_die("volume id not specified");
+ bb_simple_error_msg_and_die("volume id not specified");
if (opts & OPTION_N) {
unsigned num = ubi_devnum_from_devname(ubi_ctrl);
@@ -288,9 +288,9 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv)
//usage: "\n -s SIZE Size in bytes"
if (do_rsvol) {
if (!(opts & OPTION_s))
- bb_error_msg_and_die("size not specified");
+ bb_simple_error_msg_and_die("size not specified");
if (!(opts & OPTION_n))
- bb_error_msg_and_die("volume id not specified");
+ bb_simple_error_msg_and_die("volume id not specified");
rsvol_req.bytes = size_bytes; /* signed int64_t */
rsvol_req.vol_id = vol_id;
diff --git a/miscutils/ubirename.c b/miscutils/ubirename.c
index 21bd10111..e7c56640c 100644
--- a/miscutils/ubirename.c
+++ b/miscutils/ubirename.c
@@ -72,7 +72,7 @@ int ubirename_main(int argc, char **argv)
rnvol = xzalloc(sizeof(*rnvol));
rnvol->count = --argc;
if (argc > ARRAY_SIZE(rnvol->ents))
- bb_error_msg_and_die("too many renames requested");
+ bb_simple_error_msg_and_die("too many renames requested");
ubi_devname = argv[1];
ubi_devnum = ubi_devnum_from_devname(ubi_devname);