Skip to content

Commit ceb5697

Browse files
pixelherodevNoam Preil
andauthored
plan9 port maintenance (#1756)
* plan9: fix regressions * plan9: unopaque struct pointer --------- Co-authored-by: Noam Preil <noam@pixelhero.dev>
1 parent 6292a69 commit ceb5697

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

src/core/io.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,11 @@ static void io_file_marshal(void *p, JanetMarshalContext *ctx) {
424424
if (iof->flags & JANET_FILE_NOT_CLOSEABLE) {
425425
fno = fileno(iof->file);
426426
} else {
427+
#ifdef JANET_PLAN9
428+
fno = dup(fileno(iof->file), -1);
429+
#else
427430
fno = dup(fileno(iof->file));
431+
#endif
428432
}
429433
#endif
430434
janet_marshal_int(ctx, fno);

src/core/marsh.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@
3030
#include "util.h"
3131
#endif
3232

33-
struct JanetMarshalContext {
34-
void *m_state;
35-
void *u_state;
36-
int flags;
37-
const uint8_t *data;
38-
const JanetAbstractType *at;
39-
};
4033

4134
typedef struct {
4235
JanetBuffer *buf;

src/core/os.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,11 @@ JANET_CORE_FN(os_exit,
287287
}
288288
janet_deinit();
289289
if (argc >= 2 && janet_truthy(argv[1])) {
290+
#ifdef JANET_PLAN9
291+
exits(nil);
292+
#else
290293
_Exit(status);
294+
#endif
291295
} else {
292296
exit(status);
293297
}

src/include/janet.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,13 @@ struct JanetParser {
12021202
};
12031203

12041204
/* A context for marshaling and unmarshaling abstract types */
1205+
struct JanetMarshalContext {
1206+
void *m_state;
1207+
void *u_state;
1208+
int flags;
1209+
const uint8_t *data;
1210+
const JanetAbstractType *at;
1211+
};
12051212
typedef struct JanetMarshalContext JanetMarshalContext;
12061213

12071214
/* Defines an abstract type. Use a const pointer to one of these structures

0 commit comments

Comments
 (0)