criu 0.0.1.pre → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e9262d47352fc3da0e1729b410a9e792e4b534af85c1d90cda96a58a2b4660d
4
- data.tar.gz: 2701acf7b0236064d4799bdcfc51704ae08ff2af7bb1e7fc882ff192a3a6edad
3
+ metadata.gz: 8c7819b88b5d2942b68599f22e14890efb10572d251f173adab7d879a09324a6
4
+ data.tar.gz: 283e5f867f14d720ff4c1c546b71eb87c95f29f3fde391f0af45075431c33dd4
5
5
  SHA512:
6
- metadata.gz: c24d6ae5330fae3848b44fd70f1cbad25d6b75d9caa723562b39122806323453a7418c8ff50fafef48bd343fca0f09e4bab7a04544b045788dc1fff7f388f983
7
- data.tar.gz: 4152469599d08309edc2e3085feb3a59f0f739ed9ec42e823aff9167c23b0bc4583c54bc540c326fece87296bab65501517b9dd2bf3b2efafdb31fbe0b38482b
6
+ metadata.gz: 8b95ed2c5707523161ce8f8d95cd8e45fcf633d3645692076cf976c964e62310b7cc6c6c1755d4f114778de46fe3ca55f864cc8b012c2ffb97fffe4912f57596
7
+ data.tar.gz: cf5395378c7b1cd1b4b3f0123539a1ddee59dc94e9d53aa69f37739ca7b2476448bc475905f651356d1bb74a083376bd87b6fe9eaef2ac5fbabdce9f97711e9d
data/.gitignore CHANGED
@@ -11,3 +11,5 @@
11
11
  *.o
12
12
  *.a
13
13
  mkmf.log
14
+
15
+ Gemfile.lock
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # criu.gem
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/criu.svg)](https://badge.fury.io/rb/criu)
4
+
3
5
  A libcriu wrapper for CRuby
4
6
 
5
7
  ## Installation
@@ -1,9 +1,66 @@
1
- #include "criu.h"
1
+ #include "ruby-criu.h"
2
+ #include <criu/criu.h>
3
+ #include <stdio.h>
2
4
 
3
- VALUE rb_mCriu;
5
+ static VALUE
6
+ rb_criu_init_options (VALUE klass) {
7
+ if(criu_init_opts() < 0) {
8
+ rb_raise(rb_eRuntimeError, "criu_init_opts failed");
9
+ }
10
+ return Qtrue;
11
+ }
12
+
13
+ static VALUE
14
+ rb_criu_set_service_address (VALUE klass, VALUE path) {
15
+ criu_set_service_address(RSTRING_PTR(path));
16
+ return path;
17
+ }
18
+
19
+ static VALUE
20
+ rb_criu_set_images_dir_fd (VALUE klass, VALUE fd) {
21
+ criu_set_images_dir_fd(NUM2INT(fd));
22
+ return fd;
23
+ }
24
+
25
+ static VALUE
26
+ rb_criu_set_pid (VALUE klass, VALUE pid) {
27
+ criu_set_pid(NUM2INT(pid));
28
+ return pid;
29
+ }
30
+
31
+ static VALUE
32
+ rb_criu_set_log_level (VALUE klass, VALUE level) {
33
+ criu_set_log_level(NUM2INT(level));
34
+ return level;
35
+ }
36
+
37
+ static VALUE
38
+ rb_criu_set_log_file (VALUE klass, VALUE path) {
39
+ criu_set_log_file(RSTRING_PTR(path));
40
+ return path;
41
+ }
42
+
43
+ static VALUE
44
+ rb_criu_dump (VALUE klass) {
45
+ if(criu_dump() < 0) {
46
+ perror("ruby-criu"); /* FIXME: debug... */
47
+ rb_raise(rb_eRuntimeError, "criu_dump failed");
48
+ }
49
+ return Qtrue;
50
+ }
4
51
 
5
52
  void
6
53
  Init_criu(void)
7
54
  {
8
- rb_mCriu = rb_define_module("Criu");
55
+ VALUE rb_mCriu;
56
+
57
+ rb_mCriu = rb_define_module("CRIU");
58
+ rb_define_module_function(rb_mCriu, "_init_options", rb_criu_init_options, 0);
59
+ rb_define_module_function(rb_mCriu, "service_address=", rb_criu_set_service_address, 1);
60
+ rb_define_module_function(rb_mCriu, "_set_images_dir_fd", rb_criu_set_images_dir_fd, 1);
61
+ rb_define_module_function(rb_mCriu, "pid=", rb_criu_set_pid, 1);
62
+ rb_define_module_function(rb_mCriu, "log_level=", rb_criu_set_log_level, 1);
63
+ rb_define_module_function(rb_mCriu, "log_file=", rb_criu_set_log_file, 1);
64
+
65
+ rb_define_module_function(rb_mCriu, "dump", rb_criu_dump, 0);
9
66
  }
@@ -1,3 +1,6 @@
1
1
  require "mkmf"
2
2
 
3
+ abort "missing libcriu" unless have_library("criu")
4
+ abort "missing <criu/criu.h>" unless have_header("criu/criu.h")
5
+
3
6
  create_makefile("criu/criu")
@@ -0,0 +1,6 @@
1
+ #ifndef RUBY_CRIU_H
2
+ #define RUBY_CRIU_H 1
3
+
4
+ #include "ruby.h"
5
+
6
+ #endif /* RUBY_CRIU_H */
@@ -4,4 +4,12 @@ require "criu/criu"
4
4
  module CRIU
5
5
  class Error < StandardError; end
6
6
  # Your code goes here...
7
+
8
+ class << self
9
+ def images_dir=(path)
10
+ @images_dir = File.open(path, 'r')
11
+ self._set_images_dir_fd(@images_dir.fileno)
12
+ return path
13
+ end
14
+ end
7
15
  end
@@ -1,3 +1,3 @@
1
1
  module CRIU
2
- VERSION = "0.0.1.pre"
2
+ VERSION = "0.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: criu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.pre
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uchio Kondo
@@ -70,8 +70,8 @@ files:
70
70
  - bin/setup
71
71
  - criu.gemspec
72
72
  - ext/criu/criu.c
73
- - ext/criu/criu.h
74
73
  - ext/criu/extconf.rb
74
+ - ext/criu/ruby-criu.h
75
75
  - lib/criu.rb
76
76
  - lib/criu/version.rb
77
77
  homepage: https://github.com/udzura/ruby-criu
@@ -92,9 +92,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ">"
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: 1.3.1
97
+ version: '0'
98
98
  requirements: []
99
99
  rubyforge_project:
100
100
  rubygems_version: 2.7.6
@@ -1,6 +0,0 @@
1
- #ifndef CRIU_H
2
- #define CRIU_H 1
3
-
4
- #include "ruby.h"
5
-
6
- #endif /* CRIU_H */