linux_signal.c (70061) | linux_signal.c (72543) |
---|---|
1/*- 2 * Copyright (c) 1994-1995 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * | 1/*- 2 * Copyright (c) 1994-1995 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/compat/linux/linux_signal.c 70061 2000-12-15 19:41:27Z jhb $ | 28 * $FreeBSD: head/sys/compat/linux/linux_signal.c 72543 2001-02-16 16:40:43Z jlemon $ |
29 */ 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/sysproto.h> 34#include <sys/proc.h> 35#include <sys/signalvar.h> 36 --- 138 unchanged lines hidden (view full) --- 175#ifndef __alpha__ 176int 177linux_signal(struct proc *p, struct linux_signal_args *args) 178{ 179 linux_sigaction_t nsa, osa; 180 int error; 181 182#ifdef DEBUG | 29 */ 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/sysproto.h> 34#include <sys/proc.h> 35#include <sys/signalvar.h> 36 --- 138 unchanged lines hidden (view full) --- 175#ifndef __alpha__ 176int 177linux_signal(struct proc *p, struct linux_signal_args *args) 178{ 179 linux_sigaction_t nsa, osa; 180 int error; 181 182#ifdef DEBUG |
183 printf("Linux-emul(%ld): signal(%d, %p)\n", 184 (long)p->p_pid, args->sig, (void *)args->handler); | 183 if (ldebug(signal)) 184 printf(ARGS(signal, "%d, %p"), 185 args->sig, (void *)args->handler); |
185#endif 186 187 nsa.lsa_handler = args->handler; 188 nsa.lsa_flags = LINUX_SA_ONESHOT | LINUX_SA_NOMASK; 189 LINUX_SIGEMPTYSET(nsa.lsa_mask); 190 191 error = linux_do_sigaction(p, args->sig, &nsa, &osa); 192 p->p_retval[0] = (int)osa.lsa_handler; --- 4 unchanged lines hidden (view full) --- 197 198int 199linux_rt_sigaction(struct proc *p, struct linux_rt_sigaction_args *args) 200{ 201 linux_sigaction_t nsa, osa; 202 int error; 203 204#ifdef DEBUG | 186#endif 187 188 nsa.lsa_handler = args->handler; 189 nsa.lsa_flags = LINUX_SA_ONESHOT | LINUX_SA_NOMASK; 190 LINUX_SIGEMPTYSET(nsa.lsa_mask); 191 192 error = linux_do_sigaction(p, args->sig, &nsa, &osa); 193 p->p_retval[0] = (int)osa.lsa_handler; --- 4 unchanged lines hidden (view full) --- 198 199int 200linux_rt_sigaction(struct proc *p, struct linux_rt_sigaction_args *args) 201{ 202 linux_sigaction_t nsa, osa; 203 int error; 204 205#ifdef DEBUG |
205 printf("Linux-emul(%ld): rt_sigaction(%ld, %p, %p, %ld)\n", 206 (long)p->p_pid, (long)args->sig, (void *)args->act, 207 (void *)args->oact, (long)args->sigsetsize); | 206 if (ldebug(rt_sigaction)) 207 printf(ARGS(rt_sigaction, "%ld, %p, %p, %ld"), 208 (long)args->sig, (void *)args->act, 209 (void *)args->oact, (long)args->sigsetsize); |
208#endif 209 210 if (args->sigsetsize != sizeof(linux_sigset_t)) 211 return (EINVAL); 212 213 if (args->act != NULL) { 214 error = copyin(args->act, &nsa, sizeof(linux_sigaction_t)); 215 if (error) --- 54 unchanged lines hidden (view full) --- 270int 271linux_sigprocmask(struct proc *p, struct linux_sigprocmask_args *args) 272{ 273 linux_osigset_t mask; 274 linux_sigset_t set, oset; 275 int error; 276 277#ifdef DEBUG | 210#endif 211 212 if (args->sigsetsize != sizeof(linux_sigset_t)) 213 return (EINVAL); 214 215 if (args->act != NULL) { 216 error = copyin(args->act, &nsa, sizeof(linux_sigaction_t)); 217 if (error) --- 54 unchanged lines hidden (view full) --- 272int 273linux_sigprocmask(struct proc *p, struct linux_sigprocmask_args *args) 274{ 275 linux_osigset_t mask; 276 linux_sigset_t set, oset; 277 int error; 278 279#ifdef DEBUG |
278 printf("Linux-emul(%d): sigprocmask(%d, *, *)\n", p->p_pid, args->how); | 280 if (ldebug(sigprocmask)) 281 printf(ARGS(sigprocmask, "%d, *, *"), args->how); |
279#endif 280 281 if (args->mask != NULL) { 282 error = copyin(args->mask, &mask, sizeof(linux_osigset_t)); 283 if (error) 284 return (error); 285 LINUX_SIGEMPTYSET(set); 286 set.__bits[0] = mask; --- 14 unchanged lines hidden (view full) --- 301 302int 303linux_rt_sigprocmask(struct proc *p, struct linux_rt_sigprocmask_args *args) 304{ 305 linux_sigset_t set, oset; 306 int error; 307 308#ifdef DEBUG | 282#endif 283 284 if (args->mask != NULL) { 285 error = copyin(args->mask, &mask, sizeof(linux_osigset_t)); 286 if (error) 287 return (error); 288 LINUX_SIGEMPTYSET(set); 289 set.__bits[0] = mask; --- 14 unchanged lines hidden (view full) --- 304 305int 306linux_rt_sigprocmask(struct proc *p, struct linux_rt_sigprocmask_args *args) 307{ 308 linux_sigset_t set, oset; 309 int error; 310 311#ifdef DEBUG |
309 printf("Linux-emul(%ld): rt_sigprocmask(%d, %p, %p, %ld)\n", 310 (long)p->p_pid, args->how, (void *)args->mask, 311 (void *)args->omask, (long)args->sigsetsize); | 312 if (ldebug(rt_sigprocmask)) 313 printf(ARGS(rt_sigprocmask, "%d, %p, %p, %ld"), 314 args->how, (void *)args->mask, 315 (void *)args->omask, (long)args->sigsetsize); |
312#endif 313 314 if (args->sigsetsize != sizeof(linux_sigset_t)) 315 return EINVAL; 316 317 if (args->mask != NULL) { 318 error = copyin(args->mask, &set, sizeof(linux_sigset_t)); 319 if (error) --- 13 unchanged lines hidden (view full) --- 333 334#ifndef __alpha__ 335int 336linux_siggetmask(struct proc *p, struct linux_siggetmask_args *args) 337{ 338 linux_sigset_t mask; 339 340#ifdef DEBUG | 316#endif 317 318 if (args->sigsetsize != sizeof(linux_sigset_t)) 319 return EINVAL; 320 321 if (args->mask != NULL) { 322 error = copyin(args->mask, &set, sizeof(linux_sigset_t)); 323 if (error) --- 13 unchanged lines hidden (view full) --- 337 338#ifndef __alpha__ 339int 340linux_siggetmask(struct proc *p, struct linux_siggetmask_args *args) 341{ 342 linux_sigset_t mask; 343 344#ifdef DEBUG |
341 printf("Linux-emul(%d): siggetmask()\n", p->p_pid); | 345 if (ldebug(siggetmask)) 346 printf(ARGS(siggetmask, "")); |
342#endif 343 344 PROC_LOCK(p); 345 bsd_to_linux_sigset(&p->p_sigmask, &mask); 346 PROC_UNLOCK(p); 347 p->p_retval[0] = mask.__bits[0]; 348 return (0); 349} 350 351int 352linux_sigsetmask(struct proc *p, struct linux_sigsetmask_args *args) 353{ 354 linux_sigset_t lset; 355 sigset_t bset; 356 357#ifdef DEBUG | 347#endif 348 349 PROC_LOCK(p); 350 bsd_to_linux_sigset(&p->p_sigmask, &mask); 351 PROC_UNLOCK(p); 352 p->p_retval[0] = mask.__bits[0]; 353 return (0); 354} 355 356int 357linux_sigsetmask(struct proc *p, struct linux_sigsetmask_args *args) 358{ 359 linux_sigset_t lset; 360 sigset_t bset; 361 362#ifdef DEBUG |
358 printf("Linux-emul(%ld): sigsetmask(%08lx)\n", 359 (long)p->p_pid, (unsigned long)args->mask); | 363 if (ldebug(sigsetmask)) 364 printf(ARGS(sigsetmask, "%08lx"), (unsigned long)args->mask); |
360#endif 361 362 PROC_LOCK(p); 363 bsd_to_linux_sigset(&p->p_sigmask, &lset); 364 p->p_retval[0] = lset.__bits[0]; 365 LINUX_SIGEMPTYSET(lset); 366 lset.__bits[0] = args->mask; 367 linux_to_bsd_sigset(&lset, &bset); --- 6 unchanged lines hidden (view full) --- 374int 375linux_sigpending(struct proc *p, struct linux_sigpending_args *args) 376{ 377 sigset_t bset; 378 linux_sigset_t lset; 379 linux_osigset_t mask; 380 381#ifdef DEBUG | 365#endif 366 367 PROC_LOCK(p); 368 bsd_to_linux_sigset(&p->p_sigmask, &lset); 369 p->p_retval[0] = lset.__bits[0]; 370 LINUX_SIGEMPTYSET(lset); 371 lset.__bits[0] = args->mask; 372 linux_to_bsd_sigset(&lset, &bset); --- 6 unchanged lines hidden (view full) --- 379int 380linux_sigpending(struct proc *p, struct linux_sigpending_args *args) 381{ 382 sigset_t bset; 383 linux_sigset_t lset; 384 linux_osigset_t mask; 385 386#ifdef DEBUG |
382 printf("Linux-emul(%d): sigpending(*)\n", p->p_pid); | 387 if (ldebug(sigpending)) 388 printf(ARGS(sigpending, "*")); |
383#endif 384 385 PROC_LOCK(p); 386 bset = p->p_siglist; 387 SIGSETAND(bset, p->p_sigmask); 388 bsd_to_linux_sigset(&bset, &lset); 389 PROC_UNLOCK(p); 390 mask = lset.__bits[0]; --- 5 unchanged lines hidden (view full) --- 396linux_kill(struct proc *p, struct linux_kill_args *args) 397{ 398 struct kill_args /* { 399 int pid; 400 int signum; 401 } */ tmp; 402 403#ifdef DEBUG | 389#endif 390 391 PROC_LOCK(p); 392 bset = p->p_siglist; 393 SIGSETAND(bset, p->p_sigmask); 394 bsd_to_linux_sigset(&bset, &lset); 395 PROC_UNLOCK(p); 396 mask = lset.__bits[0]; --- 5 unchanged lines hidden (view full) --- 402linux_kill(struct proc *p, struct linux_kill_args *args) 403{ 404 struct kill_args /* { 405 int pid; 406 int signum; 407 } */ tmp; 408 409#ifdef DEBUG |
404 printf("Linux-emul(%d): kill(%d, %d)\n", 405 p->p_pid, args->pid, args->signum); | 410 if (ldebug(kill)) 411 printf(ARGS(kill, "%d, %d"), args->pid, args->signum); |
406#endif 407 408 /* 409 * Allow signal 0 as a means to check for privileges 410 */ 411 if (args->signum < 0 || args->signum > LINUX_NSIG) 412 return EINVAL; 413 414#ifndef __alpha__ 415 if (args->signum > 0 && args->signum <= LINUX_SIGTBLSZ) 416 tmp.signum = linux_to_bsd_signal[_SIG_IDX(args->signum)]; 417 else 418#endif 419 tmp.signum = args->signum; 420 421 tmp.pid = args->pid; 422 return (kill(p, &tmp)); 423} | 412#endif 413 414 /* 415 * Allow signal 0 as a means to check for privileges 416 */ 417 if (args->signum < 0 || args->signum > LINUX_NSIG) 418 return EINVAL; 419 420#ifndef __alpha__ 421 if (args->signum > 0 && args->signum <= LINUX_SIGTBLSZ) 422 tmp.signum = linux_to_bsd_signal[_SIG_IDX(args->signum)]; 423 else 424#endif 425 tmp.signum = args->signum; 426 427 tmp.pid = args->pid; 428 return (kill(p, &tmp)); 429} |