source: rtems-libbsd/rtemsbsd/include/machine/rtems-bsd-program.h @ 70555d5

55-freebsd-126-freebsd-12
Last change on this file since 70555d5 was 632e278, checked in by Christian Mauderer <Christian.Mauderer@…>, on 10/21/16 at 09:05:29

rtemsbsd: Add reallocf to rtems_bsd_program.

  • Property mode set to 100644
File size: 5.1 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup rtems_bsd_machine
5 *
6 * @brief TODO.
7 */
8
9/*
10 * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Dornierstr. 4
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions
20 * are met:
21 * 1. Redistributions of source code must retain the above copyright
22 *    notice, this list of conditions and the following disclaimer.
23 * 2. Redistributions in binary form must reproduce the above copyright
24 *    notice, this list of conditions and the following disclaimer in the
25 *    documentation and/or other materials provided with the distribution.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 */
39
40#ifndef _RTEMS_BSD_MACHINE_RTEMS_BSD_PROGRAM_H_
41#define _RTEMS_BSD_MACHINE_RTEMS_BSD_PROGRAM_H_
42
43#include <sys/cdefs.h>
44#include <stdbool.h>
45#include <stdio.h>
46#include <stdarg.h>
47
48__BEGIN_DECLS
49
50int
51rtems_bsd_program_call(const char *name, int (*prog)(void *), void *context);
52
53int
54rtems_bsd_program_call_main(const char *name, int (*main)(int, char **),
55    int argc, char **argv);
56
57int
58rtems_bsd_program_call_main_with_data_restore(const char *name,
59    int (*main)(int, char **), int argc, char **argv,
60    void *data_buf, const size_t data_size);
61
62void
63rtems_bsd_program_exit(int exit_code) __dead2;
64
65void
66rtems_bsd_program_error(const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
67
68const char *
69rtems_bsd_program_get_name(void);
70
71void *
72rtems_bsd_program_get_context(void) __pure2;
73
74void
75rtems_bsd_program_lock(void);
76
77void
78rtems_bsd_program_unlock(void);
79
80int
81rtems_bsd_program_open(const char *path, int oflag, ...);
82
83int
84rtems_bsd_program_socket(int domain, int type, int protocol);
85
86int
87rtems_bsd_program_close(int fd);
88
89FILE *
90rtems_bsd_program_fopen(const char *restrict filename,
91    const char *restrict mode);
92
93int
94rtems_bsd_program_fclose(FILE *file);
95
96void *
97rtems_bsd_program_malloc(size_t size);
98
99void *
100rtems_bsd_program_calloc(size_t nelem, size_t elsize);
101
102void *
103rtems_bsd_program_realloc(void *ptr, size_t size);
104
105void *
106rtems_bsd_program_reallocf(void *ptr, size_t size);
107
108char *
109rtems_bsd_program_strdup(const char *s1);
110
111int
112rtems_bsd_program_vasprintf(char **strp, const char *fmt, va_list ap);
113
114int
115rtems_bsd_program_asprintf(char **strp, const char *fmt, ...);
116
117void
118rtems_bsd_program_free(void *ptr);
119
120#ifndef RTEMS_BSD_PROGRAM_NO_EXIT_WRAP
121  #define exit(code) rtems_bsd_program_exit(code)
122#endif
123
124#ifndef RTEMS_BSD_PROGRAM_NO_ERROR_WRAP
125  #define error(fmt, ...) rtems_bsd_program_error(fmt, ## __VA_ARGS__)
126#endif
127
128#ifndef RTEMS_BSD_PROGRAM_NO_GETPROGNAME_WRAP
129  #define getprogname() rtems_bsd_program_get_name()
130#endif
131
132#ifndef RTEMS_BSD_PROGRAM_NO_PRINTF_WRAP
133  #define printf(...) fprintf(stdout, __VA_ARGS__)
134#endif
135
136#ifndef RTEMS_BSD_PROGRAM_NO_OPEN_WRAP
137  #define open(path, oflag, ...) \
138      rtems_bsd_program_open(path, oflag, ## __VA_ARGS__)
139#endif
140
141#ifndef RTEMS_BSD_PROGRAM_NO_SOCKET_WRAP
142  #define socket(domain, type, protocol) \
143      rtems_bsd_program_socket(domain, type, protocol)
144#endif
145
146#ifndef RTEMS_BSD_PROGRAM_NO_CLOSE_WRAP
147  #define close(fildes) rtems_bsd_program_close(fildes)
148#endif
149
150#ifndef RTEMS_BSD_PROGRAM_NO_FOPEN_WRAP
151  #define fopen(filename, mode) rtems_bsd_program_fopen(filename, mode)
152#endif
153
154#ifndef RTEMS_BSD_PROGRAM_NO_FCLOSE_WRAP
155  #define fclose(file) rtems_bsd_program_fclose(file)
156#endif
157
158#ifndef RTEMS_BSD_PROGRAM_NO_MALLOC_WRAP
159  #define malloc(size) rtems_bsd_program_malloc(size)
160#endif
161
162#ifndef RTEMS_BSD_PROGRAM_NO_CALLOC_WRAP
163  #define calloc(nelem, elsize) rtems_bsd_program_calloc(nelem, elsize)
164#endif
165
166#ifndef RTEMS_BSD_PROGRAM_NO_REALLOC_WRAP
167  #define realloc(ptr, size) rtems_bsd_program_realloc(ptr, size)
168#endif
169
170#ifndef RTEMS_BSD_PROGRAM_NO_REALLOC_WRAP
171  #define reallocf(ptr, size) rtems_bsd_program_reallocf(ptr, size)
172#endif
173
174#ifndef RTEMS_BSD_PROGRAM_NO_STRDUP_WRAP
175  #define strdup(s1) rtems_bsd_program_strdup(s1)
176#endif
177
178#ifndef RTEMS_BSD_PROGRAM_NO_VASPRINTF_WRAP
179  #define vasprintf(strp, fmt, ap) \
180      rtems_bsd_program_vasprintf(strp, fmt, ap)
181#endif
182
183#ifndef RTEMS_BSD_PROGRAM_NO_ASPRINTF_WRAP
184  #define asprintf(strp, fmt, ...) \
185      rtems_bsd_program_asprintf(strp, fmt, ## __VA_ARGS__)
186#endif
187
188#ifndef RTEMS_BSD_PROGRAM_NO_FREE_WRAP
189  #define free(ptr) rtems_bsd_program_free(ptr);
190#endif
191
192__END_DECLS
193
194#endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_PROGRAM_H_ */
Note: See TracBrowser for help on using the repository browser.