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