7 attach_function 'umask', [ :int ], :int
11 # Attaching the function to this module is about 10% faster than calling Posix.umask
12 if JRuby::FFI::Platform::IS_WINDOWS
13 attach_function '_umask', :_umask, [ :int ], :int
15 attach_function 'umask', :_umask, [ :int ], :int
17 def self.umask(mask = nil)
27 puts "FFI umask=#{NativeFile.umask} File.umask=#{File.umask}"
28 puts "Benchmark File.umask performance, #{iter}x"
30 puts Benchmark.measure {
31 iter.times { File.umask(0777) }
34 puts "Benchmark FFI File.umask performance, #{iter}x"
37 puts Benchmark.measure {
38 iter.times { NativeFile.umask(0777) }
41 puts "Benchmark FFI Posix umask performance, #{iter}x"
44 puts Benchmark.measure {
45 iter.times { Posix.umask(0777) }