"Fossies" - the Fresh Open Source Software Archive

Member "rspamd-1.7.8/src/libutil/aio_event.h" (12 Jul 2018, 1522 Bytes) of package /linux/misc/rspamd-1.7.8.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "aio_event.h" see the Fossies "Dox" file reference documentation.

    1 /*-
    2  * Copyright 2016 Vsevolod Stakhov
    3  *
    4  * Licensed under the Apache License, Version 2.0 (the "License");
    5  * you may not use this file except in compliance with the License.
    6  * You may obtain a copy of the License at
    7  *
    8  *   http://www.apache.org/licenses/LICENSE-2.0
    9  *
   10  * Unless required by applicable law or agreed to in writing, software
   11  * distributed under the License is distributed on an "AS IS" BASIS,
   12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13  * See the License for the specific language governing permissions and
   14  * limitations under the License.
   15  */
   16 #ifndef AIO_EVENT_H_
   17 #define AIO_EVENT_H_
   18 
   19 #include "config.h"
   20 
   21 /**
   22  * AIO context
   23  */
   24 struct aio_context;
   25 
   26 /**
   27  * Callback for notifying
   28  */
   29 typedef void (*rspamd_aio_cb) (gint fd, gint res, guint64 len, gpointer data,
   30     gpointer ud);
   31 
   32 /**
   33  * Initialize aio with specified event base
   34  */
   35 struct aio_context * rspamd_aio_init (struct event_base *base);
   36 
   37 /**
   38  * Open file for aio
   39  */
   40 gint rspamd_aio_open (struct aio_context *ctx, const gchar *path, int flags);
   41 
   42 /**
   43  * Asynchronous read of file
   44  */
   45 gint rspamd_aio_read (gint fd, gpointer buf, guint64 len, guint64 offset,
   46     struct aio_context *ctx, rspamd_aio_cb cb, gpointer ud);
   47 
   48 /**
   49  * Asynchronous write of file
   50  */
   51 gint rspamd_aio_write (gint fd, gpointer buf, guint64 len, guint64 offset,
   52     struct aio_context *ctx, rspamd_aio_cb cb, gpointer ud);
   53 
   54 /**
   55  * Close of aio operations
   56  */
   57 gint rspamd_aio_close (gint fd, struct aio_context *ctx);
   58 
   59 #endif /* AIO_EVENT_H_ */