Skip to content

Commit

Permalink
A couple fixes for finding constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Feb 5, 2016
1 parent 3b1d167 commit 436d859
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
10 changes: 1 addition & 9 deletions core/io.rb
Expand Up @@ -80,16 +80,10 @@ class EINPROGRESSWaitWritable < Errno::EINPROGRESS
end

class FileDescriptor
@@max_descriptors = Rubinius::AtomicReference.new(2)

attr_reader :offset

O_RDONLY = Rubinius::Config['rbx.platform.file.O_RDONLY']
O_WRONLY = Rubinius::Config['rbx.platform.file.O_WRONLY']
O_RDWR = Rubinius::Config['rbx.platform.file.O_RDWR']

def self.choose_type(fd)
stat = Stat.fstat(fd)
stat = File::Stat.fstat(fd)

case stat.ftype
when "file"
Expand Down Expand Up @@ -854,8 +848,6 @@ def to_set
end
end

FD_SETSIZE = Rubinius::Config['rbx.platform.select.FD_SETSIZE']

def self.fd_set_from_array(array)
highest = -1
fd_set = FDSet.new
Expand Down
15 changes: 15 additions & 0 deletions core/zed.rb
Expand Up @@ -1108,6 +1108,7 @@ module Constants

# O_ACCMODE is /undocumented/ for fcntl() on some platforms
ACCMODE = Rubinius::Config['rbx.platform.fcntl.O_ACCMODE']
O_ACCMODE = Rubinius::Config['rbx.platform.fcntl.O_ACCMODE']

F_GETFD = Rubinius::Config['rbx.platform.fcntl.F_GETFD']
F_SETFD = Rubinius::Config['rbx.platform.fcntl.F_SETFD']
Expand Down Expand Up @@ -1203,6 +1204,20 @@ class IO
POSIX_FADV_WILLNEED = Rubinius::Config['rbx.platform.advise.POSIX_FADV_WILLNEED']
POSIX_FADV_DONTNEED = Rubinius::Config['rbx.platform.advise.POSIX_FADV_DONTNEED']
POSIX_FADV_NOREUSE = Rubinius::Config['rbx.platform.advise.POSIX_FADV_NOREUSE']

class FileDescriptor
@@max_descriptors = Rubinius::AtomicReference.new(2)

include File::Constants

O_RDONLY = Rubinius::Config['rbx.platform.file.O_RDONLY']
O_WRONLY = Rubinius::Config['rbx.platform.file.O_WRONLY']
O_RDWR = Rubinius::Config['rbx.platform.file.O_RDWR']
end

class Select
FD_SETSIZE = Rubinius::Config['rbx.platform.select.FD_SETSIZE']
end
end

class NilClass
Expand Down

0 comments on commit 436d859

Please sign in to comment.