public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
68573b496842bb294fe236eea7aec80cff25eb7e blob 1929 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright Red Hat
 * Author: David Gibson <david@gibson.dropbear.id.au>
 *
 * Definitions used by both passt/pasta and other tools
 */

#ifndef COMMON_H
#define COMMON_H

#include <string.h>

#define VERSION_BLOB							       \
	VERSION "\n"							       \
	"Copyright Red Hat\n"						       \
	"GNU General Public License, version 2 or later\n"		       \
	"  <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>\n"	       \
	"This is free software: you are free to change and redistribute it.\n" \
	"There is NO WARRANTY, to the extent permitted by law.\n\n"

/* FPRINTF() intentionally silences cert-err33-c clang-tidy warnings */
#define FPRINTF(f, ...)	(void)fprintf(f, __VA_ARGS__)

/*
 * Starting from glibc 2.40.9000 and commit 25a5eb4010df ("string: strerror,
 * strsignal cannot use buffer after dlmopen (bug 32026)"), strerror() needs
 * getrandom(2) and brk(2) as it allocates memory for the locale-translated
 * error description, but our seccomp profiles forbid both.
 *
 * Use the strerror_() wrapper instead, calling into strerrordesc_np() to get
 * a static untranslated string. It's a GNU implementation, but also defined by
 * bionic.
 *
 * If strerrordesc_np() is not defined (e.g. musl), call strerror(). C libraries
 * not defining strerrordesc_np() are expected to provide strerror()
 * implementations that are simple enough for us to call.
 */
__attribute__ ((weak)) const char *strerrordesc_np(int errnum);

/**
 * strerror_() - strerror() wrapper calling strerrordesc_np() if available
 * @errnum:	Error code
 *
 * Return: error description string
 */
static inline const char *strerror_(int errnum)
{
	if (strerrordesc_np)
		return strerrordesc_np(errnum);

	return strerror(errnum);
}

#define strerror(x) @ "Don't call strerror() directly, use strerror_() instead"

#define ARRAY_SIZE(a)		((int)(sizeof(a) / sizeof((a)[0])))

#endif /* COMMON_H */
debug log:

solving 68573b4 ...
found 68573b4 in https://archives.passt.top/passt-dev/20260506132323.1751386-12-sbrivio@redhat.com/ ||
	https://archives.passt.top/passt-dev/20260506092241.1607480-12-sbrivio@redhat.com/ ||
	https://archives.passt.top/passt-dev/20260506213155.1886983-12-sbrivio@redhat.com/ ||
	https://archives.passt.top/passt-dev/20260505234719.1437340-12-sbrivio@redhat.com/ ||
	https://archives.passt.top/passt-dev/20260504231142.1118652-12-sbrivio@redhat.com/
found 4251781 in https://archives.passt.top/passt-dev/20260505234719.1437340-10-sbrivio@redhat.com/ ||
	https://archives.passt.top/passt-dev/20260504231142.1118652-10-sbrivio@redhat.com/ ||
	https://archives.passt.top/passt-dev/20260506092241.1607480-10-sbrivio@redhat.com/ ||
	https://archives.passt.top/passt-dev/20260506132323.1751386-10-sbrivio@redhat.com/ ||
	https://archives.passt.top/passt-dev/20260506213155.1886983-10-sbrivio@redhat.com/
found f3506b4 in https://archives.passt.top/passt-dev/20260506092241.1607480-9-sbrivio@redhat.com/ ||
	https://archives.passt.top/passt-dev/20260506132323.1751386-9-sbrivio@redhat.com/ ||
	https://archives.passt.top/passt-dev/20260506213155.1886983-9-sbrivio@redhat.com/ ||
	https://archives.passt.top/passt-dev/20260504231142.1118652-9-sbrivio@redhat.com/ ||
	https://archives.passt.top/passt-dev/20260505234719.1437340-9-sbrivio@redhat.com/

applying [1/15] https://archives.passt.top/passt-dev/20260506092241.1607480-9-sbrivio@redhat.com/
diff --git a/common.h b/common.h
new file mode 100644
index 0000000..f3506b4

Checking patch common.h...
Applied patch common.h cleanly.

skipping https://archives.passt.top/passt-dev/20260506132323.1751386-9-sbrivio@redhat.com/ for f3506b4
skipping https://archives.passt.top/passt-dev/20260506213155.1886983-9-sbrivio@redhat.com/ for f3506b4
skipping https://archives.passt.top/passt-dev/20260504231142.1118652-9-sbrivio@redhat.com/ for f3506b4
skipping https://archives.passt.top/passt-dev/20260505234719.1437340-9-sbrivio@redhat.com/ for f3506b4
index at:
100644 f3506b4275798c9435c1d213a39760ef60562e0c	common.h

applying [2/15] https://archives.passt.top/passt-dev/20260505234719.1437340-10-sbrivio@redhat.com/
diff --git a/common.h b/common.h
index f3506b4..4251781 100644

Checking patch common.h...
Applied patch common.h cleanly.

skipping https://archives.passt.top/passt-dev/20260504231142.1118652-10-sbrivio@redhat.com/ for 4251781
skipping https://archives.passt.top/passt-dev/20260506092241.1607480-10-sbrivio@redhat.com/ for 4251781
skipping https://archives.passt.top/passt-dev/20260506132323.1751386-10-sbrivio@redhat.com/ for 4251781
skipping https://archives.passt.top/passt-dev/20260506213155.1886983-10-sbrivio@redhat.com/ for 4251781
index at:
100644 4251781cbfd2ac0bafee7b600e7c17b39fee3c42	common.h

applying [3/15] https://archives.passt.top/passt-dev/20260506132323.1751386-12-sbrivio@redhat.com/
diff --git a/common.h b/common.h
index 4251781..68573b4 100644

Checking patch common.h...
Applied patch common.h cleanly.

skipping https://archives.passt.top/passt-dev/20260506092241.1607480-12-sbrivio@redhat.com/ for 68573b4
skipping https://archives.passt.top/passt-dev/20260506213155.1886983-12-sbrivio@redhat.com/ for 68573b4
skipping https://archives.passt.top/passt-dev/20260505234719.1437340-12-sbrivio@redhat.com/ for 68573b4
skipping https://archives.passt.top/passt-dev/20260504231142.1118652-12-sbrivio@redhat.com/ for 68573b4
index at:
100644 68573b496842bb294fe236eea7aec80cff25eb7e	common.h

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).