Use pthread_kill() in raise()
raise() should use pthread_kill() in a pthreads environment. For bionic this means it should always be used. Change-Id: Ic679272b664d2b8a7068b628fb83a9f7395c441f
This commit is contained in:
parent
6fcf1770e5
commit
d8a5a6f513
@ -199,7 +199,6 @@ libc_common_src_files := \
|
|||||||
bionic/ptsname_r.c \
|
bionic/ptsname_r.c \
|
||||||
bionic/pututline.c \
|
bionic/pututline.c \
|
||||||
bionic/pwrite.c \
|
bionic/pwrite.c \
|
||||||
bionic/raise.c \
|
|
||||||
bionic/realpath.c \
|
bionic/realpath.c \
|
||||||
bionic/reboot.c \
|
bionic/reboot.c \
|
||||||
bionic/recv.c \
|
bionic/recv.c \
|
||||||
@ -282,6 +281,7 @@ libc_bionic_src_files := \
|
|||||||
bionic/__memcpy_chk.cpp \
|
bionic/__memcpy_chk.cpp \
|
||||||
bionic/__memmove_chk.cpp \
|
bionic/__memmove_chk.cpp \
|
||||||
bionic/__memset_chk.cpp \
|
bionic/__memset_chk.cpp \
|
||||||
|
bionic/raise.cpp \
|
||||||
bionic/__set_errno.cpp \
|
bionic/__set_errno.cpp \
|
||||||
bionic/setlocale.cpp \
|
bionic/setlocale.cpp \
|
||||||
bionic/__strcat_chk.cpp \
|
bionic/__strcat_chk.cpp \
|
||||||
|
@ -25,10 +25,14 @@
|
|||||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#include <unistd.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
int raise(int signum)
|
#include <pthread.h>
|
||||||
{
|
|
||||||
return kill(gettid(), signum);
|
int raise(int sig) {
|
||||||
|
int rc = pthread_kill(pthread_self(), sig);
|
||||||
|
if (rc != 0) {
|
||||||
|
errno = rc;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
@ -95,3 +95,9 @@ TEST(signal, sigemptyset_invalid) {
|
|||||||
TEST(signal, sigfillset_invalid) {
|
TEST(signal, sigfillset_invalid) {
|
||||||
TestSigSet1(sigfillset);
|
TestSigSet1(sigfillset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(signal, raise_invalid) {
|
||||||
|
errno = 0;
|
||||||
|
ASSERT_EQ(-1, raise(-1));
|
||||||
|
ASSERT_EQ(EINVAL, errno);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user