Skip to content

Instantly share code, notes, and snippets.

@hiboma
Created February 22, 2012 15:10
Show Gist options
  • Save hiboma/1885475 to your computer and use it in GitHub Desktop.
Save hiboma/1885475 to your computer and use it in GitHub Desktop.
FFIでLXCをbindする - great
require 'ffi'
module LXC
extend FFI::Library
ffi_lib "/usr/local/lxc/lib/liblxc.so"
attach_function :lxc_stop, [ :string ], :int
end
puts LXC::lxc_stop(ARGV[0])
@mizzy
Copy link

mizzy commented Feb 22, 2012

これすごい。

@hiboma
Copy link
Author

hiboma commented Feb 23, 2012

lxc_attachが動かないのは

  • ffiがスレッド生成してる ?
root      3573  3573  0.0    2  0.5  39312  7012 pts/0    Sl+  23:44   0:00 ruby test.rb
root      3573  3599  0.0    2  0.5  39312  7012 pts/0    Sl+  23:44   0:00 ruby test.rb
  • setnsシステムコールがマルチスレッドの場合(fs->users >1) -EINVAL 返す?

ざっくり。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment