Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109967358
D22645.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D22645.diff
View Options
Index: head/sys/compat/linux/linux_signal.c
===================================================================
--- head/sys/compat/linux/linux_signal.c
+++ head/sys/compat/linux/linux_signal.c
@@ -415,10 +415,7 @@
int
linux_kill(struct thread *td, struct linux_kill_args *args)
{
- struct kill_args /* {
- int pid;
- int signum;
- } */ tmp;
+ int l_signum;
/*
* Allow signal 0 as a means to check for privileges
@@ -427,12 +424,11 @@
return (EINVAL);
if (args->signum > 0)
- tmp.signum = linux_to_bsd_signal(args->signum);
+ l_signum = linux_to_bsd_signal(args->signum);
else
- tmp.signum = 0;
+ l_signum = 0;
- tmp.pid = args->pid;
- return (sys_kill(td, &tmp));
+ return (kern_kill(td, args->pid, l_signum));
}
static int
Index: head/sys/kern/kern_sig.c
===================================================================
--- head/sys/kern/kern_sig.c
+++ head/sys/kern/kern_sig.c
@@ -1772,6 +1772,13 @@
int
sys_kill(struct thread *td, struct kill_args *uap)
{
+
+ return (kern_kill(td, uap->pid, uap->signum));
+}
+
+int
+kern_kill(struct thread *td, pid_t pid, int signum)
+{
ksiginfo_t ksi;
struct proc *p;
int error;
@@ -1781,38 +1788,38 @@
* The main rationale behind this is that abort(3) is implemented as
* kill(getpid(), SIGABRT).
*/
- if (IN_CAPABILITY_MODE(td) && uap->pid != td->td_proc->p_pid)
+ if (IN_CAPABILITY_MODE(td) && pid != td->td_proc->p_pid)
return (ECAPMODE);
- AUDIT_ARG_SIGNUM(uap->signum);
- AUDIT_ARG_PID(uap->pid);
- if ((u_int)uap->signum > _SIG_MAXSIG)
+ AUDIT_ARG_SIGNUM(signum);
+ AUDIT_ARG_PID(pid);
+ if ((u_int)signum > _SIG_MAXSIG)
return (EINVAL);
ksiginfo_init(&ksi);
- ksi.ksi_signo = uap->signum;
+ ksi.ksi_signo = signum;
ksi.ksi_code = SI_USER;
ksi.ksi_pid = td->td_proc->p_pid;
ksi.ksi_uid = td->td_ucred->cr_ruid;
- if (uap->pid > 0) {
+ if (pid > 0) {
/* kill single process */
- if ((p = pfind_any(uap->pid)) == NULL)
+ if ((p = pfind_any(pid)) == NULL)
return (ESRCH);
AUDIT_ARG_PROCESS(p);
- error = p_cansignal(td, p, uap->signum);
- if (error == 0 && uap->signum)
- pksignal(p, uap->signum, &ksi);
+ error = p_cansignal(td, p, signum);
+ if (error == 0 && signum)
+ pksignal(p, signum, &ksi);
PROC_UNLOCK(p);
return (error);
}
- switch (uap->pid) {
+ switch (pid) {
case -1: /* broadcast signal */
- return (killpg1(td, uap->signum, 0, 1, &ksi));
+ return (killpg1(td, signum, 0, 1, &ksi));
case 0: /* signal own process group */
- return (killpg1(td, uap->signum, 0, 0, &ksi));
+ return (killpg1(td, signum, 0, 0, &ksi));
default: /* negative explicit process group */
- return (killpg1(td, uap->signum, -uap->pid, 0, &ksi));
+ return (killpg1(td, signum, -pid, 0, &ksi));
}
/* NOTREACHED */
}
Index: head/sys/sys/syscallsubr.h
===================================================================
--- head/sys/sys/syscallsubr.h
+++ head/sys/sys/syscallsubr.h
@@ -156,6 +156,7 @@
int kern_kevent_fp(struct thread *td, struct file *fp, int nchanges,
int nevents, struct kevent_copyops *k_ops,
const struct timespec *timeout);
+int kern_kill(struct thread *td, pid_t pid, int signum);
int kern_kqueue(struct thread *td, int flags, struct filecaps *fcaps);
int kern_kldload(struct thread *td, const char *file, int *fileid);
int kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 12, 8:56 PM (19 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16616273
Default Alt Text
D22645.diff (3 KB)
Attached To
Mode
D22645: Add kern_kill(), use in Linuxulator
Attached
Detach File
Event Timeline
Log In to Comment