eventmachine 1.0.7-java → 1.0.8-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/em.h CHANGED
@@ -97,6 +97,16 @@ class EventableDescriptor;
97
97
  class InotifyDescriptor;
98
98
  struct SelectData_t;
99
99
 
100
+ /*************
101
+ enum Poller_t
102
+ *************/
103
+ enum Poller_t {
104
+ Poller_Default, // typically Select
105
+ Poller_Epoll,
106
+ Poller_Kqueue
107
+ };
108
+
109
+
100
110
  /********************
101
111
  class EventMachine_t
102
112
  ********************/
@@ -111,29 +121,30 @@ class EventMachine_t
111
121
  static void SetSimultaneousAcceptCount (int);
112
122
 
113
123
  public:
114
- EventMachine_t (EMCallback);
124
+ EventMachine_t (EMCallback, Poller_t);
115
125
  virtual ~EventMachine_t();
116
126
 
127
+ bool RunOnce();
117
128
  void Run();
118
129
  void ScheduleHalt();
119
130
  void SignalLoopBreaker();
120
- const unsigned long InstallOneshotTimer (int);
121
- const unsigned long ConnectToServer (const char *, int, const char *, int);
122
- const unsigned long ConnectToUnixServer (const char *);
123
-
124
- const unsigned long CreateTcpServer (const char *, int);
125
- const unsigned long OpenDatagramSocket (const char *, int);
126
- const unsigned long CreateUnixDomainServer (const char*);
127
- const unsigned long AttachSD (int);
128
- const unsigned long OpenKeyboard();
131
+ const uintptr_t InstallOneshotTimer (int);
132
+ const uintptr_t ConnectToServer (const char *, int, const char *, int);
133
+ const uintptr_t ConnectToUnixServer (const char *);
134
+
135
+ const uintptr_t CreateTcpServer (const char *, int);
136
+ const uintptr_t OpenDatagramSocket (const char *, int);
137
+ const uintptr_t CreateUnixDomainServer (const char*);
138
+ const uintptr_t AttachSD (int);
139
+ const uintptr_t OpenKeyboard();
129
140
  //const char *Popen (const char*, const char*);
130
- const unsigned long Socketpair (char* const*);
141
+ const uintptr_t Socketpair (char* const*);
131
142
 
132
143
  void Add (EventableDescriptor*);
133
144
  void Modify (EventableDescriptor*);
134
145
  void Deregister (EventableDescriptor*);
135
146
 
136
- const unsigned long AttachFD (int, bool);
147
+ const uintptr_t AttachFD (int, bool);
137
148
  int DetachFD (EventableDescriptor*);
138
149
 
139
150
  void ArmKqueueWriter (EventableDescriptor*);
@@ -150,18 +161,18 @@ class EventMachine_t
150
161
  float GetHeartbeatInterval();
151
162
  int SetHeartbeatInterval(float);
152
163
 
153
- const unsigned long WatchFile (const char*);
164
+ const uintptr_t WatchFile (const char*);
154
165
  void UnwatchFile (int);
155
- void UnwatchFile (const unsigned long);
166
+ void UnwatchFile (const uintptr_t);
156
167
 
157
168
  #ifdef HAVE_KQUEUE
158
169
  void _HandleKqueueFileEvent (struct kevent*);
159
170
  void _RegisterKqueueFileEvent(int);
160
171
  #endif
161
172
 
162
- const unsigned long WatchPid (int);
173
+ const uintptr_t WatchPid (int);
163
174
  void UnwatchPid (int);
164
- void UnwatchPid (const unsigned long);
175
+ void UnwatchPid (const uintptr_t);
165
176
 
166
177
  #ifdef HAVE_KQUEUE
167
178
  void _HandleKqueuePidEvent (struct kevent*);
@@ -169,20 +180,14 @@ class EventMachine_t
169
180
 
170
181
  uint64_t GetCurrentLoopTime() { return MyCurrentLoopTime; }
171
182
 
172
- // Temporary:
173
- void _UseEpoll();
174
- void _UseKqueue();
175
-
176
- bool UsingKqueue() { return bKqueue; }
177
- bool UsingEpoll() { return bEpoll; }
178
-
179
183
  void QueueHeartbeat(EventableDescriptor*);
180
184
  void ClearHeartbeat(uint64_t, EventableDescriptor*);
181
185
 
182
186
  uint64_t GetRealTime();
183
187
 
188
+ Poller_t GetPoller() { return Poller; }
189
+
184
190
  private:
185
- void _RunOnce();
186
191
  void _RunTimers();
187
192
  void _UpdateTime();
188
193
  void _AddNewDescriptors();
@@ -223,8 +228,6 @@ class EventMachine_t
223
228
  vector<EventableDescriptor*> NewDescriptors;
224
229
  set<EventableDescriptor*> ModifiedDescriptors;
225
230
 
226
- uint64_t NextHeartbeatTime;
227
-
228
231
  int LoopBreakerReader;
229
232
  int LoopBreakerWriter;
230
233
  #ifdef OS_WIN32
@@ -248,19 +251,21 @@ class EventMachine_t
248
251
  bool bTerminateSignalReceived;
249
252
  SelectData_t *SelectData;
250
253
 
251
- bool bEpoll;
254
+ Poller_t Poller;
255
+
252
256
  int epfd; // Epoll file-descriptor
253
257
  #ifdef HAVE_EPOLL
254
258
  struct epoll_event epoll_events [MaxEvents];
255
259
  #endif
256
260
 
257
- bool bKqueue;
258
261
  int kqfd; // Kqueue file-descriptor
259
262
  #ifdef HAVE_KQUEUE
260
263
  struct kevent Karray [MaxEvents];
261
264
  #endif
262
265
 
266
+ #ifdef HAVE_INOTIFY
263
267
  InotifyDescriptor *inotify; // pollable descriptor for our inotify instance
268
+ #endif
264
269
  };
265
270
 
266
271
 
@@ -41,57 +41,58 @@ extern "C" {
41
41
  };
42
42
 
43
43
  void evma_initialize_library (EMCallback);
44
+ bool evma_run_machine_once();
44
45
  void evma_run_machine();
45
46
  void evma_release_library();
46
- const unsigned long evma_install_oneshot_timer (int seconds);
47
- const unsigned long evma_connect_to_server (const char *bind_addr, int bind_port, const char *server, int port);
48
- const unsigned long evma_connect_to_unix_server (const char *server);
49
-
50
- const unsigned long evma_attach_fd (int file_descriptor, int watch_mode);
51
- int evma_detach_fd (const unsigned long binding);
52
- int evma_get_file_descriptor (const unsigned long binding);
53
- int evma_is_notify_readable (const unsigned long binding);
54
- void evma_set_notify_readable (const unsigned long binding, int mode);
55
- int evma_is_notify_writable (const unsigned long binding);
56
- void evma_set_notify_writable (const unsigned long binding, int mode);
57
-
58
- int evma_pause(const unsigned long binding);
59
- int evma_is_paused(const unsigned long binding);
60
- int evma_resume(const unsigned long binding);
61
-
62
- int evma_num_close_scheduled();
63
-
64
- void evma_stop_tcp_server (const unsigned long signature);
65
- const unsigned long evma_create_tcp_server (const char *address, int port);
66
- const unsigned long evma_create_unix_domain_server (const char *filename);
67
- const unsigned long evma_attach_sd (int sd);
68
- const unsigned long evma_open_datagram_socket (const char *server, int port);
69
- const unsigned long evma_open_keyboard();
70
- void evma_set_tls_parms (const unsigned long binding, const char *privatekey_filename, const char *certchain_filenane, int verify_peer);
71
- void evma_start_tls (const unsigned long binding);
47
+ const uintptr_t evma_install_oneshot_timer (int seconds);
48
+ const uintptr_t evma_connect_to_server (const char *bind_addr, int bind_port, const char *server, int port);
49
+ const uintptr_t evma_connect_to_unix_server (const char *server);
50
+
51
+ const uintptr_t evma_attach_fd (int file_descriptor, int watch_mode);
52
+ int evma_detach_fd (const uintptr_t binding);
53
+ int evma_get_file_descriptor (const uintptr_t binding);
54
+ int evma_is_notify_readable (const uintptr_t binding);
55
+ void evma_set_notify_readable (const uintptr_t binding, int mode);
56
+ int evma_is_notify_writable (const uintptr_t binding);
57
+ void evma_set_notify_writable (const uintptr_t binding, int mode);
58
+
59
+ int evma_pause(const uintptr_t binding);
60
+ int evma_is_paused(const uintptr_t binding);
61
+ int evma_resume(const uintptr_t binding);
62
+
63
+ int evma_num_close_scheduled();
64
+
65
+ void evma_stop_tcp_server (const uintptr_t binding);
66
+ const uintptr_t evma_create_tcp_server (const char *address, int port);
67
+ const uintptr_t evma_create_unix_domain_server (const char *filename);
68
+ const uintptr_t evma_attach_sd (int sd);
69
+ const uintptr_t evma_open_datagram_socket (const char *server, int port);
70
+ const uintptr_t evma_open_keyboard();
71
+ void evma_set_tls_parms (const uintptr_t binding, const char *privatekey_filename, const char *certchain_filenane, int verify_peer);
72
+ void evma_start_tls (const uintptr_t binding);
72
73
 
73
74
  #ifdef WITH_SSL
74
- X509 *evma_get_peer_cert (const unsigned long binding);
75
- void evma_accept_ssl_peer (const unsigned long binding);
75
+ X509 *evma_get_peer_cert (const uintptr_t binding);
76
+ void evma_accept_ssl_peer (const uintptr_t binding);
76
77
  #endif
77
78
 
78
- int evma_get_peername (const unsigned long binding, struct sockaddr*, socklen_t*);
79
- int evma_get_sockname (const unsigned long binding, struct sockaddr*, socklen_t*);
80
- int evma_get_subprocess_pid (const unsigned long binding, pid_t*);
81
- int evma_get_subprocess_status (const unsigned long binding, int*);
79
+ int evma_get_peername (const uintptr_t binding, struct sockaddr*, socklen_t*);
80
+ int evma_get_sockname (const uintptr_t binding, struct sockaddr*, socklen_t*);
81
+ int evma_get_subprocess_pid (const uintptr_t binding, pid_t*);
82
+ int evma_get_subprocess_status (const uintptr_t binding, int*);
82
83
  int evma_get_connection_count();
83
- int evma_send_data_to_connection (const unsigned long binding, const char *data, int data_length);
84
- int evma_send_datagram (const unsigned long binding, const char *data, int data_length, const char *address, int port);
85
- float evma_get_comm_inactivity_timeout (const unsigned long binding);
86
- int evma_set_comm_inactivity_timeout (const unsigned long binding, float value);
87
- float evma_get_pending_connect_timeout (const unsigned long binding);
88
- int evma_set_pending_connect_timeout (const unsigned long binding, float value);
89
- int evma_get_outbound_data_size (const unsigned long binding);
90
- uint64_t evma_get_last_activity_time (const unsigned long);
91
- int evma_send_file_data_to_connection (const unsigned long binding, const char *filename);
92
-
93
- void evma_close_connection (const unsigned long binding, int after_writing);
94
- int evma_report_connection_error_status (const unsigned long binding);
84
+ int evma_send_data_to_connection (const uintptr_t binding, const char *data, int data_length);
85
+ int evma_send_datagram (const uintptr_t binding, const char *data, int data_length, const char *address, int port);
86
+ float evma_get_comm_inactivity_timeout (const uintptr_t binding);
87
+ int evma_set_comm_inactivity_timeout (const uintptr_t binding, float value);
88
+ float evma_get_pending_connect_timeout (const uintptr_t binding);
89
+ int evma_set_pending_connect_timeout (const uintptr_t binding, float value);
90
+ int evma_get_outbound_data_size (const uintptr_t binding);
91
+ uint64_t evma_get_last_activity_time (const uintptr_t binding);
92
+ int evma_send_file_data_to_connection (const uintptr_t binding, const char *filename);
93
+
94
+ void evma_close_connection (const uintptr_t binding, int after_writing);
95
+ int evma_report_connection_error_status (const uintptr_t binding);
95
96
  void evma_signal_loopbreak();
96
97
  void evma_set_timer_quantum (int);
97
98
  int evma_get_max_timer_count();
@@ -103,17 +104,17 @@ extern "C" {
103
104
  float evma_get_heartbeat_interval();
104
105
  int evma_set_heartbeat_interval(float);
105
106
 
106
- const unsigned long evma_popen (char * const*cmd_strings);
107
+ const uintptr_t evma_popen (char * const*cmd_strings);
107
108
 
108
- const unsigned long evma_watch_filename (const char *fname);
109
- void evma_unwatch_filename (const unsigned long);
109
+ const uintptr_t evma_watch_filename (const char *fname);
110
+ void evma_unwatch_filename (const uintptr_t binding);
110
111
 
111
- const unsigned long evma_watch_pid (int);
112
- void evma_unwatch_pid (const unsigned long);
112
+ const uintptr_t evma_watch_pid (int);
113
+ void evma_unwatch_pid (const uintptr_t binding);
113
114
 
114
- void evma_start_proxy(const unsigned long, const unsigned long, const unsigned long, const unsigned long);
115
- void evma_stop_proxy(const unsigned long);
116
- unsigned long evma_proxied_bytes(const unsigned long);
115
+ void evma_start_proxy(const uintptr_t from, const uintptr_t to, const unsigned long bufsize, const unsigned long length);
116
+ void evma_stop_proxy(const uintptr_t from);
117
+ unsigned long evma_proxied_bytes(const uintptr_t from);
117
118
 
118
119
  int evma_set_rlimit_nofile (int n_files);
119
120
 
@@ -25,15 +25,15 @@ end
25
25
  def manual_ssl_config
26
26
  ssl_libs_heads_args = {
27
27
  :unix => [%w[ssl crypto], %w[openssl/ssl.h openssl/err.h]],
28
- :mswin => [%w[ssleay32 eay32], %w[openssl/ssl.h openssl/err.h]],
28
+ :mswin => [%w[ssleay32 libeay32], %w[openssl/ssl.h openssl/err.h]],
29
29
  }
30
30
 
31
31
  dc_flags = ['ssl']
32
32
  dc_flags += ["#{ENV['OPENSSL']}/include", ENV['OPENSSL']] if /linux/ =~ RUBY_PLATFORM and ENV['OPENSSL']
33
33
 
34
34
  libs, heads = case RUBY_PLATFORM
35
- when /mswin/ ; ssl_libs_heads_args[:mswin]
36
- else ssl_libs_heads_args[:unix]
35
+ when /mswin|mingw|bccwin/ ; ssl_libs_heads_args[:mswin]
36
+ else ssl_libs_heads_args[:unix]
37
37
  end
38
38
  dir_config(*dc_flags)
39
39
  check_libs(libs) and check_heads(heads)
@@ -76,6 +76,9 @@ add_define "HAVE_OLD_INOTIFY" if !inotify && have_macro('__NR_inotify_init', 'sy
76
76
  add_define 'HAVE_WRITEV' if have_func('writev', 'sys/uio.h')
77
77
  add_define 'HAVE_RB_THREAD_FD_SELECT' if have_func('rb_thread_fd_select')
78
78
  add_define 'HAVE_RB_FDSET_T' if have_type('rb_fdset_t', 'ruby/intern.h')
79
+ add_define 'HAVE_PIPE2' if have_func('pipe2', 'unistd.h')
80
+ add_define 'HAVE_ACCEPT4' if have_func('accept4', 'sys/socket.h')
81
+ add_define 'HAVE_SOCK_CLOEXEC' if have_const('SOCK_CLOEXEC', 'sys/socket.h')
79
82
 
80
83
  have_func('rb_wait_for_single_fd')
81
84
  have_func('rb_enable_interrupt')
@@ -172,6 +175,26 @@ else
172
175
  CONFIG['LDSHARED'] = "$(CXX) -shared"
173
176
  end
174
177
 
178
+ # This is our wishlist. We use whichever flags work on the host.
179
+ # In the future, add -Werror to make sure all warnings are resolved.
180
+ # deprecated-declarations are used in OS X OpenSSL
181
+ # ignored-qualifiers are used by the Bindings (would-be void *)
182
+ # unused-result because GCC 4.6 no longer silences (void) ignore_this(function)
183
+ %w(
184
+ -Wall
185
+ -Wextra
186
+ -Wno-deprecated-declarations
187
+ -Wno-ignored-qualifiers
188
+ -Wno-unused-result
189
+ ).select do |flag|
190
+ try_link('int main() {return 0;}', flag)
191
+ end.each do |flag|
192
+ $CFLAGS << ' ' << flag
193
+ $CPPFLAGS << ' ' << flag
194
+ end
195
+ puts "CFLAGS=#{$CFLAGS}"
196
+ puts "CPPFLAGS=#{$CPPFLAGS}"
197
+
175
198
  # Platform-specific time functions
176
199
  if have_func('clock_gettime')
177
200
  # clock_gettime is POSIX, but the monotonic clocks are not
@@ -48,7 +48,7 @@ mapper_new
48
48
 
49
49
  static VALUE mapper_new (VALUE self, VALUE filename)
50
50
  {
51
- Mapper_t *m = new Mapper_t (StringValuePtr (filename));
51
+ Mapper_t *m = new Mapper_t (StringValueCStr (filename));
52
52
  if (!m)
53
53
  rb_raise (rb_eException, "No Mapper Object");
54
54
  VALUE v = Data_Wrap_Struct (Mapper, 0, mapper_dt, (void*)m);
data/ext/kb.cpp CHANGED
@@ -74,6 +74,6 @@ KeyboardDescriptor::Read
74
74
  void KeyboardDescriptor::Read()
75
75
  {
76
76
  char c;
77
- read (GetSocket(), &c, 1);
77
+ (void)read (GetSocket(), &c, 1);
78
78
  _GenericInboundDispatch(&c, 1);
79
79
  }
@@ -242,7 +242,9 @@ void PipeDescriptor::Write()
242
242
  OutboundPages.push_front (OutboundPage (buffer, len));
243
243
  }
244
244
  #ifdef HAVE_EPOLL
245
- EpollEvent.events = (EPOLLIN | (SelectForWrite() ? EPOLLOUT : 0));
245
+ EpollEvent.events = EPOLLIN;
246
+ if (SelectForWrite())
247
+ EpollEvent.events |= EPOLLOUT;
246
248
  assert (MyEventMachine);
247
249
  MyEventMachine->Modify (this);
248
250
  #endif
@@ -305,7 +307,7 @@ bool PipeDescriptor::SelectForWrite()
305
307
  PipeDescriptor::SendOutboundData
306
308
  ********************************/
307
309
 
308
- int PipeDescriptor::SendOutboundData (const char *data, int length)
310
+ int PipeDescriptor::SendOutboundData (const char *data, unsigned long length)
309
311
  {
310
312
  //if (bCloseNow || bCloseAfterWriting)
311
313
  if (IsCloseScheduled())
@@ -155,6 +155,12 @@ extern "C" {
155
155
  }
156
156
  #endif
157
157
 
158
+ #if defined(__GNUC__) && (__GNUC__ >= 3)
159
+ #define UNUSED __attribute__ ((unused))
160
+ #else
161
+ #define UNUSED
162
+ #endif
163
+
158
164
  #include "binder.h"
159
165
  #include "em.h"
160
166
  #include "ed.h"
@@ -25,6 +25,16 @@ See the file COPYING for complete licensing information.
25
25
  #define RFLOAT_VALUE(arg) RFLOAT(arg)->value
26
26
  #endif
27
27
 
28
+ /* Adapted from NUM2BSIG / BSIG2NUM in ext/fiddle/conversions.h,
29
+ * we'll call it a BSIG for Binding Signature here. */
30
+ #if SIZEOF_VOIDP == SIZEOF_LONG
31
+ # define BSIG2NUM(x) (ULONG2NUM((unsigned long)(x)))
32
+ # define NUM2BSIG(x) (NUM2ULONG(x))
33
+ #else
34
+ # define BSIG2NUM(x) (ULL2NUM((unsigned long long)(x)))
35
+ # define NUM2BSIG(x) (NUM2ULL(x))
36
+ #endif
37
+
28
38
  /*******
29
39
  Statics
30
40
  *******/
@@ -59,15 +69,15 @@ static VALUE Intern_connection_completed;
59
69
  static VALUE rb_cProcStatus;
60
70
 
61
71
  struct em_event {
62
- unsigned long signature;
72
+ uintptr_t signature;
63
73
  int event;
64
74
  const char *data_str;
65
75
  unsigned long data_num;
66
76
  };
67
77
 
68
- static inline VALUE ensure_conn(const unsigned long signature)
78
+ static inline VALUE ensure_conn(const uintptr_t signature)
69
79
  {
70
- VALUE conn = rb_hash_aref (EmConnsHash, ULONG2NUM (signature));
80
+ VALUE conn = rb_hash_aref (EmConnsHash, BSIG2NUM (signature));
71
81
  if (conn == Qnil)
72
82
  rb_raise (EM_eConnectionNotBound, "unknown connection: %lu", signature);
73
83
  return conn;
@@ -80,7 +90,7 @@ t_event_callback
80
90
 
81
91
  static inline void event_callback (struct em_event* e)
82
92
  {
83
- const unsigned long signature = e->signature;
93
+ const uintptr_t signature = e->signature;
84
94
  int event = e->event;
85
95
  const char *data_str = e->data_str;
86
96
  const unsigned long data_num = e->data_num;
@@ -88,7 +98,7 @@ static inline void event_callback (struct em_event* e)
88
98
  switch (event) {
89
99
  case EM_CONNECTION_READ:
90
100
  {
91
- VALUE conn = rb_hash_aref (EmConnsHash, ULONG2NUM (signature));
101
+ VALUE conn = rb_hash_aref (EmConnsHash, BSIG2NUM (signature));
92
102
  if (conn == Qnil)
93
103
  rb_raise (EM_eConnectionNotBound, "received %lu bytes of data for unknown signature: %lu", data_num, signature);
94
104
  rb_funcall (conn, Intern_receive_data, 1, rb_str_new (data_str, data_num));
@@ -96,12 +106,12 @@ static inline void event_callback (struct em_event* e)
96
106
  }
97
107
  case EM_CONNECTION_ACCEPTED:
98
108
  {
99
- rb_funcall (EmModule, Intern_event_callback, 3, ULONG2NUM(signature), INT2FIX(event), ULONG2NUM(data_num));
109
+ rb_funcall (EmModule, Intern_event_callback, 3, BSIG2NUM(signature), INT2FIX(event), ULONG2NUM(data_num));
100
110
  return;
101
111
  }
102
112
  case EM_CONNECTION_UNBOUND:
103
113
  {
104
- rb_funcall (EmModule, Intern_event_callback, 3, ULONG2NUM(signature), INT2FIX(event), ULONG2NUM(data_num));
114
+ rb_funcall (EmModule, Intern_event_callback, 3, BSIG2NUM(signature), INT2FIX(event), ULONG2NUM(data_num));
105
115
  return;
106
116
  }
107
117
  case EM_CONNECTION_COMPLETED:
@@ -174,7 +184,7 @@ static inline void event_callback (struct em_event* e)
174
184
  event_error_handler
175
185
  *******************/
176
186
 
177
- static void event_error_handler(VALUE unused, VALUE err)
187
+ static void event_error_handler(VALUE self UNUSED, VALUE err)
178
188
  {
179
189
  VALUE error_handler = rb_ivar_get(EmModule, Intern_at_error_handler);
180
190
  rb_funcall (error_handler, Intern_call, 1, err);
@@ -184,7 +194,7 @@ static void event_error_handler(VALUE unused, VALUE err)
184
194
  event_callback_wrapper
185
195
  **********************/
186
196
 
187
- static void event_callback_wrapper (const unsigned long signature, int event, const char *data_str, const unsigned long data_num)
197
+ static void event_callback_wrapper (const uintptr_t signature, int event, const char *data_str, const unsigned long data_num)
188
198
  {
189
199
  struct em_event e;
190
200
  e.signature = signature;
@@ -202,7 +212,7 @@ static void event_callback_wrapper (const unsigned long signature, int event, co
202
212
  t_initialize_event_machine
203
213
  **************************/
204
214
 
205
- static VALUE t_initialize_event_machine (VALUE self)
215
+ static VALUE t_initialize_event_machine (VALUE self UNUSED)
206
216
  {
207
217
  EmConnsHash = rb_ivar_get (EmModule, Intern_at_conns);
208
218
  EmTimersHash = rb_ivar_get (EmModule, Intern_at_timers);
@@ -213,12 +223,21 @@ static VALUE t_initialize_event_machine (VALUE self)
213
223
  }
214
224
 
215
225
 
226
+ /******************
227
+ t_run_machine_once
228
+ ******************/
216
229
 
217
- /*****************************
218
- t_run_machine_without_threads
219
- *****************************/
230
+ static VALUE t_run_machine_once (VALUE self UNUSED)
231
+ {
232
+ return evma_run_machine_once () ? Qtrue : Qfalse;
233
+ }
220
234
 
221
- static VALUE t_run_machine_without_threads (VALUE self)
235
+
236
+ /*************
237
+ t_run_machine
238
+ *************/
239
+
240
+ static VALUE t_run_machine (VALUE self UNUSED)
222
241
  {
223
242
  evma_run_machine();
224
243
  return Qnil;
@@ -229,12 +248,12 @@ static VALUE t_run_machine_without_threads (VALUE self)
229
248
  t_add_oneshot_timer
230
249
  *******************/
231
250
 
232
- static VALUE t_add_oneshot_timer (VALUE self, VALUE interval)
251
+ static VALUE t_add_oneshot_timer (VALUE self UNUSED, VALUE interval)
233
252
  {
234
- const unsigned long f = evma_install_oneshot_timer (FIX2INT (interval));
253
+ const uintptr_t f = evma_install_oneshot_timer (FIX2INT (interval));
235
254
  if (!f)
236
255
  rb_raise (rb_eRuntimeError, "%s", "ran out of timers; use #set_max_timers to increase limit");
237
- return ULONG2NUM (f);
256
+ return BSIG2NUM (f);
238
257
  }
239
258
 
240
259
 
@@ -242,21 +261,21 @@ static VALUE t_add_oneshot_timer (VALUE self, VALUE interval)
242
261
  t_start_server
243
262
  **************/
244
263
 
245
- static VALUE t_start_server (VALUE self, VALUE server, VALUE port)
264
+ static VALUE t_start_server (VALUE self UNUSED, VALUE server, VALUE port)
246
265
  {
247
- const unsigned long f = evma_create_tcp_server (StringValuePtr(server), FIX2INT(port));
266
+ const uintptr_t f = evma_create_tcp_server (StringValueCStr(server), FIX2INT(port));
248
267
  if (!f)
249
268
  rb_raise (rb_eRuntimeError, "%s", "no acceptor (port is in use or requires root privileges)");
250
- return ULONG2NUM (f);
269
+ return BSIG2NUM (f);
251
270
  }
252
271
 
253
272
  /*************
254
273
  t_stop_server
255
274
  *************/
256
275
 
257
- static VALUE t_stop_server (VALUE self, VALUE signature)
276
+ static VALUE t_stop_server (VALUE self UNUSED, VALUE signature)
258
277
  {
259
- evma_stop_tcp_server (NUM2ULONG (signature));
278
+ evma_stop_tcp_server (NUM2BSIG (signature));
260
279
  return Qnil;
261
280
  }
262
281
 
@@ -265,24 +284,24 @@ static VALUE t_stop_server (VALUE self, VALUE signature)
265
284
  t_start_unix_server
266
285
  *******************/
267
286
 
268
- static VALUE t_start_unix_server (VALUE self, VALUE filename)
287
+ static VALUE t_start_unix_server (VALUE self UNUSED, VALUE filename)
269
288
  {
270
- const unsigned long f = evma_create_unix_domain_server (StringValuePtr(filename));
289
+ const uintptr_t f = evma_create_unix_domain_server (StringValueCStr(filename));
271
290
  if (!f)
272
291
  rb_raise (rb_eRuntimeError, "%s", "no unix-domain acceptor");
273
- return ULONG2NUM (f);
292
+ return BSIG2NUM (f);
274
293
  }
275
294
 
276
295
  /********************
277
296
  t_attach_sd
278
297
  ********************/
279
298
 
280
- static VALUE t_attach_sd(VALUE self, VALUE sd)
299
+ static VALUE t_attach_sd(VALUE self UNUSED, VALUE sd)
281
300
  {
282
- const unsigned long f = evma_attach_sd(FIX2INT(sd));
301
+ const uintptr_t f = evma_attach_sd(FIX2INT(sd));
283
302
  if (!f)
284
303
  rb_raise (rb_eRuntimeError, "%s", "no socket descriptor acceptor");
285
- return ULONG2NUM (f);
304
+ return BSIG2NUM (f);
286
305
  }
287
306
 
288
307
 
@@ -290,9 +309,9 @@ static VALUE t_attach_sd(VALUE self, VALUE sd)
290
309
  t_send_data
291
310
  ***********/
292
311
 
293
- static VALUE t_send_data (VALUE self, VALUE signature, VALUE data, VALUE data_length)
312
+ static VALUE t_send_data (VALUE self UNUSED, VALUE signature, VALUE data, VALUE data_length)
294
313
  {
295
- int b = evma_send_data_to_connection (NUM2ULONG (signature), StringValuePtr (data), FIX2INT (data_length));
314
+ int b = evma_send_data_to_connection (NUM2BSIG (signature), StringValuePtr (data), FIX2INT (data_length));
296
315
  return INT2NUM (b);
297
316
  }
298
317
 
@@ -301,9 +320,9 @@ static VALUE t_send_data (VALUE self, VALUE signature, VALUE data, VALUE data_le
301
320
  t_start_tls
302
321
  ***********/
303
322
 
304
- static VALUE t_start_tls (VALUE self, VALUE signature)
323
+ static VALUE t_start_tls (VALUE self UNUSED, VALUE signature)
305
324
  {
306
- evma_start_tls (NUM2ULONG (signature));
325
+ evma_start_tls (NUM2BSIG (signature));
307
326
  return Qnil;
308
327
  }
309
328
 
@@ -311,14 +330,14 @@ static VALUE t_start_tls (VALUE self, VALUE signature)
311
330
  t_set_tls_parms
312
331
  ***************/
313
332
 
314
- static VALUE t_set_tls_parms (VALUE self, VALUE signature, VALUE privkeyfile, VALUE certchainfile, VALUE verify_peer)
333
+ static VALUE t_set_tls_parms (VALUE self UNUSED, VALUE signature, VALUE privkeyfile, VALUE certchainfile, VALUE verify_peer)
315
334
  {
316
335
  /* set_tls_parms takes a series of positional arguments for specifying such things
317
336
  * as private keys and certificate chains.
318
337
  * It's expected that the parameter list will grow as we add more supported features.
319
338
  * ALL of these parameters are optional, and can be specified as empty or NULL strings.
320
339
  */
321
- evma_set_tls_parms (NUM2ULONG (signature), StringValuePtr (privkeyfile), StringValuePtr (certchainfile), (verify_peer == Qtrue ? 1 : 0));
340
+ evma_set_tls_parms (NUM2BSIG (signature), StringValueCStr (privkeyfile), StringValueCStr (certchainfile), (verify_peer == Qtrue ? 1 : 0));
322
341
  return Qnil;
323
342
  }
324
343
 
@@ -326,7 +345,7 @@ static VALUE t_set_tls_parms (VALUE self, VALUE signature, VALUE privkeyfile, VA
326
345
  t_get_peer_cert
327
346
  ***************/
328
347
 
329
- static VALUE t_get_peer_cert (VALUE self, VALUE signature)
348
+ static VALUE t_get_peer_cert (VALUE self UNUSED, VALUE signature)
330
349
  {
331
350
  VALUE ret = Qnil;
332
351
 
@@ -335,7 +354,7 @@ static VALUE t_get_peer_cert (VALUE self, VALUE signature)
335
354
  BUF_MEM *buf;
336
355
  BIO *out;
337
356
 
338
- cert = evma_get_peer_cert (NUM2ULONG (signature));
357
+ cert = evma_get_peer_cert (NUM2BSIG (signature));
339
358
 
340
359
  if (cert != NULL) {
341
360
  out = BIO_new(BIO_s_mem());
@@ -354,11 +373,11 @@ static VALUE t_get_peer_cert (VALUE self, VALUE signature)
354
373
  t_get_peername
355
374
  **************/
356
375
 
357
- static VALUE t_get_peername (VALUE self, VALUE signature)
376
+ static VALUE t_get_peername (VALUE self UNUSED, VALUE signature)
358
377
  {
359
378
  char buf[1024];
360
379
  socklen_t len = sizeof buf;
361
- if (evma_get_peername (NUM2ULONG (signature), (struct sockaddr*)buf, &len)) {
380
+ if (evma_get_peername (NUM2BSIG (signature), (struct sockaddr*)buf, &len)) {
362
381
  return rb_str_new (buf, len);
363
382
  }
364
383
 
@@ -369,11 +388,11 @@ static VALUE t_get_peername (VALUE self, VALUE signature)
369
388
  t_get_sockname
370
389
  **************/
371
390
 
372
- static VALUE t_get_sockname (VALUE self, VALUE signature)
391
+ static VALUE t_get_sockname (VALUE self UNUSED, VALUE signature)
373
392
  {
374
393
  char buf[1024];
375
394
  socklen_t len = sizeof buf;
376
- if (evma_get_sockname (NUM2ULONG (signature), (struct sockaddr*)buf, &len)) {
395
+ if (evma_get_sockname (NUM2BSIG (signature), (struct sockaddr*)buf, &len)) {
377
396
  return rb_str_new (buf, len);
378
397
  }
379
398
 
@@ -384,10 +403,10 @@ static VALUE t_get_sockname (VALUE self, VALUE signature)
384
403
  t_get_subprocess_pid
385
404
  ********************/
386
405
 
387
- static VALUE t_get_subprocess_pid (VALUE self, VALUE signature)
406
+ static VALUE t_get_subprocess_pid (VALUE self UNUSED, VALUE signature)
388
407
  {
389
408
  pid_t pid;
390
- if (evma_get_subprocess_pid (NUM2ULONG (signature), &pid)) {
409
+ if (evma_get_subprocess_pid (NUM2BSIG (signature), &pid)) {
391
410
  return INT2NUM (pid);
392
411
  }
393
412
 
@@ -398,15 +417,15 @@ static VALUE t_get_subprocess_pid (VALUE self, VALUE signature)
398
417
  t_get_subprocess_status
399
418
  ***********************/
400
419
 
401
- static VALUE t_get_subprocess_status (VALUE self, VALUE signature)
420
+ static VALUE t_get_subprocess_status (VALUE self UNUSED, VALUE signature)
402
421
  {
403
422
  VALUE proc_status = Qnil;
404
423
 
405
424
  int status;
406
425
  pid_t pid;
407
426
 
408
- if (evma_get_subprocess_status (NUM2ULONG (signature), &status)) {
409
- if (evma_get_subprocess_pid (NUM2ULONG (signature), &pid)) {
427
+ if (evma_get_subprocess_status (NUM2BSIG (signature), &status)) {
428
+ if (evma_get_subprocess_pid (NUM2BSIG (signature), &pid)) {
410
429
  proc_status = rb_obj_alloc(rb_cProcStatus);
411
430
 
412
431
  /* MRI Ruby uses hidden instance vars */
@@ -434,7 +453,7 @@ static VALUE t_get_subprocess_status (VALUE self, VALUE signature)
434
453
  t_get_connection_count
435
454
  **********************/
436
455
 
437
- static VALUE t_get_connection_count (VALUE self)
456
+ static VALUE t_get_connection_count (VALUE self UNUSED)
438
457
  {
439
458
  return INT2NUM(evma_get_connection_count());
440
459
  }
@@ -443,19 +462,19 @@ static VALUE t_get_connection_count (VALUE self)
443
462
  t_get_comm_inactivity_timeout
444
463
  *****************************/
445
464
 
446
- static VALUE t_get_comm_inactivity_timeout (VALUE self, VALUE signature)
465
+ static VALUE t_get_comm_inactivity_timeout (VALUE self UNUSED, VALUE signature)
447
466
  {
448
- return rb_float_new(evma_get_comm_inactivity_timeout(NUM2ULONG (signature)));
467
+ return rb_float_new(evma_get_comm_inactivity_timeout(NUM2BSIG (signature)));
449
468
  }
450
469
 
451
470
  /*****************************
452
471
  t_set_comm_inactivity_timeout
453
472
  *****************************/
454
473
 
455
- static VALUE t_set_comm_inactivity_timeout (VALUE self, VALUE signature, VALUE timeout)
474
+ static VALUE t_set_comm_inactivity_timeout (VALUE self UNUSED, VALUE signature, VALUE timeout)
456
475
  {
457
476
  float ti = RFLOAT_VALUE(timeout);
458
- if (evma_set_comm_inactivity_timeout(NUM2ULONG(signature), ti)) {
477
+ if (evma_set_comm_inactivity_timeout(NUM2BSIG(signature), ti)) {
459
478
  return Qtrue;
460
479
  }
461
480
  return Qfalse;
@@ -465,19 +484,19 @@ static VALUE t_set_comm_inactivity_timeout (VALUE self, VALUE signature, VALUE t
465
484
  t_get_pending_connect_timeout
466
485
  *****************************/
467
486
 
468
- static VALUE t_get_pending_connect_timeout (VALUE self, VALUE signature)
487
+ static VALUE t_get_pending_connect_timeout (VALUE self UNUSED, VALUE signature)
469
488
  {
470
- return rb_float_new(evma_get_pending_connect_timeout(NUM2ULONG (signature)));
489
+ return rb_float_new(evma_get_pending_connect_timeout(NUM2BSIG (signature)));
471
490
  }
472
491
 
473
492
  /*****************************
474
493
  t_set_pending_connect_timeout
475
494
  *****************************/
476
495
 
477
- static VALUE t_set_pending_connect_timeout (VALUE self, VALUE signature, VALUE timeout)
496
+ static VALUE t_set_pending_connect_timeout (VALUE self UNUSED, VALUE signature, VALUE timeout)
478
497
  {
479
498
  float ti = RFLOAT_VALUE(timeout);
480
- if (evma_set_pending_connect_timeout(NUM2ULONG(signature), ti)) {
499
+ if (evma_set_pending_connect_timeout(NUM2BSIG(signature), ti)) {
481
500
  return Qtrue;
482
501
  }
483
502
  return Qfalse;
@@ -487,9 +506,9 @@ static VALUE t_set_pending_connect_timeout (VALUE self, VALUE signature, VALUE t
487
506
  t_send_datagram
488
507
  ***************/
489
508
 
490
- static VALUE t_send_datagram (VALUE self, VALUE signature, VALUE data, VALUE data_length, VALUE address, VALUE port)
509
+ static VALUE t_send_datagram (VALUE self UNUSED, VALUE signature, VALUE data, VALUE data_length, VALUE address, VALUE port)
491
510
  {
492
- int b = evma_send_datagram (NUM2ULONG (signature), StringValuePtr (data), FIX2INT (data_length), StringValuePtr(address), FIX2INT(port));
511
+ int b = evma_send_datagram (NUM2BSIG (signature), StringValuePtr (data), FIX2INT (data_length), StringValueCStr(address), FIX2INT(port));
493
512
  return INT2NUM (b);
494
513
  }
495
514
 
@@ -498,9 +517,9 @@ static VALUE t_send_datagram (VALUE self, VALUE signature, VALUE data, VALUE dat
498
517
  t_close_connection
499
518
  ******************/
500
519
 
501
- static VALUE t_close_connection (VALUE self, VALUE signature, VALUE after_writing)
520
+ static VALUE t_close_connection (VALUE self UNUSED, VALUE signature, VALUE after_writing)
502
521
  {
503
- evma_close_connection (NUM2ULONG (signature), ((after_writing == Qtrue) ? 1 : 0));
522
+ evma_close_connection (NUM2BSIG (signature), ((after_writing == Qtrue) ? 1 : 0));
504
523
  return Qnil;
505
524
  }
506
525
 
@@ -508,9 +527,9 @@ static VALUE t_close_connection (VALUE self, VALUE signature, VALUE after_writin
508
527
  t_report_connection_error_status
509
528
  ********************************/
510
529
 
511
- static VALUE t_report_connection_error_status (VALUE self, VALUE signature)
530
+ static VALUE t_report_connection_error_status (VALUE self UNUSED, VALUE signature)
512
531
  {
513
- int b = evma_report_connection_error_status (NUM2ULONG (signature));
532
+ int b = evma_report_connection_error_status (NUM2BSIG (signature));
514
533
  return INT2NUM (b);
515
534
  }
516
535
 
@@ -520,17 +539,17 @@ static VALUE t_report_connection_error_status (VALUE self, VALUE signature)
520
539
  t_connect_server
521
540
  ****************/
522
541
 
523
- static VALUE t_connect_server (VALUE self, VALUE server, VALUE port)
542
+ static VALUE t_connect_server (VALUE self UNUSED, VALUE server, VALUE port)
524
543
  {
525
544
  // Avoid FIX2INT in this case, because it doesn't deal with type errors properly.
526
545
  // Specifically, if the value of port comes in as a string rather than an integer,
527
546
  // NUM2INT will throw a type error, but FIX2INT will generate garbage.
528
547
 
529
548
  try {
530
- const unsigned long f = evma_connect_to_server (NULL, 0, StringValuePtr(server), NUM2INT(port));
549
+ const uintptr_t f = evma_connect_to_server (NULL, 0, StringValueCStr(server), NUM2INT(port));
531
550
  if (!f)
532
551
  rb_raise (EM_eConnectionError, "%s", "no connection");
533
- return ULONG2NUM (f);
552
+ return BSIG2NUM (f);
534
553
  } catch (std::runtime_error e) {
535
554
  rb_raise (EM_eConnectionError, "%s", e.what());
536
555
  }
@@ -541,17 +560,17 @@ static VALUE t_connect_server (VALUE self, VALUE server, VALUE port)
541
560
  t_bind_connect_server
542
561
  *********************/
543
562
 
544
- static VALUE t_bind_connect_server (VALUE self, VALUE bind_addr, VALUE bind_port, VALUE server, VALUE port)
563
+ static VALUE t_bind_connect_server (VALUE self UNUSED, VALUE bind_addr, VALUE bind_port, VALUE server, VALUE port)
545
564
  {
546
565
  // Avoid FIX2INT in this case, because it doesn't deal with type errors properly.
547
566
  // Specifically, if the value of port comes in as a string rather than an integer,
548
567
  // NUM2INT will throw a type error, but FIX2INT will generate garbage.
549
568
 
550
569
  try {
551
- const unsigned long f = evma_connect_to_server (StringValuePtr(bind_addr), NUM2INT(bind_port), StringValuePtr(server), NUM2INT(port));
570
+ const uintptr_t f = evma_connect_to_server (StringValueCStr(bind_addr), NUM2INT(bind_port), StringValueCStr(server), NUM2INT(port));
552
571
  if (!f)
553
572
  rb_raise (EM_eConnectionError, "%s", "no connection");
554
- return ULONG2NUM (f);
573
+ return BSIG2NUM (f);
555
574
  } catch (std::runtime_error e) {
556
575
  rb_raise (EM_eConnectionError, "%s", e.what());
557
576
  }
@@ -562,50 +581,50 @@ static VALUE t_bind_connect_server (VALUE self, VALUE bind_addr, VALUE bind_port
562
581
  t_connect_unix_server
563
582
  *********************/
564
583
 
565
- static VALUE t_connect_unix_server (VALUE self, VALUE serversocket)
584
+ static VALUE t_connect_unix_server (VALUE self UNUSED, VALUE serversocket)
566
585
  {
567
- const unsigned long f = evma_connect_to_unix_server (StringValuePtr(serversocket));
586
+ const uintptr_t f = evma_connect_to_unix_server (StringValueCStr(serversocket));
568
587
  if (!f)
569
588
  rb_raise (rb_eRuntimeError, "%s", "no connection");
570
- return ULONG2NUM (f);
589
+ return BSIG2NUM (f);
571
590
  }
572
591
 
573
592
  /***********
574
593
  t_attach_fd
575
594
  ***********/
576
595
 
577
- static VALUE t_attach_fd (VALUE self, VALUE file_descriptor, VALUE watch_mode)
596
+ static VALUE t_attach_fd (VALUE self UNUSED, VALUE file_descriptor, VALUE watch_mode)
578
597
  {
579
- const unsigned long f = evma_attach_fd (NUM2INT(file_descriptor), watch_mode == Qtrue);
598
+ const uintptr_t f = evma_attach_fd (NUM2INT(file_descriptor), watch_mode == Qtrue);
580
599
  if (!f)
581
600
  rb_raise (rb_eRuntimeError, "%s", "no connection");
582
- return ULONG2NUM (f);
601
+ return BSIG2NUM (f);
583
602
  }
584
603
 
585
604
  /***********
586
605
  t_detach_fd
587
606
  ***********/
588
607
 
589
- static VALUE t_detach_fd (VALUE self, VALUE signature)
608
+ static VALUE t_detach_fd (VALUE self UNUSED, VALUE signature)
590
609
  {
591
- return INT2NUM(evma_detach_fd (NUM2ULONG (signature)));
610
+ return INT2NUM(evma_detach_fd (NUM2BSIG (signature)));
592
611
  }
593
612
 
594
613
  /*********************
595
614
  t_get_file_descriptor
596
615
  *********************/
597
- static VALUE t_get_file_descriptor (VALUE self, VALUE signature)
616
+ static VALUE t_get_file_descriptor (VALUE self UNUSED, VALUE signature)
598
617
  {
599
- return INT2NUM(evma_get_file_descriptor (NUM2ULONG (signature)));
618
+ return INT2NUM(evma_get_file_descriptor (NUM2BSIG (signature)));
600
619
  }
601
620
 
602
621
  /**************
603
622
  t_get_sock_opt
604
623
  **************/
605
624
 
606
- static VALUE t_get_sock_opt (VALUE self, VALUE signature, VALUE lev, VALUE optname)
625
+ static VALUE t_get_sock_opt (VALUE self UNUSED, VALUE signature, VALUE lev, VALUE optname)
607
626
  {
608
- int fd = evma_get_file_descriptor (NUM2ULONG (signature));
627
+ int fd = evma_get_file_descriptor (NUM2BSIG (signature));
609
628
  int level = NUM2INT(lev), option = NUM2INT(optname);
610
629
  socklen_t len = 128;
611
630
  char buf[128];
@@ -620,9 +639,9 @@ static VALUE t_get_sock_opt (VALUE self, VALUE signature, VALUE lev, VALUE optna
620
639
  t_set_sock_opt
621
640
  **************/
622
641
 
623
- static VALUE t_set_sock_opt (VALUE self, VALUE signature, VALUE lev, VALUE optname, VALUE optval)
642
+ static VALUE t_set_sock_opt (VALUE self UNUSED, VALUE signature, VALUE lev, VALUE optname, VALUE optval)
624
643
  {
625
- int fd = evma_get_file_descriptor (NUM2ULONG (signature));
644
+ int fd = evma_get_file_descriptor (NUM2BSIG (signature));
626
645
  int level = NUM2INT(lev), option = NUM2INT(optname);
627
646
  int i;
628
647
  const void *v;
@@ -658,18 +677,18 @@ static VALUE t_set_sock_opt (VALUE self, VALUE signature, VALUE lev, VALUE optna
658
677
  t_is_notify_readable
659
678
  ********************/
660
679
 
661
- static VALUE t_is_notify_readable (VALUE self, VALUE signature)
680
+ static VALUE t_is_notify_readable (VALUE self UNUSED, VALUE signature)
662
681
  {
663
- return evma_is_notify_readable(NUM2ULONG (signature)) ? Qtrue : Qfalse;
682
+ return evma_is_notify_readable(NUM2BSIG (signature)) ? Qtrue : Qfalse;
664
683
  }
665
684
 
666
685
  /*********************
667
686
  t_set_notify_readable
668
687
  *********************/
669
688
 
670
- static VALUE t_set_notify_readable (VALUE self, VALUE signature, VALUE mode)
689
+ static VALUE t_set_notify_readable (VALUE self UNUSED, VALUE signature, VALUE mode)
671
690
  {
672
- evma_set_notify_readable(NUM2ULONG (signature), mode == Qtrue);
691
+ evma_set_notify_readable(NUM2BSIG(signature), mode == Qtrue);
673
692
  return Qnil;
674
693
  }
675
694
 
@@ -677,18 +696,18 @@ static VALUE t_set_notify_readable (VALUE self, VALUE signature, VALUE mode)
677
696
  t_is_notify_readable
678
697
  ********************/
679
698
 
680
- static VALUE t_is_notify_writable (VALUE self, VALUE signature)
699
+ static VALUE t_is_notify_writable (VALUE self UNUSED, VALUE signature)
681
700
  {
682
- return evma_is_notify_writable(NUM2ULONG (signature)) ? Qtrue : Qfalse;
701
+ return evma_is_notify_writable(NUM2BSIG (signature)) ? Qtrue : Qfalse;
683
702
  }
684
703
 
685
704
  /*********************
686
705
  t_set_notify_writable
687
706
  *********************/
688
707
 
689
- static VALUE t_set_notify_writable (VALUE self, VALUE signature, VALUE mode)
708
+ static VALUE t_set_notify_writable (VALUE self UNUSED, VALUE signature, VALUE mode)
690
709
  {
691
- evma_set_notify_writable(NUM2ULONG (signature), mode == Qtrue);
710
+ evma_set_notify_writable(NUM2BSIG (signature), mode == Qtrue);
692
711
  return Qnil;
693
712
  }
694
713
 
@@ -696,34 +715,34 @@ static VALUE t_set_notify_writable (VALUE self, VALUE signature, VALUE mode)
696
715
  t_pause
697
716
  *******/
698
717
 
699
- static VALUE t_pause (VALUE self, VALUE signature)
718
+ static VALUE t_pause (VALUE self UNUSED, VALUE signature)
700
719
  {
701
- return evma_pause(NUM2ULONG (signature)) ? Qtrue : Qfalse;
720
+ return evma_pause(NUM2BSIG (signature)) ? Qtrue : Qfalse;
702
721
  }
703
722
 
704
723
  /********
705
724
  t_resume
706
725
  ********/
707
726
 
708
- static VALUE t_resume (VALUE self, VALUE signature)
727
+ static VALUE t_resume (VALUE self UNUSED, VALUE signature)
709
728
  {
710
- return evma_resume(NUM2ULONG (signature)) ? Qtrue : Qfalse;
729
+ return evma_resume(NUM2BSIG (signature)) ? Qtrue : Qfalse;
711
730
  }
712
731
 
713
732
  /**********
714
733
  t_paused_p
715
734
  **********/
716
735
 
717
- static VALUE t_paused_p (VALUE self, VALUE signature)
736
+ static VALUE t_paused_p (VALUE self UNUSED, VALUE signature)
718
737
  {
719
- return evma_is_paused(NUM2ULONG (signature)) ? Qtrue : Qfalse;
738
+ return evma_is_paused(NUM2BSIG (signature)) ? Qtrue : Qfalse;
720
739
  }
721
740
 
722
741
  /*********************
723
742
  t_num_close_scheduled
724
743
  *********************/
725
744
 
726
- static VALUE t_num_close_scheduled (VALUE self)
745
+ static VALUE t_num_close_scheduled (VALUE self UNUSED)
727
746
  {
728
747
  return INT2FIX(evma_num_close_scheduled());
729
748
  }
@@ -732,12 +751,12 @@ static VALUE t_num_close_scheduled (VALUE self)
732
751
  t_open_udp_socket
733
752
  *****************/
734
753
 
735
- static VALUE t_open_udp_socket (VALUE self, VALUE server, VALUE port)
754
+ static VALUE t_open_udp_socket (VALUE self UNUSED, VALUE server, VALUE port)
736
755
  {
737
- const unsigned long f = evma_open_datagram_socket (StringValuePtr(server), FIX2INT(port));
756
+ const uintptr_t f = evma_open_datagram_socket (StringValueCStr(server), FIX2INT(port));
738
757
  if (!f)
739
758
  rb_raise (rb_eRuntimeError, "%s", "no datagram socket");
740
- return ULONG2NUM (f);
759
+ return BSIG2NUM(f);
741
760
  }
742
761
 
743
762
 
@@ -746,7 +765,7 @@ static VALUE t_open_udp_socket (VALUE self, VALUE server, VALUE port)
746
765
  t_release_machine
747
766
  *****************/
748
767
 
749
- static VALUE t_release_machine (VALUE self)
768
+ static VALUE t_release_machine (VALUE self UNUSED)
750
769
  {
751
770
  evma_release_library();
752
771
  return Qnil;
@@ -757,7 +776,7 @@ static VALUE t_release_machine (VALUE self)
757
776
  t_stop
758
777
  ******/
759
778
 
760
- static VALUE t_stop (VALUE self)
779
+ static VALUE t_stop (VALUE self UNUSED)
761
780
  {
762
781
  evma_stop_machine();
763
782
  return Qnil;
@@ -767,7 +786,7 @@ static VALUE t_stop (VALUE self)
767
786
  t_signal_loopbreak
768
787
  ******************/
769
788
 
770
- static VALUE t_signal_loopbreak (VALUE self)
789
+ static VALUE t_signal_loopbreak (VALUE self UNUSED)
771
790
  {
772
791
  evma_signal_loopbreak();
773
792
  return Qnil;
@@ -777,7 +796,7 @@ static VALUE t_signal_loopbreak (VALUE self)
777
796
  t_library_type
778
797
  **************/
779
798
 
780
- static VALUE t_library_type (VALUE self)
799
+ static VALUE t_library_type (VALUE self UNUSED)
781
800
  {
782
801
  return rb_eval_string (":extension");
783
802
  }
@@ -788,54 +807,54 @@ static VALUE t_library_type (VALUE self)
788
807
  t_set_timer_quantum
789
808
  *******************/
790
809
 
791
- static VALUE t_set_timer_quantum (VALUE self, VALUE interval)
810
+ static VALUE t_set_timer_quantum (VALUE self UNUSED, VALUE interval)
792
811
  {
793
- evma_set_timer_quantum (FIX2INT (interval));
794
- return Qnil;
812
+ evma_set_timer_quantum (FIX2INT (interval));
813
+ return Qnil;
795
814
  }
796
815
 
797
816
  /********************
798
817
  t_get_max_timer_count
799
818
  ********************/
800
819
 
801
- static VALUE t_get_max_timer_count (VALUE self)
820
+ static VALUE t_get_max_timer_count (VALUE self UNUSED)
802
821
  {
803
- return INT2FIX (evma_get_max_timer_count());
822
+ return INT2FIX (evma_get_max_timer_count());
804
823
  }
805
824
 
806
825
  /********************
807
826
  t_set_max_timer_count
808
827
  ********************/
809
828
 
810
- static VALUE t_set_max_timer_count (VALUE self, VALUE ct)
829
+ static VALUE t_set_max_timer_count (VALUE self UNUSED, VALUE ct)
811
830
  {
812
- evma_set_max_timer_count (FIX2INT (ct));
813
- return Qnil;
831
+ evma_set_max_timer_count (FIX2INT (ct));
832
+ return Qnil;
814
833
  }
815
834
 
816
835
  /********************
817
836
  t_get/set_simultaneous_accept_count
818
837
  ********************/
819
838
 
820
- static VALUE t_get_simultaneous_accept_count (VALUE self)
839
+ static VALUE t_get_simultaneous_accept_count (VALUE self UNUSED)
821
840
  {
822
- return INT2FIX (evma_get_simultaneous_accept_count());
841
+ return INT2FIX (evma_get_simultaneous_accept_count());
823
842
  }
824
843
 
825
- static VALUE t_set_simultaneous_accept_count (VALUE self, VALUE ct)
844
+ static VALUE t_set_simultaneous_accept_count (VALUE self UNUSED, VALUE ct)
826
845
  {
827
- evma_set_simultaneous_accept_count (FIX2INT (ct));
828
- return Qnil;
846
+ evma_set_simultaneous_accept_count (FIX2INT (ct));
847
+ return Qnil;
829
848
  }
830
849
 
831
850
  /***************
832
851
  t_setuid_string
833
852
  ***************/
834
853
 
835
- static VALUE t_setuid_string (VALUE self, VALUE username)
854
+ static VALUE t_setuid_string (VALUE self UNUSED, VALUE username)
836
855
  {
837
- evma_setuid_string (StringValuePtr (username));
838
- return Qnil;
856
+ evma_setuid_string (StringValueCStr (username));
857
+ return Qnil;
839
858
  }
840
859
 
841
860
 
@@ -844,7 +863,7 @@ static VALUE t_setuid_string (VALUE self, VALUE username)
844
863
  t_invoke_popen
845
864
  **************/
846
865
 
847
- static VALUE t_invoke_popen (VALUE self, VALUE cmd)
866
+ static VALUE t_invoke_popen (VALUE self UNUSED, VALUE cmd)
848
867
  {
849
868
  // 1.8.7+
850
869
  #ifdef RARRAY_LEN
@@ -858,11 +877,11 @@ static VALUE t_invoke_popen (VALUE self, VALUE cmd)
858
877
  for (int i=0; i < len; i++) {
859
878
  VALUE ix = INT2FIX (i);
860
879
  VALUE s = rb_ary_aref (1, &ix, cmd);
861
- strings[i] = StringValuePtr (s);
880
+ strings[i] = StringValueCStr (s);
862
881
  }
863
882
  strings[len] = NULL;
864
883
 
865
- unsigned long f = 0;
884
+ uintptr_t f = 0;
866
885
  try {
867
886
  f = evma_popen (strings);
868
887
  } catch (std::runtime_error e) {
@@ -875,7 +894,7 @@ static VALUE t_invoke_popen (VALUE self, VALUE cmd)
875
894
  snprintf (buf, sizeof(buf)-1, "no popen: %s", (err?err:"???"));
876
895
  rb_raise (rb_eRuntimeError, "%s", buf);
877
896
  }
878
- return ULONG2NUM (f);
897
+ return BSIG2NUM (f);
879
898
  }
880
899
 
881
900
 
@@ -883,12 +902,12 @@ static VALUE t_invoke_popen (VALUE self, VALUE cmd)
883
902
  t_read_keyboard
884
903
  ***************/
885
904
 
886
- static VALUE t_read_keyboard (VALUE self)
905
+ static VALUE t_read_keyboard (VALUE self UNUSED)
887
906
  {
888
- const unsigned long f = evma_open_keyboard();
907
+ const uintptr_t f = evma_open_keyboard();
889
908
  if (!f)
890
909
  rb_raise (rb_eRuntimeError, "%s", "no keyboard reader");
891
- return ULONG2NUM (f);
910
+ return BSIG2NUM (f);
892
911
  }
893
912
 
894
913
 
@@ -896,10 +915,10 @@ static VALUE t_read_keyboard (VALUE self)
896
915
  t_watch_filename
897
916
  ****************/
898
917
 
899
- static VALUE t_watch_filename (VALUE self, VALUE fname)
918
+ static VALUE t_watch_filename (VALUE self UNUSED, VALUE fname)
900
919
  {
901
920
  try {
902
- return ULONG2NUM(evma_watch_filename(StringValuePtr(fname)));
921
+ return BSIG2NUM(evma_watch_filename(StringValueCStr(fname)));
903
922
  } catch (std::runtime_error e) {
904
923
  rb_raise (EM_eUnsupported, "%s", e.what());
905
924
  }
@@ -911,9 +930,9 @@ static VALUE t_watch_filename (VALUE self, VALUE fname)
911
930
  t_unwatch_filename
912
931
  ******************/
913
932
 
914
- static VALUE t_unwatch_filename (VALUE self, VALUE sig)
933
+ static VALUE t_unwatch_filename (VALUE self UNUSED, VALUE sig)
915
934
  {
916
- evma_unwatch_filename(NUM2ULONG (sig));
935
+ evma_unwatch_filename(NUM2BSIG (sig));
917
936
  return Qnil;
918
937
  }
919
938
 
@@ -922,10 +941,10 @@ static VALUE t_unwatch_filename (VALUE self, VALUE sig)
922
941
  t_watch_pid
923
942
  ***********/
924
943
 
925
- static VALUE t_watch_pid (VALUE self, VALUE pid)
944
+ static VALUE t_watch_pid (VALUE self UNUSED, VALUE pid)
926
945
  {
927
946
  try {
928
- return ULONG2NUM(evma_watch_pid(NUM2INT(pid)));
947
+ return BSIG2NUM(evma_watch_pid(NUM2INT(pid)));
929
948
  } catch (std::runtime_error e) {
930
949
  rb_raise (EM_eUnsupported, "%s", e.what());
931
950
  }
@@ -937,9 +956,9 @@ static VALUE t_watch_pid (VALUE self, VALUE pid)
937
956
  t_unwatch_pid
938
957
  *************/
939
958
 
940
- static VALUE t_unwatch_pid (VALUE self, VALUE sig)
959
+ static VALUE t_unwatch_pid (VALUE self UNUSED, VALUE sig)
941
960
  {
942
- evma_unwatch_pid(NUM2ULONG (sig));
961
+ evma_unwatch_pid(NUM2BSIG (sig));
943
962
  return Qnil;
944
963
  }
945
964
 
@@ -948,21 +967,26 @@ static VALUE t_unwatch_pid (VALUE self, VALUE sig)
948
967
  t__epoll_p
949
968
  **********/
950
969
 
951
- static VALUE t__epoll_p (VALUE self)
970
+ static VALUE t__epoll_p (VALUE self UNUSED)
952
971
  {
953
- #ifdef HAVE_EPOLL
954
- return Qtrue;
955
- #else
956
- return Qfalse;
957
- #endif
972
+ #ifdef HAVE_EPOLL
973
+ return Qtrue;
974
+ #else
975
+ return Qfalse;
976
+ #endif
958
977
  }
959
978
 
960
979
  /********
961
980
  t__epoll
962
981
  ********/
963
982
 
964
- static VALUE t__epoll (VALUE self)
983
+ static VALUE t__epoll (VALUE self UNUSED)
965
984
  {
985
+ if (t__epoll_p(self) == Qfalse) {
986
+ rb_warn ("epoll is not supported on this platform");
987
+ return Qfalse;
988
+ }
989
+
966
990
  evma_set_epoll (1);
967
991
  return Qtrue;
968
992
  }
@@ -974,7 +998,7 @@ t__epoll_set
974
998
  static VALUE t__epoll_set (VALUE self, VALUE val)
975
999
  {
976
1000
  if (t__epoll_p(self) == Qfalse)
977
- rb_raise (EM_eUnsupported, "%s", "epoll is not supported on this platform");
1001
+ rb_warn ("epoll is not supported on this platform");
978
1002
 
979
1003
  evma_set_epoll (val == Qtrue ? 1 : 0);
980
1004
  return val;
@@ -985,21 +1009,26 @@ static VALUE t__epoll_set (VALUE self, VALUE val)
985
1009
  t__kqueue_p
986
1010
  ***********/
987
1011
 
988
- static VALUE t__kqueue_p (VALUE self)
1012
+ static VALUE t__kqueue_p (VALUE self UNUSED)
989
1013
  {
990
- #ifdef HAVE_KQUEUE
991
- return Qtrue;
992
- #else
993
- return Qfalse;
994
- #endif
1014
+ #ifdef HAVE_KQUEUE
1015
+ return Qtrue;
1016
+ #else
1017
+ return Qfalse;
1018
+ #endif
995
1019
  }
996
1020
 
997
1021
  /*********
998
1022
  t__kqueue
999
1023
  *********/
1000
1024
 
1001
- static VALUE t__kqueue (VALUE self)
1025
+ static VALUE t__kqueue (VALUE self UNUSED)
1002
1026
  {
1027
+ if (t__kqueue_p(self) == Qfalse) {
1028
+ rb_warn ("kqueue is not supported on this platform");
1029
+ return Qfalse;
1030
+ }
1031
+
1003
1032
  evma_set_kqueue (1);
1004
1033
  return Qtrue;
1005
1034
  }
@@ -1011,7 +1040,7 @@ t__kqueue_set
1011
1040
  static VALUE t__kqueue_set (VALUE self, VALUE val)
1012
1041
  {
1013
1042
  if (t__kqueue_p(self) == Qfalse)
1014
- rb_raise (EM_eUnsupported, "%s", "kqueue is not supported on this platform");
1043
+ rb_warn ("kqueue is not supported on this platform");
1015
1044
 
1016
1045
  evma_set_kqueue (val == Qtrue ? 1 : 0);
1017
1046
  return val;
@@ -1022,13 +1051,13 @@ static VALUE t__kqueue_set (VALUE self, VALUE val)
1022
1051
  t__ssl_p
1023
1052
  ********/
1024
1053
 
1025
- static VALUE t__ssl_p (VALUE self)
1054
+ static VALUE t__ssl_p (VALUE self UNUSED)
1026
1055
  {
1027
- #ifdef WITH_SSL
1028
- return Qtrue;
1029
- #else
1030
- return Qfalse;
1031
- #endif
1056
+ #ifdef WITH_SSL
1057
+ return Qtrue;
1058
+ #else
1059
+ return Qfalse;
1060
+ #endif
1032
1061
  }
1033
1062
 
1034
1063
 
@@ -1036,7 +1065,7 @@ static VALUE t__ssl_p (VALUE self)
1036
1065
  t_send_file_data
1037
1066
  ****************/
1038
1067
 
1039
- static VALUE t_send_file_data (VALUE self, VALUE signature, VALUE filename)
1068
+ static VALUE t_send_file_data (VALUE self UNUSED, VALUE signature, VALUE filename)
1040
1069
  {
1041
1070
 
1042
1071
  /* The current implementation of evma_send_file_data_to_connection enforces a strict
@@ -1047,14 +1076,14 @@ static VALUE t_send_file_data (VALUE self, VALUE signature, VALUE filename)
1047
1076
  * do this. For one thing it's ugly. For another, we can't be sure zero is never a real errno.
1048
1077
  */
1049
1078
 
1050
- int b = evma_send_file_data_to_connection (NUM2ULONG (signature), StringValuePtr(filename));
1079
+ int b = evma_send_file_data_to_connection (NUM2BSIG (signature), StringValueCStr(filename));
1051
1080
  if (b == -1)
1052
1081
  rb_raise(rb_eRuntimeError, "%s", "File too large. send_file_data() supports files under 32k.");
1053
1082
  if (b > 0) {
1054
1083
  char *err = strerror (b);
1055
1084
  char buf[1024];
1056
1085
  memset (buf, 0, sizeof(buf));
1057
- snprintf (buf, sizeof(buf)-1, ": %s %s", StringValuePtr(filename),(err?err:"???"));
1086
+ snprintf (buf, sizeof(buf)-1, ": %s %s", StringValueCStr(filename),(err?err:"???"));
1058
1087
 
1059
1088
  rb_raise (rb_eIOError, "%s", buf);
1060
1089
  }
@@ -1067,7 +1096,7 @@ static VALUE t_send_file_data (VALUE self, VALUE signature, VALUE filename)
1067
1096
  t_set_rlimit_nofile
1068
1097
  *******************/
1069
1098
 
1070
- static VALUE t_set_rlimit_nofile (VALUE self, VALUE arg)
1099
+ static VALUE t_set_rlimit_nofile (VALUE self UNUSED, VALUE arg)
1071
1100
  {
1072
1101
  arg = (NIL_P(arg)) ? -1 : NUM2INT (arg);
1073
1102
  return INT2NUM (evma_set_rlimit_nofile (arg));
@@ -1080,7 +1109,7 @@ conn_get_outbound_data_size
1080
1109
  static VALUE conn_get_outbound_data_size (VALUE self)
1081
1110
  {
1082
1111
  VALUE sig = rb_ivar_get (self, Intern_at_signature);
1083
- return INT2NUM (evma_get_outbound_data_size (NUM2ULONG (sig)));
1112
+ return INT2NUM (evma_get_outbound_data_size (NUM2BSIG (sig)));
1084
1113
  }
1085
1114
 
1086
1115
 
@@ -1088,7 +1117,7 @@ static VALUE conn_get_outbound_data_size (VALUE self)
1088
1117
  conn_associate_callback_target
1089
1118
  ******************************/
1090
1119
 
1091
- static VALUE conn_associate_callback_target (VALUE self, VALUE sig)
1120
+ static VALUE conn_associate_callback_target (VALUE self UNUSED, VALUE sig UNUSED)
1092
1121
  {
1093
1122
  // No-op for the time being.
1094
1123
  return Qnil;
@@ -1099,22 +1128,22 @@ static VALUE conn_associate_callback_target (VALUE self, VALUE sig)
1099
1128
  t_get_loop_time
1100
1129
  ****************/
1101
1130
 
1102
- static VALUE t_get_loop_time (VALUE self)
1131
+ static VALUE t_get_loop_time (VALUE self UNUSED)
1103
1132
  {
1104
- #ifndef HAVE_RB_TIME_NEW
1105
- static VALUE cTime = rb_path2class("Time");
1106
- static ID at = rb_intern("at");
1107
- #endif
1133
+ #ifndef HAVE_RB_TIME_NEW
1134
+ static VALUE cTime = rb_path2class("Time");
1135
+ static ID at = rb_intern("at");
1136
+ #endif
1108
1137
 
1109
- uint64_t current_time = evma_get_current_loop_time();
1110
- if (current_time != 0) {
1111
- #ifndef HAVE_RB_TIME_NEW
1112
- return rb_funcall(cTime, at, 2, INT2NUM(current_time / 1000000), INT2NUM(current_time % 1000000));
1113
- #else
1114
- return rb_time_new(current_time / 1000000, current_time % 1000000);
1115
- #endif
1116
- }
1117
- return Qnil;
1138
+ uint64_t current_time = evma_get_current_loop_time();
1139
+ if (current_time != 0) {
1140
+ #ifndef HAVE_RB_TIME_NEW
1141
+ return rb_funcall(cTime, at, 2, INT2NUM(current_time / 1000000), INT2NUM(current_time % 1000000));
1142
+ #else
1143
+ return rb_time_new(current_time / 1000000, current_time % 1000000);
1144
+ #endif
1145
+ }
1146
+ return Qnil;
1118
1147
  }
1119
1148
 
1120
1149
 
@@ -1122,10 +1151,10 @@ static VALUE t_get_loop_time (VALUE self)
1122
1151
  t_start_proxy
1123
1152
  **************/
1124
1153
 
1125
- static VALUE t_start_proxy (VALUE self, VALUE from, VALUE to, VALUE bufsize, VALUE length)
1154
+ static VALUE t_start_proxy (VALUE self UNUSED, VALUE from, VALUE to, VALUE bufsize, VALUE length)
1126
1155
  {
1127
1156
  try {
1128
- evma_start_proxy(NUM2ULONG (from), NUM2ULONG (to), NUM2ULONG(bufsize), NUM2ULONG(length));
1157
+ evma_start_proxy(NUM2BSIG (from), NUM2BSIG (to), NUM2ULONG(bufsize), NUM2ULONG(length));
1129
1158
  } catch (std::runtime_error e) {
1130
1159
  rb_raise (EM_eConnectionError, "%s", e.what());
1131
1160
  }
@@ -1137,10 +1166,10 @@ static VALUE t_start_proxy (VALUE self, VALUE from, VALUE to, VALUE bufsize, VAL
1137
1166
  t_stop_proxy
1138
1167
  *************/
1139
1168
 
1140
- static VALUE t_stop_proxy (VALUE self, VALUE from)
1169
+ static VALUE t_stop_proxy (VALUE self UNUSED, VALUE from)
1141
1170
  {
1142
1171
  try{
1143
- evma_stop_proxy(NUM2ULONG (from));
1172
+ evma_stop_proxy(NUM2BSIG (from));
1144
1173
  } catch (std::runtime_error e) {
1145
1174
  rb_raise (EM_eConnectionError, "%s", e.what());
1146
1175
  }
@@ -1151,10 +1180,10 @@ static VALUE t_stop_proxy (VALUE self, VALUE from)
1151
1180
  t_proxied_bytes
1152
1181
  ****************/
1153
1182
 
1154
- static VALUE t_proxied_bytes (VALUE self, VALUE from)
1183
+ static VALUE t_proxied_bytes (VALUE self UNUSED, VALUE from)
1155
1184
  {
1156
1185
  try{
1157
- return ULONG2NUM(evma_proxied_bytes(NUM2ULONG (from)));
1186
+ return BSIG2NUM(evma_proxied_bytes(NUM2BSIG (from)));
1158
1187
  } catch (std::runtime_error e) {
1159
1188
  rb_raise (EM_eConnectionError, "%s", e.what());
1160
1189
  }
@@ -1165,14 +1194,14 @@ static VALUE t_proxied_bytes (VALUE self, VALUE from)
1165
1194
  t_get_idle_time
1166
1195
  ****************/
1167
1196
 
1168
- static VALUE t_get_idle_time (VALUE self, VALUE from)
1197
+ static VALUE t_get_idle_time (VALUE self UNUSED, VALUE from)
1169
1198
  {
1170
1199
  try{
1171
1200
  uint64_t current_time = evma_get_current_loop_time();
1172
- uint64_t time = evma_get_last_activity_time(NUM2ULONG (from));
1201
+ uint64_t time = evma_get_last_activity_time(NUM2BSIG (from));
1173
1202
  if (current_time != 0 && time != 0) {
1174
1203
  if (time >= current_time)
1175
- return ULONG2NUM(0);
1204
+ return BSIG2NUM(0);
1176
1205
  else {
1177
1206
  uint64_t diff = current_time - time;
1178
1207
  float seconds = diff / (1000.0*1000.0);
@@ -1190,7 +1219,7 @@ static VALUE t_get_idle_time (VALUE self, VALUE from)
1190
1219
  t_get_heartbeat_interval
1191
1220
  *************************/
1192
1221
 
1193
- static VALUE t_get_heartbeat_interval (VALUE self)
1222
+ static VALUE t_get_heartbeat_interval (VALUE self UNUSED)
1194
1223
  {
1195
1224
  return rb_float_new(evma_get_heartbeat_interval());
1196
1225
  }
@@ -1200,7 +1229,7 @@ static VALUE t_get_heartbeat_interval (VALUE self)
1200
1229
  t_set_heartbeat_interval
1201
1230
  *************************/
1202
1231
 
1203
- static VALUE t_set_heartbeat_interval (VALUE self, VALUE interval)
1232
+ static VALUE t_set_heartbeat_interval (VALUE self UNUSED, VALUE interval)
1204
1233
  {
1205
1234
  float iv = RFLOAT_VALUE(interval);
1206
1235
  if (evma_set_heartbeat_interval(iv))
@@ -1251,8 +1280,9 @@ extern "C" void Init_rubyeventmachine()
1251
1280
  EM_eUnsupported = rb_define_class_under (EmModule, "Unsupported", rb_eRuntimeError);
1252
1281
 
1253
1282
  rb_define_module_function (EmModule, "initialize_event_machine", (VALUE(*)(...))t_initialize_event_machine, 0);
1254
- rb_define_module_function (EmModule, "run_machine", (VALUE(*)(...))t_run_machine_without_threads, 0);
1255
- rb_define_module_function (EmModule, "run_machine_without_threads", (VALUE(*)(...))t_run_machine_without_threads, 0);
1283
+ rb_define_module_function (EmModule, "run_machine_once", (VALUE(*)(...))t_run_machine_once, 0);
1284
+ rb_define_module_function (EmModule, "run_machine", (VALUE(*)(...))t_run_machine, 0);
1285
+ rb_define_module_function (EmModule, "run_machine_without_threads", (VALUE(*)(...))t_run_machine, 0);
1256
1286
  rb_define_module_function (EmModule, "add_oneshot_timer", (VALUE(*)(...))t_add_oneshot_timer, 1);
1257
1287
  rb_define_module_function (EmModule, "start_tcp_server", (VALUE(*)(...))t_start_server, 2);
1258
1288
  rb_define_module_function (EmModule, "stop_tcp_server", (VALUE(*)(...))t_stop_server, 1);