Path: blob/main/system/lib/libc/emscripten_internal.h
6162 views
/*1* Copyright 2023 The Emscripten Authors. All rights reserved.2* Emscripten is available under two separate licenses, the MIT license and the3* University of Illinois/NCSA Open Source License. Both these licenses can be4* found in the LICENSE file.5*6* Declarations for internal-only JS library functions.7*8* All JS library functions must be declares in one header or anther in order9* for `tools/gen_sig_info.py` to work. This file contains declarations for10* functions that are not declared in any other public or private header.11*/1213#include <emscripten/em_macros.h>14#include <emscripten/proxying.h>15#include <emscripten/html5.h>16#include <emscripten/wasm_worker.h>1718#include <signal.h> // for `sighandler_t`19#include <stdbool.h> // for `bool`20#include <stdint.h> // for `intptr_t`21#include <sys/types.h> // for `off_t`22#include <time.h> // for `struct tm`2324#ifdef __cplusplus25extern "C" {26#endif2728_Noreturn void _abort_js(void);2930void setThrew(uintptr_t threw, int value);3132void* _emscripten_memcpy_bulkmem(void* __restrict__ dest,33const void* __restrict__ src,34size_t n);35void* _emscripten_memset_bulkmem(void* ptr, char value, size_t n);3637void emscripten_notify_memory_growth(size_t memory_index);3839time_t _timegm_js(struct tm* tm);40time_t _mktime_js(struct tm* tm);41void _localtime_js(time_t t, struct tm* __restrict__ tm);42void _gmtime_js(time_t t, struct tm* __restrict__ tm);4344void _tzset_js(long* timezone, int* daylight, char* std_name, char* dst_name);4546const char* emscripten_pc_get_function(uintptr_t pc);47const char* emscripten_pc_get_file(uintptr_t pc);48int emscripten_pc_get_line(uintptr_t pc);49int emscripten_pc_get_column(uintptr_t pc);5051void* emscripten_builtin_mmap(52void* addr, size_t length, int prot, int flags, int fd, off_t offset);53int emscripten_builtin_munmap(void* addr, size_t length);5455uintptr_t emscripten_stack_snapshot(void);56uint32_t57emscripten_stack_unwind_buffer(uintptr_t pc, uintptr_t* buffer, uint32_t depth);5859bool _emscripten_get_now_is_monotonic(void);6061void _emscripten_get_progname(char*, int);6263// Not defined in musl, but defined in library.js. Included here for64// the benefit of gen_sig_info.py65char* strptime_l(const char* __restrict __s,66const char* __restrict __fmt,67struct tm* __tp,68locale_t __loc);6970int _mmap_js(size_t length,71int prot,72int flags,73int fd,74off_t offset,75int* allocated,76void** addr);77int _munmap_js(78intptr_t addr, size_t length, int prot, int flags, int fd, off_t offset);79int _msync_js(80intptr_t addr, size_t length, int prot, int flags, int fd, off_t offset);8182struct dso;8384typedef void (*dlopen_callback_func)(struct dso*, void* user_data);8586void* _dlopen_js(struct dso* handle);87void* _dlsym_js(struct dso* handle, const char* symbol, int* sym_index);88void _emscripten_dlopen_js(struct dso* handle,89dlopen_callback_func onsuccess,90dlopen_callback_func onerror,91void* user_data);92void* _dlsym_catchup_js(struct dso* handle, int sym_index);9394int _setitimer_js(int which, double timeout);9596// Synchronize loaded modules across threads.97// Runs _emscripten_dlsync_self on each of the threads that are running at98// the time of the call.99void _emscripten_dlsync_threads();100101#ifdef _GNU_SOURCE102void __call_sighandler(sighandler_t handler, int sig);103#endif104105double emscripten_get_now_res(void);106107void* emscripten_return_address(int level);108109int _emscripten_sanitizer_use_colors(void);110char* _emscripten_sanitizer_get_option(const char* name);111112void _emscripten_fs_load_embedded_files(void* ptr);113114void _emscripten_throw_longjmp(void);115116void _emscripten_runtime_keepalive_clear();117118void __handle_stack_overflow(void* addr);119120// Internal fetch API121struct emscripten_fetch_t;122void emscripten_start_fetch(struct emscripten_fetch_t* fetch);123size_t _emscripten_fetch_get_response_headers_length(int32_t fetchID);124size_t _emscripten_fetch_get_response_headers(int32_t fetchID, char *dst, size_t dstSizeBytes);125void emscripten_fetch_free(unsigned int);126127// Internal implementation function in JavaScript side that emscripten_create_wasm_worker() calls to128// to perform the wasm worker creation.129emscripten_wasm_worker_t _emscripten_create_wasm_worker(void *stackLowestAddress, uint32_t stackSize);130131void __resumeException(void* exn);132void __cxa_call_unexpected(void* exn);133void llvm_eh_typeid_for(void* exn);134135uint32_t _emscripten_lookup_name(const char *name);136137int _emscripten_system(const char *command);138139void _emscripten_log_formatted(int flags, const char* str);140141EmscriptenDeviceOrientationEvent* _emscripten_get_last_deviceorientation_event();142EmscriptenDeviceMotionEvent* _emscripten_get_last_devicemotion_event();143EmscriptenMouseEvent* _emscripten_get_last_mouse_event();144145int _poll_js(void* fds, int nfds, int timeout, void* ctx, void* arg);146147#ifdef __cplusplus148}149#endif150151152