linux_signal.c (1a180032407ba2dabd02e39c508fe232a9ef66ba) linux_signal.c (0f8dab45404f347752470579feccc6d2739b9570)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 1994-1995 Søren Schmidt
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 37 unchanged lines hidden (view full) ---

46#ifdef COMPAT_LINUX32
47#include <machine/../linux32/linux.h>
48#include <machine/../linux32/linux32_proto.h>
49#else
50#include <machine/../linux/linux.h>
51#include <machine/../linux/linux_proto.h>
52#endif
53#include <compat/linux/linux_signal.h>
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 1994-1995 Søren Schmidt
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 37 unchanged lines hidden (view full) ---

46#ifdef COMPAT_LINUX32
47#include <machine/../linux32/linux.h>
48#include <machine/../linux32/linux32_proto.h>
49#else
50#include <machine/../linux/linux.h>
51#include <machine/../linux/linux_proto.h>
52#endif
53#include <compat/linux/linux_signal.h>
54#include <compat/linux/linux_timer.h>
54#include <compat/linux/linux_util.h>
55#include <compat/linux/linux_emul.h>
56#include <compat/linux/linux_misc.h>
57
58static int linux_do_tkill(struct thread *td, struct thread *tdt,
59 ksiginfo_t *ksi);
60static void sicode_to_lsicode(int si_code, int *lsi_code);
61

--- 325 unchanged lines hidden (view full) ---

387/*
388 * MPSAFE
389 */
390int
391linux_rt_sigtimedwait(struct thread *td,
392 struct linux_rt_sigtimedwait_args *args)
393{
394 int error, sig;
55#include <compat/linux/linux_util.h>
56#include <compat/linux/linux_emul.h>
57#include <compat/linux/linux_misc.h>
58
59static int linux_do_tkill(struct thread *td, struct thread *tdt,
60 ksiginfo_t *ksi);
61static void sicode_to_lsicode(int si_code, int *lsi_code);
62

--- 325 unchanged lines hidden (view full) ---

388/*
389 * MPSAFE
390 */
391int
392linux_rt_sigtimedwait(struct thread *td,
393 struct linux_rt_sigtimedwait_args *args)
394{
395 int error, sig;
395 l_timeval ltv;
396 struct timeval tv;
397 struct timespec ts, *tsa;
396 struct timespec ts, *tsa;
397 struct l_timespec lts;
398 l_sigset_t lset;
399 sigset_t bset;
400 l_siginfo_t linfo;
401 ksiginfo_t info;
402
403 if (args->sigsetsize != sizeof(l_sigset_t))
404 return (EINVAL);
405
406 if ((error = copyin(args->mask, &lset, sizeof(lset))))
407 return (error);
408 linux_to_bsd_sigset(&lset, &bset);
409
410 tsa = NULL;
411 if (args->timeout) {
398 l_sigset_t lset;
399 sigset_t bset;
400 l_siginfo_t linfo;
401 ksiginfo_t info;
402
403 if (args->sigsetsize != sizeof(l_sigset_t))
404 return (EINVAL);
405
406 if ((error = copyin(args->mask, &lset, sizeof(lset))))
407 return (error);
408 linux_to_bsd_sigset(&lset, &bset);
409
410 tsa = NULL;
411 if (args->timeout) {
412 if ((error = copyin(args->timeout, &ltv, sizeof(ltv))))
412 if ((error = copyin(args->timeout, &lts, sizeof(lts))))
413 return (error);
413 return (error);
414 tv.tv_sec = (long)ltv.tv_sec;
415 tv.tv_usec = (suseconds_t)ltv.tv_usec;
416 if (itimerfix(&tv)) {
417 /*
418 * The timeout was invalid. Convert it to something
419 * valid that will act as it does under Linux.
420 */
421 tv.tv_sec += tv.tv_usec / 1000000;
422 tv.tv_usec %= 1000000;
423 if (tv.tv_usec < 0) {
424 tv.tv_sec -= 1;
425 tv.tv_usec += 1000000;
426 }
427 if (tv.tv_sec < 0)
428 timevalclear(&tv);
429 }
430 TIMEVAL_TO_TIMESPEC(&tv, &ts);
414 error = linux_to_native_timespec(&ts, &lts);
415 if (error != 0)
416 return (error);
431 tsa = &ts;
417 tsa = &ts;
432 }
418 } else
419 tsa = NULL;
420
433 error = kern_sigtimedwait(td, bset, &info, tsa);
434 if (error)
435 return (error);
436
437 sig = bsd_to_linux_signal(info.ksi_signo);
438
439 if (args->ptr) {
440 memset(&linfo, 0, sizeof(linfo));

--- 304 unchanged lines hidden ---
421 error = kern_sigtimedwait(td, bset, &info, tsa);
422 if (error)
423 return (error);
424
425 sig = bsd_to_linux_signal(info.ksi_signo);
426
427 if (args->ptr) {
428 memset(&linfo, 0, sizeof(linfo));

--- 304 unchanged lines hidden ---