Reorganise under Linux::

This commit is contained in:
Brian Candler
2011-05-06 09:49:47 +01:00
parent f1c29980a8
commit e07af9a315
22 changed files with 146 additions and 119 deletions

15
lib/linux/error.rb Normal file
View File

@@ -0,0 +1,15 @@
module Linux
ERRNO_MAP = {} #:nodoc:
Errno.constants.each do |k|
klass = Errno.const_get(k)
next unless klass.is_a?(Class) and Class.const_defined?(:Errno)
ERRNO_MAP[klass::Errno] = klass
end
# Raise an Errno exception if the given rc is negative
def self.check_error(rc)
if rc < 0
raise ERRNO_MAP[-rc] || "System error #{-rc}"
end
end
end