equal
deleted
inserted
replaced
29 #include "utilities/globalDefinitions.hpp" |
29 #include "utilities/globalDefinitions.hpp" |
30 #include "runtime/frame.inline.hpp" |
30 #include "runtime/frame.inline.hpp" |
31 #include "runtime/interfaceSupport.inline.hpp" |
31 #include "runtime/interfaceSupport.inline.hpp" |
32 #include "services/memTracker.hpp" |
32 #include "services/memTracker.hpp" |
33 #include "utilities/align.hpp" |
33 #include "utilities/align.hpp" |
|
34 #include "utilities/events.hpp" |
34 #include "utilities/formatBuffer.hpp" |
35 #include "utilities/formatBuffer.hpp" |
35 #include "utilities/macros.hpp" |
36 #include "utilities/macros.hpp" |
36 #include "utilities/vmError.hpp" |
37 #include "utilities/vmError.hpp" |
37 |
38 |
38 #include <dirent.h> |
39 #include <dirent.h> |
1267 out->s_desc = s_desc; |
1268 out->s_desc = s_desc; |
1268 |
1269 |
1269 return true; |
1270 return true; |
1270 } |
1271 } |
1271 |
1272 |
|
1273 bool os::signal_sent_by_kill(const void* siginfo) { |
|
1274 const siginfo_t* const si = (const siginfo_t*)siginfo; |
|
1275 return si->si_code == SI_USER || si->si_code == SI_QUEUE |
|
1276 #ifdef SI_TKILL |
|
1277 || si->si_code == SI_TKILL |
|
1278 #endif |
|
1279 ; |
|
1280 } |
|
1281 |
1272 void os::print_siginfo(outputStream* os, const void* si0) { |
1282 void os::print_siginfo(outputStream* os, const void* si0) { |
1273 |
1283 |
1274 const siginfo_t* const si = (const siginfo_t*) si0; |
1284 const siginfo_t* const si = (const siginfo_t*) si0; |
1275 |
1285 |
1276 char buf[20]; |
1286 char buf[20]; |
1297 |
1307 |
1298 // Note: Many implementations lump si_addr, si_pid, si_uid etc. together as unions, |
1308 // Note: Many implementations lump si_addr, si_pid, si_uid etc. together as unions, |
1299 // so it depends on the context which member to use. For synchronous error signals, |
1309 // so it depends on the context which member to use. For synchronous error signals, |
1300 // we print si_addr, unless the signal was sent by another process or thread, in |
1310 // we print si_addr, unless the signal was sent by another process or thread, in |
1301 // which case we print out pid or tid of the sender. |
1311 // which case we print out pid or tid of the sender. |
1302 if (si->si_code == SI_USER || si->si_code == SI_QUEUE) { |
1312 if (signal_sent_by_kill(si)) { |
1303 const pid_t pid = si->si_pid; |
1313 const pid_t pid = si->si_pid; |
1304 os->print(", si_pid: %ld", (long) pid); |
1314 os->print(", si_pid: %ld", (long) pid); |
1305 if (IS_VALID_PID(pid)) { |
1315 if (IS_VALID_PID(pid)) { |
1306 const pid_t me = getpid(); |
1316 const pid_t me = getpid(); |
1307 if (me == pid) { |
1317 if (me == pid) { |
1321 } else if (sig == SIGPOLL) { |
1331 } else if (sig == SIGPOLL) { |
1322 os->print(", si_band: %ld", si->si_band); |
1332 os->print(", si_band: %ld", si->si_band); |
1323 #endif |
1333 #endif |
1324 } |
1334 } |
1325 |
1335 |
|
1336 } |
|
1337 |
|
1338 bool os::signal_thread(Thread* thread, int sig, const char* reason) { |
|
1339 OSThread* osthread = thread->osthread(); |
|
1340 if (osthread) { |
|
1341 #if defined (SOLARIS) |
|
1342 // Note: we cannot use pthread_kill on Solaris - not because |
|
1343 // its missing, but because we do not have the pthread_t id. |
|
1344 int status = thr_kill(osthread->thread_id(), sig); |
|
1345 #else |
|
1346 int status = pthread_kill(osthread->pthread_id(), sig); |
|
1347 #endif |
|
1348 if (status == 0) { |
|
1349 Events::log(Thread::current(), "sent signal %d to Thread " INTPTR_FORMAT " because %s.", |
|
1350 sig, p2i(thread), reason); |
|
1351 return true; |
|
1352 } |
|
1353 } |
|
1354 return false; |
1326 } |
1355 } |
1327 |
1356 |
1328 int os::Posix::unblock_thread_signal_mask(const sigset_t *set) { |
1357 int os::Posix::unblock_thread_signal_mask(const sigset_t *set) { |
1329 return pthread_sigmask(SIG_UNBLOCK, set, NULL); |
1358 return pthread_sigmask(SIG_UNBLOCK, set, NULL); |
1330 } |
1359 } |