kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / Atom feed
a3f2f6613e73c3c9eb2c1f41a752df59099f612d blob 2731 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
 
#ifndef KGIO_H
#define KGIO_H

#include <ruby.h>
#ifdef HAVE_RUBY_IO_H
#  include <ruby/io.h>
#else
#  include <rubyio.h>
#endif
#ifdef HAVE_RUBY_THREAD_H
#  include <ruby/thread.h>
#endif
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <assert.h>
#include <netdb.h>

#include "ancient_ruby.h"

void init_kgio_wait(void);
void init_kgio_read(void);
void init_kgio_write(void);
void init_kgio_writev(void);
void init_kgio_accept(void);
void init_kgio_connect(void);
void init_kgio_poll(void);
void init_kgio_tryopen(void);

VALUE kgio_call_wait_writable(VALUE io);
VALUE kgio_call_wait_readable(VALUE io);
#if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) && defined(HAVE_RUBY_THREAD_H)
#  define KGIO_WITHOUT_GVL(fn,data1,ubf,data2) \
      rb_thread_call_without_gvl((fn),(data1),(ubf),(data2))
#elif defined(HAVE_RB_THREAD_BLOCKING_REGION)
typedef  VALUE(*kgio_blocking_fn_t)(void*);
#  define KGIO_WITHOUT_GVL(fn,data1,ubf,data2) \
      rb_thread_blocking_region((kgio_blocking_fn_t)(fn),(data1),(ubf),(data2))
#endif /* HAVE_RB_THREAD_CALL_WITHOUT_GVL || HAVE_RB_THREAD_BLOCKING_REGION */

#if defined(KGIO_WITHOUT_GVL) && defined(HAVE_POLL)
#  define USE_KGIO_POLL
#endif /* USE_KGIO_POLL */

#ifndef HAVE_RB_UPDATE_MAX_FD
#  define rb_update_max_fd(fd) for (;0;)
#endif

/*
 * 2012/12/13 - Linux 3.7 was released on 2012/12/10 with TFO.
 * Headers distributed with glibc will take some time to catch up and
 * be officially released.  Most GNU/Linux distros will take a few months
 * to a year longer. "Enterprise" distros will probably take 5-7 years.
 * So keep these until 2017 at least...
 */
#ifdef __linux__
#  ifndef MSG_FASTOPEN
#    define MSG_FASTOPEN	0x20000000 /* for clients */
#  endif
#  ifndef TCP_FASTOPEN
#    define TCP_FASTOPEN	23 /* for listeners */
#  endif
   /* we _may_ have TFO support */
#  define KGIO_TFO_MAYBE (1)
#else /* rely entirely on standard system headers */
#  define KGIO_TFO_MAYBE (0)
#endif

extern unsigned kgio_tfo;
NORETURN(void kgio_raise_empty_bt(VALUE, const char *));
NORETURN(void kgio_wr_sys_fail(const char *));
NORETURN(void kgio_rd_sys_fail(const char *));

/*
 * we know MSG_DONTWAIT works properly on all stream sockets under Linux
 * we can define this macro for other platforms as people care and
 * notice.
 */
#  if defined(__linux__)
#    define USE_MSG_DONTWAIT
#  endif

/* prefer rb_str_subseq because we don't use negative offsets */
#ifndef HAVE_RB_STR_SUBSEQ
#define MY_STR_SUBSEQ(str,beg,len) rb_str_substr((str),(beg),(len))
#else
#define MY_STR_SUBSEQ(str,beg,len) rb_str_subseq((str),(beg),(len))
#endif

#endif /* KGIO_H */
debug log:

solving a3f2f66 ...
found a3f2f66 in https://yhbt.net/kgio.git

kgio RubyGem user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://yhbt.net/kgio-public
	git clone --mirror http://ou63pmih66umazou.onion/kgio-public

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.kgio
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.kgio

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git