support process group

This commit is contained in:
Tomoki Shirasawa
2014-08-18 17:08:28 +09:00
parent 663c121308
commit 78d10cce80
8 changed files with 103 additions and 3 deletions

View File

@@ -391,6 +391,7 @@ static int process_msg_prepare_process(unsigned long rphys)
}
proc->pid = pn->pid;
proc->tid = pn->pid;
proc->pgid = pn->pgid;
proc->ftn->pid = pn->pid;
proc->vm->region.user_start = pn->user_start;
proc->vm->region.user_end = pn->user_end;

View File

@@ -194,6 +194,7 @@ struct process {
cpu_set_t cpu_set;
unsigned long saved_auxv[AUXV_LEN];
int pgid; /* process group id */
};
struct process_vm {

View File

@@ -110,6 +110,7 @@ struct program_load_desc {
int pid;
int err;
int stack_prot;
int pgid;
unsigned long entry;
unsigned long user_start;
unsigned long user_end;

View File

@@ -98,6 +98,7 @@ void do_signal(long rc, void *regs, struct process *proc, struct sig_pending *pe
extern unsigned long do_kill(int pid, int tid, int sig);
int copy_from_user(struct process *, void *, const void *, size_t);
int copy_to_user(struct process *, void *, const void *, size_t);
void do_setpgid(int, int);
int prepare_process_ranges_args_envs(struct process *proc,
struct program_load_desc *pn,
@@ -1318,6 +1319,8 @@ SYSCALL_DECLARE(clone)
return -ENOMEM;
}
new->pgid = cpu_local_var(current)->pgid;
cpu_set(cpuid, &new->vm->cpu_set, &new->vm->cpu_set_lock);
if (clone_flags & CLONE_VM) {
@@ -1430,10 +1433,28 @@ SYSCALL_DECLARE(kill)
SYSCALL_DECLARE(tgkill)
{
int tgid = ihk_mc_syscall_arg0(ctx);
int pid = ihk_mc_syscall_arg1(ctx);
int tid = ihk_mc_syscall_arg1(ctx);
int sig = ihk_mc_syscall_arg2(ctx);
return do_kill(tgid, pid, sig);
if(tid <= 0)
return -EINVAL;
if(tgid <= 0 && tgid != -1)
return -EINVAL;
return do_kill(tgid, tid, sig);
}
SYSCALL_DECLARE(setpgid)
{
int pid = ihk_mc_syscall_arg0(ctx);
int pgid = ihk_mc_syscall_arg1(ctx);
long rc;
rc = syscall_generic_forwarding(__NR_setpgid, ctx);
if(rc == 0){
do_setpgid(pid, pgid);
}
return rc;
}
SYSCALL_DECLARE(set_robust_list)