netatalk  4.4.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
compat.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1996 Regents of The University of Michigan.
3 * All Rights Reserved. See COPYRIGHT.
4 */
5
6#ifdef HAVE_CONFIG_H
7#include "config.h"
8#endif
9
10#include <signal.h>
11
12/* OpenBSD */
13#if defined(__OpenBSD__) && !defined(ENOTSUP)
14#define ENOTSUP EOPNOTSUPP
15#endif
16
17#if !defined(HAVE_PSELECT) || defined(__OpenBSD__)
18extern int pselect(int, fd_set *, fd_set *, fd_set *, const struct timespec *,
19 const sigset_t *);
20#endif
21
22#ifndef HAVE_STRNLEN
23extern size_t strnlen(const char *s, size_t n);
24#endif
25
26#ifndef HAVE_STRLCPY
27extern size_t strlcpy(char *, const char *, size_t);
28#endif
29
30#ifndef HAVE_STRLCAT
31extern size_t strlcat(char *, const char *, size_t);
32#endif
33
34#ifndef HAVE_VASPRINTF
35#include <stdio.h>
36#include <stdarg.h>
37extern int vasprintf(char **ret, const char *fmt, va_list ap);
38#endif
39
40/* Secure memory clearing - prefer memset_explicit (C23) over explicit_bzero */
41#if !defined(HAVE_MEMSET_EXPLICIT) && !defined(HAVE_EXPLICIT_BZERO)
42#include <stddef.h>
43extern void explicit_bzero(void *s, size_t n);
44#elif defined(HAVE_MEMSET_EXPLICIT) && !defined(HAVE_EXPLICIT_BZERO)
45#include <string.h>
46#define explicit_bzero(s, n) memset_explicit((s), 0, (n))
47#endif
void explicit_bzero(void *s, size_t n)
Definition explicit_bzero.c:32
int vasprintf(char **ret, const char *fmt, va_list ap)
Definition misc.c:34
size_t strlcat(char *, const char *, size_t)
Definition strlcpy.c:59
size_t strlcpy(char *, const char *, size_t)
Definition strlcpy.c:36
size_t strnlen(const char *s, size_t n)
Definition misc.c:19
int pselect(int, fd_set *, fd_set *, fd_set *, const struct timespec *, const sigset_t *)