|
Packit Service |
82fcde |
/* raise.c - Generic raise implementation.
|
|
Packit Service |
82fcde |
Copyright (C) 2008-2018 Free Software Foundation, Inc.
|
|
Packit Service |
82fcde |
Written by Neal H. Walfield <neal@gnu.org>.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
This file is part of the GNU Hurd.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU Hurd is free software; you can redistribute it and/or
|
|
Packit Service |
82fcde |
modify it under the terms of the GNU Lesser General Public License
|
|
Packit Service |
82fcde |
as published by the Free Software Foundation; either version 3 of
|
|
Packit Service |
82fcde |
the License, or (at your option) any later version.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU Hurd is distributed in the hope that it will be useful, but
|
|
Packit Service |
82fcde |
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
82fcde |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
82fcde |
Lesser General Public License for more details.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License along with this program. If not, see
|
|
Packit Service |
82fcde |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <pthreadP.h>
|
|
Packit Service |
82fcde |
#include <signal.h>
|
|
Packit Service |
82fcde |
#include <unistd.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#pragma weak __pthread_kill
|
|
Packit Service |
82fcde |
#pragma weak __pthread_self
|
|
Packit Service |
82fcde |
#pragma weak __pthread_threads
|
|
Packit Service |
82fcde |
int
|
|
Packit Service |
82fcde |
raise (int signo)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
/* According to POSIX, if we implement threads (and we do), then
|
|
Packit Service |
82fcde |
"the effect of the raise() function shall be equivalent to
|
|
Packit Service |
82fcde |
calling: pthread_kill(pthread_self(), sig);" */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
if (__pthread_kill != NULL && __pthread_threads != NULL)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
int err;
|
|
Packit Service |
82fcde |
err = __pthread_kill (__pthread_self (), signo);
|
|
Packit Service |
82fcde |
if (err)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
errno = err;
|
|
Packit Service |
82fcde |
return -1;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
return 0;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
else
|
|
Packit Service |
82fcde |
return __kill (__getpid (), signo);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
libc_hidden_def (raise)
|
|
Packit Service |
82fcde |
weak_alias (raise, gsignal)
|