-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AT_FDCWD is a special constant in POSIX that can be passed to *at functions to indicate the current working directory. Since the current working directory is emulated in wasi libc, add emulated AT_FDCWD support as well. Fixes #42.
- Loading branch information
1 parent
5ccebd3
commit 2493211
Showing
23 changed files
with
442 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
#include <_/cdefs.h> | ||
int snprintf(char *str, size_t size, const char *format, ...); | ||
int rename(const char *oldpath, const char *newpath); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,4 +56,6 @@ | |
#define AT_SYMLINK_FOLLOW (0x2) | ||
#define AT_REMOVEDIR (0x4) | ||
|
||
#define AT_FDCWD (-2) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#ifndef __wasi_libc_nocwd_h | ||
#define __wasi_libc_nocwd_h | ||
|
||
/* | ||
* In order to support AT_FDCWD, we need to wrap the *at functions to handle | ||
* it by calling back into the non-at versions which perform libpreopen | ||
* queries. These __wasilibc_nocwd_* forms are the underlying calls which | ||
* assume AT_FDCWD has already been resolved. | ||
*/ | ||
|
||
#define __need_size_t | ||
#include <stddef.h> | ||
#include <__typedef_ssize_t.h> | ||
#include <__typedef_mode_t.h> | ||
#include <__typedef_DIR.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
struct timespec; | ||
struct stat; | ||
struct dirent; | ||
|
||
int __wasilibc_nocwd___wasilibc_unlinkat(int, const char *) | ||
__attribute__((__warn_unused_result__)); | ||
int __wasilibc_nocwd___wasilibc_rmdirat(int, const char *) | ||
__attribute__((__warn_unused_result__)); | ||
int __wasilibc_nocwd_linkat(int, const char *, int, const char *, int) | ||
__attribute__((__warn_unused_result__)); | ||
int __wasilibc_nocwd_symlinkat(const char *, int, const char *) | ||
__attribute__((__warn_unused_result__)); | ||
ssize_t __wasilibc_nocwd_readlinkat(int, const char *__restrict, char *__restrict, size_t) | ||
__attribute__((__warn_unused_result__)); | ||
int __wasilibc_nocwd_faccessat(int, const char *, int, int) | ||
__attribute__((__warn_unused_result__)); | ||
int __wasilibc_nocwd_renameat(int, const char *, int, const char *) | ||
__attribute__((__warn_unused_result__)); | ||
int __wasilibc_nocwd_openat_nomode(int, const char *, int) | ||
__attribute__((__warn_unused_result__)); | ||
int __wasilibc_nocwd_fstatat(int, const char *__restrict, struct stat *__restrict, int) | ||
__attribute__((__warn_unused_result__)); | ||
int __wasilibc_nocwd_mkdirat_nomode(int, const char *) | ||
__attribute__((__warn_unused_result__)); | ||
int __wasilibc_nocwd_utimensat(int, const char *, const struct timespec [2], int) | ||
__attribute__((__warn_unused_result__)); | ||
DIR *__wasilibc_nocwd_opendirat(int, const char *) | ||
__attribute__((__warn_unused_result__)); | ||
int __wasilibc_nocwd_scandirat(int, const char *, struct dirent ***, | ||
int (*)(const struct dirent *), | ||
int (*)(const struct dirent **, const struct dirent **)) | ||
__attribute__((__warn_unused_result__)); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.