UbixOS  2.0
sem.c File Reference
#include <ubixos/sem.h>
#include <sys/types.h>
#include <ubixos/errno.h>
#include <ubixos/time.h>
#include <ubixos/kpanic.h>
#include <lib/kmalloc.h>
Include dependency graph for sem.c:

Go to the source code of this file.

Functions

int sem_close (semID_t id)
 
err_t sem_destroy (sys_sem_t **sem)
 
int sem_getvalue (semID_t id, int *val)
 
err_t sem_init (sys_sem_t **sem, uint8_t count)
 
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 *ts)
 
int sem_trywait (semID_t id)
 
int sem_unlink (const char *name)
 
int sem_wait (semID_t id)
 

Function Documentation

◆ sem_close()

int sem_close ( semID_t  id)

Definition at line 36 of file sem.c.

◆ sem_destroy()

err_t sem_destroy ( sys_sem_t **  sem)

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()

err_t sem_init ( sys_sem_t **  sem,
uint8_t  count 
)

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 ts 
)

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.