aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coreutils/cksum.c2
-rw-r--r--coreutils/cut.c2
-rw-r--r--coreutils/dd.c2
-rw-r--r--coreutils/df.c2
-rw-r--r--coreutils/expand.c2
-rw-r--r--coreutils/fold.c2
-rw-r--r--coreutils/ln.c2
-rw-r--r--coreutils/touch.c2
-rw-r--r--include/libbb.h7
-rw-r--r--miscutils/getfattr.c2
-rw-r--r--miscutils/makedevs.c2
-rw-r--r--miscutils/setfattr.c2
-rw-r--r--miscutils/strings.c3
-rw-r--r--networking/brctl.c2
-rw-r--r--networking/tc.c5
-rw-r--r--util-linux/renice.c2
-rw-r--r--util-linux/rev.c2
-rw-r--r--util-linux/umount.c2
18 files changed, 26 insertions, 19 deletions
diff --git a/coreutils/cksum.c b/coreutils/cksum.c
index badc63a6a..1fb6ef2d0 100644
--- a/coreutils/cksum.c
+++ b/coreutils/cksum.c
@@ -39,7 +39,7 @@ int cksum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
39int cksum_main(int argc UNUSED_PARAM, char **argv) 39int cksum_main(int argc UNUSED_PARAM, char **argv)
40{ 40{
41 uint32_t *crc32_table = crc32_filltable(NULL, IS_CKSUM); 41 uint32_t *crc32_table = crc32_filltable(NULL, IS_CKSUM);
42 int exit_code = EXIT_SUCCESS; 42 exitcode_t exit_code = EXIT_SUCCESS;
43 43
44#if ENABLE_DESKTOP 44#if ENABLE_DESKTOP
45 getopt32(argv, ""); /* cksum coreutils 6.9 compat */ 45 getopt32(argv, ""); /* cksum coreutils 6.9 compat */
diff --git a/coreutils/cut.c b/coreutils/cut.c
index 25b16d1a8..d129f9b9d 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -311,7 +311,7 @@ int cut_main(int argc UNUSED_PARAM, char **argv)
311 } 311 }
312 312
313 { 313 {
314 int retval = EXIT_SUCCESS; 314 exitcode_t retval = EXIT_SUCCESS;
315 315
316 if (!*argv) 316 if (!*argv)
317 *--argv = (char *)"-"; 317 *--argv = (char *)"-";
diff --git a/coreutils/dd.c b/coreutils/dd.c
index c032ebe1b..8bb782781 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -375,7 +375,7 @@ int dd_main(int argc UNUSED_PARAM, char **argv)
375 OP_oflag_direct, 375 OP_oflag_direct,
376#endif 376#endif
377 }; 377 };
378 smallint exitcode = EXIT_FAILURE; 378 exitcode_t exitcode = EXIT_FAILURE;
379 int i; 379 int i;
380 size_t ibs = 512; 380 size_t ibs = 512;
381 char *ibuf; 381 char *ibuf;
diff --git a/coreutils/df.c b/coreutils/df.c
index 76e9cefbf..03aa78148 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -113,7 +113,7 @@ int df_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
113int df_main(int argc UNUSED_PARAM, char **argv) 113int df_main(int argc UNUSED_PARAM, char **argv)
114{ 114{
115 unsigned long df_disp_hr = 1024; 115 unsigned long df_disp_hr = 1024;
116 int status = EXIT_SUCCESS; 116 exitcode_t status = EXIT_SUCCESS;
117 unsigned opt; 117 unsigned opt;
118 FILE *mount_table; 118 FILE *mount_table;
119 struct mntent *mount_entry; 119 struct mntent *mount_entry;
diff --git a/coreutils/expand.c b/coreutils/expand.c
index 47693e144..c4db26055 100644
--- a/coreutils/expand.c
+++ b/coreutils/expand.c
@@ -192,7 +192,7 @@ int expand_main(int argc UNUSED_PARAM, char **argv)
192 FILE *file; 192 FILE *file;
193 unsigned tab_size; 193 unsigned tab_size;
194 unsigned opt; 194 unsigned opt;
195 int exit_status = EXIT_SUCCESS; 195 exitcode_t exit_status = EXIT_SUCCESS;
196 196
197 init_unicode(); 197 init_unicode();
198 198
diff --git a/coreutils/fold.c b/coreutils/fold.c
index 2839c8c68..8112fe911 100644
--- a/coreutils/fold.c
+++ b/coreutils/fold.c
@@ -77,7 +77,7 @@ int fold_main(int argc UNUSED_PARAM, char **argv)
77 char *line_out = NULL; 77 char *line_out = NULL;
78 const char *w_opt = "80"; 78 const char *w_opt = "80";
79 unsigned width; 79 unsigned width;
80 smallint exitcode = EXIT_SUCCESS; 80 exitcode_t exitcode = EXIT_SUCCESS;
81 81
82 init_unicode(); 82 init_unicode();
83 83
diff --git a/coreutils/ln.c b/coreutils/ln.c
index 34eec398a..080ba142e 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -52,7 +52,7 @@
52int ln_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 52int ln_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
53int ln_main(int argc, char **argv) 53int ln_main(int argc, char **argv)
54{ 54{
55 int status = EXIT_SUCCESS; 55 exitcode_t status = EXIT_SUCCESS;
56 int opts; 56 int opts;
57 char *last; 57 char *last;
58 char *src_name; 58 char *src_name;
diff --git a/coreutils/touch.c b/coreutils/touch.c
index 8fde70e12..ced596c89 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -77,7 +77,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
77{ 77{
78 int fd; 78 int fd;
79 int opts; 79 int opts;
80 smalluint status = EXIT_SUCCESS; 80 exitcode_t status = EXIT_SUCCESS;
81#if ENABLE_FEATURE_TOUCH_SUSV3 81#if ENABLE_FEATURE_TOUCH_SUSV3
82 char *reference_file; 82 char *reference_file;
83 char *date_str; 83 char *date_str;
diff --git a/include/libbb.h b/include/libbb.h
index 640fa3988..eb97a9880 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1444,6 +1444,13 @@ void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUNC;
1444void bb_die_memory_exhausted(void) NORETURN FAST_FUNC; 1444void bb_die_memory_exhausted(void) NORETURN FAST_FUNC;
1445void bb_logenv_override(void) FAST_FUNC; 1445void bb_logenv_override(void) FAST_FUNC;
1446 1446
1447/* x86 benefits from narrow exit code variables
1448 * (because it has no widening MOV imm8,word32 insn, has to use MOV imm32,w
1449 * for "exitcode = EXIT_FAILURE" and similar. The downside is that sometimes
1450* gcc widens the variable to int in various ugly suboptimal ways).
1451 */
1452typedef smalluint exitcode_t;
1453
1447#if ENABLE_FEATURE_SYSLOG_INFO 1454#if ENABLE_FEATURE_SYSLOG_INFO
1448void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; 1455void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
1449void bb_simple_info_msg(const char *s) FAST_FUNC; 1456void bb_simple_info_msg(const char *s) FAST_FUNC;
diff --git a/miscutils/getfattr.c b/miscutils/getfattr.c
index 905aec65f..cb42fdac0 100644
--- a/miscutils/getfattr.c
+++ b/miscutils/getfattr.c
@@ -77,7 +77,7 @@ int getfattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
77int getfattr_main(int argc UNUSED_PARAM, char **argv) 77int getfattr_main(int argc UNUSED_PARAM, char **argv)
78{ 78{
79 const char *name; 79 const char *name;
80 int status; 80 exitcode_t status;
81 int opt; 81 int opt;
82 char *buf = NULL; 82 char *buf = NULL;
83 size_t bufsize = 0; 83 size_t bufsize = 0;
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index 48be91875..999a3b976 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -181,7 +181,7 @@ int makedevs_main(int argc UNUSED_PARAM, char **argv)
181{ 181{
182 parser_t *parser; 182 parser_t *parser;
183 char *line = (char *)"-"; 183 char *line = (char *)"-";
184 int ret = EXIT_SUCCESS; 184 exitcode_t ret = EXIT_SUCCESS;
185 185
186 getopt32(argv, "^" "d:" "\0" "=1", &line); 186 getopt32(argv, "^" "d:" "\0" "=1", &line);
187 argv += optind; 187 argv += optind;
diff --git a/miscutils/setfattr.c b/miscutils/setfattr.c
index 10d1840c9..b68bc9452 100644
--- a/miscutils/setfattr.c
+++ b/miscutils/setfattr.c
@@ -32,7 +32,7 @@ int setfattr_main(int argc UNUSED_PARAM, char **argv)
32{ 32{
33 const char *name; 33 const char *name;
34 const char *value = ""; 34 const char *value = "";
35 int status; 35 exitcode_t status;
36 int opt; 36 int opt;
37 enum { 37 enum {
38 OPT_h = (1 << 0), 38 OPT_h = (1 << 0),
diff --git a/miscutils/strings.c b/miscutils/strings.c
index 036df5c5d..bd1850cbb 100644
--- a/miscutils/strings.c
+++ b/miscutils/strings.c
@@ -40,7 +40,8 @@
40int strings_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 40int strings_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
41int strings_main(int argc UNUSED_PARAM, char **argv) 41int strings_main(int argc UNUSED_PARAM, char **argv)
42{ 42{
43 int n, c, status = EXIT_SUCCESS; 43 int n, c;
44 exitcode_t status = EXIT_SUCCESS;
44 unsigned count; 45 unsigned count;
45 off_t offset; 46 off_t offset;
46 FILE *file; 47 FILE *file;
diff --git a/networking/brctl.c b/networking/brctl.c
index 7b0270b51..0f8dc2f7a 100644
--- a/networking/brctl.c
+++ b/networking/brctl.c
@@ -538,7 +538,7 @@ int brctl_main(int argc UNUSED_PARAM, char **argv)
538 DIR *net; 538 DIR *net;
539 struct dirent *ent; 539 struct dirent *ent;
540 int need_hdr = 1; 540 int need_hdr = 1;
541 int exitcode = EXIT_SUCCESS; 541 exitcode_t exitcode = EXIT_SUCCESS;
542 542
543 if (*argv) { 543 if (*argv) {
544 /* "show BR1 BR2 BR3" */ 544 /* "show BR1 BR2 BR3" */
diff --git a/networking/tc.c b/networking/tc.c
index 43187f7ee..3a79fd2d9 100644
--- a/networking/tc.c
+++ b/networking/tc.c
@@ -502,7 +502,7 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
502 }; 502 };
503 struct rtnl_handle rth; 503 struct rtnl_handle rth;
504 struct tcmsg msg; 504 struct tcmsg msg;
505 int ret, obj, cmd, arg; 505 int obj, cmd, arg;
506 char *dev = NULL; 506 char *dev = NULL;
507 507
508 INIT_G(); 508 INIT_G();
@@ -510,7 +510,6 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
510 if (!*++argv) 510 if (!*++argv)
511 bb_show_usage(); 511 bb_show_usage();
512 xrtnl_open(&rth); 512 xrtnl_open(&rth);
513 ret = EXIT_SUCCESS;
514 513
515 obj = index_in_substrings(objects, *argv++); 514 obj = index_in_substrings(objects, *argv++);
516 if (obj < 0) 515 if (obj < 0)
@@ -625,5 +624,5 @@ int tc_main(int argc UNUSED_PARAM, char **argv)
625 if (ENABLE_FEATURE_CLEAN_UP) { 624 if (ENABLE_FEATURE_CLEAN_UP) {
626 rtnl_close(&rth); 625 rtnl_close(&rth);
627 } 626 }
628 return ret; 627 return EXIT_SUCCESS;
629} 628}
diff --git a/util-linux/renice.c b/util-linux/renice.c
index 53f197cce..f2737f29b 100644
--- a/util-linux/renice.c
+++ b/util-linux/renice.c
@@ -45,7 +45,7 @@ int renice_main(int argc UNUSED_PARAM, char **argv)
45{ 45{
46 static const char Xetpriority_msg[] ALIGN1 = "%cetpriority"; 46 static const char Xetpriority_msg[] ALIGN1 = "%cetpriority";
47 47
48 int retval = EXIT_SUCCESS; 48 exitcode_t retval = EXIT_SUCCESS;
49 int which = PRIO_PROCESS; /* Default 'which' value. */ 49 int which = PRIO_PROCESS; /* Default 'which' value. */
50 int use_relative = 0; 50 int use_relative = 0;
51 int adjustment, new_priority; 51 int adjustment, new_priority;
diff --git a/util-linux/rev.c b/util-linux/rev.c
index 12df2b9ff..aad53722d 100644
--- a/util-linux/rev.c
+++ b/util-linux/rev.c
@@ -51,7 +51,7 @@ static void strrev(CHAR_T *s, int len)
51int rev_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 51int rev_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
52int rev_main(int argc UNUSED_PARAM, char **argv) 52int rev_main(int argc UNUSED_PARAM, char **argv)
53{ 53{
54 int retval; 54 exitcode_t retval;
55 size_t bufsize; 55 size_t bufsize;
56 char *buf; 56 char *buf;
57 57
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 23da32868..f5c97a034 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -97,7 +97,7 @@ int umount_main(int argc UNUSED_PARAM, char **argv)
97 struct mntent me; 97 struct mntent me;
98 FILE *fp; 98 FILE *fp;
99 char *fstype = NULL; 99 char *fstype = NULL;
100 int status = EXIT_SUCCESS; 100 exitcode_t status = EXIT_SUCCESS;
101 unsigned opt; 101 unsigned opt;
102 struct mtab_list { 102 struct mtab_list {
103 char *dir; 103 char *dir;