Ignore:
Timestamp:
May 16, 2018, 8:31:35 PM (6 years ago)
Author:
satin@…
Message:

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/mini-libc/stdlib.h

    r443 r444  
    2525#define _STDLIB_H
    2626
    27 #define   RAND_MAX   65535
    28  
    29 /*********************************************************************************************
    30  * This function tests the <expression> argument value.
    31  * When the value is false, it displays an error message, and terminates the calling thread.
    32  *********************************************************************************************
    33  * @ expression : Boolean expression to be checked.
    34  ********************************************************************************************/
    35 void assert( int expression );
     27#include <almos-mkh/stdlib.h>
     28
     29/***************************************************************************************** 
     30 * This function terminates a process.
     31 *****************************************************************************************
     32 * @ status   : terminaison status : 0 / EXIT_SUCCESS / EXIT_FAILURE.
     33 ****************************************************************************************/
     34void exit( int status );
     35
    3636
    3737/*********************************************************************************************
     
    4646 ********************************************************************************************/
    4747double atof(const char *str);
    48 
    49 /*********************************************************************************************
    50  * This function copies the content of a <src> byte array to a <dst> byte array.
    51  * Behaviour is undefined if <src> and <dst> arrays overlap.
    52  *********************************************************************************************
    53  * @ dst     : pointer on destination array.
    54  * @ dst     : pointer on source array.
    55  * @ size    : number of bytes to move.
    56  * @ return first argument.
    57  ********************************************************************************************/
    58 void * memcpy( void         * dst,
    59                const void   * src,
    60                unsigned int   size );
    61 
    62 /*********************************************************************************************
    63  * This function fill a byte array with a byte value.
    64  *********************************************************************************************
    65  * @ dst     : pointer on the byte array.
    66  * @ s       : byte value (will be casted to unsigned char).
    67  * @ size    : number of bytes to be set.
    68  * @ return first argument.
    69  ********************************************************************************************/
    70 void * memset( void        * dst,
    71                int           s,
    72                unsigned int  size);
    73 
    74 /*********************************************************************************************
    75  * This function writes a formated string to the standard "stdout" stream.
    76  *********************************************************************************************
    77  * @ returns number of characters written if success / returns -1 if failure.
    78  ********************************************************************************************/
    79 int printf( const char * format, ... );
    80 
    81 /*********************************************************************************************
    82  * This function returns a positive integer fom the standard "stdin" stream.
    83  *********************************************************************************************
    84  * returns the integer value if success / returns -1 if failure.
    85  ********************************************************************************************/
    86 int getint();
    87 
    88 /*********************************************************************************************
    89  * This function writes one single character to the standard "stdout" stream.
    90  *********************************************************************************************
    91  * @ returns written character code if success / returns 0 (EOF) if failure.
    92  ********************************************************************************************/
    93 int putchar( int c );
    94 
    95 /*********************************************************************************************
    96  * This function returns one single character from the standard "stdin" stream.
    97  *********************************************************************************************
    98  * @ returns read character code if success / returns 0 (EOF) if failure.
    99  ********************************************************************************************/
    100 int getchar();
    101 
    102 /*********************************************************************************************
    103  * This function copies a formated string to a fixed size buffer.
    104  * it includes the NUL terminating character.
    105  * it cheks that the formated string fit in the buffer length.
    106  *********************************************************************************************
    107  * @ string    :  pointer on target buffer.
    108  * @ length    : max bumber of characters in target buffer.
    109  * @ format    : formated string.
    110  * @ returns number of characters written if success / returns -1 if failure.
    111  ********************************************************************************************/
    112 int snprintf( char         * string,
    113               unsigned int   length,
    114               const char   * format, ... );
    11548
    11649/*********************************************************************************************
     
    13063int rand();
    13164
    132 /*********************************************************************************************
    133  * This blocking function implements an user-level interactive debugger that can be
    134  * introduced in any user application to display various kernel distributed structures
    135  * related to the calling process. The supported commands are:
    136  * - p (cxy)     : display all processes descriptors in a given cluster.
    137  * - s (cxy,lid) : display all threads attached to a given core in a given cluster.
    138  * - v (cxy)     : display the calling process VMM in a given cluster.
    139  * - t (tid)     : display all owner process descriptors attached to a given TXT terminal.
    140  * - x           : force the calling process to exit.
    141  * - c           : continue calling process execution.
    142  *********************************************************************************************
    143  * @ return an integer value between 0 and RAND_MAX.
    144  ********************************************************************************************/
    145 void idbg();
     65/*****************************************************************************************
     66 * This function allocates <size> bytes of memory in user space and returns a pointer
     67 * on the allocated buffer. The physical memory is allocated from store located in
     68 * the calling core cluster.
     69 *****************************************************************************************
     70 * @ size    : number of requested bytes.
     71 * @ returns a pointer on the allocated buffer if success / returns NULL if failure
     72 ****************************************************************************************/
     73void * malloc( unsigned int size );
    14674
    14775
     76/*****************************************************************************************
     77 * This function releases the memory buffer identified by the <ptr> argument,
     78 * to the store located in the calling core cluster.
     79 * It displays an error message, but does nothing if the ptr is illegal.
     80 *****************************************************************************************
     81 * @ ptr   : pointer on the released buffer.
     82 ****************************************************************************************/
     83void free( void * ptr );
     84
     85/*****************************************************************************************
     86 * This function releases the memory buffer identified by the <ptr> argument,
     87 * to the store located in the calling core cluster, and allocates a new buffer
     88 * containing <size> bytes from this store.
     89 * The content of the old buffer is copied to the new buffer, up to <size> bytes.
     90 * It displays an error message, but does nothing if the ptr is illegal.
     91 *****************************************************************************************
     92 * @ ptr   : pointer on the released buffer.
     93 * @ size  : new buffer requested size (bytes).
     94 * @ return a pointer on allocated buffer if success / return NULL if failure
     95 ****************************************************************************************/
     96void * realloc( void        * ptr,
     97                unsigned int  size );
     98
     99
     100/*****************************************************************************************
     101 * This function allocates enough space for <count> objects that are <size> bytes
     102 * of memory each from the store located in the calling core cluster.
     103 * The allocated memory is filled with bytes of value zero.
     104 *****************************************************************************************
     105 * @ count   : number of requested objects.
     106 * @ size    : number of bytes per object.
     107 * @ returns a pointer on allocated buffer if success / returns NULL if failure
     108 ****************************************************************************************/
     109void * calloc( unsigned int count,
     110               unsigned int size );
    148111#endif  // _STDLIB_H_
Note: See TracChangeset for help on using the changeset viewer.