Lely core libraries
2.2.5
|
Go to the documentation of this file.
21 #ifndef LELY_IO_INTERN_HANDLE_H_
22 #define LELY_IO_INTERN_HANDLE_H_
25 #ifndef LELY_NO_ATOMICS
26 #define LELY_NO_ATOMICS 1
27 #ifndef LELY_NO_THREADS
29 #ifndef __STDC_NO_ATOMICS__
30 #undef LELY_NO_ATOMICS
34 #ifndef LELY_NO_THREADS
45 #ifndef LELY_NO_ATOMICS
47 #elif !defined(LELY_NO_THREADS) && defined(_WIN32)
63 #ifndef LELY_NO_THREADS
146 #ifdef LELY_NO_THREADS
147 #define io_handle_lock(handle)
153 #ifdef LELY_NO_THREADS
154 #define io_handle_unlock(handle)
163 #endif // !LELY_IO_INTERN_HANDLE_H_
void io_handle_unlock(struct io_handle *handle)
Unlocks a locked I/O device handle.
io_off_t(* seek)(struct io_handle *handle, io_off_t offset, int whence)
A pointer to the seek method.
void io_handle_lock(struct io_handle *handle)
Locks an unlocked I/O device handle, so the flags (and other device-specific fields) can safely be ac...
int(* flush)(struct io_handle *handle)
A pointer to the flush method.
ssize_t(* write)(struct io_handle *handle, const void *buf, size_t nbytes)
A pointer to the write method.
int(* flags)(struct io_handle *handle, int flags)
A pointer to the static flags method.
struct io_handle * io_handle_alloc(const struct io_handle_vtab *vtab)
Allocates a new I/O device handle from a virtual table.
An opaque network address type.
int64_t io_off_t
A file offset type.
int type
The type of the device (one of IO_TYPE_CAN, IO_TYPE_FILE, IO_TYPE_PIPE, IO_TYPE_SERIAL or IO_TYPE_SOC...
ssize_t(* recv)(struct io_handle *handle, void *buf, size_t nbytes, io_addr_t *addr, int flags)
A pointer to the recv method.
void io_handle_destroy(struct io_handle *handle)
Destroys an I/O device handle.
pthread_mutex_t mtx_t
A complete object type that holds an identifier for a mutex.
void io_handle_fini(struct io_handle *handle)
Finalizes an I/O device handle by invoking its fini method, if available.
int(* connect)(struct io_handle *handle, const io_addr_t *addr)
A pointer to the connect method.
ssize_t(* send)(struct io_handle *handle, const void *buf, size_t nbytes, const io_addr_t *addr, int flags)
A pointer to the send method.
size_t size
The size (in bytes) of the handle struct.
const struct io_handle_vtab * vtab
A pointer to the virtual table.
int flags
The I/O device flags (any combination of IO_FLAG_NO_CLOSE and IO_FLAG_NONBLOCK).
int(* purge)(struct io_handle *handle, int flags)
A pointer to the purge method.
ssize_t(* pread)(struct io_handle *handle, void *buf, size_t nbytes, io_off_t offset)
A pointer to the pread method.
ssize_t(* pwrite)(struct io_handle *handle, const void *buf, size_t nbytes, io_off_t offset)
A pointer to the pwrite method.
The virtual table of an I/O device handle.
int fd
The native file descriptor.
ssize_t(* read)(struct io_handle *handle, void *buf, size_t nbytes)
A pointer to the read method.
void(* fini)(struct io_handle *handle)
A pointer to the fini method.
void io_handle_free(struct io_handle *handle)
Frees an I/O device handle.
size_t ref
The reference count.
mtx_t mtx
The mutex protecting flags (and other device-specific fields).