aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-14 00:57:43 +0200
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-20 19:14:48 +0200
commita5a032b052f026adfa9465325e9ee4d06d6bcd98 (patch)
tree03d76e83ac7b747d3c30544b68f04fff7e836bac /shell
parent1bf54057bd17188dfc57df5451567d2e6a299601 (diff)
downloadbusybox-w32-a5a032b052f026adfa9465325e9ee4d06d6bcd98.tar.gz
busybox-w32-a5a032b052f026adfa9465325e9ee4d06d6bcd98.tar.bz2
busybox-w32-a5a032b052f026adfa9465325e9ee4d06d6bcd98.zip
win32: ash: struct forkshell
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c75
1 files changed, 75 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 7cd96b2ea..a9a900bfd 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -81,6 +81,38 @@
81# error "Do not even bother, ash will not run on NOMMU machine" 81# error "Do not even bother, ash will not run on NOMMU machine"
82#endif 82#endif
83 83
84#if ENABLE_PLATFORM_MINGW32
85struct forkshell;
86union node;
87struct strlist;
88struct job;
89
90typedef void (*forkpoint_fn)(struct forkshell *fs);
91struct forkshell {
92 /* filled by forkshell_copy() */
93 struct globals_var *gvp;
94 struct globals_misc *gmp;
95 struct tblentry **cmdtable;
96 struct localvar *localvars;
97 /* struct alias **atab; */
98 /* struct parsefile *g_parsefile; */
99 int fpid;
100 HANDLE hMapFile;
101 void *old_base;
102 int nodeptr_offset;
103 int size;
104
105 forkpoint_fn fp;
106 /* optional data, used by forkpoint_fn */
107 int flags;
108 int fd[10];
109 union node *n;
110 char **argv;
111 char *string;
112 struct strlist *strlist;
113 pid_t pid;
114};
115#endif
84 116
85/* ============ Hash table sizes. Configurable. */ 117/* ============ Hash table sizes. Configurable. */
86 118
@@ -13600,6 +13632,49 @@ globals_misc_copy(struct globals_misc *p)
13600 SAVE_PTR4(new->minusc, new->curdir, new->physdir, new->arg0); 13632 SAVE_PTR4(new->minusc, new->curdir, new->physdir, new->arg0);
13601 return new; 13633 return new;
13602} 13634}
13635
13636static void
13637forkshell_size(struct forkshell *fs)
13638{
13639 funcblocksize += sizeof(struct forkshell);
13640 globals_var_size(fs->gvp);
13641 globals_misc_size(fs->gmp);
13642 cmdtable_size(fs->cmdtable);
13643 localvar_size(fs->localvars);
13644 /* optlist_transfer(sending, fd); */
13645 /* misc_transfer(sending, fd); */
13646
13647 calcsize(fs->n);
13648 argv_size(fs->argv);
13649 funcstringsize += (fs->string ? strlen(fs->string) : 0) + 1;
13650 strlist_size(fs->strlist);
13651
13652 nodeptrsize += 8; /* gvp, gmp, cmdtable, localvars, n, argv, string, strlist */
13653}
13654
13655static struct forkshell *
13656forkshell_copy(struct forkshell *fs)
13657{
13658 struct forkshell *new;
13659
13660 new = funcblock;
13661 funcblock = (char *) funcblock + sizeof(struct forkshell);
13662
13663 memcpy(new, fs, sizeof(struct forkshell)); /* non-pointer stuff */
13664 new->gvp = globals_var_copy(fs->gvp);
13665 new->gmp = globals_misc_copy(fs->gmp);
13666 new->cmdtable = cmdtable_copy(fs->cmdtable);
13667 new->localvars = localvar_copy(fs->localvars);
13668 SAVE_PTR4(new->gvp, new->gmp, new->cmdtable, new->localvars);
13669
13670 /* new->fs will be reconstructed from new->fpid */
13671 new->n = copynode(fs->n);
13672 new->argv = argv_copy(fs->argv);
13673 new->string = nodeckstrdup(fs->string);
13674 new->strlist = strlist_copy(fs->strlist);
13675 SAVE_PTR4(new->n, new->argv, new->string, new->strlist);
13676 return new;
13677}
13603/*- 13678/*-
13604 * Copyright (c) 1989, 1991, 1993, 1994 13679 * Copyright (c) 1989, 1991, 1993, 1994
13605 * The Regents of the University of California. All rights reserved. 13680 * The Regents of the University of California. All rights reserved.