aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-02-06 13:51:56 +0000
committerRon Yorston <rmy@pobox.com>2019-02-06 13:51:56 +0000
commitdbb51f0845f904d56da09cf37537ef748b7c169e (patch)
tree62430658f5b865386548fdaa827c6d045c741a77 /shell
parent19712b74259ef63e115fd55540c808e604b2f7c9 (diff)
downloadbusybox-w32-dbb51f0845f904d56da09cf37537ef748b7c169e.tar.gz
busybox-w32-dbb51f0845f904d56da09cf37537ef748b7c169e.tar.bz2
busybox-w32-dbb51f0845f904d56da09cf37537ef748b7c169e.zip
ash: make spawn_forkshell more like forkshell
These are cosmetic changes only. Make the arguments to spawn_forkshell more like those of forkshell. Since job control isn't currently supported in busybox-w32 the node argument isn't actually used. The node passed in the forkshell structure is used in the child code. It may be different from the node passed as an argument to spawn_forkshell which, in the upstream code, is forwarded to forkparent and forkchild.
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 6283d3c28..735364962 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -384,7 +384,11 @@ static void forkshell_init(const char *idstr);
384static void forkshell_child(struct forkshell *fs); 384static void forkshell_child(struct forkshell *fs);
385static void sticky_free(void *p); 385static void sticky_free(void *p);
386# define free(p) sticky_free(p) 386# define free(p) sticky_free(p)
387static void spawn_forkshell(struct job *jp, struct forkshell *fs, int mode); 387#if !JOBS
388#define spawn_forkshell(fs, jp, n, mode) spawn_forkshell(fs, jp, mode)
389#endif
390static void spawn_forkshell(struct forkshell *fs, struct job *jp,
391 union node *n, int mode);
388# if FORKSHELL_DEBUG 392# if FORKSHELL_DEBUG
389static void forkshell_print(FILE *fp0, struct forkshell *fs, char **notes); 393static void forkshell_print(FILE *fp0, struct forkshell *fs, char **notes);
390# endif 394# endif
@@ -5747,7 +5751,7 @@ openhere(union node *redir)
5747 fs.n = redir; 5751 fs.n = redir;
5748 fs.fd[0] = pip[0]; 5752 fs.fd[0] = pip[0];
5749 fs.fd[1] = pip[1]; 5753 fs.fd[1] = pip[1];
5750 spawn_forkshell(NULL, &fs, FORK_NOJOB); 5754 spawn_forkshell(&fs, NULL, NULL, FORK_NOJOB);
5751#else 5755#else
5752 if (forkshell((struct job *)NULL, (union node *)NULL, FORK_NOJOB) == 0) { 5756 if (forkshell((struct job *)NULL, (union node *)NULL, FORK_NOJOB) == 0) {
5753 /* child */ 5757 /* child */
@@ -6842,7 +6846,7 @@ evalbackcmd(union node *n, struct backcmd *result)
6842 fs.n = n; 6846 fs.n = n;
6843 fs.fd[0] = pip[0]; 6847 fs.fd[0] = pip[0];
6844 fs.fd[1] = pip[1]; 6848 fs.fd[1] = pip[1];
6845 spawn_forkshell(jp, &fs, FORK_NOJOB); 6849 spawn_forkshell(&fs, jp, n, FORK_NOJOB);
6846#else 6850#else
6847 if (forkshell(jp, n, FORK_NOJOB) == 0) { 6851 if (forkshell(jp, n, FORK_NOJOB) == 0) {
6848 /* child */ 6852 /* child */
@@ -9825,7 +9829,7 @@ evalsubshell(union node *n, int flags)
9825 fs.fpid = FS_EVALSUBSHELL; 9829 fs.fpid = FS_EVALSUBSHELL;
9826 fs.n = n; 9830 fs.n = n;
9827 fs.flags = flags; 9831 fs.flags = flags;
9828 spawn_forkshell(jp, &fs, backgnd); 9832 spawn_forkshell(&fs, jp, n, backgnd);
9829 if ( 0 ) { 9833 if ( 0 ) {
9830#else 9834#else
9831 if (forkshell(jp, n, backgnd) == 0) { 9835 if (forkshell(jp, n, backgnd) == 0) {
@@ -9956,7 +9960,7 @@ evalpipe(union node *n, int flags)
9956 fs.fd[0] = pip[0]; 9960 fs.fd[0] = pip[0];
9957 fs.fd[1] = pip[1]; 9961 fs.fd[1] = pip[1];
9958 fs.fd[2] = prevfd; 9962 fs.fd[2] = prevfd;
9959 spawn_forkshell(jp, &fs, n->npipe.pipe_backgnd); 9963 spawn_forkshell(&fs, jp, lp->n, n->npipe.pipe_backgnd);
9960#else 9964#else
9961 if (forkshell(jp, lp->n, n->npipe.pipe_backgnd) == 0) { 9965 if (forkshell(jp, lp->n, n->npipe.pipe_backgnd) == 0) {
9962 /* child */ 9966 /* child */
@@ -10781,7 +10785,7 @@ evalcommand(union node *cmd, int flags)
10781 fs.fd[0] = cmdentry.u.index; 10785 fs.fd[0] = cmdentry.u.index;
10782 fs.varlist = varlist.list; 10786 fs.varlist = varlist.list;
10783 jp = makejob(/*cmd,*/ 1); 10787 jp = makejob(/*cmd,*/ 1);
10784 spawn_forkshell(jp, &fs, FORK_FG); 10788 spawn_forkshell(&fs, jp, cmd, FORK_FG);
10785 status = waitforjob(jp); 10789 status = waitforjob(jp);
10786 INT_ON; 10790 INT_ON;
10787 TRACE(("forked child exited with %d\n", status)); 10791 TRACE(("forked child exited with %d\n", status));
@@ -15162,7 +15166,7 @@ reinitvar(void)
15162} 15166}
15163 15167
15164static void 15168static void
15165spawn_forkshell(struct job *jp, struct forkshell *fs, int mode) 15169spawn_forkshell(struct forkshell *fs, struct job *jp, union node *n, int mode)
15166{ 15170{
15167 struct forkshell *new; 15171 struct forkshell *new;
15168 char buf[32]; 15172 char buf[32];
@@ -15182,7 +15186,7 @@ spawn_forkshell(struct job *jp, struct forkshell *fs, int mode)
15182 freejob(jp); 15186 freejob(jp);
15183 ash_msg_and_raise_error("unable to spawn shell"); 15187 ash_msg_and_raise_error("unable to spawn shell");
15184 } 15188 }
15185 forkparent(jp, fs->node, mode, (HANDLE)ret); 15189 forkparent(jp, n, mode, (HANDLE)ret);
15186} 15190}
15187 15191
15188/* 15192/*