1 /*
2  * Copyright (c) 2023 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * See description in header
7  */
8 
9 #include <stdlib.h>
10 #include <unistd.h>
11 #include <fcntl.h>
12 #include <string.h>
13 
nsi_host_calloc(unsigned long nmemb,unsigned long size)14 void *nsi_host_calloc(unsigned long nmemb, unsigned long size)
15 {
16 	return calloc(nmemb, size);
17 }
18 
nsi_host_close(int fd)19 int nsi_host_close(int fd)
20 {
21 	return close(fd);
22 }
23 
nsi_host_free(void * ptr)24 void nsi_host_free(void *ptr)
25 {
26 	free(ptr);
27 }
28 
nsi_host_getcwd(char * buf,unsigned long size)29 char *nsi_host_getcwd(char *buf, unsigned long size)
30 {
31 	return getcwd(buf, size);
32 }
33 
nsi_host_isatty(int fd)34 int nsi_host_isatty(int fd)
35 {
36 	return isatty(fd);
37 }
38 
nsi_host_malloc(unsigned long size)39 void *nsi_host_malloc(unsigned long size)
40 {
41 	return malloc(size);
42 }
43 
nsi_host_open(const char * pathname,int flags)44 int nsi_host_open(const char *pathname, int flags)
45 {
46 	return open(pathname, flags);
47 }
48 
nsi_host_random(void)49 long nsi_host_random(void)
50 {
51 	return random();
52 }
53 
nsi_host_read(int fd,void * buffer,unsigned long size)54 long nsi_host_read(int fd, void *buffer, unsigned long size)
55 {
56 	return read(fd, buffer, size);
57 }
58 
nsi_host_realloc(void * ptr,unsigned long size)59 void *nsi_host_realloc(void *ptr, unsigned long size)
60 {
61 	return realloc(ptr, size);
62 }
63 
nsi_host_srandom(unsigned int seed)64 void nsi_host_srandom(unsigned int seed)
65 {
66 	srandom(seed);
67 }
68 
nsi_host_strdup(const char * s)69 char *nsi_host_strdup(const char *s)
70 {
71 	return strdup(s);
72 }
73 
nsi_host_write(int fd,void * buffer,unsigned long size)74 long nsi_host_write(int fd, void *buffer, unsigned long size)
75 {
76 	return write(fd, buffer, size);
77 }
78