]> git.ipfire.org Git - thirdparty/glibc.git/blame - support/support.h
Assume that accept4 is always available and works
[thirdparty/glibc.git] / support / support.h
CommitLineData
c23de0aa 1/* Common extra functions.
bfff8b1b 2 Copyright (C) 2016-2017 Free Software Foundation, Inc.
c23de0aa
FW
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19/* This header file should only contain definitions compatible with
20 C90. (Using __attribute__ is fine because <features.h> provides a
21 fallback.) */
22
23#ifndef SUPPORT_H
24#define SUPPORT_H
25
26#include <stddef.h>
27#include <sys/cdefs.h>
28
29__BEGIN_DECLS
30
31/* Write a message to standard output. Can be used in signal
32 handlers. */
33void write_message (const char *message) __attribute__ ((nonnull (1)));
34
35/* Avoid all the buffer overflow messages on stderr. */
36void ignore_stderr (void);
37
38/* Set fortification error handler. Used when tests want to verify that bad
39 code is caught by the library. */
40void set_fortify_handler (void (*handler) (int sig));
41
42/* Report an out-of-memory error for the allocation of SIZE bytes in
43 FUNCTION, terminating the process. */
44void oom_error (const char *function, size_t size)
45 __attribute__ ((nonnull (1)));
46
47/* Error-checking wrapper functions which terminate the process on
48 error. */
49
50void *xmalloc (size_t) __attribute__ ((malloc));
51void *xcalloc (size_t n, size_t s) __attribute__ ((malloc));
52void *xrealloc (void *p, size_t n);
53char *xasprintf (const char *format, ...)
54 __attribute__ ((format (printf, 1, 2), malloc));
5840c75c 55char *xstrdup (const char *);
c23de0aa
FW
56
57__END_DECLS
58
59#endif /* SUPPORT_H */