Home | History | Annotate | Download | only in asyncio
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      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 
     17 #ifndef _ASYNCIO_H
     18 #define _ASYNCIO_H
     19 
     20 #include <cstring>
     21 #include <cstdint>
     22 #include <linux/aio_abi.h>
     23 #include <sys/cdefs.h>
     24 #include <sys/types.h>
     25 #include <time.h>
     26 #include <unistd.h>
     27 
     28 #ifdef __cplusplus
     29 extern "C" {
     30 #endif
     31 
     32 /**
     33  * Provides kernel aio operations.
     34  */
     35 
     36 int io_setup(unsigned nr, aio_context_t* ctxp);
     37 int io_destroy(aio_context_t ctx);
     38 int io_submit(aio_context_t ctx, long nr, iocb** iocbpp);
     39 int io_getevents(aio_context_t ctx, long min_nr, long max_nr, io_event* events, timespec* timeout);
     40 int io_cancel(aio_context_t ctx, iocb*, io_event* result);
     41 void io_prep(iocb* iocb, int fd, const void* buf, uint64_t count, int64_t offset, bool read);
     42 
     43 #ifdef __cplusplus
     44 };
     45 #endif
     46 
     47 #endif  // ASYNCIO_H
     48