Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/system/lib/libc/emscripten_internal.h
6162 views
1
/*
2
* Copyright 2023 The Emscripten Authors. All rights reserved.
3
* Emscripten is available under two separate licenses, the MIT license and the
4
* University of Illinois/NCSA Open Source License. Both these licenses can be
5
* found in the LICENSE file.
6
*
7
* Declarations for internal-only JS library functions.
8
*
9
* All JS library functions must be declares in one header or anther in order
10
* for `tools/gen_sig_info.py` to work. This file contains declarations for
11
* functions that are not declared in any other public or private header.
12
*/
13
14
#include <emscripten/em_macros.h>
15
#include <emscripten/proxying.h>
16
#include <emscripten/html5.h>
17
#include <emscripten/wasm_worker.h>
18
19
#include <signal.h> // for `sighandler_t`
20
#include <stdbool.h> // for `bool`
21
#include <stdint.h> // for `intptr_t`
22
#include <sys/types.h> // for `off_t`
23
#include <time.h> // for `struct tm`
24
25
#ifdef __cplusplus
26
extern "C" {
27
#endif
28
29
_Noreturn void _abort_js(void);
30
31
void setThrew(uintptr_t threw, int value);
32
33
void* _emscripten_memcpy_bulkmem(void* __restrict__ dest,
34
const void* __restrict__ src,
35
size_t n);
36
void* _emscripten_memset_bulkmem(void* ptr, char value, size_t n);
37
38
void emscripten_notify_memory_growth(size_t memory_index);
39
40
time_t _timegm_js(struct tm* tm);
41
time_t _mktime_js(struct tm* tm);
42
void _localtime_js(time_t t, struct tm* __restrict__ tm);
43
void _gmtime_js(time_t t, struct tm* __restrict__ tm);
44
45
void _tzset_js(long* timezone, int* daylight, char* std_name, char* dst_name);
46
47
const char* emscripten_pc_get_function(uintptr_t pc);
48
const char* emscripten_pc_get_file(uintptr_t pc);
49
int emscripten_pc_get_line(uintptr_t pc);
50
int emscripten_pc_get_column(uintptr_t pc);
51
52
void* emscripten_builtin_mmap(
53
void* addr, size_t length, int prot, int flags, int fd, off_t offset);
54
int emscripten_builtin_munmap(void* addr, size_t length);
55
56
uintptr_t emscripten_stack_snapshot(void);
57
uint32_t
58
emscripten_stack_unwind_buffer(uintptr_t pc, uintptr_t* buffer, uint32_t depth);
59
60
bool _emscripten_get_now_is_monotonic(void);
61
62
void _emscripten_get_progname(char*, int);
63
64
// Not defined in musl, but defined in library.js. Included here for
65
// the benefit of gen_sig_info.py
66
char* strptime_l(const char* __restrict __s,
67
const char* __restrict __fmt,
68
struct tm* __tp,
69
locale_t __loc);
70
71
int _mmap_js(size_t length,
72
int prot,
73
int flags,
74
int fd,
75
off_t offset,
76
int* allocated,
77
void** addr);
78
int _munmap_js(
79
intptr_t addr, size_t length, int prot, int flags, int fd, off_t offset);
80
int _msync_js(
81
intptr_t addr, size_t length, int prot, int flags, int fd, off_t offset);
82
83
struct dso;
84
85
typedef void (*dlopen_callback_func)(struct dso*, void* user_data);
86
87
void* _dlopen_js(struct dso* handle);
88
void* _dlsym_js(struct dso* handle, const char* symbol, int* sym_index);
89
void _emscripten_dlopen_js(struct dso* handle,
90
dlopen_callback_func onsuccess,
91
dlopen_callback_func onerror,
92
void* user_data);
93
void* _dlsym_catchup_js(struct dso* handle, int sym_index);
94
95
int _setitimer_js(int which, double timeout);
96
97
// Synchronize loaded modules across threads.
98
// Runs _emscripten_dlsync_self on each of the threads that are running at
99
// the time of the call.
100
void _emscripten_dlsync_threads();
101
102
#ifdef _GNU_SOURCE
103
void __call_sighandler(sighandler_t handler, int sig);
104
#endif
105
106
double emscripten_get_now_res(void);
107
108
void* emscripten_return_address(int level);
109
110
int _emscripten_sanitizer_use_colors(void);
111
char* _emscripten_sanitizer_get_option(const char* name);
112
113
void _emscripten_fs_load_embedded_files(void* ptr);
114
115
void _emscripten_throw_longjmp(void);
116
117
void _emscripten_runtime_keepalive_clear();
118
119
void __handle_stack_overflow(void* addr);
120
121
// Internal fetch API
122
struct emscripten_fetch_t;
123
void emscripten_start_fetch(struct emscripten_fetch_t* fetch);
124
size_t _emscripten_fetch_get_response_headers_length(int32_t fetchID);
125
size_t _emscripten_fetch_get_response_headers(int32_t fetchID, char *dst, size_t dstSizeBytes);
126
void emscripten_fetch_free(unsigned int);
127
128
// Internal implementation function in JavaScript side that emscripten_create_wasm_worker() calls to
129
// to perform the wasm worker creation.
130
emscripten_wasm_worker_t _emscripten_create_wasm_worker(void *stackLowestAddress, uint32_t stackSize);
131
132
void __resumeException(void* exn);
133
void __cxa_call_unexpected(void* exn);
134
void llvm_eh_typeid_for(void* exn);
135
136
uint32_t _emscripten_lookup_name(const char *name);
137
138
int _emscripten_system(const char *command);
139
140
void _emscripten_log_formatted(int flags, const char* str);
141
142
EmscriptenDeviceOrientationEvent* _emscripten_get_last_deviceorientation_event();
143
EmscriptenDeviceMotionEvent* _emscripten_get_last_devicemotion_event();
144
EmscriptenMouseEvent* _emscripten_get_last_mouse_event();
145
146
int _poll_js(void* fds, int nfds, int timeout, void* ctx, void* arg);
147
148
#ifdef __cplusplus
149
}
150
#endif
151
152