Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
eventfd.h File Reference
#include <stdint.h>
#include <zephyr/kernel.h>

Go to the source code of this file.

Macros

#define ZVFS_EFD_SEMAPHORE   2
 
#define ZVFS_EFD_NONBLOCK   0x4000
 

Typedefs

typedef uint64_t zvfs_eventfd_t
 

Functions

int zvfs_eventfd (unsigned int initval, int flags)
 Create a file descriptor for ZVFS event notification.
 
int zvfs_eventfd_read (int fd, zvfs_eventfd_t *value)
 Read from a ZVFS eventfd.
 
int zvfs_eventfd_write (int fd, zvfs_eventfd_t value)
 Write to a ZVFS eventfd.
 

Macro Definition Documentation

◆ ZVFS_EFD_NONBLOCK

#define ZVFS_EFD_NONBLOCK   0x4000

◆ ZVFS_EFD_SEMAPHORE

#define ZVFS_EFD_SEMAPHORE   2

Typedef Documentation

◆ zvfs_eventfd_t

Function Documentation

◆ zvfs_eventfd()

int zvfs_eventfd ( unsigned int  initval,
int  flags 
)

Create a file descriptor for ZVFS event notification.

The returned file descriptor can be used with POSIX read/write calls or with the zvfs_eventfd_read or zvfs_eventfd_write functions.

It also supports polling and by including an eventfd in a call to poll, it is possible to signal and wake the polling thread by simply writing to the eventfd.

When using read() and write() on a ZVFS eventfd, the size must always be at least 8 bytes or the operation will fail with EINVAL.

Returns
New ZVFS eventfd file descriptor on success, -1 on error

◆ zvfs_eventfd_read()

int zvfs_eventfd_read ( int  fd,
zvfs_eventfd_t value 
)

Read from a ZVFS eventfd.

If call is successful, the value parameter will have the value 1

Parameters
fdFile descriptor
valuePointer for storing the read value
Returns
0 on success, -1 on error

◆ zvfs_eventfd_write()

int zvfs_eventfd_write ( int  fd,
zvfs_eventfd_t  value 
)

Write to a ZVFS eventfd.

Parameters
fdFile descriptor
valueValue to write
Returns
0 on success, -1 on error