Git Product home page Git Product logo

mmlabs-mindmaze / mmlib Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 5.0 1.43 MB

OS abstraction layer and helpers

Home Page: https://opensource.mindmaze.com/projects/mmlib/

License: Apache License 2.0

Makefile 0.80% Shell 0.48% Meson 1.95% M4 1.34% C 95.42% Python 0.01%
cross-platform os-independent abstraction-layer error-handling logging memory-mapped-file socket argument-parser ipc inter-process-communication

mmlib's Introduction

Overview

mmlib is an Operating System abstraction layer.

It provides an API for application developer, so that they can write portable code using relatively advanced OS features without having to care about system specifics.

The reference design in mind in its conception is POSIX, meaning that if some posix functionality is not available for given platform, mmlib will implement that same functionality itself.

Dependencies

Tests

Running the tests require the check framework.

Documentation

Generating the documentation requires sphinx and linuxdoc

Install

mmlib supports meson and autotools build systems.

# autotools
mkdir build && cd build
../autogen.sh
../configure --prefix=<install-dir>
make
make check # optional
make install

# meson
meson build --prefix=<install-dir>
cd build
ninja
ninja test # optional
ninja install

License

mmlib is free software under the terms of the Apache license 2.0. See LICENSE file.

Authors and Contributors

mmlib has been open-sourced by MindMaze and is maintained by Nicolas Bourdaud [email protected]

mmlib's People

Contributors

arthurgirouxmindmaze avatar byfron avatar gabrielganne avatar lucabaldesi avatar marjorieb avatar nbourdau avatar nicofremauxmm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mmlib's Issues

Building documentation does not seem to work as expected

$ gh repo clone mmlabs-mindmaze/mmlib
$ cd mmlib
$ python3.11 -m venv _e
(_e) $ pip install sphinx sphinx-rtd-theme linuxdoc
(_e) $ meson setup _build
(_e) $ ninja -C _build

Both when trying to generate man pages and when trying to generate HTML documentation, there are many errors of the form

/home/ben/src/mmlib/doc/alloc.rst:4: ERROR: Error in "kernel-doc" directive:
unknown option: "headers".

.. kernel-doc:: src/alloc.c
    :module: alloc
    :headers: mmlib.h
    :functions: mm_aligned_alloc, mm_aligned_free

The documentation build “succeeds” but the individual pages that would have been generated via linuxdoc, e.g. _build/doc/html/alloc.html, have no content, the man page build reports WARNING: no "man_pages" config value nor manual section found; no manual pages will be written, and _build/doc/man3/ is empty.

Am I missing something, or is this no longer working as expected with current versions of sphinx and/or linuxdoc?

Add API to get volume metadata

Add fstatvfs() and statvfs() like API. List of info useful (among other):

  • natural size of block of FS
  • free size remaining in volume
  • total size of volume

Three subtests fail in socket-api-tests

We noticed this when the mmlib package in Fedora Linux started to fail to build from source on Fedora 38, 39 (which is about to be released), and 40 (Rawhide/development). However, I can reproduce it in a fresh git checkout of the current master, f416f7a.

gh repo clone mmlabs-mindmaze/mmlib
cd mmlib
meson setup _build
meson compile -C _build
meson test -C _build --print-errorlogs
[…]
▶ 5/5 - ../tests/socket-api-tests.c:socket:getaddrinfo_valid: Assertion 'rp->ai_socktype == exp_socktype' failed FAIL          
▶ 5/5 - ../tests/socket-api-tests.c:socket:getaddrinfo_error: Assertion 'mm_getaddrinfo("localhost", "ssh", &hints, &res) == -1' failed FAIL          
▶ 5/5 - ../tests/socket-api-tests.c:socket:create_invalid_sockclient: Assertion 'mm_create_sockclient("ssh://localhost:10") == -1' failed FAIL          
5/5 unit api tests        FAIL            11.00s   418/421 subtests passed
>>> LD_LIBRARY_PATH=/home/ben/src/forks/mmlib/_build/src MALLOC_PERTURB_=190 CK_VERBOSITY=silent /home/ben/src/forks/mmlib/_build/tests/testapi
[…]

testlog.txt

I haven’t attempted to dig more deeply into why these might be failing.

Add fcntl function support

In the project xdffileio, we only use the function fcntl with the commands F_GETFL and F_SETFL.
I propose that we write two functions in the mmlib to replace the use of fcntl:

fcntl(fd, F_GETFL) could be replaced by: int mm_getflags (int fd)
-> This function returns the value of the file status flag of fd on success, otherwise returns -1 and errno is set to the appropriate value.

fcntl(fd, F_SETFL, flags) could be replaced by: int mm_setflags(int fd, int flags)
-> Set the file descriptor flags of fd to the value specified by flags. Returns -1 in case of error and errno is set to the appropriate value, otherwise returns 0.

Test fail with unexpected signal number on ppc64le, aarch64

After fixing and/or working around everything in #7, I find that I see a failure like

▶ 5/5 - ../tests/process-api-tests.c:process:wait_signal: Assertion 'status & 0x000000FF == signum' failed: status & 0x000000FF == 5, signum == 4 FAIL          
5/5 unit api tests FAIL            11.33s   419/420 subtests passed

when I build and test mmlib 1.4.2 on Fedora Linux.

This didn’t always fail; I’m not sure what triggered the regression. However, it seems strange to be hard-coding implementation details in the API of a portability library. I’m not sure that the current approach operates at the right level of abstraction. I’m not sure, at a glance, what to propose instead, but I’m happy, upon request, to provide additional information or to test patches.

Add support for efficient copy between files

We regularly need to copy file in different project. When this happens, the logic is always the same. If the implementation is available in mmlib, not only it remove boring piece of code from project depending on mmlib, but it also it may open the possibility to use platform specific API to do the copy more efficientlly (like copy_file_range on linux).

To be decided: do we provide API at a level of path, at the level of file descriptors or both...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.