Skip to content

Commit

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

- The uvwasi_preopen_t now uses const char* for the mapped_path
  and real_path fields. Previously, these were not `const`.
- uvwasi_path_filestat_get() now properly handles the
  UVWASI_LOOKUP_SYMLINK_FOLLOW flag.
- uvwasi_options_init() has been added to reduce the boilerplate
  code associated with initializing uvwasi_options_t's.
- The DEBUG() macro has been renamed to UVWASI_DEBUG() to reduce
  naming conflicts with other projects.
- A compilation error on NetBSD 8.2 has been fixed.
- The uvwasi_fd_filestat_set_times() and
  uvwasi_path_filestat_set_times() functions now have proper
  implementations.

Fixes: #34510

PR-URL: #34623
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
cjihrig authored and addaleax committed Aug 8, 2020
1 parent d8e0dea commit dc49561
Show file tree
Hide file tree
Showing 5 changed files with 387 additions and 256 deletions.
7 changes: 4 additions & 3 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 9
#define UVWASI_VERSION_PATCH 10
#define UVWASI_VERSION_HEX ((UVWASI_VERSION_MAJOR << 16) | \
(UVWASI_VERSION_MINOR << 8) | \
(UVWASI_VERSION_PATCH))
Expand Down Expand Up @@ -50,8 +50,8 @@ typedef struct uvwasi_s {
} uvwasi_t;

typedef struct uvwasi_preopen_s {
char* mapped_path;
char* real_path;
const char* mapped_path;
const char* real_path;
} uvwasi_preopen_t;

typedef struct uvwasi_options_s {
Expand All @@ -70,6 +70,7 @@ typedef struct uvwasi_options_s {
/* Embedder API. */
uvwasi_errno_t uvwasi_init(uvwasi_t* uvwasi, 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 */
uvwasi_errno_t uvwasi_embedder_remap_fd(uvwasi_t* uvwasi,
const uvwasi_fd_t fd,
Expand Down
14 changes: 6 additions & 8 deletions deps/uvwasi/include/wasi_serdes.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@

/* Basic uint{8,16,32,64}_t read/write functions. */

#define BASIC_TYPE_(name, type) \
#define BASIC_TYPE(name, type) \
void uvwasi_serdes_write_##name(void* ptr, size_t offset, type value); \
type uvwasi_serdes_read_##name(const void* ptr, size_t offset); \

#define BASIC_TYPE(type) BASIC_TYPE_(type, type)
#define BASIC_TYPE_UVWASI(type) BASIC_TYPE_(type, uvwasi_##type)
#define BASIC_TYPE_UVWASI(type) BASIC_TYPE(type, uvwasi_##type)

#define UVWASI_SERDES_SIZE_uint8_t sizeof(uint8_t)
BASIC_TYPE(uint8_t)
BASIC_TYPE(uint8_t, uint8_t)
#define UVWASI_SERDES_SIZE_uint16_t sizeof(uint16_t)
BASIC_TYPE(uint16_t)
BASIC_TYPE(uint16_t, uint16_t)
#define UVWASI_SERDES_SIZE_uint32_t sizeof(uint32_t)
BASIC_TYPE(uint32_t)
BASIC_TYPE(uint32_t, uint32_t)
#define UVWASI_SERDES_SIZE_uint64_t sizeof(uint64_t)
BASIC_TYPE(uint64_t)
BASIC_TYPE(uint64_t, uint64_t)

#define UVWASI_SERDES_SIZE_advice_t sizeof(uvwasi_advice_t)
BASIC_TYPE_UVWASI(advice_t)
Expand Down Expand Up @@ -80,7 +79,6 @@ BASIC_TYPE_UVWASI(whence_t)

#undef BASIC_TYPE_UVWASI
#undef BASIC_TYPE
#undef BASIC_TYPE_

/* WASI structure read/write functions. */

Expand Down
6 changes: 4 additions & 2 deletions deps/uvwasi/src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
#define __UVWASI_DEBUG_H__

#ifdef UVWASI_DEBUG_LOG
#ifndef __STDC_FORMAT_MACROS
# define __STDC_FORMAT_MACROS
#endif
# include <inttypes.h>
# define DEBUG(fmt, ...) \
# define UVWASI_DEBUG(fmt, ...) \
do { fprintf(stderr, fmt, __VA_ARGS__); } while (0)
#else
# define DEBUG(fmt, ...)
# define UVWASI_DEBUG(fmt, ...)
#endif

#endif /* __UVWASI_DEBUG_H__ */
Loading

0 comments on commit dc49561

Please sign in to comment.