Projects
Mega:23.09
libtevent
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 3
View file
_service:tar_scm:libtevent.spec
Changed
@@ -1,9 +1,9 @@ %{!?python3_sitearch: %define python3_sitearch %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} -%global talloc_version 2.4.0 +%global talloc_version 2.4.1 Name: libtevent -Version: 0.14.1 +Version: 0.16.0 Release: 1 Summary: Tevent is an event system based on the talloc memory management library. License: LGPLv3+ @@ -85,6 +85,9 @@ %changelog +* Thu Oct 26 2023 Paul Thomas <paulthomas100199@gmail.com> - 0.16.0-1 +- update to version v0.16.0 + * Mon Jul 17 2023 Kunlin Yang <yangkunlin7@huawei.com> - 0.14.1-1 - update to v0.14.1 version
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="url">git@gitee.com:src-openeuler/libtevent.git</param> <param name="scm">git</param> - <param name="revision">openEuler-23.09</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:libtevent.yaml
Changed
@@ -1,4 +1,4 @@ version_control: github src_repo: gooselinux/libtevent tag_prefix: tevent- -seperator: "." +separator: "."
View file
_service:tar_scm:tevent-0.16.0.tar.gz/ABI/tevent-0.15.0.sigs
Added
@@ -0,0 +1,167 @@ +__tevent_req_create: struct tevent_req *(TALLOC_CTX *, void *, size_t, const char *, const char *, const char *) +_tevent_add_fd: struct tevent_fd *(struct tevent_context *, TALLOC_CTX *, int, uint16_t, tevent_fd_handler_t, void *, const char *, const char *) +_tevent_add_signal: struct tevent_signal *(struct tevent_context *, TALLOC_CTX *, int, int, tevent_signal_handler_t, void *, const char *, const char *) +_tevent_add_timer: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +_tevent_context_pop_use: void (struct tevent_context *, const char *) +_tevent_context_push_use: bool (struct tevent_context *, const char *) +_tevent_context_wrapper_create: struct tevent_context *(struct tevent_context *, TALLOC_CTX *, const struct tevent_wrapper_ops *, void *, size_t, const char *, const char *) +_tevent_create_immediate: struct tevent_immediate *(TALLOC_CTX *, const char *) +_tevent_loop_once: int (struct tevent_context *, const char *) +_tevent_loop_until: int (struct tevent_context *, bool (*)(void *), void *, const char *) +_tevent_loop_wait: int (struct tevent_context *, const char *) +_tevent_queue_add: bool (struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, const char *, void *) +_tevent_queue_add_entry: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, const char *, void *) +_tevent_queue_add_optimize_empty: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, const char *, void *) +_tevent_queue_create: struct tevent_queue *(TALLOC_CTX *, const char *, const char *) +_tevent_req_callback_data: void *(struct tevent_req *) +_tevent_req_cancel: bool (struct tevent_req *, const char *) +_tevent_req_create: struct tevent_req *(TALLOC_CTX *, void *, size_t, const char *, const char *) +_tevent_req_data: void *(struct tevent_req *) +_tevent_req_done: void (struct tevent_req *, const char *) +_tevent_req_error: bool (struct tevent_req *, uint64_t, const char *) +_tevent_req_nomem: bool (const void *, struct tevent_req *, const char *) +_tevent_req_notify_callback: void (struct tevent_req *, const char *) +_tevent_req_oom: void (struct tevent_req *, const char *) +_tevent_req_set_callback: void (struct tevent_req *, tevent_req_fn, const char *, void *) +_tevent_req_set_cancel_fn: void (struct tevent_req *, tevent_req_cancel_fn, const char *) +_tevent_req_set_cleanup_fn: void (struct tevent_req *, tevent_req_cleanup_fn, const char *) +_tevent_schedule_immediate: void (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *) +_tevent_thread_call_depth_reset_from_req: void (struct tevent_req *, const char *) +_tevent_threaded_schedule_immediate: void (struct tevent_threaded_context *, struct tevent_immediate *, tevent_immediate_handler_t, void *, const char *, const char *) +tevent_abort: void (struct tevent_context *, const char *) +tevent_backend_list: const char **(TALLOC_CTX *) +tevent_cached_getpid: pid_t (void) +tevent_cleanup_pending_signal_handlers: void (struct tevent_signal *) +tevent_common_add_fd: struct tevent_fd *(struct tevent_context *, TALLOC_CTX *, int, uint16_t, tevent_fd_handler_t, void *, const char *, const char *) +tevent_common_add_signal: struct tevent_signal *(struct tevent_context *, TALLOC_CTX *, int, int, tevent_signal_handler_t, void *, const char *, const char *) +tevent_common_add_timer: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +tevent_common_add_timer_v2: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +tevent_common_check_double_free: void (TALLOC_CTX *, const char *) +tevent_common_check_signal: int (struct tevent_context *) +tevent_common_context_destructor: int (struct tevent_context *) +tevent_common_fd_destructor: int (struct tevent_fd *) +tevent_common_fd_get_flags: uint16_t (struct tevent_fd *) +tevent_common_fd_set_close_fn: void (struct tevent_fd *, tevent_fd_close_fn_t) +tevent_common_fd_set_flags: void (struct tevent_fd *, uint16_t) +tevent_common_have_events: bool (struct tevent_context *) +tevent_common_invoke_fd_handler: int (struct tevent_fd *, uint16_t, bool *) +tevent_common_invoke_immediate_handler: int (struct tevent_immediate *, bool *) +tevent_common_invoke_signal_handler: int (struct tevent_signal *, int, int, void *, bool *) +tevent_common_invoke_timer_handler: int (struct tevent_timer *, struct timeval, bool *) +tevent_common_loop_immediate: bool (struct tevent_context *) +tevent_common_loop_timer_delay: struct timeval (struct tevent_context *) +tevent_common_loop_wait: int (struct tevent_context *, const char *) +tevent_common_schedule_immediate: void (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *) +tevent_common_threaded_activate_immediate: void (struct tevent_context *) +tevent_common_wakeup: int (struct tevent_context *) +tevent_common_wakeup_fd: int (int) +tevent_common_wakeup_init: int (struct tevent_context *) +tevent_context_init: struct tevent_context *(TALLOC_CTX *) +tevent_context_init_byname: struct tevent_context *(TALLOC_CTX *, const char *) +tevent_context_init_ops: struct tevent_context *(TALLOC_CTX *, const struct tevent_ops *, void *) +tevent_context_is_wrapper: bool (struct tevent_context *) +tevent_context_same_loop: bool (struct tevent_context *, struct tevent_context *) +tevent_debug: void (struct tevent_context *, enum tevent_debug_level, const char *, ...) +tevent_fd_get_flags: uint16_t (struct tevent_fd *) +tevent_fd_get_tag: uint64_t (const struct tevent_fd *) +tevent_fd_set_auto_close: void (struct tevent_fd *) +tevent_fd_set_close_fn: void (struct tevent_fd *, tevent_fd_close_fn_t) +tevent_fd_set_flags: void (struct tevent_fd *, uint16_t) +tevent_fd_set_tag: void (struct tevent_fd *, uint64_t) +tevent_find_ops_byname: const struct tevent_ops *(const char *) +tevent_get_trace_callback: void (struct tevent_context *, tevent_trace_callback_t *, void *) +tevent_get_trace_fd_callback: void (struct tevent_context *, tevent_trace_fd_callback_t *, void *) +tevent_get_trace_immediate_callback: void (struct tevent_context *, tevent_trace_immediate_callback_t *, void *) +tevent_get_trace_queue_callback: void (struct tevent_context *, tevent_trace_queue_callback_t *, void *) +tevent_get_trace_signal_callback: void (struct tevent_context *, tevent_trace_signal_callback_t *, void *) +tevent_get_trace_timer_callback: void (struct tevent_context *, tevent_trace_timer_callback_t *, void *) +tevent_immediate_get_tag: uint64_t (const struct tevent_immediate *) +tevent_immediate_set_tag: void (struct tevent_immediate *, uint64_t) +tevent_loop_allow_nesting: void (struct tevent_context *) +tevent_loop_set_nesting_hook: void (struct tevent_context *, tevent_nesting_hook, void *) +tevent_num_signals: size_t (void) +tevent_queue_add: bool (struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_add_entry: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_add_optimize_empty: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_entry_get_tag: uint64_t (const struct tevent_queue_entry *) +tevent_queue_entry_set_tag: void (struct tevent_queue_entry *, uint64_t) +tevent_queue_entry_untrigger: void (struct tevent_queue_entry *) +tevent_queue_length: size_t (struct tevent_queue *) +tevent_queue_running: bool (struct tevent_queue *) +tevent_queue_start: void (struct tevent_queue *) +tevent_queue_stop: void (struct tevent_queue *) +tevent_queue_wait_recv: bool (struct tevent_req *) +tevent_queue_wait_send: struct tevent_req *(TALLOC_CTX *, struct tevent_context *, struct tevent_queue *) +tevent_re_initialise: int (struct tevent_context *) +tevent_register_backend: bool (const char *, const struct tevent_ops *) +tevent_req_default_print: char *(struct tevent_req *, TALLOC_CTX *) +tevent_req_defer_callback: void (struct tevent_req *, struct tevent_context *) +tevent_req_get_profile: const struct tevent_req_profile *(struct tevent_req *) +tevent_req_is_error: bool (struct tevent_req *, enum tevent_req_state *, uint64_t *) +tevent_req_is_in_progress: bool (struct tevent_req *) +tevent_req_move_profile: struct tevent_req_profile *(struct tevent_req *, TALLOC_CTX *) +tevent_req_poll: bool (struct tevent_req *, struct tevent_context *) +tevent_req_post: struct tevent_req *(struct tevent_req *, struct tevent_context *) +tevent_req_print: char *(TALLOC_CTX *, struct tevent_req *) +tevent_req_profile_append_sub: void (struct tevent_req_profile *, struct tevent_req_profile **) +tevent_req_profile_create: struct tevent_req_profile *(TALLOC_CTX *) +tevent_req_profile_get_name: void (const struct tevent_req_profile *, const char **) +tevent_req_profile_get_start: void (const struct tevent_req_profile *, const char **, struct timeval *) +tevent_req_profile_get_status: void (const struct tevent_req_profile *, pid_t *, enum tevent_req_state *, uint64_t *) +tevent_req_profile_get_stop: void (const struct tevent_req_profile *, const char **, struct timeval *) +tevent_req_profile_get_subprofiles: const struct tevent_req_profile *(const struct tevent_req_profile *) +tevent_req_profile_next: const struct tevent_req_profile *(const struct tevent_req_profile *) +tevent_req_profile_set_name: bool (struct tevent_req_profile *, const char *) +tevent_req_profile_set_start: bool (struct tevent_req_profile *, const char *, struct timeval) +tevent_req_profile_set_status: void (struct tevent_req_profile *, pid_t, enum tevent_req_state, uint64_t) +tevent_req_profile_set_stop: bool (struct tevent_req_profile *, const char *, struct timeval) +tevent_req_received: void (struct tevent_req *) +tevent_req_reset_endtime: void (struct tevent_req *) +tevent_req_set_callback: void (struct tevent_req *, tevent_req_fn, void *) +tevent_req_set_cancel_fn: void (struct tevent_req *, tevent_req_cancel_fn) +tevent_req_set_cleanup_fn: void (struct tevent_req *, tevent_req_cleanup_fn) +tevent_req_set_endtime: bool (struct tevent_req *, struct tevent_context *, struct timeval) +tevent_req_set_print_fn: void (struct tevent_req *, tevent_req_print_fn) +tevent_req_set_profile: bool (struct tevent_req *) +tevent_sa_info_queue_count: size_t (void) +tevent_set_abort_fn: void (void (*)(const char *)) +tevent_set_debug: int (struct tevent_context *, void (*)(void *, enum tevent_debug_level, const char *, va_list), void *) +tevent_set_debug_stderr: int (struct tevent_context *) +tevent_set_default_backend: void (const char *) +tevent_set_max_debug_level: enum tevent_debug_level (struct tevent_context *, enum tevent_debug_level) +tevent_set_trace_callback: void (struct tevent_context *, tevent_trace_callback_t, void *) +tevent_set_trace_fd_callback: void (struct tevent_context *, tevent_trace_fd_callback_t, void *) +tevent_set_trace_immediate_callback: void (struct tevent_context *, tevent_trace_immediate_callback_t, void *) +tevent_set_trace_queue_callback: void (struct tevent_context *, tevent_trace_queue_callback_t, void *) +tevent_set_trace_signal_callback: void (struct tevent_context *, tevent_trace_signal_callback_t, void *) +tevent_set_trace_timer_callback: void (struct tevent_context *, tevent_trace_timer_callback_t, void *) +tevent_signal_get_tag: uint64_t (const struct tevent_signal *) +tevent_signal_set_tag: void (struct tevent_signal *, uint64_t) +tevent_signal_support: bool (struct tevent_context *) +tevent_thread_call_depth_activate: void (size_t *) +tevent_thread_call_depth_deactivate: void (void) +tevent_thread_call_depth_reset_from_req: void (struct tevent_req *) +tevent_thread_call_depth_set_callback: void (tevent_call_depth_callback_t, void *) +tevent_thread_call_depth_start: void (struct tevent_req *) +tevent_thread_proxy_create: struct tevent_thread_proxy *(struct tevent_context *) +tevent_thread_proxy_schedule: void (struct tevent_thread_proxy *, struct tevent_immediate **, tevent_immediate_handler_t, void *) +tevent_threaded_context_create: struct tevent_threaded_context *(TALLOC_CTX *, struct tevent_context *) +tevent_timer_get_tag: uint64_t (const struct tevent_timer *) +tevent_timer_set_tag: void (struct tevent_timer *, uint64_t) +tevent_timeval_add: struct timeval (const struct timeval *, uint32_t, uint32_t) +tevent_timeval_compare: int (const struct timeval *, const struct timeval *) +tevent_timeval_current: struct timeval (void) +tevent_timeval_current_ofs: struct timeval (uint32_t, uint32_t) +tevent_timeval_is_zero: bool (const struct timeval *) +tevent_timeval_set: struct timeval (uint32_t, uint32_t) +tevent_timeval_until: struct timeval (const struct timeval *, const struct timeval *) +tevent_timeval_zero: struct timeval (void) +tevent_trace_fd_callback: void (struct tevent_context *, struct tevent_fd *, enum tevent_event_trace_point) +tevent_trace_immediate_callback: void (struct tevent_context *, struct tevent_immediate *, enum tevent_event_trace_point) +tevent_trace_point_callback: void (struct tevent_context *, enum tevent_trace_point) +tevent_trace_queue_callback: void (struct tevent_context *, struct tevent_queue_entry *, enum tevent_event_trace_point) +tevent_trace_signal_callback: void (struct tevent_context *, struct tevent_signal *, enum tevent_event_trace_point) +tevent_trace_timer_callback: void (struct tevent_context *, struct tevent_timer *, enum tevent_event_trace_point) +tevent_update_timer: void (struct tevent_timer *, struct timeval) +tevent_wakeup_recv: bool (struct tevent_req *) +tevent_wakeup_send: struct tevent_req *(TALLOC_CTX *, struct tevent_context *, struct timeval)
View file
_service:tar_scm:tevent-0.16.0.tar.gz/ABI/tevent-0.16.0.sigs
Added
@@ -0,0 +1,167 @@ +__tevent_req_create: struct tevent_req *(TALLOC_CTX *, void *, size_t, const char *, const char *, const char *) +_tevent_add_fd: struct tevent_fd *(struct tevent_context *, TALLOC_CTX *, int, uint16_t, tevent_fd_handler_t, void *, const char *, const char *) +_tevent_add_signal: struct tevent_signal *(struct tevent_context *, TALLOC_CTX *, int, int, tevent_signal_handler_t, void *, const char *, const char *) +_tevent_add_timer: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +_tevent_context_pop_use: void (struct tevent_context *, const char *) +_tevent_context_push_use: bool (struct tevent_context *, const char *) +_tevent_context_wrapper_create: struct tevent_context *(struct tevent_context *, TALLOC_CTX *, const struct tevent_wrapper_ops *, void *, size_t, const char *, const char *) +_tevent_create_immediate: struct tevent_immediate *(TALLOC_CTX *, const char *) +_tevent_loop_once: int (struct tevent_context *, const char *) +_tevent_loop_until: int (struct tevent_context *, bool (*)(void *), void *, const char *) +_tevent_loop_wait: int (struct tevent_context *, const char *) +_tevent_queue_add: bool (struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, const char *, void *) +_tevent_queue_add_entry: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, const char *, void *) +_tevent_queue_add_optimize_empty: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, const char *, void *) +_tevent_queue_create: struct tevent_queue *(TALLOC_CTX *, const char *, const char *) +_tevent_req_callback_data: void *(struct tevent_req *) +_tevent_req_cancel: bool (struct tevent_req *, const char *) +_tevent_req_create: struct tevent_req *(TALLOC_CTX *, void *, size_t, const char *, const char *) +_tevent_req_data: void *(struct tevent_req *) +_tevent_req_done: void (struct tevent_req *, const char *) +_tevent_req_error: bool (struct tevent_req *, uint64_t, const char *) +_tevent_req_nomem: bool (const void *, struct tevent_req *, const char *) +_tevent_req_notify_callback: void (struct tevent_req *, const char *) +_tevent_req_oom: void (struct tevent_req *, const char *) +_tevent_req_set_callback: void (struct tevent_req *, tevent_req_fn, const char *, void *) +_tevent_req_set_cancel_fn: void (struct tevent_req *, tevent_req_cancel_fn, const char *) +_tevent_req_set_cleanup_fn: void (struct tevent_req *, tevent_req_cleanup_fn, const char *) +_tevent_schedule_immediate: void (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *) +_tevent_thread_call_depth_reset_from_req: void (struct tevent_req *, const char *) +_tevent_threaded_schedule_immediate: void (struct tevent_threaded_context *, struct tevent_immediate *, tevent_immediate_handler_t, void *, const char *, const char *) +tevent_abort: void (struct tevent_context *, const char *) +tevent_backend_list: const char **(TALLOC_CTX *) +tevent_cached_getpid: pid_t (void) +tevent_cleanup_pending_signal_handlers: void (struct tevent_signal *) +tevent_common_add_fd: struct tevent_fd *(struct tevent_context *, TALLOC_CTX *, int, uint16_t, tevent_fd_handler_t, void *, const char *, const char *) +tevent_common_add_signal: struct tevent_signal *(struct tevent_context *, TALLOC_CTX *, int, int, tevent_signal_handler_t, void *, const char *, const char *) +tevent_common_add_timer: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +tevent_common_add_timer_v2: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +tevent_common_check_double_free: void (TALLOC_CTX *, const char *) +tevent_common_check_signal: int (struct tevent_context *) +tevent_common_context_destructor: int (struct tevent_context *) +tevent_common_fd_destructor: int (struct tevent_fd *) +tevent_common_fd_get_flags: uint16_t (struct tevent_fd *) +tevent_common_fd_set_close_fn: void (struct tevent_fd *, tevent_fd_close_fn_t) +tevent_common_fd_set_flags: void (struct tevent_fd *, uint16_t) +tevent_common_have_events: bool (struct tevent_context *) +tevent_common_invoke_fd_handler: int (struct tevent_fd *, uint16_t, bool *) +tevent_common_invoke_immediate_handler: int (struct tevent_immediate *, bool *) +tevent_common_invoke_signal_handler: int (struct tevent_signal *, int, int, void *, bool *) +tevent_common_invoke_timer_handler: int (struct tevent_timer *, struct timeval, bool *) +tevent_common_loop_immediate: bool (struct tevent_context *) +tevent_common_loop_timer_delay: struct timeval (struct tevent_context *) +tevent_common_loop_wait: int (struct tevent_context *, const char *) +tevent_common_schedule_immediate: void (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *) +tevent_common_threaded_activate_immediate: void (struct tevent_context *) +tevent_common_wakeup: int (struct tevent_context *) +tevent_common_wakeup_fd: int (int) +tevent_common_wakeup_init: int (struct tevent_context *) +tevent_context_init: struct tevent_context *(TALLOC_CTX *) +tevent_context_init_byname: struct tevent_context *(TALLOC_CTX *, const char *) +tevent_context_init_ops: struct tevent_context *(TALLOC_CTX *, const struct tevent_ops *, void *) +tevent_context_is_wrapper: bool (struct tevent_context *) +tevent_context_same_loop: bool (struct tevent_context *, struct tevent_context *) +tevent_debug: void (struct tevent_context *, enum tevent_debug_level, const char *, ...) +tevent_fd_get_flags: uint16_t (struct tevent_fd *) +tevent_fd_get_tag: uint64_t (const struct tevent_fd *) +tevent_fd_set_auto_close: void (struct tevent_fd *) +tevent_fd_set_close_fn: void (struct tevent_fd *, tevent_fd_close_fn_t) +tevent_fd_set_flags: void (struct tevent_fd *, uint16_t) +tevent_fd_set_tag: void (struct tevent_fd *, uint64_t) +tevent_find_ops_byname: const struct tevent_ops *(const char *) +tevent_get_trace_callback: void (struct tevent_context *, tevent_trace_callback_t *, void *) +tevent_get_trace_fd_callback: void (struct tevent_context *, tevent_trace_fd_callback_t *, void *) +tevent_get_trace_immediate_callback: void (struct tevent_context *, tevent_trace_immediate_callback_t *, void *) +tevent_get_trace_queue_callback: void (struct tevent_context *, tevent_trace_queue_callback_t *, void *) +tevent_get_trace_signal_callback: void (struct tevent_context *, tevent_trace_signal_callback_t *, void *) +tevent_get_trace_timer_callback: void (struct tevent_context *, tevent_trace_timer_callback_t *, void *) +tevent_immediate_get_tag: uint64_t (const struct tevent_immediate *) +tevent_immediate_set_tag: void (struct tevent_immediate *, uint64_t) +tevent_loop_allow_nesting: void (struct tevent_context *) +tevent_loop_set_nesting_hook: void (struct tevent_context *, tevent_nesting_hook, void *) +tevent_num_signals: size_t (void) +tevent_queue_add: bool (struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_add_entry: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_add_optimize_empty: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_entry_get_tag: uint64_t (const struct tevent_queue_entry *) +tevent_queue_entry_set_tag: void (struct tevent_queue_entry *, uint64_t) +tevent_queue_entry_untrigger: void (struct tevent_queue_entry *) +tevent_queue_length: size_t (struct tevent_queue *) +tevent_queue_running: bool (struct tevent_queue *) +tevent_queue_start: void (struct tevent_queue *) +tevent_queue_stop: void (struct tevent_queue *) +tevent_queue_wait_recv: bool (struct tevent_req *) +tevent_queue_wait_send: struct tevent_req *(TALLOC_CTX *, struct tevent_context *, struct tevent_queue *) +tevent_re_initialise: int (struct tevent_context *) +tevent_register_backend: bool (const char *, const struct tevent_ops *) +tevent_req_default_print: char *(struct tevent_req *, TALLOC_CTX *) +tevent_req_defer_callback: void (struct tevent_req *, struct tevent_context *) +tevent_req_get_profile: const struct tevent_req_profile *(struct tevent_req *) +tevent_req_is_error: bool (struct tevent_req *, enum tevent_req_state *, uint64_t *) +tevent_req_is_in_progress: bool (struct tevent_req *) +tevent_req_move_profile: struct tevent_req_profile *(struct tevent_req *, TALLOC_CTX *) +tevent_req_poll: bool (struct tevent_req *, struct tevent_context *) +tevent_req_post: struct tevent_req *(struct tevent_req *, struct tevent_context *) +tevent_req_print: char *(TALLOC_CTX *, struct tevent_req *) +tevent_req_profile_append_sub: void (struct tevent_req_profile *, struct tevent_req_profile **) +tevent_req_profile_create: struct tevent_req_profile *(TALLOC_CTX *) +tevent_req_profile_get_name: void (const struct tevent_req_profile *, const char **) +tevent_req_profile_get_start: void (const struct tevent_req_profile *, const char **, struct timeval *) +tevent_req_profile_get_status: void (const struct tevent_req_profile *, pid_t *, enum tevent_req_state *, uint64_t *) +tevent_req_profile_get_stop: void (const struct tevent_req_profile *, const char **, struct timeval *) +tevent_req_profile_get_subprofiles: const struct tevent_req_profile *(const struct tevent_req_profile *) +tevent_req_profile_next: const struct tevent_req_profile *(const struct tevent_req_profile *) +tevent_req_profile_set_name: bool (struct tevent_req_profile *, const char *) +tevent_req_profile_set_start: bool (struct tevent_req_profile *, const char *, struct timeval) +tevent_req_profile_set_status: void (struct tevent_req_profile *, pid_t, enum tevent_req_state, uint64_t) +tevent_req_profile_set_stop: bool (struct tevent_req_profile *, const char *, struct timeval) +tevent_req_received: void (struct tevent_req *) +tevent_req_reset_endtime: void (struct tevent_req *) +tevent_req_set_callback: void (struct tevent_req *, tevent_req_fn, void *) +tevent_req_set_cancel_fn: void (struct tevent_req *, tevent_req_cancel_fn) +tevent_req_set_cleanup_fn: void (struct tevent_req *, tevent_req_cleanup_fn) +tevent_req_set_endtime: bool (struct tevent_req *, struct tevent_context *, struct timeval) +tevent_req_set_print_fn: void (struct tevent_req *, tevent_req_print_fn) +tevent_req_set_profile: bool (struct tevent_req *) +tevent_sa_info_queue_count: size_t (void) +tevent_set_abort_fn: void (void (*)(const char *)) +tevent_set_debug: int (struct tevent_context *, void (*)(void *, enum tevent_debug_level, const char *, va_list), void *) +tevent_set_debug_stderr: int (struct tevent_context *) +tevent_set_default_backend: void (const char *) +tevent_set_max_debug_level: enum tevent_debug_level (struct tevent_context *, enum tevent_debug_level) +tevent_set_trace_callback: void (struct tevent_context *, tevent_trace_callback_t, void *) +tevent_set_trace_fd_callback: void (struct tevent_context *, tevent_trace_fd_callback_t, void *) +tevent_set_trace_immediate_callback: void (struct tevent_context *, tevent_trace_immediate_callback_t, void *) +tevent_set_trace_queue_callback: void (struct tevent_context *, tevent_trace_queue_callback_t, void *) +tevent_set_trace_signal_callback: void (struct tevent_context *, tevent_trace_signal_callback_t, void *) +tevent_set_trace_timer_callback: void (struct tevent_context *, tevent_trace_timer_callback_t, void *) +tevent_signal_get_tag: uint64_t (const struct tevent_signal *) +tevent_signal_set_tag: void (struct tevent_signal *, uint64_t) +tevent_signal_support: bool (struct tevent_context *) +tevent_thread_call_depth_activate: void (size_t *) +tevent_thread_call_depth_deactivate: void (void) +tevent_thread_call_depth_reset_from_req: void (struct tevent_req *) +tevent_thread_call_depth_set_callback: void (tevent_call_depth_callback_t, void *) +tevent_thread_call_depth_start: void (struct tevent_req *) +tevent_thread_proxy_create: struct tevent_thread_proxy *(struct tevent_context *) +tevent_thread_proxy_schedule: void (struct tevent_thread_proxy *, struct tevent_immediate **, tevent_immediate_handler_t, void *) +tevent_threaded_context_create: struct tevent_threaded_context *(TALLOC_CTX *, struct tevent_context *) +tevent_timer_get_tag: uint64_t (const struct tevent_timer *) +tevent_timer_set_tag: void (struct tevent_timer *, uint64_t) +tevent_timeval_add: struct timeval (const struct timeval *, uint32_t, uint32_t) +tevent_timeval_compare: int (const struct timeval *, const struct timeval *) +tevent_timeval_current: struct timeval (void) +tevent_timeval_current_ofs: struct timeval (uint32_t, uint32_t) +tevent_timeval_is_zero: bool (const struct timeval *) +tevent_timeval_set: struct timeval (uint32_t, uint32_t) +tevent_timeval_until: struct timeval (const struct timeval *, const struct timeval *) +tevent_timeval_zero: struct timeval (void) +tevent_trace_fd_callback: void (struct tevent_context *, struct tevent_fd *, enum tevent_event_trace_point) +tevent_trace_immediate_callback: void (struct tevent_context *, struct tevent_immediate *, enum tevent_event_trace_point) +tevent_trace_point_callback: void (struct tevent_context *, enum tevent_trace_point) +tevent_trace_queue_callback: void (struct tevent_context *, struct tevent_queue_entry *, enum tevent_event_trace_point) +tevent_trace_signal_callback: void (struct tevent_context *, struct tevent_signal *, enum tevent_event_trace_point) +tevent_trace_timer_callback: void (struct tevent_context *, struct tevent_timer *, enum tevent_event_trace_point) +tevent_update_timer: void (struct tevent_timer *, struct timeval) +tevent_wakeup_recv: bool (struct tevent_req *) +tevent_wakeup_send: struct tevent_req *(TALLOC_CTX *, struct tevent_context *, struct timeval)
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/examples/run_on_target.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/examples/run_on_target.py
Changed
@@ -38,7 +38,7 @@ import subprocess from optparse import OptionParser -# those are defaults, but can be overidden using command line +# these are defaults, but can be overridden using command line SSH = 'ssh' USER = None HOST = 'localhost'
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/pkgconfig.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/pkgconfig.py
Changed
@@ -5,7 +5,7 @@ from samba_utils import SUBST_VARS_RECURSIVE, TO_LIST def subst_at_vars(task): - '''substiture @VAR@ style variables in a file''' + '''substitute @VAR@ style variables in a file''' s = task.inputs0.read() # split on the vars
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_abi.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_abi.py
Changed
@@ -42,7 +42,8 @@ def normalise_varargs(sig): '''cope with older versions of gdb''' sig = re.sub(r',\s\.\.\.', '', sig) - return sig + # Make sure we compare bytes and not strings + return bytes(sig, encoding='utf-8').decode('unicode_escape') def parse_sigs(sigs, abi_match): @@ -224,7 +225,7 @@ if k in sorted(invmap.keys()): f.write("\tglobal:\n") for s in invmap.get(k, ): - f.write("\t\t%s;\n" % s); + f.write("\t\t%s;\n" % s) f.write("}%s;\n\n" % last_key) last_key = " %s" % symver f.write("%s {\n" % current_version)
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_autoconf.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_autoconf.py
Changed
@@ -364,7 +364,7 @@ return False @conf -def CHECK_VALUEOF(conf, v, headers=None, define=None): +def CHECK_VALUEOF(conf, v, headers=None, define=None, lib=None): '''check the value of a variable/define''' ret = True v_define = define @@ -376,6 +376,7 @@ execute=True, define_ret=True, quote=False, + lib=lib, headers=headers, local_include=False, msg="Checking value of %s" % v): @@ -816,6 +817,9 @@ if CHECK_CFLAGS(conf, "-Wno-error=array-bounds"): conf.define('HAVE_WNO_ERROR_ARRAY_BOUNDS', 1) + if CHECK_CFLAGS(conf, "-Wno-error=stringop-overflow"): + conf.define('HAVE_WNO_ERROR_STRINGOP_OVERFLOW', 1) + if not Options.options.disable_warnings_as_errors: conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Werror -Wno-error=deprecated-declarations', testflags=True) conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=tautological-compare', testflags=True) @@ -830,8 +834,10 @@ if (Options.options.address_sanitizer or Options.options.undefined_sanitizer): conf.ADD_CFLAGS('-g -O1', testflags=True) - if Options.options.address_sanitizer: + if (Options.options.address_sanitizer + or Options.options.memory_sanitizer): conf.ADD_CFLAGS('-fno-omit-frame-pointer', testflags=True) + if Options.options.address_sanitizer: conf.ADD_CFLAGS('-fsanitize=address', testflags=True) conf.ADD_LDFLAGS('-fsanitize=address', testflags=True) conf.env'ADDRESS_SANITIZER' = True @@ -842,6 +848,13 @@ conf.ADD_LDFLAGS('-fsanitize=undefined', testflags=True) conf.env'UNDEFINED_SANITIZER' = True + # MemorySanitizer is only available if you build with clang + if Options.options.memory_sanitizer: + conf.ADD_CFLAGS('-g -O2', testflags=True) + conf.ADD_CFLAGS('-fsanitize=memory', testflags=True) + conf.ADD_CFLAGS('-fsanitize-memory-track-origins=2', testflags=True) + conf.ADD_LDFLAGS('-fsanitize=memory') + conf.env'MEMORY_SANITIZER' = True # Let people pass an additional ADDITIONAL_{CFLAGS,LDFLAGS} # environment variables which are only used the for final build. @@ -883,10 +896,12 @@ conf.envname = conf.env'PREFIX' + default @conf -def ADD_NAMED_CFLAGS(conf, name, flags, testflags=False, prereq_flags=): +def ADD_NAMED_CFLAGS(conf, name, flags, testflags=False, prereq_flags=None): '''add some CFLAGS to the command line optionally set testflags to ensure all the flags work ''' + if prereq_flags is None: + prereq_flags = prereq_flags = TO_LIST(prereq_flags) if testflags: ok_flags= @@ -899,10 +914,12 @@ conf.envname.extend(TO_LIST(flags)) @conf -def ADD_CFLAGS(conf, flags, testflags=False, prereq_flags=): +def ADD_CFLAGS(conf, flags, testflags=False, prereq_flags=None): '''add some CFLAGS to the command line optionally set testflags to ensure all the flags work ''' + if prereq_flags is None: + prereq_flags = ADD_NAMED_CFLAGS(conf, 'EXTRA_CFLAGS', flags, testflags=testflags, prereq_flags=prereq_flags) @@ -946,10 +963,10 @@ if not 'EXTRA_CFLAGS' in bld.env: list = else: - list = bld.env'EXTRA_CFLAGS'; + list = bld.env'EXTRA_CFLAGS' ret.extend(list) if not allow_warnings and 'PICKY_CFLAGS' in bld.env: - list = bld.env'PICKY_CFLAGS'; + list = bld.env'PICKY_CFLAGS' ret.extend(list) if hide_symbols and bld.env.HAVE_VISIBILITY_ATTR: ret.append(bld.env.VISIBILITY_CFLAGS) @@ -969,7 +986,7 @@ '''enable/disable cache of configure results''' if enable: # when -C is chosen, we will use a private cache and will - # not look into system includes. This roughtly matches what + # not look into system includes. This roughly matches what # autoconf does with -C cache_path = os.path.join(conf.bldnode.abspath(), '.confcache') mkdir_p(cache_path) @@ -986,7 +1003,9 @@ @conf def SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS(conf): - if Options.options.address_sanitizer or Options.options.enable_libfuzzer: + if (Options.options.address_sanitizer + or Options.options.memory_sanitizer + or Options.options.enable_libfuzzer): # Sanitizers can rely on symbols undefined at library link time and the # symbols used for fuzzers are only defined by compiler wrappers. return
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_bundled.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_bundled.py
Changed
@@ -57,7 +57,7 @@ def minimum_library_version(conf, libname, default): - '''allow override of mininum system library version''' + '''allow override of minimum system library version''' minlist = Options.options.MINIMUM_LIBRARY_VERSION if not minlist: @@ -104,12 +104,14 @@ @conf def CHECK_BUNDLED_SYSTEM_PKG(conf, libname, minversion='0.0.0', - maxversion=None, version_blacklist=, + maxversion=None, version_blacklist=None, onlyif=None, implied_deps=None, pkg=None): '''check if a library is available as a system library. This only tries using pkg-config ''' + if version_blacklist is None: + version_blacklist = return conf.CHECK_BUNDLED_SYSTEM(libname, minversion=minversion, maxversion=maxversion, @@ -120,7 +122,7 @@ @conf def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0', - maxversion=None, version_blacklist=, + maxversion=None, version_blacklist=None, checkfunctions=None, headers=None, checkcode=None, onlyif=None, implied_deps=None, require_headers=True, pkg=None, set_target=True): @@ -129,6 +131,8 @@ tries by testing for a specified function in the specified lib ''' # We always do a logic validation of 'onlyif' first + if version_blacklist is None: + version_blacklist = missing = if onlyif: for l in samba_utils.TO_LIST(onlyif):
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_conftests.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_conftests.py
Changed
@@ -36,7 +36,7 @@ if d: additional_dirs.append(d) - # we add the additional dirs twice: once for the test data, and again if the compilation test suceeds below + # we add the additional dirs twice: once for the test data, and again if the compilation test succeeds below def add_options_dir(dirs, env): for x in dirs: if not x in env.CPPPATH: @@ -84,7 +84,7 @@ @conf def CHECK_LARGEFILE(conf, define='HAVE_LARGEFILE'): '''see what we need for largefile support''' - getconf_cflags = conf.CHECK_COMMAND('getconf', 'LFS_CFLAGS'); + getconf_cflags = conf.CHECK_COMMAND('getconf', 'LFS_CFLAGS') if getconf_cflags is not False: if (conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1', define='WORKING_GETCONF_LFS_CFLAGS',
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_deps.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_deps.py
Changed
@@ -360,7 +360,7 @@ def add_samba_attributes(bld, tgt_list): - '''ensure a target has a the required samba attributes''' + '''ensure a target has the required samba attributes''' targets = LOCAL_CACHE(bld, 'TARGET_TYPE')
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_git.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_git.py
Changed
@@ -43,6 +43,7 @@ cwd=path) (stdout, stderr) = p.communicate(None) for l in stdout.splitlines(): + l = l.decode('utf-8') l = l.rstrip() status = l0 l = l1:
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_headers.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_headers.py
Changed
@@ -132,7 +132,7 @@ bld.SET_BUILD_GROUP('final') if not bld.env.build_public_headers: - # in this case no header munging neeeded. Used for tdb, talloc etc + # in this case no header munging needed. Used for tdb, talloc etc public_headers_simple(bld, public_headers, header_path=header_path, public_headers_install=public_headers_install) return
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_install.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_install.py
Changed
@@ -188,7 +188,7 @@ blddir = os.path.dirname(self.bld.srcnode.abspath(self.bld.env)) libpath = self.link_task.outputs0.abspath(self.env) - # calculat the link target and put it in the environment + # calculate the link target and put it in the environment soext="" vnum = getattr(self, 'vnum', None) if vnum is not None:
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_perl.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_perl.py
Changed
@@ -34,18 +34,18 @@ perl_arch_install_dir = None if vendor_prefix == conf.env.PREFIX: - perl_arch_install_dir = check_perl_config_var('vendorarch'); + perl_arch_install_dir = check_perl_config_var('vendorarch') if perl_arch_install_dir is None: - perl_arch_install_dir = "${LIBDIR}/perl5"; + perl_arch_install_dir = "${LIBDIR}/perl5" conf.start_msg("PERL_ARCH_INSTALL_DIR: ") conf.end_msg("'%s'" % (perl_arch_install_dir), 'GREEN') conf.env.PERL_ARCH_INSTALL_DIR = perl_arch_install_dir perl_lib_install_dir = None if vendor_prefix == conf.env.PREFIX: - perl_lib_install_dir = check_perl_config_var('vendorlib'); + perl_lib_install_dir = check_perl_config_var('vendorlib') if perl_lib_install_dir is None: - perl_lib_install_dir = "${DATADIR}/perl5"; + perl_lib_install_dir = "${DATADIR}/perl5" conf.start_msg("PERL_LIB_INSTALL_DIR: ") conf.end_msg("'%s'" % (perl_lib_install_dir), 'GREEN') conf.env.PERL_LIB_INSTALL_DIR = perl_lib_install_dir
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_pidl.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_pidl.py
Changed
@@ -12,7 +12,7 @@ '''Build a IDL file using pidl. This will produce up to 13 output files depending on the options used''' - bname = source0:-4; # strip off the .idl suffix + bname = source0:-4 # strip off the .idl suffix bname = os.path.basename(bname) name = "%s_%s" % (pname, bname.upper())
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_third_party.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_third_party.py
Changed
@@ -24,12 +24,12 @@ @conf def CHECK_SOCKET_WRAPPER(conf): - return conf.CHECK_BUNDLED_SYSTEM_PKG('socket_wrapper', minversion='1.3.4') + return conf.CHECK_BUNDLED_SYSTEM_PKG('socket_wrapper', minversion='1.4.2') Build.BuildContext.CHECK_SOCKET_WRAPPER = CHECK_SOCKET_WRAPPER @conf def CHECK_NSS_WRAPPER(conf): - return conf.CHECK_BUNDLED_SYSTEM_PKG('nss_wrapper', minversion='1.1.13') + return conf.CHECK_BUNDLED_SYSTEM_PKG('nss_wrapper', minversion='1.1.15') Build.BuildContext.CHECK_NSS_WRAPPER = CHECK_NSS_WRAPPER @conf @@ -39,7 +39,7 @@ @conf def CHECK_UID_WRAPPER(conf): - return conf.CHECK_BUNDLED_SYSTEM_PKG('uid_wrapper', minversion='1.2.7') + return conf.CHECK_BUNDLED_SYSTEM_PKG('uid_wrapper', minversion='1.3.0') Build.BuildContext.CHECK_UID_WRAPPER = CHECK_UID_WRAPPER @conf
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_utils.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_utils.py
Changed
@@ -327,7 +327,7 @@ env = ConfigSet.ConfigSet() ret = varstr - # substitute on user supplied dict if avaiilable + # substitute on user supplied dict if available if vars is not None: for v in vars.keys(): envv = varsv
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_version.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_version.py
Changed
@@ -235,22 +235,22 @@ def samba_version_file(version_file, path, env=None, is_install=True): '''Parse the version information from a VERSION file''' - f = open(version_file, 'r') - version_dict = {} - for line in f: - line = line.strip() - if line == '': - continue - if line.startswith("#"): - continue - try: - split_line = line.split("=") - if split_line1 != "": - value = split_line1.strip('"') - version_dictsplit_line0 = value - except: - print("Failed to parse line %s from %s" % (line, version_file)) - raise + with open(version_file, 'r') as f: + version_dict = {} + for line in f: + line = line.strip() + if line == '': + continue + if line.startswith("#"): + continue + try: + split_line = line.split("=") + if split_line1 != "": + value = split_line1.strip('"') + version_dictsplit_line0 = value + except: + print("Failed to parse line %s from %s" % (line, version_file)) + raise return SambaVersion(version_dict, path, env=env, is_install=is_install)
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/samba_waf18.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/samba_waf18.py
Changed
@@ -148,7 +148,7 @@ def check(self, *k, **kw): '''Override the waf defaults to inject --with-directory options''' - # match the configuration test with speficic options, for example: + # match the configuration test with specific options, for example: # --with-libiconv -> Options.options.iconv_open -> "Checking for library iconv" self.validate_c(kw) @@ -161,7 +161,7 @@ if d: additional_dirs.append(d) - # we add the additional dirs twice: once for the test data, and again if the compilation test suceeds below + # we add the additional dirs twice: once for the test data, and again if the compilation test succeeds below def add_options_dir(dirs, env): for x in dirs: if not x in env.CPPPATH:
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/stale_files.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/stale_files.py
Changed
@@ -107,6 +107,7 @@ def AUTOCLEANUP_STALE_FILES(bld): """automatically clean up any files in bin that shouldn't be there""" + global old_refill_task_list old_refill_task_list = Parallel.refill_task_list Parallel.refill_task_list = replace_refill_task_list Parallel.bld = bld
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/symbols.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/symbols.py
Changed
@@ -436,7 +436,7 @@ def check_dependencies(bld, t): - '''check for depenencies that should be changed''' + '''check for dependencies that should be changed''' if bld.get_tgen_by_name(t.sname + ".objlist"): return
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/wafsamba.py -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/wafsamba.py
Changed
@@ -82,7 +82,7 @@ return bld.ASSERT(subsystem is not None, "You must specify a subsystem for init_function '%s'" % init_function) cache = LOCAL_CACHE(bld, 'INIT_FUNCTIONS') - if not subsystem in cache: + if subsystem not in cache: cachesubsystem = cachesubsystem.append( { 'TARGET':target, 'INIT_FUNCTION':init_function } ) Build.BuildContext.ADD_INIT_FUNCTION = ADD_INIT_FUNCTION @@ -303,7 +303,7 @@ else: bundled_name = libname.replace('_', '-') else: - assert (private_library == True and realname is None) + assert (private_library is True and realname is None) bundled_name = PRIVATE_NAME(bld, libname.replace('_', '-')) vnum = None @@ -899,10 +899,12 @@ private_headers=None, header_path=None, vars=None, - dep_vars=, + dep_vars=None, always=False): '''A generic source generator target''' + if dep_vars is None: + dep_vars = if not SET_TARGET_TYPE(bld, name, 'GENERATOR'): return @@ -1056,7 +1058,7 @@ lineno = 0 for line in source_file: newline = line - if lineno == 0 and task.env"PERL_SPECIFIED" == True and line:2 == "#!": + if lineno == 0 and task.env"PERL_SPECIFIED" is True and line:2 == "#!": newline = replacement_shebang elif pattern in line: newline = line.replace(pattern, replacement)
View file
_service:tar_scm:tevent-0.14.1.tar.gz/buildtools/wafsamba/wscript -> _service:tar_scm:tevent-0.16.0.tar.gz/buildtools/wafsamba/wscript
Changed
@@ -37,7 +37,7 @@ help=(f'''comma separated list of bundled libraries. {Context.g_module.APPNAME} includes copies of externally maintained -system libraries (such as popt, cmokca) as well as Samba-maintained +system libraries (such as popt, cmocka) as well as Samba-maintained libraries that can be found on the system already (such as talloc, tdb). @@ -99,7 +99,7 @@ before we will select not to 'bundle'. This option, possibly useful for packagers, allows that specified -version to be overridden (say, if it is absolutely known that a the +version to be overridden (say, if it is absolutely known that the newer version included in this tarball has no relevant changes). Use this with extreme care @@ -118,7 +118,7 @@ action="store_true", dest='disable_rpath_private_install', default=False) gr.add_option('--nonshared-binary', help=( -f'''Disable use of shared libaries internal to {Context.g_module.APPNAME} for the listed binaries. +f'''Disable use of shared libraries internal to {Context.g_module.APPNAME} for the listed binaries. The resulting binaries are 'statically linked' with regard to components provided by {Context.g_module.APPNAME}, but remain dynamically linked to (eg) libc.so and libgnutls.so @@ -189,6 +189,11 @@ action="store_true", dest='undefined_sanitizer', default=False) + gr.add_option('--memory-sanitizer', + help=("Enable memory behaviour sanitizer compile and linker flags"), + action="store_true", + dest='memory_sanitizer', + default=False) gr.add_option('--enable-libfuzzer', help=("Build fuzzing binaries (use ADDITIONAL_CFLAGS to specify compiler options for libFuzzer or use CC=honggfuzz/hfuzz-cc)"), action="store_true", dest='enable_libfuzzer', default=False) @@ -373,7 +378,7 @@ conf.CHECK_CODE('printf("hello world")', define='HAVE_SIMPLE_C_PROG', mandatory=True, - execute=True, + execute=not conf.env.CROSS_COMPILE, headers='stdio.h', msg='Checking simple C program') @@ -523,7 +528,8 @@ strict=True, msg='Checking for __attribute__') - # Solaris by defauls uses draft versions of some functions unless you set _POSIX_PTHREAD_SEMANTICS + # Solaris by default uses draft versions of some functions unless you set + # _POSIX_PTHREAD_SEMANTICS if sys.platform.startswith('sunos'): conf.DEFINE('_POSIX_PTHREAD_SEMANTICS', 1) @@ -533,7 +539,7 @@ # conf.DEFINE('_XOPEN_SOURCE', 600, add_to_cflags=True) # we should use the PIC options in waf instead - # Some compilo didn't support -fPIC but just print a warning + # Some compiler didn't support -fPIC but just print a warning if conf.env'COMPILER_CC' == "suncc": conf.ADD_CFLAGS('-KPIC', testflags=True) # we really want define here as we need to have this @@ -546,7 +552,7 @@ # On Solaris 8 with suncc (at least) the flags for the linker to define the name of the # library are not always working (if the command line is very very long and with a lot - # files) + # of files) if conf.env'COMPILER_CC' == "suncc": save = conf.env'SONAME_ST' @@ -609,7 +615,7 @@ # see if we need special largefile flags if not conf.CHECK_LARGEFILE(): - raise Errors.WafError('Samba requires large file support support, but not available on this platform: sizeof(off_t) < 8') + raise Errors.WafError('Samba requires large file support, but not available on this platform: sizeof(off_t) < 8') if conf.env.HAVE_STDDEF_H and conf.env.HAVE_STDLIB_H: conf.DEFINE('STDC_HEADERS', 1) @@ -626,7 +632,7 @@ else: conf.define('SHLIBEXT', "so", quote=True) - # First try a header check for cross-compile friendlyness + # First try a header check for cross-compile friendliness conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER #define B __BYTE_ORDER #elif defined(BYTE_ORDER) @@ -705,11 +711,6 @@ define="HAVE_VA_COPY", msg="Checking for va_copy") - conf.CHECK_CODE(''' - #define eprintf(...) fprintf(stderr, __VA_ARGS__) - eprintf("bla", "bar") - ''', define='HAVE__VA_ARGS__MACRO') - conf.env.enable_fuzzing = False conf.env.enable_libfuzzer = Options.options.enable_libfuzzer @@ -719,11 +720,6 @@ conf.DEFINE('FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION', 1) conf.env.FUZZ_TARGET_LDFLAGS = Options.options.FUZZ_TARGET_LDFLAGS - # Create a symlink of the compile db for clangd - symlink(os.path.join(conf.bldnode.abspath(), 'default/compile_commands.json'), - os.path.join(conf.srcnode.abspath(), 'compile_commands.json'), - force=True) - conf.SAMBA_BUILD_ENV()
View file
_service:tar_scm:tevent-0.14.1.tar.gz/doc/tevent_events.dox -> _service:tar_scm:tevent-0.16.0.tar.gz/doc/tevent_events.dox
Changed
@@ -27,7 +27,7 @@ This example shows how to set up an event which will be repeated for a minute with interval of 2 seconds (will be triggered 30 times). After exceeding this limit, the event loop will finish and all the memory resources will be freed. -This is just example describing repeated activity, nothing usefull is done +This is just example describing repeated activity, nothing useful is done within foo function @code @@ -233,7 +233,7 @@ void *private_data) { - // Do something usefull + // Do something useful printf("handling signal...\n"); exit(EXIT_SUCCESS);
View file
_service:tar_scm:tevent-0.14.1.tar.gz/doc/tevent_queue.dox -> _service:tar_scm:tevent-0.16.0.tar.gz/doc/tevent_queue.dox
Changed
@@ -231,9 +231,9 @@ tevent_queue_stop(fronta); tevent_queue_start(fronta); if (tevent_queue_running(fronta)) { - printf ("Queue is runnning (length: %d)\n", tevent_queue_length(fronta)); + printf ("Queue is running (length: %d)\n", tevent_queue_length(fronta)); } else { - printf ("Queue is not runnning\n"); + printf ("Queue is not running\n"); } data = talloc(ev, struct juststruct);
View file
_service:tar_scm:tevent-0.14.1.tar.gz/doc/tevent_request.dox -> _service:tar_scm:tevent-0.16.0.tar.gz/doc/tevent_request.dox
Changed
@@ -184,6 +184,6 @@ A comprehensive example of nested subrequests can be found in the file echo_server.c. It implements a complete, self-contained echo server with no -dependencies but libevent and libtalloc. +dependencies but libtevent and libtalloc. */
View file
_service:tar_scm:tevent-0.14.1.tar.gz/doxy.config -> _service:tar_scm:tevent-0.16.0.tar.gz/doxy.config
Changed
@@ -930,7 +930,7 @@ # user-defined cascading style sheet that is included after the standard # style sheets created by doxygen. Using this option one can overrule # certain style aspects. This is preferred over using HTML_STYLESHEET -# since it does not replace the standard style sheet and is therefor more +# since it does not replace the standard style sheet and is therefore more # robust against future updates. Doxygen will copy the style sheet file to # the output directory.
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/replace/inet_ntop.c -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/replace/inet_ntop.c
Changed
@@ -65,20 +65,22 @@ * format an IPv4 address * return: * `dst' (as a const) - * notes: - * (1) uses no statics - * (2) takes a unsigned char* not an in_addr as input * author: * Paul Vixie, 1996. */ static const char * inet_ntop4(const unsigned char *src, char *dst, socklen_t size) { - static const char *fmt = "%u.%u.%u.%u"; - char tmpsizeof "255.255.255.255"; + char tmpsizeof("255.255.255.255"); size_t len; - len = snprintf(tmp, sizeof tmp, fmt, src0, src1, src2, src3); + len = snprintf(tmp, + sizeof(tmp), + "%hhu.%hhu.%hhu.%hhu", + src0, + src1, + src2, + src3); if (len >= size) { errno = ENOSPC; return (NULL);
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/replace/replace.h -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/replace/replace.h
Changed
@@ -41,7 +41,7 @@ * As it's also needed when Python.h is the first header we * require a global -D__STDC_WANT_LIB_EXT1__=1 */ -#ifndef __STDC_WANT_LIB_EXT1__ +#if __STDC_WANT_LIB_EXT1__ != 1 #error -D__STDC_WANT_LIB_EXT1__=1 required #endif @@ -205,7 +205,7 @@ #endif #ifndef HAVE_STRERROR -extern char *sys_errlist; +extern const char *const sys_errlist; #define strerror(i) sys_errlisti #endif @@ -886,6 +886,21 @@ if((i)<((n)-1)){memmove(&((a)(i)),&((a)(i)+1),(sizeof(*(a))*((n)-(i)-1)));} /** + * Insert an array element by moving the rest one up + * + */ +#define ARRAY_INSERT_ELEMENT(__array,__old_last_idx,__new_elem,__new_idx) do { \ + if ((__new_idx) < (__old_last_idx)) { \ + const void *__src = &((__array)(__new_idx)); \ + void *__dst = &((__array)(__new_idx)+1); \ + size_t __num = (__old_last_idx)-(__new_idx); \ + size_t __len = sizeof(*(__array)) * __num; \ + memmove(__dst, __src, __len); \ + } \ + (__array)(__new_idx) = (__new_elem); \ +} while(0) + +/** * Pointer difference macro */ #define PTR_DIFF(p1,p2) ((ptrdiff_t)(((const char *)(p1)) - (const char *)(p2)))
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/replace/snprintf.c -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/replace/snprintf.c
Changed
@@ -20,7 +20,7 @@ * for string length. This covers a nasty loophole. * * The other functions are there to prevent NULL pointers from - * causing nast effects. + * causing nasty effects. * * More Recently: * Brandon Long <blong@fiction.net> 9/15/96 for mutt 0.43 @@ -77,7 +77,7 @@ * Fix incorrect zpadlen handling in fmtfp. * Thanks to Ollie Oldham <ollie.oldham@metro-optix.com> for spotting it. * few mods to make it easier to compile the tests. - * addedd the "Ollie" test to the floating point ones. + * added the "Ollie" test to the floating point ones. * * Martin Pool (mbp@samba.org) April 2003 * Remove NO_CONFIG_H so that the test case can be built within a source @@ -550,7 +550,7 @@ } for (i = 1; i < clistpnum.num; i++) { if (clistpnum.chunks0->type != clistpnum.chunksi->type) { - /* nooo noo no! + /* nooo no no! * all the references to a parameter * must be of the same type */
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/replace/strptime.c -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/replace/strptime.c
Changed
@@ -287,7 +287,7 @@ } /* Any character but `%' must be matched by the same character - in the iput string. */ + in the input string. */ if (*fmt != '%') { match_char (*fmt++, *rp++);
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/replace/system/wscript_configure -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/replace/system/wscript_configure
Changed
@@ -1,6 +1,6 @@ #!/usr/bin/env python -# solaris varients of getXXent_r +# solaris variants of getXXent_r conf.CHECK_C_PROTOTYPE('getpwent_r', 'struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)', define='SOLARIS_GETPWENT_R', headers='pwd.h') @@ -8,7 +8,7 @@ 'struct group *getgrent_r(struct group *src, char *buf, int buflen)', define='SOLARIS_GETGRENT_R', headers='grp.h') -# the irix varients +# the irix variants conf.CHECK_C_PROTOTYPE('getpwent_r', 'struct passwd *getpwent_r(struct passwd *src, char *buf, size_t buflen)', define='SOLARIS_GETPWENT_R', headers='pwd.h')
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/replace/tests/testsuite.c -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/replace/tests/testsuite.c
Changed
@@ -854,14 +854,14 @@ return false; } - if (write(sock1, "automatisch", 12) == -1) { + if (write(sock1, "automatisch", 12) != 12) { printf("failure: socketpair \n" "write() failed: %s\n" "\n", strerror(errno)); return false; } - if (read(sock0, buf, 12) == -1) { + if (read(sock0, buf, 12) != 12) { printf("failure: socketpair \n" "read() failed: %s\n" "\n", strerror(errno));
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/replace/wscript -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/replace/wscript
Changed
@@ -114,7 +114,7 @@ conf.CHECK_HEADERS('xfs/libxfs.h netgroup.h') conf.CHECK_HEADERS('valgrind.h valgrind/valgrind.h') - conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h') + conf.CHECK_HEADERS('valgrind/memcheck.h valgrind/helgrind.h valgrind/callgrind.h') conf.CHECK_HEADERS('nss_common.h nsswitch.h ns_api.h') conf.CHECK_HEADERS('sys/extattr.h sys/ea.h sys/proplist.h sys/cdefs.h') conf.CHECK_HEADERS('utmp.h utmpx.h lastlog.h') @@ -131,6 +131,9 @@ if conf.CHECK_CFLAGS('-Wno-strict-overflow'): conf.define('HAVE_WNO_STRICT_OVERFLOW', '1') + if conf.CHECK_CFLAGS('-Wno-unused-but-set-variable'): + conf.define('HAVE_WNO_UNUSED_BUT_SET_VARIABLE', '1') + if conf.CHECK_CFLAGS('-Wuse-after-free=1'): conf.define('HAVE_WUSE_AFTER_FREE_1', '1') @@ -181,6 +184,10 @@ conf.CHECK_TYPE('blkcnt_t', 'long', headers='sys/types.h sys/stat.h unistd.h') conf.CHECK_SIZEOF('bool char int "long long" long short size_t ssize_t') + sizeof_int = conf.env"SIZEOF_INT" + if sizeof_int < 4: + conf.fatal(f"Samba won't work with int of size {sizeof_int} (requires >= 4)") + conf.CHECK_SIZEOF('int8_t uint8_t int16_t uint16_t int32_t uint32_t int64_t uint64_t') conf.CHECK_SIZEOF('void*', define='SIZEOF_VOID_P') conf.CHECK_SIZEOF('off_t dev_t ino_t time_t') @@ -441,6 +448,17 @@ if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', checklibc=True): strlcpy_in_bsd = True + elif conf.env.enable_fuzzing: + # Just to complicate it more, some versions of Honggfuzz have + # got strlcpy and strlcat in libc, but not in <string.h> + # (unless it is there coincidentally, on a BSD). Therefore we + # can't use CHECK_FUNCS alone to decide whether to add the + # headers to replace.h. + # + # As this is only known to happen on a fuzzing compiler, we'll + # skip the check when not in fuzzing mode. + conf.CHECK_HEADERS('bsd/string.h') + if not conf.CHECK_FUNCS('getpeereid'): conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): @@ -480,7 +498,7 @@ conf.CHECK_FUNCS('gai_strerror get_current_dir_name') conf.CHECK_FUNCS('timegm getifaddrs freeifaddrs mmap setgroups syscall setsid') conf.CHECK_FUNCS('getgrent_r getgrgid_r getgrnam_r getgrouplist getpagesize') - conf.CHECK_FUNCS('getpwent_r getpwnam_r getpwuid_r epoll_create') + conf.CHECK_FUNCS('getpwent_r getpwnam_r getpwuid_r epoll_create1') conf.CHECK_FUNCS('getprogname') if not conf.CHECK_FUNCS('copy_file_range'): conf.CHECK_CODE(''' @@ -703,7 +721,7 @@ conf.CHECK_DECLS('getgrent_r getpwent_r', reverse=True, headers='pwd.h grp.h') conf.CHECK_DECLS('pread pwrite setenv setresgid setresuid', reverse=True) - if conf.CONFIG_SET('HAVE_EPOLL_CREATE') and conf.CONFIG_SET('HAVE_SYS_EPOLL_H'): + if conf.CONFIG_SET('HAVE_EPOLL_CREATE1') and conf.CONFIG_SET('HAVE_SYS_EPOLL_H'): conf.DEFINE('HAVE_EPOLL', 1) if conf.CHECK_FUNCS('eventfd', headers='sys/eventfd.h'):
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/replace/xattr.c -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/replace/xattr.c
Changed
@@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. replacement routines for xattr implementations Copyright (C) Jeremy Allison 1998-2005 @@ -10,7 +10,7 @@ ** NOTE! The following LGPL license applies to the replace ** library. This does NOT imply that all of Samba is released ** under the LGPL - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -42,7 +42,7 @@ #endif /************************************************************************** - Wrappers for extented attribute calls. Based on the Linux package with + Wrappers for extended attribute calls. Based on the Linux package with support for IRIX and (Net|Free)BSD also. Expand as other systems have them. ****************************************************************************/ @@ -196,7 +196,7 @@ int space; const char *name; size_t len; -} +} extattr = { { EXTATTR_NAMESPACE_SYSTEM, EXTATTR_PREFIX("system.") }, { EXTATTR_NAMESPACE_USER, EXTATTR_PREFIX("user.") }, @@ -233,7 +233,7 @@ errno = ENOSYS; return -1; } - /* Some error happend. Errno should be set by the previous call */ + /* Some error happened. Errno should be set by the previous call */ if(list_size < 0) return -1; /* No attributes */ @@ -245,7 +245,7 @@ problem with the emulation. */ if(list == NULL) { - /* Take the worse case of one char attribute names - + /* Take the worse case of one char attribute names - two bytes per name plus one more for sanity. */ total_size += list_size + (list_size/2 + 1)*extattrt.len;
View file
_service:tar_scm:tevent-0.16.0.tar.gz/lib/talloc/ABI/pytalloc-util-2.4.1.sigs
Added
@@ -0,0 +1,16 @@ +_pytalloc_check_type: int (PyObject *, const char *) +_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *) +_pytalloc_get_name: const char *(PyObject *) +_pytalloc_get_ptr: void *(PyObject *) +_pytalloc_get_type: void *(PyObject *, const char *) +pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *) +pytalloc_BaseObject_check: int (PyObject *) +pytalloc_BaseObject_size: size_t (void) +pytalloc_Check: int (PyObject *) +pytalloc_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *) +pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *) +pytalloc_GetBaseObjectType: PyTypeObject *(void) +pytalloc_GetObjectType: PyTypeObject *(void) +pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) +pytalloc_steal: PyObject *(PyTypeObject *, void *) +pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
View file
_service:tar_scm:tevent-0.16.0.tar.gz/lib/talloc/ABI/talloc-2.4.1.sigs
Added
@@ -0,0 +1,66 @@ +_talloc: void *(const void *, size_t) +_talloc_array: void *(const void *, size_t, unsigned int, const char *) +_talloc_free: int (void *, const char *) +_talloc_get_type_abort: void *(const void *, const char *, const char *) +_talloc_memdup: void *(const void *, const void *, size_t, const char *) +_talloc_move: void *(const void *, const void *) +_talloc_pooled_object: void *(const void *, size_t, const char *, unsigned int, size_t) +_talloc_realloc: void *(const void *, void *, size_t, const char *) +_talloc_realloc_array: void *(const void *, void *, size_t, unsigned int, const char *) +_talloc_reference_loc: void *(const void *, const void *, const char *) +_talloc_set_destructor: void (const void *, int (*)(void *)) +_talloc_steal_loc: void *(const void *, const void *, const char *) +_talloc_zero: void *(const void *, size_t, const char *) +_talloc_zero_array: void *(const void *, size_t, unsigned int, const char *) +talloc_asprintf: char *(const void *, const char *, ...) +talloc_asprintf_addbuf: void (char **, const char *, ...) +talloc_asprintf_append: char *(char *, const char *, ...) +talloc_asprintf_append_buffer: char *(char *, const char *, ...) +talloc_autofree_context: void *(void) +talloc_check_name: void *(const void *, const char *) +talloc_disable_null_tracking: void (void) +talloc_enable_leak_report: void (void) +talloc_enable_leak_report_full: void (void) +talloc_enable_null_tracking: void (void) +talloc_enable_null_tracking_no_autofree: void (void) +talloc_find_parent_byname: void *(const void *, const char *) +talloc_free_children: void (void *) +talloc_get_name: const char *(const void *) +talloc_get_size: size_t (const void *) +talloc_increase_ref_count: int (const void *) +talloc_init: void *(const char *, ...) +talloc_is_parent: int (const void *, const void *) +talloc_named: void *(const void *, size_t, const char *, ...) +talloc_named_const: void *(const void *, size_t, const char *) +talloc_parent: void *(const void *) +talloc_parent_name: const char *(const void *) +talloc_pool: void *(const void *, size_t) +talloc_realloc_fn: void *(const void *, void *, size_t) +talloc_reference_count: size_t (const void *) +talloc_reparent: void *(const void *, const void *, const void *) +talloc_report: void (const void *, FILE *) +talloc_report_depth_cb: void (const void *, int, int, void (*)(const void *, int, int, int, void *), void *) +talloc_report_depth_file: void (const void *, int, int, FILE *) +talloc_report_full: void (const void *, FILE *) +talloc_set_abort_fn: void (void (*)(const char *)) +talloc_set_log_fn: void (void (*)(const char *)) +talloc_set_log_stderr: void (void) +talloc_set_memlimit: int (const void *, size_t) +talloc_set_name: const char *(const void *, const char *, ...) +talloc_set_name_const: void (const void *, const char *) +talloc_show_parents: void (const void *, FILE *) +talloc_strdup: char *(const void *, const char *) +talloc_strdup_append: char *(char *, const char *) +talloc_strdup_append_buffer: char *(char *, const char *) +talloc_strndup: char *(const void *, const char *, size_t) +talloc_strndup_append: char *(char *, const char *, size_t) +talloc_strndup_append_buffer: char *(char *, const char *, size_t) +talloc_test_get_magic: int (void) +talloc_total_blocks: size_t (const void *) +talloc_total_size: size_t (const void *) +talloc_unlink: int (const void *, void *) +talloc_vasprintf: char *(const void *, const char *, va_list) +talloc_vasprintf_append: char *(char *, const char *, va_list) +talloc_vasprintf_append_buffer: char *(char *, const char *, va_list) +talloc_version_major: int (void) +talloc_version_minor: int (void)
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/talloc/Makefile -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/talloc/Makefile
Changed
@@ -60,9 +60,6 @@ ctags: $(WAF) ctags -pydoctor: - $(WAF) pydoctor - bin/%:: FORCE $(WAF) --targets=`basename $@` FORCE:
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/talloc/pytalloc.c -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/talloc/pytalloc.c
Changed
@@ -101,9 +101,9 @@ } /** - * Default (but only slightly more useful than the default) implementation of cmp. + * Default objects do not support ordered comparisons, but talloc + * objects do, sorting by pointers clustered by type. */ -#if PY_MAJOR_VERSION >= 3 static PyObject *pytalloc_default_richcmp(PyObject *obj1, PyObject *obj2, int op) { void *ptr1; @@ -131,17 +131,6 @@ Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } -#else -static int pytalloc_default_cmp(PyObject *_obj1, PyObject *_obj2) -{ - pytalloc_Object *obj1 = (pytalloc_Object *)_obj1, - *obj2 = (pytalloc_Object *)_obj2; - if (obj1->ob_type != obj2->ob_type) - return ((char *)obj1->ob_type - (char *)obj2->ob_type); - - return ((char *)pytalloc_get_ptr(obj1) - (char *)pytalloc_get_ptr(obj2)); -} -#endif static PyTypeObject TallocObject_Type = { .tp_name = "talloc.Object", @@ -150,11 +139,7 @@ .tp_dealloc = (destructor)pytalloc_dealloc, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_repr = pytalloc_default_repr, -#if PY_MAJOR_VERSION >= 3 .tp_richcompare = pytalloc_default_richcmp, -#else - .tp_compare = pytalloc_default_cmp, -#endif }; /** @@ -181,9 +166,9 @@ } /** - * Default (but only slightly more useful than the default) implementation of cmp. + * Default objects do not support ordered comparisons, but talloc + * objects do, sorting by pointers clustered by type. */ -#if PY_MAJOR_VERSION >= 3 static PyObject *pytalloc_base_default_richcmp(PyObject *obj1, PyObject *obj2, int op) { void *ptr1; @@ -211,17 +196,6 @@ Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } -#else -static int pytalloc_base_default_cmp(PyObject *_obj1, PyObject *_obj2) -{ - pytalloc_BaseObject *obj1 = (pytalloc_BaseObject *)_obj1, - *obj2 = (pytalloc_BaseObject *)_obj2; - if (obj1->ob_type != obj2->ob_type) - return ((char *)obj1->ob_type - (char *)obj2->ob_type); - - return ((char *)pytalloc_get_ptr(obj1) - (char *)pytalloc_get_ptr(obj2)); -} -#endif static PyTypeObject TallocBaseObject_Type = { .tp_name = "talloc.BaseObject", @@ -230,11 +204,7 @@ .tp_dealloc = (destructor)pytalloc_base_dealloc, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_repr = pytalloc_base_default_repr, -#if PY_MAJOR_VERSION >= 3 .tp_richcompare = pytalloc_base_default_richcmp, -#else - .tp_compare = pytalloc_base_default_cmp, -#endif }; static PyTypeObject TallocGenericObject_Type = { @@ -247,7 +217,6 @@ #define MODULE_DOC PyDoc_STR("Python wrapping of talloc-maintained objects.") -#if PY_MAJOR_VERSION >= 3 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, .m_name = "talloc", @@ -255,7 +224,6 @@ .m_size = -1, .m_methods = talloc_methods, }; -#endif static PyObject *module_init(void); static PyObject *module_init(void) @@ -271,11 +239,7 @@ if (PyType_Ready(&TallocGenericObject_Type) < 0) return NULL; -#if PY_MAJOR_VERSION >= 3 m = PyModule_Create(&moduledef); -#else - m = Py_InitModule3("talloc", talloc_methods, MODULE_DOC); -#endif if (m == NULL) return NULL; @@ -298,16 +262,8 @@ return NULL; } -#if PY_MAJOR_VERSION >= 3 PyMODINIT_FUNC PyInit_talloc(void); PyMODINIT_FUNC PyInit_talloc(void) { return module_init(); } -#else -void inittalloc(void); -void inittalloc(void) -{ - module_init(); -} -#endif
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/talloc/pytalloc_guide.txt -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/talloc/pytalloc_guide.txt
Changed
@@ -215,7 +215,7 @@ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- DEPRECATED! PyObject *pytalloc_CObject_FromTallocPtr(void *); -Create a new pytalloc_Object for an abitrary talloc-maintained C pointer. This will +Create a new pytalloc_Object for an arbitrary talloc-maintained C pointer. This will use a generic VoidPtr Python type, which just provides an opaque object in Python. The caller is responsible for incrementing the talloc reference count before calling this function - it will dereference the talloc pointer when it is garbage collected.
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/talloc/pytalloc_util.c -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/talloc/pytalloc_util.c
Changed
@@ -116,7 +116,7 @@ /** - * Internal function that either steals or referecences the talloc + * Internal function that either steals or references the talloc * pointer into a new talloc context. */ static PyObject *pytalloc_steal_or_reference(PyTypeObject *py_type,
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/talloc/talloc.c -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/talloc/talloc.c
Changed
@@ -146,7 +146,7 @@ } while (0) #if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS) -/* Mark the whole chunk as not accessable */ +/* Mark the whole chunk as not accessible */ #define TC_INVALIDATE_FULL_VALGRIND_CHUNK(_tc) do { \ size_t _flen = TC_HDR_SIZE + (_tc)->size; \ char *_fptr = (char *)(_tc); \ @@ -171,7 +171,7 @@ } while (0) #if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS) -/* Mark the unused bytes not accessable */ +/* Mark the unused bytes not accessible */ #define TC_INVALIDATE_SHRINK_VALGRIND_CHUNK(_tc, _new_size) do { \ size_t _flen = (_tc)->size - (_new_size); \ char *_fptr = (char *)TC_PTR_FROM_CHUNK(_tc); \ @@ -661,7 +661,7 @@ return tc_next_chunk(tc); } -/* Mark the whole remaining pool as not accessable */ +/* Mark the whole remaining pool as not accessible */ static inline void tc_invalidate_pool(struct talloc_pool_hdr *pool_hdr) { size_t flen = tc_pool_space_left(pool_hdr); @@ -2598,7 +2598,6 @@ struct talloc_chunk *tc = NULL; char buf1024; - /* this call looks strange, but it makes it work on older solaris boxes */ va_copy(ap2, ap); vlen = vsnprintf(buf, sizeof(buf), fmt, ap2); va_end(ap2); @@ -2662,6 +2661,7 @@ char c; va_copy(ap2, ap); + /* this call looks strange, but it makes it work on older solaris boxes */ alen = vsnprintf(&c, 1, fmt, ap2); va_end(ap2); @@ -2678,9 +2678,7 @@ s = talloc_realloc(NULL, s, char, slen + alen + 1); if (!s) return NULL; - va_copy(ap2, ap); - vsnprintf(s + slen, alen + 1, fmt, ap2); - va_end(ap2); + vsnprintf(s + slen, alen + 1, fmt, ap); _tc_set_name_const(talloc_chunk_from_ptr(s), s); return s;
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/talloc/talloc.h -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/talloc/talloc.h
Changed
@@ -666,6 +666,19 @@ _PUBLIC_ const char *talloc_parent_name(const void *ptr); /** + * @brief Get the size of a talloc chunk. + * + * This function lets you know the amount of memory allocated so far by + * this context. It does NOT account for subcontext memory. + * This can be used to calculate the size of an array. + * + * @paramin ctx The talloc chunk. + * + * @return The size of the talloc chunk. + */ +_PUBLIC_ size_t talloc_get_size(const void *ctx); + +/** * @brief Get the total size of a talloc chunk including its children. * * The function returns the total size in bytes used by this pointer and all @@ -713,7 +726,7 @@ * * @paramin p The memory chunk you want to duplicate. * - * @paramin size Number of char's that you want copy. + * @paramin size Number of chars that you want to copy. * * @return The allocated memory chunk. * @@ -1071,19 +1084,6 @@ _PUBLIC_ void *talloc_autofree_context(void) _DEPRECATED_; /** - * @brief Get the size of a talloc chunk. - * - * This function lets you know the amount of memory allocated so far by - * this context. It does NOT account for subcontext memory. - * This can be used to calculate the size of an array. - * - * @paramin ctx The talloc chunk. - * - * @return The size of the talloc chunk. - */ -_PUBLIC_ size_t talloc_get_size(const void *ctx); - -/** * @brief Show the parentage of a context. * * @paramin context The talloc context to look at.
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/talloc/test_pytalloc.c -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/talloc/test_pytalloc.c
Changed
@@ -181,7 +181,6 @@ #define MODULE_DOC PyDoc_STR("Test utility module for pytalloc") -#if PY_MAJOR_VERSION >= 3 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, .m_name = "_test_pytalloc", @@ -189,7 +188,6 @@ .m_size = -1, .m_methods = test_talloc_methods, }; -#endif static PyObject *module_init(void); static PyObject *module_init(void) @@ -207,11 +205,7 @@ return NULL; } -#if PY_MAJOR_VERSION >= 3 m = PyModule_Create(&moduledef); -#else - m = Py_InitModule3("_test_pytalloc", test_talloc_methods, MODULE_DOC); -#endif if (m == NULL) { return NULL; @@ -229,16 +223,8 @@ } -#if PY_MAJOR_VERSION >= 3 PyMODINIT_FUNC PyInit__test_pytalloc(void); PyMODINIT_FUNC PyInit__test_pytalloc(void) { return module_init(); } -#else -void init_test_pytalloc(void); -void init_test_pytalloc(void) -{ - module_init(); -} -#endif
View file
_service:tar_scm:tevent-0.14.1.tar.gz/lib/talloc/wscript -> _service:tar_scm:tevent-0.16.0.tar.gz/lib/talloc/wscript
Changed
@@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'talloc' -VERSION = '2.4.0' +VERSION = '2.4.1' import os import sys @@ -190,10 +190,3 @@ def reconfigure(ctx): '''reconfigure if config scripts have changed''' samba_utils.reconfigure(ctx) - - -def pydoctor(ctx): - '''build python apidocs''' - cmd='PYTHONPATH=bin/python pydoctor --project-name=talloc --project-url=http://talloc.samba.org/ --make-html --docformat=restructuredtext --introspect-c-modules --add-module bin/python/talloc.*' - print("Running: %s" % cmd) - os.system(cmd)
View file
_service:tar_scm:tevent-0.14.1.tar.gz/pytevent.c -> _service:tar_scm:tevent-0.16.0.tar.gz/pytevent.c
Changed
@@ -26,9 +26,6 @@ #include "replace.h" #include <tevent.h> -#if PY_MAJOR_VERSION >= 3 -#define PyLong_FromLong PyLong_FromLong -#endif /* discard signature of 'func' in favour of 'target_sig' */ #define PY_DISCARD_FUNC_SIG(target_sig, func) (target_sig)(void(*)(void))func @@ -244,7 +241,7 @@ if (self->timer) { talloc_free(self->timer); } - Py_DECREF(self->callback); + Py_CLEAR(self->callback); PyObject_Del(self); } @@ -285,7 +282,7 @@ static int TeventTimer_Object_ref_destructor(struct TeventTimer_Object_ref *ref) { ref->obj->timer = NULL; - Py_DECREF(ref->obj); + Py_CLEAR(ref->obj); return 0; } @@ -736,7 +733,6 @@ #define MODULE_DOC PyDoc_STR("Python wrapping of talloc-maintained objects.") -#if PY_MAJOR_VERSION >= 3 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, .m_name = "_tevent", @@ -744,7 +740,6 @@ .m_size = -1, .m_methods = tevent_methods, }; -#endif PyObject * module_init(void); PyObject * module_init(void) @@ -769,11 +764,7 @@ if (PyType_Ready(&TeventFd_Type) < 0) return NULL; -#if PY_MAJOR_VERSION >= 3 m = PyModule_Create(&moduledef); -#else - m = Py_InitModule3("_tevent", tevent_methods, MODULE_DOC); -#endif if (m == NULL) return NULL; @@ -800,16 +791,8 @@ return m; } -#if PY_MAJOR_VERSION >= 3 PyMODINIT_FUNC PyInit__tevent(void); PyMODINIT_FUNC PyInit__tevent(void) { return module_init(); } -#else -void init_tevent(void); -void init_tevent(void) -{ - module_init(); -} -#endif
View file
_service:tar_scm:tevent-0.14.1.tar.gz/testsuite.c -> _service:tar_scm:tevent-0.16.0.tar.gz/testsuite.c
Changed
@@ -32,6 +32,7 @@ #include "system/network.h" #include "torture/torture.h" #include "torture/local/proto.h" +#include "lib/util/blocking.h" #ifdef HAVE_PTHREAD #include "system/threads.h" #include <assert.h> @@ -97,6 +98,22 @@ } while (ret == -1 && errno == EINTR); } +static void do_fill(int fd) +{ + uint8_t buf1024 = {0, }; + ssize_t ret; + + set_blocking(fd, false); + + do { + do { + ret = write(fd, buf, ARRAY_SIZE(buf)); + } while (ret == -1 && errno == EINTR); + } while (ret == ARRAY_SIZE(buf)); + + set_blocking(fd, true); +} + static void fde_handler_write(struct tevent_context *ev_ctx, struct tevent_fd *f, uint16_t flags, void *private_data) { @@ -261,6 +278,118 @@ return true; } +static void fde_handler_do_read(struct tevent_context *ev_ctx, struct tevent_fd *f, + uint16_t flags, void *private_data) +{ + int *fd = (int *)private_data; + char c = 0; + + do_read(fd0, &c, 1); + fde_count++; +} + +static void fde_handler_do_write(struct tevent_context *ev_ctx, struct tevent_fd *f, + uint16_t flags, void *private_data) +{ + int *fd = (int *)private_data; + char c = 0; + + do_write(fd1, &c, 1); +} + +static void fde_handler_ignore(struct tevent_context *ev_ctx, struct tevent_fd *f, + uint16_t flags, void *private_data) +{ +} + +static bool test_fd_speedX(struct torture_context *test, + const void *test_data, + size_t additional_fdes) +{ + struct tevent_context *ev_ctx = NULL; + int fd2 = { -1, -1 }; + const char *backend = (const char *)test_data; + struct tevent_fd *fde_read = NULL; + struct tevent_fd *fde_write = NULL; + int finished=0; + struct timeval t; + size_t i; + int ret; + + ev_ctx = test_tevent_context_init_byname(test, backend); + if (ev_ctx == NULL) { + torture_comment(test, "event backend '%s' not supported\n", backend); + return true; + } + + torture_comment(test, "backend '%s' - test_fd_speed%zu\n", + backend, 1 + additional_fdes); + + /* reset globals */ + fde_count = 0; + + /* create a pipe */ + ret = pipe(fd); + torture_assert_int_equal(test, ret, 0, "pipe failed"); + + fde_read = tevent_add_fd(ev_ctx, ev_ctx, fd0, TEVENT_FD_READ, + fde_handler_do_read, fd); + + fde_write = tevent_add_fd(ev_ctx, ev_ctx, fd1, TEVENT_FD_WRITE, + fde_handler_do_write, fd); + + for (i = 0; i < additional_fdes; i++) { + tevent_add_fd(ev_ctx, ev_ctx, fd0, TEVENT_FD_WRITE, + fde_handler_ignore, fd); + tevent_add_fd(ev_ctx, ev_ctx, fd1, TEVENT_FD_READ, + fde_handler_ignore, fd); + } + + tevent_fd_set_auto_close(fde_read); + tevent_fd_set_auto_close(fde_write); + + tevent_add_timer(ev_ctx, ev_ctx, timeval_current_ofs(600,0), + finished_handler, &finished); + + t = timeval_current(); + while (!finished && fde_count < 1000000) { + errno = 0; + if (tevent_loop_once(ev_ctx) == -1) { + TALLOC_FREE(ev_ctx); + torture_fail(test, talloc_asprintf(test, "Failed event loop %s\n", strerror(errno))); + return false; + } + } + + talloc_free(fde_read); + talloc_free(fde_write); + + torture_comment(test, "Got %.2f pipe events\n", (double)fde_count); + torture_comment(test, "Got %.2f pipe events/sec\n", fde_count/timeval_elapsed(&t)); + + talloc_free(ev_ctx); + + return true; +} + +static bool test_fd_speed1(struct torture_context *test, + const void *test_data) +{ + return test_fd_speedX(test, test_data, 0); +} + +static bool test_fd_speed2(struct torture_context *test, + const void *test_data) +{ + return test_fd_speedX(test, test_data, 1); +} + +static bool test_fd_speed3(struct torture_context *test, + const void *test_data) +{ + return test_fd_speedX(test, test_data, 2); +} + struct test_event_fd1_state { struct torture_context *tctx; const char *backend; @@ -721,6 +850,600 @@ return true; } +struct test_event_fd3_state { + struct torture_context *tctx; + const char *backend; + struct tevent_context *ev; + struct timeval start_time; + struct tevent_timer *te1, *te2, *te3, *te4, *te5; + struct test_event_fd3_sock { + struct test_event_fd3_state *state; + const char *sock_name; + int fd; + const char *phase_name; + uint64_t iteration_id; + uint64_t max_iterations; + uint16_t expected_flags; + uint8_t expected_count; + uint8_t actual_count; + struct test_event_fd3_fde { + struct test_event_fd3_sock *sock; + struct tevent_fd *fde; + uint64_t last_iteration_id; + } fde1, fde2, fde3, fde4, fde5, fde6, fde7, fde8, fde9; + void (*fde_callback)(struct test_event_fd3_fde *tfde, + uint16_t flags); + } sock0, sock1; + bool finished; + const char *error; +}; + +static void test_event_fd3_fde_callback(struct test_event_fd3_fde *tfde, + uint16_t flags) +{ + struct test_event_fd3_sock *sock = tfde->sock; + struct test_event_fd3_state *state = sock->state; + uint16_t fde_flags = tevent_fd_get_flags(tfde->fde); + uint16_t expected_flags = sock->expected_flags & fde_flags; + + if (expected_flags == 0) { + state->finished = true; + state->error = __location__; + return; + } + + if (flags != expected_flags) { + state->finished = true; + state->error = __location__; + return; + } + + if (tfde->last_iteration_id == sock->iteration_id) { + state->finished = true; + state->error = __location__; + return; + } + + tfde->last_iteration_id = sock->iteration_id; + + sock->actual_count += 1; + + if (sock->actual_count > sock->expected_count) { + state->finished = true; + state->error = __location__; + return; + } + + if (sock->actual_count == sock->expected_count) { + sock->actual_count = 0; + sock->iteration_id += 1; + } + + if (sock->iteration_id > sock->max_iterations) { + torture_comment(state->tctx, + "%s: phase%s finished with %"PRIu64" iterations\n", + sock->sock_name, + sock->phase_name, + sock->max_iterations); + tevent_fd_set_flags(sock->fde1.fde, 0); + tevent_fd_set_flags(sock->fde2.fde, 0); + tevent_fd_set_flags(sock->fde3.fde, 0); + tevent_fd_set_flags(sock->fde4.fde, 0); + tevent_fd_set_flags(sock->fde5.fde, 0); + tevent_fd_set_flags(sock->fde6.fde, 0); + tevent_fd_set_flags(sock->fde7.fde, 0); + tevent_fd_set_flags(sock->fde8.fde, 0); + tevent_fd_set_flags(sock->fde9.fde, 0); + sock->fde_callback = NULL; + } +} + +static void test_event_fd3_prepare_phase(struct test_event_fd3_sock *sock, + const char *phase_name, + uint64_t max_iterations, + uint16_t expected_flags, + uint8_t expected_count, + uint16_t flags1, + uint16_t flags2, + uint16_t flags3, + uint16_t flags4, + uint16_t flags5, + uint16_t flags6, + uint16_t flags7, + uint16_t flags8, + uint16_t flags9) +{ + struct test_event_fd3_state *state = sock->state; + + if (sock->fde_callback != NULL) { + state->finished = true; + state->error = __location__; + return; + } + + sock->phase_name = phase_name; + sock->max_iterations = max_iterations; + sock->expected_flags = expected_flags; + sock->expected_count = expected_count; + sock->iteration_id = 1; + sock->actual_count = 0; + + tevent_fd_set_flags(sock->fde1.fde, flags1); + sock->fde1.last_iteration_id = 0; + tevent_fd_set_flags(sock->fde2.fde, flags2); + sock->fde2.last_iteration_id = 0; + tevent_fd_set_flags(sock->fde3.fde, flags3); + sock->fde3.last_iteration_id = 0; + tevent_fd_set_flags(sock->fde4.fde, flags4); + sock->fde4.last_iteration_id = 0; + tevent_fd_set_flags(sock->fde5.fde, flags5); + sock->fde5.last_iteration_id = 0; + tevent_fd_set_flags(sock->fde6.fde, flags6); + sock->fde6.last_iteration_id = 0; + tevent_fd_set_flags(sock->fde7.fde, flags7); + sock->fde7.last_iteration_id = 0; + tevent_fd_set_flags(sock->fde8.fde, flags8); + sock->fde8.last_iteration_id = 0; + tevent_fd_set_flags(sock->fde9.fde, flags9); + sock->fde9.last_iteration_id = 0; + + sock->fde_callback = test_event_fd3_fde_callback; +} + +static void test_event_fd3_sock_handler(struct tevent_context *ev_ctx, + struct tevent_fd *fde, + uint16_t flags, + void *private_data) +{ + struct test_event_fd3_fde *tfde = + (struct test_event_fd3_fde *)private_data; + struct test_event_fd3_sock *sock = tfde->sock; + struct test_event_fd3_state *state = sock->state; + + if (sock->fd == -1) { + state->finished = true; + state->error = __location__; + return; + } + + if (sock->fde_callback == NULL) { + state->finished = true; + state->error = __location__; + return; + } + + sock->fde_callback(tfde, flags); + return; +} + +static bool test_event_fd3_assert_timeout(struct test_event_fd3_state *state, + double expected_elapsed, + const char *func) +{ + double e = timeval_elapsed(&state->start_time); + double max_latency = 0.05; + + if (e < expected_elapsed) { + torture_comment(state->tctx, + "%s: elapsed=%.6f < expected_elapsed=%.6f\n", + func, e, expected_elapsed); + state->finished = true; + state->error = __location__; + return false; + } + + if (e > (expected_elapsed + max_latency)) { + torture_comment(state->tctx, + "%s: elapsed=%.6f > " + "(expected_elapsed=%.6f + max_latency=%.6f)\n", + func, e, expected_elapsed, max_latency); + state->finished = true; + state->error = __location__; + return false; + } + + torture_comment(state->tctx, "%s: elapsed=%.6f\n", __func__, e); + return true; +} + +static void test_event_fd3_writeable(struct tevent_context *ev_ctx, + struct tevent_timer *te, + struct timeval tval, + void *private_data) +{ + struct test_event_fd3_state *state = + (struct test_event_fd3_state *)private_data; + + if (!test_event_fd3_assert_timeout(state, 1, __func__)) { + return; + } + + test_event_fd3_prepare_phase(&state->sock0, + __func__, + INT8_MAX, + TEVENT_FD_WRITE, + 5, + TEVENT_FD_WRITE, + 0, + TEVENT_FD_READ, + TEVENT_FD_WRITE, + TEVENT_FD_READ|TEVENT_FD_WRITE, + TEVENT_FD_READ, + TEVENT_FD_WRITE, + TEVENT_FD_READ|TEVENT_FD_WRITE, + 0); + + test_event_fd3_prepare_phase(&state->sock1, + __func__, + INT8_MAX, + TEVENT_FD_WRITE, + 9, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR); +} + +static void test_event_fd3_readable(struct tevent_context *ev_ctx, + struct tevent_timer *te, + struct timeval tval, + void *private_data) +{ + struct test_event_fd3_state *state = + (struct test_event_fd3_state *)private_data; + uint8_t c = 0; + + if (!test_event_fd3_assert_timeout(state, 2, __func__)) { + return; + } + + do_write(state->sock0.fd, &c, 1); + do_write(state->sock1.fd, &c, 1); + + test_event_fd3_prepare_phase(&state->sock0, + __func__, + INT8_MAX, + TEVENT_FD_READ|TEVENT_FD_WRITE, + 9, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR); + + test_event_fd3_prepare_phase(&state->sock1, + __func__, + INT8_MAX, + TEVENT_FD_READ|TEVENT_FD_WRITE, + 7, + TEVENT_FD_READ, + TEVENT_FD_READ|TEVENT_FD_WRITE, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + 0, + TEVENT_FD_READ, + TEVENT_FD_WRITE, + TEVENT_FD_ERROR, + TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE); +} + +static void test_event_fd3_not_writeable(struct tevent_context *ev_ctx, + struct tevent_timer *te, + struct timeval tval, + void *private_data) +{ + struct test_event_fd3_state *state = + (struct test_event_fd3_state *)private_data; + + if (!test_event_fd3_assert_timeout(state, 3, __func__)) { + return; + } + + do_fill(state->sock0.fd); + do_fill(state->sock1.fd); + + test_event_fd3_prepare_phase(&state->sock0, + __func__, + INT8_MAX, + TEVENT_FD_READ, + 5, + TEVENT_FD_READ|TEVENT_FD_WRITE, + TEVENT_FD_WRITE, + TEVENT_FD_READ, + 0, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_ERROR, + TEVENT_FD_ERROR, + TEVENT_FD_READ); + + test_event_fd3_prepare_phase(&state->sock1, + __func__, + INT8_MAX, + TEVENT_FD_READ, + 9, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR); +} + +static void test_event_fd3_off(struct tevent_context *ev_ctx, + struct tevent_timer *te, + struct timeval tval, + void *private_data) +{ + struct test_event_fd3_state *state = + (struct test_event_fd3_state *)private_data; + + if (!test_event_fd3_assert_timeout(state, 4, __func__)) { + return; + } + + TALLOC_FREE(state->sock0.fde1.fde); + state->sock0.fd = -1; + + test_event_fd3_prepare_phase(&state->sock1, + __func__, + INT8_MAX, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + 7, + TEVENT_FD_READ|TEVENT_FD_WRITE, + TEVENT_FD_WRITE, + TEVENT_FD_READ, + 0, + TEVENT_FD_READ|TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_WRITE|TEVENT_FD_ERROR, + TEVENT_FD_READ|TEVENT_FD_ERROR, + TEVENT_FD_ERROR, + TEVENT_FD_READ); +} + +static void test_event_fd3_finished(struct tevent_context *ev_ctx, + struct tevent_timer *te, + struct timeval tval, + void *private_data) +{ + struct test_event_fd3_state *state = + (struct test_event_fd3_state *)private_data; + + if (!test_event_fd3_assert_timeout(state, 5, __func__)) { + return; + } + + /* + * this should never be triggered + */ + if (state->sock0.fde_callback != NULL) { + state->finished = true; + state->error = __location__; + return; + } + if (state->sock1.fde_callback != NULL) { + state->finished = true; + state->error = __location__; + return; + } + + state->finished = true; +} + +static bool test_event_fd3(struct torture_context *tctx, + const void *test_data) +{ + struct test_event_fd3_state state = { + .tctx = tctx, + .backend = (const char *)test_data, + }; + int rc; + int sock2; + + state.ev = test_tevent_context_init_byname(tctx, state.backend); + if (state.ev == NULL) { + torture_skip(tctx, talloc_asprintf(tctx, + "event backend '%s' not supported\n", + state.backend)); + return true; + } + + torture_comment(tctx, "backend '%s' - %s\n", + state.backend, __FUNCTION__); + + sock0 = -1; + sock1 = -1; + rc = socketpair(AF_UNIX, SOCK_STREAM, 0, sock); + torture_assert_int_equal(tctx, rc, 0, "socketpair()"); + + state.start_time = timeval_current(); + state.te1 = tevent_add_timer(state.ev, state.ev, + timeval_add(&state.start_time, 5, 0), + test_event_fd3_finished, &state); + torture_assert(tctx, state.te1 != NULL, "tevent_add_timer()"); + state.te2 = tevent_add_timer(state.ev, state.ev, + timeval_add(&state.start_time, 1, 0), + test_event_fd3_writeable, &state); + torture_assert(tctx, state.te2 != NULL, "tevent_add_timer()"); + state.te3 = tevent_add_timer(state.ev, state.ev, + timeval_add(&state.start_time, 2, 0), + test_event_fd3_readable, &state); + torture_assert(tctx, state.te3 != NULL, "tevent_add_timer()"); + state.te4 = tevent_add_timer(state.ev, state.ev, + timeval_add(&state.start_time, 3, 0), + test_event_fd3_not_writeable, &state); + torture_assert(tctx, state.te4 != NULL, "tevent_add_timer()"); + state.te5 = tevent_add_timer(state.ev, state.ev, + timeval_add(&state.start_time, 4, 0), + test_event_fd3_off, &state); + torture_assert(tctx, state.te5 != NULL, "tevent_add_timer()"); + + state.sock0.state = &state; + state.sock0.sock_name = "sock0"; + state.sock0.fd = sock0; + state.sock0.fde1.sock = &state.sock0; + state.sock0.fde1.fde = tevent_add_fd(state.ev, state.ev, + state.sock0.fd, + 0, + test_event_fd3_sock_handler, + &state.sock0.fde1); + torture_assert(tctx, state.sock0.fde1.fde != NULL, "tevent_add_fd()"); + tevent_fd_set_auto_close(state.sock0.fde1.fde); + state.sock0.fde2.sock = &state.sock0; + state.sock0.fde2.fde = tevent_add_fd(state.ev, state.ev, + state.sock0.fd, + 0, + test_event_fd3_sock_handler, + &state.sock0.fde2); + torture_assert(tctx, state.sock0.fde2.fde != NULL, "tevent_add_fd()"); + state.sock0.fde3.sock = &state.sock0; + state.sock0.fde3.fde = tevent_add_fd(state.ev, state.ev, + state.sock0.fd, + 0, + test_event_fd3_sock_handler, + &state.sock0.fde3); + torture_assert(tctx, state.sock0.fde3.fde != NULL, "tevent_add_fd()"); + state.sock0.fde4.sock = &state.sock0; + state.sock0.fde4.fde = tevent_add_fd(state.ev, state.ev, + state.sock0.fd, + 0, + test_event_fd3_sock_handler, + &state.sock0.fde4); + torture_assert(tctx, state.sock0.fde4.fde != NULL, "tevent_add_fd()"); + state.sock0.fde5.sock = &state.sock0; + state.sock0.fde5.fde = tevent_add_fd(state.ev, state.ev, + state.sock0.fd, + 0, + test_event_fd3_sock_handler, + &state.sock0.fde5); + torture_assert(tctx, state.sock0.fde5.fde != NULL, "tevent_add_fd()"); + state.sock0.fde6.sock = &state.sock0; + state.sock0.fde6.fde = tevent_add_fd(state.ev, state.ev, + state.sock0.fd, + 0, + test_event_fd3_sock_handler, + &state.sock0.fde6); + torture_assert(tctx, state.sock0.fde6.fde != NULL, "tevent_add_fd()"); + state.sock0.fde7.sock = &state.sock0; + state.sock0.fde7.fde = tevent_add_fd(state.ev, state.ev, + state.sock0.fd, + 0, + test_event_fd3_sock_handler, + &state.sock0.fde7); + torture_assert(tctx, state.sock0.fde7.fde != NULL, "tevent_add_fd()"); + state.sock0.fde8.sock = &state.sock0; + state.sock0.fde8.fde = tevent_add_fd(state.ev, state.ev, + state.sock0.fd, + 0, + test_event_fd3_sock_handler, + &state.sock0.fde8); + torture_assert(tctx, state.sock0.fde8.fde != NULL, "tevent_add_fd()"); + state.sock0.fde9.sock = &state.sock0; + state.sock0.fde9.fde = tevent_add_fd(state.ev, state.ev, + state.sock0.fd, + 0, + test_event_fd3_sock_handler, + &state.sock0.fde9); + torture_assert(tctx, state.sock0.fde9.fde != NULL, "tevent_add_fd()"); + + state.sock1.state = &state; + state.sock1.sock_name = "sock1"; + state.sock1.fd = sock1; + state.sock1.fde1.sock = &state.sock1; + state.sock1.fde1.fde = tevent_add_fd(state.ev, state.ev, + state.sock1.fd, + 1, + test_event_fd3_sock_handler, + &state.sock1.fde1); + torture_assert(tctx, state.sock1.fde1.fde != NULL, "tevent_add_fd()"); + tevent_fd_set_auto_close(state.sock1.fde1.fde); + state.sock1.fde2.sock = &state.sock1; + state.sock1.fde2.fde = tevent_add_fd(state.ev, state.ev, + state.sock1.fd, + 0, + test_event_fd3_sock_handler, + &state.sock1.fde2); + torture_assert(tctx, state.sock1.fde2.fde != NULL, "tevent_add_fd()"); + state.sock1.fde3.sock = &state.sock1; + state.sock1.fde3.fde = tevent_add_fd(state.ev, state.ev, + state.sock1.fd, + 0, + test_event_fd3_sock_handler, + &state.sock1.fde3); + torture_assert(tctx, state.sock1.fde3.fde != NULL, "tevent_add_fd()"); + state.sock1.fde4.sock = &state.sock1; + state.sock1.fde4.fde = tevent_add_fd(state.ev, state.ev, + state.sock1.fd, + 0, + test_event_fd3_sock_handler, + &state.sock1.fde4); + torture_assert(tctx, state.sock1.fde4.fde != NULL, "tevent_add_fd()"); + state.sock1.fde5.sock = &state.sock1; + state.sock1.fde5.fde = tevent_add_fd(state.ev, state.ev, + state.sock1.fd, + 0, + test_event_fd3_sock_handler, + &state.sock1.fde5); + torture_assert(tctx, state.sock1.fde5.fde != NULL, "tevent_add_fd()"); + state.sock1.fde6.sock = &state.sock1; + state.sock1.fde6.fde = tevent_add_fd(state.ev, state.ev, + state.sock1.fd, + 0, + test_event_fd3_sock_handler, + &state.sock1.fde6); + torture_assert(tctx, state.sock1.fde6.fde != NULL, "tevent_add_fd()"); + state.sock1.fde7.sock = &state.sock1; + state.sock1.fde7.fde = tevent_add_fd(state.ev, state.ev, + state.sock1.fd, + 0, + test_event_fd3_sock_handler, + &state.sock1.fde7); + torture_assert(tctx, state.sock1.fde7.fde != NULL, "tevent_add_fd()"); + state.sock1.fde8.sock = &state.sock1; + state.sock1.fde8.fde = tevent_add_fd(state.ev, state.ev, + state.sock1.fd, + 0, + test_event_fd3_sock_handler, + &state.sock1.fde8); + torture_assert(tctx, state.sock1.fde8.fde != NULL, "tevent_add_fd()"); + state.sock1.fde9.sock = &state.sock1; + state.sock1.fde9.fde = tevent_add_fd(state.ev, state.ev, + state.sock1.fd, + 0, + test_event_fd3_sock_handler, + &state.sock1.fde9); + torture_assert(tctx, state.sock1.fde9.fde != NULL, "tevent_add_fd()"); + + while (!state.finished) { + errno = 0; + if (tevent_loop_once(state.ev) == -1) { + talloc_free(state.ev); + torture_fail(tctx, talloc_asprintf(tctx, + "Failed event loop %s\n", + strerror(errno))); + } + } + + talloc_free(state.ev); + + torture_assert(tctx, state.error == NULL, talloc_asprintf(tctx, + "%s", state.error)); + + return true; +} + struct test_wrapper_state { struct torture_context *tctx; int num_events; @@ -1091,7 +1814,7 @@ * signal handlers have highest priority in tevent, so this signal * handler will always be started before the other handlers * below. Freeing the (wrapper) event context here tests that the - * wrapper implementation correclty handles the wrapper ev going away + * wrapper implementation correctly handles the wrapper ev going away * with pending events. */ talloc_free(ev); @@ -1866,6 +2589,18 @@ test_event_context, (const void *)listi); torture_suite_add_simple_tcase_const(backend_suite, + "fd_speed1", + test_fd_speed1, + (const void *)listi); + torture_suite_add_simple_tcase_const(backend_suite, + "fd_speed2", + test_fd_speed2, + (const void *)listi); + torture_suite_add_simple_tcase_const(backend_suite, + "fd_speed3", + test_fd_speed3, + (const void *)listi); + torture_suite_add_simple_tcase_const(backend_suite, "fd1", test_event_fd1, (const void *)listi); @@ -1874,6 +2609,10 @@ test_event_fd2, (const void *)listi); torture_suite_add_simple_tcase_const(backend_suite, + "fd3", + test_event_fd3, + (const void *)listi); + torture_suite_add_simple_tcase_const(backend_suite, "wrapper", test_wrapper, (const void *)listi);
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent.c -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent.c
Changed
@@ -410,10 +410,7 @@ for (fd = ev->fd_events; fd; fd = fn) { fn = fd->next; - tevent_trace_fd_callback(fd->event_ctx, fd, TEVENT_EVENT_TRACE_DETACH); - fd->wrapper = NULL; - fd->event_ctx = NULL; - DLIST_REMOVE(ev->fd_events, fd); + tevent_common_fd_disarm(fd); } ev->last_zero_timer = NULL; @@ -518,7 +515,7 @@ } /* - create a event_context structure for a specific implemementation. + create a event_context structure for a specific implementation. This must be the first events call, and all subsequent calls pass this event_context as the first element. Event handlers also receive this as their first argument. @@ -824,7 +821,10 @@ tevent_trace_point_callback(ev, TEVENT_TRACE_AFTER_LOOP_ONCE); /* New event (and request) will always start with call depth 0. */ - tevent_thread_call_depth_set(0); + tevent_thread_call_depth_notify(TEVENT_CALL_FLOW_REQ_RESET, + NULL, + 0, + __func__); if (ev->nesting.level > 0) { if (ev->nesting.hook_fn) {
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent.h -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent.h
Changed
@@ -39,6 +39,15 @@ #define __has_attribute(x) 0 #endif +#ifdef TEVENT_DEPRECATED +#ifndef _DEPRECATED_ +#if __has_attribute(deprecated) || (__GNUC__ >= 3) +#define _DEPRECATED_ __attribute__ ((deprecated)) +#else +#define _DEPRECATED_ +#endif +#endif +#endif struct tevent_context; struct tevent_ops; @@ -175,7 +184,7 @@ * * @paramin fd The file descriptor to base the event on. * - * @paramin flags #TEVENT_FD_READ or #TEVENT_FD_WRITE + * @paramin flags #TEVENT_FD_READ, #TEVENT_FD_WRITE or #TEVENT_FD_ERROR. * * @paramin handler The callback handler for the event. * @@ -526,8 +535,8 @@ * * @paramin fde File descriptor event to query * - * @return The flags set on the event. See #TEVENT_FD_READ and - * #TEVENT_FD_WRITE + * @return The flags set on the event. See #TEVENT_FD_READ, + * #TEVENT_FD_WRITE and #TEVENT_FD_ERROR */ uint16_t tevent_fd_get_flags(struct tevent_fd *fde); @@ -535,8 +544,8 @@ * Set flags on a file descriptor event * * @paramin fde File descriptor event to set - * @paramin flags Flags to set on the event. See #TEVENT_FD_READ and - * #TEVENT_FD_WRITE + * @paramin flags Flags to set on the event. See #TEVENT_FD_READ, + * #TEVENT_FD_WRITE and #TEVENT_FD_ERROR */ void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags); @@ -554,13 +563,25 @@ /* bits for file descriptor event flags */ /** - * Monitor a file descriptor for data to be read + * Monitor a file descriptor for data to be read and errors + * + * Note: we map this from/to POLLIN, POLLHUP, POLLERR and + * where available POLLRDHUP */ #define TEVENT_FD_READ 1 /** * Monitor a file descriptor for writeability + * + * Note: we map this from/to POLLOUT */ #define TEVENT_FD_WRITE 2 +/** + * Monitor a file descriptor for errors + * + * Note: we map this from/to POLLHUP, POLLERR and + * where available POLLRDHUP + */ +#define TEVENT_FD_ERROR 4 /** * Convenience function for declaring a tevent_fd writable @@ -575,6 +596,12 @@ tevent_fd_set_flags(fde, tevent_fd_get_flags(fde) | TEVENT_FD_READ) /** + * Convenience function for declaring a tevent_fd waiting for errors + */ +#define TEVENT_FD_WANTERROR(fde) \ + tevent_fd_set_flags(fde, tevent_fd_get_flags(fde) | TEVENT_FD_ERROR) + +/** * Convenience function for declaring a tevent_fd non-writable */ #define TEVENT_FD_NOT_WRITEABLE(fde) \ @@ -587,6 +614,12 @@ tevent_fd_set_flags(fde, tevent_fd_get_flags(fde) & ~TEVENT_FD_READ) /** + * Convenience function for declaring a tevent_fd not waiting for errors + */ +#define TEVENT_FD_NOT_WANTERROR(fde) \ + tevent_fd_set_flags(fde, tevent_fd_get_flags(fde) & ~TEVENT_FD_ERROR) + +/** * Debug level of tevent */ enum tevent_debug_level { @@ -615,6 +648,18 @@ /** * Set destination for tevent debug messages * + * As of version 0.15.0 the invocation of + * the debug function for individual messages + * is limited by the current max_debug_level, + * which means TEVENT_DEBUG_TRACE messages + * are not passed by default: + * + * - tevent_set_debug() with debug == NULL implies + * tevent_set_max_debug_level(ev, TEVENT_DEBUG_FATAL). + * + * - tevent_set_debug() with debug != NULL implies + * tevent_set_max_debug_level(ev, TEVENT_DEBUG_WARNING). + * * @paramin ev Event context to debug * @paramin debug Function to handle output printing * @paramin context The context to pass to the debug function. @@ -622,12 +667,30 @@ * @return Always returns 0 as of version 0.9.8 * * @note Default is to emit no debug messages + * + * @see tevent_set_max_debug_level() */ int tevent_set_debug(struct tevent_context *ev, tevent_debug_fn debug, void *context); /** + * Set maximum debug level for tevent debug messages + * + * @paramin ev Event context to debug + * @paramin max_level Function to handle output printing + * + * @return The former max level is returned. + * + * @see tevent_set_debug() + * + * @note Available as of tevent 0.15.0 + */ +enum tevent_debug_level +tevent_set_max_debug_level(struct tevent_context *ev, + enum tevent_debug_level max_level); + +/** * Designate stderr for debug message output * * @paramin ev Event context to debug @@ -1010,6 +1073,13 @@ * callback. */ void tevent_req_set_callback(struct tevent_req *req, tevent_req_fn fn, void *pvt); +void _tevent_req_set_callback(struct tevent_req *req, + tevent_req_fn fn, + const char *fn_name, + void *pvt); + +#define tevent_req_set_callback(req, fn, pvt) \ + _tevent_req_set_callback(req, fn, #fn, pvt) #ifdef DOXYGEN /** @@ -1166,6 +1236,11 @@ * @paramin fn A pointer to the cancel function. */ void tevent_req_set_cancel_fn(struct tevent_req *req, tevent_req_cancel_fn fn); +void _tevent_req_set_cancel_fn(struct tevent_req *req, + tevent_req_cancel_fn fn, + const char *fn_name); +#define tevent_req_set_cancel_fn(req, fn) \ + _tevent_req_set_cancel_fn(req, fn, #fn) #ifdef DOXYGEN /** @@ -1227,6 +1302,11 @@ * @paramin fn A pointer to the cancel function. */ void tevent_req_set_cleanup_fn(struct tevent_req *req, tevent_req_cleanup_fn fn); +void _tevent_req_set_cleanup_fn(struct tevent_req *req, + tevent_req_cleanup_fn fn, + const char *fn_name); +#define tevent_req_set_cleanup_fn(req, fn) \ + _tevent_req_set_cleanup_fn(req, fn, #fn) #ifdef DOXYGEN /** @@ -1262,9 +1342,20 @@ const char *type, const char *location); +struct tevent_req *__tevent_req_create(TALLOC_CTX *mem_ctx, + void *pstate, + size_t state_size, + const char *type, + const char *func, + const char *location); + #define tevent_req_create(_mem_ctx, _pstate, _type) \ - _tevent_req_create((_mem_ctx), (_pstate), sizeof(_type), \ - #_type, __location__) + __tevent_req_create((_mem_ctx), \ + (_pstate), \ + sizeof(_type), \ + #_type, \ + __func__, \ + __location__) #endif /** @@ -1588,7 +1679,7 @@ struct tevent_req_profile; /** - * @brief Get the a request's profile for inspection + * @brief Get a request's profile for inspection * * @paramin req The request to get the profile from * @@ -2029,10 +2120,9 @@ * * Part 1: activation/deactivation * - * tevent_thread_call_depth_activate(), tevent_thread_call_depth_deactivate() - * - * Activating registers external size_t variable that will be maintained with - * the current call depth. + * void tevent_thread_call_depth_set_callback(f, private_data) + * Register a callback that can track 'call depth' and 'request flow' + * NULL as a function callback means deactivation. * * Part 2: Mark the request (and its subrequests) to be tracked * @@ -2047,7 +2137,7 @@ * * tevent_thread_call_depth_reset_from_req(struct tevent_req *req) * - * If the call depth is used for trace indentation, it might be usefull to + * If the call depth is used for trace indentation, it might be useful to * reset the external variable to the call depth of currently processed tevent * request, since the ext. variable can be changed after return from a function * call that has created subrequests. @@ -2060,34 +2150,62 @@ * @{ */ +enum tevent_thread_call_depth_cmd { + TEVENT_CALL_FLOW_REQ_RESET, + TEVENT_CALL_FLOW_REQ_CREATE, + TEVENT_CALL_FLOW_REQ_CANCEL, + TEVENT_CALL_FLOW_REQ_CLEANUP, + TEVENT_CALL_FLOW_REQ_NOTIFY_CB, + TEVENT_CALL_FLOW_REQ_QUEUE_ENTER, + TEVENT_CALL_FLOW_REQ_QUEUE_TRIGGER, + TEVENT_CALL_FLOW_REQ_QUEUE_LEAVE, +}; + +typedef void (*tevent_call_depth_callback_t)( + void *private_data, + enum tevent_thread_call_depth_cmd cmd, + struct tevent_req *req, + size_t depth, + const char *fname); + +struct tevent_thread_call_depth_state { + tevent_call_depth_callback_t cb; + void *cb_private; +}; + +extern __thread struct tevent_thread_call_depth_state + tevent_thread_call_depth_state_g; + /** - * Activate call depth tracking and register external variable that will - * be updated to the call epth of currenty processed tevent request. + * Register callback function for request/subrequest call depth / flow tracking. * - * @paramin ptr Address of external variable + * @paramin f External call depth and flow handling function */ -void tevent_thread_call_depth_activate(size_t *ptr); +void tevent_thread_call_depth_set_callback(tevent_call_depth_callback_t f, + void *private_data); -/** - * Deactivate call depth tracking. Can be used in the child process, - * after fork. - */ -void tevent_thread_call_depth_deactivate(void); +#ifdef TEVENT_DEPRECATED -/** - * This request will have call depth set to 1, its subrequest will get 2 and so - * on. All other requests will have call depth 0. - */ -void tevent_thread_call_depth_start(struct tevent_req *req); +void tevent_thread_call_depth_activate(size_t *ptr) _DEPRECATED_; +void tevent_thread_call_depth_deactivate(void) _DEPRECATED_; +void tevent_thread_call_depth_start(struct tevent_req *req) _DEPRECATED_; + +#endif /** - * Set the external variable to the call depth of the request req. + * Reset the external call depth to the call depth of the request. * - * @paramin req Request from which the call depth is assigned to ext. + * @paramin req Request from which the call depth is reset. * variable. */ void tevent_thread_call_depth_reset_from_req(struct tevent_req *req); +void _tevent_thread_call_depth_reset_from_req(struct tevent_req *req, + const char *fname); + +#define tevent_thread_call_depth_reset_from_req(req) \ + _tevent_thread_call_depth_reset_from_req(req, __func__) + /* @} */ @@ -2223,6 +2341,16 @@ tevent_queue_trigger_fn_t trigger, void *private_data); +bool _tevent_queue_add(struct tevent_queue *queue, + struct tevent_context *ev, + struct tevent_req *req, + tevent_queue_trigger_fn_t trigger, + const char* trigger_name, + void *private_data); + +#define tevent_queue_add(queue, ev, req, trigger, private_data) \ + _tevent_queue_add(queue, ev, req, trigger, #trigger, private_data) + /** * @brief Add a tevent request to the queue. * @@ -2256,6 +2384,17 @@ tevent_queue_trigger_fn_t trigger, void *private_data); +struct tevent_queue_entry *_tevent_queue_add_entry( + struct tevent_queue *queue, + struct tevent_context *ev, + struct tevent_req *req, + tevent_queue_trigger_fn_t trigger, + const char* trigger_name, + void *private_data); + +#define tevent_queue_add_entry(queue, ev, req, trigger, private_data) \ + _tevent_queue_add_entry(queue, ev, req, trigger, #trigger, private_data); + /** * @brief Add a tevent request to the queue using a possible optimization. * @@ -2299,6 +2438,17 @@ tevent_queue_trigger_fn_t trigger, void *private_data); +struct tevent_queue_entry *_tevent_queue_add_optimize_empty( + struct tevent_queue *queue, + struct tevent_context *ev, + struct tevent_req *req, + tevent_queue_trigger_fn_t trigger, + const char* trigger_name, + void *private_data); + +#define tevent_queue_add_optimize_empty(queue, ev, req, trigger, private_data) \ + _tevent_queue_add_optimize_empty(queue, ev, req, trigger, #trigger, private_data) + /** * @brief Untrigger an already triggered queue entry. * @@ -2523,13 +2673,6 @@ #endif #ifdef TEVENT_DEPRECATED -#ifndef _DEPRECATED_ -#if __has_attribute(deprecated) || (__GNUC__ >= 3) -#define _DEPRECATED_ __attribute__ ((deprecated)) -#else -#define _DEPRECATED_ -#endif -#endif void tevent_loop_allow_nesting(struct tevent_context *ev) _DEPRECATED_; void tevent_loop_set_nesting_hook(struct tevent_context *ev, tevent_nesting_hook hook, @@ -2820,7 +2963,7 @@ * * The wrapper event context might undo something like impersonation. * - * This must be called after a succesful tevent_context_push_use(). + * This must be called after a successful tevent_context_push_use(). * Any ordering violation results in calling * the abort handler of the given tevent context. * @@ -2872,7 +3015,7 @@ * @defgroup tevent_compat The tevent compatibility functions * @ingroup tevent * - * The following definitions are usueful only for compatibility with the + * The following definitions are useful only for compatibility with the * implementation originally developed within the samba4 code and will be * soon removed. Please NEVER use in new code. *
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent_debug.c -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent_debug.c
Changed
@@ -23,9 +23,12 @@ */ #include "replace.h" +#define TEVENT_DEPRECATED #include "tevent.h" #include "tevent_internal.h" +#undef tevent_thread_call_depth_reset_from_req + /******************************************************************** * Debug wrapper functions, modeled (with lot's of code copied as is) * after the ev debug wrapper functions @@ -47,12 +50,31 @@ errno = EINVAL; return -1; } - + if (debug != NULL) { + /* + * tevent_set_max_debug_level(ev, TEVENT_DEBUG_TRACE) + * can be used to get full tracing, but we can to + * avoid overhead by default. + */ + ev->debug_ops.max_level = TEVENT_DEBUG_WARNING; + } else { + ev->debug_ops.max_level = TEVENT_DEBUG_FATAL; + } ev->debug_ops.debug = debug; ev->debug_ops.context = context; return 0; } +enum tevent_debug_level +tevent_set_max_debug_level(struct tevent_context *ev, + enum tevent_debug_level max_level) +{ + enum tevent_debug_level old_level; + old_level = ev->debug_ops.max_level; + ev->debug_ops.max_level = max_level; + return old_level; +} + /* debug function for ev_set_debug_stderr */ @@ -96,6 +118,9 @@ if (ev->wrapper.glue != NULL) { ev = tevent_wrapper_main_ev(ev); } + if (level > ev->debug_ops.max_level) { + return; + } if (ev->debug_ops.debug == NULL) { return; } @@ -293,40 +318,54 @@ } } -static __thread size_t *tevent_thread_call_depth_ptr = NULL; +_PRIVATE_ __thread +struct tevent_thread_call_depth_state tevent_thread_call_depth_state_g; void tevent_thread_call_depth_activate(size_t *ptr) { - tevent_thread_call_depth_ptr = ptr; - *tevent_thread_call_depth_ptr = 0; } void tevent_thread_call_depth_deactivate(void) { - /* Reset the previous storage */ - if (tevent_thread_call_depth_ptr != NULL) { - *tevent_thread_call_depth_ptr = 0; - } - tevent_thread_call_depth_ptr = NULL; } void tevent_thread_call_depth_start(struct tevent_req *req) { - if (tevent_thread_call_depth_ptr != NULL) { - *tevent_thread_call_depth_ptr = req->internal.call_depth = 1; - } } void tevent_thread_call_depth_reset_from_req(struct tevent_req *req) { - if (tevent_thread_call_depth_ptr != NULL) { - *tevent_thread_call_depth_ptr = req->internal.call_depth; + _tevent_thread_call_depth_reset_from_req(req, NULL); +} + +void _tevent_thread_call_depth_reset_from_req(struct tevent_req *req, + const char *fname) +{ + if (tevent_thread_call_depth_state_g.cb != NULL) { + tevent_thread_call_depth_state_g.cb( + tevent_thread_call_depth_state_g.cb_private, + TEVENT_CALL_FLOW_REQ_RESET, + req, + req->internal.call_depth, + fname); } } -_PRIVATE_ void tevent_thread_call_depth_set(size_t depth) +void tevent_thread_call_depth_set_callback(tevent_call_depth_callback_t f, + void *private_data) { - if (tevent_thread_call_depth_ptr != NULL) { - *tevent_thread_call_depth_ptr = depth; + /* In case of deactivation, make sure that call depth is set to 0 */ + if (tevent_thread_call_depth_state_g.cb != NULL) { + tevent_thread_call_depth_state_g.cb( + tevent_thread_call_depth_state_g.cb_private, + TEVENT_CALL_FLOW_REQ_RESET, + NULL, + 0, + "tevent_thread_call_depth_set_callback"); } + tevent_thread_call_depth_state_g = (struct tevent_thread_call_depth_state) + { + .cb = f, + .cb_private = private_data, + }; }
View file
_service:tar_scm:tevent-0.16.0.tar.gz/tevent_dlinklist.h
Added
@@ -0,0 +1,198 @@ +/* + Unix SMB/CIFS implementation. + some simple double linked list macros + + Copyright (C) Andrew Tridgell 1998-2010 + + ** NOTE! The following LGPL license applies to this file (*dlinklist.h). + ** This does NOT imply that all of Samba is released under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ + +/* To use these macros you must have a structure containing a next and + prev pointer */ + +#ifndef _DLINKLIST_H +#define _DLINKLIST_H + +/* + February 2010 - changed list format to have a prev pointer from the + list head. This makes DLIST_ADD_END() O(1) even though we only have + one list pointer. + + The scheme is as follows: + + 1) with no entries in the list: + list_head == NULL + + 2) with 1 entry in the list: + list_head->next == NULL + list_head->prev == list_head + + 3) with 2 entries in the list: + list_head->next == element2 + list_head->prev == element2 + element2->prev == list_head + element2->next == NULL + + 4) with N entries in the list: + list_head->next == element2 + list_head->prev == elementN + elementN->prev == element{N-1} + elementN->next == NULL + + This allows us to find the tail of the list by using + list_head->prev, which means we can add to the end of the list in + O(1) time + */ + + +/* + add an element at the front of a list +*/ +#define DLIST_ADD(list, p) \ +do { \ + if (!(list)) { \ + (p)->prev = (list) = (p); \ + (p)->next = NULL; \ + } else { \ + (p)->prev = (list)->prev; \ + (list)->prev = (p); \ + (p)->next = (list); \ + (list) = (p); \ + } \ +} while (0) + +/* + remove an element from a list + Note that the element doesn't have to be in the list. If it + isn't then this is a no-op +*/ +#define DLIST_REMOVE(list, p) \ +do { \ + if ((p) == (list)) { \ + if ((p)->next) (p)->next->prev = (p)->prev; \ + (list) = (p)->next; \ + } else if ((p)->prev && (list) && (p) == (list)->prev) { \ + (p)->prev->next = NULL; \ + (list)->prev = (p)->prev; \ + } else { \ + if ((p)->prev) (p)->prev->next = (p)->next; \ + if ((p)->next) (p)->next->prev = (p)->prev; \ + } \ + if ((p) != (list)) (p)->next = (p)->prev = NULL; \ +} while (0) + +/* + find the head of the list given any element in it. + Note that this costs O(N), so you should avoid this macro + if at all possible! +*/ +#define DLIST_HEAD(p, result_head) \ +do { \ + (result_head) = (p); \ + while (DLIST_PREV(result_head)) (result_head) = (result_head)->prev; \ +} while(0) + +/* return the last element in the list */ +#define DLIST_TAIL(list) ((list)?(list)->prev:NULL) + +/* return the previous element in the list. */ +#define DLIST_PREV(p) (((p)->prev && (p)->prev->next != NULL)?(p)->prev:NULL) + +/* insert 'p' after the given element 'el' in a list. If el is NULL then + this is the same as a DLIST_ADD() */ +#define DLIST_ADD_AFTER(list, p, el) \ +do { \ + if (!(list) || !(el)) { \ + DLIST_ADD(list, p); \ + } else { \ + (p)->prev = (el); \ + (p)->next = (el)->next; \ + (el)->next = (p); \ + if ((p)->next) (p)->next->prev = (p); \ + if ((list)->prev == (el)) (list)->prev = (p); \ + }\ +} while (0) + + +/* + add to the end of a list. +*/ +#define DLIST_ADD_END(list, p) \ +do { \ + if (!(list)) { \ + DLIST_ADD(list, p); \ + } else { \ + DLIST_ADD_AFTER(list, p, (list)->prev); \ + } \ +} while (0) + +/* promote an element to the front of a list */ +#define DLIST_PROMOTE(list, p) \ +do { \ + DLIST_REMOVE(list, p); \ + DLIST_ADD(list, p); \ +} while (0) + +/* + demote an element to the end of a list. +*/ +#define DLIST_DEMOTE(list, p) \ +do { \ + DLIST_REMOVE(list, p); \ + DLIST_ADD_END(list, p); \ +} while (0) + +/* + * like DLIST_DEMOTE(), but optimized + * for short lists with 0, 1 or 2 elements + */ +#define DLIST_DEMOTE_SHORT(list, p) \ +do { \ + if ((list) == NULL) { \ + /* no reason to demote, just add */ \ + DLIST_ADD(list, p); \ + } else if ((list)->prev == (p)) { \ + /* optimize if p is last */ \ + } else if ((list) == (p)) { \ + /* optimize if p is first */ \ + (list)->prev->next = (p); \ + (list) = (p)->next; \ + (p)->next = NULL; \ + } else { \ + DLIST_DEMOTE(list, p); \ + } \ +} while (0) + +/* + concatenate two lists - putting all elements of the 2nd list at the + end of the first list. +*/ +#define DLIST_CONCATENATE(list1, list2) \ +do { \ + if (!(list1)) { \ + (list1) = (list2); \ + } else { \ + (list1)->prev->next = (list2); \ + if (list2) { \ + void *_tmplist = (void *)(list1)->prev; \ + (list1)->prev = (list2)->prev; \ + (list2)->prev = _tmplist; \ + } \ + } \ +} while (0) + +#endif /* _DLINKLIST_H */
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent_epoll.c -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent_epoll.c
Changed
@@ -36,7 +36,7 @@ /* a pointer back to the generic event_context */ struct tevent_context *ev; - /* when using epoll this is the handle from epoll_create */ + /* when using epoll this is the handle from epoll_create1(2) */ int epoll_fd; pid_t pid; @@ -47,17 +47,15 @@ }; #define EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT (1<<0) -#define EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR (1<<1) -#define EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR (1<<2) -#define EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX (1<<3) +#define EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR (1<<1) #ifdef TEST_PANIC_FALLBACK -static int epoll_create_panic_fallback(struct epoll_event_context *epoll_ev, - int size) +static int epoll_create1_panic_fallback(struct epoll_event_context *epoll_ev, + int flags) { if (epoll_ev->panic_fallback == NULL) { - return epoll_create(size); + return epoll_create1(flags); } /* 50% of the time, fail... */ @@ -66,7 +64,7 @@ return -1; } - return epoll_create(size); + return epoll_create1(flags); } static int epoll_ctl_panic_fallback(struct epoll_event_context *epoll_ev, @@ -105,8 +103,8 @@ return epoll_wait(epfd, events, maxevents, timeout); } -#define epoll_create(_size) \ - epoll_create_panic_fallback(epoll_ev, _size) +#define epoll_create1(_flags) \ + epoll_create1_panic_fallback(epoll_ev, _flags) #define epoll_ctl(_epfd, _op, _fd, _event) \ epoll_ctl_panic_fallback(epoll_ev,_epfd, _op, _fd, _event) #define epoll_wait(_epfd, _events, _maxevents, _timeout) \ @@ -174,8 +172,27 @@ static uint32_t epoll_map_flags(uint16_t flags) { uint32_t ret = 0; - if (flags & TEVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP); - if (flags & TEVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP); + + /* + * we do not need to specify EPOLLERR | EPOLLHUP + * they are always reported. + */ + + if (flags & TEVENT_FD_READ) { + /* + * Note that EPOLLRDHUP always + * returns EPOLLIN in addition, + * so EPOLLRDHUP is not strictly needed, + * but we want to make it explicit. + */ + ret |= EPOLLIN | EPOLLRDHUP; + } + if (flags & TEVENT_FD_WRITE) { + ret |= EPOLLOUT; + } + if (flags & TEVENT_FD_ERROR) { + ret |= EPOLLRDHUP; + } return ret; } @@ -194,18 +211,14 @@ */ static int epoll_init_ctx(struct epoll_event_context *epoll_ev) { - epoll_ev->epoll_fd = epoll_create(64); + epoll_ev->epoll_fd = epoll_create1(EPOLL_CLOEXEC); if (epoll_ev->epoll_fd == -1) { tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL, - "Failed to create epoll handle.\n"); + "Failed to create epoll handle (%s).\n", + strerror(errno)); return -1; } - if (!ev_set_close_on_exec(epoll_ev->epoll_fd)) { - tevent_debug(epoll_ev->ev, TEVENT_DEBUG_WARNING, - "Failed to set close-on-exec, file descriptor may be leaked to children.\n"); - } - epoll_ev->pid = tevent_cached_getpid(); talloc_set_destructor(epoll_ev, epoll_ctx_destructor); @@ -231,21 +244,24 @@ } close(epoll_ev->epoll_fd); - epoll_ev->epoll_fd = epoll_create(64); + epoll_ev->epoll_fd = epoll_create1(EPOLL_CLOEXEC); if (epoll_ev->epoll_fd == -1) { epoll_panic(epoll_ev, "epoll_create() failed", false); return; } - if (!ev_set_close_on_exec(epoll_ev->epoll_fd)) { - tevent_debug(epoll_ev->ev, TEVENT_DEBUG_WARNING, - "Failed to set close-on-exec, file descriptor may be leaked to children.\n"); - } - epoll_ev->pid = pid; epoll_ev->panic_state = &panic_triggered; for (fde=epoll_ev->ev->fd_events;fde;fde=fde->next) { + /* + * We leave the mpx mappings alive + * so that we'll just re-add events for + * the existing primary events in the loop + * below. + */ fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; + } + for (fde=epoll_ev->ev->fd_events;fde;fde=fde->next) { epoll_update_event(epoll_ev, fde); if (panic_triggered) { @@ -261,7 +277,7 @@ /* epoll cannot add the same file descriptor twice, once with read, once with write which is allowed by the - tevent backend. Multiplex the existing fde, flag it + tevent poll backend. Multiplex the existing fde, flag it as such so we can search for the correct fde on event triggering. */ @@ -269,86 +285,88 @@ static int epoll_add_multiplex_fd(struct epoll_event_context *epoll_ev, struct tevent_fd *add_fde) { + struct tevent_fd *primary = NULL; + uint16_t effective_flags; struct epoll_event event; - struct tevent_fd *mpx_fde; + uint64_t clear_flags = 0; + uint64_t add_flags = 0; int ret; - /* Find the existing fde that caused the EEXIST error. */ - for (mpx_fde = epoll_ev->ev->fd_events; mpx_fde; mpx_fde = mpx_fde->next) { - if (mpx_fde->fd != add_fde->fd) { - continue; - } - - if (mpx_fde == add_fde) { - continue; - } - - break; - } - if (mpx_fde == NULL) { - tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL, - "can't find multiplex fde for fd%d", - add_fde->fd); + /* + * Check if there is another fde we can attach to + */ + primary = tevent_common_fd_mpx_add(add_fde); + if (primary == NULL) { + /* the caller calls epoll_panic() */ return -1; } - if (mpx_fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX) { - /* Logic error. Can't have more than 2 multiplexed fde's. */ - tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL, - "multiplex fde for fd%d is already multiplexed\n", - mpx_fde->fd); - return -1; + /* + * First propagate the HAS_EVENT flag from + * the primary to all others (mainly add_fde) + */ + if (primary->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT) { + add_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; + tevent_common_fd_mpx_additional_flags(primary, 0, add_flags); } /* - * The multiplex fde must have the same fd, and also - * already have an epoll event attached. + * Update the mpx internals and check if + * there is an update needed. */ - if (!(mpx_fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT)) { - /* Logic error. Can't have more than 2 multiplexed fde's. */ - tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL, - "multiplex fde for fd%d has no event\n", - mpx_fde->fd); - return -1; + primary = tevent_common_fd_mpx_update(primary); + if (primary == NULL) { + /* + * It seems the primary was already + * watching (at least) the same flags + * as add_fde, so we are done. + */ + return 0; } - /* Modify the mpx_fde to add in the new flags. */ + /* + * Before me modify the low level epoll state, + * we clear HAS_EVENT on all fdes. + */ + clear_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; + tevent_common_fd_mpx_additional_flags(primary, clear_flags, 0); + + effective_flags = tevent_common_fd_mpx_flags(primary); + + /* + * Modify the low level epoll state to reflect + * the effective flags we want to monitor. + */ ZERO_STRUCT(event); - event.events = epoll_map_flags(mpx_fde->flags); - event.events |= epoll_map_flags(add_fde->flags); - event.data.ptr = mpx_fde; - ret = epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_MOD, mpx_fde->fd, &event); + event.events = epoll_map_flags(effective_flags); + event.data.ptr = primary; + ret = epoll_ctl(epoll_ev->epoll_fd, + EPOLL_CTL_MOD, + primary->fd, + &event); if (ret != 0 && errno == EBADF) { - tevent_debug(epoll_ev->ev, TEVENT_DEBUG_ERROR, + struct tevent_common_fd_buf pbuf = {}; + TEVENT_DEBUG(epoll_ev->ev, TEVENT_DEBUG_ERROR, "EPOLL_CTL_MOD EBADF for " - "add_fde%p mpx_fde%p fd%d - disabling\n", - add_fde, mpx_fde, add_fde->fd); - DLIST_REMOVE(epoll_ev->ev->fd_events, mpx_fde); - mpx_fde->wrapper = NULL; - mpx_fde->event_ctx = NULL; - DLIST_REMOVE(epoll_ev->ev->fd_events, add_fde); - add_fde->wrapper = NULL; - add_fde->event_ctx = NULL; + "%s - disabling\n", + tevent_common_fd_str(&pbuf, "primary", primary)); + tevent_common_fd_mpx_disarm_all(primary); return 0; } else if (ret != 0) { + struct tevent_common_fd_buf pbuf = {}; + TEVENT_DEBUG(epoll_ev->ev, TEVENT_DEBUG_FATAL, + "EPOLL_CTL_MOD for %s - failed - %s", + tevent_common_fd_str(&pbuf, "primary", primary), + strerror(errno)); + /* the caller calls epoll_panic() */ return ret; } /* - * Make each fde->additional_data pointers point at each other - * so we can look them up from each other. They are now paired. + * Finally re-add HAS_EVENT to all fdes */ - mpx_fde->additional_data = (struct tevent_fd *)add_fde; - add_fde->additional_data = (struct tevent_fd *)mpx_fde; - - /* Now flag both fde's as being multiplexed. */ - mpx_fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX; - add_fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX; - - /* we need to keep the GOT_ERROR flag */ - if (mpx_fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR) { - add_fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR; - } + add_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; + tevent_common_fd_mpx_additional_flags(primary, 0, add_flags); return 0; } @@ -356,126 +374,121 @@ /* add the epoll event to the given fd_event */ -static void epoll_add_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde) +static void epoll_add_event(struct epoll_event_context *epoll_ev, + struct tevent_fd *_primary) { + struct tevent_fd *primary = tevent_common_fd_mpx_primary(_primary); + uint16_t effective_flags = tevent_common_fd_mpx_flags(primary); struct epoll_event event; + uint64_t clear_flags = 0; + uint64_t add_flags = 0; int ret; - struct tevent_fd *mpx_fde = NULL; - - fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; - fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; - if (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX) { - /* - * This is a multiplexed fde, we need to include both - * flags in the modified event. - */ - mpx_fde = talloc_get_type_abort(fde->additional_data, - struct tevent_fd); - - mpx_fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; - mpx_fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; - } + /* + * Before me modify the low level epoll state, + * we clear HAS_EVENT on all fdes. + */ + clear_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; + tevent_common_fd_mpx_additional_flags(primary, clear_flags, 0); + /* + * Modify the low level epoll state to reflect + * the effective flags we want to monitor. + * + * Most likely we won't trigger the EEXIST + * case, so it's much cheaper to try and + * react on EEXIST if needed, than to always + * scan the list of all existing events. + */ ZERO_STRUCT(event); - event.events = epoll_map_flags(fde->flags); - if (mpx_fde != NULL) { - event.events |= epoll_map_flags(mpx_fde->flags); - } - event.data.ptr = fde; - ret = epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_ADD, fde->fd, &event); + event.events = epoll_map_flags(effective_flags); + event.data.ptr = primary; + ret = epoll_ctl(epoll_ev->epoll_fd, + EPOLL_CTL_ADD, + primary->fd, + &event); if (ret != 0 && errno == EBADF) { - tevent_debug(epoll_ev->ev, TEVENT_DEBUG_ERROR, + struct tevent_common_fd_buf pbuf = {}; + TEVENT_DEBUG(epoll_ev->ev, TEVENT_DEBUG_ERROR, "EPOLL_CTL_ADD EBADF for " - "fde%p mpx_fde%p fd%d - disabling\n", - fde, mpx_fde, fde->fd); - DLIST_REMOVE(epoll_ev->ev->fd_events, fde); - fde->wrapper = NULL; - fde->event_ctx = NULL; - if (mpx_fde != NULL) { - DLIST_REMOVE(epoll_ev->ev->fd_events, mpx_fde); - mpx_fde->wrapper = NULL; - mpx_fde->event_ctx = NULL; - } + "%s - disabling\n", + tevent_common_fd_str(&pbuf, "primary", primary)); + tevent_common_fd_mpx_disarm_all(primary); return; - } else if (ret != 0 && errno == EEXIST && mpx_fde == NULL) { - ret = epoll_add_multiplex_fd(epoll_ev, fde); + } else if (ret != 0 && errno == EEXIST) { + ret = epoll_add_multiplex_fd(epoll_ev, primary); if (ret != 0) { epoll_panic(epoll_ev, "epoll_add_multiplex_fd failed", false); return; } + /* + * epoll_add_multiplex_fd() already + * added EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT + */ + return; } else if (ret != 0) { epoll_panic(epoll_ev, "EPOLL_CTL_ADD failed", false); return; } - fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; - /* only if we want to read we want to tell the event handler about errors */ - if (fde->flags & TEVENT_FD_READ) { - fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; - } - - if (mpx_fde == NULL) { - return; - } - - mpx_fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; - /* only if we want to read we want to tell the event handler about errors */ - if (mpx_fde->flags & TEVENT_FD_READ) { - mpx_fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; - } + /* + * Finally re-add HAS_EVENT to all fdes + */ + add_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; + tevent_common_fd_mpx_additional_flags(primary, 0, add_flags); } /* delete the epoll event for given fd_event */ -static void epoll_del_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde) +static void epoll_del_event(struct epoll_event_context *epoll_ev, + struct tevent_fd *_primary) { + struct tevent_fd *primary = tevent_common_fd_mpx_primary(_primary); struct epoll_event event; + uint64_t clear_flags = 0; int ret; - struct tevent_fd *mpx_fde = NULL; - fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; - fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; - - if (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX) { - /* - * This is a multiplexed fde, we need to modify both events. - */ - mpx_fde = talloc_get_type_abort(fde->additional_data, - struct tevent_fd); - - mpx_fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; - mpx_fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; - } + /* + * Before me delete the low level epoll state, + * we clear HAS_EVENT on all fdes. + */ + clear_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; + tevent_common_fd_mpx_additional_flags(primary, clear_flags, 0); + /* + * Delete the low level epoll state to reflect + * the effective flags we want to monitor. + */ ZERO_STRUCT(event); - ret = epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_DEL, fde->fd, &event); + ret = epoll_ctl(epoll_ev->epoll_fd, + EPOLL_CTL_DEL, + primary->fd, + &event); if (ret != 0 && errno == ENOENT) { + struct tevent_common_fd_buf pbuf = {}; /* * This can happen after a epoll_check_reopen * within epoll_event_fd_destructor. */ - tevent_debug(epoll_ev->ev, TEVENT_DEBUG_TRACE, - "EPOLL_CTL_DEL ignoring ENOENT for fd%d\n", - fde->fd); + TEVENT_DEBUG(epoll_ev->ev, TEVENT_DEBUG_TRACE, + "EPOLL_CTL_DEL ignoring ENOENT for %s\n", + tevent_common_fd_str(&pbuf, "primary", primary)); return; } else if (ret != 0 && errno == EBADF) { - tevent_debug(epoll_ev->ev, TEVENT_DEBUG_WARNING, - "EPOLL_CTL_DEL EBADF for " - "fde%p mpx_fde%p fd%d - disabling\n", - fde, mpx_fde, fde->fd); - DLIST_REMOVE(epoll_ev->ev->fd_events, fde); - fde->wrapper = NULL; - fde->event_ctx = NULL; - if (mpx_fde != NULL) { - DLIST_REMOVE(epoll_ev->ev->fd_events, mpx_fde); - mpx_fde->wrapper = NULL; - mpx_fde->event_ctx = NULL; - } + struct tevent_common_fd_buf pbuf = {}; + TEVENT_DEBUG(epoll_ev->ev, TEVENT_DEBUG_WARNING, + "EPOLL_CTL_DEL EBADF for %s - disabling\n", + tevent_common_fd_str(&pbuf, "primary", primary)); + tevent_common_fd_mpx_disarm_all(primary); return; } else if (ret != 0) { + struct tevent_common_fd_buf pbuf = {}; + TEVENT_DEBUG(epoll_ev->ev, TEVENT_DEBUG_FATAL, + "EPOLL_CTL_DEL for %s - failed - %s", + tevent_common_fd_str(&pbuf, "primary", primary), + strerror(errno)); epoll_panic(epoll_ev, "EPOLL_CTL_DEL failed", false); return; } @@ -484,97 +497,72 @@ /* change the epoll event to the given fd_event */ -static void epoll_mod_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde) +static void epoll_mod_event(struct epoll_event_context *epoll_ev, + struct tevent_fd *_primary) { - struct tevent_fd *mpx_fde = NULL; + struct tevent_fd *primary = tevent_common_fd_mpx_primary(_primary); + uint16_t effective_flags = tevent_common_fd_mpx_flags(primary); struct epoll_event event; + uint64_t clear_flags = 0; + uint64_t add_flags = 0; int ret; - fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; - fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; - - if (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX) { - /* - * This is a multiplexed fde, we need to include both - * flags in the modified event. - */ - mpx_fde = talloc_get_type_abort(fde->additional_data, - struct tevent_fd); - - mpx_fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; - mpx_fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; - } + /* + * Before me modify the low level epoll state, + * we clear HAS_EVENT on all fdes. + */ + clear_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; + tevent_common_fd_mpx_additional_flags(primary, clear_flags, 0); + /* + * Modify the low level epoll state to reflect + * the effective flags we want to monitor. + */ ZERO_STRUCT(event); - event.events = epoll_map_flags(fde->flags); - if (mpx_fde != NULL) { - event.events |= epoll_map_flags(mpx_fde->flags); - } - event.data.ptr = fde; - ret = epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_MOD, fde->fd, &event); + event.events = epoll_map_flags(effective_flags); + event.data.ptr = primary; + ret = epoll_ctl(epoll_ev->epoll_fd, + EPOLL_CTL_MOD, + primary->fd, + &event); if (ret != 0 && errno == EBADF) { - tevent_debug(epoll_ev->ev, TEVENT_DEBUG_ERROR, - "EPOLL_CTL_MOD EBADF for " - "fde%p mpx_fde%p fd%d - disabling\n", - fde, mpx_fde, fde->fd); - DLIST_REMOVE(epoll_ev->ev->fd_events, fde); - fde->wrapper = NULL; - fde->event_ctx = NULL; - if (mpx_fde != NULL) { - DLIST_REMOVE(epoll_ev->ev->fd_events, mpx_fde); - mpx_fde->wrapper = NULL; - mpx_fde->event_ctx = NULL; - } + struct tevent_common_fd_buf pbuf = {}; + TEVENT_DEBUG(epoll_ev->ev, TEVENT_DEBUG_ERROR, + "EPOLL_CTL_MOD EBADF for %s - disabling\n", + tevent_common_fd_str(&pbuf, "primary", primary)); + tevent_common_fd_mpx_disarm_all(primary); return; } else if (ret != 0) { + struct tevent_common_fd_buf pbuf = {}; + TEVENT_DEBUG(epoll_ev->ev, TEVENT_DEBUG_FATAL, + "EPOLL_CTL_MOD for %s - failed - %s", + tevent_common_fd_str(&pbuf, "primary", primary), + strerror(errno)); epoll_panic(epoll_ev, "EPOLL_CTL_MOD failed", false); return; } - fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; - /* only if we want to read we want to tell the event handler about errors */ - if (fde->flags & TEVENT_FD_READ) { - fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; - } - - if (mpx_fde == NULL) { - return; - } - - mpx_fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; - /* only if we want to read we want to tell the event handler about errors */ - if (mpx_fde->flags & TEVENT_FD_READ) { - mpx_fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; - } + /* + * Finally re-add HAS_EVENT to all fdes + */ + add_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; + tevent_common_fd_mpx_additional_flags(primary, 0, add_flags); } static void epoll_update_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde) { - bool got_error = (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR); - bool want_read = (fde->flags & TEVENT_FD_READ); - bool want_write= (fde->flags & TEVENT_FD_WRITE); - struct tevent_fd *mpx_fde = NULL; - - if (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX) { - /* - * work out what the multiplexed fde wants. - */ - mpx_fde = talloc_get_type_abort(fde->additional_data, - struct tevent_fd); - - if (mpx_fde->flags & TEVENT_FD_READ) { - want_read = true; - } - - if (mpx_fde->flags & TEVENT_FD_WRITE) { - want_write = true; - } - } + struct tevent_fd *primary = tevent_common_fd_mpx_primary(fde); + uint64_t _paf = primary->additional_flags; + bool got_error = (_paf & EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR); + uint16_t effective_flags = tevent_common_fd_mpx_flags(primary); + bool want_read = (effective_flags & TEVENT_FD_READ); + bool want_write= (effective_flags & TEVENT_FD_WRITE); + bool want_error= (effective_flags & TEVENT_FD_ERROR); /* there's already an event */ - if (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT) { - if (want_read || (want_write && !got_error)) { - epoll_mod_event(epoll_ev, fde); + if (primary->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT) { + if (want_read || want_error || (want_write && !got_error)) { + epoll_mod_event(epoll_ev, primary); return; } /* @@ -583,50 +571,18 @@ * * this is because epoll reports EPOLLERR and EPOLLHUP, even without asking for them */ - epoll_del_event(epoll_ev, fde); + epoll_del_event(epoll_ev, primary); return; } /* there's no epoll_event attached to the fde */ - if (want_read || (want_write && !got_error)) { - epoll_add_event(epoll_ev, fde); + if (want_read || want_error || (want_write && !got_error)) { + epoll_add_event(epoll_ev, primary); return; } } /* - Cope with epoll returning EPOLLHUP|EPOLLERR on an event. - Return true if there's nothing else to do, false if - this event needs further handling. -*/ -static bool epoll_handle_hup_or_err(struct epoll_event_context *epoll_ev, - struct tevent_fd *fde) -{ - if (fde == NULL) { - /* Nothing to do if no event. */ - return true; - } - - fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR; - /* - * if we only wait for TEVENT_FD_WRITE, we should not tell the - * event handler about it, and remove the epoll_event, - * as we only report errors when waiting for read events, - * to match the select() behavior - */ - if (!(fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR)) { - /* - * Do the same as the poll backend and - * remove the writeable flag. - */ - fde->flags &= ~TEVENT_FD_WRITE; - return true; - } - /* This has TEVENT_FD_READ set, we're not finished. */ - return false; -} - -/* event loop handling using epoll */ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval *tvalp) @@ -672,70 +628,74 @@ for (i=0;i<ret;i++) { struct tevent_fd *fde = talloc_get_type(eventsi.data.ptr, struct tevent_fd); + struct tevent_fd *selected = NULL; + uint16_t effective_flags; uint16_t flags = 0; - struct tevent_fd *mpx_fde = NULL; + bool got_error = false; if (fde == NULL) { epoll_panic(epoll_ev, "epoll_wait() gave bad data", true); return -1; } - if (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX) { - /* - * Save off the multiplexed event in case we need - * to use it to call the handler function. - */ - mpx_fde = talloc_get_type_abort(fde->additional_data, - struct tevent_fd); - } - if (eventsi.events & (EPOLLHUP|EPOLLERR)) { - bool handled_fde = epoll_handle_hup_or_err(epoll_ev, fde); - bool handled_mpx = epoll_handle_hup_or_err(epoll_ev, mpx_fde); + effective_flags = tevent_common_fd_mpx_flags(fde); + if (eventsi.events & (EPOLLHUP|EPOLLERR|EPOLLRDHUP)) { + uint64_t add_flags = 0; - if (handled_fde && handled_mpx) { - epoll_update_event(epoll_ev, fde); - continue; - } + add_flags |= EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR; + tevent_common_fd_mpx_additional_flags(fde, + 0, + add_flags); - if (!handled_mpx) { - /* - * If the mpx event was the one that needs - * further handling, it's the TEVENT_FD_READ - * event so switch over and call that handler. - */ - fde = mpx_fde; - mpx_fde = NULL; + if (effective_flags & TEVENT_FD_ERROR) { + flags |= TEVENT_FD_ERROR; + } + if (effective_flags & TEVENT_FD_READ) { + flags |= TEVENT_FD_READ; } - flags |= TEVENT_FD_READ; } - if (eventsi.events & EPOLLIN) flags |= TEVENT_FD_READ; - if (eventsi.events & EPOLLOUT) flags |= TEVENT_FD_WRITE; - - if (flags & TEVENT_FD_WRITE) { - if (fde->flags & TEVENT_FD_WRITE) { - mpx_fde = NULL; + if (eventsi.events & EPOLLIN) { + if (effective_flags & TEVENT_FD_READ) { + flags |= TEVENT_FD_READ; } - if (mpx_fde && mpx_fde->flags & TEVENT_FD_WRITE) { - fde = mpx_fde; - mpx_fde = NULL; + } + if (eventsi.events & EPOLLOUT) { + if (effective_flags & TEVENT_FD_WRITE) { + flags |= TEVENT_FD_WRITE; } } - if (mpx_fde) { - /* Ensure we got the right fde. */ - if ((flags & fde->flags) == 0) { - fde = mpx_fde; - mpx_fde = NULL; + if (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR) + { + got_error = true; + } + + selected = tevent_common_fd_mpx_select(fde, flags, got_error); + if (selected == NULL) { + if (got_error) { + /* + * if we only wait for TEVENT_FD_WRITE, we + * should not tell the event handler about it, + * and remove the epoll_event, as we only + * report errors when waiting for read events, + * to match the select() behavior + * + * Do the same as the poll backend and + * remove the writeable flag. + */ + tevent_common_fd_mpx_clear_writeable(fde); + epoll_update_event(epoll_ev, fde); } + continue; } /* * make sure we only pass the flags * the handler is expecting. */ - flags &= fde->flags; - if (flags) { - return tevent_common_invoke_fd_handler(fde, flags, NULL); - } + flags &= selected->flags; + return tevent_common_invoke_fd_handler(selected, + flags, + NULL); } return 0; @@ -775,13 +735,15 @@ */ static int epoll_event_fd_destructor(struct tevent_fd *fde) { + struct tevent_fd *old_primary = NULL; + struct tevent_fd *new_primary = NULL; + struct tevent_fd *update_primary = NULL; struct tevent_context *ev = fde->event_ctx; struct epoll_event_context *epoll_ev = NULL; bool panic_triggered = false; - struct tevent_fd *mpx_fde = NULL; - int flags = fde->flags; if (ev == NULL) { + tevent_common_fd_mpx_reinit(fde); return tevent_common_fd_destructor(fde); } @@ -795,35 +757,37 @@ */ DLIST_REMOVE(ev->fd_events, fde); - if (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX) { - mpx_fde = talloc_get_type_abort(fde->additional_data, - struct tevent_fd); - - fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX; - mpx_fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX; - - fde->additional_data = NULL; - mpx_fde->additional_data = NULL; - - fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; - } - epoll_ev->panic_state = &panic_triggered; - epoll_check_reopen(epoll_ev); - if (panic_triggered) { - return tevent_common_fd_destructor(fde); + if (epoll_ev->pid != tevent_cached_getpid()) { + epoll_check_reopen(epoll_ev); + if (panic_triggered) { + tevent_common_fd_mpx_reinit(fde); + return tevent_common_fd_destructor(fde); + } } - if (mpx_fde != NULL) { - epoll_update_event(epoll_ev, mpx_fde); + old_primary = tevent_common_fd_mpx_primary(fde); + + if (old_primary == fde) { + epoll_del_event(epoll_ev, fde); if (panic_triggered) { + tevent_common_fd_mpx_reinit(fde); return tevent_common_fd_destructor(fde); } } - fde->flags = 0; - epoll_update_event(epoll_ev, fde); - fde->flags = flags; + new_primary = tevent_common_fd_mpx_remove(fde); + if (new_primary == NULL) { + epoll_ev->panic_state = NULL; + return tevent_common_fd_destructor(fde); + } + update_primary = tevent_common_fd_mpx_update(new_primary); + if (update_primary == NULL) { + epoll_ev->panic_state = NULL; + return tevent_common_fd_destructor(fde); + } + + epoll_update_event(epoll_ev, update_primary); if (panic_triggered) { return tevent_common_fd_destructor(fde); } @@ -848,6 +812,7 @@ struct epoll_event_context); struct tevent_fd *fde; bool panic_triggered = false; + pid_t old_pid = epoll_ev->pid; fde = tevent_common_add_fd(ev, mem_ctx, fd, flags, handler, private_data, @@ -856,14 +821,24 @@ talloc_set_destructor(fde, epoll_event_fd_destructor); - epoll_ev->panic_state = &panic_triggered; - epoll_check_reopen(epoll_ev); - if (panic_triggered) { - return fde; + /* + * prepare for tevent_common_fd_mpx_flags() + * in epoll_update_event() + */ + tevent_common_fd_mpx_update_flags(fde); + + if (epoll_ev->pid != tevent_cached_getpid()) { + epoll_ev->panic_state = &panic_triggered; + epoll_check_reopen(epoll_ev); + if (panic_triggered) { + return fde; + } + epoll_ev->panic_state = NULL; } - epoll_ev->panic_state = NULL; - epoll_update_event(epoll_ev, fde); + if (epoll_ev->pid == old_pid) { + epoll_update_event(epoll_ev, fde); + } return fde; } @@ -876,23 +851,34 @@ struct tevent_context *ev; struct epoll_event_context *epoll_ev; bool panic_triggered = false; + pid_t old_pid; if (fde->flags == flags) return; ev = fde->event_ctx; epoll_ev = talloc_get_type_abort(ev->additional_data, struct epoll_event_context); + old_pid = epoll_ev->pid; fde->flags = flags; + /* + * prepare for tevent_common_fd_mpx_flags() + * in epoll_update_event() + */ + tevent_common_fd_mpx_update_flags(fde); - epoll_ev->panic_state = &panic_triggered; - epoll_check_reopen(epoll_ev); - if (panic_triggered) { - return; + if (epoll_ev->pid != tevent_cached_getpid()) { + epoll_ev->panic_state = &panic_triggered; + epoll_check_reopen(epoll_ev); + if (panic_triggered) { + return; + } + epoll_ev->panic_state = NULL; } - epoll_ev->panic_state = NULL; - epoll_update_event(epoll_ev, fde); + if (epoll_ev->pid == old_pid) { + epoll_update_event(epoll_ev, fde); + } } /* @@ -925,15 +911,17 @@ return 0; } - epoll_ev->panic_state = &panic_triggered; - epoll_ev->panic_force_replay = true; - epoll_check_reopen(epoll_ev); - if (panic_triggered) { - errno = EINVAL; - return -1; + if (epoll_ev->pid != tevent_cached_getpid()) { + epoll_ev->panic_state = &panic_triggered; + epoll_ev->panic_force_replay = true; + epoll_check_reopen(epoll_ev); + if (panic_triggered) { + errno = EINVAL; + return -1; + } + epoll_ev->panic_force_replay = false; + epoll_ev->panic_state = NULL; } - epoll_ev->panic_force_replay = false; - epoll_ev->panic_state = NULL; return epoll_event_loop(epoll_ev, &tval); }
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent_fd.c -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent_fd.c
Changed
@@ -29,14 +29,45 @@ #include "tevent_internal.h" #include "tevent_util.h" +_PRIVATE_ +const char *tevent_common_fd_str(struct tevent_common_fd_buf *buf, + const char *description, + const struct tevent_fd *fde) +{ + snprintf(buf->buf, sizeof(buf->buf), + "%sfde=%p," + "fd=%d,flags=0x%x(%s%s%s),%s", + description, fde, fde->fd, + fde->flags, + (fde->flags & TEVENT_FD_ERROR) ? "E" : "", + (fde->flags & TEVENT_FD_READ) ? "R" : "", + (fde->flags & TEVENT_FD_WRITE) ? "W" : "", + fde->handler_name); + return buf->buf; +} + int tevent_common_fd_destructor(struct tevent_fd *fde) { + struct tevent_fd *primary = NULL; + if (fde->destroyed) { tevent_common_check_double_free(fde, "tevent_fd double free"); goto done; } fde->destroyed = true; + /* + * The caller should have cleared it from any mpx relationship + */ + primary = tevent_common_fd_mpx_primary(fde); + if (primary != fde) { + tevent_abort(fde->event_ctx, + "tevent_common_fd_destructor: fde not mpx primary"); + } else if (fde->mpx.list != NULL) { + tevent_abort(fde->event_ctx, + "tevent_common_fd_destructor: fde has mpx fdes"); + } + if (fde->event_ctx) { tevent_trace_fd_callback(fde->event_ctx, fde, TEVENT_EVENT_TRACE_DETACH); DLIST_REMOVE(fde->event_ctx->fd_events, fde); @@ -88,6 +119,7 @@ tevent_trace_fd_callback(fde->event_ctx, fde, TEVENT_EVENT_TRACE_ATTACH); DLIST_ADD(ev->fd_events, fde); + tevent_common_fd_mpx_reinit(fde); talloc_set_destructor(fde, tevent_common_fd_destructor);
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent_immediate.c -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent_immediate.c
Changed
@@ -55,7 +55,7 @@ } if (im->handler_name != NULL) { - tevent_debug(im->event_ctx, TEVENT_DEBUG_TRACE, + TEVENT_DEBUG(im->event_ctx, TEVENT_DEBUG_TRACE, "Cancel immediate event %p \"%s\"\n", im, im->handler_name); } @@ -146,7 +146,7 @@ DLIST_ADD_END(ev->immediate_events, im); talloc_set_destructor(im, tevent_common_immediate_destructor); - tevent_debug(ev, TEVENT_DEBUG_TRACE, + TEVENT_DEBUG(ev, TEVENT_DEBUG_TRACE, "Schedule immediate event \"%s\": %p\n", handler_name, im); } @@ -162,7 +162,7 @@ *removed = false; } - tevent_debug(ev, TEVENT_DEBUG_TRACE, + TEVENT_DEBUG(ev, TEVENT_DEBUG_TRACE, "Run immediate event \"%s\": %p\n", im->handler_name, im);
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent_internal.h -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent_internal.h
Changed
@@ -44,6 +44,10 @@ * @brief Private data for the completion function */ void *private_data; + /** + * @brief The completion function name, for flow tracing. + */ + const char *fn_name; } async; /** @@ -71,7 +75,10 @@ * that is called when the tevent_req_cancel() function * was called. */ - tevent_req_cancel_fn private_cancel; + struct { + tevent_req_cancel_fn fn; + const char *fn_name; + } private_cancel; /** * @brief A function to cleanup the request @@ -82,6 +89,7 @@ */ struct { tevent_req_cleanup_fn fn; + const char *fn_name; enum tevent_req_state state; } private_cleanup; @@ -208,6 +216,14 @@ void *additional_data; /* custom tag that can be set by caller */ uint64_t tag; + struct tevent_fd_mpx { + struct tevent_fd_mpx *prev, *next; + struct tevent_fd *fde; + struct tevent_fd *primary; + struct tevent_fd_mpx *list; + uint16_t total_flags; + bool has_mpx; + } mpx; }; struct tevent_timer { @@ -280,6 +296,7 @@ }; struct tevent_debug_ops { + enum tevent_debug_level max_level; void (*debug)(void *context, enum tevent_debug_level level, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0); void *context; @@ -287,6 +304,13 @@ void tevent_debug(struct tevent_context *ev, enum tevent_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3,4); +#define TEVENT_DEBUG(__ev, __level, __fmt, ...) do { \ + if (unlikely((__ev) != NULL && \ + (__level) <= (__ev)->debug_ops.max_level)) \ + { \ + tevent_debug((__ev), (__level), (__fmt), __VA_ARGS__); \ + } \ +} while(0) void tevent_abort(struct tevent_context *ev, const char *reason); @@ -403,6 +427,14 @@ int tevent_common_loop_wait(struct tevent_context *ev, const char *location); +struct tevent_common_fd_buf { + char buf128; +}; + +const char *tevent_common_fd_str(struct tevent_common_fd_buf *buf, + const char *description, + const struct tevent_fd *fde); + int tevent_common_fd_destructor(struct tevent_fd *fde); struct tevent_fd *tevent_common_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx, @@ -499,7 +531,21 @@ bool replay)); #endif -void tevent_thread_call_depth_set(size_t depth); +static inline void tevent_thread_call_depth_notify( + enum tevent_thread_call_depth_cmd cmd, + struct tevent_req *req, + size_t depth, + const char *fname) +{ + if (tevent_thread_call_depth_state_g.cb != NULL) { + tevent_thread_call_depth_state_g.cb( + tevent_thread_call_depth_state_g.cb_private, + cmd, + req, + depth, + fname); + } +} void tevent_trace_point_callback(struct tevent_context *ev, enum tevent_trace_point); @@ -523,3 +569,382 @@ void tevent_trace_queue_callback(struct tevent_context *ev, struct tevent_queue_entry *qe, enum tevent_event_trace_point); + +#include "tevent_dlinklist.h" + +static inline void tevent_common_fd_mpx_reinit(struct tevent_fd *fde) +{ + fde->mpx = (struct tevent_fd_mpx) { .fde = fde, }; +} + +static inline void tevent_common_fd_disarm(struct tevent_fd *fde) +{ + if (fde->event_ctx != NULL) { + tevent_trace_fd_callback(fde->event_ctx, fde, + TEVENT_EVENT_TRACE_DETACH); + DLIST_REMOVE(fde->event_ctx->fd_events, fde); + fde->event_ctx = NULL; + } + tevent_common_fd_mpx_reinit(fde); + fde->wrapper = NULL; +} + +/* + * tevent_common_fd_mpx_primary() returns the fde that is responsible + * for the low level state. + * + * By default (when there's no multiplexing) it just returns 'any_fde'. + * + * Note it always returns a valid pointer. + */ +static inline +struct tevent_fd *tevent_common_fd_mpx_primary(struct tevent_fd *any_fde) +{ + struct tevent_fd *primary = NULL; + + if (any_fde->mpx.primary != NULL) { + primary = any_fde->mpx.primary; + } else { + primary = any_fde; + } + + return primary; +} + +/* + * tevent_common_fd_mpx_update_flags() needs to be called + * if update_fde->flags has changed. It is needed in + * order to let tevent_common_fd_mpx_flags() return a valid + * result. + */ +static inline +void tevent_common_fd_mpx_update_flags(struct tevent_fd *update_fde) +{ + struct tevent_fd *primary = tevent_common_fd_mpx_primary(update_fde); + struct tevent_fd_mpx *mpx = NULL; + uint16_t new_total_flags = 0; + + if (!primary->mpx.has_mpx) { + primary->mpx.total_flags = primary->flags; + return; + } + + for (mpx = primary->mpx.list; mpx != NULL; mpx = mpx->next) { + struct tevent_fd *mpx_fde = mpx->fde; + /* we don't care that mpx_fde might be == primary */ + new_total_flags |= mpx_fde->flags; + } + + primary->mpx.total_flags = new_total_flags; +} + +/* + * tevent_common_fd_mpx_flags() return the effective flags + * (TEVEND_FD_*) of the primary fde and all multiplexed fdes. + * + * Valid after tevent_common_fd_mpx_update_flags() was called + */ +static inline +uint16_t tevent_common_fd_mpx_flags(struct tevent_fd *any_fde) +{ + struct tevent_fd *primary = tevent_common_fd_mpx_primary(any_fde); + + return primary->mpx.total_flags; +} + +/* + * tevent_common_fd_mpx_clear_writeable() clears TEVENT_FD_WRITE + * from all fdes belonging together. + */ +static inline +void tevent_common_fd_mpx_clear_writeable(struct tevent_fd *any_fde) +{ + struct tevent_fd *primary = tevent_common_fd_mpx_primary(any_fde); + struct tevent_fd_mpx *mpx = NULL; + + primary->flags &= ~TEVENT_FD_WRITE; + + for (mpx = primary->mpx.list; mpx != NULL; mpx = mpx->next) { + struct tevent_fd *mpx_fde = mpx->fde; + /* we don't care that mpx_fde might be == primary */ + mpx_fde->flags &= ~TEVENT_FD_WRITE; + } + + primary->mpx.total_flags &= ~TEVENT_FD_WRITE; +} + +/* + * tevent_common_fd_mpx_additional_flags() modifies + * fde->additional_flags for all fdes belonging together. + */ +static inline +void tevent_common_fd_mpx_additional_flags(struct tevent_fd *any_fde, + uint64_t clear_flags, + uint64_t add_flags) +{ + struct tevent_fd *primary = tevent_common_fd_mpx_primary(any_fde); + struct tevent_fd_mpx *mpx = NULL; + + primary->additional_flags &= ~clear_flags; + primary->additional_flags |= add_flags; + + for (mpx = primary->mpx.list; mpx != NULL; mpx = mpx->next) { + struct tevent_fd *mpx_fde = mpx->fde; + /* we don't care that mpx_fde might be == primary */ + mpx_fde->additional_flags &= ~clear_flags; + mpx_fde->additional_flags |= add_flags; + } +} + +/* + * tevent_common_fd_mpx_disarm_all() detaches + * all fdes currently belonging together from each other + * and also from the tevent_context, which means their + * handler will never be called again. + */ +static inline +void tevent_common_fd_mpx_disarm_all(struct tevent_fd *any_fde) +{ + struct tevent_fd *primary = tevent_common_fd_mpx_primary(any_fde); + struct tevent_fd_mpx *mpx = NULL, *next = NULL; + + for (mpx = primary->mpx.list; mpx != NULL; mpx = next) { + struct tevent_fd *mpx_fde = mpx->fde; + + next = mpx->next; + DLIST_REMOVE(primary->mpx.list, mpx); + + if (mpx_fde == primary) { + /* primary is handled below */ + continue; + } + + tevent_common_fd_disarm(mpx_fde); + } + + tevent_common_fd_disarm(primary); +} + +/* + * tevent_common_fd_mpx_select() selects the handler that + * should be called for the given low level event. + * + * Note it's important to pass the primary fde! + */ +static inline +struct tevent_fd *tevent_common_fd_mpx_select(struct tevent_fd *primary, + uint16_t flags, + bool got_error) +{ + struct tevent_fd_mpx *mpx = NULL; + struct tevent_fd *selected = NULL; + + /* optimize for the single event case. */ + if (!primary->mpx.has_mpx) { + /* + * If we got an error, we won't report it if + * the caller only asked for TEVENT_FD_WRITE. + */ + if (got_error && + !(primary->flags & (TEVENT_FD_READ|TEVENT_FD_ERROR))) + { + return NULL; + } + + if (flags & primary->flags) { + return primary; + } + + return NULL; + } + + for (mpx = primary->mpx.list; mpx != NULL; mpx = mpx->next) { + struct tevent_fd *mpx_fde = mpx->fde; + + /* + * If we got an error, we won't report it if + * the caller only asked for TEVENT_FD_WRITE. + */ + if (got_error && + !(mpx_fde->flags & (TEVENT_FD_READ|TEVENT_FD_ERROR))) + { + continue; + } + + if (flags & mpx_fde->flags) { + selected = mpx_fde; + break; + } + } + + if (selected == NULL) { + return NULL; + } + + /* + * Maintain fairness and demote the just selected fde + */ + DLIST_DEMOTE_SHORT(primary->mpx.list, &selected->mpx); + return selected; +} + +/* + * tevent_common_fd_mpx_add() searches for an existing (active) fde + * for the same low level fd and adds the given 'add_fde' + * as multiplexed to the found fde. + * + * If another fde was found it is returned. + * NULL is returned to indicate no match + */ +static inline +struct tevent_fd *tevent_common_fd_mpx_add(struct tevent_fd *add_fde) +{ + struct tevent_context *ev = add_fde->event_ctx; + struct tevent_fd *add_primary = tevent_common_fd_mpx_primary(add_fde); + uint16_t add_flags = tevent_common_fd_mpx_flags(add_primary); + struct tevent_fd *mpx_fde = NULL; + struct tevent_fd *mpx_primary = NULL; + struct tevent_fd_mpx *tmp = NULL; + struct tevent_fd_mpx *next = NULL; + + /* Find the existing fde that caused the EEXIST error. */ + for (mpx_fde = ev->fd_events; mpx_fde; mpx_fde = mpx_fde->next) { + mpx_primary = tevent_common_fd_mpx_primary(mpx_fde); + + if (mpx_primary->fd != add_primary->fd) { + mpx_primary = NULL; + continue; + } + + if (mpx_primary == add_primary) { + mpx_primary = NULL; + continue; + } + + if (add_flags != 0 && + tevent_common_fd_mpx_flags(mpx_primary) == 0) + { + /* + * only active events should match + */ + mpx_primary = NULL; + continue; + } + break; + } + if (mpx_primary == NULL) { + tevent_debug(ev, TEVENT_DEBUG_FATAL, + "can't find multiplex fde for fd%d", + add_fde->fd); + return NULL; + } + + /* + * If add_primary is not in it's own list + * we add it in order to simplify the loop below. + */ + + if (add_primary->mpx.prev == NULL && add_primary->mpx.next == NULL) { + DLIST_ADD_END(add_primary->mpx.list, &add_primary->mpx); + } + + /* + * Add the new mpx_primary to its own list before others, + * if it is not already added. + */ + if (mpx_primary->mpx.prev == NULL && mpx_primary->mpx.next == NULL) { + DLIST_ADD_END(mpx_primary->mpx.list, &mpx_primary->mpx); + } + + /* + * Now we clear all entries and move them to the + * new primary + */ + for (tmp = add_primary->mpx.list; tmp != NULL; tmp = next) { + struct tevent_fd *tmp_fde = tmp->fde; + + next = tmp->next; + + DLIST_REMOVE(add_primary->mpx.list, tmp); + tevent_common_fd_mpx_reinit(tmp_fde); + DLIST_ADD_END(mpx_primary->mpx.list, tmp); + tmp->primary = mpx_primary; + tmp->has_mpx = true; + } + + mpx_primary->mpx.has_mpx = true; + return mpx_primary; +} + +/* + * tevent_common_fd_mpx_update() calls tevent_common_fd_mpx_update_flags() + * and compares tevent_common_fd_mpx_flags() before and after. + * + * When there's a low level update needed the primary fde, + * otherwise NULL is returned. + */ +static inline +struct tevent_fd *tevent_common_fd_mpx_update(struct tevent_fd *update_fde) +{ + struct tevent_fd *primary = tevent_common_fd_mpx_primary(update_fde); + uint16_t old_total_flags; + uint16_t new_total_flags; + + old_total_flags = primary->mpx.total_flags; + tevent_common_fd_mpx_update_flags(primary); + new_total_flags = primary->mpx.total_flags; + + if (old_total_flags == new_total_flags) { + /* No update needed */ + return NULL; + } + + return primary; +} + +/* + * tevent_common_fd_mpx_remove() removes remove_fde from its possible primary, + * if remove_fde is a primary itself, a new primary is selected. + * + * The remaining primary or NULL is returned. + */ +static inline +struct tevent_fd *tevent_common_fd_mpx_remove(struct tevent_fd *remove_fde) +{ + struct tevent_fd *primary = tevent_common_fd_mpx_primary(remove_fde); + struct tevent_fd_mpx *mpx = NULL, *next = NULL; + struct tevent_fd *new_primary = NULL; + + DLIST_REMOVE(primary->mpx.list, &remove_fde->mpx); + + if (primary != remove_fde) { + tevent_common_fd_mpx_reinit(remove_fde); + return primary; + } + + for (mpx = primary->mpx.list; mpx != NULL; mpx = next) { + struct tevent_fd *mpx_fde = mpx->fde; + + next = mpx->next; + + DLIST_REMOVE(primary->mpx.list, &mpx_fde->mpx); + tevent_common_fd_mpx_reinit(mpx_fde); + mpx->primary = new_primary; + if (new_primary == NULL) { + /* + * Select the first one as the new primary and add + * itself as the first mpx-fde to the mpx list + */ + new_primary = mpx_fde; + DLIST_ADD(new_primary->mpx.list, &mpx_fde->mpx); + continue; + } + new_primary->mpx.has_mpx = true; + mpx->has_mpx = true; + DLIST_ADD_END(new_primary->mpx.list, &mpx_fde->mpx); + } + + /* primary == remove_fde */ + tevent_common_fd_mpx_reinit(primary); + return new_primary; +}
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent_poll.c -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent_poll.c
Changed
@@ -170,6 +170,7 @@ size_t num_fdes; fde->additional_flags = UINT64_MAX; + tevent_common_fd_mpx_reinit(fde); talloc_set_destructor(fde, poll_event_fd_destructor); if (fde->flags == 0) { @@ -255,6 +256,43 @@ } /* + map from TEVENT_FD_* to POLLIN/POLLOUT +*/ +static uint16_t poll_map_flags(uint16_t flags) +{ + uint16_t pollflags = 0; + + /* + * we do not need to specify POLLERR | POLLHUP + * they are always reported. + */ + + if (flags & TEVENT_FD_READ) { + pollflags |= POLLIN; +#ifdef POLLRDHUP + /* + * Note that at least on Linux + * POLLRDHUP always returns + * POLLIN in addition, so this + * is not strictly needed, but + * we want to make it explicit. + */ + pollflags |= POLLRDHUP; +#endif + } + if (flags & TEVENT_FD_WRITE) { + pollflags |= POLLOUT; + } + if (flags & TEVENT_FD_ERROR) { +#ifdef POLLRDHUP + pollflags |= POLLRDHUP; +#endif + } + + return pollflags; +} + +/* set the fd event flags */ static void poll_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags) @@ -262,7 +300,6 @@ struct tevent_context *ev = fde->event_ctx; struct poll_event_context *poll_ev; uint64_t idx = fde->additional_flags; - uint16_t pollflags; if (ev == NULL) { return; @@ -307,15 +344,7 @@ return; } - pollflags = 0; - - if (flags & TEVENT_FD_READ) { - pollflags |= (POLLIN|POLLHUP); - } - if (flags & TEVENT_FD_WRITE) { - pollflags |= (POLLOUT); - } - poll_ev->fdsidx.events = pollflags; + poll_ev->fdsidx.events = poll_map_flags(flags); poll_event_wake_pollthread(poll_ev); } @@ -401,16 +430,9 @@ } pfd->fd = fde->fd; - pfd->events = 0; + pfd->events = poll_map_flags(fde->flags); pfd->revents = 0; - if (fde->flags & TEVENT_FD_READ) { - pfd->events |= (POLLIN|POLLHUP); - } - if (fde->flags & TEVENT_FD_WRITE) { - pfd->events |= (POLLOUT); - } - poll_ev->num_fds += 1; } /* Both are in sync again */ @@ -534,23 +556,35 @@ fde, pfd->fd); poll_ev->fdesidx = NULL; poll_ev->deleted = true; - DLIST_REMOVE(ev->fd_events, fde); - fde->wrapper = NULL; - fde->event_ctx = NULL; + tevent_common_fd_disarm(fde); continue; } - if (pfd->revents & (POLLHUP|POLLERR)) { - /* If we only wait for TEVENT_FD_WRITE, we - should not tell the event handler about it, - and remove the writable flag, as we only - report errors when waiting for read events - to match the select behavior. */ - if (!(fde->flags & TEVENT_FD_READ)) { +#ifdef POLLRDHUP +#define __POLL_RETURN_ERROR_FLAGS (POLLHUP|POLLERR|POLLRDHUP) +#else +#define __POLL_RETURN_ERROR_FLAGS (POLLHUP|POLLERR) +#endif + + if (pfd->revents & __POLL_RETURN_ERROR_FLAGS) { + /* + * If we only wait for TEVENT_FD_WRITE, we + * should not tell the event handler about it, + * and remove the writable flag, as we only + * report errors when waiting for read events + * or explicit for errors. + */ + if (!(fde->flags & (TEVENT_FD_READ|TEVENT_FD_ERROR))) + { TEVENT_FD_NOT_WRITEABLE(fde); continue; } - flags |= TEVENT_FD_READ; + if (fde->flags & TEVENT_FD_ERROR) { + flags |= TEVENT_FD_ERROR; + } + if (fde->flags & TEVENT_FD_READ) { + flags |= TEVENT_FD_READ; + } } if (pfd->revents & POLLIN) { flags |= TEVENT_FD_READ; @@ -586,9 +620,7 @@ poll_ev->fdesi = NULL; poll_ev->deleted = true; if (fde != NULL) { - DLIST_REMOVE(ev->fd_events, fde); - fde->wrapper = NULL; - fde->event_ctx = NULL; + tevent_common_fd_disarm(fde); } } }
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent_queue.c -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent_queue.c
Changed
@@ -27,6 +27,10 @@ #include "tevent_internal.h" #include "tevent_util.h" +#undef tevent_queue_add +#undef tevent_queue_add_entry +#undef tevent_queue_add_optimize_empty + struct tevent_queue_entry { struct tevent_queue_entry *prev, *next; struct tevent_queue *queue; @@ -37,6 +41,7 @@ struct tevent_context *ev; tevent_queue_trigger_fn_t trigger; + const char *trigger_name; void *private_data; uint64_t tag; }; @@ -65,6 +70,10 @@ } tevent_trace_queue_callback(q->list->ev, e, TEVENT_EVENT_TRACE_DETACH); + tevent_thread_call_depth_notify(TEVENT_CALL_FLOW_REQ_QUEUE_LEAVE, + q->list->req, + q->list->req->internal.call_depth, + e->trigger_name); DLIST_REMOVE(q->list, e); q->length--; @@ -150,7 +159,10 @@ tevent_trace_queue_callback(ev, q->list, TEVENT_EVENT_TRACE_BEFORE_HANDLER); /* Set the call depth of the request coming from the queue. */ - tevent_thread_call_depth_set(q->list->req->internal.call_depth); + tevent_thread_call_depth_notify(TEVENT_CALL_FLOW_REQ_QUEUE_TRIGGER, + q->list->req, + q->list->req->internal.call_depth, + q->list->trigger_name); q->list->triggered = true; q->list->trigger(q->list->req, q->list->private_data); } @@ -166,6 +178,7 @@ struct tevent_context *ev, struct tevent_req *req, tevent_queue_trigger_fn_t trigger, + const char *trigger_name, void *private_data, bool allow_direct) { @@ -187,6 +200,7 @@ e->req = req; e->ev = ev; e->trigger = trigger; + e->trigger_name = trigger_name; e->private_data = private_data; if (queue->length > 0) { @@ -211,6 +225,10 @@ queue->length++; talloc_set_destructor(e, tevent_queue_entry_destructor); tevent_trace_queue_callback(ev, e, TEVENT_EVENT_TRACE_ATTACH); + tevent_thread_call_depth_notify(TEVENT_CALL_FLOW_REQ_QUEUE_ENTER, + req, + req->internal.call_depth, + e->trigger_name); if (!queue->running) { return e; @@ -249,10 +267,21 @@ tevent_queue_trigger_fn_t trigger, void *private_data) { + return _tevent_queue_add(queue, ev, req, trigger, NULL, private_data); +} + +bool _tevent_queue_add(struct tevent_queue *queue, + struct tevent_context *ev, + struct tevent_req *req, + tevent_queue_trigger_fn_t trigger, + const char* trigger_name, + void *private_data) +{ struct tevent_queue_entry *e; e = tevent_queue_add_internal(queue, ev, req, - trigger, private_data, false); + trigger, trigger_name, + private_data, false); if (e == NULL) { return false; } @@ -267,8 +296,22 @@ tevent_queue_trigger_fn_t trigger, void *private_data) { + return _tevent_queue_add_entry(queue, ev, req, + trigger, NULL, + private_data); +} + +struct tevent_queue_entry *_tevent_queue_add_entry( + struct tevent_queue *queue, + struct tevent_context *ev, + struct tevent_req *req, + tevent_queue_trigger_fn_t trigger, + const char* trigger_name, + void *private_data) +{ return tevent_queue_add_internal(queue, ev, req, - trigger, private_data, false); + trigger, trigger_name, + private_data, false); } struct tevent_queue_entry *tevent_queue_add_optimize_empty( @@ -278,8 +321,22 @@ tevent_queue_trigger_fn_t trigger, void *private_data) { + return _tevent_queue_add_optimize_empty(queue, ev, req, + trigger, NULL, + private_data); +} + +struct tevent_queue_entry *_tevent_queue_add_optimize_empty( + struct tevent_queue *queue, + struct tevent_context *ev, + struct tevent_req *req, + tevent_queue_trigger_fn_t trigger, + const char* trigger_name, + void *private_data) +{ return tevent_queue_add_internal(queue, ev, req, - trigger, private_data, true); + trigger, trigger_name, + private_data, true); } void tevent_queue_entry_untrigger(struct tevent_queue_entry *entry) @@ -354,8 +411,9 @@ return NULL; } - ok = tevent_queue_add(queue, ev, req, + ok = _tevent_queue_add(queue, ev, req, tevent_queue_wait_trigger, + "tevent_queue_wait_trigger", NULL); if (!ok) { tevent_req_oom(req);
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent_req.c -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent_req.c
Changed
@@ -27,6 +27,10 @@ #include "tevent_internal.h" #include "tevent_util.h" +#undef tevent_req_set_callback +#undef tevent_req_set_cancel_fn +#undef tevent_req_set_cleanup_fn + char *tevent_req_default_print(struct tevent_req *req, TALLOC_CTX *mem_ctx) { return talloc_asprintf(mem_ctx, @@ -64,6 +68,21 @@ const char *type, const char *location) { + return __tevent_req_create(mem_ctx, + pdata, + data_size, + type, + NULL, + location); +} + +struct tevent_req *__tevent_req_create(TALLOC_CTX *mem_ctx, + void *pdata, + size_t data_size, + const char *type, + const char *func, + const char *location) +{ struct tevent_req *req; struct tevent_req *parent; void **ppdata = (void **)pdata; @@ -122,10 +141,13 @@ *ppdata = data; /* Initially, talloc_zero_size() sets internal.call_depth to 0 */ - if (parent != NULL && parent->internal.call_depth > 0) { + if (parent != NULL) { req->internal.call_depth = parent->internal.call_depth + 1; - tevent_thread_call_depth_set(req->internal.call_depth); } + tevent_thread_call_depth_notify(TEVENT_CALL_FLOW_REQ_CREATE, + req, + req->internal.call_depth, + func); return req; } @@ -146,18 +168,18 @@ } if (req->async.fn != NULL) { /* Calling back the parent code, decrement the call depth. */ - tevent_thread_call_depth_set(req->internal.call_depth > 0 ? - req->internal.call_depth - 1 : 0); + size_t new_depth = req->internal.call_depth > 0 ? + req->internal.call_depth - 1 : 0; + tevent_thread_call_depth_notify(TEVENT_CALL_FLOW_REQ_NOTIFY_CB, + req, + new_depth, + req->async.fn_name); req->async.fn(req); } } static void tevent_req_cleanup(struct tevent_req *req) { - if (req->private_cleanup.fn == NULL) { - return; - } - if (req->private_cleanup.state >= req->internal.state) { /* * Don't call the cleanup_function multiple times for the same @@ -166,6 +188,15 @@ return; } + tevent_thread_call_depth_notify(TEVENT_CALL_FLOW_REQ_CLEANUP, + req, + req->internal.call_depth, + req->private_cleanup.fn_name); + + if (req->private_cleanup.fn == NULL) { + return; + } + req->private_cleanup.state = req->internal.state; req->private_cleanup.fn(req, req->internal.state); } @@ -289,7 +320,8 @@ talloc_set_destructor(req, NULL); req->private_print = NULL; - req->private_cancel = NULL; + req->private_cancel.fn = NULL; + req->private_cancel.fn_name = NULL; TALLOC_FREE(req->internal.trigger); TALLOC_FREE(req->internal.timer); @@ -366,7 +398,16 @@ void tevent_req_set_callback(struct tevent_req *req, tevent_req_fn fn, void *pvt) { + return _tevent_req_set_callback(req, fn, NULL, pvt); +} + +void _tevent_req_set_callback(struct tevent_req *req, + tevent_req_fn fn, + const char *fn_name, + void *pvt) +{ req->async.fn = fn; + req->async.fn_name = fn_name; req->async.private_data = pvt; } @@ -387,22 +428,43 @@ void tevent_req_set_cancel_fn(struct tevent_req *req, tevent_req_cancel_fn fn) { - req->private_cancel = fn; + _tevent_req_set_cancel_fn(req, fn, NULL); +} + +void _tevent_req_set_cancel_fn(struct tevent_req *req, + tevent_req_cancel_fn fn, + const char *fn_name) +{ + req->private_cancel.fn = fn; + req->private_cancel.fn_name = fn != NULL ? fn_name : NULL; } bool _tevent_req_cancel(struct tevent_req *req, const char *location) { - if (req->private_cancel == NULL) { + tevent_thread_call_depth_notify(TEVENT_CALL_FLOW_REQ_CANCEL, + req, + req->internal.call_depth, + req->private_cancel.fn_name); + + if (req->private_cancel.fn == NULL) { return false; } - return req->private_cancel(req); + return req->private_cancel.fn(req); } void tevent_req_set_cleanup_fn(struct tevent_req *req, tevent_req_cleanup_fn fn) { + _tevent_req_set_cleanup_fn(req, fn, NULL); +} + +void _tevent_req_set_cleanup_fn(struct tevent_req *req, + tevent_req_cleanup_fn fn, + const char *fn_name) +{ req->private_cleanup.state = req->internal.state; req->private_cleanup.fn = fn; + req->private_cleanup.fn_name = fn != NULL ? fn_name : NULL; } static int tevent_req_profile_destructor(struct tevent_req_profile *p);
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent_threads.c -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent_threads.c
Changed
@@ -302,12 +302,12 @@ * * pp_im must be a pointer to an immediate event talloced on * a context owned by the calling thread, or the NULL context. - * Ownership of *pp_im will be transfered to the tevent library. + * Ownership of *pp_im will be transferred to the tevent library. * * pp_private can be null, or contents of *pp_private must be * talloc'ed memory on a context owned by the calling thread * or the NULL context. If non-null, ownership of *pp_private will - * be transfered to the tevent library. + * be transferred to the tevent library. * * If you want to return a message, have the destination use the * same function call to send back to the caller. @@ -576,7 +576,7 @@ DLIST_REMOVE(ev->scheduled_immediates, im); - tevent_debug(ev, TEVENT_DEBUG_TRACE, + TEVENT_DEBUG(ev, TEVENT_DEBUG_TRACE, "Schedule immediate event \"%s\": %p from thread into main\n", im->handler_name, im); im->handler_name = NULL;
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent_timed.c -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent_timed.c
Changed
@@ -144,7 +144,7 @@ return 0; } - tevent_debug(te->event_ctx, TEVENT_DEBUG_TRACE, + TEVENT_DEBUG(te->event_ctx, TEVENT_DEBUG_TRACE, "Destroying timer event %p \"%s\"\n", te, te->handler_name); @@ -259,7 +259,7 @@ talloc_set_destructor(te, tevent_common_timed_destructor); - tevent_debug(ev, TEVENT_DEBUG_TRACE, + TEVENT_DEBUG(ev, TEVENT_DEBUG_TRACE, "Added timed event \"%s\": %p\n", handler_name, te); return te; @@ -346,7 +346,7 @@ } DLIST_REMOVE(te->event_ctx->timer_events, te); - tevent_debug(te->event_ctx, TEVENT_DEBUG_TRACE, + TEVENT_DEBUG(te->event_ctx, TEVENT_DEBUG_TRACE, "Running timer event %p \"%s\"\n", te, te->handler_name); @@ -388,7 +388,7 @@ } te->busy = false; - tevent_debug(te->event_ctx, TEVENT_DEBUG_TRACE, + TEVENT_DEBUG(te->event_ctx, TEVENT_DEBUG_TRACE, "Ending timer event %p \"%s\"\n", te, te->handler_name);
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent_util.h -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent_util.h
Changed
@@ -1,183 +1,28 @@ /* Unix SMB/CIFS implementation. - Copyright (C) Andrew Tridgell 1998-2010 + Copyright (C) Andrew Tridgell 2005 Copyright (C) Jelmer Vernooij 2005 - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -/* To use these macros you must have a structure containing a next and - prev pointer */ - -#ifndef _DLINKLIST_H -#define _DLINKLIST_H - -/* - February 2010 - changed list format to have a prev pointer from the - list head. This makes DLIST_ADD_END() O(1) even though we only have - one list pointer. - - The scheme is as follows: - - 1) with no entries in the list: - list_head == NULL - - 2) with 1 entry in the list: - list_head->next == NULL - list_head->prev == list_head - - 3) with 2 entries in the list: - list_head->next == element2 - list_head->prev == element2 - element2->prev == list_head - element2->next == NULL - - 4) with N entries in the list: - list_head->next == element2 - list_head->prev == elementN - elementN->prev == element{N-1} - elementN->next == NULL - - This allows us to find the tail of the list by using - list_head->prev, which means we can add to the end of the list in - O(1) time - */ - - -/* - add an element at the front of a list -*/ -#define DLIST_ADD(list, p) \ -do { \ - if (!(list)) { \ - (p)->prev = (list) = (p); \ - (p)->next = NULL; \ - } else { \ - (p)->prev = (list)->prev; \ - (list)->prev = (p); \ - (p)->next = (list); \ - (list) = (p); \ - } \ -} while (0) - -/* - remove an element from a list - Note that the element doesn't have to be in the list. If it - isn't then this is a no-op -*/ -#define DLIST_REMOVE(list, p) \ -do { \ - if ((p) == (list)) { \ - if ((p)->next) (p)->next->prev = (p)->prev; \ - (list) = (p)->next; \ - } else if ((p)->prev && (list) && (p) == (list)->prev) { \ - (p)->prev->next = NULL; \ - (list)->prev = (p)->prev; \ - } else { \ - if ((p)->prev) (p)->prev->next = (p)->next; \ - if ((p)->next) (p)->next->prev = (p)->prev; \ - } \ - if ((p) != (list)) (p)->next = (p)->prev = NULL; \ -} while (0) - -/* - find the head of the list given any element in it. - Note that this costs O(N), so you should avoid this macro - if at all possible! -*/ -#define DLIST_HEAD(p, result_head) \ -do { \ - (result_head) = (p); \ - while (DLIST_PREV(result_head)) (result_head) = (result_head)->prev; \ -} while(0) - -/* return the last element in the list */ -#define DLIST_TAIL(list) ((list)?(list)->prev:NULL) - -/* return the previous element in the list. */ -#define DLIST_PREV(p) (((p)->prev && (p)->prev->next != NULL)?(p)->prev:NULL) - -/* insert 'p' after the given element 'el' in a list. If el is NULL then - this is the same as a DLIST_ADD() */ -#define DLIST_ADD_AFTER(list, p, el) \ -do { \ - if (!(list) || !(el)) { \ - DLIST_ADD(list, p); \ - } else { \ - (p)->prev = (el); \ - (p)->next = (el)->next; \ - (el)->next = (p); \ - if ((p)->next) (p)->next->prev = (p); \ - if ((list)->prev == (el)) (list)->prev = (p); \ - }\ -} while (0) + ** NOTE! The following LGPL license applies to the tevent + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. -/* - add to the end of a list. -*/ -#define DLIST_ADD_END(list, p) \ -do { \ - if (!(list)) { \ - DLIST_ADD(list, p); \ - } else { \ - DLIST_ADD_AFTER(list, p, (list)->prev); \ - } \ -} while (0) - -/* promote an element to the front of a list */ -#define DLIST_PROMOTE(list, p) \ -do { \ - DLIST_REMOVE(list, p); \ - DLIST_ADD(list, p); \ -} while (0) - -/* - demote an element to the end of a list. -*/ -#define DLIST_DEMOTE(list, p) \ -do { \ - DLIST_REMOVE(list, p); \ - DLIST_ADD_END(list, p); \ -} while (0) + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. -/* - concatenate two lists - putting all elements of the 2nd list at the - end of the first list. + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#define DLIST_CONCATENATE(list1, list2) \ -do { \ - if (!(list1)) { \ - (list1) = (list2); \ - } else { \ - (list1)->prev->next = (list2); \ - if (list2) { \ - void *_tmplist = (void *)(list1)->prev; \ - (list1)->prev = (list2)->prev; \ - (list2)->prev = _tmplist; \ - } \ - } \ -} while (0) - -#endif /* _DLINKLIST_H */ int ev_set_blocking(int fd, bool set); bool ev_set_close_on_exec(int fd); -/* Defined here so we can build against older talloc versions that don't - * have this define yet. */ -#ifndef TALLOC_FREE -#define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx=NULL; } while(0) -#endif +#include "tevent_dlinklist.h"
View file
_service:tar_scm:tevent-0.14.1.tar.gz/tevent_wrapper.c -> _service:tar_scm:tevent-0.16.0.tar.gz/tevent_wrapper.c
Changed
@@ -227,7 +227,7 @@ return 0; } - tevent_debug(wrap_ev, TEVENT_DEBUG_TRACE, + TEVENT_DEBUG(wrap_ev, TEVENT_DEBUG_TRACE, "Destroying wrapper context %p \"%s\"\n", wrap_ev, talloc_get_name(glue->private_state)); @@ -276,9 +276,7 @@ tevent_fd_set_flags(fd, 0); - fd->wrapper = NULL; - fd->event_ctx = NULL; - DLIST_REMOVE(main_ev->fd_events, fd); + tevent_common_fd_disarm(fd); } for (te = main_ev->timer_events; te; te = tn) {
View file
_service:tar_scm:tevent-0.14.1.tar.gz/wscript -> _service:tar_scm:tevent-0.16.0.tar.gz/wscript
Changed
@@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'tevent' -VERSION = '0.14.1' +VERSION = '0.16.0' import sys, os @@ -51,7 +51,7 @@ conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytevent', 'tevent', minversion=VERSION): conf.define('USING_SYSTEM_PYTEVENT', 1) - if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'): + if conf.CHECK_FUNCS('epoll_create1', headers='sys/epoll.h'): conf.DEFINE('HAVE_EPOLL', 1) tevent_num_signals = 64 @@ -110,7 +110,7 @@ enabled= not bld.CONFIG_SET('USING_SYSTEM_TEVENT'), includes='.', abi_directory='ABI', - abi_match='tevent_* _tevent_*', + abi_match='tevent_* _tevent_* __tevent_*', vnum=VERSION, public_headers=('' if private_library else 'tevent.h'), public_headers_install=not private_library,
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2