Enable Linux threads support by default.
This takes the conditionals out of the code that has been tested by various people for a while. ps and friends (libkvm) will need a recompile as some proc structure changes are made. Submitted by: "Richard Seaman, Jr." <dick@tar.com>
This commit is contained in:
parent
ab19eb8230
commit
88c5ea4574
@ -36,7 +36,7 @@
|
||||
static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94";
|
||||
#else
|
||||
static const char rcsid[] =
|
||||
"$Id: keyword.c,v 1.21 1998/12/19 02:55:32 julian Exp $";
|
||||
"$Id: keyword.c,v 1.22 1999/01/13 03:11:43 julian Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -157,17 +157,10 @@ VAR var[] = {
|
||||
{"ruser", "RUSER", NULL, LJUST|DSIZ, runame, s_runame, USERLEN},
|
||||
{"sess", "SESS", NULL, 0, evar, NULL, 6, EOFF(e_sess), KPTR, "lx"},
|
||||
{"sig", "PENDING", NULL, 0, pvar, NULL, 8, POFF(p_siglist), INT, "x"},
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
{"sigcatch", "CAUGHT",
|
||||
NULL, 0, pvar, NULL, 8, POFF(p_sigcatch), UINT, "x"},
|
||||
{"sigignore", "IGNORED",
|
||||
NULL, 0, pvar, NULL, 8, POFF(p_sigignore), UINT, "x"},
|
||||
#else
|
||||
{"sigcatch", "CAUGHT",
|
||||
NULL, 0, evar, NULL, 8, EOFF(e_procsig.ps_sigcatch), UINT, "x"},
|
||||
{"sigignore", "IGNORED",
|
||||
NULL, 0, evar, NULL, 8, EOFF(e_procsig.ps_sigignore), UINT, "x"},
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
{"sigmask", "BLOCKED",
|
||||
NULL, 0, pvar, NULL, 8, POFF(p_sigmask), UINT, "x"},
|
||||
{"sl", "SL", NULL, 0, pvar, NULL, 3, POFF(p_slptime), UINT, "d"},
|
||||
|
@ -56,6 +56,12 @@ types will be unaffected. Subsequent forks by the parent will then
|
||||
propagate the shared data and bss between children. The stack segment
|
||||
is always split. May be set only with
|
||||
.Dv RFPROC .
|
||||
.It RFSIGSHARE
|
||||
If set, the kernel will force sharing the sigacts structure between the
|
||||
child and the parent.
|
||||
.It RFLINUXTHPN
|
||||
If set, the kernel will return SIGUSR1 instead of SIGCHILD upon thread
|
||||
exit for the child. This is intended to mimic certain Linux clone behaviour.
|
||||
.El
|
||||
.Pp
|
||||
File descriptors in a shared file descriptor table are kept
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: linux_misc.c,v 1.50 1998/12/30 21:01:33 sos Exp $
|
||||
* $Id: linux_misc.c,v 1.51 1999/01/06 23:05:38 julian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -41,9 +41,7 @@
|
||||
#include <sys/resourcevar.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysctl.h>
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
#include <sys/unistd.h>
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/time.h>
|
||||
@ -563,15 +561,6 @@ linux_fork(struct proc *p, struct linux_fork_args *args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
int
|
||||
linux_clone(struct proc *p, struct linux_clone_args *args)
|
||||
{
|
||||
printf("linux_clone(%d): Not enabled\n", p->p_pid);
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
#else
|
||||
#define CLONE_VM 0x100
|
||||
#define CLONE_FS 0x200
|
||||
#define CLONE_FILES 0x400
|
||||
@ -635,7 +624,6 @@ linux_clone(struct proc *p, struct linux_clone_args *args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
/* XXX move */
|
||||
struct linux_mmap_argv {
|
||||
linux_caddr_t addr;
|
||||
@ -646,11 +634,8 @@ struct linux_mmap_argv {
|
||||
int pos;
|
||||
};
|
||||
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
#define STACK_SIZE (2 * 1024 * 1024)
|
||||
#define GUARD_SIZE (4 * PAGE_SIZE)
|
||||
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
int
|
||||
linux_mmap(struct proc *p, struct linux_mmap_args *args)
|
||||
{
|
||||
@ -683,10 +668,6 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args)
|
||||
bsd_args.flags |= MAP_FIXED;
|
||||
if (linux_args.flags & LINUX_MAP_ANON)
|
||||
bsd_args.flags |= MAP_ANON;
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
bsd_args.addr = linux_args.addr;
|
||||
bsd_args.len = linux_args.len;
|
||||
#else
|
||||
|
||||
#ifndef VM_STACK
|
||||
/* Linux Threads will map into the proc stack space, unless
|
||||
@ -745,7 +726,7 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args)
|
||||
bsd_args.addr = linux_args.addr;
|
||||
bsd_args.len = linux_args.len;
|
||||
}
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
|
||||
bsd_args.prot = linux_args.prot | PROT_READ; /* always required */
|
||||
bsd_args.fd = linux_args.fd;
|
||||
bsd_args.pos = linux_args.pos;
|
||||
@ -972,9 +953,6 @@ linux_waitpid(struct proc *p, struct linux_waitpid_args *args)
|
||||
#endif
|
||||
tmp.pid = args->pid;
|
||||
tmp.status = args->status;
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
tmp.options = args->options;
|
||||
#else
|
||||
/* This filters out the linux option _WCLONE. I don't
|
||||
* think we need it, but I could be wrong. If we need
|
||||
* it, we need to fix wait4, since it will give us an
|
||||
@ -982,15 +960,11 @@ linux_waitpid(struct proc *p, struct linux_waitpid_args *args)
|
||||
* of course, it won't do anything with it.
|
||||
*/
|
||||
tmp.options = (args->options & (WNOHANG | WUNTRACED));
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
tmp.rusage = NULL;
|
||||
|
||||
if (error = wait4(p, &tmp))
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
return error;
|
||||
#else
|
||||
return error;
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
|
||||
if (args->status) {
|
||||
if (error = copyin(args->status, &tmpstat, sizeof(int)))
|
||||
return error;
|
||||
@ -1023,9 +997,6 @@ linux_wait4(struct proc *p, struct linux_wait4_args *args)
|
||||
#endif
|
||||
tmp.pid = args->pid;
|
||||
tmp.status = args->status;
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
tmp.options = args->options;
|
||||
#else
|
||||
/* This filters out the linux option _WCLONE. I don't
|
||||
* think we need it, but I could be wrong. If we need
|
||||
* it, we need to fix wait4, since it will give us an
|
||||
@ -1033,7 +1004,6 @@ linux_wait4(struct proc *p, struct linux_wait4_args *args)
|
||||
* of course, it won't do anything with it.
|
||||
*/
|
||||
tmp.options = (args->options & (WNOHANG | WUNTRACED));
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
tmp.rusage = args->rusage;
|
||||
|
||||
if (error = wait4(p, &tmp))
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: linux_misc.c,v 1.50 1998/12/30 21:01:33 sos Exp $
|
||||
* $Id: linux_misc.c,v 1.51 1999/01/06 23:05:38 julian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -41,9 +41,7 @@
|
||||
#include <sys/resourcevar.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysctl.h>
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
#include <sys/unistd.h>
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/time.h>
|
||||
@ -563,15 +561,6 @@ linux_fork(struct proc *p, struct linux_fork_args *args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
int
|
||||
linux_clone(struct proc *p, struct linux_clone_args *args)
|
||||
{
|
||||
printf("linux_clone(%d): Not enabled\n", p->p_pid);
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
#else
|
||||
#define CLONE_VM 0x100
|
||||
#define CLONE_FS 0x200
|
||||
#define CLONE_FILES 0x400
|
||||
@ -635,7 +624,6 @@ linux_clone(struct proc *p, struct linux_clone_args *args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
/* XXX move */
|
||||
struct linux_mmap_argv {
|
||||
linux_caddr_t addr;
|
||||
@ -646,11 +634,8 @@ struct linux_mmap_argv {
|
||||
int pos;
|
||||
};
|
||||
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
#define STACK_SIZE (2 * 1024 * 1024)
|
||||
#define GUARD_SIZE (4 * PAGE_SIZE)
|
||||
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
int
|
||||
linux_mmap(struct proc *p, struct linux_mmap_args *args)
|
||||
{
|
||||
@ -683,10 +668,6 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args)
|
||||
bsd_args.flags |= MAP_FIXED;
|
||||
if (linux_args.flags & LINUX_MAP_ANON)
|
||||
bsd_args.flags |= MAP_ANON;
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
bsd_args.addr = linux_args.addr;
|
||||
bsd_args.len = linux_args.len;
|
||||
#else
|
||||
|
||||
#ifndef VM_STACK
|
||||
/* Linux Threads will map into the proc stack space, unless
|
||||
@ -745,7 +726,7 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args)
|
||||
bsd_args.addr = linux_args.addr;
|
||||
bsd_args.len = linux_args.len;
|
||||
}
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
|
||||
bsd_args.prot = linux_args.prot | PROT_READ; /* always required */
|
||||
bsd_args.fd = linux_args.fd;
|
||||
bsd_args.pos = linux_args.pos;
|
||||
@ -972,9 +953,6 @@ linux_waitpid(struct proc *p, struct linux_waitpid_args *args)
|
||||
#endif
|
||||
tmp.pid = args->pid;
|
||||
tmp.status = args->status;
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
tmp.options = args->options;
|
||||
#else
|
||||
/* This filters out the linux option _WCLONE. I don't
|
||||
* think we need it, but I could be wrong. If we need
|
||||
* it, we need to fix wait4, since it will give us an
|
||||
@ -982,15 +960,11 @@ linux_waitpid(struct proc *p, struct linux_waitpid_args *args)
|
||||
* of course, it won't do anything with it.
|
||||
*/
|
||||
tmp.options = (args->options & (WNOHANG | WUNTRACED));
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
tmp.rusage = NULL;
|
||||
|
||||
if (error = wait4(p, &tmp))
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
return error;
|
||||
#else
|
||||
return error;
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
|
||||
if (args->status) {
|
||||
if (error = copyin(args->status, &tmpstat, sizeof(int)))
|
||||
return error;
|
||||
@ -1023,9 +997,6 @@ linux_wait4(struct proc *p, struct linux_wait4_args *args)
|
||||
#endif
|
||||
tmp.pid = args->pid;
|
||||
tmp.status = args->status;
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
tmp.options = args->options;
|
||||
#else
|
||||
/* This filters out the linux option _WCLONE. I don't
|
||||
* think we need it, but I could be wrong. If we need
|
||||
* it, we need to fix wait4, since it will give us an
|
||||
@ -1033,7 +1004,6 @@ linux_wait4(struct proc *p, struct linux_wait4_args *args)
|
||||
* of course, it won't do anything with it.
|
||||
*/
|
||||
tmp.options = (args->options & (WNOHANG | WUNTRACED));
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
tmp.rusage = args->rusage;
|
||||
|
||||
if (error = wait4(p, &tmp))
|
||||
|
@ -26,7 +26,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: imgact_elf.c,v 1.43 1998/12/04 22:54:51 archie Exp $
|
||||
* $Id: imgact_elf.c,v 1.44 1998/12/19 02:55:33 julian Exp $
|
||||
*/
|
||||
|
||||
#include "opt_rlimit.h"
|
||||
@ -854,11 +854,7 @@ elf_corehdr(p, vp, cred, numsegs, hdr, hdrsize)
|
||||
status.pr_gregsetsz = sizeof(gregset_t);
|
||||
status.pr_fpregsetsz = sizeof(fpregset_t);
|
||||
status.pr_osreldate = osreldate;
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
status.pr_cursig = p->p_sigacts->ps_sig;
|
||||
#else
|
||||
status.pr_cursig = p->p_sig;
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
status.pr_pid = p->p_pid;
|
||||
fill_regs(p, &status.pr_reg);
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
|
||||
* $Id: init_main.c,v 1.102 1998/12/30 10:38:58 dfr Exp $
|
||||
* $Id: init_main.c,v 1.103 1999/01/07 21:23:39 julian Exp $
|
||||
*/
|
||||
|
||||
#include "opt_devfs.h"
|
||||
@ -83,9 +83,7 @@ static struct session session0;
|
||||
static struct pgrp pgrp0;
|
||||
struct proc proc0;
|
||||
static struct pcred cred0;
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
static struct procsig procsig0;
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
static struct filedesc0 filedesc0;
|
||||
static struct plimit limit0;
|
||||
static struct vmspace vmspace0;
|
||||
@ -418,12 +416,10 @@ proc0_init(dummy)
|
||||
p->p_ucred = crget();
|
||||
p->p_ucred->cr_ngroups = 1; /* group 0 */
|
||||
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
/* Create procsig. */
|
||||
p->p_procsig = &procsig0;
|
||||
p->p_procsig->ps_refcnt = 2;
|
||||
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
/* Create the file descriptor table. */
|
||||
fdp = &filedesc0;
|
||||
p->p_fd = &fdp->fd_fd;
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_exit.c 8.7 (Berkeley) 2/12/94
|
||||
* $Id: kern_exit.c,v 1.70 1998/12/19 02:55:33 julian Exp $
|
||||
* $Id: kern_exit.c,v 1.71 1999/01/07 21:23:41 julian Exp $
|
||||
*/
|
||||
|
||||
#include "opt_compat.h"
|
||||
@ -73,9 +73,7 @@
|
||||
#include <vm/pmap.h>
|
||||
#include <vm/vm_map.h>
|
||||
#include <vm/vm_zone.h>
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
#include <sys/user.h>
|
||||
#endif
|
||||
|
||||
static MALLOC_DEFINE(M_ZOMBIE, "zombie", "zombie proc status");
|
||||
|
||||
@ -184,9 +182,6 @@ exit1(p, rv)
|
||||
*/
|
||||
p->p_flag &= ~(P_TRACED | P_PPWAIT);
|
||||
p->p_flag |= P_WEXIT;
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
p->p_sigignore = ~0;
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
p->p_siglist = 0;
|
||||
if (timevalisset(&p->p_realtimer.it_value))
|
||||
untimeout(realitexpire, (caddr_t)p, p->p_ithandle);
|
||||
@ -287,9 +282,7 @@ exit1(p, rv)
|
||||
LIST_REMOVE(q, p_sibling);
|
||||
LIST_INSERT_HEAD(&initproc->p_children, q, p_sibling);
|
||||
q->p_pptr = initproc;
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
q->p_sigparent = 0;
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
/*
|
||||
* Traced processes are killed
|
||||
* since their existence means someone is screwing up.
|
||||
@ -314,11 +307,7 @@ exit1(p, rv)
|
||||
* flag set, notify process 1 instead (and hope it will handle
|
||||
* this situation).
|
||||
*/
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
if (p->p_pptr->p_flag & P_NOCLDWAIT) {
|
||||
#else
|
||||
if (p->p_pptr->p_procsig->ps_flag & P_NOCLDWAIT) {
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
struct proc *pp = p->p_pptr;
|
||||
proc_reparent(p, initproc);
|
||||
/*
|
||||
@ -330,15 +319,12 @@ exit1(p, rv)
|
||||
wakeup((caddr_t)pp);
|
||||
}
|
||||
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
psignal(p->p_pptr, SIGCHLD);
|
||||
#else
|
||||
if (p->p_sigparent && p->p_pptr != initproc) {
|
||||
psignal(p->p_pptr, p->p_sigparent);
|
||||
} else {
|
||||
psignal(p->p_pptr, SIGCHLD);
|
||||
}
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
|
||||
wakeup((caddr_t)p->p_pptr);
|
||||
#if defined(tahoe)
|
||||
/* move this to cpu_exit */
|
||||
@ -508,14 +494,13 @@ loop:
|
||||
LIST_REMOVE(p, p_list); /* off zombproc */
|
||||
LIST_REMOVE(p, p_sibling);
|
||||
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
if (--p->p_procsig->ps_refcnt == 0) {
|
||||
if (p->p_sigacts != &p->p_addr->u_sigacts)
|
||||
FREE(p->p_sigacts, M_SUBPROC);
|
||||
FREE(p->p_procsig, M_SUBPROC);
|
||||
p->p_procsig = NULL;
|
||||
}
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
|
||||
/*
|
||||
* Give machine-dependent layer a chance
|
||||
* to free anything that cpu_exit couldn't
|
||||
@ -627,7 +612,6 @@ rm_at_exit(function)
|
||||
return (count);
|
||||
}
|
||||
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
void check_sigacts (void)
|
||||
{
|
||||
struct proc *p = curproc;
|
||||
@ -644,4 +628,4 @@ void check_sigacts (void)
|
||||
FREE(pss, M_SUBPROC);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_fork.c 8.6 (Berkeley) 4/8/94
|
||||
* $Id: kern_fork.c,v 1.53 1998/12/19 02:55:33 julian Exp $
|
||||
* $Id: kern_fork.c,v 1.54 1999/01/07 21:23:42 julian Exp $
|
||||
*/
|
||||
|
||||
#include "opt_ktrace.h"
|
||||
@ -62,10 +62,9 @@
|
||||
#include <vm/vm_extern.h>
|
||||
#include <vm/vm_zone.h>
|
||||
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
#include <machine/frame.h>
|
||||
#include <sys/user.h>
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
|
||||
#ifdef SMP
|
||||
static int fast_vfork = 0; /* Doesn't work on SMP yet. */
|
||||
#else
|
||||
@ -329,7 +328,6 @@ again:
|
||||
p2->p_cred->p_refcnt = 1;
|
||||
crhold(p1->p_ucred);
|
||||
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
if (flags & RFSIGSHARE) {
|
||||
p2->p_procsig = p1->p_procsig;
|
||||
p2->p_procsig->ps_refcnt++;
|
||||
@ -366,7 +364,7 @@ again:
|
||||
if (flags & RFLINUXTHPN) {
|
||||
p2->p_sigparent = SIGUSR1;
|
||||
}
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
|
||||
/* bump references to the text vnode (for procfs) */
|
||||
p2->p_textvp = p1->p_textvp;
|
||||
if (p2->p_textvp)
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_proc.c 8.7 (Berkeley) 2/14/95
|
||||
* $Id: kern_proc.c,v 1.42 1999/01/10 01:58:24 eivind Exp $
|
||||
* $Id: kern_proc.c,v 1.43 1999/01/13 03:11:42 julian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -415,11 +415,9 @@ fill_eproc(p, ep)
|
||||
if (p->p_ucred)
|
||||
ep->e_ucred = *p->p_ucred;
|
||||
}
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
if (p->p_procsig){
|
||||
ep->e_procsig = *p->p_procsig;
|
||||
}
|
||||
#endif
|
||||
if (p->p_stat != SIDL && p->p_stat != SZOMB && p->p_vmspace != NULL) {
|
||||
register struct vmspace *vm = p->p_vmspace;
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_sig.c 8.7 (Berkeley) 4/18/94
|
||||
* $Id: kern_sig.c,v 1.52 1999/01/08 17:31:10 eivind Exp $
|
||||
* $Id: kern_sig.c,v 1.53 1999/01/10 01:58:24 eivind Exp $
|
||||
*/
|
||||
|
||||
#include "opt_compat.h"
|
||||
@ -135,17 +135,9 @@ sigaction(p, uap)
|
||||
sa->sa_flags |= SA_RESETHAND;
|
||||
if ((ps->ps_signodefer & bit) != 0)
|
||||
sa->sa_flags |= SA_NODEFER;
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
if (signum == SIGCHLD && p->p_flag & P_NOCLDSTOP)
|
||||
#else
|
||||
if (signum == SIGCHLD && p->p_procsig->ps_flag & P_NOCLDSTOP)
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
sa->sa_flags |= SA_NOCLDSTOP;
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
if (signum == SIGCHLD && p->p_flag & P_NOCLDWAIT)
|
||||
#else
|
||||
if (signum == SIGCHLD && p->p_procsig->ps_flag & P_NOCLDWAIT)
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
sa->sa_flags |= SA_NOCLDWAIT;
|
||||
if ((error = copyout((caddr_t)sa, (caddr_t)uap->osa,
|
||||
sizeof (vec))))
|
||||
@ -203,15 +195,9 @@ setsigvec(p, signum, sa)
|
||||
#endif
|
||||
if (signum == SIGCHLD) {
|
||||
if (sa->sa_flags & SA_NOCLDSTOP)
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
p->p_flag |= P_NOCLDSTOP;
|
||||
else
|
||||
p->p_flag &= ~P_NOCLDSTOP;
|
||||
#else
|
||||
p->p_procsig->ps_flag |= P_NOCLDSTOP;
|
||||
else
|
||||
p->p_procsig->ps_flag &= ~P_NOCLDSTOP;
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
if (sa->sa_flags & SA_NOCLDWAIT) {
|
||||
/*
|
||||
* Paranoia: since SA_NOCLDWAIT is implemented by
|
||||
@ -220,21 +206,11 @@ setsigvec(p, signum, sa)
|
||||
* forbidden to set SA_NOCLDWAIT.
|
||||
*/
|
||||
if (p->p_pid == 1)
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
p->p_flag &= ~P_NOCLDWAIT;
|
||||
else
|
||||
p->p_flag |= P_NOCLDWAIT;
|
||||
#else
|
||||
p->p_procsig->ps_flag &= ~P_NOCLDWAIT;
|
||||
else
|
||||
p->p_procsig->ps_flag |= P_NOCLDWAIT;
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
} else
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
p->p_flag &= ~P_NOCLDWAIT;
|
||||
#else
|
||||
p->p_procsig->ps_flag &= ~P_NOCLDWAIT;
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
}
|
||||
/*
|
||||
* Set bit in p_sigignore for signals that are set to SIG_IGN,
|
||||
@ -409,11 +385,7 @@ osigvec(p, uap)
|
||||
if ((ps->ps_signodefer & bit) != 0)
|
||||
sv->sv_flags |= SV_NODEFER;
|
||||
#ifndef COMPAT_SUNOS
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
if (signum == SIGCHLD && p->p_flag & P_NOCLDSTOP)
|
||||
#else
|
||||
if (signum == SIGCHLD && p->p_procsig->ps_flag & P_NOCLDSTOP)
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
sv->sv_flags |= SV_NOCLDSTOP;
|
||||
#endif
|
||||
if ((error = copyout((caddr_t)sv, (caddr_t)uap->osv,
|
||||
@ -498,12 +470,7 @@ sigsuspend(p, uap)
|
||||
* save it here and mark the sigacts structure
|
||||
* to indicate this.
|
||||
*/
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
ps->ps_oldmask = p->p_sigmask;
|
||||
ps->ps_flags |= SAS_OLDMASK;
|
||||
#else
|
||||
p->p_oldsigmask = p->p_sigmask;
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
p->p_sigmask = uap->mask &~ sigcantmask;
|
||||
while (tsleep((caddr_t) ps, PPAUSE|PCATCH, "pause", 0) == 0)
|
||||
/* void */;
|
||||
@ -762,13 +729,8 @@ trapsignal(p, signum, code)
|
||||
ps->ps_sigact[signum] = SIG_DFL;
|
||||
}
|
||||
} else {
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
ps->ps_code = code; /* XXX for core dump/debugger */
|
||||
ps->ps_sig = signum; /* XXX to verify code */
|
||||
#else
|
||||
p->p_code = code; /* XXX for core dump/debugger */
|
||||
p->p_sig = signum; /* XXX to verify code */
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
psignal(p, signum);
|
||||
}
|
||||
}
|
||||
@ -817,11 +779,7 @@ psignal(p, signum)
|
||||
* and if it is set to SIG_IGN,
|
||||
* action will be SIG_DFL here.)
|
||||
*/
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
if (p->p_sigignore & mask)
|
||||
#else
|
||||
if ((p->p_sigignore & mask) || (p->p_flag & P_WEXIT))
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
return;
|
||||
if (p->p_sigmask & mask)
|
||||
action = SIG_HOLD;
|
||||
@ -903,11 +861,7 @@ psignal(p, signum)
|
||||
goto out;
|
||||
p->p_siglist &= ~mask;
|
||||
p->p_xstat = signum;
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
if ((p->p_pptr->p_flag & P_NOCLDSTOP) == 0)
|
||||
#else
|
||||
if ((p->p_pptr->p_procsig->ps_flag & P_NOCLDSTOP) == 0)
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
psignal(p->p_pptr, SIGCHLD);
|
||||
stop(p);
|
||||
goto out;
|
||||
@ -1114,11 +1068,7 @@ issignal(p)
|
||||
break; /* == ignore */
|
||||
p->p_xstat = signum;
|
||||
stop(p);
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
if ((p->p_pptr->p_flag & P_NOCLDSTOP) == 0)
|
||||
#else
|
||||
if ((p->p_pptr->p_procsig->ps_flag & P_NOCLDSTOP) == 0)
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
psignal(p->p_pptr, SIGCHLD);
|
||||
mi_switch();
|
||||
break;
|
||||
@ -1191,13 +1141,8 @@ postsig(signum)
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(p, KTR_PSIG))
|
||||
ktrpsig(p->p_tracep,
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
signum, action, ps->ps_flags & SAS_OLDMASK ?
|
||||
ps->ps_oldmask : p->p_sigmask, 0);
|
||||
#else
|
||||
signum, action, p->p_oldsigmask ?
|
||||
p->p_oldsigmask : p->p_sigmask, 0);
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
#endif
|
||||
STOPEVENT(p, S_SIG, signum);
|
||||
|
||||
@ -1224,15 +1169,9 @@ postsig(signum)
|
||||
* restored after the signal processing is completed.
|
||||
*/
|
||||
(void) splhigh();
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
if (ps->ps_flags & SAS_OLDMASK) {
|
||||
returnmask = ps->ps_oldmask;
|
||||
ps->ps_flags &= ~SAS_OLDMASK;
|
||||
#else
|
||||
if (p->p_oldsigmask) {
|
||||
returnmask = p->p_oldsigmask;
|
||||
p->p_oldsigmask = 0;
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
} else
|
||||
returnmask = p->p_sigmask;
|
||||
p->p_sigmask |= ps->ps_catchmask[signum] |
|
||||
@ -1248,22 +1187,12 @@ postsig(signum)
|
||||
}
|
||||
(void) spl0();
|
||||
p->p_stats->p_ru.ru_nsignals++;
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
if (ps->ps_sig != signum) {
|
||||
#else
|
||||
if (p->p_sig != signum) {
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
code = 0;
|
||||
} else {
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
code = ps->ps_code;
|
||||
ps->ps_code = 0;
|
||||
ps->ps_sig = 0;
|
||||
#else
|
||||
code = p->p_code;
|
||||
p->p_code = 0;
|
||||
p->p_sig = 0;
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
}
|
||||
(*p->p_sysent->sv_sendsig)(action, signum, returnmask, code);
|
||||
}
|
||||
@ -1298,11 +1227,7 @@ sigexit(p, signum)
|
||||
|
||||
p->p_acflag |= AXSIG;
|
||||
if (sigprop[signum] & SA_CORE) {
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
p->p_sigacts->ps_sig = signum;
|
||||
#else
|
||||
p->p_sig = signum;
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
/*
|
||||
* Log signals which would cause core dumps
|
||||
* (Log as LOG_INFO to appease those who don't want
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)proc.h 8.15 (Berkeley) 5/19/95
|
||||
* $Id: proc.h,v 1.65 1998/12/31 13:23:16 bde Exp $
|
||||
* $Id: proc.h,v 1.66 1999/01/07 21:23:45 julian Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_PROC_H_
|
||||
@ -47,9 +47,7 @@
|
||||
#include <sys/rtprio.h> /* For struct rtprio. */
|
||||
#include <sys/select.h> /* For struct selinfo. */
|
||||
#include <sys/signal.h>
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
#include <sys/signalvar.h>
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
#ifndef KERNEL
|
||||
#include <sys/time.h> /* For structs itimerval, timeval. */
|
||||
#endif
|
||||
@ -81,7 +79,6 @@ struct pgrp {
|
||||
int pg_jobc; /* # procs qualifying pgrp for job control */
|
||||
};
|
||||
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
struct procsig {
|
||||
#define ps_begincopy ps_sigignore
|
||||
sigset_t ps_sigignore; /* Signals being ignored. */
|
||||
@ -91,7 +88,6 @@ struct procsig {
|
||||
#define ps_endcopy ps_refcnt
|
||||
int ps_refcnt;
|
||||
};
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
|
||||
/*
|
||||
* pasleep structure, used by asleep() syscall to hold requested priority
|
||||
@ -123,14 +119,10 @@ struct proc {
|
||||
struct pstats *p_stats; /* Accounting/statistics (PROC ONLY). */
|
||||
struct plimit *p_limit; /* Process limits. */
|
||||
struct vm_object *p_upages_obj;/* Upages object */
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
struct sigacts *p_sigacts; /* Signal actions, state (PROC ONLY). */
|
||||
#else
|
||||
struct procsig *p_procsig;
|
||||
#define p_sigacts p_procsig->ps_sigacts
|
||||
#define p_sigignore p_procsig->ps_sigignore
|
||||
#define p_sigcatch p_procsig->ps_sigcatch
|
||||
#endif
|
||||
|
||||
#define p_ucred p_cred->pc_ucred
|
||||
#define p_rlimit p_limit->pl_rlimit
|
||||
@ -195,12 +187,10 @@ struct proc {
|
||||
char p_pad3[2]; /* padding for alignment */
|
||||
register_t p_retval[2]; /* syscall aux returns */
|
||||
struct sigiolst p_sigiolst; /* list of sigio sources */
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
int p_sigparent; /* signal to parent on exit */
|
||||
sigset_t p_oldsigmask; /* saved mask from before sigpause */
|
||||
int p_sig; /* for core dump/debugger XXX */
|
||||
u_long p_code; /* for core dump/debugger XXX */
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
|
||||
/* End area that is zeroed on creation. */
|
||||
#define p_endzero p_startcopy
|
||||
@ -209,10 +199,6 @@ struct proc {
|
||||
#define p_startcopy p_sigmask
|
||||
|
||||
sigset_t p_sigmask; /* Current signal mask. */
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
sigset_t p_sigignore; /* Signals being ignored. */
|
||||
sigset_t p_sigcatch; /* Signals being caught by user. */
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
u_char p_priority; /* Process priority. */
|
||||
u_char p_usrpri; /* User-priority based on p_cpu and p_nice. */
|
||||
char p_nice; /* Process "nice" value. */
|
||||
@ -388,11 +374,7 @@ void wakeup_one __P((void *chan));
|
||||
void cpu_exit __P((struct proc *)) __dead2;
|
||||
void exit1 __P((struct proc *, int)) __dead2;
|
||||
void cpu_fork __P((struct proc *, struct proc *));
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
int fork1 __P((struct proc *, int));
|
||||
#else
|
||||
int fork1 __P((struct proc *, int));
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
int trace_req __P((struct proc *));
|
||||
void cpu_wait __P((struct proc *));
|
||||
int cpu_coredump __P((struct proc *, struct vnode *, struct ucred *));
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)signalvar.h 8.6 (Berkeley) 2/19/95
|
||||
* $Id: signalvar.h,v 1.21 1998/12/19 02:55:34 julian Exp $
|
||||
* $Id: signalvar.h,v 1.22 1999/01/07 21:23:46 julian Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SIGNALVAR_H_ /* tmp for user.h */
|
||||
@ -55,15 +55,8 @@ struct sigacts {
|
||||
sigset_t ps_sigintr; /* signals that interrupt syscalls */
|
||||
sigset_t ps_sigreset; /* signals that reset when caught */
|
||||
sigset_t ps_signodefer; /* signals not masked while handled */
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
sigset_t ps_oldmask; /* saved mask from before sigpause */
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
int ps_flags; /* signal flags, below */
|
||||
struct sigaltstack ps_sigstk; /* sp & on stack state variable */
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
int ps_sig; /* for core dump/debugger XXX */
|
||||
u_long ps_code; /* for core dump/debugger XXX */
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
sigset_t ps_usertramp; /* SunOS compat; libc sigtramp XXX */
|
||||
};
|
||||
|
||||
@ -175,9 +168,7 @@ void psignal __P((struct proc *p, int sig));
|
||||
void sigexit __P((struct proc *p, int signum));
|
||||
void siginit __P((struct proc *p));
|
||||
void trapsignal __P((struct proc *p, int sig, u_long code));
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
void check_sigacts (void);
|
||||
#endif
|
||||
/*
|
||||
* Machine-dependent functions:
|
||||
*/
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)user.h 8.2 (Berkeley) 9/23/93
|
||||
* $Id: user.h,v 1.18 1999/01/07 21:23:47 julian Exp $
|
||||
* $Id: user.h,v 1.19 1999/01/13 03:11:42 julian Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_USER_H_
|
||||
@ -69,9 +69,7 @@ struct kinfo_proc {
|
||||
struct session *e_sess; /* session pointer */
|
||||
struct pcred e_pcred; /* process credentials */
|
||||
struct ucred e_ucred; /* current credentials */
|
||||
#ifdef COMPAT_LINUX_THREADS
|
||||
struct procsig e_procsig; /* shared signal structure */
|
||||
#endif
|
||||
struct vmspace e_vm; /* address space */
|
||||
pid_t e_ppid; /* parent process id */
|
||||
pid_t e_pgid; /* process group id */
|
||||
@ -128,13 +126,8 @@ struct user {
|
||||
#define U_tsize u_kproc.kp_eproc.e_vm.vm_tsize
|
||||
#define U_dsize u_kproc.kp_eproc.e_vm.vm_dsize
|
||||
#define U_ssize u_kproc.kp_eproc.e_vm.vm_ssize
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
#define U_sig u_sigacts.ps_sig
|
||||
#define U_code u_sigacts.ps_code
|
||||
#else
|
||||
#define U_sig u_kproc.kp_proc.p_sig
|
||||
#define U_code u_kproc.kp_proc.p_code
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
|
||||
#ifndef KERNEL
|
||||
#define u_ar0 U_ar0
|
||||
|
@ -59,7 +59,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: vm_glue.c,v 1.81 1999/01/21 08:29:10 dillon Exp $
|
||||
* $Id: vm_glue.c,v 1.82 1999/01/21 09:36:23 dillon Exp $
|
||||
*/
|
||||
|
||||
#include "opt_rlimit.h"
|
||||
@ -238,16 +238,6 @@ vm_fork(p1, p2, flags)
|
||||
|
||||
up = p2->p_addr;
|
||||
|
||||
#ifndef COMPAT_LINUX_THREADS
|
||||
/*
|
||||
* p_stats and p_sigacts currently point at fields in the user struct
|
||||
* but not at &u, instead at p_addr. Copy p_sigacts and parts of
|
||||
* p_stats; zero the rest of p_stats (statistics).
|
||||
*/
|
||||
p2->p_stats = &up->u_stats;
|
||||
p2->p_sigacts = &up->u_sigacts;
|
||||
up->u_sigacts = *p1->p_sigacts;
|
||||
#else
|
||||
/*
|
||||
* p_stats currently points at fields in the user struct
|
||||
* but not at &u, instead at p_addr. Copy parts of
|
||||
@ -263,7 +253,7 @@ vm_fork(p1, p2, flags)
|
||||
p2->p_sigacts = &up->u_sigacts;
|
||||
up->u_sigacts = *p1->p_sigacts;
|
||||
}
|
||||
#endif /* COMPAT_LINUX_THREADS */
|
||||
|
||||
bzero(&up->u_stats.pstat_startzero,
|
||||
(unsigned) ((caddr_t) &up->u_stats.pstat_endzero -
|
||||
(caddr_t) &up->u_stats.pstat_startzero));
|
||||
|
Loading…
x
Reference in New Issue
Block a user