723
724 // IO operations on binary files
725 static int create_binary_file(const char* path, bool rewrite_existing);
726 static jlong current_file_offset(int fd);
727 static jlong seek_to_file_offset(int fd, jlong offset);
728
729 // Retrieve native stack frames.
730 // Parameter:
731 // stack: an array to storage stack pointers.
732 // frames: size of above array.
733 // toSkip: number of stack frames to skip at the beginning.
734 // Return: number of stack frames captured.
735 static int get_native_stack(address* stack, int size, int toSkip = 0);
736
737 // General allocation (must be MT-safe)
738 static void* malloc (size_t size, MEMFLAGS flags, const NativeCallStack& stack);
739 static void* malloc (size_t size, MEMFLAGS flags);
740 static void* realloc (void *memblock, size_t size, MEMFLAGS flag, const NativeCallStack& stack);
741 static void* realloc (void *memblock, size_t size, MEMFLAGS flag);
742
743 static void free (void *memblock);
744 static char* strdup(const char *, MEMFLAGS flags = mtInternal); // Like strdup
745 // Like strdup, but exit VM when strdup() returns NULL
746 static char* strdup_check_oom(const char*, MEMFLAGS flags = mtInternal);
747
748 #ifndef PRODUCT
749 static julong num_mallocs; // # of calls to malloc/realloc
750 static julong alloc_bytes; // # of bytes allocated
751 static julong num_frees; // # of calls to free
752 static julong free_bytes; // # of bytes freed
753 #endif
754
755 // SocketInterface (ex HPI SocketInterface )
756 static int socket(int domain, int type, int protocol);
757 static int socket_close(int fd);
758 static int recv(int fd, char* buf, size_t nBytes, uint flags);
759 static int send(int fd, char* buf, size_t nBytes, uint flags);
760 static int raw_send(int fd, char* buf, size_t nBytes, uint flags);
761 static int connect(int fd, struct sockaddr* him, socklen_t len);
762 static struct hostent* get_host_by_name(char* name);
|
723
724 // IO operations on binary files
725 static int create_binary_file(const char* path, bool rewrite_existing);
726 static jlong current_file_offset(int fd);
727 static jlong seek_to_file_offset(int fd, jlong offset);
728
729 // Retrieve native stack frames.
730 // Parameter:
731 // stack: an array to storage stack pointers.
732 // frames: size of above array.
733 // toSkip: number of stack frames to skip at the beginning.
734 // Return: number of stack frames captured.
735 static int get_native_stack(address* stack, int size, int toSkip = 0);
736
737 // General allocation (must be MT-safe)
738 static void* malloc (size_t size, MEMFLAGS flags, const NativeCallStack& stack);
739 static void* malloc (size_t size, MEMFLAGS flags);
740 static void* realloc (void *memblock, size_t size, MEMFLAGS flag, const NativeCallStack& stack);
741 static void* realloc (void *memblock, size_t size, MEMFLAGS flag);
742
743 // handles NULL pointers
744 static void free (void *memblock);
745 static char* strdup(const char *, MEMFLAGS flags = mtInternal); // Like strdup
746 // Like strdup, but exit VM when strdup() returns NULL
747 static char* strdup_check_oom(const char*, MEMFLAGS flags = mtInternal);
748
749 #ifndef PRODUCT
750 static julong num_mallocs; // # of calls to malloc/realloc
751 static julong alloc_bytes; // # of bytes allocated
752 static julong num_frees; // # of calls to free
753 static julong free_bytes; // # of bytes freed
754 #endif
755
756 // SocketInterface (ex HPI SocketInterface )
757 static int socket(int domain, int type, int protocol);
758 static int socket_close(int fd);
759 static int recv(int fd, char* buf, size_t nBytes, uint flags);
760 static int send(int fd, char* buf, size_t nBytes, uint flags);
761 static int raw_send(int fd, char* buf, size_t nBytes, uint flags);
762 static int connect(int fd, struct sockaddr* him, socklen_t len);
763 static struct hostent* get_host_by_name(char* name);
|