···4 "O_DSYNC";
5 "O_RESOLVE_BENEATH";
6 "O_PATH";
07]
89let () =
10 C.main ~name:"discover" (fun c ->
11- let c_flags = ["-D_LARGEFILE64_SOURCE"; "-D_XOPEN_SOURCE=700"; "-D_DARWIN_C_SOURCE"; "-D_GNU_SOURCE"; "-D_BSD_SOURCE"] in
12- let includes = ["sys/types.h"; "sys/stat.h"; "fcntl.h"] in
13 let extra_flags, missing_defs =
14 C.C_define.import c ~c_flags ~includes
15 C.C_define.Type.(List.map (fun name -> name, Switch) optional_flags)
···21 )
22 in
23 let present_defs =
24- C.C_define.import c ~c_flags
25- ~includes:["sys/types.h"; "sys/stat.h"; "fcntl.h"; "limits.h"]
26 C.C_define.Type.(extra_flags @ [
27 "O_RDONLY", Int;
28 "O_RDWR", Int;
···4 "O_DSYNC";
5 "O_RESOLVE_BENEATH";
6 "O_PATH";
7+ "ENOTCAPABLE";
8]
910let () =
11 C.main ~name:"discover" (fun c ->
12+ let c_flags = ["-D_LARGEFILE64_SOURCE"; "-D_XOPEN_SOURCE=700"; "-D_DARWIN_C_SOURCE"; "-D_GNU_SOURCE"; "-D_BSD_SOURCE"; "-D__BSD_VISIBLE"] in
13+ let includes = ["errno.h"; "sys/types.h"; "sys/stat.h"; "fcntl.h"; "limits.h"] in
14 let extra_flags, missing_defs =
15 C.C_define.import c ~c_flags ~includes
16 C.C_define.Type.(List.map (fun name -> name, Switch) optional_flags)
···22 )
23 in
24 let present_defs =
25+ C.C_define.import c ~c_flags ~includes
026 C.C_define.Type.(extra_flags @ [
27 "O_RDONLY", Int;
28 "O_RDWR", Int;
+5-2
lib_eio_posix/test/open_beneath.ml
···12 try Ok (L.Resolve.open_unconfined ~sw ~mode (Some dirfd) path flags) with Unix.Unix_error _ as e -> Error e in
13 let y =
14 Eio_unix.Fd.use_exn "check" dirfd @@ fun dirfd ->
15- try Ok (L.Resolve.open_beneath_fallback ~sw ~dirfd ~mode path flags) with Unix.Unix_error _ as e -> Error e
0016 in
17 match x, y with
18 | Ok x, Ok y ->
···30 if x <> y then (
31 Fmt.failwith "Different errors: %a vs %a" Fmt.exn e1 Fmt.exn e2
32 )
33- | Error _, Error _ -> assert false
034 | Error e, Ok _ -> Fmt.failwith "Only OS open failed: %a" Fmt.exn e
35 | Ok _, Error e -> Fmt.failwith "Only open_beneath failed: %a" Fmt.exn e
36
···12 try Ok (L.Resolve.open_unconfined ~sw ~mode (Some dirfd) path flags) with Unix.Unix_error _ as e -> Error e in
13 let y =
14 Eio_unix.Fd.use_exn "check" dirfd @@ fun dirfd ->
15+ try Ok (L.Resolve.open_beneath_fallback ~sw ~dirfd ~mode path flags) with
16+ | Unix.Unix_error _ as e -> Error e
17+ | Eio.Io _ as e -> Error e
18 in
19 match x, y with
20 | Ok x, Ok y ->
···32 if x <> y then (
33 Fmt.failwith "Different errors: %a vs %a" Fmt.exn e1 Fmt.exn e2
34 )
35+ | Error (Unix.Unix_error _), Error (Eio.Io (Eio.Fs.E Permission_denied _, _)) -> ()
36+ | Error e1, Error e2 -> Fmt.failwith "Multiple errors: %a vs %a" Fmt.exn e1 Fmt.exn e2
37 | Error e, Ok _ -> Fmt.failwith "Only OS open failed: %a" Fmt.exn e
38 | Ok _, Error e -> Fmt.failwith "Only open_beneath failed: %a" Fmt.exn e
39