myMPD
Internal API documentation
Loading...
Searching...
No Matches
event.c File Reference

Event handling. More...

#include "compile_time.h"
#include "src/lib/event.h"
#include "src/lib/log.h"
#include <errno.h>
#include <string.h>
#include <sys/eventfd.h>
#include <unistd.h>
Include dependency graph for event.c:

Functions

void event_pfd_init (struct mympd_pfds *pfds)
 
bool event_pfd_add_fd (struct mympd_pfds *pfds, int fd, enum pfd_type type, struct t_partition_state *partition_state)
 
int event_eventfd_create (void)
 
bool event_eventfd_write (int fd)
 
bool event_eventfd_read (int fd)
 
void event_fd_close (int fd)
 
const char * lookup_pfd_type (enum pfd_type type)
 
const char * lookup_pfd_revents (short revent)
 

Detailed Description

Event handling.

Function Documentation

◆ event_eventfd_create()

int event_eventfd_create ( void  )

Creates an eventfd

Returns
the eventfd

◆ event_eventfd_read()

bool event_eventfd_read ( int  fd)

Reads from an eventfd

Parameters
fdread from this fd
Returns
true on success, else false

◆ event_eventfd_write()

bool event_eventfd_write ( int  fd)

Increments the eventfd by one

Parameters
fdfd to write
Returns
true on success, else false

◆ event_fd_close()

void event_fd_close ( int  fd)

Closes the fd

Parameters
fdfd to close

◆ event_pfd_add_fd()

bool event_pfd_add_fd ( struct mympd_pfds pfds,
int  fd,
enum pfd_type  type,
struct t_partition_state partition_state 
)

Adds an fd to poll

Parameters
pfdsstruct to add the fd
fdfd to add
typefd type to add
partition_statepointer to partition_state or NULL
Returns
true on success, else false

◆ event_pfd_init()

void event_pfd_init ( struct mympd_pfds pfds)

Initializes the mympd_pfds struct to zero

Parameters
pfdsstruct to initialize

◆ lookup_pfd_revents()

const char * lookup_pfd_revents ( short  revent)

Lookups the name for poll revents

Parameters
reventpoll return event
Returns
name as string

◆ lookup_pfd_type()

const char * lookup_pfd_type ( enum pfd_type  type)

Lookups the name for a pfd_type

Parameters
typepfd_type
Returns
name as string