Пример #1
0
int
forkparent(struct job *jp, union node *n, int mode, pid_t pid)
{
	int pgrp;

	if (rootshell && mode != FORK_NOJOB && mflag) {
		if (jp == NULL || jp->nprocs == 0)
			pgrp = pid;
		else
			pgrp = jp->ps[0].pid;
		/* This can fail because we are doing it in the child also */
		(void)setpgid(pid, pgrp);
	}
	if (mode == FORK_BG)
		backgndpid = pid;		/* set $! */
	if (jp) {
		struct procstat *ps = &jp->ps[jp->nprocs++];
		ps->pid = pid;
		ps->status = -1;
		ps->cmd[0] = 0;
		if (/* iflag && rootshell && */ n)
			commandtext(ps, n);
	}
	TRACE(("In parent shell:  child = %d\n", pid));
	return pid;
}
Пример #2
0
const char *
mfn_command(MFUNARGS)
{
    return (commandtext(player, argv[0], argv[1]));
}