| Samsung Internal API reference 2.0

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

- File List
- Globals

stdlib.h
Go to the documentation of this file.
1
9 #ifndef __STDLIB_H__
10 #define __STDLIB_H__
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 #include <stddef.h>
17 #include <stdint.h>
18
19 #ifdef __STDC_WANT_LIB_EXT1__
20 #include "errno.h"
21
26 typedef void (*constraint_handler_t) (const char *restrict msg, void *restrict ptr, errno_t error);
27
33 constraint_handler_t set_constraint_handler_s(constraint_handler_t handler);
34
43 void invoke_constraint_handler_s(const char *msg,
44 const char *file,
45 const char *function,
46 uint32_t line,
47 errno_t error);
48
55 void abort_handler_s(const char *restrict msg,
56 void *restrict ptr,
57 errno_t error) __attribute__ ((noreturn));
58
65 void ignore_handler_s(const char *restrict msg,
66 void *restrict ptr,
67 errno_t error);
68
69 #endif /* __STDC_WANT_LIB_EXT1__ */
70
76 extern void exit(int status) __attribute__ ((noreturn));
77
83 extern void _exit(int status) __attribute__((noreturn));
84
91 static __inline__ int abs(int j) {
92 return (j < 0) ? -j : j;
93 }
94
98 void abort(void) __attribute__((noreturn));
99
122 extern long strtol(const char *nptr, char **endptr, int base)
123 __attribute__ ((warn_unused_result));
124
144 extern unsigned long strtoul(const char *cp, char **endp, int base)
145 __attribute__ ((warn_unused_result));
146
147
169 extern double strtod(const char *nptr, char **endptr);
170
192 extern long long strtoll(const char *nptr, char **endptr, int base)
193 __attribute__ ((warn_unused_result));
194
214 extern unsigned long long strtoull(const char *cp, char **endp, int base)
215 __attribute__ ((warn_unused_result));
216
245 extern float strtof(const char *nptr, char **endptr);
246
275 extern long double strtold(const char *nptr, char **endptr);
276
284 int atexit(void (*func)(void));
285
286 #ifndef __HIDE_INTERNAL_FUNCTIONS__
287
296 int on_exit(void (*func)(int , void *), void *arg);
297
298 #endif
299
307 extern void *malloc(size_t size)
308 __attribute__ ((warn_unused_result, malloc));
309
316 extern void free(void *ptr);
317
328 extern void *calloc(size_t nmemb, size_t size)
329 __attribute__ ((warn_unused_result, malloc));
330
350 extern void *realloc(void *ptr, size_t size)
351 __attribute__ ((warn_unused_result));
352
353 /* stubs for jemalloc. Find more info at jemalloc_stubs.c */
354 #ifdef USE_JEMALLOC
355 extern char *__getenv_stub(const char *name);
356 #endif
357
365 void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
366
375 void qsort_r(void *base, size_t nmemb, size_t size,
376 int (*compar)(const void *, const void *, void *), void *arg);
377
383 int atoi(const char *nptr);
384
390 double atof(const char *nptr);
391
397 char *getenv(const char *name);
398
404 int unsetenv(const char *name);
405
413 int setenv(const char *name, const char *value, int overwrite);
414
415 #ifdef __cplusplus
416 }
417 #endif
418
419 #endif /* __STDLIB_H__ */
420
ignore_handler_s
void ignore_handler_s(const char *restrict msg, void *restrict ptr, errno_t error)
Returns to the caller without performing any actions.
errno.h
system error numbers
malloc
void * malloc(size_t size)
Allocate size bytes and return a pointer to the allocated memory.
atoi
int atoi(const char *nptr)
Convert a string to an integer.
strtoul
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 give...
strtod
double strtod(const char *nptr, char **endptr)
the initial portion of the string pointed to by nptr to double.
strtoull
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...
abs
static __inline__ int abs(int j)
Compute the absolute value of the integer argument __n.
Definition: stdlib.h:91
errno_t
int errno_t
Definition: errno.h:297
set_constraint_handler_s
constraint_handler_t set_constraint_handler_s(constraint_handler_t handler)
Set the handler to be handler.
unsetenv
int unsetenv(const char *name)
delete environment variable function stub
strtol
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...
_exit
void _exit(int status)
Terminate the calling process "immediately". Any open file descriptors belonging to the process are c...
strtof
float strtof(const char *nptr, char **endptr)
the initial portion of the string pointed to by nptr to float.
invoke_constraint_handler_s
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.
getenv
char * getenv(const char *name)
get an environment variable function stub
setenv
int setenv(const char *name, const char *value, int overwrite)
change or add environment variable function stub
atexit
int atexit(void(*func)(void))
Register the given function to be called at normal process termination.
abort
void abort(void)
Cause abnormal process termination.
abort_handler_s
void abort_handler_s(const char *restrict msg, void *restrict ptr, errno_t error)
Abort system if constraint was caused.
calloc
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 allocat...
constraint_handler_t
void(* constraint_handler_t)(const char *restrict msg, void *restrict ptr, errno_t error)
Definition: stdlib.h:26
free
void free(void *ptr)
Free the memory space pointer to by ptr.
strtold
long double strtold(const char *nptr, char **endptr)
the initial portion of the string pointed to by nptr to long double.
realloc
void * realloc(void *ptr, size_t size)
Change the size of the memory block pointed to by ptr to size bytes.
exit
void exit(int status)
Cause normal process termination and return the value of status & 0377 to the parent.
atof
double atof(const char *nptr)
Convert a string to a double.
qsort_r
void qsort_r(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *, void *), void *arg)
Sort an array.
strtoll
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 ba...
qsort
void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *))
Sort an array.