1 /*
2  * Copyright (c) 2023 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * The native simulator provides a set of trampolines to some of the simplest
7  * host C library symbols.
8  * These are intended to facilitate test embedded code interacting with the host.
9  *
10  * We should never include here symbols which require host headers be exposed
11  * to the embedded side, for example due to non-basic types being used in
12  * function calls, as that would break the include path isolation
13  *
14  * Naming convention: nsi_host_<fun>() where <func> is the name of the equivalent
15  * C library function we call through
16  */
17 
18 #ifndef NSI_COMMON_SRC_INCL_NSI_HOST_TRAMPOLINES_H
19 #define NSI_COMMON_SRC_INCL_NSI_HOST_TRAMPOLINES_H
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 void *nsi_host_calloc(unsigned long nmemb, unsigned long size);
26 int nsi_host_close(int fd);
27 /* void nsi_host_exit (int status); Use nsi_exit() instead */
28 void nsi_host_free(void *ptr);
29 char *nsi_host_getcwd(char *buf, unsigned long size);
30 int nsi_host_isatty(int fd);
31 void *nsi_host_malloc(unsigned long size);
32 int nsi_host_open(const char *pathname, int flags);
33 /* int nsi_host_printf (const char *fmt, ...); Use the nsi_tracing.h equivalents */
34 long nsi_host_random(void);
35 long nsi_host_read(int fd, void *buffer, unsigned long size);
36 void *nsi_host_realloc(void *ptr, unsigned long size);
37 void nsi_host_srandom(unsigned int seed);
38 char *nsi_host_strdup(const char *s);
39 long nsi_host_write(int fd, const void *buffer, unsigned long size);
40 
41 #ifdef __cplusplus
42 }
43 #endif
44 
45 #endif /* NSI_COMMON_SRC_INCL_NSI_HOST_TRAMPOLINES_H */
46