diff --git a/lib/process_shared/posix_call.rb b/lib/process_shared/posix_call.rb deleted file mode 100644 index e3ed9b7..0000000 --- a/lib/process_shared/posix_call.rb +++ /dev/null @@ -1,29 +0,0 @@ -# require 'process_shared/libc' - circular dependency here... - -module ProcessShared - module PosixCall - # Replace methods in +syms+ with error checking wrappers that - # invoke the original method and raise a {SystemCallError} with - # the current errno if the return value is an error. - # - # Errors are detected if the block returns true when called with - # the original method's return value. - def error_check(*syms, &is_err) - unless block_given? - is_err = lambda { |v| (v == -1) } - end - - syms.each do |sym| - method = self.method(sym) - define_singleton_method(sym) do |*args| - ret = method.call(*args) - if is_err.call(ret) - raise SystemCallError.new("error in #{sym}", LibC.errno) - else - ret - end - end - end - end - end -end diff --git a/lib/process_shared/rt.rb b/lib/process_shared/rt.rb deleted file mode 100644 index 672d386..0000000 --- a/lib/process_shared/rt.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'process_shared/posix_call' -require 'process_shared/psem' - -module ProcessShared - module RT - extend FFI::Library - extend PosixCall - - # FIXME: mac and linux OK, but what about everything else? - if FFI::Platform.mac? - ffi_lib 'c' - else - ffi_lib 'rt' - end - - attach_function :shm_open, [:string, :int, :mode_t], :int - attach_function :shm_unlink, [:string], :int - - error_check :shm_open, :shm_unlink - end -end