Skip to content

Commit

Permalink
Fix compiler errors
Browse files Browse the repository at this point in the history
  • Loading branch information
talex5 committed Sep 20, 2023
1 parent 02c6d99 commit 7a985da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion bench/bench_fstat.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let n_stat = 100000

let run_fiber file =
for _ = 1 to n_stat do
let info = (Eio.File.stat file).kind in
let info = (Eio.File.stat file [Kind]) Fun.id in
assert (info = `Regular_file)
done

Expand Down
32 changes: 14 additions & 18 deletions lib_eio_posix/eio_posix_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@ CAMLprim value caml_eio_posix_mkdirat(value v_fd, value v_path, value v_perm) {
CAMLreturn(Val_unit);
}

static double double_of_timespec(struct timespec *t) {
return ((double) t->tv_sec) + (((double ) t->tv_nsec) / 1e9);
}

#define Stat_val(v) (*((struct stat **) Data_custom_val(v)))

static void finalize_stat(value v) {
Expand Down Expand Up @@ -258,14 +254,14 @@ value ocaml_eio_posix_stat_ ## field ## _bytes(value v_stat) { \
return ocaml_value_maker(ocaml_eio_posix_stat_##field##_native(v_stat)); \
}

STAT_GETTER(blksize, int64_t, caml_copy_int64);
STAT_GETTER(nlink, int64_t, caml_copy_int64);
STAT_GETTER(uid, int64_t, caml_copy_int64);
STAT_GETTER(gid, int64_t, caml_copy_int64);
STAT_GETTER(ino, int64_t, caml_copy_int64);
STAT_GETTER(size, int64_t, caml_copy_int64);
STAT_GETTER(blocks, int64_t, caml_copy_int64);
STAT_GETTER(mode, intnat, Val_int);
STAT_GETTER(blksize, int64_t, caml_copy_int64)
STAT_GETTER(nlink, int64_t, caml_copy_int64)
STAT_GETTER(uid, int64_t, caml_copy_int64)
STAT_GETTER(gid, int64_t, caml_copy_int64)
STAT_GETTER(ino, int64_t, caml_copy_int64)
STAT_GETTER(size, int64_t, caml_copy_int64)
STAT_GETTER(blocks, int64_t, caml_copy_int64)
STAT_GETTER(mode, intnat, Val_int)

#define STAT_TIME_GETTER(name,field) \
int64_t ocaml_eio_posix_stat_##name##_sec_native(value v_stat) { \
Expand All @@ -281,13 +277,13 @@ value ocaml_eio_posix_stat_##name##_nsec(value v_stat) { \
}

#ifdef __APPLE__
STAT_TIME_GETTER(atime,atimespec);
STAT_TIME_GETTER(ctime,ctimespec);
STAT_TIME_GETTER(mtime,mtimespec);
STAT_TIME_GETTER(atime,atimespec)
STAT_TIME_GETTER(ctime,ctimespec)
STAT_TIME_GETTER(mtime,mtimespec)
#else
STAT_TIME_GETTER(atime,atim);
STAT_TIME_GETTER(ctime,ctim);
STAT_TIME_GETTER(mtime,mtim);
STAT_TIME_GETTER(atime,atim)
STAT_TIME_GETTER(ctime,ctim)
STAT_TIME_GETTER(mtime,mtim)
#endif

intnat
Expand Down

0 comments on commit 7a985da

Please sign in to comment.