package posix-types
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
md5=2e05f3e890206138c4ebd09878359a2f
sha512=79a786c299b5d9f7f5ff0c3cf289539e8ea257b2068f75cd9faca9450679e5cd7de6b0fc5b77c9ddbbb5857d4f64119837a61a22d277e6e2a8ab4b3c4d5911c0
Description
posix-types provides an API to the types defined in <sys/types.h>
Added to opam-repository:
README
ocaml-posix
OCaml bindings to POSIX APIs.
Overview
ocaml-posix provides comprehensive bindings to POSIX system interfaces for OCaml. Each module offers:
- Low-level bindings for use with ocaml-ctypes
- High-level OCaml APIs for convenient, idiomatic usage
This project consolidates and extends various existing POSIX binding libraries into a single, consistent collection.
Documentation
API documentation is available at: http://www.liquidsoap.info/ocaml-posix/
Installation
Via opam (recommended)
opam install posix-base posix-types posix-errno posix-socket posix-time2From source
git clone https://github.com/savonet/ocaml-posix.git
cd ocaml-posix
opam install .Quick Start
(* Using posix-time2 for clock operations *)
open Posix_time2
let () =
let ts = clock_gettime `Realtime in
Printf.printf "Current time: %Ld.%09ld seconds\n"
ts.Timespec.tv_sec ts.Timespec.tv_nsec(* Using posix-uname for system information *)
open Posix_uname
let () =
let info = uname () in
Printf.printf "System: %s %s (%s)\n"
info.sysname info.release info.machine(* Using posix-socket for DNS resolution *)
open Ctypes
open Posix_socket
let () =
(* Resolve hostname to socket addresses *)
let addresses = getaddrinfo ~port:(`Int 443) "example.com" in
List.iter (fun sockaddr ->
(* Convert back to human-readable form *)
let host, port = getnameinfo sockaddr in
Printf.printf "Resolved: %s:%d\n" host port
) addresses
(* Convert between Unix and POSIX socket addresses *)
let unix_to_posix addr =
let posix_addr = from_unix_sockaddr addr in
let host, port = getnameinfo posix_addr in
Printf.printf "Address: %s:%d\n" host portAvailable Packages
Package | Description | Replaces |
|---|---|---|
| Base tools for generating POSIX bindings | - |
| POSIX type definitions | |
| Error number handling and Unix error conversion | |
| Socket operations ( | |
| Unix domain socket extensions | - |
| Time and clock functions | |
| Command-line option parsing | |
| System identification | - |
| Miscellaneous POSIX functions ( | - |
| Resource limits and usage ( | |
| Signal handling | - |
| File status ( | |
| Mathematical functions | - |
Cross-compilation
ocaml-posix supports cross-compilation (e.g., building for Windows from Linux/macOS using mingw). The build system automatically detects cross-compilation scenarios and uses appropriate tooling.
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Dependencies (4)
- ctypes
-
posix-base
= version -
ocaml
>= "4.03" -
dune
>= "3.20"
Dev Dependencies (1)
-
odoc
with-doc
Optional Dependencies
None
Used by (6)
- osx-membership
-
posix-bindings
>= "3" -
posix-resource
>= "4.0.2" -
posix-stat
>= "4.0.2" -
posix-time2
>= "4.0.2" -
posix-unistd
>= "4.0.2"
Conflicts
None
Build status
Results of building posix-types with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 4.0.2 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure