wip on intellisense (again)

This commit is contained in:
Alexander Nicholi 2021-02-02 11:14:45 -05:00
parent 9841e2186a
commit 7642710155
No known key found for this signature in database
GPG key ID: B75B2EB05540F74C
18 changed files with 242 additions and 52 deletions

View file

@ -251,6 +251,7 @@ int vdprintf(int, const char *, va_list) paramsnonnull();
void _init_onntconsoleevent(void);
void _init_wincrash(void);
#ifndef __SIGACTION
#define __SIGACTION(FN, SIG, ...) \
({ \
if (SupportsWindows()) { \
@ -279,6 +280,7 @@ void _init_wincrash(void);
} \
(FN)(SIG, __VA_ARGS__); \
})
#endif
#define dprintf(FD, FMT, ...) (dprintf)(FD, PFLINK(FMT), ##__VA_ARGS__)
#define sigaction(SIG, ACT, OLD) __SIGACTION(sigaction, SIG, ACT, OLD)

View file

@ -36,25 +36,28 @@ struct IoctlPtmGet {
char theduxname[16];
char workername[16];
};
enum FdKind {
kFdEmpty,
kFdFile,
kFdSocket,
kFdProcess,
kFdConsole,
kFdSerial,
kFdZip,
kFdEpoll,
};
struct Fd {
int64_t handle;
int64_t extra;
int kind;
unsigned flags;
};
struct Fds {
size_t f; // lowest free slot
size_t n; // monotonic capacity
struct Fd {
int64_t handle;
int64_t extra;
enum FdKind {
kFdEmpty,
kFdFile,
kFdSocket,
kFdProcess,
kFdConsole,
kFdSerial,
kFdZip,
kFdEpoll,
} kind;
unsigned flags;
} * p;
struct Fd * p;
struct Fd __init_p[OPEN_MAX];
};
@ -76,7 +79,7 @@ forceinline bool __isfdopen(int fd) {
return 0 <= fd && fd < g_fds.n && g_fds.p[fd].kind != kFdEmpty;
}
forceinline bool __isfdkind(int fd, enum FdKind kind) {
forceinline bool __isfdkind(int fd, int kind) {
return 0 <= fd && fd < g_fds.n && g_fds.p[fd].kind == kind;
}

View file

@ -45,6 +45,7 @@ union metasigaction {
struct sigaction$xnu_out xnu_out;
};
#ifndef SWITCHEROO
#define SWITCHEROO(S1, S2, A, B, C, D) \
do { \
autotype((S2).A) a = (typeof((S2).A))(S1).A; \
@ -59,6 +60,7 @@ union metasigaction {
memset(&((S2).D), 0, sizeof((S2).D)); \
memcpy(&((S2).D), &d, MIN(sizeof(d), sizeof((S2).D))); \
} while (0);
#endif
static void sigaction$cosmo2native(union metasigaction *sa) {
if (!sa) return;

View file

@ -20,6 +20,7 @@
#include "libc/calls/struct/metastat.internal.h"
#include "libc/dce.h"
#ifndef SWITCHEROO
#define SWITCHEROO(S1, S2, A, B, C, D, E, F, G, H, I, J, K, L, M) \
do { \
autotype((S2).A) a = (typeof((S2).A))(S1).A; \
@ -49,6 +50,7 @@
(S2).L = l; \
(S2).M = m; \
} while (0);
#endif
forceinline void stat2linux_xnu(union metastat *ms) {
SWITCHEROO(ms->xnu, ms->linux, st_dev, st_ino, st_nlink, st_mode, st_uid,