am f822e7f6: am 0521ff82: Merge "Use pthread_kill() in raise()"

* commit 'f822e7f68eec30bb175ccb46cd379f4a060b6c74':
  Use pthread_kill() in raise()
This commit is contained in:
Elliott Hughes 2012-12-10 11:42:06 -08:00 committed by Android Git Automerger
commit 42d7a26d23
3 changed files with 16 additions and 6 deletions

View File

@ -199,7 +199,6 @@ libc_common_src_files := \
bionic/ptsname_r.c \
bionic/pututline.c \
bionic/pwrite.c \
bionic/raise.c \
bionic/realpath.c \
bionic/reboot.c \
bionic/recv.c \
@ -282,6 +281,7 @@ libc_bionic_src_files := \
bionic/__memcpy_chk.cpp \
bionic/__memmove_chk.cpp \
bionic/__memset_chk.cpp \
bionic/raise.cpp \
bionic/__set_errno.cpp \
bionic/setlocale.cpp \
bionic/__strcat_chk.cpp \

View File

@ -25,10 +25,14 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <unistd.h>
#include <signal.h>
int raise(int signum)
{
return kill(gettid(), signum);
#include <pthread.h>
int raise(int sig) {
int rc = pthread_kill(pthread_self(), sig);
if (rc != 0) {
errno = rc;
return -1;
}
return 0;
}

View File

@ -95,3 +95,9 @@ TEST(signal, sigemptyset_invalid) {
TEST(signal, sigfillset_invalid) {
TestSigSet1(sigfillset);
}
TEST(signal, raise_invalid) {
errno = 0;
ASSERT_EQ(-1, raise(-1));
ASSERT_EQ(EINVAL, errno);
}