Something wrong with splats in my previous commit...backing out until I figure this...
[jruby.git] / samples / ffi.rb
blob3631016567b6adb11379cefe62677d1c552471e4
1 require 'ffi'
3 module POSIX
4   extend FFI::Library
5   # this line isn't really necessary since libc is always linked into JVM
6   ffi_lib 'c'
7   
8   attach_function :getuid, :getuid, [], :uid_t
9   attach_function :getpid, :getpid, [], :pid_t
10 end
12 puts "Process #{POSIX.getpid} running as user #{POSIX.getuid}"