diff options
author | kikht <kikht@yandex-team.ru> | 2022-02-10 16:45:14 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:14 +0300 |
commit | 194cae0e8855b11be2005e1eff12c660c3ee9774 (patch) | |
tree | ed29c437b616690880c017855ebe0be34fdf81a2 /contrib/libs/libevent/evbuffer-internal.h | |
parent | 49116032d905455a7b1c994e4a696afc885c1e71 (diff) | |
download | ydb-194cae0e8855b11be2005e1eff12c660c3ee9774.tar.gz |
Restoring authorship annotation for <kikht@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/libevent/evbuffer-internal.h')
-rw-r--r-- | contrib/libs/libevent/evbuffer-internal.h | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/contrib/libs/libevent/evbuffer-internal.h b/contrib/libs/libevent/evbuffer-internal.h index d09b4f1ddd..815305c99c 100644 --- a/contrib/libs/libevent/evbuffer-internal.h +++ b/contrib/libs/libevent/evbuffer-internal.h @@ -24,17 +24,17 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef EVBUFFER_INTERNAL_H_INCLUDED_ -#define EVBUFFER_INTERNAL_H_INCLUDED_ +#ifndef EVBUFFER_INTERNAL_H_INCLUDED_ +#define EVBUFFER_INTERNAL_H_INCLUDED_ #ifdef __cplusplus extern "C" { #endif #include "event2/event-config.h" -#include "evconfig-private.h" +#include "evconfig-private.h" #include "event2/util.h" -#include "event2/event_struct.h" +#include "event2/event_struct.h" #include "util-internal.h" #include "defer-internal.h" @@ -43,7 +43,7 @@ extern "C" { * arguments. */ #define EVBUFFER_CB_NODEFER 2 -#ifdef _WIN32 +#ifdef _WIN32 #include <winsock2.h> #endif #include <sys/queue.h> @@ -51,7 +51,7 @@ extern "C" { /* Minimum allocation for a chain. We define this so that we're burning no * more than 5% of each allocation on overhead. It would be nice to lose even * less space, though. */ -#if EVENT__SIZEOF_VOID_P < 8 +#if EVENT__SIZEOF_VOID_P < 8 #define MIN_BUFFER_SIZE 512 #else #define MIN_BUFFER_SIZE 1024 @@ -61,7 +61,7 @@ extern "C" { * when bytes are added to or removed from the evbuffer. */ struct evbuffer_cb_entry { /** Structures to implement a doubly-linked queue of callbacks */ - LIST_ENTRY(evbuffer_cb_entry) next; + LIST_ENTRY(evbuffer_cb_entry) next; /** The callback function to invoke when this callback is called. If EVBUFFER_CB_OBSOLETE is set in flags, the cb_obsolete field is valid; otherwise, cb_func is valid. */ @@ -92,7 +92,7 @@ struct evbuffer { * If the buffer has no chains, it is NULL. * * The last_with_datap pointer points at _whatever 'next' pointer_ - * pointing at the last_with_data chain. If the last_with_data chain + * pointing at the last_with_data chain. If the last_with_data chain * is the first chain, or it is NULL, then the last_with_datap pointer * is &buf->first. */ @@ -108,7 +108,7 @@ struct evbuffer { * tried to invoke callbacks. */ size_t n_del_for_cb; -#ifndef EVENT__DISABLE_THREAD_SUPPORT +#ifndef EVENT__DISABLE_THREAD_SUPPORT /** A lock used to mediate access to this buffer. */ void *lock; #endif @@ -127,7 +127,7 @@ struct evbuffer { * overflows when we have mutually recursive callbacks, and for * serializing callbacks in a single thread. */ unsigned deferred_cbs : 1; -#ifdef _WIN32 +#ifdef _WIN32 /** True iff this buffer is set up for overlapped IO. */ unsigned is_overlapped : 1; #endif @@ -135,7 +135,7 @@ struct evbuffer { ev_uint32_t flags; /** Used to implement deferred callbacks. */ - struct event_base *cb_queue; + struct event_base *cb_queue; /** A reference count on this evbuffer. When the reference count * reaches 0, the buffer is destroyed. Manipulated with @@ -143,24 +143,24 @@ struct evbuffer { * evbuffer_free. */ int refcnt; - /** A struct event_callback handle to make all of this buffer's callbacks + /** A struct event_callback handle to make all of this buffer's callbacks * invoked from the event loop. */ - struct event_callback deferred; + struct event_callback deferred; /** A doubly-linked-list of callback functions */ - LIST_HEAD(evbuffer_cb_queue, evbuffer_cb_entry) callbacks; + LIST_HEAD(evbuffer_cb_queue, evbuffer_cb_entry) callbacks; /** The parent bufferevent object this evbuffer belongs to. * NULL if the evbuffer stands alone. */ struct bufferevent *parent; }; -#if EVENT__SIZEOF_OFF_T < EVENT__SIZEOF_SIZE_T +#if EVENT__SIZEOF_OFF_T < EVENT__SIZEOF_SIZE_T typedef ev_ssize_t ev_misalign_t; #define EVBUFFER_CHAIN_MAX ((size_t)EV_SSIZE_MAX) #else typedef ev_off_t ev_misalign_t; -#if EVENT__SIZEOF_OFF_T > EVENT__SIZEOF_SIZE_T +#if EVENT__SIZEOF_OFF_T > EVENT__SIZEOF_SIZE_T #define EVBUFFER_CHAIN_MAX EV_SIZE_MAX #else #define EVBUFFER_CHAIN_MAX ((size_t)EV_SSIZE_MAX) @@ -186,8 +186,8 @@ struct evbuffer_chain { /** Set if special handling is required for this chain */ unsigned flags; -#define EVBUFFER_FILESEGMENT 0x0001 /**< A chain used for a file segment */ -#define EVBUFFER_SENDFILE 0x0002 /**< a chain used with sendfile */ +#define EVBUFFER_FILESEGMENT 0x0001 /**< A chain used for a file segment */ +#define EVBUFFER_SENDFILE 0x0002 /**< a chain used with sendfile */ #define EVBUFFER_REFERENCE 0x0004 /**< a chain with a mem reference */ #define EVBUFFER_IMMUTABLE 0x0008 /**< read-only chain */ /** a chain that mustn't be reallocated or freed, or have its contents @@ -198,12 +198,12 @@ struct evbuffer_chain { /** a chain that should be freed, but can't be freed until it is * un-pinned. */ #define EVBUFFER_DANGLING 0x0040 - /** a chain that is a referenced copy of another chain */ -#define EVBUFFER_MULTICAST 0x0080 - - /** number of references to this chain */ - int refcnt; + /** a chain that is a referenced copy of another chain */ +#define EVBUFFER_MULTICAST 0x0080 + /** number of references to this chain */ + int refcnt; + /** Usually points to the read-write memory belonging to this * buffer allocated as part of the evbuffer_chain allocation. * For mmap, this can be a read-only buffer and @@ -213,67 +213,67 @@ struct evbuffer_chain { unsigned char *buffer; }; -/** callback for a reference chain; lets us know what to do with it when - * we're done with it. Lives at the end of an evbuffer_chain with the - * EVBUFFER_REFERENCE flag set */ +/** callback for a reference chain; lets us know what to do with it when + * we're done with it. Lives at the end of an evbuffer_chain with the + * EVBUFFER_REFERENCE flag set */ struct evbuffer_chain_reference { evbuffer_ref_cleanup_cb cleanupfn; void *extra; }; -/** File segment for a file-segment chain. Lives at the end of an - * evbuffer_chain with the EVBUFFER_FILESEGMENT flag set. */ -struct evbuffer_chain_file_segment { - struct evbuffer_file_segment *segment; -#ifdef _WIN32 - /** If we're using CreateFileMapping, this is the handle to the view. */ - HANDLE view_handle; -#endif -}; - -/* Declared in event2/buffer.h; defined here. */ -struct evbuffer_file_segment { - void *lock; /**< lock prevent concurrent access to refcnt */ - int refcnt; /**< Reference count for this file segment */ - unsigned flags; /**< combination of EVBUF_FS_* flags */ - - /** What kind of file segment is this? */ - unsigned can_sendfile : 1; - unsigned is_mapping : 1; - - /** The fd that we read the data from. */ - int fd; - /** If we're using mmap, this is the raw mapped memory. */ - void *mapping; -#ifdef _WIN32 - /** If we're using CreateFileMapping, this is the mapping */ - HANDLE mapping_handle; -#endif - /** If we're using mmap or IO, this is the content of the file - * segment. */ - char *contents; - /** Position of this segment within the file. */ - ev_off_t file_offset; - /** If we're using mmap, this is the offset within 'mapping' where - * this data segment begins. */ - ev_off_t mmap_offset; - /** The length of this segment. */ - ev_off_t length; - /** Cleanup callback function */ - evbuffer_file_segment_cleanup_cb cleanup_cb; - /** Argument to be pass to cleanup callback function */ - void *cleanup_cb_arg; -}; - -/** Information about the multicast parent of a chain. Lives at the - * end of an evbuffer_chain with the EVBUFFER_MULTICAST flag set. */ -struct evbuffer_multicast_parent { - /** source buffer the multicast parent belongs to */ - struct evbuffer *source; - /** multicast parent for this chain */ - struct evbuffer_chain *parent; -}; - +/** File segment for a file-segment chain. Lives at the end of an + * evbuffer_chain with the EVBUFFER_FILESEGMENT flag set. */ +struct evbuffer_chain_file_segment { + struct evbuffer_file_segment *segment; +#ifdef _WIN32 + /** If we're using CreateFileMapping, this is the handle to the view. */ + HANDLE view_handle; +#endif +}; + +/* Declared in event2/buffer.h; defined here. */ +struct evbuffer_file_segment { + void *lock; /**< lock prevent concurrent access to refcnt */ + int refcnt; /**< Reference count for this file segment */ + unsigned flags; /**< combination of EVBUF_FS_* flags */ + + /** What kind of file segment is this? */ + unsigned can_sendfile : 1; + unsigned is_mapping : 1; + + /** The fd that we read the data from. */ + int fd; + /** If we're using mmap, this is the raw mapped memory. */ + void *mapping; +#ifdef _WIN32 + /** If we're using CreateFileMapping, this is the mapping */ + HANDLE mapping_handle; +#endif + /** If we're using mmap or IO, this is the content of the file + * segment. */ + char *contents; + /** Position of this segment within the file. */ + ev_off_t file_offset; + /** If we're using mmap, this is the offset within 'mapping' where + * this data segment begins. */ + ev_off_t mmap_offset; + /** The length of this segment. */ + ev_off_t length; + /** Cleanup callback function */ + evbuffer_file_segment_cleanup_cb cleanup_cb; + /** Argument to be pass to cleanup callback function */ + void *cleanup_cb_arg; +}; + +/** Information about the multicast parent of a chain. Lives at the + * end of an evbuffer_chain with the EVBUFFER_MULTICAST flag set. */ +struct evbuffer_multicast_parent { + /** source buffer the multicast parent belongs to */ + struct evbuffer *source; + /** multicast parent for this chain */ + struct evbuffer_chain *parent; +}; + #define EVBUFFER_CHAIN_SIZE sizeof(struct evbuffer_chain) /** Return a pointer to extra data allocated along with an evbuffer. */ #define EVBUFFER_CHAIN_EXTRA(t, c) (t *)((struct evbuffer_chain *)(c) + 1) @@ -300,21 +300,21 @@ struct evbuffer_multicast_parent { } while (0) /** Increase the reference count of buf by one. */ -void evbuffer_incref_(struct evbuffer *buf); +void evbuffer_incref_(struct evbuffer *buf); /** Increase the reference count of buf by one and acquire the lock. */ -void evbuffer_incref_and_lock_(struct evbuffer *buf); +void evbuffer_incref_and_lock_(struct evbuffer *buf); /** Pin a single buffer chain using a given flag. A pinned chunk may not be * moved or freed until it is unpinned. */ -void evbuffer_chain_pin_(struct evbuffer_chain *chain, unsigned flag); +void evbuffer_chain_pin_(struct evbuffer_chain *chain, unsigned flag); /** Unpin a single buffer chain using a given flag. */ -void evbuffer_chain_unpin_(struct evbuffer_chain *chain, unsigned flag); +void evbuffer_chain_unpin_(struct evbuffer_chain *chain, unsigned flag); /** As evbuffer_free, but requires that we hold a lock on the buffer, and * releases the lock before freeing it and the buffer. */ -void evbuffer_decref_and_unlock_(struct evbuffer *buffer); +void evbuffer_decref_and_unlock_(struct evbuffer *buffer); /** As evbuffer_expand, but does not guarantee that the newly allocated memory * is contiguous. Instead, it may be split across two or more chunks. */ -int evbuffer_expand_fast_(struct evbuffer *, size_t, int); +int evbuffer_expand_fast_(struct evbuffer *, size_t, int); /** Helper: prepares for a readv/WSARecv call by expanding the buffer to * hold enough memory to read 'howmuch' bytes in possibly noncontiguous memory. @@ -322,7 +322,7 @@ int evbuffer_expand_fast_(struct evbuffer *, size_t, int); * extent, and *chainp to point to the first chain that we'll try to read into. * Returns the number of vecs used. */ -int evbuffer_read_setup_vecs_(struct evbuffer *buf, ev_ssize_t howmuch, +int evbuffer_read_setup_vecs_(struct evbuffer *buf, ev_ssize_t howmuch, struct evbuffer_iovec *vecs, int n_vecs, struct evbuffer_chain ***chainp, int exact); @@ -335,17 +335,17 @@ int evbuffer_read_setup_vecs_(struct evbuffer *buf, ev_ssize_t howmuch, * See note in buffer_iocp's launch_write function */ /** Set the parent bufferevent object for buf to bev */ -void evbuffer_set_parent_(struct evbuffer *buf, struct bufferevent *bev); - -void evbuffer_invoke_callbacks_(struct evbuffer *buf); - +void evbuffer_set_parent_(struct evbuffer *buf, struct bufferevent *bev); -int evbuffer_get_callbacks_(struct evbuffer *buffer, - struct event_callback **cbs, - int max_cbs); +void evbuffer_invoke_callbacks_(struct evbuffer *buf); + +int evbuffer_get_callbacks_(struct evbuffer *buffer, + struct event_callback **cbs, + int max_cbs); + #ifdef __cplusplus } #endif -#endif /* EVBUFFER_INTERNAL_H_INCLUDED_ */ +#endif /* EVBUFFER_INTERNAL_H_INCLUDED_ */ |