2023-01-16 04:54:34 +00: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 18:30:44 +00:00
|
|
|
#ifndef UMKAIO_H_INCLUDED
|
|
|
|
|
#define UMKAIO_H_INCLUDED
|
2023-01-16 04:54:34 +00:00
|
|
|
|
2023-02-03 07:39:32 +03:00
|
|
|
#include <stdatomic.h>
|
2023-02-02 23:52:35 +00:00
|
|
|
#include <stddef.h>
|
|
|
|
|
#include <pthread.h>
|
2023-01-16 04:54:34 +00:00
|
|
|
|
2023-02-06 16:01:37 +00:00
|
|
|
#if !defined (O_BINARY)
|
|
|
|
|
#define O_BINARY 0 // for Windows
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-01-18 08:29:08 +00:00
|
|
|
struct umka_io {
|
2023-02-03 07:39:32 +03:00
|
|
|
const atomic_int *running;
|
2023-02-02 23:52:35 +00:00
|
|
|
pthread_t iot;
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-18 08:29:08 +00:00
|
|
|
struct umka_io *
|
2023-02-03 07:39:32 +03:00
|
|
|
io_init(atomic_int *running);
|
2023-01-17 00:49:11 +00:00
|
|
|
|
|
|
|
|
void
|
2023-01-18 08:29:08 +00:00
|
|
|
io_close(struct umka_io *io);
|
2023-01-16 04:54:34 +00:00
|
|
|
|
|
|
|
|
ssize_t
|
2023-02-06 16:01:37 +00:00
|
|
|
io_read(int fd, void *buf, size_t count, const struct umka_io *io);
|
2023-01-17 00:49:11 +00:00
|
|
|
|
|
|
|
|
ssize_t
|
2023-02-06 16:01:37 +00:00
|
|
|
io_write(int fd, const void *buf, size_t count, const struct umka_io *io);
|
2023-01-16 04:54:34 +00:00
|
|
|
|
2023-02-01 18:30:44 +00:00
|
|
|
#endif // UMKAIO_H_INCLUDED
|