Skip to content

Commit

Permalink
[#48828] Move constants definitions to .c source
Browse files Browse the repository at this point in the history
  • Loading branch information
GPlaczek committed Sep 11, 2023
1 parent 19125e8 commit ebe1a16
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
11 changes: 11 additions & 0 deletions c_lib/wasi_ext_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@
#define SYSCALL_LENGTH 256
#define SYSCALL_ARGS_LENGTH 2048

const __wasi_fdflags_t WASI_EXT_FDFLAG_CTRL_BIT = 0x0020;
const __wasi_fdflags_t WASI_EXT_FDFLAG_MASK = 0xffc0;
const __wasi_fdflags_t WASI_EXT_FDFLAG_CLOEXEC = 0x0040;

const unsigned int TIOCGWINSZ = _IOR(1, 0, 8);
const unsigned int TIOCSRAW = _IOW(1, 1, 4);
const unsigned int TIOCSECHO = _IOW(1, 2, 4);

const int STDIN = 0;
const int STDOUT = 1;

int __syscall(const char *command, char *args, uint8_t *output_buf,
size_t output_buf_len) {
char *ptr;
Expand Down
16 changes: 8 additions & 8 deletions c_lib/wasi_ext_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@
#include <stdlib.h>

// Ioctl magic numbers
const unsigned int TIOCGWINSZ = _IOR(1, 0, 8);
const unsigned int TIOCSRAW = _IOW(1, 1, 4);
const unsigned int TIOCSECHO = _IOW(1, 2, 4);
extern const unsigned int TIOCGWINSZ;
extern const unsigned int TIOCSRAW;
extern const unsigned int TIOCSECHO;

// Fnctl commands
enum FcntlCommand { F_MVFD, F_GETFD, F_SETFD };

// Extended fs_fdflags
const __wasi_fdflags_t WASI_EXT_FDFLAG_CTRL_BIT = 0x0020;
const __wasi_fdflags_t WASI_EXT_FDFLAG_MASK = 0xffc0;
const __wasi_fdflags_t WASI_EXT_FDFLAG_CLOEXEC = 0x0040;
extern const __wasi_fdflags_t WASI_EXT_FDFLAG_CTRL_BIT;
extern const __wasi_fdflags_t WASI_EXT_FDFLAG_MASK;
extern const __wasi_fdflags_t WASI_EXT_FDFLAG_CLOEXEC;

const int STDIN = 0;
const int STDOUT = 1;
extern const int STDIN;
extern const int STDOUT;

enum RedirectType {
READ,
Expand Down

0 comments on commit ebe1a16

Please sign in to comment.