358 static void free_thread(OSThread* osthread); |
358 static void free_thread(OSThread* osthread); |
359 |
359 |
360 // thread id on Linux/64bit is 64bit, on Windows and Solaris, it's 32bit |
360 // thread id on Linux/64bit is 64bit, on Windows and Solaris, it's 32bit |
361 static intx current_thread_id(); |
361 static intx current_thread_id(); |
362 static int current_process_id(); |
362 static int current_process_id(); |
363 // hpi::read for calls from non native state |
|
364 // For performance, hpi::read is only callable from _thread_in_native |
|
365 static size_t read(int fd, void *buf, unsigned int nBytes); |
|
366 static int sleep(Thread* thread, jlong ms, bool interruptable); |
363 static int sleep(Thread* thread, jlong ms, bool interruptable); |
367 static int naked_sleep(); |
364 static int naked_sleep(); |
368 static void infinite_sleep(); // never returns, use with CAUTION |
365 static void infinite_sleep(); // never returns, use with CAUTION |
369 static void yield(); // Yields to all threads with same priority |
366 static void yield(); // Yields to all threads with same priority |
370 enum YieldResult { |
367 enum YieldResult { |
416 static void abort(bool dump_core = true); |
413 static void abort(bool dump_core = true); |
417 |
414 |
418 // Die immediately, no exit hook, no abort hook, no cleanup. |
415 // Die immediately, no exit hook, no abort hook, no cleanup. |
419 static void die(); |
416 static void die(); |
420 |
417 |
|
418 // File i/o operations |
|
419 static const int default_file_open_flags(); |
|
420 static int open(const char *path, int oflag, int mode); |
|
421 static int close(int fd); |
|
422 static jlong lseek(int fd, jlong offset, int whence); |
|
423 static char* native_path(char *path); |
|
424 static int ftruncate(int fd, jlong length); |
|
425 static int fsync(int fd); |
|
426 static int available(int fd, jlong *bytes); |
|
427 |
|
428 //File i/o operations |
|
429 |
|
430 static size_t read(int fd, void *buf, unsigned int nBytes); |
|
431 static size_t restartable_read(int fd, void *buf, unsigned int nBytes); |
|
432 static size_t write(int fd, const void *buf, unsigned int nBytes); |
|
433 |
421 // Reading directories. |
434 // Reading directories. |
422 static DIR* opendir(const char* dirname); |
435 static DIR* opendir(const char* dirname); |
423 static int readdir_buf_size(const char *path); |
436 static int readdir_buf_size(const char *path); |
424 static struct dirent* readdir(DIR* dirp, dirent* dbuf); |
437 static struct dirent* readdir(DIR* dirp, dirent* dbuf); |
425 static int closedir(DIR* dirp); |
438 static int closedir(DIR* dirp); |
457 // same architecture as Hotspot is running on |
470 // same architecture as Hotspot is running on |
458 static void* dll_load(const char *name, char *ebuf, int ebuflen); |
471 static void* dll_load(const char *name, char *ebuf, int ebuflen); |
459 |
472 |
460 // lookup symbol in a shared library |
473 // lookup symbol in a shared library |
461 static void* dll_lookup(void* handle, const char* name); |
474 static void* dll_lookup(void* handle, const char* name); |
|
475 |
|
476 // Unload library |
|
477 static void dll_unload(void *lib); |
462 |
478 |
463 // Print out system information; they are called by fatal error handler. |
479 // Print out system information; they are called by fatal error handler. |
464 // Output format may be different on different platforms. |
480 // Output format may be different on different platforms. |
465 static void print_os_info(outputStream* st); |
481 static void print_os_info(outputStream* st); |
466 static void print_cpu_info(outputStream* st); |
482 static void print_cpu_info(outputStream* st); |
472 static void print_siginfo(outputStream* st, void* siginfo); |
488 static void print_siginfo(outputStream* st, void* siginfo); |
473 static void print_signal_handlers(outputStream* st, char* buf, size_t buflen); |
489 static void print_signal_handlers(outputStream* st, char* buf, size_t buflen); |
474 static void print_date_and_time(outputStream* st); |
490 static void print_date_and_time(outputStream* st); |
475 |
491 |
476 static void print_location(outputStream* st, intptr_t x, bool verbose = false); |
492 static void print_location(outputStream* st, intptr_t x, bool verbose = false); |
|
493 static size_t lasterror(char *buf, size_t len); |
477 |
494 |
478 // The following two functions are used by fatal error handler to trace |
495 // The following two functions are used by fatal error handler to trace |
479 // native (C) frames. They are not part of frame.hpp/frame.cpp because |
496 // native (C) frames. They are not part of frame.hpp/frame.cpp because |
480 // frame.hpp/cpp assume thread is JavaThread, and also because different |
497 // frame.hpp/cpp assume thread is JavaThread, and also because different |
481 // OS/compiler may have different convention or provide different API to |
498 // OS/compiler may have different convention or provide different API to |
499 static const char* exception_name(int exception_code, char* buf, size_t buflen); |
516 static const char* exception_name(int exception_code, char* buf, size_t buflen); |
500 |
517 |
501 // Returns native Java library, loads if necessary |
518 // Returns native Java library, loads if necessary |
502 static void* native_java_library(); |
519 static void* native_java_library(); |
503 |
520 |
504 // Fills in path to jvm.dll/libjvm.so (this info used to find hpi). |
521 // Fills in path to jvm.dll/libjvm.so (used by the Disassembler) |
505 static void jvm_path(char *buf, jint buflen); |
522 static void jvm_path(char *buf, jint buflen); |
506 |
523 |
507 // Returns true if we are running in a headless jre. |
524 // Returns true if we are running in a headless jre. |
508 static bool is_headless_jre(); |
525 static bool is_headless_jre(); |
509 |
526 |
544 #ifndef PRODUCT |
561 #ifndef PRODUCT |
545 static int num_mallocs; // # of calls to malloc/realloc |
562 static int num_mallocs; // # of calls to malloc/realloc |
546 static size_t alloc_bytes; // # of bytes allocated |
563 static size_t alloc_bytes; // # of bytes allocated |
547 static int num_frees; // # of calls to free |
564 static int num_frees; // # of calls to free |
548 #endif |
565 #endif |
|
566 |
|
567 // SocketInterface (ex HPI SocketInterface ) |
|
568 static int socket(int domain, int type, int protocol); |
|
569 static int socket_close(int fd); |
|
570 static int socket_shutdown(int fd, int howto); |
|
571 static int recv(int fd, char *buf, int nBytes, int flags); |
|
572 static int send(int fd, char *buf, int nBytes, int flags); |
|
573 static int raw_send(int fd, char *buf, int nBytes, int flags); |
|
574 static int timeout(int fd, long timeout); |
|
575 static int listen(int fd, int count); |
|
576 static int connect(int fd, struct sockaddr *him, int len); |
|
577 static int bind(int fd, struct sockaddr *him, int len); |
|
578 static int accept(int fd, struct sockaddr *him, int *len); |
|
579 static int recvfrom(int fd, char *buf, int nbytes, int flags, |
|
580 struct sockaddr *from, int *fromlen); |
|
581 static int get_sock_name(int fd, struct sockaddr *him, int *len); |
|
582 static int sendto(int fd, char *buf, int len, int flags, |
|
583 struct sockaddr *to, int tolen); |
|
584 static int socket_available(int fd, jint *pbytes); |
|
585 |
|
586 static int get_sock_opt(int fd, int level, int optname, |
|
587 char *optval, int* optlen); |
|
588 static int set_sock_opt(int fd, int level, int optname, |
|
589 const char *optval, int optlen); |
|
590 static int get_host_name(char* name, int namelen); |
|
591 |
|
592 static struct hostent* get_host_by_name(char* name); |
549 |
593 |
550 // Printing 64 bit integers |
594 // Printing 64 bit integers |
551 static const char* jlong_format_specifier(); |
595 static const char* jlong_format_specifier(); |
552 static const char* julong_format_specifier(); |
596 static const char* julong_format_specifier(); |
553 |
597 |