| Samsung Internal API reference 2.0

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

Files | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Auxiliary API

## Files
file | error.h
file | mman.h
file | phys.h

## Data Structures
struct | cpu_set_t
struct | tm
struct | __uuid_t
| wrapper for uuid type. More...

## Macros
#define | assert(expr) __assert__(expr, __FILE__, __LINE__)
| Abort the program if assertion is false. More...
#define | alloca _alloca
| Allocate memory that is automatically freed. More...
#define | EPERM 1 /* Operation not permitted */
#define | ENOENT 2 /* No such file or directory */
#define | ESRCH 3 /* No such process */
#define | EINTR 4 /* Interrupted system call */
#define | EIO 5 /* I/O error */
#define | ENXIO 6 /* No such device or address */
#define | E2BIG 7 /* Argument list too long */
#define | ENOEXEC 8 /* Exec format error */
#define | EBADF 9 /* Bad file number */
#define | ECHILD 10 /* No child processes */
#define | EAGAIN 11 /* Try again */
#define | ENOMEM 12 /* Out of memory */
#define | EACCES 13 /* Permission denied */
#define | EFAULT 14 /* Bad address */
#define | ENOTBLK 15 /* Block device required */
#define | EBUSY 16 /* Device or resource busy */
#define | EEXIST 17 /* File exists */
#define | EXDEV 18 /* Cross-device link */
#define | ENODEV 19 /* No such device */
#define | ENOTDIR 20 /* Not a directory */
#define | EISDIR 21 /* Is a directory */
#define | EINVAL 22 /* Invalid argument */
#define | ENFILE 23 /* File table overflow */
#define | EMFILE 24 /* Too many open files */
#define | ENOTTY 25 /* Not a typewriter */
#define | ETXTBSY 26 /* Text file busy */
#define | EFBIG 27 /* File too large */
#define | ENOSPC 28 /* No space left on device */
#define | ESPIPE 29 /* Illegal seek */
#define | EROFS 30 /* Read-only file system */
#define | EMLINK 31 /* Too many links */
#define | EPIPE 32 /* Broken pipe */
#define | EDOM 33 /* Math argument out of domain of func */
#define | ERANGE 34 /* Math result not representable */
#define | EDEADLK 35 /* Resource deadlock would occur */
#define | ENAMETOOLONG 36 /* File name too long */
#define | ENOLCK 37 /* No record locks available */
#define | ENOSYS 38 /* Function not implemented */
#define | ENOTEMPTY 39 /* Directory not empty */
#define | ELOOP 40 /* Too many symbolic links encountered */
#define | EWOULDBLOCK EAGAIN /* Operation would block */
#define | ENOMSG 42 /* No message of desired type */
#define | EIDRM 43 /* Identifier removed */
#define | ECHRNG 44 /* Channel number out of range */
#define | EL2NSYNC 45 /* Level 2 not synchronized */
#define | EL3HLT 46 /* Level 3 halted */
#define | EL3RST 47 /* Level 3 reset */
#define | ELNRNG 48 /* Link number out of range */
#define | EUNATCH 49 /* Protocol driver not attached */
#define | ENOCSI 50 /* No CSI structure available */
#define | EL2HLT 51 /* Level 2 halted */
#define | EBADE 52 /* Invalid exchange */
#define | EBADR 53 /* Invalid request descriptor */
#define | EXFULL 54 /* Exchange full */
#define | ENOANO 55 /* No anode */
#define | EBADRQC 56 /* Invalid request code */
#define | EBADSLT 57 /* Invalid slot */
#define | EDEADLOCK EDEADLK
#define | EBFONT 59 /* Bad font file format */
#define | ENOSTR 60 /* Device not a stream */
#define | ENODATA 61 /* No data available */
#define | ETIME 62 /* Timer expired */
#define | ENOSR 63 /* Out of streams resources */
#define | ENONET 64 /* Machine is not on the network */
#define | ENOPKG 65 /* Package not installed */
#define | EREMOTE 66 /* Object is remote */
#define | ENOLINK 67 /* Link has been severed */
#define | EADV 68 /* Advertise error */
#define | ESRMNT 69 /* Srmount error */
#define | ECOMM 70 /* Communication error on send */
#define | EPROTO 71 /* Protocol error */
#define | EMULTIHOP 72 /* Multihop attempted */
#define | EDOTDOT 73 /* RFS specific error */
#define | EBADMSG 74 /* Not a data message */
#define | EOVERFLOW 75 /* Value too large for defined data type */
#define | ENOTUNIQ 76 /* Name not unique on network */
#define | EBADFD 77 /* File descriptor in bad state */
#define | EREMCHG 78 /* Remote address changed */
#define | ELIBACC 79 /* Can not access a needed shared library */
#define | ELIBBAD 80 /* Accessing a corrupted shared library */
#define | ELIBSCN 81 /* .lib section in a.out corrupted */
#define | ELIBMAX 82 /* Attempting to link in too many shared libraries */
#define | ELIBEXEC 83 /* Cannot exec a shared library directly */
#define | EILSEQ 84 /* Illegal byte sequence */
#define | ERESTART 85 /* Interrupted system call should be restarted */
#define | ESTRPIPE 86 /* Streams pipe error */
#define | EUSERS 87 /* Too many users */
#define | ENOTSOCK 88 /* Socket operation on non-socket */
#define | EDESTADDRREQ 89 /* Destination address required */
#define | EMSGSIZE 90 /* Message too long */
#define | EPROTOTYPE 91 /* Protocol wrong type for socket */
#define | ENOPROTOOPT 92 /* Protocol not available */
#define | EPROTONOSUPPORT 93 /* Protocol not supported */
#define | ESOCKTNOSUPPORT 94 /* Socket type not supported */
#define | EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
#define | EPFNOSUPPORT 96 /* Protocol family not supported */
#define | EAFNOSUPPORT 97 /* Address family not supported by protocol */
#define | EADDRINUSE 98 /* Address already in use */
#define | EADDRNOTAVAIL 99 /* Cannot assign requested address */
#define | ENETDOWN 100 /* Network is down */
#define | ENETUNREACH 101 /* Network is unreachable */
#define | ENETRESET 102 /* Network dropped connection because of reset */
#define | ECONNABORTED 103 /* Software caused connection abort */
#define | ECONNRESET 104 /* Connection reset by peer */
#define | ENOBUFS 105 /* No buffer space available */
#define | EISCONN 106 /* Transport endpoint is already connected */
#define | ENOTCONN 107 /* Transport endpoint is not connected */
#define | ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
#define | ETOOMANYREFS 109 /* Too many references: cannot splice */
#define | ETIMEDOUT 110 /* Connection timed out */
#define | ECONNREFUSED 111 /* Connection refused */
#define | EHOSTDOWN 112 /* Host is down */
#define | EHOSTUNREACH 113 /* No route to host */
#define | EALREADY 114 /* Operation already in progress */
#define | EINPROGRESS 115 /* Operation now in progress */
#define | ESTALE 116 /* Stale file handle */
#define | EUCLEAN 117 /* Structure needs cleaning */
#define | ENOTNAM 118 /* Not a XENIX named type file */
#define | ENAVAIL 119 /* No XENIX semaphores available */
#define | EISNAM 120 /* Is a named type file */
#define | EREMOTEIO 121 /* Remote I/O error */
#define | EDQUOT 122 /* Quota exceeded */
#define | ECANCELED 125 /* Operation canceled */
#define | ENOKEY 126 /* Required key not available */
#define | EKEYREJECTED 127 /* Key was rejected by service */
#define | ENOTRECOVERABLE 131 /* State not recoverable */
#define | errno (*get_errno_addr())
#define | PRId16 __16_PREFIX "d"
#define | PRId32 "d"
#define | PRId64 __64_PREFIX "d"
#define | PRIu16 __16_PREFIX "u"
#define | PRIu32 "u"
#define | PRIu64 __64_PREFIX "u"
#define | PRIx16 __16_PREFIX "x"
#define | PRIx32 "x"
#define | PRIx64 __64_PREFIX "x"
#define | SCNd16 __16_PREFIX "d"
#define | SCNd32 "d"
#define | SCNd64 __64_PREFIX "d"
#define | SCNu16 __16_PREFIX "u"
#define | SCNu32 "u"
#define | SCNu64 __64_PREFIX "u"
#define | SCNx16 __16_PREFIX "x"
#define | SCNx32 "x"
#define | SCNx64 __64_PREFIX "x"
#define | CHAR_BIT 8
#define | SCHAR_MAX (127)
#define | SCHAR_MIN (-128)
#define | UCHAR_MAX (255)
#define | USHRT_MAX (0xFFFFU)
#define | SHRT_MAX (32767)
#define | SHRT_MIN (-32768)
#define | INT_MAX ((int)(~0U>>1))
#define | INT_MIN (-INT_MAX - 1)
#define | LONG_MAX ((long)(~0UL>>1))
#define | LONG_MIN (-LONG_MAX - 1)
#define | UINT_MAX (~0U)
#define | ULONG_MAX (~0UL)
#define | ULLONG_MAX (~0ULL)
#define | LLONG_MAX ((long long)(~0ULL>>1))
#define | LLONG_MIN ((long long)(-LLONG_MAX - 1))
#define | _POSIX_THREAD_KEYS_MAX 12
#define | PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
#define | _POSIX_THREAD_THREADS_MAX 64
#define | _POSIX_THREADS 1
#define | M_CACHE_PAGES 1
#define | AUTO_BUFFER_SIZE 1024
#define | BIT_PER_CPU (1)
#define | MAX_CPUS (32)
#define | BITS_TO_CPU_MASK(bits) (((bits) + BITS_PER_LONG - 1) / BITS_PER_LONG)
#define | BITMAP_ELT(cpu) ((cpu) / BITS_PER_LONG)
#define | __CPUMASK(cpu) (1L << ((cpu) % BITS_PER_LONG))
#define | DECLARE_BITMAP(name, bits) unsigned long name[BITS_TO_CPU_MASK(bits)]
#define | CPU_ZERO(cpusetp)
#define | CPU_SET(cpu, cpusetp)
#define | CPU_CLR(cpu, cpusetp)
#define | CPU_ISSET(cpu, cpusetp)
#define | EOF (-1)
#define | MAP_ANONYMOUS (1 << 0)
#define | MAP_POPULATE (1 << 1)
#define | MAP_FIXED (1 << 2)
#define | MAP_PRIVATE (1 << 3)
#define | MAP_SHARED (1 << 4)
#define | MAP_STACK (1 << 5)
#define | MAP_GROWSDOWN (1 << 6)
#define | PROT_NONE 0
#define | PROT_READ 1
#define | PROT_WRITE 2
#define | PROT_EXEC 4
#define | PGOFF_SHIFT 12
#define | MAP_PHYS_NON_SECURE (1 << 29)
#define | MAP_PHYS_NON_CACHED (1 << 28)
#define | MAP_FAILED ((void *)-1)
#define | NUM_SECONDS_IN_MIN (60)
#define | NUM_MILLIS_IN_SEC (1000)
#define | NUM_NANOS_IN_USEC (1000)
#define | NUM_NANOS_IN_MILLI (1000000L)
#define | NUM_NANOS_IN_SEC (1000000000ULL)
#define | TEMP_FAILURE_RETRY(expression)
| Recall function if it was interrupted by signal. More...
#define | UUID_STRING_LEN 37
#define | uuid_unparse_lower(uu, out) uuid_unparse((uu), (out))
#define | uuid_generate_time(x) uuid_generate(x)

## Typedefs
typedef int | errno_t
typedef intptr_t | ssize_t
typedef int | pid_t
typedef int | uid_t
typedef int | gid_t
typedef long long | time_t
typedef int64_t | off_t
typedef unsigned int | mode_t
typedef struct __uuid_t | __uuid_t
typedef __uuid_t | uuid_t
typedef void(* | constraint_handler_t) (const char *restrict msg, void *restrict ptr, errno_t error)

## Enumerations
enum | { _SC_OPEN_MAX, _SC_PAGESIZE, _SC_PHYS_PAGES, _SC_AVPHYS_PAGES, _SC_NPROCESSORS_CONF, _SC_NPROCESSORS_ONLN, _SC_THREADS, _SC_THREAD_KEYS_MAX, _SC_THREAD_THREADS_MAX, _SC_THREAD_STACK_MIN }
| sysconf system resources' names. More...

## Functions
static int | isspace (int c)
| Check for white-space characters. These are: space, form-feed ('\f'), newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). More...
static int | isascii (int c)
| Check whether `c` is a 7-bit unsigned char value that fits into the ASCII character set. More...
static int | isupper (int c)
| Check for an uppercase letter. More...
static int | islower (int c)
| Check for an lowercase letter. More...
static int | isalpha (int c)
| Check for an alphabetic character; it is equivalent to (isupper(c) || islower(c)) More...
static int | isdigit (int c)
| Check for a digit (0 through 9) More...
static int | isalnum (int c)
| Check for an alphanumeric character; it is equivalent to (isalpha(c) || isdigit(c)). More...
static int | isblank (int c)
| Check for a blank character; that is, a space or a tab. More...
static int | isxdigit (int c)
| Check for hexadecimal digits, that is, one of 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F. More...
static int | isprint (int c)
| Check for any printable character including space. More...
static int | isgraph (int c)
| Check for any printable character except space. More...
static int | ispunct (int c)
| Check for any printable character which is not a space or an alphanumeric character. More...
static int | iscntrl (int c)
| Check for a control character. More...
static int | toupper (int c)
| Convert lowercase letter to uppercase. More...
static int | tolower (int c)
| Convert uppercase letter to lowercase. More...
int * | get_errno_addr (void)
| This function should NOT be used directly, use 'errno' instead. More...
int | open (const char *pathname, int flags,...)
| Open a device by specifying its namespace path. Device driver operations should be previously registered with the namespace framework. More...
int | printf_no_alloc (const char *fmt,...)
| Prints to ringbuffer. If resulting string exceeds AUTO_BUFFER_SIZE, cuts it off to AUTO_BUFFER_SIZE. More...
int | sched_yield (void)
| Causes the calling thread to relinquish the CPU. The thread is moved to the end of the queue for its static priority and a new thread gets to run. More...
int | sched_setaffinity (pid_t pid, size_t cpusetsize, cpu_set_t *mask)
| Sets the CPU affinity mask of the process whose `ID` is pid to the value specified by `mask`. If pid is zero, then the calling process is used. More...
int | sched_getaffinity (pid_t pid, size_t cpusetsize, cpu_set_t *mask)
| Writes the affinity mask of the process whose `ID` is pid into the `cpu_set_t` structure pointed to by `mask`. More...
int | printf (const char *fmt,...)
| Format and print string. More...
int | fprintf (FILE *_restrict_ stream, const char *_restrict_ fmt,...)
| The fprintf() is equivalent to the printf(), but uses a custom file handle. More...
int | vfprintf (FILE *_restrict_ stream, const char *_restrict_ fmt, va_list ap)
| The vfprintf() is equivalent to the fprintf(), but uses an argument list. More...
int | fflush (FILE *stream)
| Flush a stream. More...
int | sprintf (char *s, const char *fmt,...)
| format and string and save it to `s'. More...
int | printf_s (const char *_restrict_ fmt,...)
| format and print string. More...
int | vsprintf_s (char *_restrict_ s, rsize_t n, const char *_restrict_ format, va_list arg)
| Write formatted data from variable length argument list to string. More...
int | vsnprintf_s (char *_restrict_ s, rsize_t n, const char *_restrict_ format, va_list arg)
| Write formatted data from variable argument list to sized buffer. More...
int | sprintf_s (char *_restrict_ s, rsize_t n, const char *_restrict_ format,...)
| format string and save it to `s'. More...
int | snprintf_s (char *_restrict_ s, rsize_t n, const char *_restrict_ format,...)
| Format string and save it to `s'. More...
int | sscanf_s (const char *_restrict_ s, const char *_restrict_ format,...)
| Reads data safely from buf and stores them according to parameter fmt into the locations given by the additional arguments. More...
int | vsscanf_s (const char *_restrict_ s, const char *_restrict_ format, va_list arg)
| vsscanf unformat a buffer into a list of arguments. More...
int | snprintf (char *s, size_t count, const char *fmt,...)
| format and string and save it to `s'. More...
int | vsprintf (char *buffer, const char *format, va_list args)
| Write formatted data from variable argument list to string. More...
int | vsnprintf (char *buffer, size_t size, const char *format, va_list args)
| Write formatted data from variable argument list to sized buffer. More...
int | sscanf (const char *buf, const char *fmt,...)
| Reads data from buf and stores them according to parameter fmt into the locations given by the additional arguments. More...
int | asprintf (char **strp, const char *fmt,...)
| print to allocated string. More...
int | vasprintf (char **strp, const char *fmt, va_list args)
| print to allocated string. More...
int | vasprintf_s (char **strp, const char *fmt, va_list args)
| Print to allocated string in secure mode. More...
int | putchar (int ch)
| writes a character to log. More...
int | puts (const char *s)
| writes the string s and a trailing newline to log(dmesg). More...
int | vsscanf (const char *buffer, const char *fmt, va_list args)
| vsscanf unformat a buffer into a list of arguments. More...
errno_t | memcpy_s (void *restrict dest, rsize_t dest_max, const void *restrict src, rsize_t n)
| Check arguments and copy `src` sized memory area to `dest`. Memory must not be overlapped. To copy overlapped area use memmove_s() function. More...
errno_t | memmove_s (void *dest, rsize_t dest_max, const void *src, rsize_t n)
| Check arguments and copy `src` sized memory area to `dest`. Memory may be overlapped. More...
errno_t | memset_s (void *block, rsize_t block_max, int c, rsize_t n)
| Check arguments and fill `n` bytes of `block` sized memory with `c` constant value. More...
size_t | strnlen_s (const char *s, size_t s_max)
| Check arguments and calculate the length of the `s` fixed-size string, excluding the terminating null byte ('\0'). More...
errno_t | strcpy_s (char *restrict dest, rsize_t dest_max, const char *restrict src)
| Check arguments and copy the `src` string, including the terminating null byte ('\0'), to the `dest` sized buffer. If `n` is bigger than size of `src` then the remaining characters (after '\0') are unspecified. More...
errno_t | strncpy_s (char *restrict dest, rsize_t dest_max, const char *restrict src, rsize_t n)
| Check arguments and copy at most `n` bytes of the `src` string, including the terminating null byte ('\0') to the `dest` sized buffer. More...
errno_t | strcat_s (char *restrict dest, rsize_t dest_max, const char *restrict src)
| Check arguments and append the `src` string to the `dest` string, overwriting the terminating null byte ('\0') at the end of `dest`, and add a terminating null byte. More...
errno_t | strncat_s (char *restrict dest, rsize_t dest_max, const char *restrict src, rsize_t n)
| Check arguments and append at most `n` bytes of `src` string to the `dest` string, overwriting the terminating null byte ('\0') at the end of dest and then adds a terminating null byte. More...
errno_t | strerror_s (char *buf, rsize_t bufmax, errno_t errnum)
| Check arguments and return a pointer to a `buf` string that describes the `errnum` error code. More...
void * | memcpy (void *dest, const void *src, size_t n)
| Copy memory area from `src` to `dst`. The memory must not overlap. To copy overlapped area use memmove() function. More...
void * | memmove (void *dest, const void *src, size_t n)
| Copy memory area from `src` to `dest`. The memory may overlap. More...
int | memcmp (const void *s1, const void *s2, size_t n)
| Compare fist `n` bytes of memory pointed by `s1` and `s2`. More...
void * | memset (void *block, int c, size_t size)
| Fill `size` bytes with a constant value. More...
size_t | strlen (const char *s)
| Calculate the length of the string `s`, excluding the terminating null byte ('\0'). More...
size_t | strnlen (const char *s, size_t n)
| Calculate the length of the fixed-size string `s`, excluding the terminating null byte ('\0'). More...
char * | strcpy (char *dest, const char *src)
| Copy the string pointed to by `src`, including the terminating null byte ('\0'), to the buffer pointed to by `dest`. More...
char * | strncpy (char *dest, const char *src, size_t n)
| Copy at most `n` bytes of the string pointed to by `src`, including the terminating null byte ('\0'), to the buffer pointed to by `dest`. More...
char * | strdup (const char *s)
| Return a pointer to a new string which is a duplicate of the string `s`. Memory for the new string is obtained with `malloc()`. More...
char * | strstr (const char *text, const char *pattern)
| Find the first occurrence of the substring `pattern` in the string `text`. The terminating null bytes ('\0') are not compared. More...
char * | strncat (char *dest, const char *src, size_t n)
| Append the `src` string to the `dest` string, overwriting the terminating null byte ('\0') at the end of dest, and then adds a terminating null byte. More...
size_t | strlcat (char *dest, const char *src, size_t n)
| Append the NUL-terminated string `src` to the end of `dest` string, overwriting the terminating null byte ('\0') at the end of dest, and guarantee to NUL-terminate the result. More...
char * | strcat (char *dest, const char *src)
| Append the `src` string to the `dest` string, overwriting the terminating null byte ('\0') at the end of dest, and then adds a terminating null byte. More...
int | strcmp (const char *s1, const char *s2)
| Compare the two strings `s1` and `s2`. More...
int | strncmp (const char *s1, const char *s2, size_t n)
| Compare at most `n` bytes of two strings `s1` and `s2`. More...
char * | strrchr (const char *s, int c)
| Find last occurence of character `c` in string `s`. More...
const char * | strerror (int errnum)
| Return a pointer to a string that describes the error code passed in the argument `errnum`. More...
void * | memchr (const void *s, int c, size_t n)
| Find a character in an area of memory. More...
void * | memrchr (const void *s, int c, size_t n)
| Find a character in an area of memory. More...
char * | strchr (const char *s, int c)
| Find first occurence of character `c` in string `s`. More...
char * | strchrnul (const char *s, int c)
| Find first occurence of character `c` in string `s`. More...
size_t | strspn (const char *s, const char *accept)
| Calculate the length (in bytes) of the initial segment of s which consists entirely of bytes in accept. More...
size_t | strcspn (const char *s, const char *reject)
| Calculate the length of the initial segment of s which consists entirely of bytes not in reject. More...
char * | strtok (char *str, const char *delim)
| Function breaks a string into a sequence of zero or more nonempty tokens. More...
char * | strtok_r (char *_restrict_ s, const char *_restrict_ sep, char **_restrict_ p)
| Function breaks a string into a sequence of zero or more nonempty tokens. More...
int | strerror_r (int errnum, char *buf, size_t buflen)
| Returns the error string in the user-supplied `buf` of length `buflen`. XSI-compliant version. More...
int | ioctl (int fd, int request, unsigned long data)
| Manipulates the underlying device parameters of special files. More...
void * | mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset)
int | munmap (void *addr, size_t length)
int | mprotect (void *addr, size_t len, int prot)
int | nanosleep (const struct timespec *req, struct timespec *rem)
| nanosleep() suspends the execution of the calling thread until either at least the time specified in `*req` has elapsed, or the delivery of a signal that triggers the invocation of a handler in the calling thread or that terminates the process. If the call is interrupted by a signal handler, nanosleep() returns -1, sets errno to EINTR, and writes the remaining time into the structure pointed to by rem unless rem is NULL. The value of `*req` can then be used to call nanosleep() again and complete the specified pause. More...
int | clock_gettime (clockid_t clk_id, struct timespec *ts)
| The function retrieves the time of the specified clock `clk_id`. This function is non-blocking, except CLOCK_REE case. In this case function can sleep and can be interrupted with -1 result and EINTR errno. More...
time_t | time (time_t *time)
| Get the current calendar time as a value of type time_t. More...
unsigned int | arm_timer_get_frequency (void)
| The function retrieves the frequency of ARM timer. More...
void | timeadd (const struct timespec *a, const struct timespec *b, struct timespec *res)
| The function adds two dates. More...
void | timesub (const struct timespec *a, const struct timespec *b, struct timespec *res)
| The function subtracts two dates. More...
int64_t | timespec_to_ms (const struct timespec *a)
| The function converts time from timespec format to milliseconds. More...
uint64_t | timespec_to_nsec (const struct timespec *a)
| The function converts time from timespec format to nanoseconds. More...
void | ms_to_timespec (int64_t t, struct timespec *a)
| The function converts time in milliseconds to to timespec format. More...
void | _exit (int status)
| Terminate the calling process "immediately". Any open file descriptors belonging to the process are closed; process's parent is sent a SIGCHLD signal. More...
int | profil (unsigned short *buf, size_t bufsiz, size_t offset, unsigned int scale)
| Provide a means to find out in what areas your program spends most of its time. The argument `buf` points to `bufsiz` bytes of core. Every virtual 10 milliseconds, the user's program counter (PC) is examined: `offset` is subtracted and the result is multiplied by `scale` and divided by 65536. If the resulting value is less than `bufsiz`, then the corresponding entry in `buf` is incremented. If `buf` is NULL, profiling is disabled. More...
pid_t | getpid (void)
| Return the process ID of the calling process. More...
pid_t | gettid (void)
| Return the thread ID of the calling thread. More...
int | getcpu (void)
| Return the number of CPU on which current thread is performed. More...
int | getcluster (void)
| Return the cluster id on which current thread is performed. More...
int | rename (const char *pathname, const char *new_pathname)
| Rename file. More...
int | unlink (const char *pathname)
| Remove a link to a file. More...
int | ftruncate (int fd, int size)
| Cause file referenced by `fd` to be truncated to a `size` of precisely length bytes. More...
int | rmdir (char *dir_name)
| Remove a directory at file system. More...
int | close (int fd)
| Deallocate the file descriptor indicated by `fd`. To deallocate means to make the file descriptor available for return by subsequent calls to open() or other functions that allocate file descriptors. All outstanding record locks owned by the process on the file associated with the file descriptor shall be removed (that is, unlocked). More...
ssize_t | read (int fd, void *buf, size_t count)
| Attempt to read `count` bytes from the file associated with the open file descriptor, `fd`, into the buffer pointed to by `buf`. More...
ssize_t | write (int fd, const void *buf, size_t count)
| Attempt to write `count` bytes from buffer pointed to by `buf` to the file associated with the open file descriptor, `fd`. More...
int | fstat (int fd, struct stat *buf)
| Get status of a file with a descriptor `fd`. More...
int | stat (const char *pathname, struct stat *buf)
| Get status of a file `pathname`. More...
int | fsync (int fd)
| Synchronize a file's in-core state with storage device. More...
int | lseek (int fd, int offset, int whence)
| Reposition read/write file offset. More...
long | sysconf (int name)
| Get configuration information at run time. More...
void | uuid_unparse (const uuid_t *uu, char *out)
| Convert binary representation of UUID to string. More...
void | uuid_unparse_upper (const uuid_t *uu, char *out)
| Convert binary representation of UUID to string. More...
int | uuid_parse (const char *in, uuid_t *uu)
| Convert an input UUID string into binary representation. More...
void | uuid_generate (uuid_t *out)
| The `uuid_generate` function creates a new universally unique identifier (UUID). More...
int | uuid_is_null (const uuid_t *uu)
| Check if UUID is null. More...
void | uuid_clear (uuid_t *uu)
| set value to zero UUID. More...
int | uuid_compare (const uuid_t *uu1, const uuid_t *uu2)
| Compare the two supplied uuid variables `uu1` and `uu2` to each other. More...
constraint_handler_t | set_constraint_handler_s (constraint_handler_t handler)
| Set the `handler` to be handler. More...
void | invoke_constraint_handler_s (const char *msg, const char *file, const char *function, uint32_t line, errno_t error)
| Print `msg` if constraint was caused. More...
void | abort_handler_s (const char *restrict msg, void *restrict ptr, errno_t error)
| Abort system if constraint was caused. More...
void | ignore_handler_s (const char *restrict msg, void *restrict ptr, errno_t error)
| Returns to the caller without performing any actions. More...
void | exit (int status)
| Cause normal process termination and return the value of `status` & 0377 to the parent. More...
static __inline__ int | abs (int j)
| Compute the absolute value of the integer argument `__n`. More...
void | abort (void)
| Cause abnormal process termination.
long | strtol (const char *nptr, char **endptr, int base)
| Convert the initial part of the string in `nptr` to a long integer value according to the given `base`, which must be between 2 and 36 inclusive, or be the special value 0. More...
unsigned long | strtoul (const char *cp, char **endp, int base)
| Convert the initial part of the string in `nptr` to a unsigned long integer value according to the given `base`, which must be between 2 and 36 inclusive, or be the special value 0. More...
double | strtod (const char *nptr, char **endptr)
| the initial portion of the string pointed to by `nptr` to double. More...
long long | strtoll (const char *nptr, char **endptr, int base)
| Convert the initial part of the string in `nptr` to a long long integer value according to the given `base`, which must be between 2 and 36 inclusive, or be the special value 0. More...
unsigned long long | strtoull (const char *cp, char **endp, int base)
| Convert the initial part of the string in `nptr` to a unsigned long long integer value according to the given `base`, which must be between 2 and 36 inclusive, or be the special value 0. More...
float | strtof (const char *nptr, char **endptr)
| the initial portion of the string pointed to by `nptr` to float. More...
long double | strtold (const char *nptr, char **endptr)
| the initial portion of the string pointed to by `nptr` to long double. More...
int | atexit (void(*func)(void))
| Register the given function to be called at normal process termination. More...
void * | malloc (size_t size)
| Allocate `size` bytes and return a pointer to the allocated memory. More...
void | free (void *ptr)
| Free the memory space pointer to by `ptr`. More...
void * | calloc (size_t nmemb, size_t size)
| Allocate memory for an array of `nmemb` elements of `size` bytes each and return a pointer to the allocated memory. More...
void * | realloc (void *ptr, size_t size)
| Change the size of the memory block pointed to by `ptr` to `size` bytes. More...
void | qsort (void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *))
| Sort an array. More...
void | qsort_r (void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *, void *), void *arg)
| Sort an array. More...
int | atoi (const char *nptr)
| Convert a string to an integer. More...
double | atof (const char *nptr)
| Convert a string to a double. More...
char * | getenv (const char *name)
| get an environment variable function stub More...
int | unsetenv (const char *name)
| delete environment variable function stub More...
int | setenv (const char *name, const char *value, int overwrite)
| change or add environment variable function stub More...

## Variables
FILE * | stdin
| Standard input stream (stub). More...
FILE * | stdout
| Standard output stream.
FILE * | stderr
| Standard error stream.

## Detailed Description

## Data Structure Documentation

struct cpu_set_t

cpu set structure

Data Fields
unsigned long | bits[((((1)*(32))+BITS_PER_LONG-1)/BITS_PER_LONG)] |

struct tm

time structure

Data Fields
int | tm_hour | Hours. [0-23]
int | tm_isdst | DST. [-1/0/1]
int | tm_mday | Day. [1-31]
int | tm_min | Minutes. [0-59]
int | tm_mon | Month. [0-11]
int | tm_sec | Seconds. [0-60] (1 leap second)
int | tm_wday | Day of week. [0-6]
int | tm_yday | Days in year.[0-365]
int | tm_year | Year - 1900.

struct __uuid_t

wrapper for uuid type.

Data Fields
uint8_t | clockSeqAndNode[8] | unique identifier for specific system.
uint16_t | timeHiAndVersion | time specific part of UUID and version number.
uint32_t | timeLow | time specific part of UUID.
uint16_t | timeMid | time specific part of UUID.

## Macro Definition Documentation

#define __CPUMASK | ( |  | cpu | ) | (1L << ((cpu) % BITS_PER_LONG))

`#include <sched.h>`

The value of cpu mask

#define _POSIX_THREAD_KEYS_MAX 12

`#include <limits.h>`

The number of data keys per process.

POSIX requires to support at least 128 keys (Linux supports up to 1024), but we can't affort such luxury

#define _POSIX_THREAD_THREADS_MAX 64

`#include <limits.h>`

The number of threads per process.

#define _POSIX_THREADS 1

`#include <limits.h>`

Threads are supported.

#define alloca _alloca

`#include <alloca.h>`

Allocate memory that is automatically freed.

Parameters

  [in] | size | of requested memory

Returns
  pointer to allocated memory

#define assert | ( |  | expr | ) | __assert__(expr, __FILE__, __LINE__)

`#include <assert.h>`

Abort the program if assertion is false.

Parameters

  [in] | expr | expression to check

Returns
  - if `expr` == `true` - do nothing
  - if `expr` != `true` - in debug mode terminates application

#define AUTO_BUFFER_SIZE 1024

`#include <print_no_alloc.h>`

Buffer size.

#define BIT_PER_CPU (1)

`#include <sched.h>`

The number cpu bits

#define BITMAP_ELT | ( |  | cpu | ) | ((cpu) / BITS_PER_LONG)

`#include <sched.h>`

The bit map element

#define BITS_TO_CPU_MASK | ( |  | bits | ) | (((bits) + BITS_PER_LONG - 1) / BITS_PER_LONG)

`#include <sched.h>`

The number bits of cpu mask

#define CHAR_BIT 8

`#include <limits.h>`

Number of bits in a type `char`

#define CPU_CLR | ( |  | cpu,
|  |  | cpusetp
| ) |  |

`#include <sched.h>`

Value:
({ \
size_t __cpu = (cpu); \
__cpu < CHAR_BIT * (sizeof(cpu_set_t)) \
? (((cpusetp)->bits)[BITMAP_ELT(__cpu)] &= ~__CPUMASK (__cpu)) \
: 0; \
})
__CPUMASK
#define __CPUMASK(cpu)
Definition: sched.h:41
BITMAP_ELT
#define BITMAP_ELT(cpu)
Definition: sched.h:36
cpu_set_t
Definition: sched.h:51
CHAR_BIT
#define CHAR_BIT
Definition: limits.h:27

The macros for clear cpu

#define CPU_ISSET | ( |  | cpu,
|  |  | cpusetp
| ) |  |

`#include <sched.h>`

Value:
({ \
size_t __cpu = (cpu); \
__cpu < CHAR_BIT * (sizeof(cpu_set_t)) \
? ((((cpusetp)->bits)[BITMAP_ELT(__cpu)] & __CPUMASK (__cpu))) != 0 \
: 0; \
})
__CPUMASK
#define __CPUMASK(cpu)
Definition: sched.h:41
BITMAP_ELT
#define BITMAP_ELT(cpu)
Definition: sched.h:36
cpu_set_t
Definition: sched.h:51
CHAR_BIT
#define CHAR_BIT
Definition: limits.h:27

The macros for check is spu is set

#define CPU_SET | ( |  | cpu,
|  |  | cpusetp
| ) |  |

`#include <sched.h>`

Value:
({ \
size_t __cpu = (cpu); \
__cpu < CHAR_BIT * (sizeof(cpu_set_t)) \
? (((cpusetp)->bits)[BITMAP_ELT(__cpu)] |= __CPUMASK (__cpu)) \
: 0; \
})
__CPUMASK
#define __CPUMASK(cpu)
Definition: sched.h:41
BITMAP_ELT
#define BITMAP_ELT(cpu)
Definition: sched.h:36
cpu_set_t
Definition: sched.h:51
CHAR_BIT
#define CHAR_BIT
Definition: limits.h:27

The macros for set cpu to cpusetp

#define CPU_ZERO | ( |  | cpusetp | ) |

`#include <sched.h>`

Value:
({ \
size_t i; \
size_t imax = (sizeof(cpu_set_t)) / sizeof (unsigned long); \
unsigned long *bits = (cpusetp)->bits; \
for (i = 0; i < imax; ++i) \
bits[i] = 0; \
})
cpu_set_t
Definition: sched.h:51

The macros for set cpu to zero

#define DECLARE_BITMAP | ( |  | name,
|  |  | bits
| ) |  | unsigned long name[BITS_TO_CPU_MASK(bits)]

`#include <sched.h>`

The short type of bitmap

#define E2BIG 7 /* Argument list too long */

`#include <core/error.h>`

Argument list too long.

#define EACCES 13 /* Permission denied */

`#include <core/error.h>`

Permission denied.

#define EADDRINUSE 98 /* Address already in use */

`#include <core/error.h>`

Address already in use.

#define EADDRNOTAVAIL 99 /* Cannot assign requested address */

`#include <core/error.h>`

Cannot assign requested address.

#define EADV 68 /* Advertise error */

`#include <core/error.h>`

Advertise error.

#define EAFNOSUPPORT 97 /* Address family not supported by protocol */

`#include <core/error.h>`

Address family not supported by protocol.

#define EAGAIN 11 /* Try again */

`#include <core/error.h>`

Try again.

#define EALREADY 114 /* Operation already in progress */

`#include <core/error.h>`

Operation already in progress.

#define EBADE 52 /* Invalid exchange */

`#include <core/error.h>`

Invalid exchange.

#define EBADF 9 /* Bad file number */

`#include <core/error.h>`

Bad file number.

#define EBADFD 77 /* File descriptor in bad state */

`#include <core/error.h>`

File descriptor in bad state.

#define EBADMSG 74 /* Not a data message */

`#include <core/error.h>`

Not a data message.

#define EBADR 53 /* Invalid request descriptor */

`#include <core/error.h>`

Invalid request descriptor.

#define EBADRQC 56 /* Invalid request code */

`#include <core/error.h>`

Invalid request code.

#define EBADSLT 57 /* Invalid slot */

`#include <core/error.h>`

Invalid slot.

#define EBFONT 59 /* Bad font file format */

`#include <core/error.h>`

Bad font file format.

#define EBUSY 16 /* Device or resource busy */

`#include <core/error.h>`

Device or resource busy.

#define ECANCELED 125 /* Operation canceled */

`#include <core/error.h>`

Operation canceled.

#define ECHILD 10 /* No child processes */

`#include <core/error.h>`

No child processes.

#define ECHRNG 44 /* Channel number out of range */

`#include <core/error.h>`

Channel number out of range.

#define ECOMM 70 /* Communication error on send */

`#include <core/error.h>`

Communication error on send.

#define ECONNABORTED 103 /* Software caused connection abort */

`#include <core/error.h>`

Software caused connection abort.

#define ECONNREFUSED 111 /* Connection refused */

`#include <core/error.h>`

Connection refused.

#define ECONNRESET 104 /* Connection reset by peer */

`#include <core/error.h>`

Connection reset by peer.

#define EDEADLK 35 /* Resource deadlock would occur */

`#include <core/error.h>`

Resource deadlock would occur.

#define EDEADLOCK EDEADLK

`#include <core/error.h>`

Resource deadlock would occur.

#define EDESTADDRREQ 89 /* Destination address required */

`#include <core/error.h>`

Destination address required.

#define EDOM 33 /* Math argument out of domain of func */

`#include <core/error.h>`

Math argument out of domain of func.

#define EDOTDOT 73 /* RFS specific error */

`#include <core/error.h>`

RFS specific error.

#define EDQUOT 122 /* Quota exceeded */

`#include <core/error.h>`

Quota exceeded.

#define EEXIST 17 /* File exists */

`#include <core/error.h>`

File exists.

#define EFAULT 14 /* Bad address */

`#include <core/error.h>`

Bad address.

#define EFBIG 27 /* File too large */

`#include <core/error.h>`

File too large.

#define EHOSTDOWN 112 /* Host is down */

`#include <core/error.h>`

Host is down.

#define EHOSTUNREACH 113 /* No route to host */

`#include <core/error.h>`

No route to host.

#define EIDRM 43 /* Identifier removed */

`#include <core/error.h>`

Identifier removed.

#define EILSEQ 84 /* Illegal byte sequence */

`#include <core/error.h>`

Illegal byte sequence.

#define EINPROGRESS 115 /* Operation now in progress */

`#include <core/error.h>`

Operation now in progress.

#define EINTR 4 /* Interrupted system call */

`#include <core/error.h>`

Interrupted system call.

#define EINVAL 22 /* Invalid argument */

`#include <core/error.h>`

Invalid argument.

#define EIO 5 /* I/O error */

`#include <core/error.h>`

I/O error.

#define EISCONN 106 /* Transport endpoint is already connected */

`#include <core/error.h>`

Transport endpoint is already connected.

#define EISDIR 21 /* Is a directory */

`#include <core/error.h>`

Is a directory.

#define EISNAM 120 /* Is a named type file */

`#include <core/error.h>`

Is a named type file.

#define EKEYREJECTED 127 /* Key was rejected by service */

`#include <core/error.h>`

Key was rejected by service.

#define EL2HLT 51 /* Level 2 halted */

`#include <core/error.h>`

Level 2 halted.

#define EL2NSYNC 45 /* Level 2 not synchronized */

`#include <core/error.h>`

Level 2 not synchronized.

#define EL3HLT 46 /* Level 3 halted */

`#include <core/error.h>`

Level 3 halted.

#define EL3RST 47 /* Level 3 reset */

`#include <core/error.h>`

Level 3 reset.

#define ELIBACC 79 /* Can not access a needed shared library */

`#include <core/error.h>`

Can not access a needed shared library.

#define ELIBBAD 80 /* Accessing a corrupted shared library */

`#include <core/error.h>`

Accessing a corrupted shared library.

#define ELIBEXEC 83 /* Cannot exec a shared library directly */

`#include <core/error.h>`

Cannot exec a shared library directly.

#define ELIBMAX 82 /* Attempting to link in too many shared libraries */

`#include <core/error.h>`

Attempting to link in too many shared libraries.

#define ELIBSCN 81 /* .lib section in a.out corrupted */

`#include <core/error.h>`

.lib section in a.out corrupted.

#define ELNRNG 48 /* Link number out of range */

`#include <core/error.h>`

Link number out of range.

#define ELOOP 40 /* Too many symbolic links encountered */

`#include <core/error.h>`

Too many symbolic links encountered.

#define EMFILE 24 /* Too many open files */

`#include <core/error.h>`

Too many open files.

#define EMLINK 31 /* Too many links */

`#include <core/error.h>`

Too many links.

#define EMSGSIZE 90 /* Message too long */

`#include <core/error.h>`

Message too long.

#define EMULTIHOP 72 /* Multihop attempted */

`#include <core/error.h>`

Multihop attempted.

#define ENAMETOOLONG 36 /* File name too long */

`#include <core/error.h>`

File name too long.

#define ENAVAIL 119 /* No XENIX semaphores available */

`#include <core/error.h>`

No XENIX semaphores available.

#define ENETDOWN 100 /* Network is down */

`#include <core/error.h>`

Network is down.

#define ENETRESET 102 /* Network dropped connection because of reset */

`#include <core/error.h>`

Network dropped connection because of reset.

#define ENETUNREACH 101 /* Network is unreachable */

`#include <core/error.h>`

Network is unreachable.

#define ENFILE 23 /* File table overflow */

`#include <core/error.h>`

File table overflow.

#define ENOANO 55 /* No anode */

`#include <core/error.h>`

No anode.

#define ENOBUFS 105 /* No buffer space available */

`#include <core/error.h>`

No buffer space available.

#define ENOCSI 50 /* No CSI structure available */

`#include <core/error.h>`

No CSI structure available.

#define ENODATA 61 /* No data available */

`#include <core/error.h>`

No data available.

#define ENODEV 19 /* No such device */

`#include <core/error.h>`

No such device.

#define ENOENT 2 /* No such file or directory */

`#include <core/error.h>`

No such file or directory.

#define ENOEXEC 8 /* Exec format error */

`#include <core/error.h>`

Exec format error.

#define ENOKEY 126 /* Required key not available */

`#include <core/error.h>`

Required key not available.

#define ENOLCK 37 /* No record locks available */

`#include <core/error.h>`

No record locks available.

#define ENOLINK 67 /* Link has been severed */

`#include <core/error.h>`

Link has been severed.

#define ENOMEM 12 /* Out of memory */

`#include <core/error.h>`

Out of memory.

#define ENOMSG 42 /* No message of desired type */

`#include <core/error.h>`

No message of desired type.

#define ENONET 64 /* Machine is not on the network */

`#include <core/error.h>`

Machine is not on the network.

#define ENOPKG 65 /* Package not installed */

`#include <core/error.h>`

Package not installed.

#define ENOPROTOOPT 92 /* Protocol not available */

`#include <core/error.h>`

Protocol not available.

#define ENOSPC 28 /* No space left on device */

`#include <core/error.h>`

No space left on device.

#define ENOSR 63 /* Out of streams resources */

`#include <core/error.h>`

Out of streams resources.

#define ENOSTR 60 /* Device not a stream */

`#include <core/error.h>`

Device not a stream.

#define ENOSYS 38 /* Function not implemented */

`#include <core/error.h>`

Function not implemented.

#define ENOTBLK 15 /* Block device required */

`#include <core/error.h>`

Block device required.

#define ENOTCONN 107 /* Transport endpoint is not connected */

`#include <core/error.h>`

Transport endpoint is not connected.

#define ENOTDIR 20 /* Not a directory */

`#include <core/error.h>`

Not a directory.

#define ENOTEMPTY 39 /* Directory not empty */

`#include <core/error.h>`

Directory not empty.

#define ENOTNAM 118 /* Not a XENIX named type file */

`#include <core/error.h>`

Not a XENIX named type file.

#define ENOTRECOVERABLE 131 /* State not recoverable */

`#include <core/error.h>`

State not recoverable.

#define ENOTSOCK 88 /* Socket operation on non-socket */

`#include <core/error.h>`

Socket operation on non-socket.

#define ENOTTY 25 /* Not a typewriter */

`#include <core/error.h>`

Not a typewriter.

#define ENOTUNIQ 76 /* Name not unique on network */

`#include <core/error.h>`

Name not unique on network.

#define ENXIO 6 /* No such device or address */

`#include <core/error.h>`

No such device or address.

#define EOF (-1)

`#include <stdio.h>`

EOF - symbol signifying End Of File.

#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */

`#include <core/error.h>`

Operation not supported on transport endpoint.

#define EOVERFLOW 75 /* Value too large for defined data type */

`#include <core/error.h>`

Value too large for defined data type.

#define EPERM 1 /* Operation not permitted */

`#include <core/error.h>`

Operation not permitted.

#define EPFNOSUPPORT 96 /* Protocol family not supported */

`#include <core/error.h>`

Protocol family not supported.

#define EPIPE 32 /* Broken pipe */

`#include <core/error.h>`

Broken pipe.

#define EPROTO 71 /* Protocol error */

`#include <core/error.h>`

Protocol error.

#define EPROTONOSUPPORT 93 /* Protocol not supported */

`#include <core/error.h>`

Protocol not supported.

#define EPROTOTYPE 91 /* Protocol wrong type for socket */

`#include <core/error.h>`

Protocol wrong type for socket.

#define ERANGE 34 /* Math result not representable */

`#include <core/error.h>`

Math result not representable.

#define EREMCHG 78 /* Remote address changed */

`#include <core/error.h>`

Remote address changed.

#define EREMOTE 66 /* Object is remote */

`#include <core/error.h>`

Object is remote.

#define EREMOTEIO 121 /* Remote I/O error */

`#include <core/error.h>`

Remote I/O error.

#define ERESTART 85 /* Interrupted system call should be restarted */

`#include <core/error.h>`

Interrupted system call should be restarted.

#define EROFS 30 /* Read-only file system */

`#include <core/error.h>`

Read-only file system.

#define errno (*get_errno_addr())

`#include <errno.h>`

number of last error

Contains numeric code of last error, list of possible error codes is specified in POSIX.1-2001 or in core/error.h file.

#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */

`#include <core/error.h>`

Cannot send after transport endpoint shutdown.

#define ESOCKTNOSUPPORT 94 /* Socket type not supported */

`#include <core/error.h>`

Socket type not supported.

#define ESPIPE 29 /* Illegal seek */

`#include <core/error.h>`

Illegal seek.

#define ESRCH 3 /* No such process */

`#include <core/error.h>`

No such process.

#define ESRMNT 69 /* Srmount error */

`#include <core/error.h>`

Srmount error.

#define ESTALE 116 /* Stale file handle */

`#include <core/error.h>`

Stale file handle.

#define ESTRPIPE 86 /* Streams pipe error */

`#include <core/error.h>`

Streams pipe error.

#define ETIME 62 /* Timer expired */

`#include <core/error.h>`

Timer expired.

#define ETIMEDOUT 110 /* Connection timed out */

`#include <core/error.h>`

Connection timed out.

#define ETOOMANYREFS 109 /* Too many references: cannot splice */

`#include <core/error.h>`

Too many references: cannot splice.

#define ETXTBSY 26 /* Text file busy */

`#include <core/error.h>`

Text file busy.

#define EUCLEAN 117 /* Structure needs cleaning */

`#include <core/error.h>`

Structure needs cleaning.

#define EUNATCH 49 /* Protocol driver not attached */

`#include <core/error.h>`

Protocol driver not attached.

#define EUSERS 87 /* Too many users */

`#include <core/error.h>`

Too many users.

#define EWOULDBLOCK EAGAIN /* Operation would block */

`#include <core/error.h>`

Operation would block.

#define EXDEV 18 /* Cross-device link */

`#include <core/error.h>`

Cross-device link.

#define EXFULL 54 /* Exchange full */

`#include <core/error.h>`

Exchange full.

#define INT_MAX ((int)(~0U>>1))

`#include <limits.h>`

Maximum value for an object of type `int`. Minimum Acceptable Value: 2 147 483 647

#define INT_MIN (-INT_MAX - 1)

`#include <limits.h>`

Minimum value for an object of type `int`. Maximum Acceptable Value: -2 147 483 647

#define LLONG_MAX ((long long)(~0ULL>>1))

`#include <limits.h>`

Maximum value for an object of type `long long`. Minimum Acceptable Value: +9223372036854775807

#define LLONG_MIN ((long long)(-LLONG_MAX - 1))

`#include <limits.h>`

Minimum value for an object of type `long long`. Maximum Acceptable Value: -9223372036854775807

#define LONG_MAX ((long)(~0UL>>1))

`#include <limits.h>`

Maximum value for an object of type `long`. Minimum Acceptable Value: +2 147 483 647

#define LONG_MIN (-LONG_MAX - 1)

`#include <limits.h>`

Minimum value for an object of type `long`. Maximum Acceptable Value: -2 147 483 647

#define M_CACHE_PAGES 1

`#include <malloc.h>`

For setting number of pages that not to be munmapped to reuse them quickly again.

#define MAP_ANONYMOUS (1 << 0)

`#include <core/mman.h>`

The mapping is not backed by any file; its contents are initialized to zero.

#define MAP_FAILED ((void *)-1)

`#include <sys/mman.h>`

Error return value from mmap().

#define MAP_FIXED (1 << 2)

`#include <core/mman.h>`

Don't interpret `addr` as a hint: place the mapping at exactly that address. `addr` must be a multiple of the page size.

#define MAP_GROWSDOWN (1 << 6)

`#include <core/mman.h>`

This flag may be used with MAP_STACK. It indicates to the kernel virtual memory system that the mapping should extend downward in memory. mmap() calls will return the highest address on the stack.

#define MAP_PHYS_NON_CACHED (1 << 28)

`#include <driver/mem/phys.h>`

Memory will be mapped as non-cached.

#define MAP_PHYS_NON_SECURE (1 << 29)

`#include <driver/mem/phys.h>`

Non-secure memory region will be mapped.

#define MAP_POPULATE (1 << 1)

`#include <core/mman.h>`

Populate (prefault) page tables for a mapping.

#define MAP_PRIVATE (1 << 3)

`#include <core/mman.h>`

Create a private copy-on-write mapping. Updates to the mapping are not visible to other processes mapping the same file, and are not carried through to the underlying file.

#define MAP_SHARED (1 << 4)

`#include <core/mman.h>`

Share this mapping. Updates to the mapping are visible to other processes that map this file, and are carried through to the underlying file.

#define MAP_STACK (1 << 5)

`#include <core/mman.h>`

Allocate the mapping at an address suitable for a process or thread stack. Use for SafeStack mechanism.

#define MAX_CPUS (32)

`#include <sched.h>`

The maximum cpu number

#define NUM_MILLIS_IN_SEC (1000)

`#include <time.h>`

The number millisecond in second

#define NUM_NANOS_IN_MILLI (1000000L)

`#include <time.h>`

The number nanosecond in millisecond

#define NUM_NANOS_IN_SEC (1000000000ULL)

`#include <time.h>`

The number nanosecond in second

#define NUM_NANOS_IN_USEC (1000)

`#include <time.h>`

The number nanosecond in microsecond

#define NUM_SECONDS_IN_MIN (60)

`#include <time.h>`

The number second in minute

#define PGOFF_SHIFT 12

`#include <core/mman.h>`

Offset shift.

#define PRId16 __16_PREFIX "d"

`#include <inttypes.h>`

Macro to be used in a format string to print the value of type int16_t

#define PRId32 "d"

`#include <inttypes.h>`

Macro to be used in a format string to print the value of type int32_t

#define PRId64 __64_PREFIX "d"

`#include <inttypes.h>`

Macro to be used in a format string to print the value of type int64_t

#define PRIu16 __16_PREFIX "u"

`#include <inttypes.h>`

Macro to be used in a format string to print the value of type uint16_t

#define PRIu32 "u"

`#include <inttypes.h>`

Macro to be used in a format string to print the value of type uint32_t

#define PRIu64 __64_PREFIX "u"

`#include <inttypes.h>`

Macro to be used in a format string to print the value of type uint64_t

#define PRIx16 __16_PREFIX "x"

`#include <inttypes.h>`

Macro to be used in a format string to scan the 16-bit value in hex

#define PRIx32 "x"

`#include <inttypes.h>`

Macro to be used in a format string to print the 32-bit value in hex

#define PRIx64 __64_PREFIX "x"

`#include <inttypes.h>`

Macro to be used in a format string to print the 64-bit value in hex

#define PROT_EXEC 4

`#include <core/mman.h>`

Pages may be executed.

#define PROT_NONE 0

`#include <core/mman.h>`

Pages may not be accessed.

#define PROT_READ 1

`#include <core/mman.h>`

Pages may be read.

#define PROT_WRITE 2

`#include <core/mman.h>`

Pages may be written.

#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX

`#include <limits.h>`

Maximum number of data keys that can be created by a process. Minimum Acceptable Value: _POSIX_THREAD_KEYS_MAX

#define SCHAR_MAX (127)

`#include <limits.h>`

Maximum value for an object of type `signed char`. Minimum Acceptable Value: 127

#define SCHAR_MIN (-128)

`#include <limits.h>`

Minumum value for an object of type `signed char`. Maximum Acceptable Value: -128

#define SCNd16 __16_PREFIX "d"

`#include <inttypes.h>`

Macro to be used in a format string to scan the value of type int16_t

#define SCNd32 "d"

`#include <inttypes.h>`

Macro to be used in a format string to scan the value of type int32_t

#define SCNd64 __64_PREFIX "d"

`#include <inttypes.h>`

Macro to be used in a format string to scan the value of type int64_t

#define SCNu16 __16_PREFIX "u"

`#include <inttypes.h>`

Macro to be used in a format string to scan the value of type uint16_t

#define SCNu32 "u"

`#include <inttypes.h>`

Macro to be used in a format string to scan the value of type uint32_t

#define SCNu64 __64_PREFIX "u"

`#include <inttypes.h>`

Macro to be used in a format string to scan the value of type uint64_t

#define SCNx16 __16_PREFIX "x"

`#include <inttypes.h>`

Macro to be used in a format string to scan the 16-bit value in hex

#define SCNx32 "x"

`#include <inttypes.h>`

Macro to be used in a format string to scan the 32-bit value in hex

#define SCNx64 __64_PREFIX "x"

`#include <inttypes.h>`

Macro to be used in a format string to scan the 64-bit value in hex

#define SHRT_MAX (32767)

`#include <limits.h>`

Maximum value for an object of type `signed short int`. Minimum Acceptable Value: 32767

#define SHRT_MIN (-32768)

`#include <limits.h>`

Minimum value for an object of type `signed short int`. Maximum Acceptable Value: -32768

#define TEMP_FAILURE_RETRY | ( |  | expression | ) |

`#include <unistd.h>`

Value:
({ \
typeof (expression) _result; \
do { \
_result = (expression); \
} while (_result == ((typeof (expression)) -1) && errno == EINTR); \
_result; })
EINTR
#define EINTR
errno
#define errno
Definition: errno.h:290

Recall function if it was interrupted by signal.

Parameters

  [in] | expression | macro argument.

Returns
  result of last function call.

#define UCHAR_MAX (255)

`#include <limits.h>`

Maximum value for an object of type `unsigned char`. Minimum Acceptable Value: 255

#define UINT_MAX (~0U)

`#include <limits.h>`

Maximum value for an object of type `unsigned`. Minimum Acceptable Value: 4 294 967 295

#define ULLONG_MAX (~0ULL)

`#include <limits.h>`

Maximum value for an object of type `unsigned long long`. Minimum Acceptable Value: 18446744073709551615

#define ULONG_MAX (~0UL)

`#include <limits.h>`

Maximum value for an object of type `unsigned long`. Minimum Acceptable Value: 4 294 967 295

#define USHRT_MAX (0xFFFFU)

`#include <limits.h>`

Maximum value for an object of type `unsigned short`. Minimum Acceptable Value: 65 535

#define uuid_generate_time | ( |  | x | ) | uuid_generate(x)

`#include <uuid/uuid.h>`

The `uuid_generate` function creates a new universally unique identifier (UUID). based on secure timer value.

#define UUID_STRING_LEN 37

`#include <uuid/uuid.h>`

Length of string representation of UUID in format (with terminating '\0'): `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`.

#define uuid_unparse_lower | ( |  | uu,
|  |  | out
| ) |  | uuid_unparse((uu), (out))

`#include <uuid/uuid.h>`

Convert binary representation of UUID to string in lowercase format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`.

## Typedef Documentation

__uuid_t

`#include <uuid/uuid.h>`

Provide UUID type as the structure.

constraint_handler_t

`#include <stdlib.h>`

Used for runtime-constraint handler description.

errno_t

`#include <errno.h>`

Used for error description in safe C functions (*_s). See Annex K of C11 standard.

gid_t

`#include <sys/types.h>`

Used for groups IDs.

mode_t

`#include <sys/types.h>`

Used for some file attributes.

off_t

`#include <sys/types.h>`

Used for file sizes.

pid_t

`#include <sys/types.h>`

Used for process IDs.

ssize_t

`#include <sys/types.h>`

Used for a count of bytes or an error indication.

time_t

`#include <sys/types.h>`

Used for time in seconds.

uid_t

`#include <sys/types.h>`

Used for user IDs.

uuid_t

`#include <uuid/uuid.h>`

Provide UUID type for users.

## Enumeration Type Documentation

anonymous enum

`#include <unistd.h>`

sysconf system resources' names.

Enumerator
_SC_OPEN_MAX | Max number of files that TA can have open.
_SC_PAGESIZE | Size of a page in bytes.
_SC_PHYS_PAGES | The number of pages of physical memory.
_SC_AVPHYS_PAGES | The number of currently available physical pages.
_SC_NPROCESSORS_CONF | The number of processors configured.
_SC_NPROCESSORS_ONLN | The number of processors currently online (same as previous).
_SC_THREADS | Inquire about the parameter corresponding to _POSIX_THREADS.
_SC_THREAD_KEYS_MAX | Inquire about the parameter corresponding to _POSIX_THREAD_KEYS_MAX
_SC_THREAD_THREADS_MAX | Inquire about the parameter corresponding to _POSIX_THREAD_THREADS_MAX.
_SC_THREAD_STACK_MIN | Inquire about the parameter corresponding to _POSIX_THREAD_STACK_MIN.

## Function Documentation

void _exit | ( | int | status | ) |

`#include <unistd.h>`

Terminate the calling process "immediately". Any open file descriptors belonging to the process are closed; process's parent is sent a SIGCHLD signal.

Cause process termination without calling of functions registered with atexit() and return the value of `status` & 0377 to the parent.

Parameters

  [in] | status | value to return to parent process.
  [in] | status | function argument.

void abort_handler_s | ( | const char *restrict | msg,
|  | void *restrict | ptr,
|  | errno_t | error
| ) |  |

`#include <stdlib.h>`

Abort system if constraint was caused.

Parameters

  [in] | msg | pointer to the error message.
  [in] | ptr | pointer to an implementation-defined object or a NULL.
  [in] | error | positive value of type errno_t.

static __inline__ int abs | ( | int | j | ) |
| static

`#include <stdlib.h>`

Compute the absolute value of the integer argument `__n`.

Parameters

  [in] | j | function argument.

Returns
  the result of computation.

unsigned int arm_timer_get_frequency | ( | void |  | ) |

`#include <time.h>`

The function retrieves the frequency of ARM timer.

Return values

  frequency | of ARM timer in HZ.

int asprintf | ( | char ** | strp,
|  | const char * | fmt,
|  |  | ...
| ) |  |

`#include <stdio.h>`

print to allocated string.

Parameters

  [out] | strp | Pointer to newly allocated string or NULL(if the function failed).
  [in] | fmt | Format string.
  [in,out] | ... | Variable arguments for printing.

The functions asprintf() and vasprintf() are analogs of sprintf() and vsprintf(), except that they allocate a string large enough to hold the output including the terminating null byte, and return a pointer to it via the first argument. This pointer should be passed to free() to release the allocated storage when it is no longer needed.
These functions are TEEGRIS extensions, not in C or POSIX. They are also available under *BSD and GNU/Linux. The GNU/Linux implementation leaves strp in undefined state in case of error.

Return values

  >=0 | number of bytes printed if succeed
  -1 | if failed, and set strp to NULL

int atexit | ( | void(*)(void) | func | ) |

`#include <stdlib.h>`

Register the given function to be called at normal process termination.

Parameters

  [in] | func | pointer to the function.

Returns
  - 0 if successful
  - nonzero otherwise

double atof | ( | const char * | nptr | ) |

`#include <stdlib.h>`

Convert a string to a double.

Parameters

  [in] | nptr | pointer to the string

Return values

  Converted | value

int atoi | ( | const char * | nptr | ) |

`#include <stdlib.h>`

Convert a string to an integer.

Parameters

  [in] | nptr | pointer to the string

Return values

  Converted | value

void* calloc | ( | size_t | nmemb,
|  | size_t | size
| ) |  |

`#include <stdlib.h>`

Allocate memory for an array of `nmemb` elements of `size` bytes each and return a pointer to the allocated memory.

Note
  The memory is set to zero.

Parameters

  [in] | nmemb | function argument.
  [in] | size | function argument.

Return values

  address | pointer to allocated memory on success.
  NULL | if size is equal to zero.
  NULL | and sets errno to ENOMEM if there is no enough memory to be allocated.

int clock_gettime | ( | clockid_t | clk_id,
|  | struct timespec * | ts
| ) |  |

`#include <time.h>`

The function retrieves the time of the specified clock `clk_id`. This function is non-blocking, except CLOCK_REE case. In this case function can sleep and can be interrupted with -1 result and EINTR errno.

Parameters

  [in] | clk_id | Specified clock.
  [out] | ts | timespec structs argument.

Return values

  0 | on success.
  -1 | on failure. errno variable is set appropriately.

int close | ( | int | fd | ) |

`#include <unistd.h>`

Deallocate the file descriptor indicated by `fd`. To deallocate means to make the file descriptor available for return by subsequent calls to open() or other functions that allocate file descriptors. All outstanding record locks owned by the process on the file associated with the file descriptor shall be removed (that is, unlocked).

Parameters

  [in] | fd | file descriptor.

Return values

  0 | on success.
  -1 | on error. errno is set appropriately.

void exit | ( | int | status | ) |

`#include <stdlib.h>`

Cause normal process termination and return the value of `status` & 0377 to the parent.

Parameters

  [in] | status | function argument.

int fflush | ( | FILE * | stream | ) |

`#include <stdio.h>`

Flush a stream.

Parameters

  [in] | stream | A writeable file handle.

Return values

  =0 | if succeed.
  EOF | if error occurred.

int fprintf | ( | FILE *_restrict_ | stream,
|  | const char *_restrict_ | fmt,
|  |  | ...
| ) |  |

`#include <stdio.h>`

The fprintf() is equivalent to the printf(), but uses a custom file handle.

Parameters

  [in] | stream | A writeable file handle.
  [in] | fmt | Format specification of output string.
  [in,out] | ... | Arguments used for printing.

Return values

  >=0 | number of characters printed if succeed.
  -1 | if error occurred.

Example:

fprintf(stdout, "Hello, %s!\n", "world");

void free | ( | void * | ptr | ) |

`#include <stdlib.h>`

Free the memory space pointer to by `ptr`.

Note
  if free(`ptr`) has already been called before, undefined behaviour occurs.

Parameters

  [in] | ptr | - pointer returned by a previous call to malloc(), calloc(), or realloc().

int fstat | ( | int | fd,
|  | struct stat * | buf
| ) |  |

`#include <unistd.h>`

Get status of a file with a descriptor `fd`.

Parameters

  [in] | fd | File descriptor.
  [out] | buf | Pointer to structure to store status information.

Return values

  0 | on success.
  -1 | on error. errno is set appropriately.

int fsync | ( | int | fd | ) |

`#include <unistd.h>`

Synchronize a file's in-core state with storage device.

Parameters

  [in] | fd | File descriptor.

Return values

  0 | on success.
  -1 | on error. errno is set appropriately.

int ftruncate | ( | int | fd,
|  | int | size
| ) |  |

`#include <unistd.h>`

Cause file referenced by `fd` to be truncated to a `size` of precisely length bytes.

Parameters

  [in] | fd | file descriptor.
  [in] | size | function argument.

Return values

  0 | on success.
  -1 | on error. errno is set appropriately.

int* get_errno_addr | ( | void |  | ) |

`#include <errno.h>`

This function should NOT be used directly, use 'errno' instead.

Returns
  thread local pointer to errno

int getcluster | ( | void |  | ) |

`#include <unistd.h>`

Return the cluster id on which current thread is performed.

Note
  Arch-specific function. Assumes the presence of two clusters.

Returns
  function result.

int getcpu | ( | void |  | ) |

`#include <unistd.h>`

Return the number of CPU on which current thread is performed.

Returns
  function result.

char* getenv | ( | const char * | name | ) |

`#include <stdlib.h>`

get an environment variable function stub

Parameters

  [in] | name | environment variable name

Return values

  NULL |

pid_t getpid | ( | void |  | ) |

`#include <unistd.h>`

Return the process ID of the calling process.

Returns
  function result.

pid_t gettid | ( | void |  | ) |

`#include <unistd.h>`

Return the thread ID of the calling thread.

Returns
  function result.

void ignore_handler_s | ( | const char *restrict | msg,
|  | void *restrict | ptr,
|  | errno_t | error
| ) |  |

`#include <stdlib.h>`

Returns to the caller without performing any actions.

Parameters

  [in] | msg | pointer to the error message.
  [in] | ptr | pointer to an implementation-defined object or a NULL.
  [in] | error | positive value of type errno_t.

void invoke_constraint_handler_s | ( | const char * | msg,
|  | const char * | file,
|  | const char * | function,
|  | uint32_t | line,
|  | errno_t | error
| ) |  |

`#include <stdlib.h>`

Print `msg` if constraint was caused.

Parameters

  [in] | msg | pointer to the error message.
  [in] | file | name of file where constraint was caused.
  [in] | function | name of function where constraint was caused.
  [in] | line | number of line where constraint was caused.
  [in] | error | positive value of type errno_t.

int ioctl | ( | int | fd,
|  | int | request,
|  | unsigned long | data
| ) |  |

`#include <sys/ioctl.h>`

Manipulates the underlying device parameters of special files.

Parameters

  [in] | fd | Open file descriptor.
  [in] | request | Device-dependent request code.
  [in,out] | data | Optional data associated with request.

Returns
  usually, on success zero is returned, on error -1 is returned and errno is set appropriately. Strictly speaking, return status is device-dependent.

Performs a variety of control functions on a device opened by open() system call. The request argument and an optional third argument (of varying type) are device driver implementation-defined. Example:

ret = ioctl (fd, STORAGE_GET_IMAGE_SNAPSHOT, 0);
if (ret == -1)
return errno;

static int isalnum | ( | int | c | ) |
| static

`#include <ctype.h>`

Check for an alphanumeric character; it is equivalent to (isalpha(c) || isdigit(c)).

Parameters

  [in] | c | symbol for checking

Returns
  - non-zero if `c` is an alphanumeric character;
  - 0 otherwise.

static int isalpha | ( | int | c | ) |
| static

`#include <ctype.h>`

Check for an alphabetic character; it is equivalent to (isupper(c) || islower(c))

Parameters

  [in] | c | symbol for checking

Returns
  - non-zero if `c` is an alphabetic character;
  - 0 otherwise.

static int isascii | ( | int | c | ) |
| static

`#include <ctype.h>`

Check whether `c` is a 7-bit unsigned char value that fits into the ASCII character set.

Parameters

  [in] | c | symbol for checking

Returns
  - non-zero if `c` is a 7-bit US-ASCII character code between 0 and octal 0177 inclusive;
  - 0 otherwise.

static int isblank | ( | int | c | ) |
| static

`#include <ctype.h>`

Check for a blank character; that is, a space or a tab.

Parameters

  [in] | c | symbol for checking

Returns
  - non-zero if `c` is a blank character;
  - 0 otherwise.

static int iscntrl | ( | int | c | ) |
| static

`#include <ctype.h>`

Check for a control character.

Parameters

  [in] | c | symbol for checking

Returns
  - non-zero if `c` is a control character;
  - 0 otherwise.

static int isdigit | ( | int | c | ) |
| static

`#include <ctype.h>`

Check for a digit (0 through 9)

Parameters

  [in] | c | symbol for checking

Returns
  - non-zero if `c` is a decimal digit character;
  - 0 otherwise.

static int isgraph | ( | int | c | ) |
| static

`#include <ctype.h>`

Check for any printable character except space.

Parameters

  [in] | c | symbol for checking

Returns
  - non-zero if `c` is a character with a visible representation;
  - 0 otherwise.

static int islower | ( | int | c | ) |
| static

`#include <ctype.h>`

Check for an lowercase letter.

Parameters

  [in] | c | symbol for checking

Returns
  - non-zero if c is a lowercase letter;
  - 0 otherwise.

static int isprint | ( | int | c | ) |
| static

`#include <ctype.h>`

Check for any printable character including space.

Parameters

  [in] | c | symbol for checking

Returns
  - non-zero if `c` is a printable character;
  - 0 otherwise.

static int ispunct | ( | int | c | ) |
| static

`#include <ctype.h>`

Check for any printable character which is not a space or an alphanumeric character.

Parameters

  [in] | c | symbol for checking

Returns
  - non-zero if `c` is a punctuation character;
  - 0 otherwise.

static int isspace | ( | int | c | ) |
| static

`#include <ctype.h>`

Check for white-space characters. These are: space, form-feed ('\f'), newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v').

Parameters

  [in] | c | symbol for checking

Returns
  - non-zero if `c` is a white-space character;
  - 0 otherwise.

static int isupper | ( | int | c | ) |
| static

`#include <ctype.h>`

Check for an uppercase letter.

Parameters

  [in] | c | symbol for checking

Returns
  - non-zero if `c` is an uppercase letter;
  - 0 otherwise.

static int isxdigit | ( | int | c | ) |
| static

`#include <ctype.h>`

Check for hexadecimal digits, that is, one of 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F.

Parameters

  [in] | c | symbol for checking

Returns
  - non-zero if `c` is a hexadecimal digit character;
  - 0 otherwise.

int lseek | ( | int | fd,
|  | int | offset,
|  | int | whence
| ) |  |

`#include <unistd.h>`

Reposition read/write file offset.

Available modes:

- SEEK_SET - offset is set to `offset` bytes.
- SEEK_CUR - offset is set to current location plus `offset` bytes.
- SEEK_END - offset is set to the size of the file plus `offset` bytes.

Parameters

  [in] | fd | File descriptor.
  [in] | offset | New offset value.
  [in] | whence | Mode of operation.

Returns
  - resulting offset location from the beginning of the file - on success.
  - -1 and set errno to indicate the error - otherwise.

void* malloc | ( | size_t | size | ) |

`#include <stdlib.h>`

Allocate `size` bytes and return a pointer to the allocated memory.

Parameters

  [in] | size | - size of memory to be allocated.

Return values

  address | pointer to allocated memory on success.
  NULL | if size is equal to zero.
  NULL | and sets errno to ENOMEM if there is no enough memory to be allocated.

void* memchr | ( | const void * | s,
|  | int | c,
|  | size_t | n
| ) |  |

`#include <string.h>`

Find a character in an area of memory.

Parameters

  [in] | s | pointer to the memory area.
  [in] | c | the byte to search for.
  [in] | n | the size of the area.

Returns
  address of the first occurrence of `c`, or `NULL`.

int memcmp | ( | const void * | s1,
|  | const void * | s2,
|  | size_t | n
| ) |  |

`#include <string.h>`

Compare fist `n` bytes of memory pointed by `s1` and `s2`.

Parameters

  [in] | s1 | fist memory region to compare.
  [in] | s2 | second memory region to compare.
  [in] | n | number of bytes to compare.

Return values

  0 | memory regions have the same values.
  <0 | region `s1` has lower value than `s2`.
  >0 | region `s1` has greater value than `s2`.

void* memcpy | ( | void * | dest,
|  | const void * | src,
|  | size_t | n
| ) |  |

`#include <string.h>`

Copy memory area from `src` to `dst`. The memory must not overlap. To copy overlapped area use memmove() function.

Parameters

  [out] | dest | destination area.
  [in] | src | source area.
  [in] | n | number of bytes to copy.

Returns
  pointer to `dest` area.

errno_t memcpy_s | ( | void *restrict | dest,
|  | rsize_t | dest_max,
|  | const void *restrict | src,
|  | rsize_t | n
| ) |  |

`#include <string.h>`

Check arguments and copy `src` sized memory area to `dest`. Memory must not be overlapped. To copy overlapped area use memmove_s() function.

Parameters

  [out] | dest | destination area.
  [in] | dest_max | max number of bytes to modify in the dest.
  [in] | src | source area.
  [in] | n | number of bytes to copy.

Return values

  0 | function completed work with success.
  !=0 | function completed work with error.

void* memmove | ( | void * | dest,
|  | const void * | src,
|  | size_t | n
| ) |  |

`#include <string.h>`

Copy memory area from `src` to `dest`. The memory may overlap.

Parameters

  [out] | dest | destination area.
  [in] | src | source area.
  [in] | n | number of bytes to copy.

Returns
  pointer to `dest` area.

errno_t memmove_s | ( | void * | dest,
|  | rsize_t | dest_max,
|  | const void * | src,
|  | rsize_t | n
| ) |  |

`#include <string.h>`

Check arguments and copy `src` sized memory area to `dest`. Memory may be overlapped.

Parameters

  [out] | dest | destination area.
  [in] | dest_max | max number of bytes to modify in the dest.
  [in] | src | source area.
  [in] | n | number of bytes to copy.

Return values

  0 | function completed work with success.
  !=0 | function completed work with error.

void* memrchr | ( | const void * | s,
|  | int | c,
|  | size_t | n
| ) |  |

`#include <string.h>`

Find a character in an area of memory.

Parameters

  [in] | s | pointer to the memory area.
  [in] | c | the byte to search for.
  [in] | n | the size of the area.

Returns
  address of the last occurrence of `c`, or `NULL`.

void* memset | ( | void * | block,
|  | int | c,
|  | size_t | size
| ) |  |

`#include <string.h>`

Fill `size` bytes with a constant value.

Parameters

  [out] | block | address of memory region to be filled.
  [in] | c | value to fill.
  [in] | size | number of bytes to fill.

Returns
  pointer to `block` area.

errno_t memset_s | ( | void * | block,
|  | rsize_t | block_max,
|  | int | c,
|  | rsize_t | n
| ) |  |

`#include <string.h>`

Check arguments and fill `n` bytes of `block` sized memory with `c` constant value.

Parameters

  [out] | block | address of memory region to be filled.
  [in] | block_max | max number of bytes for copy to block.
  [in] | c | value to fill.
  [in] | n | number of bytes to fill.

Return values

  0 | function completed work with success.
  !=0 | function completed work with error.

void* mmap | ( | void * | addr,
|  | size_t | len,
|  | int | prot,
|  | int | flags,
|  | int | fd,
|  | off_t | offset
| ) |  |

`#include <sys/mman.h>`

The mmap() function establishes a mapping between a process' address space and a file or shared memory object.

Parameters

  [in] | addr | starting address.
  [in] | len | specify the length of the mapping.
  [in] | prot | Describes the desired memory protection of the mapping Protection flags are defined in core/mman.h header. Possible values: PROT_READ - Data can be read. PROT_WRITE - Data can be written. PROT_EXEC - Data can be executed. PROT_NONE - Data cannot be accessed.
  [in] | flags | Provides other information about the handling of the mapped data. All flags except MAP_PHYS_NON_SECURE and MAP_PHYS_NON_CACHED are defined in core/mman.h header. Possible values: MAP_ANONYMOUS - The mapping is not backed by any file; its contents are initialized to zero. MAP_POPULATE - Populate (prefault) page tables for a mapping. MAP_FIXED - Don't interpret addr as a hint: place the mapping at exactly that address. MAP_PRIVATE - Create a private copy-on-write mapping. Updates to the mapping are not visible to other processes mapping the same file, and are not carried through to the underlying file. MAP_SHARED - Share this mapping. Updates to the mapping are visible to other processes that map this file, and are carried through to the underlying file. MAP_PHYS_NON_SECURE - Use non-secure mapping (phys_mmap driver specific, i.e. for mappings created in /dev/phys). Defined in driver/mem/phys.h header. MAP_PHYS_NON_CACHED - Use non-cached mapping (phys_mmap driver specific, i.e. for mappings created in /dev/phys). Defined in driver/mem/phys.h header. MAP_STACK - Allocate the mapping at an address suitable for a process or thread stack. Use for SafeStack mechanism. MAP_GROWSDOWN - Get the highest address on the stack allocated with MAP_STACK.
  [in] | fd | file descriptor.
  [in] | offset | offset.

Returns
  Upon successful completion, the mmap() function returns the address at which the mapping was placed (pa); otherwise, it returns a value of MAP_FAILED.

Example:

address = mmap(0, len, PROT_READ, MAP_PRIVATE, fildes, some_offset);

int mprotect | ( | void * | addr,
|  | size_t | len,
|  | int | prot
| ) |  |

`#include <sys/mman.h>`

Changes permission of memory region.

Parameters

  [in] | addr | address where memory was previously mapped.
  [in] | len | size of the memory area.
  [in] | prot | new protection flags.

Return values

  0 | no error.
  -1 | on failure. errno variable is set appropriately. EINVAL - addr is not multiple of page size. EACCES - prot argument violates protection of file mapped. EAGAIN - no memory resources to create writable private mapping for file. ENOMEM - specified address range is invalid or includes not mapped zones. EOPNOTSUPP - prot argument specifies PROT_EXEC.

void ms_to_timespec | ( | int64_t | t,
|  | struct timespec * | a
| ) |  |

`#include <time.h>`

The function converts time in milliseconds to to timespec format.

Parameters

  [in] | t | time in milliseconds.
  [out] | a | Pointer to timespec structure to save result.

int munmap | ( | void * | addr,
|  | size_t | length
| ) |  |

`#include <sys/mman.h>`

Tries to unmap memory area at addr of length bytes previously allocated and mmaped by mmap() system call.

Parameters

  [in] | addr | address where memory was previously mapped.
  [in] | length | size of the memory area.

Return values

  0 | no error.
  -1 | on failure. errno variable is set appropriately. EINVAL - invalid length specified. EPERM - memory area other than heap is specified.

Example:

ret = munmap(buf, 0x8000);
if (ret) {
printf("munmap error\n");
panic(1);
}

int nanosleep | ( | const struct timespec * | req,
|  | struct timespec * | rem
| ) |  |

`#include <time.h>`

nanosleep() suspends the execution of the calling thread until either at least the time specified in `*req` has elapsed, or the delivery of a signal that triggers the invocation of a handler in the calling thread or that terminates the process. If the call is interrupted by a signal handler, nanosleep() returns -1, sets errno to EINTR, and writes the remaining time into the structure pointed to by rem unless rem is NULL. The value of `*req` can then be used to call nanosleep() again and complete the specified pause.

Parameters

  [in] | req | Pointer to requested time.
  [in] | rem | Pointer to remained time.

Return values

  0 | on success.
  -1 | on failure. errno variable is set appropriately.

Example:

struct timespec req;
struct timespec rem;
req.tv_sec = TIME_TO_WAIT;
req.tv_nsec = 0;
if(nanosleep(&req, &rem) != 0) {
printf(TEST_NAME": nanosleep() failed, errno: %d\n", errno);
}

int open | ( | const char * | pathname,
|  | int | flags,
|  |  | ...
| ) |  |

`#include <fcntl.h>`

Open a device by specifying its namespace path. Device driver operations should be previously registered with the namespace framework.

Parameters

  [in] | pathname | namespace path for specific device
  [in] | flags | file access mode
  [in] | ... | (optional) file mode

Return values

  >0 | a descriptor associated with the device.
  -1 | on error and sets errno to appropriated value: EINVAL – pathname is invalid or device not registered; ENOMEM – there is not enough memory for internal operations; EMFILE – to many device descriptors opened by the current thread; Other values are device driver implementation defined

Example:

int func(void) {
int fd = open(“/dev/crypto”, O_RDWR);
if (fd < 0)
return errno;
}

int printf | ( | const char * | fmt,
|  |  | ...
| ) |  |

`#include <stdio.h>`

Format and print string.

Parameters

  [in] | fmt | Format specification of output string.
  [in,out] | ... | Arguments used for printing.

Return values

  >=0 | number of characters printed if succeed.
  -1 | if error occurred.

Example:

int a,b;
float c,d;
a = 15;
b = a / 2;
printf("%d\n",b);
printf("%3d\n",b);
printf("%03d\n",b);
c = 15.3;
d = c / 3;
printf("%3.2f\n",d);

int printf_no_alloc | ( | const char * | fmt,
|  |  | ...
| ) |  |

`#include <print_no_alloc.h>`

Prints to ringbuffer. If resulting string exceeds AUTO_BUFFER_SIZE, cuts it off to AUTO_BUFFER_SIZE.

Parameters

  [in] | fmt | Format specification of output string.
  [in,out] | ... | Arguments used for printing.

Return values

  >=0 | number of characters printed if succeed.
  -1 | if error occurred.

Example:

printf_no_alloc("Receive_signal_test: never reach here.\n");

int printf_s | ( | const char *_restrict_ | fmt,
|  |  | ...
| ) |  |

`#include <stdio.h>`

format and print string.

Parameters

  [in] | fmt | Format specification of output string.
  [in] | ... | Arguments used for printing.

Return values

  >=0 | number of characters printed if succeed.
  -1 | if error occurred.

int profil | ( | unsigned short * | buf,
|  | size_t | bufsiz,
|  | size_t | offset,
|  | unsigned int | scale
| ) |  |

`#include <unistd.h>`

Provide a means to find out in what areas your program spends most of its time. The argument `buf` points to `bufsiz` bytes of core. Every virtual 10 milliseconds, the user's program counter (PC) is examined: `offset` is subtracted and the result is multiplied by `scale` and divided by 65536. If the resulting value is less than `bufsiz`, then the corresponding entry in `buf` is incremented. If `buf` is NULL, profiling is disabled.

Parameters

  [in] | buf | function argument.
  [in] | bufsiz | function argument.
  [in] | offset | function argument.
  [in] | scale | function argument.

Returns
  zero is always returned.

int putchar | ( | int | ch | ) |

`#include <stdio.h>`

writes a character to log.

writes the character `ch`, cast to an unsigned char, to the log.

Parameters

  [in] | ch | Character to print.

Return values

  character | written as an unsigned char cast to an int.
  EOF | on error.

int puts | ( | const char * | s | ) |

`#include <stdio.h>`

writes the string s and a trailing newline to log(dmesg).

Parameters

  [in] | s | String to print.

Return values

  >=0 | on success.
  EOF | on error.

void qsort | ( | void * | base,
|  | size_t | nmemb,
|  | size_t | size,
|  | int(*)(const void *, const void *) | compar
| ) |  |

`#include <stdlib.h>`

Sort an array.

Parameters

  [in,out] | base | pointer to start of the array.
  [in] | nmemb | number or elements in array.
  [in] | size | size of each element in array.
  [in] | compar | comparison function.

void qsort_r | ( | void * | base,
|  | size_t | nmemb,
|  | size_t | size,
|  | int(*)(const void *, const void *, void *) | compar,
|  | void * | arg
| ) |  |

`#include <stdlib.h>`

Sort an array.

Parameters

  [in,out] | base | pointer to start of the array.
  [in] | nmemb | number or elements in array.
  [in] | size | size of each element in array.
  [in] | compar | comparison function.
  [in] | arg | argument, which passed directly as 3-rd parameter to `compar`.

ssize_t read | ( | int | fd,
|  | void * | buf,
|  | size_t | count
| ) |  |

`#include <unistd.h>`

Attempt to read `count` bytes from the file associated with the open file descriptor, `fd`, into the buffer pointed to by `buf`.

Parameters

  [in] | fd | File descriptor.
  [out] | buf | Pointer to buffer to write.
  [in] | count | Number of bytes to read.

Returns
  - non-negative integer indicating the number of bytes actually read - on success.
  - -1 and set errno to indicate the error - otherwise.

void* realloc | ( | void * | ptr,
|  | size_t | size
| ) |  |

`#include <stdlib.h>`

Change the size of the memory block pointed to by `ptr` to `size` bytes.

Note
  The contents will be unchanged in the range from the start of the region up to the minimum of the old and new sizes. If the new size is larger than the old size, the added memory will not be initialized. If `ptr` is NULL, then the call is equivalent to malloc(size), for all values of size; if size is equal to zero, and `ptr` is not NULL, then the call is equivalent to free(`ptr`). Unless `ptr` is NULL, it must have been returned by an earlier call to malloc(), calloc() or realloc(). If the area pointed to was moved, a free(`ptr`) is done. If realloc() fails, the original block is left untouched; it is not freed or moved.

Parameters

  [in] | ptr | function argument.
  [in] | size | function argument.

Return values

  address | pointer to the newly allocated memory, which is properly aligned for any built-in type and may be different from `ptr`.
  NULL | if the request fails. either NULL or a pointer suitable to be passed to free() if size was equal to 0.

int rename | ( | const char * | pathname,
|  | const char * | new_pathname
| ) |  |

`#include <unistd.h>`

Rename file.

Parameters

  [in] | pathname | is name of file to rename.
  [in] | new_pathname | is new name of file.

Return values

  0 | on success.
  -1 | on error. errno is set appropriately.

int rmdir | ( | char * | dir_name | ) |

`#include <unistd.h>`

Remove a directory at file system.

Parameters

  [in] | dir_name | is name of the directory.

Return values

  0 | on success.
  -1 | on error. errno is set appropriately.

int sched_getaffinity | ( | pid_t | pid,
|  | size_t | cpusetsize,
|  | cpu_set_t * | mask
| ) |  |

`#include <sched.h>`

Writes the affinity mask of the process whose `ID` is pid into the `cpu_set_t` structure pointed to by `mask`.

Parameters

  [in] | pid | process ID.
  [in] | cpusetsize | size (in bytes) of mask.
  [in,out] | mask | pointer to CPU affinity mask.

Return values

  0 | function completed work with success.
  -1 | function completed work with error and errno is set appropriately.

int sched_setaffinity | ( | pid_t | pid,
|  | size_t | cpusetsize,
|  | cpu_set_t * | mask
| ) |  |

`#include <sched.h>`

Sets the CPU affinity mask of the process whose `ID` is pid to the value specified by `mask`. If pid is zero, then the calling process is used.

Parameters

  [in] | pid | process ID.
  [in] | cpusetsize | the length (in bytes) of the data pointed to by mask.
  [in,out] | mask | pointer to CPU affinity mask.

Return values

  0 | function completed work with success.
  -1 | function completed work with error and errno is set appropriately.

int sched_yield | ( | void |  | ) |

`#include <sched.h>`

Causes the calling thread to relinquish the CPU. The thread is moved to the end of the queue for its static priority and a new thread gets to run.

Return values

  0 | function completed work with success.
  -1 | function completed work with error and errno is set appropriately.

constraint_handler_t set_constraint_handler_s | ( | constraint_handler_t | handler | ) |

`#include <stdlib.h>`

Set the `handler` to be handler.

Parameters

  [in] | handler | runtime-constraint handler.

Returns
  pointer to the previously registered handler.

int setenv | ( | const char * | name,
|  | const char * | value,
|  | int | overwrite
| ) |  |

`#include <stdlib.h>`

change or add environment variable function stub

Parameters

  [in] | name | environment variable name
  [in] | value | new value for environment variable
  [in] | overwrite | replace variable's value to new if name exists

Return values

  0 |

int snprintf | ( | char * | s,
|  | size_t | count,
|  | const char * | fmt,
|  |  | ...
| ) |  |

`#include <stdio.h>`

format and string and save it to `s'.

Parameters

  [out] | s | Pointer to an array of char elements where the resulting string will be stored.
  [in] | count | size of `s` in bytes.
  [in] | fmt | Format specification of output string.
  [in,out] | ... | Arguments used for printing.

Return values

  number | of characters printed.
  number | of characters printed if succeed.
  -1 | if error occurred.

Example:

char buffer[200];
int i, j;
double fp;
char *s = "baltimore";
char c;
int main(void)
{
c = 'l';
i = 35;
fp = 1.7320508;
j = snprintf(buffer, 6, "%s\n", s);
j += snprintf(buffer+j, 6, "%c\n", c);
j += snprintf(buffer+j, 6, "%d\n", i);
j += snprintf(buffer+j, 6, "%f\n", fp);
printf("string:\n%s\ncharacter count = %d\n", buffer, j);
}

int snprintf_s | ( | char *_restrict_ | s,
|  | rsize_t | n,
|  | const char *_restrict_ | format,
|  |  | ...
| ) |  |

`#include <stdio.h>`

Format string and save it to `s'.

Parameters

  [out] | s | Pointer to an array of char elements where the resulting string will be stored.
  [in] | n | Size of `s` in bytes.
  [in] | format | Format specification of output string.
  [in] | ... | Arguments used for printing.

Return values

  number | Number of characters printed if succeed.
  -1 | if error occurred.

int sprintf | ( | char * | s,
|  | const char * | fmt,
|  |  | ...
| ) |  |

`#include <stdio.h>`

format and string and save it to `s'.

Parameters

  [out] | s | Pointer to an array of char elements where the resulting string will be stored.
  [in] | fmt | Format specification of output string.
  [in,out] | ... | Arguments used for printing.

Return values

  number | of characters printed if succeed.
  -1 | if error occurred.

Example:

char str[80];
sprintf(str, "Value of Pi = %f", M_PI);

int sprintf_s | ( | char *_restrict_ | s,
|  | rsize_t | n,
|  | const char *_restrict_ | format,
|  |  | ...
| ) |  |

`#include <stdio.h>`

format string and save it to `s'.

Parameters

  [out] | s | Pointer to an array of char elements where the resulting string will be stored.
  [in] | n | Size of `s` in bytes.
  [in] | format | Format specification of output string.
  [in] | ... | Arguments used for printing.

Return values

  number | of characters printed if succeed.
  -1 | if encoding error occurred.
  0 | if constrain violation occurred.

int sscanf | ( | const char * | buf,
|  | const char * | fmt,
|  |  | ...
| ) |  |

`#include <stdio.h>`

Reads data from buf and stores them according to parameter fmt into the locations given by the additional arguments.

Parameters

  [in] | buf | Pointer to C string that the function processes as its source to retrieve the data.
  [in] | fmt | Pointer to C string that contains a format string that follows the same specifications as format in scanf.

Return values

  number | of items read, This count can match the expected number of items or be less (even zero) in the case of a matching failure.
  EOF | in case of an input failure before any data could be successfully interpreted.

Example:

char sentence []="Rudolph is 12 years old";
char str [20];
int i;
sscanf (sentence,"%s %*s %d",str,&i);
printf ("%s -> %d\n", str, i);

int sscanf_s | ( | const char *_restrict_ | s,
|  | const char *_restrict_ | format,
|  |  | ...
| ) |  |

`#include <stdio.h>`

Reads data safely from buf and stores them according to parameter fmt into the locations given by the additional arguments.

Parameters

  [in] | s | Pointer to C string that the function processes as its source to retrieve the data.
  [in] | format | Pointer to C string that contains a format string that follows the same specifications as format in scanf.

Return values

  number | of items read, this count can match the expected number of items or be less (even zero) in the case of a matching failure.
  EOF | in case of an input failure before any data could be successfully interpreted.

int stat | ( | const char * | pathname,
|  | struct stat * | buf
| ) |  |

`#include <unistd.h>`

Get status of a file `pathname`.

Parameters

  [in] | pathname | Path to file.
  [out] | buf | Pointer to structure to store status information.

Return values

  0 | on success.
  -1 | on error. errno is set appropriately.

char* strcat | ( | char * | dest,
|  | const char * | src
| ) |  |

`#include <string.h>`

Append the `src` string to the `dest` string, overwriting the terminating null byte ('\0') at the end of dest, and then adds a terminating null byte.

Parameters

  [in,out] | dest | Pointer to string to append.
  [in] | src | Pointer to source string.

Returns
  pointer to the resulting string `dest`.

Example:

int main ()
{
char src[50], dest[50];
strcpy(src, "This is source");
strcpy(dest, "This is destination");
strcat(dest, src);
printf("Final destination string : |%s|", dest);
return 0;
}

errno_t strcat_s | ( | char *restrict | dest,
|  | rsize_t | dest_max,
|  | const char *restrict | src
| ) |  |

`#include <string.h>`

Check arguments and append the `src` string to the `dest` string, overwriting the terminating null byte ('\0') at the end of `dest`, and add a terminating null byte.

Parameters

  [in,out] | dest | Pointer to string to append.
  [in] | dest_max | max number of bytes to modify in the dest.
  [in] | src | Pointer to source string.

Return values

  0 | function completed work with success.
  !=0 | function completed work with error.

char* strchr | ( | const char * | s,
|  | int | c
| ) |  |

`#include <string.h>`

Find first occurence of character `c` in string `s`.

Parameters

  [in] | s | Pointer to string to search in.
  [in] | c | character to seach.

Returns
  pointer to matched character, or `NULL` if not found.

Example:

char str[] = "This is a sample string";
char * pch;
printf ("Looking for the 's' character in \"%s\"...\n",str);
pch=strchr(str,'s');
while (pch != NULL)
{
printf ("found at %d\n",pch-str+1);
pch = strchr(pch+1,'s');
}

char* strchrnul | ( | const char * | s,
|  | int | c
| ) |  |

`#include <string.h>`

Find first occurence of character `c` in string `s`.

Parameters

  [in] | s | Pointer to string to search in.
  [in] | c | character to seach.

Returns
  pointer to matched character, or a pointer to the null byte at the end of s (i.e., s+strlen(s)) if the character is not found.

int strcmp | ( | const char * | s1,
|  | const char * | s2
| ) |  |

`#include <string.h>`

Compare the two strings `s1` and `s2`.

Parameters

  [in] | s1 | Pointer to first string to compare.
  [in] | s2 | Pointer to second string to compare.

Return values

  0 | strings are equal.
  <0 | string `s1` has lower value than `s2`.
  >0 | string `s1` has greater value than `s2`.

Example:

int main ()
{
char str1[15];
char str2[15];
int ret;
strcpy(str1, "abcdef");
strcpy(str2, "ABCDEF");
ret = strcmp(str1, str2);
if(ret > 0)
{
printf("str1 is less than str2");
}
else if(ret < 0)
{
printf("str2 is less than str1");
}
else
{
printf("str1 is equal to str2");
}
return 0;
}

char* strcpy | ( | char * | dest,
|  | const char * | src
| ) |  |

`#include <string.h>`

Copy the string pointed to by `src`, including the terminating null byte ('\0'), to the buffer pointed to by `dest`.

Parameters

  [out] | dest | pointer to destination string.
  [in] | src | pointer to source string.

Returns
  pointer to destination string `dest`.

Example:

int main()
{
char src[40];
char dest[100];
memset(dest, '\0', sizeof(dest));
strcpy(src, "This is example");
strcpy(dest, src);
printf("Final copied string : %s\n", dest);
return 0;
}

errno_t strcpy_s | ( | char *restrict | dest,
|  | rsize_t | dest_max,
|  | const char *restrict | src
| ) |  |

`#include <string.h>`

Check arguments and copy the `src` string, including the terminating null byte ('\0'), to the `dest` sized buffer. If `n` is bigger than size of `src` then the remaining characters (after '\0') are unspecified.

Parameters

  [out] | dest | pointer to destination string.
  [in] | dest_max | max number of bytes to modify in the dest.
  [in] | src | pointer to source string.

Return values

  0 | function completed work with success.
  !=0 | function completed work with error.

size_t strcspn | ( | const char * | s,
|  | const char * | reject
| ) |  |

`#include <string.h>`

Calculate the length of the initial segment of s which consists entirely of bytes not in reject.

Parameters

  [in] | s | Pointer to string to search in.
  [in] | reject | String containing the characters not to match.

Returns
  number of bytes in the initial segment of s which are not in the string reject.

char* strdup | ( | const char * | s | ) |

`#include <string.h>`

Return a pointer to a new string which is a duplicate of the string `s`. Memory for the new string is obtained with `malloc()`.

Parameters

  [in] | s | pointer to source string.

Returns
  pointer to duplicated string.

const char* strerror | ( | int | errnum | ) |

`#include <string.h>`

Return a pointer to a string that describes the error code passed in the argument `errnum`.

Parameters

  [in] | errnum | error code.

Returns
  pointer to description.

int strerror_r | ( | int | errnum,
|  | char * | buf,
|  | size_t | buflen
| ) |  |

`#include <string.h>`

Returns the error string in the user-supplied `buf` of length `buflen`. XSI-compliant version.

Parameters

  [in] | errnum | Error code.
  [in] | buf | Pointer to the buffer.
  [in] | buflen | Buffer length.

Return values

  0 | on success.
  -1 | on error and errno is set.

errno_t strerror_s | ( | char * | buf,
|  | rsize_t | bufmax,
|  | errno_t | errnum
| ) |  |

`#include <string.h>`

Check arguments and return a pointer to a `buf` string that describes the `errnum` error code.

Parameters

  [in] | buf | pointer to a user-provided buffer.
  [in] | bufmax | max size of a user-provided buffer.
  [in] | errnum | error code.

Return values

  0 | function completed work with success.
  !=0 | function completed work with error.

size_t strlcat | ( | char * | dest,
|  | const char * | src,
|  | size_t | n
| ) |  |

`#include <string.h>`

Append the NUL-terminated string `src` to the end of `dest` string, overwriting the terminating null byte ('\0') at the end of dest, and guarantee to NUL-terminate the result.

Parameters

  [in,out] | dest | Pointer to string to append.
  [in] | src | Pointer to source string.
  [in] | n | Maximal number of bytes to copy if string does not have \0 terminator.

Returns
  The total length of the string they tried to create. Count does not include NUL.

Example:

int main ()
{
char src[50], dst[50];
strcpy(src, "It is source.");
strcpy(dst, "It is dst.");
strlcat(dst, src, sizeof(dst));
return 0;
}

size_t strlen | ( | const char * | s | ) |

`#include <string.h>`

Calculate the length of the string `s`, excluding the terminating null byte ('\0').

Parameters

  [in] | s | Pointer to string.

Returns
  number of bytes in the string.

Example:

int main ()
{
char string[32] = "hello, world";
printf("String length is %zu\n", strlen(string));
return 0;
}

char* strncat | ( | char * | dest,
|  | const char * | src,
|  | size_t | n
| ) |  |

`#include <string.h>`

Append the `src` string to the `dest` string, overwriting the terminating null byte ('\0') at the end of dest, and then adds a terminating null byte.

Parameters

  [in,out] | dest | Pointer to string to append.
  [in] | src | Pointer to source string.
  [in] | n | maximal number of bytes to copy if string does not have \0 terminator.

Returns
  pointer to the resulting string `dest`.

Example:

int main ()
{
char src[50], dest[50];
strcpy(src, "This is source");
strcpy(dest, "This is destination");
strncat(dest, src, 10);
printf("Final destination string : |%s|", dest);
return 0;
}

errno_t strncat_s | ( | char *restrict | dest,
|  | rsize_t | dest_max,
|  | const char *restrict | src,
|  | rsize_t | n
| ) |  |

`#include <string.h>`

Check arguments and append at most `n` bytes of `src` string to the `dest` string, overwriting the terminating null byte ('\0') at the end of dest and then adds a terminating null byte.

Parameters

  [in,out] | dest | Pointer to string to append.
  [in] | dest_max | max number of bytes to modify in the dest.
  [in] | src | Pointer to source string.
  [in] | n | maximal number of bytes to copy if string does not have \0 terminator.

Return values

  0 | function completed work with success.
  !=0 | function completed work with error.

int strncmp | ( | const char * | s1,
|  | const char * | s2,
|  | size_t | n
| ) |  |

`#include <string.h>`

Compare at most `n` bytes of two strings `s1` and `s2`.

Parameters

  [in] | s1 | Pointer to first string to compare.
  [in] | s2 | Pointer to second string to compare.
  [in] | n | maximal number of bytes to compare if string does not have \0 terminator.

Return values

  0 | strings are equal.
  <0 | string `s1` has lower value than `s2`.
  >0 | string `s1` has greater value than `s2`.

Example:

int main ()
{
char str1[15];
char str2[15];
int ret;
strcpy(str1, "abcdef");
strcpy(str2, "ABCDEF");
ret = strncmp(str1, str2, 4);
if(ret > 0)
{
printf("str1 is less than str2");
}
else if(ret < 0)
{
printf("str2 is less than str1");
}
else
{
printf("str1 is equal to str2");
}
return 0;
}

char* strncpy | ( | char * | dest,
|  | const char * | src,
|  | size_t | n
| ) |  |

`#include <string.h>`

Copy at most `n` bytes of the string pointed to by `src`, including the terminating null byte ('\0'), to the buffer pointed to by `dest`.

Parameters

  [out] | dest | pointer to destination string.
  [in] | src | pointer to source string.
  [in] | n | maximal number of bytes to copy if string does not have \0 terminator.

Returns
  pointer to destination string `dest`.

Example:

int main()
{
char src[40];
char dest[100];
memset(dest, '\0', sizeof(dest));
strncpy(src, "This is example", 10);
strncpy(dest, src, 10);
printf("Final copied string : %s\n", dest);
return 0;
}

errno_t strncpy_s | ( | char *restrict | dest,
|  | rsize_t | dest_max,
|  | const char *restrict | src,
|  | rsize_t | n
| ) |  |

`#include <string.h>`

Check arguments and copy at most `n` bytes of the `src` string, including the terminating null byte ('\0') to the `dest` sized buffer.

Parameters

  [out] | dest | pointer to destination string.
  [in] | dest_max | max number of bytes to modify in the dest.
  [in] | src | pointer to source string.
  [in] | n | maximal number of bytes to copy if string does not have \0 terminator.

Return values

  0 | function completed work with success.
  !=0 | function completed work with error.

size_t strnlen | ( | const char * | s,
|  | size_t | n
| ) |  |

`#include <string.h>`

Calculate the length of the fixed-size string `s`, excluding the terminating null byte ('\0').

Parameters

  [in] | s | Pointer to string.
  [in] | n | maximal number of bytes to scan.

Returns
  number of bytes in the string, or `n` if string is nonger than `n`.

Example:

int main ()
{
char string[32] = "hello, world";
printf("String length is %zu\n", strnlen(string, 10));
return 0;
}

size_t strnlen_s | ( | const char * | s,
|  | size_t | s_max
| ) |  |

`#include <string.h>`

Check arguments and calculate the length of the `s` fixed-size string, excluding the terminating null byte ('\0').

Parameters

  [in] | s | pointer to string.
  [in] | s_max | maximal number of bytes to scan.

Return values

  0 | `s` is a null pointer.
  !=0 | number of symbols that precede the terminating null character.

char* strrchr | ( | const char * | s,
|  | int | c
| ) |  |

`#include <string.h>`

Find last occurence of character `c` in string `s`.

Parameters

  [in] | s | Pointer to string to search in.
  [in] | c | character to seach.

Returns
  pointer to matched character, or `NULL` if not found.

Example:

char str[] = "This is a sample string";
char * pch;
printf ("Looking for the 's' character in \"%s\"...\n",str);
pch=strrchr(str,'s');
while (pch != NULL)
{
printf ("found at %d\n",pch-str+1);
pch = strrchr(pch+1,'s');
}

size_t strspn | ( | const char * | s,
|  | const char * | accept
| ) |  |

`#include <string.h>`

Calculate the length (in bytes) of the initial segment of s which consists entirely of bytes in accept.

Parameters

  [in] | s | Pointer to string to search in.
  [in] | accept | String containing the characters to match.

Returns
  number of bytes in the initial segment of s which consist only of bytes from accept.

char* strstr | ( | const char * | text,
|  | const char * | pattern
| ) |  |

`#include <string.h>`

Find the first occurrence of the substring `pattern` in the string `text`. The terminating null bytes ('\0') are not compared.

Parameters

  [in] | text | Pointer to buffer with text for scan.
  [in] | pattern | Pointer to pattern to find in text.

Returns
  pointer to substring, or `NULL` if substring is not found.

Example:

int main()
{
const char text [20] = "ExamplePoint";
const char pattern [10] = "Point";
char *ret;
ret = strstr(text, pattern);
printf("The substring is: %s\n", ret);
return 0;
}

double strtod | ( | const char * | nptr,
|  | char ** | endptr
| ) |  |

`#include <stdlib.h>`

the initial portion of the string pointed to by `nptr` to double.

Note
  The expected form of the (initial portion of the) string is optional leading white space, an optional plus ('+') or minus sign ('-') and then either
  (i) a decimal number.
  (ii) an infinity.
  (iii) a NAN (not-a-number).
  A decimal number consists of a nonempty sequence of decimal digits possibly containing a radix character (decimal point, locale-dependent, usually '.'), optionally followed by a decimal exponent. A decimal exponent consists of an 'E' or 'e', followed by an optional plus or minus sign, followed by a nonempty sequence of decimal digits, and indicates multiplication by a power of 10. An infinity is either "INF" or "INFINITY", disregarding case.

Parameters

  [in] | nptr | The start of the string.
  [in] | endptr | A pointer to the end of the parsed string will be placed here.

Return values

  result | conversion is success.
  HUGE_VAL | if an overflow occurs. errno is set to ERANGE.
  -HUGE_VAL | if an underflow occurs. errno is set to ERANGE.

float strtof | ( | const char * | nptr,
|  | char ** | endptr
| ) |  |

`#include <stdlib.h>`

the initial portion of the string pointed to by `nptr` to float.

Note
  The expected form of the (initial portion of the) string is optional leading white space as recognized by isspace(3), an optional plus ('+') or minus sign ('-') and then either
  (i) a decimal number.
  (ii) a hexadecimal number.
  (iii) an infinity.
  (iv) a NAN (not-a-number).
  A decimal number consists of a nonempty sequence of decimal digits possibly containing a radix character (decimal point, locale-dependent, usually '.'), optionally followed by a decimal exponent. A decimal exponent consists of an 'E' or 'e', followed by an optional plus or minus sign, followed by a nonempty sequence of decimal digits, and indicates multiplication by a power of 10. A hexadecimal number consists of a "0x" or "0X" followed by a nonempty sequence of hexadecimal digits possibly containing a radix character, optionally followed by a binary exponent. A binary exponent consists of a 'P' or 'p', followed by an optional plus or minus sign, followed by a nonempty sequence of decimal digits, and indicates multiplication by a power of 2. At least one of radix character and binary exponent must be present. An infinity is either "INF" or "INFINITY", disregarding case.

Parameters

  [in] | nptr | The start of the string.
  [in] | endptr | A pointer to the end of the parsed string will be placed here.

Return values

  result | conversion is success.
  HUGE_VAL | if an overflow occurs. errno is set to ERANGE.
  -HUGE_VAL | if an underflow occurs. errno is set to ERANGE.

char* strtok | ( | char * | str,
|  | const char * | delim
| ) |  |

`#include <string.h>`

Function breaks a string into a sequence of zero or more nonempty tokens.

This function is MT-unsafe, i.e. it's not safe to call in a multithreaded programs

Parameters

  [in] | str | The string to be parsed.
  [in] | delim | The argument specifies a set of bytes that delimit the tokens in the parsed string.

Returns
  a pointer to a null-terminated string containing the next token.

char str[] = "- This, a sample string.";
char *pch;
printf("Splitting string \"%s\" into tokens:\n",str);
pch = strtok(str, " ,.-");
while (pch != NULL)
{
printf("%s\n", pch);
pch = strtok(NULL, " ,.-");
}
return 0;

char* strtok_r | ( | char *_restrict_ | s,
|  | const char *_restrict_ | sep,
|  | char **_restrict_ | p
| ) |  |

`#include <string.h>`

Function breaks a string into a sequence of zero or more nonempty tokens.

Parameters

  [in] | s | The string to be parsed.
  [in] | sep | The argument specifies a set of bytes that delimit the tokens in the parsed string.
  [out] | p | used internally by strtok_r() in order to maintain context between successive calls that parse the same string.

Returns
  a pointer to a null-terminated string containing the next token.

long strtol | ( | const char * | nptr,
|  | char ** | endptr,
|  | int | base
| ) |  |

`#include <stdlib.h>`

Convert the initial part of the string in `nptr` to a long integer value according to the given `base`, which must be between 2 and 36 inclusive, or be the special value 0.

Note
  The string may begin with an arbitrary amount of white spaces followed by a single optional '+' or '-' sign. If `base` is zero or 16, the string may then include a "0x" prefix, and the number will be read in `base` 16; otherwise, a zero `base` is taken as 10 (decimal) unless the next character is '0', in which case it is taken as 8 (octal). The remainder of the string is converted to a long int value in the obvious manner, stopping at the first character which is not a valid digit in the given `base`. (In bases above 10, the letter 'A' in either uppercase or lowercase represents 10, 'B' represents 11, and so forth, with 'Z' representing 35.)

Parameters

  [in] | nptr | The start of the string
  [in] | endptr | A pointer to the end of the parsed string will be placed here
  [in] | base | The number base to use

Returns
  - result of conversion on success
  - LONG_MIN if an underflow occurs. errno is set to ERANGE.
  - LONG_MAX if an overflow occurs. errno is set to ERANGE.

long double strtold | ( | const char * | nptr,
|  | char ** | endptr
| ) |  |

`#include <stdlib.h>`

the initial portion of the string pointed to by `nptr` to long double.

Note
  The expected form of the (initial portion of the) string is optional leading white space as recognized by isspace(3), an optional plus ('+') or minus sign ('-') and then either
  (i) a decimal number.
  (ii) a hexadecimal number.
  (iii) an infinity.
  (iv) a NAN (not-a-number).
  A decimal number consists of a nonempty sequence of decimal digits possibly containing a radix character (decimal point, locale-dependent, usually '.'), optionally followed by a decimal exponent. A decimal exponent consists of an 'E' or 'e', followed by an optional plus or minus sign, followed by a nonempty sequence of decimal digits, and indicates multiplication by a power of 10. A hexadecimal number consists of a "0x" or "0X" followed by a nonempty sequence of hexadecimal digits possibly containing a radix character, optionally followed by a binary exponent. A binary exponent consists of a 'P' or 'p', followed by an optional plus or minus sign, followed by a nonempty sequence of decimal digits, and indicates multiplication by a power of 2. At least one of radix character and binary exponent must be present. An infinity is either "INF" or "INFINITY", disregarding case.

Parameters

  [in] | nptr | The start of the string.
  [in] | endptr | A pointer to the end of the parsed string will be placed here.

Return values

  result | conversion is success.
  HUGE_VAL | if an overflow occurs. errno is set to ERANGE.
  -HUGE_VAL | if an underflow occurs. errno is set to ERANGE.

long long strtoll | ( | const char * | nptr,
|  | char ** | endptr,
|  | int | base
| ) |  |

`#include <stdlib.h>`

Convert the initial part of the string in `nptr` to a long long integer value according to the given `base`, which must be between 2 and 36 inclusive, or be the special value 0.

Note
  The string may begin with an arbitrary amount of white spaces (as determined by isspace(3)) followed by a single optional '+' or '-' sign. If `base` is zero or 16, the string may then include a "0x" prefix, and the number will be read in `base` 16; otherwise, a zero `base` is taken as 10 (decimal) unless the next character is '0', in which case it is taken as 8 (octal). The remainder of the string is converted to a long int value in the obvious manner, stopping at the first character which is not a valid digit in the given `base`. (In bases above 10, the letter 'A' in either uppercase or lowercase represents 10, 'B' represents 11, and so forth, with 'Z' representing 35.)

Parameters

  [in] | nptr | The start of the string
  [in] | endptr | A pointer to the end of the parsed string will be placed here
  [in] | base | The number base to use

Returns
  - result of conversion on success
  - LLONG_MIN if an underflow occurs. errno is set to ERANGE.
  - LLONG_MAX if an overflow occurs. errno is set to ERANGE.

unsigned long strtoul | ( | const char * | cp,
|  | char ** | endp,
|  | int | base
| ) |  |

`#include <stdlib.h>`

Convert the initial part of the string in `nptr` to a unsigned long integer value according to the given `base`, which must be between 2 and 36 inclusive, or be the special value 0.

Note
  The string may begin with an arbitrary amount of white spaces followed by a single optional '+' or '-' sign. If `base` is zero or 16, the string may then include a "0x" prefix, and the number will be read in `base` 16; otherwise, a zero `base` is taken as 10 (decimal) unless the next character is '0', in which case it is taken as 8 (octal). The remainder of the string is converted to a long int value in the obvious manner, stopping at the first character which is not a valid digit in the given `base`. (In bases above 10, the letter 'A' in either uppercase or lowercase represents 10, 'B' represents 11, and so forth, with 'Z' representing 35.)

Parameters

  [in] | cp | The start of the string.
  [in] | endp | A pointer to the end of the parsed string will be placed here.
  [in] | base | The number base to use.

Return values

  result | conversion is success.
  ULONG_MAX | if an overflow occurs. errno is set to ERANGE.

unsigned long long strtoull | ( | const char * | cp,
|  | char ** | endp,
|  | int | base
| ) |  |

`#include <stdlib.h>`

Convert the initial part of the string in `nptr` to a unsigned long long integer value according to the given `base`, which must be between 2 and 36 inclusive, or be the special value 0.

Note
  The string may begin with an arbitrary amount of white spaces (as determined by isspace(3)) followed by a single optional '+' or '-' sign. If `base` is zero or 16, the string may then include a "0x" prefix, and the number will be read in `base` 16; otherwise, a zero `base` is taken as 10 (decimal) unless the next character is '0', in which case it is taken as 8 (octal). The remainder of the string is converted to a long int value in the obvious manner, stopping at the first character which is not a valid digit in the given `base`. (In bases above 10, the letter 'A' in either uppercase or lowercase represents 10, 'B' represents 11, and so forth, with 'Z' representing 35.)

Parameters

  [in] | cp | The start of the string.
  [in] | endp | A pointer to the end of the parsed string will be placed here.
  [in] | base | The number base to use.

Return values

  result | conversion is success.
  ULONG_MAX | if an overflow occurs. errno is set to ERANGE.

long sysconf | ( | int | name | ) |

`#include <unistd.h>`

Get configuration information at run time.

Allows an application to test at compile or run time whether certain options are supported, or what the value is of certain configurable constants or limits.

Parameters

  [in] | name | System resource to find out.

Returns
  - -1 if name is invalid and set errno to indicate the error.
  - value of the system resource.

time_t time | ( | time_t * | time | ) |

`#include <time.h>`

Get the current calendar time as a value of type time_t.

Parameters

  [in] | time | Pointer to an object of type time_t.

Returns
  The current calendar time as a time_t object.

void timeadd | ( | const struct timespec * | a,
|  | const struct timespec * | b,
|  | struct timespec * | res
| ) |  |

`#include <time.h>`

The function adds two dates.

Parameters

  [in] | a | Pointer to parameter to add.
  [in] | b | Pointer to parameter to add.
  [out] | res | Pointer to parameter to save result.

int64_t timespec_to_ms | ( | const struct timespec * | a | ) |

`#include <time.h>`

The function converts time from timespec format to milliseconds.

Parameters

  [in] | a | Pointer to timespec structure.

Return values

  time | in milliseconds.

uint64_t timespec_to_nsec | ( | const struct timespec * | a | ) |

`#include <time.h>`

The function converts time from timespec format to nanoseconds.

Parameters

  [in] | a | Pointer to timespec structure.

Return values

  time | in nanoseconds.

void timesub | ( | const struct timespec * | a,
|  | const struct timespec * | b,
|  | struct timespec * | res
| ) |  |

`#include <time.h>`

The function subtracts two dates.

Parameters

  [in] | a | Pointer to parameter to subtract.
  [in] | b | Pointer to parameter to subtract.
  [out] | res | Pointer to parameter to save result.

static int tolower | ( | int | c | ) |
| static

`#include <ctype.h>`

Convert uppercase letter to lowercase.

Parameters

  [in] | c | symbol for converting

Returns
  - the value of the converted letter,
  - `c` if the conversion was not possible.

static int toupper | ( | int | c | ) |
| static

`#include <ctype.h>`

Convert lowercase letter to uppercase.

Parameters

  [in] | c | symbol for converting

Returns
  - the value of the converted letter,
  - `c` if the conversion was not possible.

int unlink | ( | const char * | pathname | ) |

`#include <unistd.h>`

Remove a link to a file.

Parameters

  [in] | pathname | is name of file to remove.

Return values

  0 | on success.
  -1 | on error. errno is set appropriately.

int unsetenv | ( | const char * | name | ) |

`#include <stdlib.h>`

delete environment variable function stub

Parameters

  [in] | name | environment variable name

Return values

  0 |

void uuid_clear | ( | uuid_t * | uu | ) |

`#include <uuid/uuid.h>`

set value to zero UUID.

Parameters

  [in] | uu | value to cleanup.

int uuid_compare | ( | const uuid_t * | uu1,
|  | const uuid_t * | uu2
| ) |  |

`#include <uuid/uuid.h>`

Compare the two supplied uuid variables `uu1` and `uu2` to each other.

Parameters

  [in] | uu1 | first value to compare.
  [in] | uu2 | second value to compare.

Return values

  0 | - values are the same.
  <0 | `uu2` value is lexigraphically greater than `uu1`.
  >0 | `uu2` value is lexigraphically less than `uu1`.

void uuid_generate | ( | uuid_t * | out | ) |

`#include <uuid/uuid.h>`

The `uuid_generate` function creates a new universally unique identifier (UUID).

Parameters

  [out] | out | generated value.

int uuid_is_null | ( | const uuid_t * | uu | ) |

`#include <uuid/uuid.h>`

Check if UUID is null.

Parameters

  [in] | uu | value to check.

Return values

  0 | UUID is not NULL.
  1 | otherwise.

int uuid_parse | ( | const char * | in,
|  | uuid_t * | uu
| ) |  |

`#include <uuid/uuid.h>`

Convert an input UUID string into binary representation.

Function converts the UUID string given by `in` into the binary representation. The input UUID is a string of the form 1b4e28ba-2fa1-11d2-883f-b9a761bde3fb (in printf(3) format "%08x-%04x-%04x-%04x-%012x", 36 bytes plus the trailing '\0').

Parameters

  [in] | in | string value to convert.
  [out] | uu | binary UUID representation.

Return values

  0 | upon successfully parsing the input string.
  -1 | on failure.

void uuid_unparse | ( | const uuid_t * | uu,
|  | char * | out
| ) |  |

`#include <uuid/uuid.h>`

Convert binary representation of UUID to string.

Parameters

  [in] | uu | value to convert.
  [out] | out | textual representation in lowercase format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`.

void uuid_unparse_upper | ( | const uuid_t * | uu,
|  | char * | out
| ) |  |

`#include <uuid/uuid.h>`

Convert binary representation of UUID to string.

Parameters

  [in] | uu | value to convert.
  [out] | out | textual representation in uppercase format `XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX`.

int vasprintf | ( | char ** | strp,
|  | const char * | fmt,
|  | va_list | args
| ) |  |

`#include <stdio.h>`

print to allocated string.

Parameters

  [in,out] | args | arguments for printing.
  [out] | strp | Pointer to newly allocated string or NULL(if the function failed).
  [in] | fmt | Format string.
  [in,out] | ... | Variable arguments for printing.

The functions asprintf() and vasprintf() are analogs of sprintf() and vsprintf(), except that they allocate a string large enough to hold the output including the terminating null byte, and return a pointer to it via the first argument. This pointer should be passed to free() to release the allocated storage when it is no longer needed.
These functions are TEEGRIS extensions, not in C or POSIX. They are also available under *BSD and GNU/Linux. The GNU/Linux implementation leaves strp in undefined state in case of error.

Return values

  >=0 | number of bytes printed if succeed
  -1 | if failed, and set strp to NULL

int vasprintf_s | ( | char ** | strp,
|  | const char * | fmt,
|  | va_list | args
| ) |  |

`#include <stdio.h>`

Print to allocated string in secure mode.

Parameters

  [out] | strp | Pointer to newly allocated string or NULL(if the function failed).
  [in] | fmt | Format string.
  [in,out] | args | arguments for printing.

Return values

  >=0 | number of bytes printed if succeed
  -1 | if failed, and set strp to NULL

int vfprintf | ( | FILE *_restrict_ | stream,
|  | const char *_restrict_ | fmt,
|  | va_list | ap
| ) |  |

`#include <stdio.h>`

The vfprintf() is equivalent to the fprintf(), but uses an argument list.

Parameters

  [in] | stream | A writeable file handle.
  [in] | fmt | Format specification of output string.
  [in] | ap | Value identifying a variable arguments list initialized with `va_start`. `va_list` is a special type.

Return values

  >=0 | number of characters printed if succeed.
  -1 | if error occurred.

int vsnprintf | ( | char * | buffer,
|  | size_t | size,
|  | const char * | format,
|  | va_list | args
| ) |  |

`#include <stdio.h>`

Write formatted data from variable argument list to sized buffer.

Parameters

  [out] | buffer | Pointer to a buffer where the resulting C-string is stored.
  [in] | size | size of the buffer.
  [in] | format | C string that contains a format string.
  [in,out] | args | A value identifying a variable arguments list initialized with `va_start`. `va_list` is a special type.

Returns
  The number of characters that would have been written if size had been sufficiently large, not counting the terminating null character. If an encoding error occurs, a negative number is returned. Notice that only when this returned value is non-negative and less than size, the string has been completely written.

Example:

#include <stdio.h>
#include <stdarg.h>
void PrintFError ( const char * format, ... )
{
char buffer[256];
va_list args;
va_start (args, format);
vsnprintf (buffer,256,format, args);
perror (buffer);
va_end (args);
}
int main ()
{
FILE * pFile;
char szFileName[]="myfile.txt";
pFile = fopen (szFileName,"r");
if (pFile == NULL)
PrintFError ("Error opening '%s'",szFileName);
else
{
fclose (pFile);
}
return 0;
}

int vsnprintf_s | ( | char *_restrict_ | s,
|  | rsize_t | n,
|  | const char *_restrict_ | format,
|  | va_list | arg
| ) |  |

`#include <stdio.h>`

Write formatted data from variable argument list to sized buffer.

Parameters

  [out] | s | Pointer to a buffer where the resulting C-string is stored.
  [in] | n | size of the buffer.
  [in] | format | C string that contains a format string.
  [in] | arg | A value identifying a variable length arguments list initialized with `va_start`. `va_list` is a special type.

Returns
  The number of characters that would have been written if size had been sufficiently large, not counting the terminating null character. If an encoding error or constrain violation occur, a negative number is returned. Notice that only when this returned value is non-negative and less than size, the string has been completely written.

int vsprintf | ( | char * | buffer,
|  | const char * | format,
|  | va_list | args
| ) |  |

`#include <stdio.h>`

Write formatted data from variable argument list to string.

Parameters

  [out] | buffer | Pointer to a buffer where the resulting C-string is stored.
  [in] | format | C string that contains a format string.
  [in,out] | args | A value identifying a variable arguments list initialized with `va_start`. `va_list` is a special type.

Return values

  number | of characters printed if succeed.
  -1 | if error occurred.

Example:

#include <stdio.h>
#include <stdarg.h>
void PrintFError ( const char * format, ... )
{
char buffer[256];
va_list args;
va_start (args, format);
vsprintf (buffer,format, args);
perror (buffer);
va_end (args);
}
int main ()
{
FILE * pFile;
char szFileName[]="myfile.txt";
pFile = fopen (szFileName,"r");
if (pFile == NULL)
PrintFError ("Error opening '%s'",szFileName);
else
{
fclose (pFile);
}
return 0;
}

int vsprintf_s | ( | char *_restrict_ | s,
|  | rsize_t | n,
|  | const char *_restrict_ | format,
|  | va_list | arg
| ) |  |

`#include <stdio.h>`

Write formatted data from variable length argument list to string.

Parameters

  [out] | s | Pointer to a buffer where the resulting C-string is stored.
  [in] | n | buffer size in characters.
  [in] | format | C string that contains a format string.
  [in] | arg | A value identifying a variable arguments list initialized. with `va_start`. `va_list` is a special type.

Return values

  number | of characters printed if succeed.
  0 | if constrain violation occurred.
  -1 | if encoding error occurred.

int vsscanf | ( | const char * | buffer,
|  | const char * | fmt,
|  | va_list | args
| ) |  |

`#include <stdio.h>`

vsscanf unformat a buffer into a list of arguments.

Parameters

  [in] | buffer | input buffer.
  [in] | fmt | format of buffer.
  [in] | args | value identifying a variable arguments list initialized with `va_start`. `va_list` is a special type.

Return values

  >=0 | On success, the function returns the number of items in the argument list successfully filled. This count can match the expected number of items or be less -even zero- in the case of a matching failure.
  EOF | In the case of an input failure before any data could be successfully interpreted.

int vsscanf_s | ( | const char *_restrict_ | s,
|  | const char *_restrict_ | format,
|  | va_list | arg
| ) |  |

`#include <stdio.h>`

vsscanf unformat a buffer into a list of arguments.

Parameters

  [in] | s | Input buffer.
  [in] | format | Format of buffer.
  [in] | arg | Value identifying a variable arguments list initialized with `va_start`. `va_list` is a special type.

Return values

  >=0 | On success, the function returns the number of items in the argument list successfully filled. This count can match the expected number of items or be less -even zero- in the case of a matching failure.
  EOF | In the case of an input failure before any data could be successfully interpreted.

ssize_t write | ( | int | fd,
|  | const void * | buf,
|  | size_t | count
| ) |  |

`#include <unistd.h>`

Attempt to write `count` bytes from buffer pointed to by `buf` to the file associated with the open file descriptor, `fd`.

Parameters

  [in] | fd | File descriptor.
  [in] | buf | Pointer to buffer from to read.
  [in] | count | Number of bytes to write.

Returns
  - non-negative integer indicating the number of bytes actually written - on success.
  - -1 and set errno to indicate the error - otherwise.

## Variable Documentation

FILE* stdin

`#include <stdio.h>`

Standard input stream (stub).

PRIVATE