svn commit: r549940 - in head/devel/got: . files/openbsd-compat files/openbsd-compat/sys
Christian Weisgerber
naddy at FreeBSD.org
Thu Sep 24 19:02:03 UTC 2020
Author: naddy
Date: Thu Sep 24 19:02:01 2020
New Revision: 549940
URL: https://svnweb.freebsd.org/changeset/ports/549940
Log:
Switch mostly to a single compat header file that provides compatibility
mappings for system headers and prototypes of functions in libopenbsd-compat.
Added:
head/devel/got/files/openbsd-compat/openbsd-compat.h (contents, props changed)
Deleted:
head/devel/got/files/openbsd-compat/libgen.h
head/devel/got/files/openbsd-compat/stdlib.h
head/devel/got/files/openbsd-compat/sys/
head/devel/got/files/openbsd-compat/unistd.h
Modified:
head/devel/got/Makefile
head/devel/got/files/openbsd-compat/basename.c
head/devel/got/files/openbsd-compat/dirname.c
head/devel/got/files/openbsd-compat/imsg-buffer.c
head/devel/got/files/openbsd-compat/imsg.c
Modified: head/devel/got/Makefile
==============================================================================
--- head/devel/got/Makefile Thu Sep 24 18:56:13 2020 (r549939)
+++ head/devel/got/Makefile Thu Sep 24 19:02:01 2020 (r549940)
@@ -13,7 +13,12 @@ LICENSE_FILE= ${WRKSRC}/LICENCE
USES= uidfix
+n= ${.newline}
post-extract:
+ @${FIND} ${WRKSRC} -name '*.[cy]' -exec \
+ ${REINPLACE_CMD} '1,/^#include "/{ \
+ /^#include "/i\$n#include "openbsd-compat.h"\$n$n}' \
+ {} +
${CP} -R ${FILESDIR}/openbsd-compat ${WRKSRC}
# The regression test suite requires:
Modified: head/devel/got/files/openbsd-compat/basename.c
==============================================================================
--- head/devel/got/files/openbsd-compat/basename.c Thu Sep 24 18:56:13 2020 (r549939)
+++ head/devel/got/files/openbsd-compat/basename.c Thu Sep 24 19:02:01 2020 (r549940)
@@ -21,6 +21,8 @@
#include <limits.h>
#include <string.h>
+#include <openbsd-compat.h>
+
char *
basename(const char *path)
{
Modified: head/devel/got/files/openbsd-compat/dirname.c
==============================================================================
--- head/devel/got/files/openbsd-compat/dirname.c Thu Sep 24 18:56:13 2020 (r549939)
+++ head/devel/got/files/openbsd-compat/dirname.c Thu Sep 24 19:02:01 2020 (r549940)
@@ -21,6 +21,8 @@
#include <limits.h>
#include <string.h>
+#include <openbsd-compat.h>
+
/* A slightly modified copy of this file exists in libexec/ld.so */
char *
Modified: head/devel/got/files/openbsd-compat/imsg-buffer.c
==============================================================================
--- head/devel/got/files/openbsd-compat/imsg-buffer.c Thu Sep 24 18:56:13 2020 (r549939)
+++ head/devel/got/files/openbsd-compat/imsg-buffer.c Thu Sep 24 19:02:01 2020 (r549940)
@@ -27,6 +27,8 @@
#include <string.h>
#include <unistd.h>
+#include <openbsd-compat.h>
+
#include "imsg.h"
static int ibuf_realloc(struct ibuf *, size_t);
Modified: head/devel/got/files/openbsd-compat/imsg.c
==============================================================================
--- head/devel/got/files/openbsd-compat/imsg.c Thu Sep 24 18:56:13 2020 (r549939)
+++ head/devel/got/files/openbsd-compat/imsg.c Thu Sep 24 19:02:01 2020 (r549940)
@@ -26,6 +26,8 @@
#include <string.h>
#include <unistd.h>
+#include <openbsd-compat.h>
+
#include "imsg.h"
int imsg_fd_overhead = 0;
Added: head/devel/got/files/openbsd-compat/openbsd-compat.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/devel/got/files/openbsd-compat/openbsd-compat.h Thu Sep 24 19:02:01 2020 (r549940)
@@ -0,0 +1,78 @@
+/*
+ * Compatibility mappings for system headers and
+ * prototypes for functions in libopenbsd-compat.
+ */
+
+#ifndef _OPENBSD_COMPAT_H_
+#define _OPENBSD_COMPAT_H_
+
+/*
+ * <sys/cdefs.h>
+ */
+#define __dead __dead2
+
+/*
+ * <sys/queue.h>
+ */
+#define SIMPLEQ_HEAD(name, type) \
+ STAILQ_HEAD(name, type)
+#define SIMPLEQ_HEAD_INITIALIZER(head) \
+ STAILQ_HEAD_INITIALIZER(head)
+#define SIMPLEQ_ENTRY(type) \
+ STAILQ_ENTRY(type)
+#define SIMPLEQ_FIRST(head) \
+ STAILQ_FIRST(head)
+#define SIMPLEQ_END(head) \
+ NULL
+#define SIMPLEQ_EMPTY(head) \
+ STAILQ_EMPTY(head)
+#define SIMPLEQ_NEXT(elm, field) \
+ STAILQ_NEXT(elm, field)
+#define SIMPLEQ_FOREACH(var, head, field) \
+ STAILQ_FOREACH(var, head, field)
+#define SIMPLEQ_FOREACH_SAFE(var, head, field, tvar) \
+ STAILQ_FOREACH_SAFE(var, head, field, tvar)
+#define SIMPLEQ_INIT(head) \
+ STAILQ_INIT(head)
+#define SIMPLEQ_INSERT_HEAD(head, elm, field) \
+ STAILQ_INSERT_HEAD(head, elm, field)
+#define SIMPLEQ_INSERT_TAIL(head, elm, field) \
+ STAILQ_INSERT_TAIL(head, elm, field)
+#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) \
+ STAILQ_INSERT_AFTER(head, listelm, elm, field)
+#define SIMPLEQ_REMOVE_HEAD(head, field) \
+ STAILQ_REMOVE_HEAD(head, field)
+#define SIMPLEQ_REMOVE_AFTER(head, elm, field) \
+ STAILQ_REMOVE_AFTER(head, elm, field)
+#define SIMPLEQ_CONCAT(head1, head2) \
+ STAILQ_CONCAT(head1, head2)
+
+/*
+ * <libgen.h>
+ */
+#undef basename
+#undef dirname
+#define basename(path) basename_const(path)
+#define dirname(path) dirname_const(path)
+
+char *basename(const char *);
+char *dirname(const char *);
+
+/*
+ * <stdlib.h>
+ */
+void freezero(void *, size_t);
+void *recallocarray(void *, size_t, size_t, size_t);
+
+/*
+ * <unistd.h>
+ */
+int getdtablecount(void);
+
+/* void -> int */
+#define closefrom(fd) (closefrom(fd), 0)
+
+#define pledge(promises, execpromises) 0
+#define unveil(path, permissions) 0
+
+#endif /* _OPENBSD_COMPAT_H_ */
More information about the svn-ports-head
mailing list