https://github.com/postmodern/ffi-libc
Useful Ruby FFI bindings for libc
https://github.com/postmodern/ffi-libc
ffi ffi-bindings libc ruby
Last synced: 11 months ago
JSON representation
Useful Ruby FFI bindings for libc
- Host: GitHub
- URL: https://github.com/postmodern/ffi-libc
- Owner: postmodern
- License: mit
- Created: 2010-05-19T15:37:11.000Z (almost 16 years ago)
- Default Branch: main
- Last Pushed: 2021-09-22T19:35:20.000Z (over 4 years ago)
- Last Synced: 2025-02-27T12:45:31.268Z (12 months ago)
- Topics: ffi, ffi-bindings, libc, ruby
- Language: Ruby
- Homepage:
- Size: 75.2 KB
- Stars: 32
- Watchers: 7
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ffi-libc
[](https://github.com/postmodern/ffi-libc/actions/workflows/ruby.yml)
[](https://codeclimate.com/github/postmodern/ffi-libc)
* [Source](https://github.com/postmodern/ffi-libc/)
* [Issues](https://github.com/postmodern/ffi-libc/issues)
* [Documentation](https://rubydoc.info/gems/ffi-libc)
## Description
Useful Ruby FFI bindings for `libc`.
## Features
* Provides common Structs used in `libc`:
* {FFI::LibC::Ifaddrs}
* {FFI::LibC::In6Addr}
* {FFI::LibC::InAddr}
* {FFI::LibC::SockaddrDL}
* {FFI::LibC::SockaddrFamily}
* {FFI::LibC::SockaddrIn6}
* {FFI::LibC::SockaddrIn}
* {FFI::LibC::Sockaddr}
* {FFI::LibC::Timeval}
* {FFI::LibC::Timezone}
* {FFI::LibC::RUsage}
* Binds to common functions and global variables in `libc`:
* `errno.h`:
* `sys_errlist` (BSD)
* `sys_nerr` (BSD)
* `errno`
* `unistd.h`:
* `brk`
* `sbrk`
* `getpid`
* `getppid`
* `getuid`
* `geteuid`
* `getgid`
* `getegid`
* `stdlib.h`:
* `calloc`
* `malloc`
* `free`
* `realloc`
* `getenv`
* `putenv`
* `unsetenv`
* `clearenv`
* `time.h`:
* `time`
* `sys/time.h`:
* `gettimeofday`
* `settimeofday`
* `sys/resource.h` / `bits/resource.h`:
* `getrusage`
* `sys/mman.h`:
* `mmap`
* `munmap`
* `string.h`:
* `bzero`
* `memset`
* `memcpy`
* `memcmp`
* `memchr`
* `memrchr`
* `strcpy`
* `strncpy`
* `strlen`
* `index`
* `rindex`
* `strchr`
* `strrchr`
* `strstr`
* `strerror`
* `stdio.h`:
* `stdin`
* `stdout`
* `stderr`
* `fopen`
* `fdopen`
* `freopen`
* `fseek`
* `ftell`
* `rewind`
* `fread`
* `fwrite`
* `fgetc`
* `fgets`
* `fputc`
* `fputs`
* `fflush`
* `fclose`
* `clearerr`
* `feof`
* `ferror`
* `fileno`
* `perror`
* `netdb.h`:
* `getnameinfo`
* `ifaddrs.h`:
* `getifaddrs`
* `freeifaddrs`
## Requirements
* [ffi] ~> 1.0
## Install
```shell
$ gem install ffi-libc
```
### gemspec
```ruby
gem.add_dependency 'ffi-libc', '~> 0.1'
```
### Gemfile
```ruby
gem 'ffi-libc', '~> 0.1'
```
## License
Copyright (c) 2010-2021 Hal Brodigan
See {file:LICENSE.txt} for license information.
[ffi]: https://github.com/ffi/ffi#readme