Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zyga/python-glibc
Pure-Python bindings to glibc (based on ctypes)
https://github.com/zyga/python-glibc
Last synced: 2 days ago
JSON representation
Pure-Python bindings to glibc (based on ctypes)
- Host: GitHub
- URL: https://github.com/zyga/python-glibc
- Owner: zyga
- License: lgpl-3.0
- Created: 2014-10-18T11:28:21.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-12-26T20:15:48.000Z (almost 2 years ago)
- Last Synced: 2024-09-24T20:43:56.383Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 196 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- License: COPYING
Awesome Lists containing this project
README
===============================================
Pure-Python bindings to glibc (based on ctypes)
===============================================.. image:: https://badge.fury.io/py/glibc.png
:target: http://badge.fury.io/py/glibc.. image:: https://travis-ci.org/zyga/python-glibc.png?branch=master
:target: https://travis-ci.org/zyga/python-glibc.. image:: https://pypip.in/d/glibc/badge.png
:target: https://pypi.python.org/pypi/glibcFeatures
========* Free software: LGPLv3 license
* Works on python 2.7+ and python 3.2+ and pypy
* Currently exposes 23 low-level glibc functions (see below), 10 data types and
118 constants. All useful glibc features are in scope (patches welcome!)
* ``from glibc import ...`` -- direct access to glibc constants, functions and
types via lazy imports, fast startup, low memory overhead, efficient calls to
glibc
* Translates error codes according to documentation (manual pages) of each
supported function. Raises OSError with appropriate values and a customized,
easy-to-understand error message.
* Uses declarative "bindings", easy to verify for correctness, easy to add more
types, functions and constants. Built-in tests verify the value of each
constant, size and offset of each structure / union field and the size of the
whole structure / union.
* Adds high-level abstractions on top of raw functions (pyglibc.select,
pyglibc.signalfd, pyglibc.selectors, pyglibc.pthread_sigmask, pyglibc.pipe,
pyglibc.subreaper) so that using them is easier and more pythonic.
* This code is entirely optional and users can still call the low-level
C-equivalents directly.
* Where possible, existing Python APIs are followed so that glibc_select and
glibc_selectors are drop-in replacements for the select and selectors modules
from Python's standard library.Functions
=========The following glibc functions are supported
=========================== =================================
Name Remarks
=========================== =================================
``clock_getres(2)``
``clock_gettime(2)``
``clock_settime(2)``
``close(2)`` Same as os.close()
``dup(2)`` Same as os.dup()
``dup2(2)`` Same as os.dup2()
``dup3(2)`` Same as os.dup(flags=)
``epoll_create(2)`` Similar to select.epoll()
``epoll_create1(2)`` Similar to select.epoll()
``epoll_ctl(2)`` Similar to select.epoll.{register,unregister,modify}
``epoll_pwait(2)``
``epoll_wait(2)`` Similar to select.epoll.poll()
``eventfd(2)``
``eventfd_read(2)``
``eventfd_write(2)``
``pause(2)``
``pipe(2)`` Same as os.pipe
``pipe2(2)``
``prctl(2)``
``pthread_sigmask(2)``
``read(2)`` Unlike os.read, this one makes no copies
``sigaddset(3)``
``sigdelset(3)``
``sigemptyset(3)``
``sigfillset(3)``
``sigismember(3)``
``signalfd(2)``
``sigprocmask(2)``
``timerfd_create(2)``
``timerfd_gettime(2)``
``timerfd_settime(2)``