GitXplorerGitXplorer
s

ocaml-pci

public
6 stars
9 forks
2 issues

Commits

List of commits on branch master.
Verified
334611a248b67518c4f17fa22b9aa0782c6d5c9a

build: Use ounit2 (#23)

AAlessandro-Barbieri committed 3 years ago
Unverified
936cff8794bcb2ac0c4de6f8431f1810ba4e6941

Keep string alive over C function call (#21)

llindig committed 6 years ago
Unverified
fae2e6094977936eb7917851dc1d992ab1a3bc8a

build: Bump release version to 1.0.1 and regenerate oasis

ssimonjbeaumont committed 7 years ago
Verified
01a318e82279a48d4558a6d853341c858bafec17

Merge pull request #20 from mseri/master

ssimonjbeaumont committed 7 years ago
Unverified
f7001cb9628d414bb0a8eca19aad8394bc3ce896

pci: use CArray instead of Buffer

mmseri committed 7 years ago
Unverified
f082f71ce426a366afb6b39b0db459c987920afe

Merge pull request #19 from simonjbeaumont/quest-for-100-cov

ssimonjbeaumont committed 9 years ago

README

The README file for this repository.

ocaml-pci

Build Status Coverage Status API reference

An OCaml library exposing an API over bindings to libpci.

This library uses Ctypes to generate type-safe bindings to libpci which is part of "The PCI Utilities" package shipped with most operating systems.

Rather than being a completely transparent set of bindings, this library exposes an API to wrap some of the composite functions to ensure correct memory allocation and cleanup. This should reduce memory leaks and segfaults which are possible with incorrect use of libpci.

Installation

The easiest way to install this library is to use opam:

opam install pci

However, if you don't use opam, you can compile from source by cloning this repo and executing the usual dance:

./configure
make
make install

Documentation

The API documentation for this library is automatically generated from source using ocamldoc and is available online.

Usage

There is an example of a minimal lspci clone in the examples/ directory. The interface is intended to be as simple as possible. Here is an example of listing the devices on your system:

open Pci
let devs = with_access get_devices in
List.iter (fun d ->
  let open Pci_dev in
  Printf.printf "Device: %04x:%02x:%02x.%d\n" d.domain d.bus d.dev d.func
) devs