Movatterモバイル変換


[0]ホーム

URL:


packageextunix

  1. Overview
  2. Docs

You can search for identifiers within the package.

in-package search v0.2.0

Collection of thin bindings to various low-level system API

Install

Dune Dependency

Authors

Maintainers

Sources

extunix-0.4.4.tbz
sha256=9334c892316223e68aef795ca72b2d429d4eec0a647f418b035e36a053d1497d
sha512=b8e5c0ace3f017105daa2b81dbcbd5de087f06d851e9ac90d3db13d3c9898ad9fdeae36b3decc60a70573bc6e12f6c77f3669f9f392e7de64705ffcbee513844

Description

Motto: "Be to Unix, what extlib is to stdlib"

  • Implement thin C bindings that directly map to underlying system API.
  • Provide common consistent ocaml interface: naming convention, exceptions.
  • Simple to build - no extra dependencies.

Tags

org:ygrek

Published:12 Mar 2025

README

ExtUnix OCaml library

A collection of thin bindings to various low-level system API.

Our motto: "Be to Unix, what extlib is to stdlib"

  • Implement thin C bindings that directly map to underlying system API.

  • Provide common consistent ocaml interface: naming convention, exceptions.

  • Simple to build - no extra dependencies.

Homepage:https://ygrek.org/p/ocaml-extunix/

Why?

Most of the system API don't deserve fully fledged library.

The ExtUnix project aims to collect these in one place. Read the "ExtUnix integration requirements" to know what kind of system API we can integrate.

Installation

Dependencies :

  • OCaml, Dune, ppxlib for build and installation

  • (optional) oUnit2 for tests, odoc for documentation

Build and install:

makemake install

Alternatively use the underlying Dune build system directly (plain ocaml, no sh and make needed):

dune build @install

Usage example:

$ ocaml# #use "topfind";;# #require "extunix";;# module U = ExtUnix.Specific;;# U.ttyname Unix.stdout;;- : string = "/dev/pts/8"

Run unit tests:

make test

Guidelines

For OCaml programming style, we follow Unix module:

  • Values and types should be named by the name of the underlying C function

  • RaiseUnix_error on runtime errors

  • Uniformly raiseNot_available exception for functions not available on the current platform

  • Be MT friendly by default - i.e. release runtime lock for blocking operations, (FIXME) optionally provide ST variants

Portability:

  • No shell scripting for build and install (think windows :) )

  • Write portable C code (use compiler options to catch compatibility issues), NB: msvc doesn't support C99.

  • Provide module (ExtUnix.Specific) exposing only functions available on the platform where library is built - i.e. guaranteed to not throwNot_available exception (experimental).

Build infrastructure:

  • discover is used to discover available functions during configure step.

  • Generatedconfig.h describes "features" discovered - it is responsible for inclusion of system-specific headers - this ensures coherent result at configure and build steps.

  • Generatedconfig.ml describes the same features for the ocaml syntax extensionppx_have, which preprocessessrc/extUnix.pp.ml and generates two modules:ExtUnix.All where bindings to missing functions are rewritten to raise exception andExtUnix.Specific which drops bindings to missing functions.

ExtUnix integration requirements

We can integrate into ExtUnix:

  • Official POSIX calls not in Unix module.

  • Drafted POSIX calls which are at least present on two systems among: Linux, *BSD, MacOS X.

  • System specific calls, as long as they don't need additional library, that they are marked as such in the documentation and that we have an automatic configure system test for them.

We should avoid system calls that are complex and would deserve a library on their own. For example, a family of more than 10 functions and datatypes should deserve its own library. If an external library already exists and works, like for inotify system call, we also won't consider it for integration.

Regarding Win32 portability: If there is a sane default to create a portable equivalent of the function on Windows, we can consider it. And we will mark it as such in the documentation.

Checklist for adding new bindings

Checklist for release

  • Reviewgit log and updateCHANGES.txt

  • Increase VERSION in Makefile

  • Commit

  • make release

Development

Many people contribute to extunix. Please submit your patches and/or feature requests to the project bugtracker athttps://github.com/ygrek/extunix/issues.

The current maintainer is reachable atmailto:ygrek@autistici.org.

Dependencies (7)

  1. base-unix
  2. base-bigarray
  3. base-bytes
  4. ppxlib>= "0.36.0" & build
  5. dune-configurator>= "3.0" & build
  6. ocaml>= "4.08"
  7. dune>= "3.0"

Dev Dependencies (2)

  1. odocwith-doc
  2. ounit2with-test

Used by (9)

  1. capnp< "3.3.0"
  2. capnp-rpc-unix>= "0.9.0"
  3. devkit>= "1.20210517"
  4. dokeysto
  5. obuilder>= "0.6.0"
  6. ocluster= "0.2"
  7. ocluster-worker
  8. passage
  9. smtml>= "0.6.0"

Conflicts

None


[8]ページ先頭

©2009-2025 Movatter.jp