Changeset 3438 for trunk/src/kash/shinstance.h
- Timestamp:
- Sep 9, 2020, 10:01:39 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/shinstance.h
r3435 r3438 65 65 typedef struct shchild 66 66 { 67 pid_tpid; /**< The pid. */67 shpid pid; /**< The pid. */ 68 68 #if K_OS == K_OS_WINDOWS 69 69 void *hChild; /**< The process handle. */ 70 #endif 71 #ifndef SH_FORKED_MODE 72 KBOOL fProcess; /**< Set if process, clear if internal thread. */ 70 73 #endif 71 74 } shchild; … … 140 143 struct shinstance *prev; /**< The previous shell instance. */ 141 144 struct shinstance *parent; /**< The parent shell instance. */ 142 pid_tpid; /**< The (fake) process id of this shell instance. */145 shpid pid; /**< The (fake) process id of this shell instance. */ 143 146 shtid tid; /**< The thread identifier of the thread for this shell. */ 147 shpid pgid; /**< Process group ID. */ 144 148 shfdtab fdtab; /**< The file descriptor table. */ 145 149 shsigaction_t sigactions[NSIG]; /**< The signal actions registered with this shell instance. */ … … 148 152 int num_children; /**< Number of children in the array. */ 149 153 shchild *children; /**< The child array. */ 154 #ifndef SH_FORKED_MODE 155 int (*thread)(struct shinstance *, void *); /**< The thread procedure. */ 156 void *threadarg; /**< The thread argument. */ 157 #endif 150 158 151 159 /* alias.c */ 152 160 #define ATABSIZE 39 153 161 struct alias *atab[ATABSIZE]; 162 unsigned aliases; /**< Number of active aliases. */ 154 163 155 164 /* cd.c */ … … 178 187 int skipcount; /**< number of levels to skip */ 179 188 int loopnest; /**< current loop nesting level */ 189 int commandnamemalloc; /**< Set if commandname is malloc'ed (only subshells). */ 180 190 181 191 /* expand.c */ … … 210 220 211 221 /* jobs.h */ 212 pid_tbackgndpid/* = -1 */; /**< pid of last background process */222 shpid backgndpid/* = -1 */; /**< pid of last background process */ 213 223 int job_warning; /**< user was warned about stopped jobs */ 214 224 … … 217 227 int njobs; /**< size of array */ 218 228 int jobs_invalid; /**< set in child */ 219 intinitialpgrp; /**< pgrp of shell on invocation */229 shpid initialpgrp; /**< pgrp of shell on invocation */ 220 230 int curjob/* = -1*/;/**< current job */ 221 231 int ttyfd/* = -1*/; … … 231 241 232 242 /* main.h */ 233 introotpid; /**< pid of main shell. */243 shpid rootpid; /**< pid of main shell. */ 234 244 int rootshell; /**< true if we aren't a child of the main shell. */ 235 245 struct shinstance *psh_rootshell; /**< The root shell pointer. (!rootshell) */ … … 272 282 char *optionarg; /**< set by nextopt */ 273 283 char *optptr; /**< used by nextopt */ 284 char **orgargv; /**< The original argument vector (for cleanup). */ 285 int arg0malloc; /**< Indicates whether arg0 was allocated or is part of orgargv. */ 274 286 275 287 /* parse.h */ … … 346 358 347 359 348 extern shinstance *sh_create_root_shell(shinstance *, int, char **, char **); 360 extern shinstance *sh_create_root_shell(char **, char **); 361 extern shinstance *sh_create_child_shell(shinstance *); 349 362 350 363 /* environment & pwd.h */ … … 395 408 SH_NORETURN_1 void sh_abort(shinstance *) SH_NORETURN_2; 396 409 void sh_raise_sigint(shinstance *); 397 int sh_kill(shinstance *, pid_t, int);398 int sh_killpg(shinstance *, pid_t, int);410 int sh_kill(shinstance *, shpid, int); 411 int sh_killpg(shinstance *, shpid, int); 399 412 400 413 /* times */ … … 416 429 417 430 /* wait / process */ 418 int sh_add_child(shinstance *psh, pid_t pid, void *hChild);431 int sh_add_child(shinstance *psh, shpid pid, void *hChild, KBOOL fProcess); 419 432 #ifdef _MSC_VER 420 433 # include <process.h> … … 442 455 # endif 443 456 #endif 444 pid_t sh_fork(shinstance *); 445 pid_t sh_waitpid(shinstance *, pid_t, int *, int); 457 #ifdef SH_FORKED_MODE 458 shpid sh_fork(shinstance *); 459 #else 460 shpid sh_thread_start(shinstance *pshparent, shinstance *pshchild, int (*thread)(shinstance *, void *), void *arg); 461 #endif 462 shpid sh_waitpid(shinstance *, shpid, int *, int); 446 463 SH_NORETURN_1 void sh__exit(shinstance *, int) SH_NORETURN_2; 447 464 int sh_execve(shinstance *, const char *, const char * const*, const char * const *); … … 450 467 gid_t sh_getgid(shinstance *); 451 468 gid_t sh_getegid(shinstance *); 452 pid_tsh_getpid(shinstance *);453 pid_tsh_getpgrp(shinstance *);454 pid_t sh_getpgid(shinstance *, pid_t);455 int sh_setpgid(shinstance *, pid_t, pid_t);469 shpid sh_getpid(shinstance *); 470 shpid sh_getpgrp(shinstance *); 471 shpid sh_getpgid(shinstance *, shpid); 472 int sh_setpgid(shinstance *, shpid, shpid); 456 473 457 474 /* tc* */ 458 pid_tsh_tcgetpgrp(shinstance *, int);459 int sh_tcsetpgrp(shinstance *, int, pid_t);475 shpid sh_tcgetpgrp(shinstance *, int); 476 int sh_tcsetpgrp(shinstance *, int, shpid); 460 477 461 478 /* sys/resource.h */
Note:
See TracChangeset
for help on using the changeset viewer.