Date: Sun, 18 Aug 2002 21:35:58 -0700 (PDT) From: Jonathan Mini <mini@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 16244 for review Message-ID: <200208190435.g7J4ZwHe076451@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=16244 Change 16244 by mini@mini_stylus on 2002/08/18 21:35:41 Add function thread_setcontext(), which does the same thing as setcontext(3) in userland, but from the kernel. This is also Dan's code. Affected files ... .. //depot/projects/kse/sys/kern/kern_thread.c#85 edit .. //depot/projects/kse/sys/sys/kse.h#15 edit .. //depot/projects/kse/sys/sys/proc.h#121 edit Differences ... ==== //depot/projects/kse/sys/kern/kern_thread.c#85 (text+ko) ==== @@ -44,6 +44,7 @@ #include <sys/jail.h> #include <sys/kse.h> #include <sys/ktr.h> +#include <sys/ucontext.h> #include <vm/vm.h> #include <vm/vm_object.h> @@ -189,6 +190,21 @@ allocated_threads--; /* XXXSMP */ } +int +thread_setcontext(struct thread *td, ucontext_t *uc) +{ + int ret; + + ret = set_mcontext(td, &uc->uc_mcontext); + if (ret == 0) { + SIG_CANTMASK(uc->uc_sigmask); + PROC_LOCK(td->td_proc); + td->td_proc->p_sigmask = uc->uc_sigmask; + PROC_UNLOCK(td->td_proc); + } + return (ret); +} + /* * Initialize global thread allocation resources. */ ==== //depot/projects/kse/sys/sys/kse.h#15 (text+ko) ==== @@ -33,6 +33,7 @@ #ifndef SYS_KSE_H #define SYS_KSE_H #include <machine/kse.h> +#include <sys/ucontext.h> /* * This file defines the structures needed for communication between * the userland and the kernel when running a KSE-based threading system. @@ -75,4 +76,8 @@ }; #define GMBXF_CRITICAL 0x00000001 +#ifdef _KERNEL +int thread_setcontext(struct thread *td, ucontext_t *uc); +#endif /* _KERNEL */ + #endif ==== //depot/projects/kse/sys/sys/proc.h#121 (text+ko) ==== To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208190435.g7J4ZwHe076451>