Functions
semaphores.c File Reference

Software API for an easy use of the *nix IPC system. More...

#include "sr_communications/ipc/semaphores.h"
Include dependency graph for semaphores.c:

Go to the source code of this file.

Functions

int createKey (key_t *semKey, char *semFile)
int freeSem (int semID)
 Frees a taken semaphore.
int getSemID (key_t semKey, int *semID)
 Gets a semaphore identification.
int rmSem (int semID)
 Removes a semaphore set.
int waitSem (int semID)
 waits for a semaphore until its resources are free

Detailed Description

Software API for an easy use of the *nix IPC system.

Author:
Raul Perula-Martinez <raul.perula@uc3m.es>
Date:
2015-03
Author:
Victor Gonzalez <vgonzale@ing.uc3m.es>
Date:
2010-01

This program is free software: you can redistribute it and/or modify it under the terms of the Licencia Educativa UC3M as published by the University Carlos III of Madrid, either version 1.0, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. See the Licencia Educativa UC3M version 1.0 or any later version for more details.

A copy of the Licencia Educativa UC3M is in the LICENSE file.

Definition in file semaphores.c.


Function Documentation

int createKey ( key_t *  semKey,
char *  semFile 
)

Definition at line 30 of file semaphores.c.

int freeSem ( int  semID)

Frees a taken semaphore.

Parameters:
semIDis the identifier of the semaphore
Returns:
0 if everything goes correctly
-1 if there is an error in semop operation

Definition at line 102 of file semaphores.c.

int getSemID ( key_t  ,
int *  semID 
)

Gets a semaphore identification.

Parameters:
semKey
semIDis where the semaphore identificator is stored
Returns:
-1 if there is an error in semget operation
-2 if there is an error in semctl operation
semID in case of success

Definition at line 50 of file semaphores.c.

int rmSem ( int  semID)

Removes a semaphore set.

Parameters:
semIDan integer with semaphore identification.
Returns:
0 if everything goes correctly
-1 if there is an error in semop operation

Definition at line 68 of file semaphores.c.

int waitSem ( int  semID)

waits for a semaphore until its resources are free

Parameters:
semIDan integer which identifies the semaphore
Returns:
0 if everything goes correctly
-1 if there is an error in semop operation

Definition at line 84 of file semaphores.c.



sr_communications
Author(s): Raul Perula-Martinez , Victor Gonzalez
autogenerated on Wed Aug 26 2015 16:26:48