@ai-ecoverse/wasm-emscripten 6.0.9-8 → 6.0.9-9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/wasm-emscripten",
3
- "version": "6.0.9-8",
3
+ "version": "6.0.9-9",
4
4
  "description": "Emscripten 6.0.9 for slicc (emcc via wasix-python)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -53,7 +53,7 @@
53
53
  "@ai-ecoverse/wasix-python": "^3.14.2-7",
54
54
  "@ai-ecoverse/wasm-clang": "24.0.0-9",
55
55
  "@ai-ecoverse/wasm-binaryen": "132.0.0-1",
56
- "@ai-ecoverse/emscripten-cache": "6.0.9-2",
56
+ "@ai-ecoverse/emscripten-cache": "6.0.9-3",
57
57
  "esbuild-wasm": "0.28.2",
58
58
  "typescript": "6.0.3",
59
59
  "acorn": "^8.18.0",
@@ -9,8 +9,6 @@
9
9
  */
10
10
 
11
11
  #include <errno.h>
12
- #include <grp.h>
13
- #include <pwd.h>
14
12
  #include <string.h>
15
13
  #include <time.h>
16
14
  #include <signal.h>
@@ -72,76 +70,6 @@ weak int clock_getcpuclockid(pid_t pid, clockid_t *clockid) {
72
70
  return 0;
73
71
  }
74
72
 
75
- // ==========================================================================
76
- // pwd.h
77
- // ==========================================================================
78
-
79
- struct passwd *getpwnam(const char *name) {
80
- errno = ENOENT;
81
- return 0;
82
- }
83
-
84
- struct passwd *getpwuid(uid_t uid) {
85
- errno = ENOENT;
86
- return 0;
87
- }
88
-
89
- weak int getpwnam_r(const char *name, struct passwd *pwd,
90
- char *buf, size_t buflen, struct passwd **result) {
91
- return ENOENT;
92
- }
93
-
94
- weak int getpwuid_r(uid_t uid, struct passwd *pwd,
95
- char *buf, size_t buflen, struct passwd **result) {
96
- return ENOENT;
97
- }
98
-
99
- weak void setpwent(void) {
100
- }
101
-
102
- weak void endpwent(void) {
103
- }
104
-
105
- struct passwd *getpwent(void) {
106
- errno = EIO;
107
- return NULL;
108
- }
109
-
110
- // ==========================================================================
111
- // grp.h
112
- // ==========================================================================
113
-
114
- weak struct group *getgrnam(const char *name) {
115
- errno = ENOENT;
116
- return 0;
117
- }
118
-
119
- weak struct group *getgrgid(gid_t gid) {
120
- errno = ENOENT;
121
- return 0;
122
- }
123
-
124
- weak int getgrnam_r(const char *name, struct group *grp,
125
- char *buf, size_t buflen, struct group **result) {
126
- return ENOENT;
127
- }
128
-
129
- weak int getgrgid_r(gid_t gid, struct group *grp,
130
- char *buf, size_t buflen, struct group **result) {
131
- return ENOENT;
132
- }
133
-
134
- weak struct group *getgrent(void) {
135
- errno = EIO;
136
- return NULL;
137
- }
138
-
139
- weak void endgrent(void) {
140
- }
141
-
142
- weak void setgrent(void) {
143
- }
144
-
145
73
  // ==========================================================================
146
74
  // sys/file.h
147
75
  // ==========================================================================
@@ -404,15 +404,11 @@ typedef struct __locale_struct * locale_t;
404
404
  #endif
405
405
 
406
406
 
407
- // Musl uses 128 bytes for sigset_t, presumably for some kind of ABI
408
- // compatability with the kernel or GLIBC, but in emscripten we can be precise.
409
- // Since we have _NSIG = 65 which only need 2 `long`s for the bitmask.
410
- // The signals we support are
411
- // 1 - 31 - standard POSIX signals (see emscripten/bits/signal.h)
412
- // 32 - 34 - pthread-specific signals (see pthread_impl.h>
413
- // 35 - 65 - user-defined RT signals (we don't currently have any test coverage of these).
407
+ // Keep the musl 128-byte sigset_t layout. Emscripten's short two-long
408
+ // bitmask (16 bytes on wasm32) made sizeof(struct sigaction)==20 and broke
409
+ // slicc_sig_mask stride (20 vs 140) against libc's __sig_actions[].
414
410
  #if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t)
415
- typedef struct __sigset_t { unsigned long __bits[2]; } sigset_t;
411
+ typedef struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
416
412
  #define __DEFINED_sigset_t
417
413
  #endif
418
414
 
@@ -131,13 +131,14 @@ int __getgr_a(const char *name, gid_t gid, struct group *gr, char **buf, size_t
131
131
  if (groupbuf[GRMEMCNT]) {
132
132
  mem[0][0] = *buf + groupbuf[GRNAMELEN] + groupbuf[GRPASSWDLEN];
133
133
  for (ptr = mem[0][0], i = 0; ptr != mem[0][0]+grlist_len; ptr++)
134
- if (!*ptr)
134
+ if (!*ptr) {
135
135
  if (i<groupbuf[GRMEMCNT]) {
136
136
  mem[0][++i] = ptr+1;
137
137
  } else {
138
138
  rv = EIO;
139
139
  goto cleanup_f;
140
140
  }
141
+ }
141
142
  mem[0][i] = 0;
142
143
 
143
144
  if (i != groupbuf[GRMEMCNT]) {
@@ -1178,8 +1178,11 @@ class libc(MuslInternalLibrary,
1178
1178
  musl_srcdir = utils.path_from_root('system/lib/libc/musl/src')
1179
1179
 
1180
1180
  # musl modules
1181
+ # SLICC: include musl passwd/ so getpw*/getgr* read /etc/passwd + /etc/group
1182
+ # from the VFS (synthetic files from the shell). Keep getgrouplist/initgroups
1183
+ # excluded below — they need syscalls Emscripten lacks.
1181
1184
  ignore = [
1182
- 'ipc', 'passwd', 'signal', 'sched', 'time', 'linux',
1185
+ 'ipc', 'signal', 'sched', 'time', 'linux',
1183
1186
  'aio', 'legacy', 'mq', 'setjmp',
1184
1187
  'ldso', 'malloc',
1185
1188
  ]