forked from Imagelibrary/binutils-gdb
gdb/
* linux-nat.c (kill_lwp): Minor cleanup, move definition of tkill_failed into ifdef HAVE_TKILL_SYSCALL. Move setting of errno there too. Delete unnecessary resetting of errno after syscall. Minor comment changes to match gdbserver/linux-low.c:kill_lwp. gdbserver/ * linux-low.c (kill_lwp): Use __NR_tkill instead of SYS_tkill. Move definition of tkill_failed to ifdef __NR_tkill to avoid gcc warning ifndef __NR_tkill. Move setting of errno there too. Delete unnecessary resetting of errno after syscall. Minor comment changes to match gdb/linux-nat.c:kill_lwp.
This commit is contained in:
@@ -1572,25 +1572,29 @@ linux_wait (ptid_t ptid,
|
||||
return event_ptid;
|
||||
}
|
||||
|
||||
/* Send a signal to an LWP. For LinuxThreads, kill is enough; however, if
|
||||
thread groups are in use, we need to use tkill. */
|
||||
/* Send a signal to an LWP. */
|
||||
|
||||
static int
|
||||
kill_lwp (unsigned long lwpid, int signo)
|
||||
{
|
||||
static int tkill_failed;
|
||||
/* Use tkill, if possible, in case we are using nptl threads. If tkill
|
||||
fails, then we are not using nptl threads and we should be using kill. */
|
||||
|
||||
errno = 0;
|
||||
#ifdef __NR_tkill
|
||||
{
|
||||
static int tkill_failed;
|
||||
|
||||
#ifdef SYS_tkill
|
||||
if (!tkill_failed)
|
||||
{
|
||||
int ret = syscall (SYS_tkill, lwpid, signo);
|
||||
if (errno != ENOSYS)
|
||||
return ret;
|
||||
errno = 0;
|
||||
tkill_failed = 1;
|
||||
}
|
||||
if (!tkill_failed)
|
||||
{
|
||||
int ret;
|
||||
|
||||
errno = 0;
|
||||
ret = syscall (__NR_tkill, lwpid, signo);
|
||||
if (errno != ENOSYS)
|
||||
return ret;
|
||||
tkill_failed = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return kill (lwpid, signo);
|
||||
|
||||
Reference in New Issue
Block a user