overmind 0.1.0-x86_64-freebsd → 0.1.2-x86_64-freebsd
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/overmind/version.rb +1 -1
- metadata +2 -66
- data/libexec/prebuilt-tmux/bin/event_rpcgen.py +0 -1925
- data/libexec/prebuilt-tmux/bin/tmux +0 -0
- data/libexec/prebuilt-tmux/include/evdns.h +0 -45
- data/libexec/prebuilt-tmux/include/event.h +0 -83
- data/libexec/prebuilt-tmux/include/event2/buffer.h +0 -1077
- data/libexec/prebuilt-tmux/include/event2/buffer_compat.h +0 -116
- data/libexec/prebuilt-tmux/include/event2/bufferevent.h +0 -1024
- data/libexec/prebuilt-tmux/include/event2/bufferevent_compat.h +0 -104
- data/libexec/prebuilt-tmux/include/event2/bufferevent_ssl.h +0 -134
- data/libexec/prebuilt-tmux/include/event2/bufferevent_struct.h +0 -116
- data/libexec/prebuilt-tmux/include/event2/dns.h +0 -751
- data/libexec/prebuilt-tmux/include/event2/dns_compat.h +0 -358
- data/libexec/prebuilt-tmux/include/event2/dns_struct.h +0 -80
- data/libexec/prebuilt-tmux/include/event2/event-config.h +0 -570
- data/libexec/prebuilt-tmux/include/event2/event.h +0 -1672
- data/libexec/prebuilt-tmux/include/event2/event_compat.h +0 -230
- data/libexec/prebuilt-tmux/include/event2/event_struct.h +0 -180
- data/libexec/prebuilt-tmux/include/event2/http.h +0 -1192
- data/libexec/prebuilt-tmux/include/event2/http_compat.h +0 -94
- data/libexec/prebuilt-tmux/include/event2/http_struct.h +0 -152
- data/libexec/prebuilt-tmux/include/event2/keyvalq_struct.h +0 -80
- data/libexec/prebuilt-tmux/include/event2/listener.h +0 -192
- data/libexec/prebuilt-tmux/include/event2/rpc.h +0 -626
- data/libexec/prebuilt-tmux/include/event2/rpc_compat.h +0 -61
- data/libexec/prebuilt-tmux/include/event2/rpc_struct.h +0 -114
- data/libexec/prebuilt-tmux/include/event2/tag.h +0 -146
- data/libexec/prebuilt-tmux/include/event2/tag_compat.h +0 -49
- data/libexec/prebuilt-tmux/include/event2/thread.h +0 -253
- data/libexec/prebuilt-tmux/include/event2/util.h +0 -888
- data/libexec/prebuilt-tmux/include/event2/visibility.h +0 -67
- data/libexec/prebuilt-tmux/include/evhttp.h +0 -45
- data/libexec/prebuilt-tmux/include/evrpc.h +0 -45
- data/libexec/prebuilt-tmux/include/evutil.h +0 -39
- data/libexec/prebuilt-tmux/include/utf8proc.h +0 -743
- data/libexec/prebuilt-tmux/lib/libevent-2.1.7.dylib +0 -0
- data/libexec/prebuilt-tmux/lib/libevent.a +0 -0
- data/libexec/prebuilt-tmux/lib/libevent.dylib +0 -1
- data/libexec/prebuilt-tmux/lib/libevent.la +0 -41
- data/libexec/prebuilt-tmux/lib/libevent_core-2.1.7.dylib +0 -0
- data/libexec/prebuilt-tmux/lib/libevent_core.a +0 -0
- data/libexec/prebuilt-tmux/lib/libevent_core.dylib +0 -1
- data/libexec/prebuilt-tmux/lib/libevent_core.la +0 -41
- data/libexec/prebuilt-tmux/lib/libevent_extra-2.1.7.dylib +0 -0
- data/libexec/prebuilt-tmux/lib/libevent_extra.a +0 -0
- data/libexec/prebuilt-tmux/lib/libevent_extra.dylib +0 -1
- data/libexec/prebuilt-tmux/lib/libevent_extra.la +0 -41
- data/libexec/prebuilt-tmux/lib/libevent_openssl-2.1.7.dylib +0 -0
- data/libexec/prebuilt-tmux/lib/libevent_openssl.a +0 -0
- data/libexec/prebuilt-tmux/lib/libevent_openssl.dylib +0 -1
- data/libexec/prebuilt-tmux/lib/libevent_openssl.la +0 -41
- data/libexec/prebuilt-tmux/lib/libevent_pthreads-2.1.7.dylib +0 -0
- data/libexec/prebuilt-tmux/lib/libevent_pthreads.a +0 -0
- data/libexec/prebuilt-tmux/lib/libevent_pthreads.dylib +0 -1
- data/libexec/prebuilt-tmux/lib/libevent_pthreads.la +0 -41
- data/libexec/prebuilt-tmux/lib/libutf8proc.3.dylib +0 -0
- data/libexec/prebuilt-tmux/lib/libutf8proc.a +0 -0
- data/libexec/prebuilt-tmux/lib/libutf8proc.dylib +0 -1
- data/libexec/prebuilt-tmux/lib/pkgconfig/libevent.pc +0 -16
- data/libexec/prebuilt-tmux/lib/pkgconfig/libevent_core.pc +0 -16
- data/libexec/prebuilt-tmux/lib/pkgconfig/libevent_extra.pc +0 -16
- data/libexec/prebuilt-tmux/lib/pkgconfig/libevent_openssl.pc +0 -16
- data/libexec/prebuilt-tmux/lib/pkgconfig/libevent_pthreads.pc +0 -16
- data/libexec/prebuilt-tmux/lib/pkgconfig/libutf8proc.pc +0 -10
- data/libexec/prebuilt-tmux/share/man/man1/tmux.1 +0 -7242
@@ -1,114 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu>
|
3
|
-
* Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
|
4
|
-
*
|
5
|
-
* Redistribution and use in source and binary forms, with or without
|
6
|
-
* modification, are permitted provided that the following conditions
|
7
|
-
* are met:
|
8
|
-
* 1. Redistributions of source code must retain the above copyright
|
9
|
-
* notice, this list of conditions and the following disclaimer.
|
10
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
11
|
-
* notice, this list of conditions and the following disclaimer in the
|
12
|
-
* documentation and/or other materials provided with the distribution.
|
13
|
-
* 3. The name of the author may not be used to endorse or promote products
|
14
|
-
* derived from this software without specific prior written permission.
|
15
|
-
*
|
16
|
-
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
17
|
-
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
18
|
-
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
19
|
-
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
20
|
-
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
21
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
22
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
23
|
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
24
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
25
|
-
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
|
-
*/
|
27
|
-
#ifndef EVENT2_RPC_STRUCT_H_INCLUDED_
|
28
|
-
#define EVENT2_RPC_STRUCT_H_INCLUDED_
|
29
|
-
|
30
|
-
#ifdef __cplusplus
|
31
|
-
extern "C" {
|
32
|
-
#endif
|
33
|
-
|
34
|
-
/** @file event2/rpc_struct.h
|
35
|
-
|
36
|
-
Structures used by rpc.h. Using these structures directly may harm
|
37
|
-
forward compatibility: be careful!
|
38
|
-
|
39
|
-
*/
|
40
|
-
|
41
|
-
/* Fix so that people don't have to run with <sys/queue.h> */
|
42
|
-
#ifndef TAILQ_ENTRY
|
43
|
-
#define EVENT_DEFINED_TQENTRY_
|
44
|
-
#define TAILQ_ENTRY(type) \
|
45
|
-
struct { \
|
46
|
-
struct type *tqe_next; /* next element */ \
|
47
|
-
struct type **tqe_prev; /* address of previous next element */ \
|
48
|
-
}
|
49
|
-
#endif /* !TAILQ_ENTRY */
|
50
|
-
|
51
|
-
/**
|
52
|
-
* provides information about the completed RPC request.
|
53
|
-
*/
|
54
|
-
struct evrpc_status {
|
55
|
-
#define EVRPC_STATUS_ERR_NONE 0
|
56
|
-
#define EVRPC_STATUS_ERR_TIMEOUT 1
|
57
|
-
#define EVRPC_STATUS_ERR_BADPAYLOAD 2
|
58
|
-
#define EVRPC_STATUS_ERR_UNSTARTED 3
|
59
|
-
#define EVRPC_STATUS_ERR_HOOKABORTED 4
|
60
|
-
int error;
|
61
|
-
|
62
|
-
/* for looking at headers or other information */
|
63
|
-
struct evhttp_request *http_req;
|
64
|
-
};
|
65
|
-
|
66
|
-
/* the structure below needs to be synchronized with evrpc_req_generic */
|
67
|
-
|
68
|
-
/* Encapsulates a request */
|
69
|
-
struct evrpc {
|
70
|
-
TAILQ_ENTRY(evrpc) next;
|
71
|
-
|
72
|
-
/* the URI at which the request handler lives */
|
73
|
-
const char* uri;
|
74
|
-
|
75
|
-
/* creates a new request structure */
|
76
|
-
void *(*request_new)(void *);
|
77
|
-
void *request_new_arg;
|
78
|
-
|
79
|
-
/* frees the request structure */
|
80
|
-
void (*request_free)(void *);
|
81
|
-
|
82
|
-
/* unmarshals the buffer into the proper request structure */
|
83
|
-
int (*request_unmarshal)(void *, struct evbuffer *);
|
84
|
-
|
85
|
-
/* creates a new reply structure */
|
86
|
-
void *(*reply_new)(void *);
|
87
|
-
void *reply_new_arg;
|
88
|
-
|
89
|
-
/* frees the reply structure */
|
90
|
-
void (*reply_free)(void *);
|
91
|
-
|
92
|
-
/* verifies that the reply is valid */
|
93
|
-
int (*reply_complete)(void *);
|
94
|
-
|
95
|
-
/* marshals the reply into a buffer */
|
96
|
-
void (*reply_marshal)(struct evbuffer*, void *);
|
97
|
-
|
98
|
-
/* the callback invoked for each received rpc */
|
99
|
-
void (*cb)(struct evrpc_req_generic *, void *);
|
100
|
-
void *cb_arg;
|
101
|
-
|
102
|
-
/* reference for further configuration */
|
103
|
-
struct evrpc_base *base;
|
104
|
-
};
|
105
|
-
|
106
|
-
#ifdef EVENT_DEFINED_TQENTRY_
|
107
|
-
#undef TAILQ_ENTRY
|
108
|
-
#endif
|
109
|
-
|
110
|
-
#ifdef __cplusplus
|
111
|
-
}
|
112
|
-
#endif
|
113
|
-
|
114
|
-
#endif /* EVENT2_RPC_STRUCT_H_INCLUDED_ */
|
@@ -1,146 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
|
3
|
-
* Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
|
4
|
-
*
|
5
|
-
* Redistribution and use in source and binary forms, with or without
|
6
|
-
* modification, are permitted provided that the following conditions
|
7
|
-
* are met:
|
8
|
-
* 1. Redistributions of source code must retain the above copyright
|
9
|
-
* notice, this list of conditions and the following disclaimer.
|
10
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
11
|
-
* notice, this list of conditions and the following disclaimer in the
|
12
|
-
* documentation and/or other materials provided with the distribution.
|
13
|
-
* 3. The name of the author may not be used to endorse or promote products
|
14
|
-
* derived from this software without specific prior written permission.
|
15
|
-
*
|
16
|
-
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
17
|
-
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
18
|
-
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
19
|
-
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
20
|
-
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
21
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
22
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
23
|
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
24
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
25
|
-
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
|
-
*/
|
27
|
-
#ifndef EVENT2_TAG_H_INCLUDED_
|
28
|
-
#define EVENT2_TAG_H_INCLUDED_
|
29
|
-
|
30
|
-
/** @file event2/tag.h
|
31
|
-
|
32
|
-
Helper functions for reading and writing tagged data onto buffers.
|
33
|
-
|
34
|
-
*/
|
35
|
-
|
36
|
-
#include <event2/visibility.h>
|
37
|
-
|
38
|
-
#ifdef __cplusplus
|
39
|
-
extern "C" {
|
40
|
-
#endif
|
41
|
-
|
42
|
-
#include <event2/event-config.h>
|
43
|
-
#ifdef EVENT__HAVE_SYS_TYPES_H
|
44
|
-
#include <sys/types.h>
|
45
|
-
#endif
|
46
|
-
#ifdef EVENT__HAVE_SYS_TIME_H
|
47
|
-
#include <sys/time.h>
|
48
|
-
#endif
|
49
|
-
|
50
|
-
/* For int types. */
|
51
|
-
#include <event2/util.h>
|
52
|
-
|
53
|
-
struct evbuffer;
|
54
|
-
|
55
|
-
/*
|
56
|
-
* Marshaling tagged data - We assume that all tags are inserted in their
|
57
|
-
* numeric order - so that unknown tags will always be higher than the
|
58
|
-
* known ones - and we can just ignore the end of an event buffer.
|
59
|
-
*/
|
60
|
-
|
61
|
-
EVENT2_EXPORT_SYMBOL
|
62
|
-
void evtag_init(void);
|
63
|
-
|
64
|
-
/**
|
65
|
-
Unmarshals the header and returns the length of the payload
|
66
|
-
|
67
|
-
@param evbuf the buffer from which to unmarshal data
|
68
|
-
@param ptag a pointer in which the tag id is being stored
|
69
|
-
@returns -1 on failure or the number of bytes in the remaining payload.
|
70
|
-
*/
|
71
|
-
EVENT2_EXPORT_SYMBOL
|
72
|
-
int evtag_unmarshal_header(struct evbuffer *evbuf, ev_uint32_t *ptag);
|
73
|
-
|
74
|
-
EVENT2_EXPORT_SYMBOL
|
75
|
-
void evtag_marshal(struct evbuffer *evbuf, ev_uint32_t tag, const void *data,
|
76
|
-
ev_uint32_t len);
|
77
|
-
EVENT2_EXPORT_SYMBOL
|
78
|
-
void evtag_marshal_buffer(struct evbuffer *evbuf, ev_uint32_t tag,
|
79
|
-
struct evbuffer *data);
|
80
|
-
|
81
|
-
/**
|
82
|
-
Encode an integer and store it in an evbuffer.
|
83
|
-
|
84
|
-
We encode integers by nybbles; the first nibble contains the number
|
85
|
-
of significant nibbles - 1; this allows us to encode up to 64-bit
|
86
|
-
integers. This function is byte-order independent.
|
87
|
-
|
88
|
-
@param evbuf evbuffer to store the encoded number
|
89
|
-
@param number a 32-bit integer
|
90
|
-
*/
|
91
|
-
EVENT2_EXPORT_SYMBOL
|
92
|
-
void evtag_encode_int(struct evbuffer *evbuf, ev_uint32_t number);
|
93
|
-
EVENT2_EXPORT_SYMBOL
|
94
|
-
void evtag_encode_int64(struct evbuffer *evbuf, ev_uint64_t number);
|
95
|
-
|
96
|
-
EVENT2_EXPORT_SYMBOL
|
97
|
-
void evtag_marshal_int(struct evbuffer *evbuf, ev_uint32_t tag,
|
98
|
-
ev_uint32_t integer);
|
99
|
-
EVENT2_EXPORT_SYMBOL
|
100
|
-
void evtag_marshal_int64(struct evbuffer *evbuf, ev_uint32_t tag,
|
101
|
-
ev_uint64_t integer);
|
102
|
-
|
103
|
-
EVENT2_EXPORT_SYMBOL
|
104
|
-
void evtag_marshal_string(struct evbuffer *buf, ev_uint32_t tag,
|
105
|
-
const char *string);
|
106
|
-
|
107
|
-
EVENT2_EXPORT_SYMBOL
|
108
|
-
void evtag_marshal_timeval(struct evbuffer *evbuf, ev_uint32_t tag,
|
109
|
-
struct timeval *tv);
|
110
|
-
|
111
|
-
EVENT2_EXPORT_SYMBOL
|
112
|
-
int evtag_unmarshal(struct evbuffer *src, ev_uint32_t *ptag,
|
113
|
-
struct evbuffer *dst);
|
114
|
-
EVENT2_EXPORT_SYMBOL
|
115
|
-
int evtag_peek(struct evbuffer *evbuf, ev_uint32_t *ptag);
|
116
|
-
EVENT2_EXPORT_SYMBOL
|
117
|
-
int evtag_peek_length(struct evbuffer *evbuf, ev_uint32_t *plength);
|
118
|
-
EVENT2_EXPORT_SYMBOL
|
119
|
-
int evtag_payload_length(struct evbuffer *evbuf, ev_uint32_t *plength);
|
120
|
-
EVENT2_EXPORT_SYMBOL
|
121
|
-
int evtag_consume(struct evbuffer *evbuf);
|
122
|
-
|
123
|
-
EVENT2_EXPORT_SYMBOL
|
124
|
-
int evtag_unmarshal_int(struct evbuffer *evbuf, ev_uint32_t need_tag,
|
125
|
-
ev_uint32_t *pinteger);
|
126
|
-
EVENT2_EXPORT_SYMBOL
|
127
|
-
int evtag_unmarshal_int64(struct evbuffer *evbuf, ev_uint32_t need_tag,
|
128
|
-
ev_uint64_t *pinteger);
|
129
|
-
|
130
|
-
EVENT2_EXPORT_SYMBOL
|
131
|
-
int evtag_unmarshal_fixed(struct evbuffer *src, ev_uint32_t need_tag,
|
132
|
-
void *data, size_t len);
|
133
|
-
|
134
|
-
EVENT2_EXPORT_SYMBOL
|
135
|
-
int evtag_unmarshal_string(struct evbuffer *evbuf, ev_uint32_t need_tag,
|
136
|
-
char **pstring);
|
137
|
-
|
138
|
-
EVENT2_EXPORT_SYMBOL
|
139
|
-
int evtag_unmarshal_timeval(struct evbuffer *evbuf, ev_uint32_t need_tag,
|
140
|
-
struct timeval *ptv);
|
141
|
-
|
142
|
-
#ifdef __cplusplus
|
143
|
-
}
|
144
|
-
#endif
|
145
|
-
|
146
|
-
#endif /* EVENT2_TAG_H_INCLUDED_ */
|
@@ -1,49 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
|
3
|
-
* Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
|
4
|
-
*
|
5
|
-
* Redistribution and use in source and binary forms, with or without
|
6
|
-
* modification, are permitted provided that the following conditions
|
7
|
-
* are met:
|
8
|
-
* 1. Redistributions of source code must retain the above copyright
|
9
|
-
* notice, this list of conditions and the following disclaimer.
|
10
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
11
|
-
* notice, this list of conditions and the following disclaimer in the
|
12
|
-
* documentation and/or other materials provided with the distribution.
|
13
|
-
* 3. The name of the author may not be used to endorse or promote products
|
14
|
-
* derived from this software without specific prior written permission.
|
15
|
-
*
|
16
|
-
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
17
|
-
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
18
|
-
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
19
|
-
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
20
|
-
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
21
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
22
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
23
|
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
24
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
25
|
-
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
|
-
*/
|
27
|
-
#ifndef EVENT2_TAG_COMPAT_H_INCLUDED_
|
28
|
-
#define EVENT2_TAG_COMPAT_H_INCLUDED_
|
29
|
-
|
30
|
-
/** @file event2/tag_compat.h
|
31
|
-
|
32
|
-
Obsolete/deprecated functions from tag.h; provided only for backwards
|
33
|
-
compatibility.
|
34
|
-
*/
|
35
|
-
|
36
|
-
/**
|
37
|
-
@name Misnamed functions
|
38
|
-
|
39
|
-
@deprecated These macros are deprecated because their names don't follow
|
40
|
-
Libevent's naming conventions. Use evtag_encode_int and
|
41
|
-
evtag_encode_int64 instead.
|
42
|
-
|
43
|
-
@{
|
44
|
-
*/
|
45
|
-
#define encode_int(evbuf, number) evtag_encode_int((evbuf), (number))
|
46
|
-
#define encode_int64(evbuf, number) evtag_encode_int64((evbuf), (number))
|
47
|
-
/**@}*/
|
48
|
-
|
49
|
-
#endif /* EVENT2_TAG_H_INCLUDED_ */
|
@@ -1,253 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (c) 2008-2012 Niels Provos and Nick Mathewson
|
3
|
-
*
|
4
|
-
* Redistribution and use in source and binary forms, with or without
|
5
|
-
* modification, are permitted provided that the following conditions
|
6
|
-
* are met:
|
7
|
-
* 1. Redistributions of source code must retain the above copyright
|
8
|
-
* notice, this list of conditions and the following disclaimer.
|
9
|
-
* 2. Redistributions in binary form must reproduce the above copyright
|
10
|
-
* notice, this list of conditions and the following disclaimer in the
|
11
|
-
* documentation and/or other materials provided with the distribution.
|
12
|
-
* 3. The name of the author may not be used to endorse or promote products
|
13
|
-
* derived from this software without specific prior written permission.
|
14
|
-
*
|
15
|
-
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
16
|
-
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
17
|
-
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
18
|
-
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
19
|
-
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
20
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
21
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
22
|
-
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
24
|
-
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
25
|
-
*/
|
26
|
-
#ifndef EVENT2_THREAD_H_INCLUDED_
|
27
|
-
#define EVENT2_THREAD_H_INCLUDED_
|
28
|
-
|
29
|
-
/** @file event2/thread.h
|
30
|
-
|
31
|
-
Functions for multi-threaded applications using Libevent.
|
32
|
-
|
33
|
-
When using a multi-threaded application in which multiple threads
|
34
|
-
add and delete events from a single event base, Libevent needs to
|
35
|
-
lock its data structures.
|
36
|
-
|
37
|
-
Like the memory-management function hooks, all of the threading functions
|
38
|
-
_must_ be set up before an event_base is created if you want the base to
|
39
|
-
use them.
|
40
|
-
|
41
|
-
Most programs will either be using Windows threads or Posix threads. You
|
42
|
-
can configure Libevent to use one of these event_use_windows_threads() or
|
43
|
-
event_use_pthreads() respectively. If you're using another threading
|
44
|
-
library, you'll need to configure threading functions manually using
|
45
|
-
evthread_set_lock_callbacks() and evthread_set_condition_callbacks().
|
46
|
-
|
47
|
-
*/
|
48
|
-
|
49
|
-
#include <event2/visibility.h>
|
50
|
-
|
51
|
-
#ifdef __cplusplus
|
52
|
-
extern "C" {
|
53
|
-
#endif
|
54
|
-
|
55
|
-
#include <event2/event-config.h>
|
56
|
-
|
57
|
-
/**
|
58
|
-
@name Flags passed to lock functions
|
59
|
-
|
60
|
-
@{
|
61
|
-
*/
|
62
|
-
/** A flag passed to a locking callback when the lock was allocated as a
|
63
|
-
* read-write lock, and we want to acquire or release the lock for writing. */
|
64
|
-
#define EVTHREAD_WRITE 0x04
|
65
|
-
/** A flag passed to a locking callback when the lock was allocated as a
|
66
|
-
* read-write lock, and we want to acquire or release the lock for reading. */
|
67
|
-
#define EVTHREAD_READ 0x08
|
68
|
-
/** A flag passed to a locking callback when we don't want to block waiting
|
69
|
-
* for the lock; if we can't get the lock immediately, we will instead
|
70
|
-
* return nonzero from the locking callback. */
|
71
|
-
#define EVTHREAD_TRY 0x10
|
72
|
-
/**@}*/
|
73
|
-
|
74
|
-
#if !defined(EVENT__DISABLE_THREAD_SUPPORT) || defined(EVENT_IN_DOXYGEN_)
|
75
|
-
|
76
|
-
#define EVTHREAD_LOCK_API_VERSION 1
|
77
|
-
|
78
|
-
/**
|
79
|
-
@name Types of locks
|
80
|
-
|
81
|
-
@{*/
|
82
|
-
/** A recursive lock is one that can be acquired multiple times at once by the
|
83
|
-
* same thread. No other process can allocate the lock until the thread that
|
84
|
-
* has been holding it has unlocked it as many times as it locked it. */
|
85
|
-
#define EVTHREAD_LOCKTYPE_RECURSIVE 1
|
86
|
-
/* A read-write lock is one that allows multiple simultaneous readers, but
|
87
|
-
* where any one writer excludes all other writers and readers. */
|
88
|
-
#define EVTHREAD_LOCKTYPE_READWRITE 2
|
89
|
-
/**@}*/
|
90
|
-
|
91
|
-
/** This structure describes the interface a threading library uses for
|
92
|
-
* locking. It's used to tell evthread_set_lock_callbacks() how to use
|
93
|
-
* locking on this platform.
|
94
|
-
*/
|
95
|
-
struct evthread_lock_callbacks {
|
96
|
-
/** The current version of the locking API. Set this to
|
97
|
-
* EVTHREAD_LOCK_API_VERSION */
|
98
|
-
int lock_api_version;
|
99
|
-
/** Which kinds of locks does this version of the locking API
|
100
|
-
* support? A bitfield of EVTHREAD_LOCKTYPE_RECURSIVE and
|
101
|
-
* EVTHREAD_LOCKTYPE_READWRITE.
|
102
|
-
*
|
103
|
-
* (Note that RECURSIVE locks are currently mandatory, and
|
104
|
-
* READWRITE locks are not currently used.)
|
105
|
-
**/
|
106
|
-
unsigned supported_locktypes;
|
107
|
-
/** Function to allocate and initialize new lock of type 'locktype'.
|
108
|
-
* Returns NULL on failure. */
|
109
|
-
void *(*alloc)(unsigned locktype);
|
110
|
-
/** Funtion to release all storage held in 'lock', which was created
|
111
|
-
* with type 'locktype'. */
|
112
|
-
void (*free)(void *lock, unsigned locktype);
|
113
|
-
/** Acquire an already-allocated lock at 'lock' with mode 'mode'.
|
114
|
-
* Returns 0 on success, and nonzero on failure. */
|
115
|
-
int (*lock)(unsigned mode, void *lock);
|
116
|
-
/** Release a lock at 'lock' using mode 'mode'. Returns 0 on success,
|
117
|
-
* and nonzero on failure. */
|
118
|
-
int (*unlock)(unsigned mode, void *lock);
|
119
|
-
};
|
120
|
-
|
121
|
-
/** Sets a group of functions that Libevent should use for locking.
|
122
|
-
* For full information on the required callback API, see the
|
123
|
-
* documentation for the individual members of evthread_lock_callbacks.
|
124
|
-
*
|
125
|
-
* Note that if you're using Windows or the Pthreads threading library, you
|
126
|
-
* probably shouldn't call this function; instead, use
|
127
|
-
* evthread_use_windows_threads() or evthread_use_posix_threads() if you can.
|
128
|
-
*/
|
129
|
-
EVENT2_EXPORT_SYMBOL
|
130
|
-
int evthread_set_lock_callbacks(const struct evthread_lock_callbacks *);
|
131
|
-
|
132
|
-
#define EVTHREAD_CONDITION_API_VERSION 1
|
133
|
-
|
134
|
-
struct timeval;
|
135
|
-
|
136
|
-
/** This structure describes the interface a threading library uses for
|
137
|
-
* condition variables. It's used to tell evthread_set_condition_callbacks
|
138
|
-
* how to use locking on this platform.
|
139
|
-
*/
|
140
|
-
struct evthread_condition_callbacks {
|
141
|
-
/** The current version of the conditions API. Set this to
|
142
|
-
* EVTHREAD_CONDITION_API_VERSION */
|
143
|
-
int condition_api_version;
|
144
|
-
/** Function to allocate and initialize a new condition variable.
|
145
|
-
* Returns the condition variable on success, and NULL on failure.
|
146
|
-
* The 'condtype' argument will be 0 with this API version.
|
147
|
-
*/
|
148
|
-
void *(*alloc_condition)(unsigned condtype);
|
149
|
-
/** Function to free a condition variable. */
|
150
|
-
void (*free_condition)(void *cond);
|
151
|
-
/** Function to signal a condition variable. If 'broadcast' is 1, all
|
152
|
-
* threads waiting on 'cond' should be woken; otherwise, only on one
|
153
|
-
* thread is worken. Should return 0 on success, -1 on failure.
|
154
|
-
* This function will only be called while holding the associated
|
155
|
-
* lock for the condition.
|
156
|
-
*/
|
157
|
-
int (*signal_condition)(void *cond, int broadcast);
|
158
|
-
/** Function to wait for a condition variable. The lock 'lock'
|
159
|
-
* will be held when this function is called; should be released
|
160
|
-
* while waiting for the condition to be come signalled, and
|
161
|
-
* should be held again when this function returns.
|
162
|
-
* If timeout is provided, it is interval of seconds to wait for
|
163
|
-
* the event to become signalled; if it is NULL, the function
|
164
|
-
* should wait indefinitely.
|
165
|
-
*
|
166
|
-
* The function should return -1 on error; 0 if the condition
|
167
|
-
* was signalled, or 1 on a timeout. */
|
168
|
-
int (*wait_condition)(void *cond, void *lock,
|
169
|
-
const struct timeval *timeout);
|
170
|
-
};
|
171
|
-
|
172
|
-
/** Sets a group of functions that Libevent should use for condition variables.
|
173
|
-
* For full information on the required callback API, see the
|
174
|
-
* documentation for the individual members of evthread_condition_callbacks.
|
175
|
-
*
|
176
|
-
* Note that if you're using Windows or the Pthreads threading library, you
|
177
|
-
* probably shouldn't call this function; instead, use
|
178
|
-
* evthread_use_windows_threads() or evthread_use_pthreads() if you can.
|
179
|
-
*/
|
180
|
-
EVENT2_EXPORT_SYMBOL
|
181
|
-
int evthread_set_condition_callbacks(
|
182
|
-
const struct evthread_condition_callbacks *);
|
183
|
-
|
184
|
-
/**
|
185
|
-
Sets the function for determining the thread id.
|
186
|
-
|
187
|
-
@param base the event base for which to set the id function
|
188
|
-
@param id_fn the identify function Libevent should invoke to
|
189
|
-
determine the identity of a thread.
|
190
|
-
*/
|
191
|
-
EVENT2_EXPORT_SYMBOL
|
192
|
-
void evthread_set_id_callback(
|
193
|
-
unsigned long (*id_fn)(void));
|
194
|
-
|
195
|
-
#if (defined(_WIN32) && !defined(EVENT__DISABLE_THREAD_SUPPORT)) || defined(EVENT_IN_DOXYGEN_)
|
196
|
-
/** Sets up Libevent for use with Windows builtin locking and thread ID
|
197
|
-
functions. Unavailable if Libevent is not built for Windows.
|
198
|
-
|
199
|
-
@return 0 on success, -1 on failure. */
|
200
|
-
EVENT2_EXPORT_SYMBOL
|
201
|
-
int evthread_use_windows_threads(void);
|
202
|
-
/**
|
203
|
-
Defined if Libevent was built with support for evthread_use_windows_threads()
|
204
|
-
*/
|
205
|
-
#define EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED 1
|
206
|
-
#endif
|
207
|
-
|
208
|
-
#if defined(EVENT__HAVE_PTHREADS) || defined(EVENT_IN_DOXYGEN_)
|
209
|
-
/** Sets up Libevent for use with Pthreads locking and thread ID functions.
|
210
|
-
Unavailable if Libevent is not build for use with pthreads. Requires
|
211
|
-
libraries to link against Libevent_pthreads as well as Libevent.
|
212
|
-
|
213
|
-
@return 0 on success, -1 on failure. */
|
214
|
-
EVENT2_EXPORT_SYMBOL
|
215
|
-
int evthread_use_pthreads(void);
|
216
|
-
/** Defined if Libevent was built with support for evthread_use_pthreads() */
|
217
|
-
#define EVTHREAD_USE_PTHREADS_IMPLEMENTED 1
|
218
|
-
|
219
|
-
#endif
|
220
|
-
|
221
|
-
/** Enable debugging wrappers around the current lock callbacks. If Libevent
|
222
|
-
* makes one of several common locking errors, exit with an assertion failure.
|
223
|
-
*
|
224
|
-
* If you're going to call this function, you must do so before any locks are
|
225
|
-
* allocated.
|
226
|
-
**/
|
227
|
-
EVENT2_EXPORT_SYMBOL
|
228
|
-
void evthread_enable_lock_debugging(void);
|
229
|
-
|
230
|
-
/* Old (misspelled) version: This is deprecated; use
|
231
|
-
* evthread_enable_log_debugging instead. */
|
232
|
-
EVENT2_EXPORT_SYMBOL
|
233
|
-
void evthread_enable_lock_debuging(void);
|
234
|
-
|
235
|
-
#endif /* EVENT__DISABLE_THREAD_SUPPORT */
|
236
|
-
|
237
|
-
struct event_base;
|
238
|
-
/** Make sure it's safe to tell an event base to wake up from another thread
|
239
|
-
or a signal handler.
|
240
|
-
|
241
|
-
You shouldn't need to call this by hand; configuring the base with thread
|
242
|
-
support should be necessary and sufficient.
|
243
|
-
|
244
|
-
@return 0 on success, -1 on failure.
|
245
|
-
*/
|
246
|
-
EVENT2_EXPORT_SYMBOL
|
247
|
-
int evthread_make_base_notifiable(struct event_base *base);
|
248
|
-
|
249
|
-
#ifdef __cplusplus
|
250
|
-
}
|
251
|
-
#endif
|
252
|
-
|
253
|
-
#endif /* EVENT2_THREAD_H_INCLUDED_ */
|