Monado OpenXR Runtime
Loading...
Searching...
No Matches
os_fd.h File Reference

Reading from file descriptors, shared by the Linux hid and serial code. More...

#include "xrt/xrt_config_os.h"
#include "os/os_time.h"
#include <stdint.h>
#include <errno.h>
#include <poll.h>
#include <unistd.h>
Include dependency graph for os_fd.h:

Go to the source code of this file.

Functions

static ssize_t os_fd_read (int fd, uint8_t *data, size_t size, int milliseconds)
 Waits up to milliseconds for fd to be readable, then reads from it.
 

Detailed Description

Function Documentation

◆ os_fd_read()

static ssize_t os_fd_read ( int  fd,
uint8_t *  data,
size_t  size,
int  milliseconds 
)
inlinestatic

Waits up to milliseconds for fd to be readable, then reads from it.

A negative milliseconds reads without waiting. Retries on EINTR.

Returns
Bytes read, 0 on timeout, -1 on error.

References os_monotonic_get_ns(), and U_TIME_1MS_IN_NS.