UbixOS  2.0
sem.h File Reference
#include <sys/types.h>
#include <ubixos/errno.h>
#include <ubixos/ubthread.h>
Include dependency graph for sem.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sys_sem
 

Typedefs

typedef uint32_t semID_t
 
typedef struct sys_sem sys_sem_t
 

Functions

int sem_close (semID_t id)
 
int sem_destroy (sys_sem_t **)
 
int sem_getvalue (semID_t id, int *val)
 
int sem_init (sys_sem_t **, uint8_t)
 
int sem_open (semID_t *id, const char *name, int oflag, mode_t mode, unsigned int value)
 
int sem_post (semID_t id)
 
int sem_timedwait (semID_t id, const struct timespec *)
 
int sem_trywait (semID_t id)
 
int sem_unlink (const char *name)
 
int sem_wait (semID_t id)
 

Typedef Documentation

◆ semID_t

typedef uint32_t semID_t

Definition at line 44 of file sem.h.

◆ sys_sem_t

typedef struct sys_sem sys_sem_t

Definition at line 42 of file sem.h.

Function Documentation

◆ sem_close()

int sem_close ( semID_t  id)

Definition at line 36 of file sem.c.

◆ sem_destroy()

int sem_destroy ( sys_sem_t **  )

Definition at line 87 of file sem.c.

References sys_sem::cond, EINVAL, ENOERR, kfree(), sys_sem::mutex, NULL, ubthread_cond_destroy(), and ubthread_mutex_destroy().

Referenced by sys_sem_free().

Here is the call graph for this function:

◆ sem_getvalue()

int sem_getvalue ( semID_t  id,
int *  val 
)

Definition at line 83 of file sem.c.

◆ sem_init()

int sem_init ( sys_sem_t **  ,
uint8_t   
)

Definition at line 56 of file sem.c.

References sys_sem::cond, ENOERR, kmalloc(), kprintf(), sys_sem::mutex, NULL, sys_sem::signaled, ubthread_cond_init(), and ubthread_mutex_init().

Referenced by sys_sem_new().

Here is the call graph for this function:

◆ sem_open()

int sem_open ( semID_t id,
const char *  name,
int  oflag,
mode_t  mode,
unsigned int  value 
)

Definition at line 75 of file sem.c.

◆ sem_post()

int sem_post ( semID_t  id)

Definition at line 40 of file sem.c.

◆ sem_timedwait()

int sem_timedwait ( semID_t  id,
const struct timespec  
)

Definition at line 52 of file sem.c.

◆ sem_trywait()

int sem_trywait ( semID_t  id)

Definition at line 48 of file sem.c.

◆ sem_unlink()

int sem_unlink ( const char *  name)

Definition at line 79 of file sem.c.

◆ sem_wait()

int sem_wait ( semID_t  id)

Definition at line 44 of file sem.c.