Git Product home page Git Product logo

ffi-libc's Introduction

ffi-libc

CI Code Climate

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

Install

$ gem install ffi-libc

gemspec

gem.add_dependency 'ffi-libc', '~> 0.1'

Gemfile

gem 'ffi-libc', '~> 0.1'

License

Copyright (c) 2010-2021 Hal Brodigan

See {file:LICENSE.txt} for license information.

ffi-libc's People

Contributors

alekstorm avatar djcas9 avatar postmodern avatar razielgn avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ffi-libc's Issues

Function 'sys_errlist' not found by require 'ffi/libc' on glibc 2.32

Hello,

I got the following error "Function 'sys_errlist' not found" on my Linux distribution Fedora 34 environment.
Do you have any idea to fix it?
Thank you.

$ cat /etc/fedora-release 
Fedora release 34 (Rawhide)

$ ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.1 20201125 (Red Hat 10.2.1-9) (GCC) 

$ rpm -q glibc
glibc-2.32.9000-17.fc34.x86_64

$ rpm -q glibc-devel
glibc-devel-2.32.9000-17.fc34.x86_64

ffi-libc is the latest version 0.1.0.

$ gem list ffi     

*** LOCAL GEMS ***

ffi (1.12.1)
ffi-libc (0.1.0)
$ ruby -e "require 'ffi/libc'"
Traceback (most recent call last):
	2: from -e:1:in `<main>'
	1: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require': cannot load such file -- ffi/libc (LoadError)
	10: from -e:1:in `<main>'
	 9: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:147:in `require'
	 8: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:159:in `rescue in require'
	 7: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:159:in `require'
	 6: from /builddir/.gem/ruby/gems/ffi-libc-0.1.0/lib/ffi/libc.rb:13:in `<top (required)>'
	 5: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
	 4: from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:83:in `require'
	 3: from /builddir/.gem/ruby/gems/ffi-libc-0.1.0/lib/ffi/libc/libc.rb:9:in `<top (required)>'
	 2: from /builddir/.gem/ruby/gems/ffi-libc-0.1.0/lib/ffi/libc/libc.rb:10:in `<module:FFI>'
	 1: from /builddir/.gem/ruby/gems/ffi-libc-0.1.0/lib/ffi/libc/libc.rb:19:in `<module:LibC>'
/usr/share/gems/gems/ffi-1.12.1/lib/ffi/library.rb:342:in `attach_variable': Function 'sys_errlist' not found in [#<FFI::DynamicLibrary:0x0000556ea6f649c8>] (FFI::NotFoundError)

Perhaps, the sys_errlist does not exist on the new glibc version?
I find this article.
https://stackoverflow.com/questions/33948508/why-is-sys-errlist-deprecated-in-glibc

Explose clock(3)

I'd love to use clock(3) to measure unit spec runtime minus iowait.

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.