package posix-stat

  1. Overview
  2. Docs
Bindings for posix stat

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v4.0.1.tar.gz
md5=464f431a8517dba4295286dd61f3ff2c
sha512=36d4c64987848fc06a4296c2141d250d95db0092b2d9d4d95f301f5eaada9a3df8ae9703fc8f2407596f6fb474a69863abd5e3d2c08636eb2c0dd67477d316e8

doc/src/posix-stat.types/posix_stat_types.ml.html

Source file posix_stat_types.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
open Ctypes
module Constants = Posix_stat_constants.Def (Posix_stat_generated_constants)

(* Re-export constants *)
let s_ifmt = Constants.s_ifmt
let s_ifreg = Constants.s_ifreg
let s_ifdir = Constants.s_ifdir
let s_iflnk = Constants.s_iflnk
let s_ifchr = Constants.s_ifchr
let s_ifblk = Constants.s_ifblk
let s_ififo = Constants.s_ififo
let s_ifsock = Constants.s_ifsock
let s_isuid = Constants.s_isuid
let s_isgid = Constants.s_isgid
let s_isvtx = Constants.s_isvtx
let s_irwxu = Constants.s_irwxu
let s_irusr = Constants.s_irusr
let s_iwusr = Constants.s_iwusr
let s_ixusr = Constants.s_ixusr
let s_irwxg = Constants.s_irwxg
let s_irgrp = Constants.s_irgrp
let s_iwgrp = Constants.s_iwgrp
let s_ixgrp = Constants.s_ixgrp
let s_irwxo = Constants.s_irwxo
let s_iroth = Constants.s_iroth
let s_iwoth = Constants.s_iwoth
let s_ixoth = Constants.s_ixoth
let at_fdcwd = Constants.at_fdcwd
let at_symlink_nofollow = Constants.at_symlink_nofollow
let at_removedir = Constants.at_removedir
let at_eaccess = Constants.at_eaccess

module Def (S : Cstubs.Types.TYPE) = struct
  (* Import timespec type from posix-time2 *)
  module Time2_types = Posix_time2_types.Def (S)

  module Stat = struct
    type t = unit

    let t = S.structure "stat"

    (* Required POSIX fields *)
    let st_dev = S.field t "st_dev" (S.lift_typ Posix_types.dev_t)
    let st_ino = S.field t "st_ino" (S.lift_typ Posix_types.ino_t)
    let st_mode = S.field t "st_mode" (S.lift_typ Posix_types.mode_t)
    let st_nlink = S.field t "st_nlink" (S.lift_typ Posix_types.nlink_t)
    let st_uid = S.field t "st_uid" (S.lift_typ Posix_types.uid_t)
    let st_gid = S.field t "st_gid" (S.lift_typ Posix_types.gid_t)
    let st_rdev = S.field t "st_rdev" (S.lift_typ Posix_types.dev_t)
    let st_size = S.field t "st_size" (S.lift_typ Posix_types.off_t)

    (* Timespec timestamps *)
    let st_atim = S.field t "st_atim" Time2_types.Timespec.t
    let st_mtim = S.field t "st_mtim" Time2_types.Timespec.t
    let st_ctim = S.field t "st_ctim" Time2_types.Timespec.t

    (* XSI optional fields *)
    let st_blksize = S.field t "st_blksize" (S.lift_typ Posix_types.blksize_t)
    let st_blocks = S.field t "st_blocks" (S.lift_typ Posix_types.blkcnt_t)
    let () = S.seal t
  end

  type stat = Stat.t structure

  let stat_t : stat S.typ = Stat.t
end