aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2026-01-27 12:21:07 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2026-01-27 13:15:14 +0100
commitb715e82e1fc8a3366f2cce867b97480b43185693 (patch)
treefcb10a5640343d59214e8486b98d41d3ec5bdd5d
parentdee016821955e7e8de5f8e133e1b2de7b42c0c94 (diff)
downloadbusybox-w32-b715e82e1fc8a3366f2cce867b97480b43185693.tar.gz
busybox-w32-b715e82e1fc8a3366f2cce867b97480b43185693.tar.bz2
busybox-w32-b715e82e1fc8a3366f2cce867b97480b43185693.zip
ash: JOBSTOPPED can only be set if job control is compiled in - conditionalize code which depends on it
With !ASH_JOB_CONTROL: function old new delta cmdloop 363 351 -12 exitcmd 47 31 -16 .rodata 106422 106398 -24 stoppedjobs 58 - -58 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/3 up/down: 0/-110) Total: -110 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 4122b4dcf..de6e482cd 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -470,7 +470,9 @@ struct jmploc {
470struct globals_misc { 470struct globals_misc {
471 uint8_t exitstatus; /* exit status of last command */ 471 uint8_t exitstatus; /* exit status of last command */
472 uint8_t back_exitstatus;/* exit status of backquoted command */ 472 uint8_t back_exitstatus;/* exit status of backquoted command */
473#if JOBS
473 smallint job_warning; /* user was warned about stopped jobs (can be 2, 1 or 0). */ 474 smallint job_warning; /* user was warned about stopped jobs (can be 2, 1 or 0). */
475#endif
474 smallint inps4; /* Prevent PS4 nesting. */ 476 smallint inps4; /* Prevent PS4 nesting. */
475 smallint vforked; 477 smallint vforked;
476 int savestatus; /* exit status of last command outside traps */ 478 int savestatus; /* exit status of last command outside traps */
@@ -575,7 +577,11 @@ extern struct globals_misc *BB_GLOBAL_CONST ash_ptr_to_globals_misc;
575#define G_misc (*ash_ptr_to_globals_misc) 577#define G_misc (*ash_ptr_to_globals_misc)
576#define exitstatus (G_misc.exitstatus ) 578#define exitstatus (G_misc.exitstatus )
577#define back_exitstatus (G_misc.back_exitstatus ) 579#define back_exitstatus (G_misc.back_exitstatus )
580#if JOBS
578#define job_warning (G_misc.job_warning) 581#define job_warning (G_misc.job_warning)
582#else
583#define job_warning 0
584#endif
579#define inps4 (G_misc.inps4 ) 585#define inps4 (G_misc.inps4 )
580#define vforked (G_misc.vforked ) 586#define vforked (G_misc.vforked )
581#define savestatus (G_misc.savestatus ) 587#define savestatus (G_misc.savestatus )
@@ -3935,7 +3941,9 @@ struct job {
3935 unsigned nprocs; /* number of processes */ 3941 unsigned nprocs; /* number of processes */
3936 3942
3937#define JOBRUNNING 0 /* at least one proc running */ 3943#define JOBRUNNING 0 /* at least one proc running */
3944#if JOBS
3938#define JOBSTOPPED 1 /* all procs are stopped */ 3945#define JOBSTOPPED 1 /* all procs are stopped */
3946#endif
3939#define JOBDONE 2 /* all procs are completed */ 3947#define JOBDONE 2 /* all procs are completed */
3940 unsigned 3948 unsigned
3941 state: 8, 3949 state: 8,
@@ -4880,7 +4888,6 @@ fg_bgcmd(int argc UNUSED_PARAM, char **argv)
4880 } while (*argv && *++argv); 4888 } while (*argv && *++argv);
4881 return retval; 4889 return retval;
4882} 4890}
4883#endif
4884 4891
4885/* 4892/*
4886 * return 1 if there are stopped jobs, otherwise 0 4893 * return 1 if there are stopped jobs, otherwise 0
@@ -4903,6 +4910,9 @@ stoppedjobs(void)
4903 out: 4910 out:
4904 return retval; 4911 return retval;
4905} 4912}
4913#else
4914#define stoppedjobs() 0
4915#endif
4906 4916
4907static int FAST_FUNC 4917static int FAST_FUNC
4908waitcmd(int argc UNUSED_PARAM, char **argv) 4918waitcmd(int argc UNUSED_PARAM, char **argv)
@@ -13900,9 +13910,10 @@ cmdloop(int top)
13900 numeof++; 13910 numeof++;
13901 } else { 13911 } else {
13902 int i; 13912 int i;
13903 13913#if JOBS
13904 /* job_warning can only be 2,1,0. Here 2->1, 1/0->0 */ 13914 /* job_warning can only be 2,1,0. Here 2->1, 1/0->0 */
13905 job_warning >>= 1; 13915 job_warning >>= 1;
13916#endif
13906 numeof = 0; 13917 numeof = 0;
13907 i = evaltree(n, 0); 13918 i = evaltree(n, 0);
13908 if (n) 13919 if (n)