Skip to content

Commit

Permalink
deps: update to uvwasi 0.0.12
Browse files Browse the repository at this point in the history
Notable changes:

- Several overflows have been fixed.
- The libuv dependency has been updated to v1.42.0.

PR-URL: #40847
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
cjihrig authored and targos committed Nov 21, 2021
1 parent 4c47b01 commit b46184d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
4 changes: 2 additions & 2 deletions deps/uvwasi/include/uvwasi.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern "C" {

#define UVWASI_VERSION_MAJOR 0
#define UVWASI_VERSION_MINOR 0
#define UVWASI_VERSION_PATCH 11
#define UVWASI_VERSION_PATCH 12
#define UVWASI_VERSION_HEX ((UVWASI_VERSION_MAJOR << 16) | \
(UVWASI_VERSION_MINOR << 8) | \
(UVWASI_VERSION_PATCH))
Expand Down Expand Up @@ -68,7 +68,7 @@ typedef struct uvwasi_options_s {
} uvwasi_options_t;

/* Embedder API. */
uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, uvwasi_options_t* options);
uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, const uvwasi_options_t* options);
void uvwasi_destroy(uvwasi_t* uvwasi);
void uvwasi_options_init(uvwasi_options_t* options);
/* Use int instead of uv_file to avoid needing uv.h */
Expand Down
2 changes: 1 addition & 1 deletion deps/uvwasi/include/wasi_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <stddef.h>
#include <stdint.h>

/* API: https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/docs.md */
/* API: https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md */

typedef uint32_t uvwasi_size_t;

Expand Down
24 changes: 12 additions & 12 deletions deps/uvwasi/src/clocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
); \
} \
\
(time) = (((sys_system.wHour * 3600) + (sys_system.wMinute * 60) + \
sys_system.wSecond) * NANOS_PER_SEC) + \
(sys_system.wMilliseconds * 1000000) + \
(((sys_user.wHour * 3600) + (sys_user.wMinute * 60) + \
sys_user.wSecond) * NANOS_PER_SEC) + \
(sys_user.wMilliseconds * 1000000); \
(time) = (((uvwasi_timestamp_t)(sys_system.wHour * 3600) + \
(sys_system.wMinute * 60) + sys_system.wSecond) * NANOS_PER_SEC) + \
((uvwasi_timestamp_t)(sys_system.wMilliseconds) * 1000000) + \
(((uvwasi_timestamp_t)(sys_user.wHour * 3600) + \
(sys_user.wMinute * 60) + sys_user.wSecond) * NANOS_PER_SEC) + \
((uvwasi_timestamp_t)(sys_user.wMilliseconds) * 1000000); \
return UVWASI_ESUCCESS; \
} while (0)

Expand All @@ -52,7 +52,7 @@
struct timespec ts; \
if (0 != clock_gettime((clk), &ts)) \
return uvwasi__translate_uv_error(uv_translate_sys_error(errno)); \
(time) = (ts.tv_sec * NANOS_PER_SEC) + ts.tv_nsec; \
(time) = ((uvwasi_timestamp_t)(ts.tv_sec) * NANOS_PER_SEC) + ts.tv_nsec; \
return UVWASI_ESUCCESS; \
} while (0)

Expand All @@ -62,9 +62,9 @@
struct rusage ru; \
if (0 != getrusage((who), &ru)) \
return uvwasi__translate_uv_error(uv_translate_sys_error(errno)); \
(time) = (ru.ru_utime.tv_sec * NANOS_PER_SEC) + \
(time) = ((uvwasi_timestamp_t)(ru.ru_utime.tv_sec) * NANOS_PER_SEC) + \
(ru.ru_utime.tv_usec * 1000) + \
(ru.ru_stime.tv_sec * NANOS_PER_SEC) + \
((uvwasi_timestamp_t)(ru.ru_stime.tv_sec) * NANOS_PER_SEC) + \
(ru.ru_stime.tv_usec * 1000); \
return UVWASI_ESUCCESS; \
} while (0)
Expand All @@ -83,9 +83,9 @@
&count)) { \
return UVWASI_ENOSYS; \
} \
(time) = (info.user_time.seconds * NANOS_PER_SEC) + \
(time) = ((uvwasi_timestamp_t)(info.user_time.seconds) * NANOS_PER_SEC) + \
(info.user_time.microseconds * 1000) + \
(info.system_time.seconds * NANOS_PER_SEC) + \
((uvwasi_timestamp_t)(info.system_time.seconds) * NANOS_PER_SEC) + \
(info.system_time.microseconds * 1000); \
return UVWASI_ESUCCESS; \
} while (0)
Expand All @@ -109,7 +109,7 @@
if (0 != clock_getres((clk), &ts)) \
(time) = 1000000; \
else \
(time) = (ts.tv_sec * NANOS_PER_SEC) + ts.tv_nsec; \
(time) = ((uvwasi_timestamp_t)(ts.tv_sec) * NANOS_PER_SEC) + ts.tv_nsec; \
return UVWASI_ESUCCESS; \
} while (0)

Expand Down
2 changes: 1 addition & 1 deletion deps/uvwasi/src/fd_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ uvwasi_errno_t uvwasi_fd_table_insert(uvwasi_t* uvwasi,


uvwasi_errno_t uvwasi_fd_table_init(uvwasi_t* uvwasi,
uvwasi_options_t* options) {
const uvwasi_options_t* options) {
struct uvwasi_fd_table_t* table;
uvwasi_errno_t err;
int r;
Expand Down
2 changes: 1 addition & 1 deletion deps/uvwasi/src/fd_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct uvwasi_fd_table_t {
};

uvwasi_errno_t uvwasi_fd_table_init(struct uvwasi_s* uvwasi,
struct uvwasi_options_s* options);
const struct uvwasi_options_s* options);
void uvwasi_fd_table_free(struct uvwasi_s* uvwasi,
struct uvwasi_fd_table_t* table);
uvwasi_errno_t uvwasi_fd_table_insert(struct uvwasi_s* uvwasi,
Expand Down
5 changes: 4 additions & 1 deletion deps/uvwasi/src/uvwasi.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ void* uvwasi__malloc(const uvwasi_t* uvwasi, size_t size) {
}

void uvwasi__free(const uvwasi_t* uvwasi, void* ptr) {
if (ptr == NULL)
return;

uvwasi->allocator->free(ptr, uvwasi->allocator->mem_user_data);
}

Expand Down Expand Up @@ -229,7 +232,7 @@ static uvwasi_errno_t uvwasi__setup_ciovs(const uvwasi_t* uvwasi,
}


uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, uvwasi_options_t* options) {
uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, const uvwasi_options_t* options) {
uv_fs_t realpath_req;
uv_fs_t open_req;
uvwasi_errno_t err;
Expand Down

0 comments on commit b46184d

Please sign in to comment.