Skip to content

Commit 9081b66

Browse files
committed
Export symbols for -fvisibility=hidden (under cmake)
Fixes: libevent#442
1 parent 83b1584 commit 9081b66

18 files changed

+146
-6
lines changed

Diff for: bufferevent-internal.h

+20
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,16 @@ extern const struct bufferevent_ops bufferevent_ops_async;
314314
#endif
315315

316316
/** Initialize the shared parts of a bufferevent. */
317+
EVENT2_EXPORT_SYMBOL
317318
int bufferevent_init_common_(struct bufferevent_private *, struct event_base *, const struct bufferevent_ops *, enum bufferevent_options options);
318319

319320
/** For internal use: temporarily stop all reads on bufev, until the conditions
320321
* in 'what' are over. */
322+
EVENT2_EXPORT_SYMBOL
321323
void bufferevent_suspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what);
322324
/** For internal use: clear the conditions 'what' on bufev, and re-enable
323325
* reading if there are no conditions left. */
326+
EVENT2_EXPORT_SYMBOL
324327
void bufferevent_unsuspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what);
325328

326329
/** For internal use: temporarily stop all writes on bufev, until the conditions
@@ -347,16 +350,19 @@ void bufferevent_unsuspend_write_(struct bufferevent *bufev, bufferevent_suspend
347350
@return 0 if successful, or -1 if an error occurred
348351
@see bufferevent_disable()
349352
*/
353+
EVENT2_EXPORT_SYMBOL
350354
int bufferevent_disable_hard_(struct bufferevent *bufev, short event);
351355

352356
/** Internal: Set up locking on a bufferevent. If lock is set, use it.
353357
* Otherwise, use a new lock. */
358+
EVENT2_EXPORT_SYMBOL
354359
int bufferevent_enable_locking_(struct bufferevent *bufev, void *lock);
355360
/** Internal: backwards compat macro for the now public function
356361
* Increment the reference count on bufev. */
357362
#define bufferevent_incref_(bufev) bufferevent_incref(bufev)
358363
/** Internal: Lock bufev and increase its reference count.
359364
* unlocking it otherwise. */
365+
EVENT2_EXPORT_SYMBOL
360366
void bufferevent_incref_and_lock_(struct bufferevent *bufev);
361367
/** Internal: backwards compat macro for the now public function
362368
* Decrement the reference count on bufev. Returns 1 if it freed
@@ -365,17 +371,21 @@ void bufferevent_incref_and_lock_(struct bufferevent *bufev);
365371

366372
/** Internal: Drop the reference count on bufev, freeing as necessary, and
367373
* unlocking it otherwise. Returns 1 if it freed the bufferevent. */
374+
EVENT2_EXPORT_SYMBOL
368375
int bufferevent_decref_and_unlock_(struct bufferevent *bufev);
369376

370377
/** Internal: If callbacks are deferred and we have a read callback, schedule
371378
* a readcb. Otherwise just run the readcb. Ignores watermarks. */
379+
EVENT2_EXPORT_SYMBOL
372380
void bufferevent_run_readcb_(struct bufferevent *bufev, int options);
373381
/** Internal: If callbacks are deferred and we have a write callback, schedule
374382
* a writecb. Otherwise just run the writecb. Ignores watermarks. */
383+
EVENT2_EXPORT_SYMBOL
375384
void bufferevent_run_writecb_(struct bufferevent *bufev, int options);
376385
/** Internal: If callbacks are deferred and we have an eventcb, schedule
377386
* it to run with events "what". Otherwise just run the eventcb.
378387
* See bufferevent_trigger_event for meaning of "options". */
388+
EVENT2_EXPORT_SYMBOL
379389
void bufferevent_run_eventcb_(struct bufferevent *bufev, short what, int options);
380390

381391
/** Internal: Run or schedule (if deferred or options contain
@@ -399,6 +409,7 @@ bufferevent_trigger_nolock_(struct bufferevent *bufev, short iotype, int options
399409

400410
/** Internal: Add the event 'ev' with timeout tv, unless tv is set to 0, in
401411
* which case add ev with no timeout. */
412+
EVENT2_EXPORT_SYMBOL
402413
int bufferevent_add_event_(struct event *ev, const struct timeval *tv);
403414

404415
/* =========
@@ -408,16 +419,21 @@ int bufferevent_add_event_(struct event *ev, const struct timeval *tv);
408419
/** Internal use: Set up the ev_read and ev_write callbacks so that
409420
* the other "generic_timeout" functions will work on it. Call this from
410421
* the constructor function. */
422+
EVENT2_EXPORT_SYMBOL
411423
void bufferevent_init_generic_timeout_cbs_(struct bufferevent *bev);
412424
/** Internal use: Add or delete the generic timeout events as appropriate.
413425
* (If an event is enabled and a timeout is set, we add the event. Otherwise
414426
* we delete it.) Call this from anything that changes the timeout values,
415427
* that enabled EV_READ or EV_WRITE, or that disables EV_READ or EV_WRITE. */
428+
EVENT2_EXPORT_SYMBOL
416429
int bufferevent_generic_adj_timeouts_(struct bufferevent *bev);
430+
EVENT2_EXPORT_SYMBOL
417431
int bufferevent_generic_adj_existing_timeouts_(struct bufferevent *bev);
418432

433+
EVENT2_EXPORT_SYMBOL
419434
enum bufferevent_options bufferevent_get_options_(struct bufferevent *bev);
420435

436+
EVENT2_EXPORT_SYMBOL
421437
const struct sockaddr*
422438
bufferevent_socket_get_conn_address_(struct bufferevent *bev);
423439

@@ -465,11 +481,15 @@ bufferevent_socket_get_conn_address_(struct bufferevent *bev);
465481

466482
/* ==== For rate-limiting. */
467483

484+
EVENT2_EXPORT_SYMBOL
468485
int bufferevent_decrement_write_buckets_(struct bufferevent_private *bev,
469486
ev_ssize_t bytes);
487+
EVENT2_EXPORT_SYMBOL
470488
int bufferevent_decrement_read_buckets_(struct bufferevent_private *bev,
471489
ev_ssize_t bytes);
490+
EVENT2_EXPORT_SYMBOL
472491
ev_ssize_t bufferevent_get_read_max_(struct bufferevent_private *bev);
492+
EVENT2_EXPORT_SYMBOL
473493
ev_ssize_t bufferevent_get_write_max_(struct bufferevent_private *bev);
474494

475495
int bufferevent_ratelim_init_(struct bufferevent_private *bev);

Diff for: defer-internal.h

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ typedef void (*deferred_cb_fn)(struct event_callback *, void *);
4646
@param cb The function to run when the struct event_callback executes.
4747
@param arg The function's second argument.
4848
*/
49+
EVENT2_EXPORT_SYMBOL
4950
void event_deferred_cb_init_(struct event_callback *, ev_uint8_t, deferred_cb_fn, void *);
5051
/**
5152
Change the priority of a non-pending event_callback.
@@ -54,12 +55,14 @@ void event_deferred_cb_set_priority_(struct event_callback *, ev_uint8_t);
5455
/**
5556
Cancel a struct event_callback if it is currently scheduled in an event_base.
5657
*/
58+
EVENT2_EXPORT_SYMBOL
5759
void event_deferred_cb_cancel_(struct event_base *, struct event_callback *);
5860
/**
5961
Activate a struct event_callback if it is not currently scheduled in an event_base.
6062
6163
Return true if it was not previously scheduled.
6264
*/
65+
EVENT2_EXPORT_SYMBOL
6366
int event_deferred_cb_schedule_(struct event_base *, struct event_callback *);
6467

6568
#ifdef __cplusplus

Diff for: event-internal.h

+5
Original file line numberDiff line numberDiff line change
@@ -421,16 +421,19 @@ int event_del_nolock_(struct event *ev, int blocking);
421421
int event_remove_timer_nolock_(struct event *ev);
422422

423423
void event_active_nolock_(struct event *ev, int res, short count);
424+
EVENT2_EXPORT_SYMBOL
424425
int event_callback_activate_(struct event_base *, struct event_callback *);
425426
int event_callback_activate_nolock_(struct event_base *, struct event_callback *);
426427
int event_callback_cancel_(struct event_base *base,
427428
struct event_callback *evcb);
428429

429430
void event_callback_finalize_nolock_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *));
431+
EVENT2_EXPORT_SYMBOL
430432
void event_callback_finalize_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *));
431433
int event_callback_finalize_many_(struct event_base *base, int n_cbs, struct event_callback **evcb, void (*cb)(struct event_callback *, void *));
432434

433435

436+
EVENT2_EXPORT_SYMBOL
434437
void event_active_later_(struct event *ev, int res);
435438
void event_active_later_nolock_(struct event *ev, int res);
436439
int event_callback_activate_later_nolock_(struct event_base *base,
@@ -441,6 +444,7 @@ void event_callback_init_(struct event_base *base,
441444
struct event_callback *cb);
442445

443446
/* FIXME document. */
447+
EVENT2_EXPORT_SYMBOL
444448
void event_base_add_virtual_(struct event_base *base);
445449
void event_base_del_virtual_(struct event_base *base);
446450

@@ -450,6 +454,7 @@ void event_base_del_virtual_(struct event_base *base);
450454
451455
Returns on success; aborts on failure.
452456
*/
457+
EVENT2_EXPORT_SYMBOL
453458
void event_base_assert_ok_(struct event_base *base);
454459
void event_base_assert_ok_nolock_(struct event_base *base);
455460

Diff for: event.c

+1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ static const struct eventop *eventops[] = {
123123
};
124124

125125
/* Global state; deprecated */
126+
EVENT2_EXPORT_SYMBOL
126127
struct event_base *event_global_current_base_ = NULL;
127128
#define current_base event_global_current_base_
128129

Diff for: event_tagging.c

+4
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,13 @@
9393
a final padding nibble with value 0 is appended.
9494
*/
9595

96+
EVENT2_EXPORT_SYMBOL
9697
int evtag_decode_int(ev_uint32_t *pnumber, struct evbuffer *evbuf);
98+
EVENT2_EXPORT_SYMBOL
9799
int evtag_decode_int64(ev_uint64_t *pnumber, struct evbuffer *evbuf);
100+
EVENT2_EXPORT_SYMBOL
98101
int evtag_encode_tag(struct evbuffer *evbuf, ev_uint32_t tag);
102+
EVENT2_EXPORT_SYMBOL
99103
int evtag_decode_tag(ev_uint32_t *ptag, struct evbuffer *evbuf);
100104

101105
void

Diff for: evthread-internal.h

+5
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ struct event_base;
4949
#if ! defined(EVENT__DISABLE_THREAD_SUPPORT) && defined(EVTHREAD_EXPOSE_STRUCTS)
5050
/* Global function pointers to lock-related functions. NULL if locking isn't
5151
enabled. */
52+
EVENT2_EXPORT_SYMBOL
5253
extern struct evthread_lock_callbacks evthread_lock_fns_;
54+
EVENT2_EXPORT_SYMBOL
5355
extern struct evthread_condition_callbacks evthread_cond_fns_;
5456
extern unsigned long (*evthread_id_fn_)(void);
57+
EVENT2_EXPORT_SYMBOL
5558
extern int evthread_lock_debugging_enabled_;
5659

5760
/** Return the ID of the current thread, or 1 if threading isn't enabled. */
@@ -355,6 +358,7 @@ EVLOCK_TRY_LOCK_(void *lock)
355358
EVLOCK_UNLOCK(lock1_tmplock_,mode1); \
356359
} while (0)
357360

361+
EVENT2_EXPORT_SYMBOL
358362
int evthread_is_debug_lock_held_(void *lock);
359363
void *evthread_debug_get_real_lock_(void *lock);
360364

@@ -377,6 +381,7 @@ int evutil_global_setup_locks_(const int enable_locks);
377381
int evutil_secure_rng_global_setup_locks_(const int enable_locks);
378382

379383
/** Return current evthread_lock_callbacks */
384+
EVENT2_EXPORT_SYMBOL
380385
struct evthread_lock_callbacks *evthread_get_lock_callbacks(void);
381386
/** Return current evthread_condition_callbacks */
382387
struct evthread_condition_callbacks *evthread_get_condition_callbacks(void);

Diff for: evthread.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#endif
4747

4848
#ifndef EVENT__DISABLE_DEBUG_MODE
49-
extern int event_debug_created_threadable_ctx_;
49+
extern int event_debug_created_threadable_ctx_;
5050
extern int event_debug_mode_on_;
5151
#endif
5252

Diff for: http-internal.h

+4
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,15 @@ int evhttp_connection_connect_(struct evhttp_connection *);
184184

185185
enum evhttp_request_error;
186186
/* notifies the current request that it failed; resets connection */
187+
EVENT2_EXPORT_SYMBOL
187188
void evhttp_connection_fail_(struct evhttp_connection *,
188189
enum evhttp_request_error error);
189190

190191
enum message_read_status;
191192

193+
EVENT2_EXPORT_SYMBOL
192194
enum message_read_status evhttp_parse_firstline_(struct evhttp_request *, struct evbuffer*);
195+
EVENT2_EXPORT_SYMBOL
193196
enum message_read_status evhttp_parse_headers_(struct evhttp_request *, struct evbuffer*);
194197

195198
void evhttp_start_read_(struct evhttp_connection *);
@@ -199,6 +202,7 @@ void evhttp_start_write_(struct evhttp_connection *);
199202
void evhttp_response_code_(struct evhttp_request *, int, const char *);
200203
void evhttp_send_page_(struct evhttp_request *, struct evbuffer *);
201204

205+
EVENT2_EXPORT_SYMBOL
202206
int evhttp_decode_uri_internal(const char *uri, size_t length,
203207
char *ret, int decode_plus);
204208

Diff for: include/event2/bufferevent_compat.h

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#ifndef EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
2929
#define EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
3030

31+
#include <event2/visibility.h>
32+
3133
#define evbuffercb bufferevent_data_cb
3234
#define everrorcb bufferevent_event_cb
3335

@@ -72,6 +74,7 @@
7274
error occurred
7375
@see bufferevent_base_set(), bufferevent_free()
7476
*/
77+
EVENT2_EXPORT_SYMBOL
7578
struct bufferevent *bufferevent_new(evutil_socket_t fd,
7679
evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg);
7780

@@ -83,6 +86,7 @@ struct bufferevent *bufferevent_new(evutil_socket_t fd,
8386
@param timeout_read the read timeout
8487
@param timeout_write the write timeout
8588
*/
89+
EVENT2_EXPORT_SYMBOL
8690
void bufferevent_settimeout(struct bufferevent *bufev,
8791
int timeout_read, int timeout_write);
8892

0 commit comments

Comments
 (0)