Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Commit 655bdae

Browse files
committed
update for comments
1 parent 1e7279d commit 655bdae

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/signalhandler.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@
5353
# include <sys/ucontext.h>
5454
#endif
5555
#ifdef HAVE_UNISTD_H
56+
# include <unistd.h>
57+
#endif
58+
#if defined (HAVE_SYS_SYSCALL_H) && defined (HAVE_SYS_TYPES_H)
5659
# include <sys/syscall.h>
5760
# include <sys/types.h>
58-
# include <unistd.h>
5961
#endif
6062

6163
namespace google {
@@ -218,16 +220,15 @@ void DumpSignalInfo(int signal_number, siginfo_t* siginfo) {
218220
std::ostringstream oss;
219221
oss << std::showbase << std::hex << std::this_thread::get_id();
220222
formatter.AppendString(oss.str().c_str());
221-
222-
formatter.AppendString(") ");
223-
224-
// Only linux has the PID of the signal sender in si_pid.
225-
# ifdef GLOG_OS_LINUX
223+
#if defined (GLOG_OS_LINUX) && defined (HAVE_SYS_SYSCALL_H) && defined (HAVE_SYS_TYPES_H)
226224
pid_t tid = syscall(SYS_gettid);
227-
formatter.AppendString("(LWP ");
225+
formatter.AppendString(" LWP ");
228226
formatter.AppendUint64(tid, 10);
227+
# endif
229228
formatter.AppendString(") ");
230229

230+
// Only linux has the PID of the signal sender in si_pid.
231+
# ifdef GLOG_OS_LINUX
231232
formatter.AppendString("from PID ");
232233
formatter.AppendUint64(static_cast<uint64>(siginfo->si_pid), 10);
233234
formatter.AppendString("; ");

0 commit comments

Comments
 (0)