My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Classes | Macros | Functions
libc_sos.h File Reference

Go to the source code of this file.

Classes

struct  pthread_mutex_t
 
struct  sem_t
 

Macros

#define PTHREAD_MUTEX_INITIALIZER   {1,0}
 
#define pthread_mutexattr_t   void
 

Functions

void * memmove (void *dest, const void *src, unsigned int count)
 
void * memset (void *dest, unsigned int c, unsigned int count)
 
void * memcpy (void *dst, const void *src, unsigned int count)
 
void * malloc (unsigned int size)
 
void * realloc (void *ptr, unsigned int size)
 
void * calloc (unsigned int num_elements, unsigned int element_size)
 
void free (void *ptr)
 Deallocates the memory previously allocated. More...
 
int strncmp (const char *s1, const char *s2, unsigned int n)
 
unsigned int atoi (const char *ptr)
 converts the string argument pointed to ptr to integer More...
 
unsigned int strlen (const char *ptr)
 computes and returns the length of the string pointed to ptr More...
 
char * strcpy (char *ptr1, const char *ptr2)
 copies the string pointed to by ptr2 to ptr1 More...
 
int strcmp (const char *ptr1, const char *ptr2)
 compares the string pointed to by ptr1 to the string pointed to by ptr2 More...
 
char * strcat (char *ptr1, const char *ptr2)
 appends the string pointed to by ptr2 to the end of string pointed to by dest More...
 
int pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attribute)
 initializes the mutex parameters More...
 
int pthread_mutex_destroy (pthread_mutex_t *mutex)
 This function is called to destroy the mutex once it is used If it is under lock it returns an error code init param is reinitialized to zero. More...
 
int pthread_mutex_lock (pthread_mutex_t *mutex)
 This function is called to lock the specified mutex. More...
 
int pthread_mutex_unlock (pthread_mutex_t *mutex)
 This function is called to unlock a mutex. More...
 
int pthread_mutex_trylock (pthread_mutex_t *mutex)
 Same as sw_mutex_lock but it does not block the calling function It returns an error code if the mutex is already locked. More...
 
int sem_init (sem_t *sem, int shared, unsigned int value)
 
int sem_wait (sem_t *sem)
 Locks the semaphore referenced by sem It will return to the calling thread only after locking the semaphore or if the call is interrupted by a signal. More...
 
int sem_post (sem_t *sem)
 unlocks the semaphore referenced by sem by performing a unlock operation on that semaphore More...
 
int sem_destroy (sem_t *sem)
 Destroys the semaphore indicated by sem. More...
 
int sem_getvalue (sem_t *sem, int *value)
 
void sleep (unsigned int seconds)
 
void usleep (unsigned int seconds)
 
int truncate (const char *tr_path, long tr_lth)
 truncate - function cause the regular file named by path to be truncated to a size of precisely length bytes More...
 
int rename (const char *old_name, const char *new_name)
 rename - Changes the name of the file or directory specified by oldname to newname More...
 

Macro Definition Documentation

#define PTHREAD_MUTEX_INITIALIZER   {1,0}
#define pthread_mutexattr_t   void

Function Documentation

unsigned int atoi ( const char *  ptr)

converts the string argument pointed to ptr to integer

Parameters
ptr
Returns
void* calloc ( unsigned int  num_elements,
unsigned int  element_size 
)
void free ( void *  ptr)

Deallocates the memory previously allocated.

Parameters
ptr
void* malloc ( unsigned int  size)
void* memcpy ( void *  dst,
const void *  src,
unsigned int  count 
)
void* memmove ( void *  dest,
const void *  src,
unsigned int  count 
)
void* memset ( void *  dest,
unsigned int  c,
unsigned int  count 
)
int pthread_mutex_destroy ( pthread_mutex_t mutex)

This function is called to destroy the mutex once it is used If it is under lock it returns an error code init param is reinitialized to zero.

Parameters
mutex
Returns
int pthread_mutex_init ( pthread_mutex_t mutex,
const pthread_mutexattr_t attribute 
)

initializes the mutex parameters

Parameters
mutex
attribute
Returns
int pthread_mutex_lock ( pthread_mutex_t mutex)

This function is called to lock the specified mutex.

Parameters
mutex
Returns
int pthread_mutex_trylock ( pthread_mutex_t mutex)

Same as sw_mutex_lock but it does not block the calling function It returns an error code if the mutex is already locked.

Parameters
mutex
Returns
int pthread_mutex_unlock ( pthread_mutex_t mutex)

This function is called to unlock a mutex.

Parameters
mutex
Returns
void* realloc ( void *  ptr,
unsigned int  size 
)
int rename ( const char *  old_name,
const char *  new_name 
)

rename - Changes the name of the file or directory specified by oldname to newname

Parameters
old_name-string containing the name of an existing file to be renamed
new_name-string containing the new name for the file
Returns
- If the file is successfully renamed, a zero value is returned. On failure, a nonzero value is returned
int sem_destroy ( sem_t sem)

Destroys the semaphore indicated by sem.

Parameters
sem
Returns
int sem_getvalue ( sem_t sem,
int *  value 
)
int sem_init ( sem_t sem,
int  shared,
unsigned int  value 
)
int sem_post ( sem_t sem)

unlocks the semaphore referenced by sem by performing a unlock operation on that semaphore

Parameters
sem
Returns
int sem_wait ( sem_t sem)

Locks the semaphore referenced by sem It will return to the calling thread only after locking the semaphore or if the call is interrupted by a signal.

Parameters
sem
Returns
void sleep ( unsigned int  seconds)
char* strcat ( char *  ptr1,
const char *  ptr2 
)

appends the string pointed to by ptr2 to the end of string pointed to by dest

Parameters
ptr1
ptr2
Returns
int strcmp ( const char *  ptr1,
const char *  ptr2 
)

compares the string pointed to by ptr1 to the string pointed to by ptr2

Parameters
ptr1
ptr2
Returns
char* strcpy ( char *  ptr1,
const char *  ptr2 
)

copies the string pointed to by ptr2 to ptr1

Parameters
ptr1
ptr2
Returns
unsigned int strlen ( const char *  ptr)

computes and returns the length of the string pointed to ptr

Parameters
ptr
Returns
int strncmp ( const char *  s1,
const char *  s2,
unsigned int  n 
)
int truncate ( const char *  tr_path,
long  tr_lth 
)

truncate - function cause the regular file named by path to be truncated to a size of precisely length bytes

Parameters
tr_path- truncates the file whose name is specified in filename
tr_lth- The desired truncate size of the file in bytes
Returns
- If the file contents is successfully truncated, a zero value is returned.On failure, non-Zero is returned
void usleep ( unsigned int  seconds)