use core::ffi::{c_int, c_void};

use super::{signal::__ygg_sigevent_t, sys_time::__ygg_timespec_t, sys_types::off_t};

#[repr(C)]
pub struct aiocb {
    pub aio_fildes: c_int,
    pub aio_offset: off_t,
    pub aio_buf: *mut c_void,
    pub aio_nbytes: usize,
    pub aio_reqprio: c_int,
    pub aio_sigevent: __ygg_sigevent_t,
    pub aio_lio_opcode: c_int,
}

pub type __ygg_aiocb_t = aiocb;

pub const AIO_ALLDONE: c_int = 1 << 0;
pub const AIO_CANCELED: c_int = 1 << 1;
pub const AIO_NOTCANCELED: c_int = 1 << 2;

pub const LIO_NOP: c_int = 1;
pub const LIO_READ: c_int = 2;
pub const LIO_WRITE: c_int = 3;
pub const LIO_NOWAIT: c_int = 4;
pub const LIO_WAIT: c_int = 5;

#[no_mangle]
unsafe extern "C" fn aio_cancel(_fd: c_int, _aiocbp: *mut aiocb) -> c_int {
    unimplemented!("aio_cancel(): <aio.h> is not implemented in Yggdrasil")
}

#[no_mangle]
unsafe extern "C" fn aio_error(_aiocbp: *const aiocb) -> c_int {
    unimplemented!("aio_error(): <aio.h> is not implemented in Yggdrasil")
}

#[no_mangle]
unsafe extern "C" fn aio_fsync(_fd: c_int, _aiocbp: *mut aiocb) -> c_int {
    unimplemented!("aio_fsync(): <aio.h> is not implemented in Yggdrasil")
}

#[no_mangle]
unsafe extern "C" fn aio_read(_aiocbp: *mut aiocb) -> c_int {
    unimplemented!("aio_read(): <aio.h> is not implemented in Yggdrasil")
}

#[no_mangle]
unsafe extern "C" fn aio_return(_aiocbp: *mut aiocb) -> isize {
    unimplemented!("aio_return(): <aio.h> is not implemented in Yggdrasil")
}

#[no_mangle]
unsafe extern "C" fn aio_suspend(
    _aiocbps: *const *const aiocb,
    _fd: c_int,
    _timeout: *const __ygg_timespec_t,
) -> c_int {
    unimplemented!("aio_suspend(): <aio.h> is not implemented in Yggdrasil")
}

#[no_mangle]
unsafe extern "C" fn aio_write(_aiocbp: *mut aiocb) -> c_int {
    unimplemented!("aio_write(): <aio.h> is not implemented in Yggdrasil")
}

#[no_mangle]
unsafe extern "C" fn lio_listio(
    _fd: c_int,
    _aiocb: *const aiocb,
    _opts: c_int,
    _sigevent: *mut __ygg_sigevent_t,
) -> c_int {
    unimplemented!("lio_listio(): <aio.h> is not implemented in Yggdrasil")
}
