Follow the FreeBSD and implement PDEATH_SIG prctl ops in the Linuxulator.

It was first introduced in r163734 and missied by me in r283383.

MFC after:	1 week
This commit is contained in:
Dmitry Chagin 2019-04-30 17:18:05 +00:00
parent dc93026776
commit 5d520d7fab
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346965
3 changed files with 11 additions and 12 deletions

View File

@ -127,7 +127,6 @@ linux_proc_init(struct thread *td, struct thread *newtd, int flags)
em->em_tid = p->p_pid;
em->flags = 0;
em->pdeath_signal = 0;
em->robust_futexes = NULL;
em->child_clear_tid = NULL;
em->child_set_tid = NULL;

View File

@ -40,7 +40,6 @@ struct linux_emuldata {
int *child_set_tid; /* in clone(): Child's TID to set on clone */
int *child_clear_tid;/* in clone(): Child's TID to clear on exit */
int pdeath_signal; /* parent death signal */
int flags; /* thread emuldata flags */
int em_tid; /* thread id */

View File

@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <sys/namei.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/procctl.h>
#include <sys/reboot.h>
#include <sys/racct.h>
#include <sys/random.h>
@ -1993,7 +1994,6 @@ linux_prctl(struct thread *td, struct linux_prctl_args *args)
int error = 0, max_size;
struct proc *p = td->td_proc;
char comm[LINUX_MAX_COMM_LEN];
struct linux_emuldata *em;
int pdeath_signal;
#ifdef DEBUG
@ -2007,17 +2007,18 @@ linux_prctl(struct thread *td, struct linux_prctl_args *args)
case LINUX_PR_SET_PDEATHSIG:
if (!LINUX_SIG_VALID(args->arg2))
return (EINVAL);
em = em_find(td);
KASSERT(em != NULL, ("prctl: emuldata not found.\n"));
em->pdeath_signal = args->arg2;
break;
pdeath_signal = linux_to_bsd_signal(args->arg2);
return (kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_CTL,
&pdeath_signal));
case LINUX_PR_GET_PDEATHSIG:
em = em_find(td);
KASSERT(em != NULL, ("prctl: emuldata not found.\n"));
pdeath_signal = em->pdeath_signal;
error = copyout(&pdeath_signal,
error = kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_STATUS,
&pdeath_signal);
if (error != 0)
return (error);
pdeath_signal = bsd_to_linux_signal(pdeath_signal);
return (copyout(&pdeath_signal,
(void *)(register_t)args->arg2,
sizeof(pdeath_signal));
sizeof(pdeath_signal)));
break;
case LINUX_PR_GET_KEEPCAPS:
/*