├── .github
└── workflows
│ ├── ci.yml
│ └── doc.yml
├── .gitignore
├── .ocamlformat
├── LICENSE
├── README.md
├── docs
├── highlight.pack.js
├── index.html
├── odoc.css
├── posix-base
│ ├── Posix_base
│ │ ├── .dune-keep
│ │ ├── Generators
│ │ │ ├── Stubs
│ │ │ │ ├── argument-1-Def
│ │ │ │ │ └── index.html
│ │ │ │ └── index.html
│ │ │ ├── Types
│ │ │ │ ├── argument-1-Def
│ │ │ │ │ └── index.html
│ │ │ │ └── index.html
│ │ │ ├── index.html
│ │ │ ├── module-type-StubsDef
│ │ │ │ └── index.html
│ │ │ └── module-type-TypesDef
│ │ │ │ └── index.html
│ │ ├── Types
│ │ │ ├── index.html
│ │ │ ├── module-type-Arithmetic
│ │ │ │ └── index.html
│ │ │ ├── module-type-Signed
│ │ │ │ ├── Infix
│ │ │ │ │ └── index.html
│ │ │ │ └── index.html
│ │ │ └── module-type-Unsigned
│ │ │ │ ├── Infix
│ │ │ │ └── index.html
│ │ │ │ └── index.html
│ │ └── index.html
│ └── index.html
├── posix-bindings
│ └── index.html
├── posix-getopt
│ ├── Posix_getopt
│ │ ├── .dune-keep
│ │ └── index.html
│ ├── Posix_getopt__
│ │ ├── .dune-keep
│ │ ├── Posix_getopt_generated_stubs
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_getopt__Posix_getopt_generated_stubs
│ │ ├── .dune-keep
│ │ └── index.html
│ ├── Posix_getopt_stubs
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ ├── Types
│ │ │ │ ├── Option
│ │ │ │ │ └── index.html
│ │ │ │ └── index.html
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_getopt_stubs__
│ │ ├── .dune-keep
│ │ ├── Posix_getopt_generated_types
│ │ │ ├── index.html
│ │ │ ├── module-type-FOREIGN
│ │ │ │ └── index.html
│ │ │ └── module-type-TYPE
│ │ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_getopt_stubs__Posix_getopt_generated_types
│ │ ├── .dune-keep
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ ├── Posix_getopt_types
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ ├── Option
│ │ │ │ └── index.html
│ │ │ └── index.html
│ │ └── index.html
│ └── index.html
├── posix-signal
│ ├── Posix_signal
│ │ ├── .dune-keep
│ │ └── index.html
│ ├── Posix_signal__
│ │ ├── .dune-keep
│ │ ├── Posix_signal_generated_stubs
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_signal__Posix_signal_generated_stubs
│ │ ├── .dune-keep
│ │ └── index.html
│ ├── Posix_signal_constants
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_signal_stubs
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ ├── Types
│ │ │ │ └── index.html
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_signal_stubs__
│ │ ├── .dune-keep
│ │ ├── Posix_signal_generated_types
│ │ │ ├── index.html
│ │ │ ├── module-type-FOREIGN
│ │ │ │ └── index.html
│ │ │ └── module-type-TYPE
│ │ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_signal_stubs__Posix_signal_generated_types
│ │ ├── .dune-keep
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ ├── Posix_signal_types
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_signal_types__
│ │ ├── .dune-keep
│ │ ├── Posix_signal_generated_constants
│ │ │ ├── index.html
│ │ │ ├── module-type-FOREIGN
│ │ │ │ └── index.html
│ │ │ └── module-type-TYPE
│ │ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_signal_types__Posix_signal_generated_constants
│ │ ├── .dune-keep
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ └── index.html
├── posix-socket-unix
│ ├── Posix_socket_unix
│ │ ├── .dune-keep
│ │ ├── SockaddrUnix
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_socket_unix__
│ │ ├── .dune-keep
│ │ ├── Posix_socket_unix_generated_types
│ │ │ ├── index.html
│ │ │ ├── module-type-FOREIGN
│ │ │ │ └── index.html
│ │ │ └── module-type-TYPE
│ │ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_socket_unix__Posix_socket_unix_generated_types
│ │ ├── .dune-keep
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ ├── Posix_socket_unix_constants
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_socket_unix_types
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ ├── SockaddrUnix
│ │ │ │ └── index.html
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_socket_unix_types__
│ │ ├── .dune-keep
│ │ ├── Posix_socket_unix_generated_constants
│ │ │ ├── index.html
│ │ │ ├── module-type-FOREIGN
│ │ │ │ └── index.html
│ │ │ └── module-type-TYPE
│ │ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_socket_unix_types__Posix_socket_unix_generated_constants
│ │ ├── .dune-keep
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ └── index.html
├── posix-socket
│ ├── Posix_socket
│ │ ├── .dune-keep
│ │ ├── Sockaddr
│ │ │ └── index.html
│ │ ├── SockaddrInet
│ │ │ └── index.html
│ │ ├── SockaddrInet6
│ │ │ └── index.html
│ │ ├── SockaddrStorage
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_socket__
│ │ ├── .dune-keep
│ │ ├── Posix_socket_generated_stubs
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_socket__Posix_socket_generated_stubs
│ │ ├── .dune-keep
│ │ └── index.html
│ ├── Posix_socket_constants
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_socket_stubs
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ ├── Types
│ │ │ │ ├── Addrinfo
│ │ │ │ │ └── index.html
│ │ │ │ ├── Servent
│ │ │ │ │ └── index.html
│ │ │ │ ├── Sockaddr
│ │ │ │ │ └── index.html
│ │ │ │ ├── SockaddrInet
│ │ │ │ │ └── index.html
│ │ │ │ ├── SockaddrInet6
│ │ │ │ │ └── index.html
│ │ │ │ ├── SockaddrStorage
│ │ │ │ │ └── index.html
│ │ │ │ └── index.html
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_socket_stubs__
│ │ ├── .dune-keep
│ │ ├── Posix_socket_generated_types
│ │ │ ├── index.html
│ │ │ ├── module-type-FOREIGN
│ │ │ │ └── index.html
│ │ │ └── module-type-TYPE
│ │ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_socket_stubs__Posix_socket_generated_types
│ │ ├── .dune-keep
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ ├── Posix_socket_types
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ ├── Addrinfo
│ │ │ │ └── index.html
│ │ │ ├── Servent
│ │ │ │ └── index.html
│ │ │ ├── Sockaddr
│ │ │ │ └── index.html
│ │ │ ├── SockaddrInet
│ │ │ │ └── index.html
│ │ │ ├── SockaddrInet6
│ │ │ │ └── index.html
│ │ │ ├── SockaddrStorage
│ │ │ │ └── index.html
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_socket_types__
│ │ ├── .dune-keep
│ │ ├── Posix_socket_generated_constants
│ │ │ ├── index.html
│ │ │ ├── module-type-FOREIGN
│ │ │ │ └── index.html
│ │ │ └── module-type-TYPE
│ │ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_socket_types__Posix_socket_generated_constants
│ │ ├── .dune-keep
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ └── index.html
├── posix-time2
│ ├── Posix_time
│ │ ├── .dune-keep
│ │ ├── Itimerspec
│ │ │ └── index.html
│ │ ├── Itimerval
│ │ │ └── index.html
│ │ ├── Timespec
│ │ │ └── index.html
│ │ ├── Timeval
│ │ │ └── index.html
│ │ ├── Tm
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time2
│ │ ├── .dune-keep
│ │ ├── Itimerspec
│ │ │ └── index.html
│ │ ├── Itimerval
│ │ │ └── index.html
│ │ ├── Timespec
│ │ │ └── index.html
│ │ ├── Timeval
│ │ │ └── index.html
│ │ ├── Tm
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time2__
│ │ ├── .dune-keep
│ │ ├── Posix_time2_generated_stubs
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time2__Posix_time2_generated_stubs
│ │ ├── .dune-keep
│ │ └── index.html
│ ├── Posix_time2_constants
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time2_stubs
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ ├── Types
│ │ │ │ ├── Itimerval
│ │ │ │ │ └── index.html
│ │ │ │ ├── Timespec
│ │ │ │ │ └── index.html
│ │ │ │ ├── Timeval
│ │ │ │ │ └── index.html
│ │ │ │ ├── Tm
│ │ │ │ │ └── index.html
│ │ │ │ └── index.html
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time2_stubs__
│ │ ├── .dune-keep
│ │ ├── Posix_time2_generated_types
│ │ │ ├── index.html
│ │ │ ├── module-type-FOREIGN
│ │ │ │ └── index.html
│ │ │ └── module-type-TYPE
│ │ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time2_stubs__Posix_time2_generated_types
│ │ ├── .dune-keep
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ ├── Posix_time2_types
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ ├── Itimerval
│ │ │ │ └── index.html
│ │ │ ├── Timespec
│ │ │ │ └── index.html
│ │ │ ├── Timeval
│ │ │ │ └── index.html
│ │ │ ├── Tm
│ │ │ │ └── index.html
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time2_types__
│ │ ├── .dune-keep
│ │ ├── Posix_time2_generated_constants
│ │ │ ├── index.html
│ │ │ ├── module-type-FOREIGN
│ │ │ │ └── index.html
│ │ │ └── module-type-TYPE
│ │ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time2_types__Posix_time2_generated_constants
│ │ ├── .dune-keep
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ ├── Posix_time__
│ │ ├── .dune-keep
│ │ ├── Posix_time_generated_stubs
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time__Posix_time_generated_stubs
│ │ ├── .dune-keep
│ │ └── index.html
│ ├── Posix_time_constants
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time_stubs
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ ├── Types
│ │ │ │ ├── Itimerval
│ │ │ │ │ └── index.html
│ │ │ │ ├── Timespec
│ │ │ │ │ └── index.html
│ │ │ │ ├── Timeval
│ │ │ │ │ └── index.html
│ │ │ │ ├── Tm
│ │ │ │ │ └── index.html
│ │ │ │ └── index.html
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time_stubs__
│ │ ├── .dune-keep
│ │ ├── Posix_time_generated_types
│ │ │ ├── index.html
│ │ │ ├── module-type-FOREIGN
│ │ │ │ └── index.html
│ │ │ └── module-type-TYPE
│ │ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time_stubs__Posix_time_generated_types
│ │ ├── .dune-keep
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ ├── Posix_time_types
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ ├── Itimerval
│ │ │ │ └── index.html
│ │ │ ├── Timespec
│ │ │ │ └── index.html
│ │ │ ├── Timeval
│ │ │ │ └── index.html
│ │ │ ├── Tm
│ │ │ │ └── index.html
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time_types__
│ │ ├── .dune-keep
│ │ ├── Posix_time_generated_constants
│ │ │ ├── index.html
│ │ │ ├── module-type-FOREIGN
│ │ │ │ └── index.html
│ │ │ └── module-type-TYPE
│ │ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_time_types__Posix_time_generated_constants
│ │ ├── .dune-keep
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ └── index.html
├── posix-types
│ ├── Posix_types
│ │ ├── .dune-keep
│ │ ├── Clock
│ │ │ └── index.html
│ │ ├── Key
│ │ │ └── index.html
│ │ ├── Pthread
│ │ │ ├── Attr
│ │ │ │ └── index.html
│ │ │ ├── Cond
│ │ │ │ └── index.html
│ │ │ ├── Condattr
│ │ │ │ └── index.html
│ │ │ ├── Key
│ │ │ │ └── index.html
│ │ │ ├── Mutex
│ │ │ │ └── index.html
│ │ │ ├── Mutexattr
│ │ │ │ └── index.html
│ │ │ ├── Once
│ │ │ │ └── index.html
│ │ │ ├── Rwlock
│ │ │ │ └── index.html
│ │ │ ├── Rwlockattr
│ │ │ │ └── index.html
│ │ │ ├── T
│ │ │ │ └── index.html
│ │ │ └── index.html
│ │ ├── Time
│ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_types__
│ │ ├── .dune-keep
│ │ ├── Posix_types_generated_constants
│ │ │ ├── index.html
│ │ │ ├── module-type-FOREIGN
│ │ │ │ └── index.html
│ │ │ └── module-type-TYPE
│ │ │ │ └── index.html
│ │ └── index.html
│ ├── Posix_types__Posix_types_generated_constants
│ │ ├── .dune-keep
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ ├── Posix_types_constants
│ │ ├── .dune-keep
│ │ ├── Def
│ │ │ └── index.html
│ │ └── index.html
│ └── index.html
└── posix-uname
│ ├── Posix_uname
│ ├── .dune-keep
│ └── index.html
│ ├── Posix_uname__
│ ├── .dune-keep
│ ├── Posix_uname_generated_stubs
│ │ └── index.html
│ └── index.html
│ ├── Posix_uname__Posix_uname_generated_stubs
│ ├── .dune-keep
│ └── index.html
│ ├── Posix_uname_constants
│ ├── .dune-keep
│ ├── Def
│ │ └── index.html
│ └── index.html
│ ├── Posix_uname_stubs
│ ├── .dune-keep
│ ├── Def
│ │ ├── Types
│ │ │ ├── Utsname
│ │ │ │ └── index.html
│ │ │ └── index.html
│ │ └── index.html
│ └── index.html
│ ├── Posix_uname_stubs__
│ ├── .dune-keep
│ ├── Posix_uname_generated_types
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ └── index.html
│ ├── Posix_uname_stubs__Posix_uname_generated_types
│ ├── .dune-keep
│ ├── index.html
│ ├── module-type-FOREIGN
│ │ └── index.html
│ └── module-type-TYPE
│ │ └── index.html
│ ├── Posix_uname_types
│ ├── .dune-keep
│ ├── Def
│ │ ├── Utsname
│ │ │ └── index.html
│ │ └── index.html
│ └── index.html
│ ├── Posix_uname_types__
│ ├── .dune-keep
│ ├── Posix_uname_generated_constants
│ │ ├── index.html
│ │ ├── module-type-FOREIGN
│ │ │ └── index.html
│ │ └── module-type-TYPE
│ │ │ └── index.html
│ └── index.html
│ ├── Posix_uname_types__Posix_uname_generated_constants
│ ├── .dune-keep
│ ├── index.html
│ ├── module-type-FOREIGN
│ │ └── index.html
│ └── module-type-TYPE
│ │ └── index.html
│ └── index.html
├── dune
├── dune-project
├── posix-base.opam
├── posix-base
├── CHANGES
└── src
│ ├── dune
│ ├── posix_base.ml
│ └── posix_base.mli
├── posix-bindings.opam
├── posix-getopt.opam
├── posix-getopt.opam.template
├── posix-getopt
├── CHANGES
├── README.md
├── src
│ ├── config
│ │ ├── discover.ml
│ │ └── dune
│ ├── dune
│ ├── generator
│ │ ├── dune
│ │ ├── gen_stubs.ml
│ │ └── gen_types_c.ml
│ ├── posix_getopt.ml
│ ├── posix_getopt.mli
│ ├── stubs
│ │ ├── dune
│ │ └── posix_getopt_stubs.ml
│ └── types
│ │ ├── dune
│ │ ├── posix_getopt_types.ml
│ │ └── posix_getopt_types.mli
└── test
│ ├── dune
│ └── test.ml
├── posix-math2.opam
├── posix-math2
├── CHANGES
└── src
│ ├── constants
│ ├── dune
│ └── posix_math_constants.ml
│ ├── dune
│ ├── generator
│ ├── dune
│ ├── gen_constants_c.ml
│ ├── gen_stubs.ml
│ └── gen_types_c.ml
│ ├── posix_math.ml
│ ├── posix_math.mli
│ ├── stubs
│ ├── dune
│ └── posix_math_stubs.ml
│ └── types
│ ├── dune
│ └── posix_math_types.ml
├── posix-signal.opam
├── posix-signal.opam.template
├── posix-signal
├── CHANGES
├── src
│ ├── constants
│ │ ├── dune
│ │ └── posix_signal_constants.ml
│ ├── dune
│ ├── generator
│ │ ├── dune
│ │ ├── gen_constants_c.ml
│ │ ├── gen_stubs.ml
│ │ └── gen_types_c.ml
│ ├── posix_signal.ml
│ ├── posix_signal.mli
│ ├── stubs
│ │ ├── dune
│ │ └── posix_signal_stubs.ml
│ └── types
│ │ ├── dune
│ │ ├── posix_signal_types.ml
│ │ └── posix_signal_types.mli
└── test
│ ├── dune
│ └── test.ml
├── posix-socket-unix.opam
├── posix-socket-unix.opam.template
├── posix-socket-unix
├── CHANGES
├── README.md
├── src
│ ├── constants
│ │ ├── dune
│ │ └── posix_socket_unix_constants.ml
│ ├── dune
│ ├── generator
│ │ ├── dune
│ │ ├── gen_constants_c.ml
│ │ └── gen_types_c.ml
│ ├── posix_socket_unix.ml
│ ├── posix_socket_unix.mli
│ └── types
│ │ ├── dune
│ │ ├── posix_socket_unix_types.ml
│ │ └── posix_socket_unix_types.mli
└── test
│ ├── dune
│ └── test.ml
├── posix-socket.opam
├── posix-socket
├── CHANGES
├── README.md
├── examples
│ ├── dune
│ └── getaddrinfo.ml
├── src
│ ├── config
│ │ ├── discover.ml
│ │ └── dune
│ ├── constants
│ │ ├── dune
│ │ └── posix_socket_constants.ml
│ ├── dune
│ ├── generator
│ │ ├── dune
│ │ ├── exec.sh
│ │ ├── gen_constants_c.ml
│ │ ├── gen_stubs.ml
│ │ └── gen_types_c.ml
│ ├── posix_socket.ml
│ ├── posix_socket.mli
│ ├── posix_socket_stubs.c
│ ├── stubs
│ │ ├── dune
│ │ └── posix_socket_stubs.ml
│ └── types
│ │ ├── dune
│ │ ├── posix_socket_types.ml
│ │ └── posix_socket_types.mli
└── test
│ ├── dune
│ └── test.ml
├── posix-time2.opam
├── posix-time2.opam.template
├── posix-time2
├── CHANGES
├── README.md
├── src
│ ├── constants
│ │ ├── dune
│ │ └── posix_time2_constants.ml
│ ├── dune
│ ├── generator
│ │ ├── dune
│ │ ├── gen_constants_c.ml
│ │ ├── gen_stubs.ml
│ │ └── gen_types_c.ml
│ ├── posix_time2.ml
│ ├── posix_time2.mli
│ ├── stubs
│ │ ├── dune
│ │ └── posix_time2_stubs.ml
│ └── types
│ │ ├── dune
│ │ ├── posix_time2_types.ml
│ │ └── posix_time2_types.mli
└── test
│ ├── dune
│ └── test.ml
├── posix-types.opam
├── posix-types.opam.template
├── posix-types
├── CHANGES
└── src
│ ├── constants
│ ├── dune
│ └── posix_types_constants.ml
│ ├── dune
│ ├── generator
│ ├── dune
│ └── gen_constants_c.ml
│ ├── posix_types.ml
│ └── posix_types.mli
├── posix-uname.opam
├── posix-uname.opam.template
└── posix-uname
├── CHANGES
├── src
├── constants
│ ├── dune
│ └── posix_uname_constants.ml
├── dune
├── generator
│ ├── dune
│ ├── gen_constants_c.ml
│ ├── gen_stubs.ml
│ └── gen_types_c.ml
├── posix_uname.ml
├── posix_uname.mli
├── stubs
│ ├── dune
│ └── posix_uname_stubs.ml
└── types
│ ├── dune
│ ├── posix_uname_types.ml
│ └── posix_uname_types.mli
└── test
├── dune
└── test.ml
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on:
4 | pull_request:
5 | push:
6 | branches:
7 | - main
8 |
9 | concurrency:
10 | group: ${{ github.workflow }}-${{ github.ref }}
11 | cancel-in-progress: true
12 |
13 | jobs:
14 | build:
15 | runs-on: ${{ matrix.os }}
16 | strategy:
17 | fail-fast: false
18 | matrix:
19 | os: [ubuntu-latest, macos-latest]
20 | steps:
21 | - name: Build and test module
22 | uses: savonet/build-and-test-ocaml-module@main
23 |
--------------------------------------------------------------------------------
/.github/workflows/doc.yml:
--------------------------------------------------------------------------------
1 | name: Doc build
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 |
8 | jobs:
9 | build_doc:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - name: Checkout code
13 | uses: actions/checkout@v1
14 | - name: Setup OCaml
15 | uses: ocaml/setup-ocaml@v3
16 | with:
17 | ocaml-compiler: 4.14.x
18 | - name: Pin locally
19 | run: opam pin -y add --no-action .
20 | - name: Install locally
21 | run: opam install -y --with-doc .
22 | - name: Build doc
23 | run: opam exec dune build @doc
24 | - name: Deploy doc
25 | uses: JamesIves/github-pages-deploy-action@4.1.4
26 | with:
27 | branch: gh-pages
28 | folder: _build/default/_doc/_html
29 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | _build
3 | *.byte
4 | *.native
5 | _tests
6 | .merlin
7 | *.install
8 | .*.sw*
9 |
--------------------------------------------------------------------------------
/.ocamlformat:
--------------------------------------------------------------------------------
1 | version=0.27.0
2 | profile = conventional
3 | break-separators = after
4 | space-around-lists = false
5 | doc-comments = before
6 | match-indent = 2
7 | match-indent-nested = always
8 | parens-ite
9 | exp-grouping = preserve
10 | module-item-spacing = compact
11 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2020 Romain Beauxis
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | index
5 |
6 |
7 |
8 |
9 |
10 |
11 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/docs/posix-base/Posix_base/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-base/Posix_base/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-base/Posix_base/Generators/Stubs/argument-1-Def/index.html:
--------------------------------------------------------------------------------
1 |
2 | 1-Def (posix-base.Posix_base.Generators.Stubs.1-Def)module Stubs : Cstubs.BINDINGS
val concurrency : Cstubs.concurrency_policy
val prefix : string
--------------------------------------------------------------------------------
/docs/posix-base/Posix_base/Generators/Stubs/index.html:
--------------------------------------------------------------------------------
1 |
2 | Stubs (posix-base.Posix_base.Generators.Stubs)Parameters
Signature
val gen : unit -> unit
--------------------------------------------------------------------------------
/docs/posix-base/Posix_base/Generators/Types/argument-1-Def/index.html:
--------------------------------------------------------------------------------
1 |
2 | 1-Def (posix-base.Posix_base.Generators.Types.1-Def)module Types : Cstubs.Types.BINDINGS
--------------------------------------------------------------------------------
/docs/posix-base/Posix_base/Generators/Types/index.html:
--------------------------------------------------------------------------------
1 |
2 | Types (posix-base.Posix_base.Generators.Types)Parameters
Signature
val gen : unit -> unit
--------------------------------------------------------------------------------
/docs/posix-base/Posix_base/Generators/module-type-StubsDef/index.html:
--------------------------------------------------------------------------------
1 |
2 | StubsDef (posix-base.Posix_base.Generators.StubsDef)module Stubs : Cstubs.BINDINGS
val concurrency : Cstubs.concurrency_policy
val prefix : string
--------------------------------------------------------------------------------
/docs/posix-base/Posix_base/Generators/module-type-TypesDef/index.html:
--------------------------------------------------------------------------------
1 |
2 | TypesDef (posix-base.Posix_base.Generators.TypesDef)module Types : Cstubs.Types.BINDINGS
--------------------------------------------------------------------------------
/docs/posix-base/Posix_base/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_base (posix-base.Posix_base)module Generators : sig ... end
Module used to define stubs generators. See: Posix_uname_stubs
and Posix_uname_constants
For some examples.
module Types : sig ... end
Module used to define generic types using their size. See Posix_types
for an example.
--------------------------------------------------------------------------------
/docs/posix-base/index.html:
--------------------------------------------------------------------------------
1 |
2 | index (posix-base.index)posix-base index
Library posix-base
The entry point of this library is the module: Posix_base
.
--------------------------------------------------------------------------------
/docs/posix-bindings/index.html:
--------------------------------------------------------------------------------
1 |
2 | index (posix-bindings.index)posix-bindings index
--------------------------------------------------------------------------------
/docs/posix-getopt/Posix_getopt/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-getopt/Posix_getopt/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-getopt/Posix_getopt__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-getopt/Posix_getopt__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-getopt/Posix_getopt__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_getopt__ (posix-getopt.Posix_getopt__)
--------------------------------------------------------------------------------
/docs/posix-getopt/Posix_getopt__Posix_getopt_generated_stubs/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-getopt/Posix_getopt__Posix_getopt_generated_stubs/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-getopt/Posix_getopt_stubs/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-getopt/Posix_getopt_stubs/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-getopt/Posix_getopt_stubs/Def/Types/index.html:
--------------------------------------------------------------------------------
1 |
2 | Types (posix-getopt.Posix_getopt_stubs.Def.Types)
--------------------------------------------------------------------------------
/docs/posix-getopt/Posix_getopt_stubs/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_getopt_stubs (posix-getopt.Posix_getopt_stubs)module Def : functor (F : Cstubs.FOREIGN) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-getopt/Posix_getopt_stubs__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-getopt/Posix_getopt_stubs__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-getopt/Posix_getopt_stubs__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_getopt_stubs__ (posix-getopt.Posix_getopt_stubs__)
--------------------------------------------------------------------------------
/docs/posix-getopt/Posix_getopt_stubs__Posix_getopt_generated_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-getopt/Posix_getopt_stubs__Posix_getopt_generated_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-getopt/Posix_getopt_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-getopt/Posix_getopt_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-getopt/Posix_getopt_types/Def/index.html:
--------------------------------------------------------------------------------
1 |
2 | Def (posix-getopt.Posix_getopt_types.Def)
--------------------------------------------------------------------------------
/docs/posix-getopt/Posix_getopt_types/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_getopt_types (posix-getopt.Posix_getopt_types)module Def : functor (S : Cstubs.Types.TYPE) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-getopt/index.html:
--------------------------------------------------------------------------------
1 |
2 | index (posix-getopt.index)posix-getopt index
Library posix-getopt
The entry point of this library is the module: Posix_getopt
.
Library posix-getopt.stubs
The entry point of this library is the module: Posix_getopt_stubs
.
Library posix-getopt.types
The entry point of this library is the module: Posix_getopt_types
.
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-signal/Posix_signal/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-signal/Posix_signal__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_signal__ (posix-signal.Posix_signal__)
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal__Posix_signal_generated_stubs/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-signal/Posix_signal__Posix_signal_generated_stubs/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-signal/Posix_signal_constants/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal_constants/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_signal_constants (posix-signal.Posix_signal_constants)Module Posix_signal_constants
module Def : functor (S : Cstubs.Types.TYPE) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal_stubs/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-signal/Posix_signal_stubs/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal_stubs/Def/Types/index.html:
--------------------------------------------------------------------------------
1 |
2 | Types (posix-signal.Posix_signal_stubs.Def.Types)
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal_stubs/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_signal_stubs (posix-signal.Posix_signal_stubs)module Def : functor (F : Cstubs.FOREIGN) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal_stubs__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-signal/Posix_signal_stubs__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal_stubs__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_signal_stubs__ (posix-signal.Posix_signal_stubs__)
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal_stubs__Posix_signal_generated_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-signal/Posix_signal_stubs__Posix_signal_generated_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-signal/Posix_signal_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal_types/Def/index.html:
--------------------------------------------------------------------------------
1 |
2 | Def (posix-signal.Posix_signal_types.Def)Parameters
Signature
type sigset_t
val sigset_t : sigset_t Ctypes.typ
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal_types__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-signal/Posix_signal_types__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal_types__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_signal_types__ (posix-signal.Posix_signal_types__)
--------------------------------------------------------------------------------
/docs/posix-signal/Posix_signal_types__Posix_signal_generated_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-signal/Posix_signal_types__Posix_signal_generated_constants/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket-unix/Posix_socket_unix/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket-unix/Posix_socket_unix/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket-unix/Posix_socket_unix__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket-unix/Posix_socket_unix__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket-unix/Posix_socket_unix__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_socket_unix__ (posix-socket-unix.Posix_socket_unix__)
--------------------------------------------------------------------------------
/docs/posix-socket-unix/Posix_socket_unix__Posix_socket_unix_generated_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket-unix/Posix_socket_unix__Posix_socket_unix_generated_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket-unix/Posix_socket_unix_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket-unix/Posix_socket_unix_constants/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket-unix/Posix_socket_unix_constants/Def/index.html:
--------------------------------------------------------------------------------
1 |
2 | Def (posix-socket-unix.Posix_socket_unix_constants.Def)Parameters
Signature
val af_unix : int S.const
val sun_path_len : int S.const
--------------------------------------------------------------------------------
/docs/posix-socket-unix/Posix_socket_unix_constants/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_socket_unix_constants (posix-socket-unix.Posix_socket_unix_constants)module Def : functor (S : Cstubs.Types.TYPE) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-socket-unix/Posix_socket_unix_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket-unix/Posix_socket_unix_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket-unix/Posix_socket_unix_types/Def/index.html:
--------------------------------------------------------------------------------
1 |
2 | Def (posix-socket-unix.Posix_socket_unix_types.Def)Parameters
Signature
type sockaddr_un
= SockaddrUnix.t Ctypes.structure
val sockaddr_un_t : sockaddr_un S.typ
--------------------------------------------------------------------------------
/docs/posix-socket-unix/Posix_socket_unix_types/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_socket_unix_types (posix-socket-unix.Posix_socket_unix_types)val af_unix : Posix_socket_types.sa_family_t
val sun_path_len : int
module Def : functor (S : Cstubs.Types.TYPE) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-socket-unix/Posix_socket_unix_types__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket-unix/Posix_socket_unix_types__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket-unix/Posix_socket_unix_types__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_socket_unix_types__ (posix-socket-unix.Posix_socket_unix_types__)
--------------------------------------------------------------------------------
/docs/posix-socket-unix/Posix_socket_unix_types__Posix_socket_unix_generated_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket-unix/Posix_socket_unix_types__Posix_socket_unix_generated_constants/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket-unix/index.html:
--------------------------------------------------------------------------------
1 |
2 | index (posix-socket-unix.index)posix-socket-unix index
Library posix-socket-unix
The entry point of this library is the module: Posix_socket_unix
.
Library posix-socket-unix.constants
The entry point of this library is the module: Posix_socket_unix_constants
.
Library posix-socket-unix.types
The entry point of this library is the module: Posix_socket_unix_types
.
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket/Posix_socket/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket/SockaddrStorage/index.html:
--------------------------------------------------------------------------------
1 |
2 | SockaddrStorage (posix-socket.Posix_socket.SockaddrStorage)type t
val t : t Ctypes.structure Ctypes.typ
val ss_family : (sa_family_t, t Ctypes.structure) Ctypes.field
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket/Posix_socket__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_socket__ (posix-socket.Posix_socket__)
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket__Posix_socket_generated_stubs/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket/Posix_socket__Posix_socket_generated_stubs/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket/Posix_socket_constants/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_constants/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_socket_constants (posix-socket.Posix_socket_constants)Module Posix_socket_constants
module Def : functor (S : Cstubs.Types.TYPE) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_stubs/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket/Posix_socket_stubs/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_stubs/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_socket_stubs (posix-socket.Posix_socket_stubs)module Def : functor (F : Cstubs.FOREIGN) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_stubs__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket/Posix_socket_stubs__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_stubs__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_socket_stubs__ (posix-socket.Posix_socket_stubs__)
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_stubs__Posix_socket_generated_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket/Posix_socket_stubs__Posix_socket_generated_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket/Posix_socket_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_types/Def/Servent/index.html:
--------------------------------------------------------------------------------
1 |
2 | Servent (posix-socket.Posix_socket_types.Def.Servent)type t
val t : t Ctypes.structure S.typ
val s_port : (Unsigned.uint16, t Ctypes.structure) S.field
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_types/Def/Sockaddr/index.html:
--------------------------------------------------------------------------------
1 |
2 | Sockaddr (posix-socket.Posix_socket_types.Def.Sockaddr)type t
val t : t Ctypes.structure S.typ
val sa_family : (sa_family_t, t Ctypes.structure) S.field
val sa_data : (char Ctypes.carray, t Ctypes.structure) S.field
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_types/Def/SockaddrStorage/index.html:
--------------------------------------------------------------------------------
1 |
2 | SockaddrStorage (posix-socket.Posix_socket_types.Def.SockaddrStorage)type t
val t : t Ctypes.structure S.typ
val ss_family : (sa_family_t, t Ctypes.structure) S.field
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_types__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket/Posix_socket_types__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_types__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_socket_types__ (posix-socket.Posix_socket_types__)
--------------------------------------------------------------------------------
/docs/posix-socket/Posix_socket_types__Posix_socket_generated_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-socket/Posix_socket_types__Posix_socket_generated_constants/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time/Itimerspec/index.html:
--------------------------------------------------------------------------------
1 |
2 | Itimerspec (posix-time2.Posix_time.Itimerspec)
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time/Itimerval/index.html:
--------------------------------------------------------------------------------
1 |
2 | Itimerval (posix-time2.Posix_time.Itimerval)
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time2/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2/Itimerspec/index.html:
--------------------------------------------------------------------------------
1 |
2 | Itimerspec (posix-time2.Posix_time2.Itimerspec)
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2/Itimerval/index.html:
--------------------------------------------------------------------------------
1 |
2 | Itimerval (posix-time2.Posix_time2.Itimerval)
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time2__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_time2__ (posix-time2.Posix_time2__)
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2__Posix_time2_generated_stubs/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time2__Posix_time2_generated_stubs/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time2_constants/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2_constants/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_time2_constants (posix-time2.Posix_time2_constants)Module Posix_time2_constants
module Def : functor (S : Cstubs.Types.TYPE) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2_stubs/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time2_stubs/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2_stubs/Def/Types/index.html:
--------------------------------------------------------------------------------
1 |
2 | Types (posix-time2.Posix_time2_stubs.Def.Types)
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2_stubs/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_time2_stubs (posix-time2.Posix_time2_stubs)module Def : functor (F : Cstubs.FOREIGN) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2_stubs__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time2_stubs__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2_stubs__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_time2_stubs__ (posix-time2.Posix_time2_stubs__)
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2_stubs__Posix_time2_generated_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time2_stubs__Posix_time2_generated_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time2_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2_types/Def/Timespec/index.html:
--------------------------------------------------------------------------------
1 |
2 | Timespec (posix-time2.Posix_time2_types.Def.Timespec)type t
val t : t Ctypes.structure S.typ
val tv_sec : (Posix_types.time_t, t Ctypes.structure) S.field
val tv_nsec : (Signed.long, t Ctypes.structure) S.field
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2_types__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time2_types__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2_types__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_time2_types__ (posix-time2.Posix_time2_types__)
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time2_types__Posix_time2_generated_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time2_types__Posix_time2_generated_constants/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_time__ (posix-time2.Posix_time__)
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time__Posix_time_generated_stubs/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time__Posix_time_generated_stubs/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time_constants/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time_constants/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_time_constants (posix-time2.Posix_time_constants)Module Posix_time_constants
module Def : functor (S : Cstubs.Types.TYPE) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time_stubs/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time_stubs/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time_stubs/Def/Types/index.html:
--------------------------------------------------------------------------------
1 |
2 | Types (posix-time2.Posix_time_stubs.Def.Types)
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time_stubs/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_time_stubs (posix-time2.Posix_time_stubs)module Def : functor (F : Cstubs.FOREIGN) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time_stubs__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time_stubs__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time_stubs__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_time_stubs__ (posix-time2.Posix_time_stubs__)
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time_stubs__Posix_time_generated_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time_stubs__Posix_time_generated_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time_types/Def/Timespec/index.html:
--------------------------------------------------------------------------------
1 |
2 | Timespec (posix-time2.Posix_time_types.Def.Timespec)type t
val t : t Ctypes.structure S.typ
val tv_sec : (Posix_types.time_t, t Ctypes.structure) S.field
val tv_nsec : (Signed.long, t Ctypes.structure) S.field
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time_types__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time_types__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time_types__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_time_types__ (posix-time2.Posix_time_types__)
--------------------------------------------------------------------------------
/docs/posix-time2/Posix_time_types__Posix_time_generated_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-time2/Posix_time_types__Posix_time_generated_constants/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-types/Posix_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types/Pthread/Attr/index.html:
--------------------------------------------------------------------------------
1 |
2 | Attr (posix-types.Posix_types.Pthread.Attr)type t
val t : t Ctypes.typ
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types/Pthread/Cond/index.html:
--------------------------------------------------------------------------------
1 |
2 | Cond (posix-types.Posix_types.Pthread.Cond)type t
val t : t Ctypes.typ
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types/Pthread/Condattr/index.html:
--------------------------------------------------------------------------------
1 |
2 | Condattr (posix-types.Posix_types.Pthread.Condattr)type t
val t : t Ctypes.typ
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types/Pthread/Key/index.html:
--------------------------------------------------------------------------------
1 |
2 | Key (posix-types.Posix_types.Pthread.Key)type t
val t : t Ctypes.typ
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types/Pthread/Mutex/index.html:
--------------------------------------------------------------------------------
1 |
2 | Mutex (posix-types.Posix_types.Pthread.Mutex)type t
val t : t Ctypes.typ
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types/Pthread/Mutexattr/index.html:
--------------------------------------------------------------------------------
1 |
2 | Mutexattr (posix-types.Posix_types.Pthread.Mutexattr)type t
val t : t Ctypes.typ
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types/Pthread/Once/index.html:
--------------------------------------------------------------------------------
1 |
2 | Once (posix-types.Posix_types.Pthread.Once)type t
val t : t Ctypes.typ
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types/Pthread/Rwlock/index.html:
--------------------------------------------------------------------------------
1 |
2 | Rwlock (posix-types.Posix_types.Pthread.Rwlock)type t
val t : t Ctypes.typ
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types/Pthread/Rwlockattr/index.html:
--------------------------------------------------------------------------------
1 |
2 | Rwlockattr (posix-types.Posix_types.Pthread.Rwlockattr)type t
val t : t Ctypes.typ
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types/Pthread/T/index.html:
--------------------------------------------------------------------------------
1 |
2 | T (posix-types.Posix_types.Pthread.T)type t
val t : t Ctypes.typ
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-types/Posix_types__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_types__ (posix-types.Posix_types__)
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types__Posix_types_generated_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-types/Posix_types__Posix_types_generated_constants/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-types/Posix_types_constants/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-types/Posix_types_constants/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_types_constants (posix-types.Posix_types_constants)Module Posix_types_constants
val number_types : string list
val abstract_types : string list
module Def : functor (S : Cstubs.Types.TYPE) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-types/index.html:
--------------------------------------------------------------------------------
1 |
2 | index (posix-types.index)posix-types index
Library posix-types
The entry point of this library is the module: Posix_types
.
Library posix-types.constants
The entry point of this library is the module: Posix_types_constants
.
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-uname/Posix_uname/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-uname/Posix_uname__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_uname__ (posix-uname.Posix_uname__)
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname__Posix_uname_generated_stubs/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-uname/Posix_uname__Posix_uname_generated_stubs/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-uname/Posix_uname_constants/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_constants/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_uname_constants (posix-uname.Posix_uname_constants)Module Posix_uname_constants
module Def : functor (S : Cstubs.Types.TYPE) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_stubs/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-uname/Posix_uname_stubs/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_stubs/Def/Types/index.html:
--------------------------------------------------------------------------------
1 |
2 | Types (posix-uname.Posix_uname_stubs.Def.Types)
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_stubs/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_uname_stubs (posix-uname.Posix_uname_stubs)module Def : functor (F : Cstubs.FOREIGN) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_stubs__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-uname/Posix_uname_stubs__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_stubs__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_uname_stubs__ (posix-uname.Posix_uname_stubs__)
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_stubs__Posix_uname_generated_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-uname/Posix_uname_stubs__Posix_uname_generated_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_types/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-uname/Posix_uname_types/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_types/Def/index.html:
--------------------------------------------------------------------------------
1 |
2 | Def (posix-uname.Posix_uname_types.Def)Parameters
Signature
module Utsname : sig ... end
Ctypes type for struct utsname
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_types/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_uname_types (posix-uname.Posix_uname_types)module Def : functor (S : Cstubs.Types.TYPE) -> sig ... end
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_types__/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-uname/Posix_uname_types__/.dune-keep
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_types__/index.html:
--------------------------------------------------------------------------------
1 |
2 | Posix_uname_types__ (posix-uname.Posix_uname_types__)
--------------------------------------------------------------------------------
/docs/posix-uname/Posix_uname_types__Posix_uname_generated_constants/.dune-keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/savonet/ocaml-posix/13995b70153cfa01635e98e1a5a0a4939f48e285/docs/posix-uname/Posix_uname_types__Posix_uname_generated_constants/.dune-keep
--------------------------------------------------------------------------------
/dune:
--------------------------------------------------------------------------------
1 | (rule
2 | (alias upload-doc)
3 | (deps
4 | (alias doc))
5 | (action
6 | (progn
7 | (run cp -rf _doc/_html/ ../../docs)
8 | (run git commit ../../docs -m "Update docs")
9 | (run git push origin master))))
10 |
--------------------------------------------------------------------------------
/posix-base.opam:
--------------------------------------------------------------------------------
1 | # This file is generated by dune, edit dune-project instead
2 | opam-version: "2.0"
3 | version: "2.2.0"
4 | synopsis: "Base module for the posix bindings"
5 | description: "posix-base provides base tools for the posix binding modules."
6 | maintainer: ["romain.beauxis@gmail.com"]
7 | authors: ["Romain Beauxis"]
8 | license: "MIT"
9 | homepage: "https://github.com/savonet/ocaml-posix"
10 | bug-reports: "https://github.com/savonet/ocaml-posix/issues"
11 | depends: [
12 | "dune" {>= "2.9"}
13 | "ocaml" {>= "4.08"}
14 | "integers"
15 | "ctypes" {>= "0.14.0"}
16 | "odoc" {with-doc}
17 | ]
18 | build: [
19 | ["dune" "subst"] {dev}
20 | [
21 | "dune"
22 | "build"
23 | "-p"
24 | name
25 | "-j"
26 | jobs
27 | "--promote-install-files=false"
28 | "@install"
29 | "@runtest" {with-test}
30 | "@doc" {with-doc}
31 | ]
32 | ["dune" "install" "-p" name "--create-install-files" name]
33 | ]
34 | dev-repo: "git+https://github.com/savonet/ocaml-posix.git"
35 |
--------------------------------------------------------------------------------
/posix-base/CHANGES:
--------------------------------------------------------------------------------
1 | 2.2.0 (2025-01-30)
2 | =====
3 | * Fix copy code in `getaddrinfo`.
4 |
5 | 2.1.0 (2025-01-16)
6 | =====
7 | * Added `posix-math2`
8 | * Invoke `wine64` only when available.
9 | * Added `sockaddr_len` in `ocaml-posix`.
10 | * Add support for string and optional `port.
11 | * Add support for `hints`.
12 |
13 | 2.0.2 (2023-02-08)
14 | =====
15 | **posix-time2**
16 | * Added `clock_nanosleep`
17 |
--------------------------------------------------------------------------------
/posix-base/src/dune:
--------------------------------------------------------------------------------
1 | (library
2 | (name posix_base)
3 | (public_name posix-base)
4 | (synopsis
5 | "posix-base provides the base tools to generate the various posix bindings")
6 | (libraries ctypes.stubs integers))
7 |
--------------------------------------------------------------------------------
/posix-bindings.opam:
--------------------------------------------------------------------------------
1 | # This file is generated by dune, edit dune-project instead
2 | opam-version: "2.0"
3 | version: "3"
4 | synopsis: "POSIX bindings"
5 | description: "install all available posix bindings"
6 | maintainer: ["romain.beauxis@gmail.com"]
7 | authors: ["Romain Beauxis"]
8 | license: "MIT"
9 | homepage: "https://github.com/savonet/ocaml-posix"
10 | bug-reports: "https://github.com/savonet/ocaml-posix/issues"
11 | depends: [
12 | "dune" {>= "2.9"}
13 | "posix-types"
14 | "posix-socket"
15 | "posix-socket-unix"
16 | "posix-uname"
17 | "posix-math2"
18 | "posix-getopt"
19 | "odoc" {with-doc}
20 | ]
21 | build: [
22 | ["dune" "subst"] {dev}
23 | [
24 | "dune"
25 | "build"
26 | "-p"
27 | name
28 | "-j"
29 | jobs
30 | "--promote-install-files=false"
31 | "@install"
32 | "@runtest" {with-test}
33 | "@doc" {with-doc}
34 | ]
35 | ["dune" "install" "-p" name "--create-install-files" name]
36 | ]
37 | dev-repo: "git+https://github.com/savonet/ocaml-posix.git"
38 |
--------------------------------------------------------------------------------
/posix-getopt.opam:
--------------------------------------------------------------------------------
1 | # This file is generated by dune, edit dune-project instead
2 | opam-version: "2.0"
3 | version: "2.2.0"
4 | synopsis: "Bindings for posix getopt/getopt_long"
5 | description:
6 | "posix-getopt provides a simple interface for the POSIX getopt and its extensions, getopt_long and getopt_long_only."
7 | maintainer: ["romain.beauxis@gmail.com"]
8 | authors: ["Romain Beauxis"]
9 | license: "MIT"
10 | homepage: "https://github.com/savonet/ocaml-posix"
11 | bug-reports: "https://github.com/savonet/ocaml-posix/issues"
12 | depends: [
13 | "dune" {>= "2.9"}
14 | "dune-configurator"
15 | "ounit2" {with-test}
16 | "process" {with-test}
17 | "posix-uname" {with-test & = version}
18 | "ctypes"
19 | "posix-base" {= version}
20 | "unix-errno"
21 | "odoc" {with-doc}
22 | ]
23 | build: [
24 | ["dune" "subst"] {dev}
25 | [
26 | "dune"
27 | "build"
28 | "-p"
29 | name
30 | "-j"
31 | jobs
32 | "--promote-install-files=false"
33 | "@install"
34 | "@runtest" {with-test}
35 | "@doc" {with-doc}
36 | ]
37 | ["dune" "install" "-p" name "--create-install-files" name]
38 | ]
39 | dev-repo: "git+https://github.com/savonet/ocaml-posix.git"
40 | available: os != "win32" & os != "bsd"
41 |
--------------------------------------------------------------------------------
/posix-getopt.opam.template:
--------------------------------------------------------------------------------
1 | available: os != "win32" & os != "bsd"
2 |
--------------------------------------------------------------------------------
/posix-getopt/CHANGES:
--------------------------------------------------------------------------------
1 | 2.2.0 (2025-01-30)
2 | =====
3 | * Fix copy code in `getaddrinfo`.
4 |
5 | 2.1.0 (2025-01-16)
6 | =====
7 | * Added `posix-math2`
8 | * Invoke `wine64` only when available.
9 | * Added `sockaddr_len` in `ocaml-posix`.
10 | * Add support for string and optional `port.
11 | * Add support for `hints`.
12 |
13 | 2.0.2 (2023-02-08)
14 | =====
15 | **posix-time2**
16 | * Added `clock_nanosleep`
17 |
--------------------------------------------------------------------------------
/posix-getopt/README.md:
--------------------------------------------------------------------------------
1 | # posix-getopt
2 |
3 | This module provides a simple interface for the POSIX `getopt` and its extensions,` getopt_long` and `getopt_long_only`.
4 |
--------------------------------------------------------------------------------
/posix-getopt/src/config/discover.ml:
--------------------------------------------------------------------------------
1 | module C = Configurator.V1
2 |
3 | let has_getopt_h_code = {|
4 | #include
5 |
6 | int main()
7 | {
8 | return 0;
9 | }
10 | |}
11 |
12 | let has_optreset_code =
13 | {|
14 | #include
15 |
16 | int main()
17 | {
18 | int foo = optreset;
19 | return 0;
20 | }
21 | |}
22 |
23 | let has_get_getopt_long_code =
24 | {|
25 | #include
26 | #include
27 |
28 | int main()
29 | {
30 | int ret = getopt_long(0, NULL, NULL, NULL, NULL);
31 | return 0;
32 | }
33 | |}
34 |
35 | let has_get_getopt_long_only_code =
36 | {|
37 | #include
38 | #include
39 |
40 | int main()
41 | {
42 | int ret = getopt_long_only(0, NULL, NULL, NULL, NULL);
43 | return 0;
44 | }
45 | |}
46 |
47 | let () =
48 | C.main ~name:"posix_getopt" (fun c ->
49 | let has_getopt_h = C.c_test c has_getopt_h_code in
50 | let has_optreset = C.c_test c has_optreset_code in
51 | let has_get_getopt_long = C.c_test c has_get_getopt_long_code in
52 | let has_get_getopt_long_only = C.c_test c has_get_getopt_long_only_code in
53 |
54 | C.C_define.gen_header_file c ~fname:"config.h"
55 | [
56 | ("HAS_GETOPT_H", Switch has_getopt_h);
57 | ("HAS_OPTRESET", Switch has_optreset);
58 | ("HAS_GETOPT_LONG", Switch has_get_getopt_long);
59 | ("HAS_GETOPT_LONG_ONLY", Switch has_get_getopt_long_only);
60 | ])
61 |
--------------------------------------------------------------------------------
/posix-getopt/src/config/dune:
--------------------------------------------------------------------------------
1 | (executable
2 | (name discover)
3 | (libraries dune.configurator))
4 |
--------------------------------------------------------------------------------
/posix-getopt/src/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_getopt)
8 | (public_name posix-getopt)
9 | (synopsis
10 | "posix-getopt provides access to the features exposed in unistd.h")
11 | (foreign_stubs
12 | (language c)
13 | (names posix_getopt_generated_stubs))
14 | (libraries ctypes unix-errno.unix posix-getopt.stubs))
15 |
16 | (rule
17 | (targets posix_getopt_generated_stubs.ml)
18 | (action
19 | (run ./generator/gen_stubs.exe ml %{targets})))
20 |
21 | (rule
22 | (targets posix_getopt_generated_stubs.c)
23 | (deps config.h)
24 | (action
25 | (run ./generator/gen_stubs.exe c %{targets})))
26 |
27 | (rule
28 | (targets config.h)
29 | (action
30 | (run ./config/discover.exe)))
31 |
--------------------------------------------------------------------------------
/posix-getopt/src/generator/dune:
--------------------------------------------------------------------------------
1 | (executable
2 | (name gen_stubs)
3 | (modules gen_stubs)
4 | (libraries posix-getopt.stubs posix-base))
5 |
6 | (executable
7 | (name gen_types_c)
8 | (modules gen_types_c)
9 | (libraries posix-getopt.types posix-base))
10 |
11 | (rule
12 | (targets gen_types.c)
13 | (deps config.h)
14 | (action
15 | (run ./gen_types_c.exe %{targets})))
16 |
17 | (rule
18 | (targets config.h)
19 | (action
20 | (run ../config/discover.exe)))
21 |
22 | (rule
23 | (targets gen_types_c)
24 | (deps
25 | (:c_code ./gen_types.c))
26 | (action
27 | (run
28 | %{ocaml-config:c_compiler}
29 | -I
30 | %{lib:ctypes:}
31 | -I
32 | %{ocaml-config:standard_library}
33 | -o
34 | %{targets}
35 | %{c_code})))
36 |
--------------------------------------------------------------------------------
/posix-getopt/src/generator/gen_stubs.ml:
--------------------------------------------------------------------------------
1 | module Stubs = Posix_base.Generators.Stubs (struct
2 | module Stubs = Posix_getopt_stubs.Def
3 |
4 | let c_headers =
5 | {|
6 | #include
7 | #include
8 | #include
9 |
10 | #include "config.h"
11 |
12 | #ifdef HAS_GETOPT_H
13 | #include
14 | #else
15 | struct option {
16 | char *name;
17 | int has_arg;
18 | int *flag;
19 | int val;
20 | };
21 | #endif
22 |
23 | static int *getoptind() {
24 | return &optind;
25 | }
26 |
27 | static int *getopterr() {
28 | return &opterr;
29 | }
30 |
31 | static char *getoptopt() {
32 | return (char *)&optopt;
33 | }
34 |
35 | static int *getoptreset() {
36 | #ifdef HAS_OPTRESET
37 | return &optreset;
38 | #else
39 | return NULL;
40 | #endif
41 | }
42 |
43 | static char *getoptarg() {
44 | return optarg;
45 | }
46 |
47 | #ifndef HAS_GETOPT_LONG
48 | static int has_getopt_long() {
49 | return 0;
50 | }
51 |
52 | int getopt_long(int x, char **y, const char *z, const struct option *t, int *u) {
53 | errno = ENOSYS;
54 | return 0;
55 | }
56 | #else
57 | static int has_getopt_long() {
58 | return 1;
59 | }
60 | #endif
61 |
62 | #ifndef HAS_GETOPT_LONG_ONLY
63 | static int has_getopt_long_only() {
64 | return 0;
65 | }
66 |
67 | int getopt_long_only(int x, char **y, const char *z, const struct option *t, int *u) {
68 | errno = ENOSYS;
69 | return 0;
70 | }
71 | #else
72 | static int has_getopt_long_only() {
73 | return 1;
74 | }
75 | #endif
76 | |}
77 |
78 | let concurrency = Cstubs.unlocked
79 | let prefix = "posix_getopt"
80 | end)
81 |
82 | let () = Stubs.gen ()
83 |
--------------------------------------------------------------------------------
/posix-getopt/src/generator/gen_types_c.ml:
--------------------------------------------------------------------------------
1 | module Types = Posix_base.Generators.Types (struct
2 | module Types = Posix_getopt_types.Def
3 |
4 | let c_headers =
5 | {|
6 | #include "config.h"
7 |
8 | #ifdef HAS_GETOPT_H
9 | #include
10 | #else
11 | struct option {
12 | char *name;
13 | int has_arg;
14 | int *flag;
15 | int val;
16 | };
17 | #endif
18 | |}
19 | end)
20 |
21 | let () = Types.gen ()
22 |
--------------------------------------------------------------------------------
/posix-getopt/src/posix_getopt.mli:
--------------------------------------------------------------------------------
1 | type short = char
2 | type long = string * char
3 |
4 | type arg =
5 | [ `None of unit -> unit
6 | | `Optional of string option -> unit
7 | | `Required of string -> unit ]
8 |
9 | type 'a opt = { name : 'a; arg : arg }
10 |
11 | exception Unknown_option of string
12 | exception Missing_argument of char
13 |
14 | val has_getopt_long : bool
15 | val has_getopt_long_only : bool
16 | val print_error : bool -> unit
17 | val reset : unit -> unit
18 | val getopt : string array -> short opt list -> string array
19 | val getopt_long : string array -> long opt list -> string array
20 | val getopt_long_only : string array -> long opt list -> string array
21 |
--------------------------------------------------------------------------------
/posix-getopt/src/stubs/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_getopt_stubs)
8 | (public_name posix-getopt.stubs)
9 | (libraries posix-getopt.types ctypes.stubs))
10 |
11 | (rule
12 | (targets posix_getopt_generated_types.ml)
13 | (action
14 | (with-stdout-to
15 | %{targets}
16 | (run ../generator/gen_types_c))))
17 |
--------------------------------------------------------------------------------
/posix-getopt/src/stubs/posix_getopt_stubs.ml:
--------------------------------------------------------------------------------
1 | open Ctypes
2 |
3 | module Def (F : Cstubs.FOREIGN) = struct
4 | open F
5 | module Types = Posix_getopt_types.Def (Posix_getopt_generated_types)
6 | include Types
7 |
8 | let const_string_ptr = typedef (ptr string) "char * const *"
9 |
10 | let getopt =
11 | foreign "getopt" (int @-> const_string_ptr @-> string @-> returning int)
12 |
13 | let has_getopt_long = foreign "has_getopt_long" (void @-> returning bool)
14 |
15 | let getopt_long =
16 | foreign "getopt_long"
17 | (int @-> const_string_ptr @-> string @-> ptr Option.t @-> ptr int
18 | @-> returning int)
19 |
20 | let has_getopt_long_only =
21 | foreign "has_getopt_long_only" (void @-> returning bool)
22 |
23 | let getopt_long_only =
24 | foreign "getopt_long_only"
25 | (int @-> const_string_ptr @-> string @-> ptr Option.t @-> ptr int
26 | @-> returning int)
27 |
28 | let getoptarg = foreign "getoptarg" (void @-> returning (ptr char))
29 | let getoptind = foreign "getoptind" (void @-> returning (ptr int))
30 | let getopterr = foreign "getopterr" (void @-> returning (ptr int))
31 | let getoptopt = foreign "getoptopt" (void @-> returning (ptr char))
32 | let getoptreset = foreign "getoptreset" (void @-> returning (ptr int))
33 | let strlen = foreign "strlen" (ptr char @-> returning int)
34 | end
35 |
--------------------------------------------------------------------------------
/posix-getopt/src/types/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_getopt_types)
8 | (public_name posix-getopt.types)
9 | (libraries posix-base ctypes.stubs))
10 |
--------------------------------------------------------------------------------
/posix-getopt/src/types/posix_getopt_types.ml:
--------------------------------------------------------------------------------
1 | module Def (S : Cstubs.Types.TYPE) = struct
2 | module Option = struct
3 | type t = unit
4 |
5 | let t = S.structure "option"
6 | let name = S.field t "name" S.string
7 | let has_arg = S.field t "has_arg" S.int
8 | let flag = S.field t "flag" (S.ptr S.int)
9 | let _val = S.field t "val" S.int
10 | let () = S.seal t
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/posix-getopt/src/types/posix_getopt_types.mli:
--------------------------------------------------------------------------------
1 | open Ctypes
2 |
3 | module Def (S : Cstubs.Types.TYPE) : sig
4 | module Option : sig
5 | type t
6 |
7 | val t : t structure S.typ
8 | val name : (string, t structure) S.field
9 | val has_arg : (int, t structure) S.field
10 | val flag : (int ptr, t structure) S.field
11 | val _val : (int, t structure) S.field
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/posix-getopt/test/dune:
--------------------------------------------------------------------------------
1 | (test
2 | (name test)
3 | (package posix-getopt)
4 | (libraries process posix-uname posix-getopt ounit2))
5 |
--------------------------------------------------------------------------------
/posix-math2.opam:
--------------------------------------------------------------------------------
1 | # This file is generated by dune, edit dune-project instead
2 | opam-version: "2.0"
3 | version: "2.2.0"
4 | synopsis: "Bindings for posix math"
5 | description:
6 | "posix-math2 provides a simple interface for POSIX math functions."
7 | maintainer: ["romain.beauxis@gmail.com"]
8 | authors: ["Romain Beauxis"]
9 | license: "MIT"
10 | homepage: "https://github.com/savonet/ocaml-posix"
11 | bug-reports: "https://github.com/savonet/ocaml-posix/issues"
12 | depends: [
13 | "dune" {>= "2.9"}
14 | "ctypes"
15 | "posix-base" {= version}
16 | "unix-errno"
17 | "odoc" {with-doc}
18 | ]
19 | build: [
20 | ["dune" "subst"] {dev}
21 | [
22 | "dune"
23 | "build"
24 | "-p"
25 | name
26 | "-j"
27 | jobs
28 | "--promote-install-files=false"
29 | "@install"
30 | "@runtest" {with-test}
31 | "@doc" {with-doc}
32 | ]
33 | ["dune" "install" "-p" name "--create-install-files" name]
34 | ]
35 | dev-repo: "git+https://github.com/savonet/ocaml-posix.git"
36 |
--------------------------------------------------------------------------------
/posix-math2/CHANGES:
--------------------------------------------------------------------------------
1 | 2.2.0 (2025-01-30)
2 | =====
3 | * Fix copy code in `getaddrinfo`.
4 |
5 | 2.1.0 (2025-01-16)
6 | =====
7 | * Added `posix-math2`
8 | * Invoke `wine64` only when available.
9 | * Added `sockaddr_len` in `ocaml-posix`.
10 | * Add support for string and optional `port.
11 | * Add support for `hints`.
12 |
13 | 2.0.2 (2023-02-08)
14 | =====
15 | **posix-time2**
16 | * Added `clock_nanosleep`
17 |
--------------------------------------------------------------------------------
/posix-math2/src/constants/dune:
--------------------------------------------------------------------------------
1 | (library
2 | (name posix_math_constants)
3 | (public_name posix-math2.constants)
4 | (libraries ctypes.stubs))
5 |
--------------------------------------------------------------------------------
/posix-math2/src/constants/posix_math_constants.ml:
--------------------------------------------------------------------------------
1 | module Def (S : Cstubs.Types.TYPE) = struct
2 | let sizeof_float_t = S.constant "SIZEOF_FLOAT_T" S.int
3 | let alignof_float_t = S.constant "ALIGNOF_FLOAT_T" S.int
4 | let sizeof_double_t = S.constant "SIZEOF_DOUBLE_T" S.int
5 | let alignof_double_t = S.constant "ALIGNOF_DOUBLE_T" S.int
6 | let fp_infinite = S.constant "FP_INFINITE" S.int
7 | let fp_nan = S.constant "FP_NAN" S.int
8 | let fp_normal = S.constant "FP_NORMAL" S.int
9 | let fp_subnormal = S.constant "FP_SUBNORMAL" S.int
10 | let fp_zero = S.constant "FP_ZERO" S.int
11 | end
12 |
--------------------------------------------------------------------------------
/posix-math2/src/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_math)
8 | (public_name posix-math2)
9 | (synopsis "posix-math2 provides access to the features exposed in math.h")
10 | (foreign_stubs
11 | (language c)
12 | (names posix_math_generated_stubs))
13 | (libraries unix unix-errno.unix ctypes posix-math2.types posix-math2.stubs))
14 |
15 | (rule
16 | (targets posix_math_generated_stubs.ml)
17 | (action
18 | (run ./generator/gen_stubs.exe ml %{targets})))
19 |
20 | (rule
21 | (targets posix_math_generated_stubs.c)
22 | (action
23 | (run ./generator/gen_stubs.exe c %{targets})))
24 |
--------------------------------------------------------------------------------
/posix-math2/src/generator/dune:
--------------------------------------------------------------------------------
1 | (executable
2 | (name gen_stubs)
3 | (modules gen_stubs)
4 | (libraries posix-math2.stubs posix-base))
5 |
6 | (executable
7 | (name gen_types_c)
8 | (modules gen_types_c)
9 | (libraries posix-math2.types posix-base))
10 |
11 | (rule
12 | (targets gen_types.c)
13 | (action
14 | (run ./gen_types_c.exe %{targets})))
15 |
16 | (rule
17 | (targets gen_types_c)
18 | (deps
19 | (:c_code ./gen_types.c))
20 | (action
21 | (run
22 | %{ocaml-config:c_compiler}
23 | -I
24 | %{lib:ctypes:}
25 | -I
26 | %{ocaml-config:standard_library}
27 | -o
28 | %{targets}
29 | %{c_code})))
30 |
31 | (executable
32 | (name gen_constants_c)
33 | (modules gen_constants_c)
34 | (libraries posix-math2.constants posix-base))
35 |
36 | (rule
37 | (targets gen_constants.c)
38 | (action
39 | (run ./gen_constants_c.exe %{targets})))
40 |
41 | (rule
42 | (targets gen_constants_c)
43 | (deps
44 | (:c_code ./gen_constants.c))
45 | (action
46 | (run
47 | %{ocaml-config:c_compiler}
48 | -I
49 | %{lib:ctypes:}
50 | -I
51 | %{ocaml-config:standard_library}
52 | -o
53 | %{targets}
54 | %{c_code})))
55 |
--------------------------------------------------------------------------------
/posix-math2/src/generator/gen_constants_c.ml:
--------------------------------------------------------------------------------
1 | module Types = Posix_base.Generators.Types (struct
2 | module Types = Posix_math_constants.Def
3 |
4 | let c_headers =
5 | {|
6 | #include
7 | #include
8 |
9 | #define SIZEOF_FLOAT_T sizeof(float_t)
10 | #define ALIGNOF_FLOAT_T alignof(float_t)
11 | #define SIZEOF_DOUBLE_T sizeof(double_t)
12 | #define ALIGNOF_DOUBLE_T alignof(double_t)
13 | |}
14 | end)
15 |
16 | let () = Types.gen ()
17 |
--------------------------------------------------------------------------------
/posix-math2/src/generator/gen_stubs.ml:
--------------------------------------------------------------------------------
1 | module Stubs = Posix_base.Generators.Stubs (struct
2 | module Stubs = Posix_math_stubs.Def
3 |
4 | let c_headers =
5 | {|
6 | #include
7 |
8 | double ocaml_posix_math_huge_val() {
9 | return HUGE_VAL;
10 | }
11 |
12 | float ocaml_posix_math_huge_valf() {
13 | return HUGE_VALF;
14 | }
15 |
16 | long double ocaml_posix_math_huge_vall() {
17 | return HUGE_VALL;
18 | }
19 |
20 | float ocaml_posix_math_infinity() {
21 | return INFINITY;
22 | }
23 |
24 | float ocaml_posix_math_nan() {
25 | return NAN;
26 | }
27 |
28 | int *ocaml_posix_math_signgam() {
29 | return &signgam;
30 | }
31 |
32 | double ocaml_posix_math_m_e() {
33 | return M_E;
34 | };
35 |
36 | double ocaml_posix_math_m_log2e() {
37 | return M_LOG2E;
38 | };
39 |
40 | double ocaml_posix_math_m_log10e() {
41 | return M_LOG10E;
42 | };
43 |
44 | double ocaml_posix_math_m_ln2() {
45 | return M_LN2;
46 | };
47 |
48 | double ocaml_posix_math_m_ln10() {
49 | return M_LN10;
50 | };
51 |
52 | double ocaml_posix_math_m_pi() {
53 | return M_PI;
54 | };
55 |
56 | double ocaml_posix_math_m_pi_2() {
57 | return M_PI_2;
58 | };
59 |
60 | double ocaml_posix_math_m_pi_4() {
61 | return M_PI_4;
62 | };
63 |
64 | double ocaml_posix_math_m_1_pi() {
65 | return M_1_PI;
66 | };
67 |
68 | double ocaml_posix_math_m_2_pi() {
69 | return M_2_PI;
70 | };
71 |
72 | double ocaml_posix_math_m_2_sqrtpi() {
73 | return M_2_SQRTPI;
74 | };
75 |
76 | double ocaml_posix_math_m_sqrt2() {
77 | return M_SQRT2;
78 | };
79 |
80 | double ocaml_posix_math_m_sqrt1_2() {
81 | return M_SQRT1_2;
82 | };
83 | |}
84 |
85 | let concurrency = Cstubs.unlocked
86 | let prefix = "posix_math"
87 | end)
88 |
89 | let () = Stubs.gen ()
90 |
--------------------------------------------------------------------------------
/posix-math2/src/generator/gen_types_c.ml:
--------------------------------------------------------------------------------
1 | module Types = Posix_base.Generators.Types (struct
2 | module Types = Posix_math_types.Def
3 |
4 | let c_headers = {|
5 | #include
6 | |}
7 | end)
8 |
9 | let () = Types.gen ()
10 |
--------------------------------------------------------------------------------
/posix-math2/src/posix_math.ml:
--------------------------------------------------------------------------------
1 | include Posix_math_stubs.Def (Posix_math_generated_stubs)
2 |
3 | type fp_type = [ `Infinite | `NaN | `Normal | `Subnormal | `Zero ]
4 |
5 | let fpclassify f =
6 | match fpclassify f with
7 | | x when x = fp_infinite -> Some `Infinite
8 | | x when x = fp_nan -> Some `NaN
9 | | x when x = fp_normal -> Some `Normal
10 | | x when x = fp_subnormal -> Some `Subnormal
11 | | x when x = fp_zero -> Some `Zero
12 | | _ -> None
13 |
14 | let huge_val = huge_val ()
15 | let huge_valf = huge_valf ()
16 | let huge_vall = huge_vall ()
17 | let infinity = infinity ()
18 | let nan_constant = nan_constant ()
19 | let signgam = signgam ()
20 | let m_e = m_e ()
21 | let m_log2e = m_log2e ()
22 | let m_log10e = m_log10e ()
23 | let m_ln2 = m_ln2 ()
24 | let m_ln10 = m_ln10 ()
25 | let m_pi = m_pi ()
26 | let m_pi_2 = m_pi_2 ()
27 | let m_pi_4 = m_pi_4 ()
28 | let m_1_pi = m_1_pi ()
29 | let m_2_pi = m_2_pi ()
30 | let m_2_sqrtpi = m_2_sqrtpi ()
31 | let m_sqrt2 = m_sqrt2 ()
32 | let m_sqrt1_2 = m_sqrt1_2 ()
33 |
--------------------------------------------------------------------------------
/posix-math2/src/stubs/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_math_stubs)
8 | (public_name posix-math2.stubs)
9 | (libraries posix-math2.types ctypes.stubs))
10 |
11 | (rule
12 | (targets posix_math_generated_types.ml)
13 | (action
14 | (with-stdout-to
15 | %{targets}
16 | (run ../generator/gen_types_c))))
17 |
--------------------------------------------------------------------------------
/posix-math2/src/types/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_math_types)
8 | (public_name posix-math2.types)
9 | (libraries posix-math2.constants posix-base ctypes.stubs))
10 |
11 | (rule
12 | (targets posix_math_generated_constants.ml)
13 | (action
14 | (with-stdout-to
15 | %{targets}
16 | (run ../generator/gen_constants_c))))
17 |
--------------------------------------------------------------------------------
/posix-math2/src/types/posix_math_types.ml:
--------------------------------------------------------------------------------
1 | module Constants = Posix_math_constants.Def (Posix_math_generated_constants)
2 |
3 | module Def (S : Cstubs.Types.TYPE) = struct
4 | include Constants
5 |
6 | let float_t = S.typedef S.float "float_t"
7 | let double_t = S.typedef S.double "double_t"
8 | end
9 |
--------------------------------------------------------------------------------
/posix-signal.opam:
--------------------------------------------------------------------------------
1 | # This file is generated by dune, edit dune-project instead
2 | opam-version: "2.0"
3 | version: "2.2.0"
4 | synopsis: "Bindings for the types defined in "
5 | description:
6 | "posix-signal provides an API to the types and bindings defined in "
7 | maintainer: ["romain.beauxis@gmail.com"]
8 | authors: ["Romain Beauxis"]
9 | license: "MIT"
10 | homepage: "https://github.com/savonet/ocaml-posix"
11 | bug-reports: "https://github.com/savonet/ocaml-posix/issues"
12 | depends: [
13 | "dune" {>= "2.9"}
14 | "posix-base" {= version}
15 | "ctypes"
16 | "unix-errno"
17 | "odoc" {with-doc}
18 | ]
19 | build: [
20 | ["dune" "subst"] {dev}
21 | [
22 | "dune"
23 | "build"
24 | "-p"
25 | name
26 | "-j"
27 | jobs
28 | "--promote-install-files=false"
29 | "@install"
30 | "@runtest" {with-test}
31 | "@doc" {with-doc}
32 | ]
33 | ["dune" "install" "-p" name "--create-install-files" name]
34 | ]
35 | dev-repo: "git+https://github.com/savonet/ocaml-posix.git"
36 | available: os != "win32"
37 |
--------------------------------------------------------------------------------
/posix-signal.opam.template:
--------------------------------------------------------------------------------
1 | available: os != "win32"
2 |
--------------------------------------------------------------------------------
/posix-signal/CHANGES:
--------------------------------------------------------------------------------
1 | 2.2.0 (2025-01-30)
2 | =====
3 | * Fix copy code in `getaddrinfo`.
4 |
5 | 2.1.0 (2025-01-16)
6 | =====
7 | * Added `posix-math2`
8 | * Invoke `wine64` only when available.
9 | * Added `sockaddr_len` in `ocaml-posix`.
10 | * Add support for string and optional `port.
11 | * Add support for `hints`.
12 |
13 | 2.0.2 (2023-02-08)
14 | =====
15 | **posix-time2**
16 | * Added `clock_nanosleep`
17 |
--------------------------------------------------------------------------------
/posix-signal/src/constants/dune:
--------------------------------------------------------------------------------
1 | (library
2 | (name posix_signal_constants)
3 | (public_name posix-signal.constants)
4 | (libraries ctypes.stubs))
5 |
--------------------------------------------------------------------------------
/posix-signal/src/constants/posix_signal_constants.ml:
--------------------------------------------------------------------------------
1 | module Def (S : Cstubs.Types.TYPE) = struct
2 | let sigset_size = S.constant "SIGSET_SIZE" S.int
3 | let sigset_alignment = S.constant "SIGSET_ALIGNMENT" S.int
4 | let sig_block = S.constant "SIG_BLOCK" S.int
5 | let sig_setmask = S.constant "SIG_SETMASK" S.int
6 | let sig_unblock = S.constant "SIG_UNBLOCK" S.int
7 | let sigabrt = S.constant "SIGABRT" S.int
8 | let sigalrm = S.constant "SIGALRM" S.int
9 | let sigbus = S.constant "SIGBUS" S.int
10 | let sigchld = S.constant "SIGCHLD" S.int
11 | let sigcont = S.constant "SIGCONT" S.int
12 | let sigfpe = S.constant "SIGFPE" S.int
13 | let sighup = S.constant "SIGHUP" S.int
14 | let sigill = S.constant "SIGILL" S.int
15 | let sigint = S.constant "SIGINT" S.int
16 | let sigkill = S.constant "SIGKILL" S.int
17 | let sigpipe = S.constant "SIGPIPE" S.int
18 | let sigquit = S.constant "SIGQUIT" S.int
19 | let sigsegv = S.constant "SIGSEGV" S.int
20 | let sigstop = S.constant "SIGSTOP" S.int
21 | let sigterm = S.constant "SIGTERM" S.int
22 | let sigtstp = S.constant "SIGTSTP" S.int
23 | let sigttin = S.constant "SIGTTIN" S.int
24 | let sigttou = S.constant "SIGTTOU" S.int
25 | let sigusr1 = S.constant "SIGUSR1" S.int
26 | let sigusr2 = S.constant "SIGUSR2" S.int
27 | let sigtrap = S.constant "SIGTRAP" S.int
28 | let sigurg = S.constant "SIGURG" S.int
29 | let sigxcpu = S.constant "SIGXCPU" S.int
30 | let sigxfsz = S.constant "SIGXFSZ" S.int
31 | end
32 |
--------------------------------------------------------------------------------
/posix-signal/src/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_signal)
8 | (public_name posix-signal)
9 | (synopsis
10 | "posix-signal provides access to the features exposed in signal.h")
11 | (foreign_stubs
12 | (language c)
13 | (names posix_signal_generated_stubs))
14 | (c_library_flags %{ocaml-config:bytecomp_c_libraries})
15 | (libraries
16 | unix
17 | unix-errno.unix
18 | ctypes
19 | posix-signal.types
20 | posix-signal.stubs))
21 |
22 | (rule
23 | (targets posix_signal_generated_stubs.ml)
24 | (action
25 | (run ./generator/gen_stubs.exe ml %{targets})))
26 |
27 | (rule
28 | (targets posix_signal_generated_stubs.c)
29 | (action
30 | (run ./generator/gen_stubs.exe c %{targets})))
31 |
--------------------------------------------------------------------------------
/posix-signal/src/generator/dune:
--------------------------------------------------------------------------------
1 | (executable
2 | (name gen_stubs)
3 | (modules gen_stubs)
4 | (libraries posix-signal.stubs posix-base))
5 |
6 | (executable
7 | (name gen_types_c)
8 | (modules gen_types_c)
9 | (libraries posix-signal.types posix-base))
10 |
11 | (rule
12 | (targets gen_types.c)
13 | (action
14 | (run ./gen_types_c.exe %{targets})))
15 |
16 | (rule
17 | (targets gen_types_c)
18 | (deps
19 | (:c_code ./gen_types.c))
20 | (action
21 | (run
22 | %{ocaml-config:c_compiler}
23 | -I
24 | %{lib:ctypes:}
25 | -I
26 | %{ocaml-config:standard_library}
27 | -o
28 | %{targets}
29 | %{c_code})))
30 |
31 | (executable
32 | (name gen_constants_c)
33 | (modules gen_constants_c)
34 | (libraries posix-signal.constants posix-base))
35 |
36 | (rule
37 | (targets gen_constants.c)
38 | (action
39 | (run ./gen_constants_c.exe %{targets})))
40 |
41 | (rule
42 | (targets gen_constants_c)
43 | (deps
44 | (:c_code ./gen_constants.c))
45 | (action
46 | (run
47 | %{ocaml-config:c_compiler}
48 | -I
49 | %{lib:ctypes:}
50 | -I
51 | %{ocaml-config:standard_library}
52 | -o
53 | %{targets}
54 | %{c_code})))
55 |
--------------------------------------------------------------------------------
/posix-signal/src/generator/gen_constants_c.ml:
--------------------------------------------------------------------------------
1 | module Types = Posix_base.Generators.Types (struct
2 | module Types = Posix_signal_constants.Def
3 |
4 | let c_headers =
5 | {|
6 | #include
7 |
8 | #define SIGSET_SIZE sizeof(sigset_t)
9 | #define SIGSET_ALIGNMENT offsetof(struct { char c; sigset_t x; }, x)
10 | |}
11 | end)
12 |
13 | let () = Types.gen ()
14 |
--------------------------------------------------------------------------------
/posix-signal/src/generator/gen_stubs.ml:
--------------------------------------------------------------------------------
1 | module Stubs = Posix_base.Generators.Stubs (struct
2 | module Stubs = Posix_signal_stubs.Def
3 |
4 | let c_headers = {|
5 | #include
6 | |}
7 |
8 | let concurrency = Cstubs.unlocked
9 | let prefix = "posix_signal"
10 | end)
11 |
12 | let () = Stubs.gen ()
13 |
--------------------------------------------------------------------------------
/posix-signal/src/generator/gen_types_c.ml:
--------------------------------------------------------------------------------
1 | module Types = Posix_base.Generators.Types (struct
2 | module Types = Posix_signal_types.Def
3 |
4 | let c_headers = {|
5 | #include
6 | |}
7 | end)
8 |
9 | let () = Types.gen ()
10 |
--------------------------------------------------------------------------------
/posix-signal/src/posix_signal.mli:
--------------------------------------------------------------------------------
1 | (** Bindings to *)
2 |
3 | type sigset
4 |
5 | type signal =
6 | [ `Sigabrt
7 | | `Sigalrm
8 | | `Sigbus
9 | | `Sigchld
10 | | `Sigcont
11 | | `Sigfpe
12 | | `Sighup
13 | | `Sigill
14 | | `Sigint
15 | | `Sigkill
16 | | `Sigpipe
17 | | `Sigquit
18 | | `Sigsegv
19 | | `Sigstop
20 | | `Sigterm
21 | | `Sigtstp
22 | | `Sigttin
23 | | `Sigttou
24 | | `Sigusr1
25 | | `Sigusr2
26 | | `Sigtrap
27 | | `Sigurg
28 | | `Sigxcpu
29 | | `Sigxfsz ]
30 |
31 | type action = [ `Sig_block | `Sig_setmask | `Sig_unblock ]
32 |
33 | val sigemptyset : unit -> sigset
34 | val sigaddset : sigset -> signal -> unit
35 | val sigismember : sigset -> signal -> bool
36 | val pthread_sigmask : action -> sigset option -> sigset
37 | val sigprocmask : action -> sigset option -> sigset
38 |
--------------------------------------------------------------------------------
/posix-signal/src/stubs/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_signal_stubs)
8 | (public_name posix-signal.stubs)
9 | (libraries posix-signal.types ctypes.stubs))
10 |
11 | (rule
12 | (targets posix_signal_generated_types.ml)
13 | (action
14 | (with-stdout-to
15 | %{targets}
16 | (run ../generator/gen_types_c))))
17 |
--------------------------------------------------------------------------------
/posix-signal/src/stubs/posix_signal_stubs.ml:
--------------------------------------------------------------------------------
1 | open Ctypes
2 |
3 | module Def (F : Cstubs.FOREIGN) = struct
4 | open F
5 | module Types = Posix_signal_types.Def (Posix_signal_generated_types)
6 | open Types
7 |
8 | let sigemptyset = foreign "sigemptyset" (ptr sigset_t @-> returning int)
9 | let sigaddset = foreign "sigaddset" (ptr sigset_t @-> int @-> returning int)
10 |
11 | let sigismember =
12 | foreign "sigismember" (ptr sigset_t @-> int @-> returning int)
13 |
14 | let pthread_sigmask =
15 | foreign "pthread_sigmask"
16 | (int @-> ptr sigset_t @-> ptr sigset_t @-> returning int)
17 |
18 | let sigprocmask =
19 | foreign "sigprocmask"
20 | (int @-> ptr sigset_t @-> ptr sigset_t @-> returning int)
21 | end
22 |
--------------------------------------------------------------------------------
/posix-signal/src/types/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_signal_types)
8 | (public_name posix-signal.types)
9 | (libraries posix-signal.constants posix-base ctypes.stubs))
10 |
11 | (rule
12 | (targets posix_signal_generated_constants.ml)
13 | (action
14 | (with-stdout-to
15 | %{targets}
16 | (run ../generator/gen_constants_c))))
17 |
--------------------------------------------------------------------------------
/posix-signal/src/types/posix_signal_types.ml:
--------------------------------------------------------------------------------
1 | module Constants = Posix_signal_constants.Def (Posix_signal_generated_constants)
2 | include Constants
3 |
4 | module Def (S : Cstubs.Types.TYPE) = struct
5 | open Ctypes
6 |
7 | type sigset_t = unit Ctypes.abstract
8 |
9 | let sigset_t =
10 | abstract ~name:"sigset_t" ~size:sigset_size ~alignment:sigset_alignment
11 | end
12 |
--------------------------------------------------------------------------------
/posix-signal/src/types/posix_signal_types.mli:
--------------------------------------------------------------------------------
1 | (** Ctypes types for *)
2 |
3 | val sigabrt : int
4 | val sigalrm : int
5 | val sigbus : int
6 | val sigchld : int
7 | val sigcont : int
8 | val sigfpe : int
9 | val sighup : int
10 | val sigill : int
11 | val sigint : int
12 | val sigkill : int
13 | val sigpipe : int
14 | val sigquit : int
15 | val sigsegv : int
16 | val sigstop : int
17 | val sigterm : int
18 | val sigtstp : int
19 | val sigttin : int
20 | val sigttou : int
21 | val sigusr1 : int
22 | val sigusr2 : int
23 | val sigtrap : int
24 | val sigurg : int
25 | val sigxcpu : int
26 | val sigxfsz : int
27 | val sig_block : int
28 | val sig_setmask : int
29 | val sig_unblock : int
30 |
31 | module Def (_ : Cstubs.Types.TYPE) : sig
32 | type sigset_t
33 |
34 | val sigset_t : sigset_t Ctypes.typ
35 | end
36 |
--------------------------------------------------------------------------------
/posix-signal/test/dune:
--------------------------------------------------------------------------------
1 | (test
2 | (name test)
3 | (package posix-signal)
4 | (libraries posix-signal))
5 |
--------------------------------------------------------------------------------
/posix-signal/test/test.ml:
--------------------------------------------------------------------------------
1 | open Posix_signal
2 |
3 | let () =
4 | let sigset = sigemptyset () in
5 | sigaddset sigset `Sigint;
6 | ignore (sigprocmask `Sig_setmask (Some sigset));
7 | let old_mask = sigprocmask `Sig_setmask None in
8 | assert (sigismember old_mask `Sigint)
9 |
--------------------------------------------------------------------------------
/posix-socket-unix.opam:
--------------------------------------------------------------------------------
1 | # This file is generated by dune, edit dune-project instead
2 | opam-version: "2.0"
3 | version: "3.0.0"
4 | synopsis: "Bindings for posix sockets"
5 | description:
6 | "posix-socket-unix provides unix-specific types and bindings for posix sockets."
7 | maintainer: ["romain.beauxis@gmail.com"]
8 | authors: ["Romain Beauxis"]
9 | license: "MIT"
10 | homepage: "https://github.com/savonet/ocaml-posix"
11 | bug-reports: "https://github.com/savonet/ocaml-posix/issues"
12 | depends: [
13 | "dune" {>= "2.9"}
14 | "ctypes"
15 | "posix-base" {>= "2.2"}
16 | "posix-socket" {= version}
17 | "unix-errno"
18 | "odoc" {with-doc}
19 | ]
20 | build: [
21 | ["dune" "subst"] {dev}
22 | [
23 | "dune"
24 | "build"
25 | "-p"
26 | name
27 | "-j"
28 | jobs
29 | "--promote-install-files=false"
30 | "@install"
31 | "@runtest" {with-test}
32 | "@doc" {with-doc}
33 | ]
34 | ["dune" "install" "-p" name "--create-install-files" name]
35 | ]
36 | dev-repo: "git+https://github.com/savonet/ocaml-posix.git"
37 | available: os != "win32"
38 |
--------------------------------------------------------------------------------
/posix-socket-unix.opam.template:
--------------------------------------------------------------------------------
1 | available: os != "win32"
2 |
--------------------------------------------------------------------------------
/posix-socket-unix/CHANGES:
--------------------------------------------------------------------------------
1 | 3.0.0 (2025-04-20)
2 | =====
3 | * Adapt to new `posix-socket` API
4 |
5 | 2.2.0 (2025-01-30)
6 | =====
7 | * Fix copy code in `getaddrinfo`.
8 |
9 | 2.1.0 (2025-01-16)
10 | =====
11 | * Added `posix-math2`
12 | * Invoke `wine64` only when available.
13 | * Added `sockaddr_len` in `ocaml-posix`.
14 | * Add support for string and optional `port.
15 | * Add support for `hints`.
16 |
17 | 2.0.2 (2023-02-08)
18 | =====
19 | **posix-time2**
20 | * Added `clock_nanosleep`
21 |
--------------------------------------------------------------------------------
/posix-socket-unix/README.md:
--------------------------------------------------------------------------------
1 | # posix-socket-unix
2 |
3 | This module provides OCaml ctypes bindings to system-specific low-level socket structure and data-types.
4 |
5 | The interface is implemented using [ocaml-ctypes](https://github.com/ocamllabs/ocaml-ctypes) and is intended
6 | to exposed the machine-specific, low-level details of the most important parts of socket implementations.
7 |
8 | [Posix_socket_unix](src/posix_socket_unix.mli) provides the API specific to `Unix` systems, mostly the `sockaddr_u` structure.
9 | API common to both `Unix` and `Win32` systems are defined in the parent `posix-socket` module.
10 |
11 | Happy hacking!
12 |
--------------------------------------------------------------------------------
/posix-socket-unix/src/constants/dune:
--------------------------------------------------------------------------------
1 | (library
2 | (name posix_socket_unix_constants)
3 | (public_name posix-socket-unix.constants)
4 | (enabled_if
5 | (= %{os_type} Unix))
6 | (libraries ctypes.stubs))
7 |
--------------------------------------------------------------------------------
/posix-socket-unix/src/constants/posix_socket_unix_constants.ml:
--------------------------------------------------------------------------------
1 | module Def (S : Cstubs.Types.TYPE) = struct
2 | let af_unix = S.constant "AF_UNIX" S.int
3 | let sun_path_len = S.constant "SUN_PATH_LEN" S.int
4 | end
5 |
--------------------------------------------------------------------------------
/posix-socket-unix/src/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_socket_unix)
8 | (public_name posix-socket-unix)
9 | (synopsis "posix-socket-unix provides access to unix-specific sockaddr_un")
10 | (enabled_if
11 | (= %{os_type} Unix))
12 | (libraries unix unix-errno.unix ctypes posix-socket posix-socket-unix.types))
13 |
14 | (rule
15 | (targets posix_socket_unix_generated_types.ml)
16 | (deps
17 | (:gen ./generator/gen_types_c))
18 | (action
19 | (system "%{gen} > %{targets}")))
20 |
--------------------------------------------------------------------------------
/posix-socket-unix/src/generator/dune:
--------------------------------------------------------------------------------
1 | (executable
2 | (name gen_types_c)
3 | (modules gen_types_c)
4 | (libraries posix-socket-unix.types posix-base))
5 |
6 | (rule
7 | (targets gen_types.c)
8 | (action
9 | (run ./gen_types_c.exe %{targets})))
10 |
11 | (rule
12 | (targets gen_types_c)
13 | (deps
14 | (:c_code ./gen_types.c))
15 | (action
16 | (run
17 | %{ocaml-config:c_compiler}
18 | -I
19 | %{lib:ctypes:}
20 | -I
21 | %{ocaml-config:standard_library}
22 | -o
23 | %{targets}
24 | %{c_code})))
25 |
26 | (executable
27 | (name gen_constants_c)
28 | (modules gen_constants_c)
29 | (libraries posix-socket-unix.constants posix-base))
30 |
31 | (rule
32 | (targets gen_constants.c)
33 | (action
34 | (run ./gen_constants_c.exe %{targets})))
35 |
36 | (rule
37 | (targets gen_constants_c)
38 | (deps
39 | (:c_code ./gen_constants.c))
40 | (action
41 | (run
42 | %{ocaml-config:c_compiler}
43 | -I
44 | %{lib:ctypes:}
45 | -I
46 | %{ocaml-config:standard_library}
47 | -o
48 | %{targets}
49 | %{c_code})))
50 |
--------------------------------------------------------------------------------
/posix-socket-unix/src/generator/gen_constants_c.ml:
--------------------------------------------------------------------------------
1 | module Types = Posix_base.Generators.Types (struct
2 | module Types = Posix_socket_unix_constants.Def
3 |
4 | let c_headers =
5 | {|
6 | #include
7 | #include
8 | #define SUN_PATH_LEN (sizeof(((struct sockaddr_un *)0)->sun_path))
9 | |}
10 | end)
11 |
12 | let () = Types.gen ()
13 |
--------------------------------------------------------------------------------
/posix-socket-unix/src/generator/gen_types_c.ml:
--------------------------------------------------------------------------------
1 | module Types = Posix_base.Generators.Types (struct
2 | module Types = Posix_socket_unix_types.Def
3 |
4 | let c_headers =
5 | {|
6 | #include
7 | #include
8 | #include
9 | |}
10 | end)
11 |
12 | let () = Types.gen ()
13 |
--------------------------------------------------------------------------------
/posix-socket-unix/src/posix_socket_unix.ml:
--------------------------------------------------------------------------------
1 | open Ctypes
2 | open Posix_socket
3 | include Posix_socket_unix_types
4 | module Types = Posix_socket_unix_types.Def (Posix_socket_unix_generated_types)
5 |
6 | type sockaddr_un = Types.sockaddr_un
7 |
8 | let sockaddr_un_t = Types.sockaddr_un_t
9 | let from_ptr t ptr = from_voidp t (to_voidp ptr)
10 |
11 | module SockaddrUnix = struct
12 | include Types.SockaddrUnix
13 |
14 | let from_sockaddr_storage = from_ptr t
15 | let sun_path_len = sun_path_len
16 | end
17 |
18 | let to_unix_sockaddr s =
19 | match !@(s |-> Sockaddr.sa_family) with
20 | | id when id = af_unix ->
21 | let s = from_ptr SockaddrUnix.t s in
22 | let path = !@(s |-> SockaddrUnix.sun_path) in
23 | let len =
24 | strnlen (CArray.start path)
25 | (Unsigned.Size_t.of_int (CArray.length path))
26 | in
27 | let path =
28 | string_from_ptr (CArray.start path)
29 | ~length:(Unsigned.Size_t.to_int len)
30 | in
31 | Unix.ADDR_UNIX path
32 | | _ -> to_unix_sockaddr s
33 |
34 | let from_unix_sockaddr = function
35 | | Unix.ADDR_UNIX path ->
36 | let ss = sockaddr_storage () in
37 | let path =
38 | if String.length path > sun_path_len then String.sub path 0 sun_path_len
39 | else path
40 | in
41 | let ret = ref [] in
42 | String.iter (fun c -> ret := c :: !ret) path;
43 | let path = CArray.of_list char (List.rev !ret) in
44 | let s = SockaddrUnix.from_sockaddr_storage ss in
45 | s |-> SockaddrUnix.sun_family <-@ af_unix;
46 | s |-> SockaddrUnix.sun_path <-@ path;
47 | from_ptr Sockaddr.t ss
48 | | sockaddr -> from_unix_sockaddr sockaddr
49 |
--------------------------------------------------------------------------------
/posix-socket-unix/src/posix_socket_unix.mli:
--------------------------------------------------------------------------------
1 | open Ctypes
2 | open Posix_socket
3 |
4 | (** Socket types constants. *)
5 | val af_unix : sa_family_t
6 |
7 | (** Unix socket_un structure. *)
8 | module SockaddrUnix : sig
9 | type t
10 |
11 | val t : t structure typ
12 | val sun_family : (sa_family_t, t structure) field
13 | val sun_path : (char carray, t structure) field
14 | val sun_path_len : int
15 | val from_sockaddr_storage : sockaddr_storage ptr -> t structure ptr
16 | end
17 |
18 | type sockaddr_un = SockaddrUnix.t structure
19 |
20 | val sockaddr_un_t : sockaddr_un typ
21 |
22 | (** Interface with the [Unix] module. *)
23 | val from_unix_sockaddr : Unix.sockaddr -> sockaddr ptr
24 |
25 | val to_unix_sockaddr : sockaddr ptr -> Unix.sockaddr
26 |
--------------------------------------------------------------------------------
/posix-socket-unix/src/types/dune:
--------------------------------------------------------------------------------
1 | (library
2 | (name posix_socket_unix_types)
3 | (public_name posix-socket-unix.types)
4 | (enabled_if
5 | (= %{os_type} Unix))
6 | (libraries posix-socket.types posix-socket-unix.constants ctypes.stubs))
7 |
8 | (rule
9 | (targets posix_socket_unix_generated_constants.ml)
10 | (deps
11 | (:gen ../generator/gen_constants_c))
12 | (action
13 | (system "%{gen} > %{targets}")))
14 |
--------------------------------------------------------------------------------
/posix-socket-unix/src/types/posix_socket_unix_types.ml:
--------------------------------------------------------------------------------
1 | open Ctypes
2 | open Posix_socket_types
3 |
4 | module Constants =
5 | Posix_socket_unix_constants.Def (Posix_socket_unix_generated_constants)
6 |
7 | include Constants
8 |
9 | let af_unix = Sa_family.of_int af_unix
10 |
11 | module Def (S : Cstubs.Types.TYPE) = struct
12 | let sa_family_t = S.lift_typ sa_family_t
13 |
14 | module SockaddrUnix = struct
15 | type t = unit
16 |
17 | let t = S.structure "sockaddr_un"
18 | let sun_family = S.field t "sun_family" sa_family_t
19 | let sun_path = S.field t "sun_path" (S.array sun_path_len S.char)
20 | let () = S.seal t
21 | end
22 |
23 | type sockaddr_un = SockaddrUnix.t structure
24 |
25 | let sockaddr_un_t : sockaddr_un S.typ = SockaddrUnix.t
26 | end
27 |
--------------------------------------------------------------------------------
/posix-socket-unix/src/types/posix_socket_unix_types.mli:
--------------------------------------------------------------------------------
1 | open Ctypes
2 | open Posix_socket_types
3 |
4 | val af_unix : sa_family_t
5 | val sun_path_len : int
6 |
7 | module Def (S : Cstubs.Types.TYPE) : sig
8 | module SockaddrUnix : sig
9 | type t
10 |
11 | val t : t structure S.typ
12 | val sun_family : (sa_family_t, t structure) S.field
13 | val sun_path : (char carray, t structure) S.field
14 | end
15 |
16 | type sockaddr_un = SockaddrUnix.t structure
17 |
18 | val sockaddr_un_t : sockaddr_un S.typ
19 | end
20 |
--------------------------------------------------------------------------------
/posix-socket-unix/test/dune:
--------------------------------------------------------------------------------
1 | (test
2 | (name test)
3 | (package posix-socket-unix)
4 | (libraries posix-socket-unix))
5 |
--------------------------------------------------------------------------------
/posix-socket-unix/test/test.ml:
--------------------------------------------------------------------------------
1 | open Ctypes
2 | open Posix_socket
3 | open Posix_socket_unix
4 |
5 | let from_ptr t ptr = from_voidp t (to_voidp ptr)
6 |
7 | let () =
8 | let sockaddr = from_unix_sockaddr (Unix.ADDR_UNIX "/path/to/socket") in
9 | let sockaddr_un = from_ptr SockaddrUnix.t sockaddr in
10 | Printf.printf "sockaddr_un.sun_family = %d\n%!"
11 | (Sa_family.to_int !@(sockaddr_un |-> SockaddrUnix.sun_family));
12 | let unix_socket = to_unix_sockaddr sockaddr in
13 | match unix_socket with
14 | | Unix.ADDR_UNIX path -> Printf.printf "Unix.ADDR_UNIX(%S)\n%!" path
15 | | _ -> assert false
16 |
--------------------------------------------------------------------------------
/posix-socket.opam:
--------------------------------------------------------------------------------
1 | # This file is generated by dune, edit dune-project instead
2 | opam-version: "2.0"
3 | version: "3.0.0"
4 | synopsis: "Bindings for posix sockets"
5 | description:
6 | "posix-socket provides the types and bindings of posix sockets APIs available on both unix and windows."
7 | maintainer: ["romain.beauxis@gmail.com"]
8 | authors: ["Romain Beauxis"]
9 | license: "MIT"
10 | homepage: "https://github.com/savonet/ocaml-posix"
11 | bug-reports: "https://github.com/savonet/ocaml-posix/issues"
12 | depends: [
13 | "dune" {>= "2.9"}
14 | "ocaml" {>= "4.12"}
15 | "dune-configurator"
16 | "posix-base" {>= "2.2"}
17 | "ctypes"
18 | "odoc" {with-doc}
19 | ]
20 | build: [
21 | ["dune" "subst"] {dev}
22 | [
23 | "dune"
24 | "build"
25 | "-p"
26 | name
27 | "-j"
28 | jobs
29 | "--promote-install-files=false"
30 | "@install"
31 | "@runtest" {with-test}
32 | "@doc" {with-doc}
33 | ]
34 | ["dune" "install" "-p" name "--create-install-files" name]
35 | ]
36 | dev-repo: "git+https://github.com/savonet/ocaml-posix.git"
37 |
--------------------------------------------------------------------------------
/posix-socket/CHANGES:
--------------------------------------------------------------------------------
1 | 3.0.0 (2025-04-20)
2 | =====
3 | * Remove full struct support for `SockaddrStorage`,
4 | only allocate by size.
5 | * Use native API to convert back and forth to OCaml socketaddr
6 |
7 | 2.2.0 (2025-01-30)
8 | =====
9 | * Fix copy code in `getaddrinfo`.
10 |
11 |
--------------------------------------------------------------------------------
/posix-socket/README.md:
--------------------------------------------------------------------------------
1 | # posix-socket
2 |
3 | This module provides OCaml ctypes bindings to system-specific low-level socket structure and data-types.
4 |
5 | The interface is implemented using [ocaml-ctypes](https://github.com/ocamllabs/ocaml-ctypes) and is intended
6 | to exposed the machine-specific, low-level details of the most important parts of socket implementations.
7 |
8 | [Posix_socket](src/posix_socket.mli) provides an API compatible for both `Unix` and `Win32` systems.
9 |
10 | On POSIX systems, the following headers define the bound types and structures:
11 | * [sys/sock.h](https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html)
12 | * [sys/un.h](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/un.h.html)
13 | * [netinet/in.h](https://pubs.opengroup.org/onlinepubs/009695399/basedefs/netinet/in.h.html)
14 |
15 | On windows systems, the following headers define the bound types and structures:
16 | * [winsock.h](https://docs.microsoft.com/en-us/windows/win32/api/winsock/)
17 | * [ws2tcpip.h](https://docs.microsoft.com/en-us/windows/win32/api/ws2tcpip/)
18 |
19 | Its API mirrors as much as possible the original POSIX definitions, including integers representation (network bytes order,
20 | host byte order).
21 |
22 | Happy hacking!
23 |
--------------------------------------------------------------------------------
/posix-socket/examples/dune:
--------------------------------------------------------------------------------
1 | (executable
2 | (name getaddrinfo)
3 | (modules getaddrinfo)
4 | (libraries posix-socket))
5 |
--------------------------------------------------------------------------------
/posix-socket/examples/getaddrinfo.ml:
--------------------------------------------------------------------------------
1 | open Ctypes
2 | open Posix_socket
3 |
4 | let from_ptr t ptr = from_voidp t (to_voidp ptr)
5 |
6 | let () =
7 | let host = Sys.argv.(1) in
8 | let resolved_addresses = getaddrinfo ~port:(`String Sys.argv.(2)) host in
9 | List.iter
10 | (fun sockaddr ->
11 | Printf.printf "sockaddr.sa_family = %d\n%!"
12 | (Sa_family.to_int !@(sockaddr |-> Sockaddr.sa_family));
13 | let sockaddr_in = from_ptr SockaddrInet.t sockaddr in
14 | Printf.printf "sockaddr_in.sin_addr.s_addr = %d\n%!"
15 | (Unsigned.UInt32.to_int
16 | (ntohl
17 | !@(sockaddr_in |-> SockaddrInet.sin_addr |-> SockaddrInet.s_addr))))
18 | resolved_addresses
19 |
--------------------------------------------------------------------------------
/posix-socket/src/config/discover.ml:
--------------------------------------------------------------------------------
1 | module C = Configurator.V1
2 |
3 | let has_caml_unix_get_sockaddr_c =
4 | {|
5 | #ifdef _WIN32
6 | #include
7 | #endif
8 |
9 | #include
10 | #include
11 |
12 | int main() {
13 | union sock_addr_union sockaddr;
14 | socklen_param_type addr_len;
15 | value s;
16 | caml_unix_get_sockaddr(s, &sockaddr, &addr_len);
17 | return 0;
18 | }
19 | |}
20 |
21 | let () =
22 | C.main ~name:"posix-socket" (fun c ->
23 | let has_caml_unix_get_sockaddr =
24 | C.c_test c ~link_flags:["-lcamlrun"] has_caml_unix_get_sockaddr_c
25 | in
26 | C.C_define.gen_header_file c ~fname:"posix_socket_stubs.h"
27 | [
28 | ( "HAS_CAML_UNIX_GET_SOCKADDR",
29 | C.C_define.Value.Switch has_caml_unix_get_sockaddr );
30 | ])
31 |
--------------------------------------------------------------------------------
/posix-socket/src/config/dune:
--------------------------------------------------------------------------------
1 | (executable
2 | (name discover)
3 | (libraries dune.configurator))
4 |
--------------------------------------------------------------------------------
/posix-socket/src/constants/dune:
--------------------------------------------------------------------------------
1 | (library
2 | (name posix_socket_constants)
3 | (public_name posix-socket.constants)
4 | (libraries ctypes.stubs))
5 |
--------------------------------------------------------------------------------
/posix-socket/src/constants/posix_socket_constants.ml:
--------------------------------------------------------------------------------
1 | module Def (S : Cstubs.Types.TYPE) = struct
2 | let af_inet = S.constant "AF_INET" S.int
3 | let af_inet6 = S.constant "AF_INET6" S.int
4 | let af_unix = S.constant "AF_UNIX" S.int
5 | let af_unspec = S.constant "AF_UNSPEC" S.int
6 | let sa_data_len = S.constant "SA_DATA_LEN" S.int
7 | let sa_family_t_len = S.constant "SA_FAMILY_T_LEN" S.int
8 | let sockaddr_storage_len = S.constant "SOCKADDR_STORAGE_LEN" S.int
9 | let sock_dgram = S.constant "SOCK_DGRAM" S.int
10 | let sock_stream = S.constant "SOCK_STREAM" S.int
11 | let sock_seqpacket = S.constant "SOCK_STREAM" S.int
12 | let socklen_t_len = S.constant "SOCKLEN_T_LEN" S.int
13 | let ni_maxserv = S.constant "NI_MAXSERV" S.int
14 | let ni_maxhost = S.constant "NI_MAXHOST" S.int
15 | let ni_numerichost = S.constant "NI_NUMERICHOST" S.int
16 | let ni_numericserv = S.constant "NI_NUMERICSERV" S.int
17 | let ipproto_ip = S.constant "IPPROTO_IP" S.int
18 | let ipproto_ipv6 = S.constant "IPPROTO_IPV6" S.int
19 | let ipproto_icmp = S.constant "IPPROTO_ICMP" S.int
20 | let ipproto_raw = S.constant "IPPROTO_RAW" S.int
21 | let ipproto_tcp = S.constant "IPPROTO_TCP" S.int
22 | let ipproto_udp = S.constant "IPPROTO_UDP" S.int
23 | end
24 |
--------------------------------------------------------------------------------
/posix-socket/src/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -g -warn-error -A))))
5 |
6 | (library
7 | (name posix_socket)
8 | (public_name posix-socket)
9 | (synopsis
10 | "posix-socket provides access to the features exposed in sys/socket.h")
11 | (foreign_stubs
12 | (language c)
13 | (names posix_socket_generated_stubs posix_socket_stubs)
14 | (extra_deps posix_socket_stubs.h))
15 | (libraries unix ctypes posix-socket.types posix-socket.stubs))
16 |
17 | (rule
18 | (targets posix_socket_stubs.h)
19 | (action
20 | (run ./config/discover.exe)))
21 |
22 | (rule
23 | (targets posix_socket_generated_stubs.ml)
24 | (action
25 | (run ./generator/gen_stubs.exe ml %{targets})))
26 |
27 | (rule
28 | (targets posix_socket_generated_stubs.c)
29 | (action
30 | (run ./generator/gen_stubs.exe c %{targets})))
31 |
--------------------------------------------------------------------------------
/posix-socket/src/generator/dune:
--------------------------------------------------------------------------------
1 | (executable
2 | (name gen_stubs)
3 | (modules gen_stubs)
4 | (libraries posix-socket.stubs posix-base))
5 |
6 | (executable
7 | (name gen_types_c)
8 | (modules gen_types_c)
9 | (libraries posix-socket.types posix-base))
10 |
11 | (rule
12 | (targets gen_types.c)
13 | (action
14 | (run ./gen_types_c.exe %{targets})))
15 |
16 | (rule
17 | (targets gen_types_c_target.exe)
18 | (deps
19 | (:c_code ./gen_types.c))
20 | (action
21 | (run
22 | %{ocaml-config:c_compiler}
23 | -I
24 | %{lib:ctypes:}
25 | -I
26 | %{ocaml-config:standard_library}
27 | -o
28 | %{targets}
29 | %{c_code})))
30 |
31 | (executable
32 | (name gen_constants_c)
33 | (modules gen_constants_c)
34 | (libraries posix-socket.constants posix-base))
35 |
36 | (rule
37 | (targets gen_constants.c)
38 | (action
39 | (run ./gen_constants_c.exe %{targets})))
40 |
41 | (rule
42 | (targets gen_constants_c_target.exe)
43 | (deps
44 | (:c_code ./gen_constants.c))
45 | (action
46 | (run
47 | %{ocaml-config:c_compiler}
48 | -I
49 | %{lib:ctypes:}
50 | -I
51 | %{ocaml-config:standard_library}
52 | -o
53 | %{targets}
54 | %{c_code})))
55 |
--------------------------------------------------------------------------------
/posix-socket/src/generator/exec.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | SYSTEM=$1
4 | CMD=$2
5 | ARG=$3
6 |
7 | if test "${SYSTEM}" = "mingw"; then
8 | wine $CMD $ARG
9 | elif test "${SYSTEM}" = "mingw64"; then
10 | if command -v wine64 > /dev/null 2>&1; then
11 | wine64 $CMD $ARG
12 | else
13 | wine $CMD $ARG
14 | fi
15 | else
16 | $CMD $ARG
17 | fi
18 |
--------------------------------------------------------------------------------
/posix-socket/src/generator/gen_constants_c.ml:
--------------------------------------------------------------------------------
1 | module Types = Posix_base.Generators.Types (struct
2 | module Types = Posix_socket_constants.Def
3 |
4 | let c_headers =
5 | {|
6 | #ifdef _WIN32
7 | #include
8 | #include
9 | #else
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #endif
16 |
17 | #define SA_DATA_LEN (sizeof(((struct sockaddr*)0)->sa_data))
18 | #define SA_FAMILY_T_LEN (sizeof(((struct sockaddr*)0)->sa_family))
19 | #define SOCKLEN_T_LEN (sizeof(socklen_t))
20 | #define SOCKADDR_STORAGE_LEN (sizeof(struct sockaddr_storage))
21 |
22 | #ifndef NI_MAXHOST
23 | #define NI_MAXHOST 1025
24 | #endif
25 |
26 | #ifndef NI_MAXSERV
27 | #define NI_MAXSERV 32
28 | #endif
29 | |}
30 | end)
31 |
32 | let () = Types.gen ()
33 |
--------------------------------------------------------------------------------
/posix-socket/src/generator/gen_stubs.ml:
--------------------------------------------------------------------------------
1 | module Stubs = Posix_base.Generators.Stubs (struct
2 | module Stubs = Posix_socket_stubs.Def
3 |
4 | let c_headers =
5 | {|
6 | #ifdef _WIN32
7 | #include
8 | #include
9 | #else
10 | #include
11 | #include
12 | #include
13 | #include
14 | #endif
15 |
16 | #include
17 | #include
18 | |}
19 |
20 | let concurrency = Cstubs.unlocked
21 | let prefix = "posix_socket"
22 | end)
23 |
24 | let () = Stubs.gen ()
25 |
--------------------------------------------------------------------------------
/posix-socket/src/generator/gen_types_c.ml:
--------------------------------------------------------------------------------
1 | module Types = Posix_base.Generators.Types (struct
2 | module Types = Posix_socket_types.Def
3 |
4 | let c_headers =
5 | {|
6 | #ifdef _WIN32
7 | #include
8 | #include
9 | #else
10 | #include
11 | #include
12 | #include
13 | #include
14 | #endif
15 | |}
16 | end)
17 |
18 | let () = Types.gen ()
19 |
--------------------------------------------------------------------------------
/posix-socket/src/posix_socket_stubs.c:
--------------------------------------------------------------------------------
1 | #ifdef _WIN32
2 | #include
3 | #endif
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | #include "ctypes_cstubs_internals.h"
10 | #include "posix_socket_stubs.h"
11 |
12 | CAMLprim value posix_socket_get_sockaddr(value socket, value socket_storage) {
13 | CAMLparam2(socket, socket_storage);
14 | union sock_addr_union *sockaddr = CTYPES_ADDR_OF_FATPTR(socket_storage);
15 | socklen_param_type addr_len;
16 | #ifdef HAS_CAML_UNIX_GET_SOCKADDR
17 | caml_unix_get_sockaddr(socket, sockaddr, &addr_len);
18 | #else
19 | get_sockaddr(socket, sockaddr, &addr_len);
20 | #endif
21 | CAMLreturn(Val_unit);
22 | }
23 |
24 | CAMLprim value posix_socket_alloc_sockaddr(value socket_addr_ptr,
25 | value socket_addr_len) {
26 | CAMLparam2(socket_addr_ptr, socket_addr_len);
27 | union sock_addr_union *sockaddr = CTYPES_ADDR_OF_FATPTR(socket_addr_ptr);
28 | size_t sockaddr_len = Int_val(socket_addr_len);
29 | #ifdef HAS_CAML_UNIX_GET_SOCKADDR
30 | value socket = acaml_unix_alloc_sockaddr(sockaddr, sockaddr_len, -1);
31 | #else
32 | value socket = alloc_sockaddr(sockaddr, sockaddr_len, -1);
33 | #endif
34 | CAMLreturn(socket);
35 | }
36 |
--------------------------------------------------------------------------------
/posix-socket/src/stubs/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_socket_stubs)
8 | (public_name posix-socket.stubs)
9 | (libraries posix-socket.types ctypes.stubs))
10 |
11 | (rule
12 | (targets posix_socket_generated_types.ml)
13 | (enabled_if (<> %{ocaml-config:host} %{ocaml-config:target}))
14 | (deps
15 | (:exec ../generator/exec.sh)
16 | (:gen ../generator/gen_types_c_target.exe))
17 | (action
18 | (with-stdout-to
19 | %{targets}
20 | (system "%{exec} %{ocaml-config:system} %{gen}"))))
21 |
22 | (rule
23 | (targets posix_socket_generated_types.ml)
24 | (enabled_if (= %{ocaml-config:host} %{ocaml-config:target}))
25 | (deps
26 | (:gen ../generator/gen_types_c_target.exe))
27 | (action
28 | (with-stdout-to
29 | %{targets}
30 | (run %{gen}))))
31 |
--------------------------------------------------------------------------------
/posix-socket/src/stubs/posix_socket_stubs.ml:
--------------------------------------------------------------------------------
1 | open Ctypes
2 |
3 | module Def (F : Cstubs.FOREIGN) = struct
4 | open F
5 | open Posix_socket_types
6 | module Types = Posix_socket_types.Def (Posix_socket_generated_types)
7 | open Types
8 |
9 | let const_void_ptr = typedef (ptr void) "const void *"
10 |
11 | let getnameinfo =
12 | foreign "getnameinfo"
13 | (ptr sockaddr_t @-> socklen_t @-> ptr char @-> socklen_t @-> ptr char
14 | @-> socklen_t @-> int @-> returning int)
15 |
16 | let getaddrinfo =
17 | foreign "getaddrinfo"
18 | (string @-> ptr char @-> ptr Addrinfo.t
19 | @-> ptr (ptr Addrinfo.t)
20 | @-> returning int)
21 |
22 | let freeaddrinfo = foreign "freeaddrinfo" (ptr Addrinfo.t @-> returning void)
23 |
24 | let getservbyname =
25 | foreign "getservbyname" (ptr char @-> ptr void @-> returning (ptr Servent.t))
26 |
27 | let strnlen = foreign "strnlen" (ptr char @-> size_t @-> returning size_t)
28 | let memcpy = foreign "memcpy" (ptr void @-> const_void_ptr @-> size_t @-> returning void)
29 | let htonl = foreign "htonl" (uint32_t @-> returning uint32_t)
30 | let htons = foreign "htons" (uint16_t @-> returning uint16_t)
31 | let ntohs = foreign "ntohs" (uint16_t @-> returning uint16_t)
32 | let ntohl = foreign "ntohl" (uint32_t @-> returning uint32_t)
33 | end
34 |
--------------------------------------------------------------------------------
/posix-socket/src/types/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_socket_types)
8 | (public_name posix-socket.types)
9 | (libraries posix-socket.constants posix-base ctypes.stubs))
10 |
11 | (rule
12 | (targets posix_socket_generated_constants.ml)
13 | (enabled_if (<> %{ocaml-config:host} %{ocaml-config:target}))
14 | (deps
15 | (:exec ../generator/exec.sh)
16 | (:gen ../generator/gen_constants_c_target.exe))
17 | (action
18 | (with-stdout-to
19 | %{targets}
20 | (system "%{exec} %{ocaml-config:system} %{gen}"))))
21 |
22 | (rule
23 | (targets posix_socket_generated_constants.ml)
24 | (enabled_if (= %{ocaml-config:host} %{ocaml-config:target}))
25 | (deps
26 | (:gen ../generator/gen_constants_c_target.exe))
27 | (action
28 | (with-stdout-to
29 | %{targets}
30 | (run %{gen}))))
31 |
--------------------------------------------------------------------------------
/posix-socket/test/dune:
--------------------------------------------------------------------------------
1 | (test
2 | (name test)
3 | (modes native)
4 | (package posix-socket)
5 | (libraries posix-socket))
6 |
--------------------------------------------------------------------------------
/posix-socket/test/test.ml:
--------------------------------------------------------------------------------
1 | open Ctypes
2 | open Posix_socket
3 |
4 | let () = Printf.printf "sizeof(socklen_t) = %d\n%!" (sizeof socklen_t)
5 | let from_ptr t ptr = from_voidp t (to_voidp ptr)
6 |
7 | let () =
8 | let inet_addr = Unix.inet_addr_of_string "0.0.0.1" in
9 | let sockaddr = from_unix_sockaddr (Unix.ADDR_INET (inet_addr, 80)) in
10 | Printf.printf "sockaddr.sa_family = %d\n%!"
11 | (Sa_family.to_int !@(sockaddr |-> Sockaddr.sa_family));
12 | let sockaddr_in = from_ptr SockaddrInet.t sockaddr in
13 | Printf.printf "sockaddr_in.sin_addr.s_addr = %d\n%!"
14 | (Unsigned.UInt32.to_int
15 | (ntohl !@(sockaddr_in |-> SockaddrInet.sin_addr |-> SockaddrInet.s_addr)));
16 | let unix_socket = to_unix_sockaddr sockaddr in
17 | match unix_socket with
18 | | Unix.ADDR_INET (inet_addr, port) ->
19 | Printf.printf "Unix.ADDR_INET(%S,%d)\n%!"
20 | (Unix.string_of_inet_addr inet_addr)
21 | port
22 | | _ -> assert false
23 |
--------------------------------------------------------------------------------
/posix-time2.opam:
--------------------------------------------------------------------------------
1 | # This file is generated by dune, edit dune-project instead
2 | opam-version: "2.0"
3 | version: "2.2.0"
4 | synopsis: "Bindings for posix time functions"
5 | description:
6 | "posix-time2 provides the types and bindings for posix time APIs."
7 | maintainer: ["romain.beauxis@gmail.com"]
8 | authors: ["Romain Beauxis"]
9 | license: "MIT"
10 | homepage: "https://github.com/savonet/ocaml-posix"
11 | bug-reports: "https://github.com/savonet/ocaml-posix/issues"
12 | depends: [
13 | "dune" {>= "2.9"}
14 | "ctypes"
15 | "posix-base" {= version}
16 | "posix-types" {= version}
17 | "unix-errno"
18 | "odoc" {with-doc}
19 | ]
20 | build: [
21 | ["dune" "subst"] {dev}
22 | [
23 | "dune"
24 | "build"
25 | "-p"
26 | name
27 | "-j"
28 | jobs
29 | "--promote-install-files=false"
30 | "@install"
31 | "@runtest" {with-test}
32 | "@doc" {with-doc}
33 | ]
34 | ["dune" "install" "-p" name "--create-install-files" name]
35 | ]
36 | dev-repo: "git+https://github.com/savonet/ocaml-posix.git"
37 | available: os != "win32"
38 |
--------------------------------------------------------------------------------
/posix-time2.opam.template:
--------------------------------------------------------------------------------
1 | available: os != "win32"
2 |
--------------------------------------------------------------------------------
/posix-time2/CHANGES:
--------------------------------------------------------------------------------
1 | 2.2.0 (2025-01-30)
2 | =====
3 | * Fix copy code in `getaddrinfo`.
4 |
5 | 2.1.0 (2025-01-16)
6 | =====
7 | * Added `posix-math2`
8 | * Invoke `wine64` only when available.
9 | * Added `sockaddr_len` in `ocaml-posix`.
10 | * Add support for string and optional `port.
11 | * Add support for `hints`.
12 |
13 | 2.0.2 (2023-02-08)
14 | =====
15 | **posix-time2**
16 | * Added `clock_nanosleep`
17 |
--------------------------------------------------------------------------------
/posix-time2/README.md:
--------------------------------------------------------------------------------
1 | # posix-time2
2 |
3 | This module provides OCaml ctypes bindings to system-specific low-level time-related structures, functions and data-types.
4 |
5 | The interface is implemented using [ocaml-ctypes](https://github.com/ocamllabs/ocaml-ctypes) and is intended
6 | to exposed the machine-specific, low-level details of the most important parts of socket implementations.
7 |
8 | The C API bound in this module are defined on POSIX systems by the following files:
9 | * [time.h](https://pubs.opengroup.org/onlinepubs/009695399/basedefs/time.h.html)
10 | * [sys/time.h](https://pubs.opengroup.org/onlinepubs/7908799/xsh/systime.h.html)
11 |
12 | The low-level API mirrors as much as possible the original POSIX definitions. It is defined in [posix_time2_types.mli](src/types/posix_time2_types.mli). This API can be used to build further C bindings using `ocaml-ctypes`.
13 |
14 | [posix_time2.mli](src/posix_time2.mli) provides a high-level API compatible exported from the low-level bindings.
15 |
16 | Happy hacking!
17 |
--------------------------------------------------------------------------------
/posix-time2/src/constants/dune:
--------------------------------------------------------------------------------
1 | (library
2 | (name posix_time2_constants)
3 | (public_name posix-time2.constants)
4 | (libraries posix-types ctypes.stubs))
5 |
--------------------------------------------------------------------------------
/posix-time2/src/constants/posix_time2_constants.ml:
--------------------------------------------------------------------------------
1 | module Def (S : Cstubs.Types.TYPE) = struct
2 | let clockid_t = S.lift_typ Posix_types.clockid_t
3 | let clock_process_cputime_id = S.constant "CLOCK_PROCESS_CPUTIME_ID" clockid_t
4 | let clock_thread_cputime_id = S.constant "CLOCK_THREAD_CPUTIME_ID" clockid_t
5 | let clock_monotonic = S.constant "CLOCK_MONOTONIC" clockid_t
6 | let clock_realtime = S.constant "CLOCK_REALTIME" clockid_t
7 | let itimer_real = S.constant "ITIMER_REAL" S.int
8 | let itimer_virtual = S.constant "ITIMER_VIRTUAL" S.int
9 | let itimer_prof = S.constant "ITIMER_PROF" S.int
10 | let fd_setsize = S.constant "FD_SETSIZE" S.int
11 | let fd_set_size = S.constant "FD_SET_SIZE" S.int
12 | let fd_set_alignment = S.constant "FD_SET_ALIGNMENT" S.int
13 | let timer_abstime = S.constant "TIMER_ABSTIME" S.int
14 | end
15 |
--------------------------------------------------------------------------------
/posix-time2/src/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_time2)
8 | (public_name posix-time2)
9 | (synopsis "posix-time2 provides access to POSIX's time-related APIs")
10 | (foreign_stubs
11 | (language c)
12 | (names posix_time2_generated_stubs))
13 | (libraries unix unix-errno.unix ctypes posix-time2.types posix-time2.stubs))
14 |
15 | (rule
16 | (targets posix_time2_generated_stubs.ml)
17 | (action
18 | (run ./generator/gen_stubs.exe ml %{targets})))
19 |
20 | (rule
21 | (targets posix_time2_generated_stubs.c)
22 | (action
23 | (run ./generator/gen_stubs.exe c %{targets})))
24 |
--------------------------------------------------------------------------------
/posix-time2/src/generator/dune:
--------------------------------------------------------------------------------
1 | (executable
2 | (name gen_stubs)
3 | (modules gen_stubs)
4 | (libraries posix-time2.stubs posix-base))
5 |
6 | (executable
7 | (name gen_types_c)
8 | (modules gen_types_c)
9 | (libraries posix-time2.types posix-base))
10 |
11 | (rule
12 | (targets gen_types.c)
13 | (action
14 | (run ./gen_types_c.exe %{targets})))
15 |
16 | (rule
17 | (targets gen_types_c)
18 | (deps
19 | (:c_code ./gen_types.c))
20 | (action
21 | (run
22 | %{ocaml-config:c_compiler}
23 | -I
24 | %{lib:ctypes:}
25 | -I
26 | %{ocaml-config:standard_library}
27 | -o
28 | %{targets}
29 | %{c_code})))
30 |
31 | (executable
32 | (name gen_constants_c)
33 | (modules gen_constants_c)
34 | (libraries posix-time2.constants posix-base))
35 |
36 | (rule
37 | (targets gen_constants.c)
38 | (action
39 | (run ./gen_constants_c.exe %{targets})))
40 |
41 | (rule
42 | (targets gen_constants_c)
43 | (deps
44 | (:c_code ./gen_constants.c))
45 | (action
46 | (run
47 | %{ocaml-config:c_compiler}
48 | -I
49 | %{lib:ctypes:}
50 | -I
51 | %{ocaml-config:standard_library}
52 | -o
53 | %{targets}
54 | %{c_code})))
55 |
--------------------------------------------------------------------------------
/posix-time2/src/generator/gen_constants_c.ml:
--------------------------------------------------------------------------------
1 | module Constants = Posix_base.Generators.Types (struct
2 | module Types = Posix_time2_constants.Def
3 |
4 | let c_headers =
5 | {|
6 | #include
7 | #include
8 |
9 | // Some macos are missing these defines:
10 | #ifdef __MACH__
11 |
12 | #ifndef CLOCK_REALTIME
13 | #define CLOCK_REALTIME 0
14 | #endif
15 |
16 | #ifndef CLOCK_MONOTONIC
17 | #define CLOCK_MONOTONIC 1
18 | #endif
19 |
20 | #ifndef TIMER_ABSTIME
21 | #define TIMER_ABSTIME 1
22 | #endif
23 |
24 | #endif
25 |
26 | #define FD_SET_SIZE sizeof(fd_set)
27 | #define FD_SET_ALIGNMENT offsetof(struct { char c; fd_set x; }, x)
28 | |}
29 | end)
30 |
31 | let () = Constants.gen ()
32 |
--------------------------------------------------------------------------------
/posix-time2/src/generator/gen_stubs.ml:
--------------------------------------------------------------------------------
1 | module Stubs = Posix_base.Generators.Stubs (struct
2 | module Stubs = Posix_time2_stubs.Def
3 |
4 | let c_headers =
5 | {|
6 | #include
7 | #include
8 |
9 | static inline void ocaml_posix_time2_fd_zero(fd_set *fdset) {
10 | FD_ZERO(fdset);
11 | }
12 |
13 | static inline void ocaml_posix_time2_fd_set(int fd, fd_set *fdset) {
14 | FD_SET(fd, fdset);
15 | }
16 |
17 | static inline int ocaml_posix_time2_fd_isset(int fd, fd_set *fdset) {
18 | return FD_ISSET(fd, fdset);
19 | }
20 |
21 | static inline void ocaml_posix_time2_fd_clr(int fd, fd_set *fdset) {
22 | FD_CLR(fd, fdset);
23 | }
24 |
25 | #ifdef __MACH__
26 |
27 | #define TIMING_GIGA (1000000000)
28 |
29 | /* timespec difference (monotonic) right - left */
30 | inline void timespec_monodiff_rml(struct timespec *ts_out,
31 | const struct timespec *ts_in) {
32 | ts_out->tv_sec = ts_in->tv_sec - ts_out->tv_sec;
33 | ts_out->tv_nsec = ts_in->tv_nsec - ts_out->tv_nsec;
34 | if (ts_out->tv_nsec < 0) {
35 | ts_out->tv_sec = ts_out->tv_sec - 1;
36 | ts_out->tv_nsec = ts_out->tv_nsec + TIMING_GIGA;
37 | }
38 | }
39 |
40 | inline int clock_nanosleep(clock_t clock_id, int flags, const struct timespec *req, struct timespec *rem) {
41 | struct timespec ts_delta;
42 | if (flags == 0) {
43 | // clock_id is ignored in this case
44 | return nanosleep(req, rem);
45 | }
46 |
47 | int retval = clock_gettime(clock_id, &ts_delta );
48 | if (retval != 0) return retval;
49 |
50 | timespec_monodiff_rml(&ts_delta, req);
51 | return nanosleep(&ts_delta, NULL);
52 | }
53 |
54 | #endif
55 | |}
56 |
57 | let concurrency = Cstubs.unlocked
58 | let prefix = "posix_time2"
59 | end)
60 |
61 | let () = Stubs.gen ()
62 |
--------------------------------------------------------------------------------
/posix-time2/src/generator/gen_types_c.ml:
--------------------------------------------------------------------------------
1 | module Types = Posix_base.Generators.Types (struct
2 | module Types = Posix_time2_types.Def
3 |
4 | let c_headers = {|
5 | #include
6 | #include
7 | |}
8 | end)
9 |
10 | let () = Types.gen ()
11 |
--------------------------------------------------------------------------------
/posix-time2/src/stubs/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_time2_stubs)
8 | (public_name posix-time2.stubs)
9 | (libraries posix-types posix-time2.types ctypes.stubs))
10 |
11 | (rule
12 | (targets posix_time2_generated_types.ml)
13 | (action
14 | (with-stdout-to
15 | %{targets}
16 | (run ../generator/gen_types_c))))
17 |
--------------------------------------------------------------------------------
/posix-time2/src/types/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_time2_types)
8 | (public_name posix-time2.types)
9 | (libraries posix-time2.constants posix-base ctypes.stubs))
10 |
11 | (rule
12 | (targets posix_time2_generated_constants.ml)
13 | (action
14 | (with-stdout-to
15 | %{targets}
16 | (run ../generator/gen_constants_c))))
17 |
--------------------------------------------------------------------------------
/posix-time2/src/types/posix_time2_types.ml:
--------------------------------------------------------------------------------
1 | open Ctypes
2 | module Constants = Posix_time2_constants.Def (Posix_time2_generated_constants)
3 | include Constants
4 |
5 | type fd_set = unit Ctypes.abstract
6 |
7 | let fd_set =
8 | Ctypes.abstract ~name:"fd_set" ~size:fd_set_size ~alignment:fd_set_alignment
9 |
10 | module Def (S : Cstubs.Types.TYPE) = struct
11 | module Tm = struct
12 | type t = unit
13 |
14 | let t = S.structure "tm"
15 | let tm_sec = S.field t "tm_sec" S.int
16 | let tm_min = S.field t "tm_min" S.int
17 | let tm_hour = S.field t "tm_hour" S.int
18 | let tm_mday = S.field t "tm_mday" S.int
19 | let tm_mon = S.field t "tm_mon" S.int
20 | let tm_year = S.field t "tm_year" S.int
21 | let tm_wday = S.field t "tm_wday" S.int
22 | let tm_yday = S.field t "tm_yday" S.int
23 | let tm_isdst = S.field t "tm_isdst" S.int
24 | let () = S.seal t
25 | end
26 |
27 | module Timespec = struct
28 | type t = unit
29 |
30 | let t = S.structure "timespec"
31 | let tv_sec = S.field t "tv_sec" (S.lift_typ Posix_types.time_t)
32 | let tv_nsec = S.field t "tv_nsec" (S.lift_typ long)
33 | let () = S.seal t
34 | end
35 |
36 | module Timeval = struct
37 | type t = unit
38 |
39 | let t = S.structure "timeval"
40 | let tv_sec = S.field t "tv_sec" (S.lift_typ Posix_types.time_t)
41 | let tv_usec = S.field t "tv_usec" (S.lift_typ Posix_types.suseconds_t)
42 | let () = S.seal t
43 | end
44 |
45 | module Itimerval = struct
46 | type t = unit
47 |
48 | let t = S.structure "itimerval"
49 | let it_interval = S.field t "it_interval" Timeval.t
50 | let it_value = S.field t "it_value" Timeval.t
51 | let () = S.seal t
52 | end
53 | end
54 |
--------------------------------------------------------------------------------
/posix-time2/src/types/posix_time2_types.mli:
--------------------------------------------------------------------------------
1 | open Ctypes
2 |
3 | val itimer_real : int
4 | val itimer_virtual : int
5 | val itimer_prof : int
6 |
7 | type fd_set
8 |
9 | val fd_set : fd_set typ
10 | val fd_setsize : int
11 | val clock_monotonic : Posix_types.clockid_t
12 | val clock_realtime : Posix_types.clockid_t
13 | val clock_process_cputime_id : Posix_types.clockid_t
14 | val clock_thread_cputime_id : Posix_types.clockid_t
15 | val timer_abstime : int
16 |
17 | module Def (S : Cstubs.Types.TYPE) : sig
18 | module Tm : sig
19 | type t
20 |
21 | val t : t structure S.typ
22 | val tm_sec : (int, t structure) S.field
23 | val tm_min : (int, t structure) S.field
24 | val tm_hour : (int, t structure) S.field
25 | val tm_mday : (int, t structure) S.field
26 | val tm_mon : (int, t structure) S.field
27 | val tm_year : (int, t structure) S.field
28 | val tm_wday : (int, t structure) S.field
29 | val tm_yday : (int, t structure) S.field
30 | val tm_isdst : (int, t structure) S.field
31 | end
32 |
33 | module Timespec : sig
34 | type t
35 |
36 | val t : t structure S.typ
37 | val tv_sec : (Posix_types.time_t, t structure) S.field
38 | val tv_nsec : (Signed.long, t structure) S.field
39 | end
40 |
41 | module Timeval : sig
42 | type t
43 |
44 | val t : t structure S.typ
45 | val tv_sec : (Posix_types.time_t, t structure) S.field
46 | val tv_usec : (Posix_types.suseconds_t, t structure) S.field
47 | end
48 |
49 | module Itimerval : sig
50 | type t
51 |
52 | val t : t structure S.typ
53 | val it_interval : (Timeval.t structure, t structure) S.field
54 | val it_value : (Timeval.t structure, t structure) S.field
55 | end
56 | end
57 |
--------------------------------------------------------------------------------
/posix-time2/test/dune:
--------------------------------------------------------------------------------
1 | (test
2 | (name test)
3 | (package posix-time2)
4 | (libraries posix-time2 threads))
5 |
--------------------------------------------------------------------------------
/posix-types.opam:
--------------------------------------------------------------------------------
1 | # This file is generated by dune, edit dune-project instead
2 | opam-version: "2.0"
3 | version: "2.2.0"
4 | synopsis: "Bindings for the types defined in "
5 | description:
6 | "posix-types provides an API to the types defined in "
7 | maintainer: ["romain.beauxis@gmail.com"]
8 | authors: ["Romain Beauxis"]
9 | license: "MIT"
10 | homepage: "https://github.com/savonet/ocaml-posix"
11 | bug-reports: "https://github.com/savonet/ocaml-posix/issues"
12 | depends: [
13 | "dune" {>= "2.9"}
14 | "ocaml" {>= "4.03"}
15 | "posix-base" {= version}
16 | "ctypes"
17 | "odoc" {with-doc}
18 | ]
19 | build: [
20 | ["dune" "subst"] {dev}
21 | [
22 | "dune"
23 | "build"
24 | "-p"
25 | name
26 | "-j"
27 | jobs
28 | "--promote-install-files=false"
29 | "@install"
30 | "@runtest" {with-test}
31 | "@doc" {with-doc}
32 | ]
33 | ["dune" "install" "-p" name "--create-install-files" name]
34 | ]
35 | dev-repo: "git+https://github.com/savonet/ocaml-posix.git"
36 | available: os != "win32"
37 |
--------------------------------------------------------------------------------
/posix-types.opam.template:
--------------------------------------------------------------------------------
1 | available: os != "win32"
2 |
--------------------------------------------------------------------------------
/posix-types/CHANGES:
--------------------------------------------------------------------------------
1 | 2.2.0 (2025-01-30)
2 | =====
3 | * Fix copy code in `getaddrinfo`.
4 |
5 | 2.1.0 (2025-01-16)
6 | =====
7 | * Added `posix-math2`
8 | * Invoke `wine64` only when available.
9 | * Added `sockaddr_len` in `ocaml-posix`.
10 | * Add support for string and optional `port.
11 | * Add support for `hints`.
12 |
13 | 2.0.2 (2023-02-08)
14 | =====
15 | **posix-time2**
16 | * Added `clock_nanosleep`
17 |
--------------------------------------------------------------------------------
/posix-types/src/constants/dune:
--------------------------------------------------------------------------------
1 | (library
2 | (name posix_types_constants)
3 | (public_name posix-types.constants)
4 | (libraries ctypes.stubs))
5 |
--------------------------------------------------------------------------------
/posix-types/src/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_types)
8 | (public_name posix-types)
9 | (synopsis
10 | "posix-types provides access to POSIX's types defined in ")
11 | (libraries ctypes posix-types.constants posix-base))
12 |
13 | (rule
14 | (targets posix_types_generated_constants.ml)
15 | (action
16 | (with-stdout-to
17 | %{targets}
18 | (run ./generator/gen_constants_c))))
19 |
--------------------------------------------------------------------------------
/posix-types/src/generator/dune:
--------------------------------------------------------------------------------
1 | (executable
2 | (name gen_constants_c)
3 | (modules gen_constants_c)
4 | (libraries posix-types.constants posix-base))
5 |
6 | (rule
7 | (targets gen_constants.c)
8 | (action
9 | (run ./gen_constants_c.exe %{targets})))
10 |
11 | (rule
12 | (targets gen_constants_c)
13 | (deps
14 | (:c_code ./gen_constants.c))
15 | (action
16 | (run
17 | %{ocaml-config:c_compiler}
18 | -I
19 | %{lib:ctypes:}
20 | -I
21 | %{ocaml-config:standard_library}
22 | -o
23 | %{targets}
24 | %{c_code})))
25 |
--------------------------------------------------------------------------------
/posix-types/src/generator/gen_constants_c.ml:
--------------------------------------------------------------------------------
1 | module Constants = Posix_base.Generators.Types (struct
2 | module Types = Posix_types_constants.Def
3 |
4 | let defines =
5 | String.concat "\n"
6 | (List.map
7 | (fun t ->
8 | let name = String.uppercase_ascii t in
9 | Printf.sprintf
10 | "\n\
11 | #define %s_SIZE sizeof(%s)\n\
12 | #define IS_%s_FLOAT ((float)((%s)1.23f) == 1.23f)" name t name t)
13 | Posix_types_constants.number_types
14 | @ List.map
15 | (fun t ->
16 | let name = String.uppercase_ascii t in
17 | Printf.sprintf
18 | "\n\
19 | #define %s_SIZE sizeof(%s)\n\
20 | #define %s_ALIGNMENT offsetof(struct { char c; %s x; }, x)" name
21 | t name t)
22 | Posix_types_constants.abstract_types)
23 |
24 | let c_headers =
25 | Printf.sprintf
26 | "\n\
27 | #include \n\
28 | #include \n\
29 | #include \n\n\
30 | %s"
31 | defines
32 | end)
33 |
34 | let () = Constants.gen ()
35 |
--------------------------------------------------------------------------------
/posix-uname.opam:
--------------------------------------------------------------------------------
1 | # This file is generated by dune, edit dune-project instead
2 | opam-version: "2.0"
3 | version: "2.2.0"
4 | synopsis: "Bindings for posix uname"
5 | description: "posix-uname provides a simple interface for POSIX uname."
6 | maintainer: ["romain.beauxis@gmail.com"]
7 | authors: ["Romain Beauxis"]
8 | license: "MIT"
9 | homepage: "https://github.com/savonet/ocaml-posix"
10 | bug-reports: "https://github.com/savonet/ocaml-posix/issues"
11 | depends: [
12 | "dune" {>= "2.9"}
13 | "ctypes"
14 | "posix-base" {= version}
15 | "unix-errno"
16 | "odoc" {with-doc}
17 | ]
18 | build: [
19 | ["dune" "subst"] {dev}
20 | [
21 | "dune"
22 | "build"
23 | "-p"
24 | name
25 | "-j"
26 | jobs
27 | "--promote-install-files=false"
28 | "@install"
29 | "@runtest" {with-test}
30 | "@doc" {with-doc}
31 | ]
32 | ["dune" "install" "-p" name "--create-install-files" name]
33 | ]
34 | dev-repo: "git+https://github.com/savonet/ocaml-posix.git"
35 | available: os != "win32"
36 |
--------------------------------------------------------------------------------
/posix-uname.opam.template:
--------------------------------------------------------------------------------
1 | available: os != "win32"
2 |
--------------------------------------------------------------------------------
/posix-uname/CHANGES:
--------------------------------------------------------------------------------
1 | 2.2.0 (2025-01-30)
2 | =====
3 | * Fix copy code in `getaddrinfo`.
4 |
5 | 2.1.0 (2025-01-16)
6 | =====
7 | * Added `posix-math2`
8 | * Invoke `wine64` only when available.
9 | * Added `sockaddr_len` in `ocaml-posix`.
10 | * Add support for string and optional `port.
11 | * Add support for `hints`.
12 |
13 | 2.0.2 (2023-02-08)
14 | =====
15 | **posix-time2**
16 | * Added `clock_nanosleep`
17 |
--------------------------------------------------------------------------------
/posix-uname/src/constants/dune:
--------------------------------------------------------------------------------
1 | (library
2 | (name posix_uname_constants)
3 | (public_name posix-uname.constants)
4 | (libraries ctypes.stubs))
5 |
--------------------------------------------------------------------------------
/posix-uname/src/constants/posix_uname_constants.ml:
--------------------------------------------------------------------------------
1 | module Def (S : Cstubs.Types.TYPE) = struct
2 | let sysname_len = S.constant "SYSNAME_LEN" S.int
3 | let nodename_len = S.constant "NODENAME_LEN" S.int
4 | let release_len = S.constant "RELEASE_LEN" S.int
5 | let version_len = S.constant "VERSION_LEN" S.int
6 | let machine_len = S.constant "MACHINE_LEN" S.int
7 | end
8 |
--------------------------------------------------------------------------------
/posix-uname/src/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_uname)
8 | (public_name posix-uname)
9 | (synopsis
10 | "posix-uname provides access to the features exposed in sys/utsname.h")
11 | (foreign_stubs
12 | (language c)
13 | (names posix_uname_generated_stubs))
14 | (libraries unix unix-errno.unix ctypes posix-uname.types posix-uname.stubs))
15 |
16 | (rule
17 | (targets posix_uname_generated_stubs.ml)
18 | (action
19 | (run ./generator/gen_stubs.exe ml %{targets})))
20 |
21 | (rule
22 | (targets posix_uname_generated_stubs.c)
23 | (action
24 | (run ./generator/gen_stubs.exe c %{targets})))
25 |
--------------------------------------------------------------------------------
/posix-uname/src/generator/dune:
--------------------------------------------------------------------------------
1 | (executable
2 | (name gen_stubs)
3 | (modules gen_stubs)
4 | (libraries posix-uname.stubs posix-base))
5 |
6 | (executable
7 | (name gen_types_c)
8 | (modules gen_types_c)
9 | (libraries posix-uname.types posix-base))
10 |
11 | (rule
12 | (targets gen_types.c)
13 | (action
14 | (run ./gen_types_c.exe %{targets})))
15 |
16 | (rule
17 | (targets gen_types_c)
18 | (deps
19 | (:c_code ./gen_types.c))
20 | (action
21 | (run
22 | %{ocaml-config:c_compiler}
23 | -I
24 | %{lib:ctypes:}
25 | -I
26 | %{ocaml-config:standard_library}
27 | -o
28 | %{targets}
29 | %{c_code})))
30 |
31 | (executable
32 | (name gen_constants_c)
33 | (modules gen_constants_c)
34 | (libraries posix-uname.constants posix-base))
35 |
36 | (rule
37 | (targets gen_constants.c)
38 | (action
39 | (run ./gen_constants_c.exe %{targets})))
40 |
41 | (rule
42 | (targets gen_constants_c)
43 | (deps
44 | (:c_code ./gen_constants.c))
45 | (action
46 | (run
47 | %{ocaml-config:c_compiler}
48 | -I
49 | %{lib:ctypes:}
50 | -I
51 | %{ocaml-config:standard_library}
52 | -o
53 | %{targets}
54 | %{c_code})))
55 |
--------------------------------------------------------------------------------
/posix-uname/src/generator/gen_constants_c.ml:
--------------------------------------------------------------------------------
1 | module Types = Posix_base.Generators.Types (struct
2 | module Types = Posix_uname_constants.Def
3 |
4 | let c_headers =
5 | {|
6 | #include
7 |
8 | #define SYSNAME_LEN (sizeof(((struct utsname*)0)->sysname))
9 | #define NODENAME_LEN (sizeof(((struct utsname*)0)->nodename))
10 | #define RELEASE_LEN (sizeof(((struct utsname*)0)->release))
11 | #define VERSION_LEN (sizeof(((struct utsname*)0)->version))
12 | #define MACHINE_LEN (sizeof(((struct utsname*)0)->machine))
13 | |}
14 | end)
15 |
16 | let () = Types.gen ()
17 |
--------------------------------------------------------------------------------
/posix-uname/src/generator/gen_stubs.ml:
--------------------------------------------------------------------------------
1 | module Stubs = Posix_base.Generators.Stubs (struct
2 | module Stubs = Posix_uname_stubs.Def
3 |
4 | let c_headers = {|
5 | #include
6 | #include
7 | |}
8 |
9 | let concurrency = Cstubs.unlocked
10 | let prefix = "posix_uname"
11 | end)
12 |
13 | let () = Stubs.gen ()
14 |
--------------------------------------------------------------------------------
/posix-uname/src/generator/gen_types_c.ml:
--------------------------------------------------------------------------------
1 | module Types = Posix_base.Generators.Types (struct
2 | module Types = Posix_uname_types.Def
3 |
4 | let c_headers = {|
5 | #include
6 | |}
7 | end)
8 |
9 | let () = Types.gen ()
10 |
--------------------------------------------------------------------------------
/posix-uname/src/posix_uname.ml:
--------------------------------------------------------------------------------
1 | open Ctypes
2 | include Posix_uname_stubs.Def (Posix_uname_generated_stubs)
3 |
4 | type utsname = {
5 | sysname : string;
6 | nodename : string;
7 | release : string;
8 | version : string;
9 | machine : string;
10 | }
11 |
12 | let from_utsname p =
13 | let get f = getf p f in
14 | let read f =
15 | let p = CArray.start (get f) in
16 | string_from_ptr ~length:(strlen p) p
17 | in
18 | {
19 | sysname = read Types.Utsname.sysname;
20 | nodename = read Types.Utsname.nodename;
21 | release = read Types.Utsname.release;
22 | version = read Types.Utsname.version;
23 | machine = read Types.Utsname.machine;
24 | }
25 |
26 | let uname () =
27 | Errno_unix.with_unix_exn (fun () ->
28 | Errno_unix.raise_on_errno (fun () ->
29 | let p = make Types.Utsname.t in
30 | match uname (addr p) with
31 | | x when x < 0 -> None
32 | | _ -> Some (from_utsname p)))
33 |
--------------------------------------------------------------------------------
/posix-uname/src/posix_uname.mli:
--------------------------------------------------------------------------------
1 | (** Bindings to *)
2 |
3 | type utsname = {
4 | sysname : string;
5 | nodename : string;
6 | release : string;
7 | version : string;
8 | machine : string;
9 | }
10 |
11 | val uname : unit -> utsname
12 |
--------------------------------------------------------------------------------
/posix-uname/src/stubs/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_uname_stubs)
8 | (public_name posix-uname.stubs)
9 | (libraries posix-uname.types ctypes.stubs))
10 |
11 | (rule
12 | (targets posix_uname_generated_types.ml)
13 | (action
14 | (with-stdout-to
15 | %{targets}
16 | (run ../generator/gen_types_c))))
17 |
--------------------------------------------------------------------------------
/posix-uname/src/stubs/posix_uname_stubs.ml:
--------------------------------------------------------------------------------
1 | open Ctypes
2 |
3 | module Def (F : Cstubs.FOREIGN) = struct
4 | open F
5 | module Types = Posix_uname_types.Def (Posix_uname_generated_types)
6 | open Types
7 |
8 | let uname = foreign "uname" (ptr Utsname.t @-> returning int)
9 | let strlen = foreign "strlen" (ptr char @-> returning int)
10 | end
11 |
--------------------------------------------------------------------------------
/posix-uname/src/types/dune:
--------------------------------------------------------------------------------
1 | (env
2 | (dev
3 | (flags
4 | (:standard -warn-error -A))))
5 |
6 | (library
7 | (name posix_uname_types)
8 | (public_name posix-uname.types)
9 | (libraries posix-uname.constants posix-base ctypes.stubs))
10 |
11 | (rule
12 | (targets posix_uname_generated_constants.ml)
13 | (action
14 | (with-stdout-to
15 | %{targets}
16 | (run ../generator/gen_constants_c))))
17 |
--------------------------------------------------------------------------------
/posix-uname/src/types/posix_uname_types.ml:
--------------------------------------------------------------------------------
1 | module Constants = Posix_uname_constants.Def (Posix_uname_generated_constants)
2 | include Constants
3 |
4 | module Def (S : Cstubs.Types.TYPE) = struct
5 | module Utsname = struct
6 | type t = unit
7 |
8 | let t = S.structure "utsname"
9 | let sysname = S.field t "sysname" (S.array sysname_len S.char)
10 | let nodename = S.field t "nodename" (S.array nodename_len S.char)
11 | let release = S.field t "release" (S.array release_len S.char)
12 | let version = S.field t "version" (S.array version_len S.char)
13 | let machine = S.field t "machine" (S.array machine_len S.char)
14 | let () = S.seal t
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/posix-uname/src/types/posix_uname_types.mli:
--------------------------------------------------------------------------------
1 | open Ctypes
2 |
3 | (** Ctypes types for *)
4 |
5 | module Def (S : Cstubs.Types.TYPE) : sig
6 | (** Ctypes type for [struct utsname] *)
7 | module Utsname : sig
8 | type t
9 |
10 | val t : t structure S.typ
11 | val sysname : (char carray, t structure) S.field
12 | val nodename : (char carray, t structure) S.field
13 | val release : (char carray, t structure) S.field
14 | val version : (char carray, t structure) S.field
15 | val machine : (char carray, t structure) S.field
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/posix-uname/test/dune:
--------------------------------------------------------------------------------
1 | (test
2 | (name test)
3 | (package posix-uname)
4 | (libraries posix-uname))
5 |
--------------------------------------------------------------------------------
/posix-uname/test/test.ml:
--------------------------------------------------------------------------------
1 | open Posix_uname
2 |
3 | let () =
4 | let { sysname; nodename; release; version; machine } = uname () in
5 | Printf.printf
6 | "sysname: %s\nnodename: %s\nrelease: %s\nversion: %s\nmachine: %s\n%!"
7 | sysname nodename release version machine
8 |
--------------------------------------------------------------------------------