2023-01-16 05:54:34 +01:00
|
|
|
/*
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
UMKa - User-Mode KolibriOS developer tools
|
|
|
|
io - input/output platform specific code
|
|
|
|
|
|
|
|
Copyright (C) 2023 Ivan Baravy <dunkaist@gmail.com>
|
|
|
|
*/
|
|
|
|
|
2023-02-01 19:30:44 +01:00
|
|
|
#ifndef UMKAIO_H_INCLUDED
|
|
|
|
#define UMKAIO_H_INCLUDED
|
2023-01-16 05:54:34 +01:00
|
|
|
|
2023-02-03 05:39:32 +01:00
|
|
|
#include <stdatomic.h>
|
2023-02-03 00:52:35 +01:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <pthread.h>
|
2023-01-16 05:54:34 +01:00
|
|
|
|
2023-02-06 17:01:37 +01:00
|
|
|
#if !defined (O_BINARY)
|
|
|
|
#define O_BINARY 0 // for Windows
|
|
|
|
#endif
|
|
|
|
|
2023-01-18 09:29:08 +01:00
|
|
|
struct umka_io {
|
2023-02-03 05:39:32 +01:00
|
|
|
const atomic_int *running;
|
2023-02-03 00:52:35 +01:00
|
|
|
pthread_t iot;
|
|
|
|
};
|
|
|
|
|
2023-01-18 09:29:08 +01:00
|
|
|
struct umka_io *
|
2023-02-03 05:39:32 +01:00
|
|
|
io_init(atomic_int *running);
|
2023-01-17 01:49:11 +01:00
|
|
|
|
|
|
|
void
|
2023-01-18 09:29:08 +01:00
|
|
|
io_close(struct umka_io *io);
|
2023-01-17 01:49:11 +01:00
|
|
|
|
2023-01-16 05:54:34 +01:00
|
|
|
ssize_t
|
2023-02-06 17:01:37 +01:00
|
|
|
io_read(int fd, void *buf, size_t count, const struct umka_io *io);
|
2023-01-16 05:54:34 +01:00
|
|
|
|
|
|
|
ssize_t
|
2023-02-06 17:01:37 +01:00
|
|
|
io_write(int fd, const void *buf, size_t count, const struct umka_io *io);
|
2023-01-16 05:54:34 +01:00
|
|
|
|
2023-02-01 19:30:44 +01:00
|
|
|
#endif // UMKAIO_H_INCLUDED
|