Module: FFI::Stat

Defined in:
lib/ffi/stat/x86_64-darwin/stat.rb,
lib/ffi/stat/x86_64-linux/stat.rb,
lib/ffi/stat.rb

Defined Under Namespace

Modules: Native Classes: Stat, Timespec

Constant Summary collapse

S_IFMT =

File types.

0x170000
S_IFIFO =
0x010000
S_IFCHR =
0x020000
S_IFDIR =
0x040000
S_IFBLK =
0x060000
S_IFREG =
0x100000
S_IFLNK =
0x120000
S_IFSOCK =
0x140000
S_IRWXU =

Read, write, execute by owner.

0x000700
S_IRUSR =
0x000400
S_IWUSR =
0x000200
S_IXUSR =
0x000100
S_IRWXG =

Read, write, execute by group.

0x000070
S_IRGRP =
0x000040
S_IWGRP =
0x000020
S_IXGRP =
0x000010
S_IRWXO =

Read, write, execute by others.

0x000007
S_IROTH =
0x000004
S_IWOTH =
0x000002
S_IXOTH =
0x000001
S_ISUID =
0x004000
S_ISGID =
0x002000
S_ISVTX =
0x001000

Class Method Summary collapse

Class Method Details

.fstat(fd) ⇒ Object



85
86
87
88
89
90
91
# File 'lib/ffi/stat/x86_64-darwin/stat.rb', line 85

def self.fstat(fd)
  stat = FFI::Stat::Stat.new

  FFI::Stat::Native.fstat(fd, stat.pointer)

  stat
end

.lstat(path) ⇒ Object



77
78
79
80
81
82
83
# File 'lib/ffi/stat/x86_64-darwin/stat.rb', line 77

def self.lstat(path)
  stat = FFI::Stat::Stat.new

  FFI::Stat::Native.lstat(path, stat.pointer)

  stat
end

.stat(path) ⇒ Object



69
70
71
72
73
74
75
# File 'lib/ffi/stat/x86_64-darwin/stat.rb', line 69

def self.stat(path)
  stat = FFI::Stat::Stat.new

  FFI::Stat::Native.stat(path, stat.pointer)

  stat
end