diff options
| author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-14 00:57:43 +0200 |
|---|---|---|
| committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-14 11:04:29 +1000 |
| commit | e8fb0c108f83dbdd3dcd6110fa58fea7581d75f4 (patch) | |
| tree | 83b18b60283bb041f7fb89e4f01463bd81455806 /shell | |
| parent | 4084f1ce1e02548db7e0bc3ec6efb37078d445e8 (diff) | |
| download | busybox-w32-e8fb0c108f83dbdd3dcd6110fa58fea7581d75f4.tar.gz busybox-w32-e8fb0c108f83dbdd3dcd6110fa58fea7581d75f4.tar.bz2 busybox-w32-e8fb0c108f83dbdd3dcd6110fa58fea7581d75f4.zip | |
win32: ash: struct forkshell
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/ash.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index f41bba36d..4710f7153 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 | ||
| 85 | struct forkshell; | ||
| 86 | union node; | ||
| 87 | struct strlist; | ||
| 88 | struct job; | ||
| 89 | |||
| 90 | typedef void (*forkpoint_fn)(struct forkshell *fs); | ||
| 91 | struct 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 | ||
| @@ -13601,6 +13633,49 @@ globals_misc_copy(struct globals_misc *p) | |||
| 13601 | SAVE_PTR4(new->minusc, new->curdir, new->physdir, new->arg0); | 13633 | SAVE_PTR4(new->minusc, new->curdir, new->physdir, new->arg0); |
| 13602 | return new; | 13634 | return new; |
| 13603 | } | 13635 | } |
| 13636 | |||
| 13637 | static void | ||
| 13638 | forkshell_size(struct forkshell *fs) | ||
| 13639 | { | ||
| 13640 | funcblocksize += sizeof(struct forkshell); | ||
| 13641 | globals_var_size(fs->gvp); | ||
| 13642 | globals_misc_size(fs->gmp); | ||
| 13643 | cmdtable_size(fs->cmdtable); | ||
| 13644 | localvar_size(fs->localvars); | ||
| 13645 | /* optlist_transfer(sending, fd); */ | ||
| 13646 | /* misc_transfer(sending, fd); */ | ||
| 13647 | |||
| 13648 | calcsize(fs->n); | ||
| 13649 | argv_size(fs->argv); | ||
| 13650 | funcstringsize += (fs->string ? strlen(fs->string) : 0) + 1; | ||
| 13651 | strlist_size(fs->strlist); | ||
| 13652 | |||
| 13653 | nodeptrsize += 8; /* gvp, gmp, cmdtable, localvars, n, argv, string, strlist */ | ||
| 13654 | } | ||
| 13655 | |||
| 13656 | static struct forkshell * | ||
| 13657 | forkshell_copy(struct forkshell *fs) | ||
| 13658 | { | ||
| 13659 | struct forkshell *new; | ||
| 13660 | |||
| 13661 | new = funcblock; | ||
| 13662 | funcblock = (char *) funcblock + sizeof(struct forkshell); | ||
| 13663 | |||
| 13664 | memcpy(new, fs, sizeof(struct forkshell)); /* non-pointer stuff */ | ||
| 13665 | new->gvp = globals_var_copy(fs->gvp); | ||
| 13666 | new->gmp = globals_misc_copy(fs->gmp); | ||
| 13667 | new->cmdtable = cmdtable_copy(fs->cmdtable); | ||
| 13668 | new->localvars = localvar_copy(fs->localvars); | ||
| 13669 | SAVE_PTR4(new->gvp, new->gmp, new->cmdtable, new->localvars); | ||
| 13670 | |||
| 13671 | /* new->fs will be reconstructed from new->fpid */ | ||
| 13672 | new->n = copynode(fs->n); | ||
| 13673 | new->argv = argv_copy(fs->argv); | ||
| 13674 | new->string = nodeckstrdup(fs->string); | ||
| 13675 | new->strlist = strlist_copy(fs->strlist); | ||
| 13676 | SAVE_PTR4(new->n, new->argv, new->string, new->strlist); | ||
| 13677 | return new; | ||
| 13678 | } | ||
| 13604 | /*- | 13679 | /*- |
| 13605 | * Copyright (c) 1989, 1991, 1993, 1994 | 13680 | * Copyright (c) 1989, 1991, 1993, 1994 |
| 13606 | * The Regents of the University of California. All rights reserved. | 13681 | * The Regents of the University of California. All rights reserved. |
