2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
2018-10-24 12:43:52 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-05-28 11:53:16 +02:00
|
|
|
#include <stddef.h>
|
2018-10-31 02:09:11 +01:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include <sys/types.h>
|
2018-10-24 12:43:52 +02:00
|
|
|
|
2019-12-26 10:30:34 +01:00
|
|
|
__attribute__((warn_unused_result)) int __generate_unique_filename(char* pattern);
|
2019-12-26 16:40:35 +13:00
|
|
|
|
2018-10-31 02:09:11 +01:00
|
|
|
__BEGIN_DECLS
|
2018-10-24 12:43:52 +02:00
|
|
|
|
2018-11-17 15:56:09 +01:00
|
|
|
#define EXIT_SUCCESS 0
|
|
|
|
#define EXIT_FAILURE 1
|
2019-02-08 02:38:21 +01:00
|
|
|
#define MB_CUR_MAX 1
|
2018-11-17 15:56:09 +01:00
|
|
|
|
2019-02-15 22:37:20 +01:00
|
|
|
__attribute__((malloc)) __attribute__((alloc_size(1))) void* malloc(size_t);
|
|
|
|
__attribute__((malloc)) __attribute__((alloc_size(1, 2))) void* calloc(size_t nmemb, size_t);
|
2019-05-30 02:37:40 +02:00
|
|
|
size_t malloc_size(void*);
|
2021-05-15 10:06:41 +02:00
|
|
|
size_t malloc_good_size(size_t);
|
2020-12-24 08:41:54 -07:00
|
|
|
void serenity_dump_malloc_stats(void);
|
2018-10-24 12:43:52 +02:00
|
|
|
void free(void*);
|
2020-08-13 20:14:28 +03:00
|
|
|
__attribute__((alloc_size(2))) void* realloc(void* ptr, size_t);
|
2018-10-31 17:50:43 +01:00
|
|
|
char* getenv(const char* name);
|
2021-01-31 14:31:13 +01:00
|
|
|
char* secure_getenv(const char* name);
|
2019-02-26 12:57:02 +01:00
|
|
|
int putenv(char*);
|
2019-05-19 15:19:48 +02:00
|
|
|
int unsetenv(const char*);
|
2020-12-24 08:41:54 -07:00
|
|
|
int clearenv(void);
|
2019-05-30 02:51:15 +02:00
|
|
|
int setenv(const char* name, const char* value, int overwrite);
|
2021-05-26 09:39:57 +02:00
|
|
|
const char* getprogname();
|
|
|
|
void setprogname(const char*);
|
2018-10-31 17:50:43 +01:00
|
|
|
int atoi(const char*);
|
2018-11-11 10:40:50 +01:00
|
|
|
long atol(const char*);
|
2019-03-14 15:18:15 +01:00
|
|
|
long long atoll(const char*);
|
2019-02-25 10:05:32 +01:00
|
|
|
double strtod(const char*, char** endptr);
|
2019-10-02 22:48:14 +03:00
|
|
|
long double strtold(const char*, char** endptr);
|
2019-04-17 23:13:07 +02:00
|
|
|
float strtof(const char*, char** endptr);
|
2019-02-24 15:19:32 +01:00
|
|
|
long strtol(const char*, char** endptr, int base);
|
2019-10-02 22:48:14 +03:00
|
|
|
long long strtoll(const char*, char** endptr, int base);
|
|
|
|
unsigned long long strtoull(const char*, char** endptr, int base);
|
2019-02-24 15:19:32 +01:00
|
|
|
unsigned long strtoul(const char*, char** endptr, int base);
|
2019-03-09 13:33:52 +01:00
|
|
|
void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*));
|
|
|
|
void qsort_r(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*, void*), void* arg);
|
2019-02-25 10:05:32 +01:00
|
|
|
int atexit(void (*function)());
|
2019-02-15 22:37:20 +01:00
|
|
|
__attribute__((noreturn)) void exit(int status);
|
|
|
|
__attribute__((noreturn)) void abort();
|
2019-01-15 06:30:19 +01:00
|
|
|
char* ptsname(int fd);
|
|
|
|
int ptsname_r(int fd, char* buffer, size_t);
|
2019-01-23 06:35:34 +01:00
|
|
|
int abs(int);
|
2019-02-25 10:05:32 +01:00
|
|
|
long labs(long);
|
2021-04-28 16:17:06 -07:00
|
|
|
long long int llabs(long long int);
|
2019-02-25 10:05:32 +01:00
|
|
|
double atof(const char*);
|
2019-02-03 04:32:31 +01:00
|
|
|
int system(const char* command);
|
2019-02-08 02:38:21 +01:00
|
|
|
char* mktemp(char*);
|
2019-11-16 04:34:20 -06:00
|
|
|
int mkstemp(char*);
|
2019-09-12 08:43:52 -03:00
|
|
|
char* mkdtemp(char*);
|
2019-05-28 11:53:16 +02:00
|
|
|
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*));
|
2019-10-09 16:00:35 +03:00
|
|
|
size_t mbstowcs(wchar_t*, const char*, size_t);
|
2020-09-09 08:27:12 +01:00
|
|
|
int mbtowc(wchar_t*, const char*, size_t);
|
2019-10-12 22:47:25 -03:00
|
|
|
int wctomb(char*, wchar_t);
|
2019-11-11 14:08:20 +01:00
|
|
|
size_t wcstombs(char*, const wchar_t*, size_t);
|
2019-11-16 17:18:44 +01:00
|
|
|
char* realpath(const char* pathname, char* buffer);
|
2021-05-08 20:46:06 +02:00
|
|
|
__attribute__((noreturn)) void _Exit(int status);
|
2018-10-24 12:43:52 +02:00
|
|
|
|
2019-01-14 15:25:34 +01:00
|
|
|
#define RAND_MAX 32767
|
|
|
|
int rand();
|
|
|
|
void srand(unsigned seed);
|
|
|
|
|
2019-02-01 16:03:21 +01:00
|
|
|
long int random();
|
|
|
|
void srandom(unsigned seed);
|
|
|
|
|
2020-12-24 08:41:54 -07:00
|
|
|
uint32_t arc4random(void);
|
2019-10-13 12:26:42 -03:00
|
|
|
void arc4random_buf(void*, size_t);
|
|
|
|
uint32_t arc4random_uniform(uint32_t);
|
|
|
|
|
2019-05-28 11:53:16 +02:00
|
|
|
typedef struct {
|
|
|
|
int quot;
|
|
|
|
int rem;
|
|
|
|
} div_t;
|
2019-02-05 13:38:32 +01:00
|
|
|
div_t div(int, int);
|
2019-05-28 11:53:16 +02:00
|
|
|
typedef struct {
|
|
|
|
long quot;
|
|
|
|
long rem;
|
|
|
|
} ldiv_t;
|
2019-02-05 13:38:32 +01:00
|
|
|
ldiv_t ldiv(long, long);
|
2021-03-07 18:09:44 +02:00
|
|
|
typedef struct {
|
|
|
|
long long quot;
|
|
|
|
long long rem;
|
|
|
|
} lldiv_t;
|
|
|
|
lldiv_t lldiv(long long, long long);
|
2019-02-05 13:38:32 +01:00
|
|
|
|
2020-02-05 21:17:41 +01:00
|
|
|
int posix_openpt(int flags);
|
|
|
|
int grantpt(int fd);
|
|
|
|
int unlockpt(int fd);
|
|
|
|
|
2021-01-31 14:31:13 +01:00
|
|
|
long getauxval(long type);
|
|
|
|
|
2018-10-31 02:09:11 +01:00
|
|
|
__END_DECLS
|