Module Name:    othersrc
Committed By:   lukem
Date:           Tue Jan 29 13:06:14 UTC 2019

Modified Files:
        othersrc/libexec/tnftpd: configure.ac tnftpd.h
Added Files:
        othersrc/libexec/tnftpd/libnetbsd: explicit_memset.c

Log Message:
provide explicit_memset() from NetBSD

Import NetBSD src/common/lib/libc/string/explicit_memset.c rev 1.4
for explicit_memset(3), because ftpcmd.y now uses that.

Add autoconf AC_REPLACE_FUNCS check for explicit_memset.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 othersrc/libexec/tnftpd/configure.ac
cvs rdiff -u -r1.36 -r1.37 othersrc/libexec/tnftpd/tnftpd.h
cvs rdiff -u -r0 -r1.1 othersrc/libexec/tnftpd/libnetbsd/explicit_memset.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: othersrc/libexec/tnftpd/configure.ac
diff -u othersrc/libexec/tnftpd/configure.ac:1.40 othersrc/libexec/tnftpd/configure.ac:1.41
--- othersrc/libexec/tnftpd/configure.ac:1.40	Tue Jan 29 12:51:38 2019
+++ othersrc/libexec/tnftpd/configure.ac	Tue Jan 29 13:06:14 2019
@@ -1,4 +1,4 @@
-# $NetBSD: configure.ac,v 1.40 2019/01/29 12:51:38 lukem Exp $
+# $NetBSD: configure.ac,v 1.41 2019/01/29 13:06:14 lukem Exp $
 #
 # Process this file with autoconf to produce a configure script.
 
@@ -9,7 +9,7 @@ AC_COPYRIGHT([
 Copyright (c) 2001-2019 The NetBSD Foundation, Inc.
 All rights reserved.
 ])
-AC_REVISION([$Revision: 1.40 $])
+AC_REVISION([$Revision: 1.41 $])
 
 AS_SHELL_SANITIZE()
 
@@ -274,7 +274,7 @@ AC_FUNC_CLOSEDIR_VOID()
 AC_FUNC_FORK()
 AC_FUNC_FSEEKO()
 AC_FUNC_STRCOLL()
-AC_REPLACE_FUNCS([daemon err fgetln fparseln \
+AC_REPLACE_FUNCS([daemon err explicit_memset fgetln fparseln \
                   getaddrinfo getgrouplist getnameinfo getusershell \
                   inet_net_pton inet_ntop inet_pton mkstemp \
                   sl_init snprintf strdup strerror strsuftollx \

Index: othersrc/libexec/tnftpd/tnftpd.h
diff -u othersrc/libexec/tnftpd/tnftpd.h:1.36 othersrc/libexec/tnftpd/tnftpd.h:1.37
--- othersrc/libexec/tnftpd/tnftpd.h:1.36	Wed Jan 23 07:00:21 2019
+++ othersrc/libexec/tnftpd/tnftpd.h	Tue Jan 29 13:06:14 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: tnftpd.h,v 1.36 2019/01/23 07:00:21 lukem Exp $ */
+/* $NetBSD: tnftpd.h,v 1.37 2019/01/29 13:06:14 lukem Exp $ */
 
 #define	FTPD_VERSION	PACKAGE_STRING
 
@@ -420,6 +420,10 @@ void	warn(const char *, ...);
 void	warnx(const char *, ...);
 #endif
 
+#if !defined(HAVE_EXPLICIT_MEMSET)
+void	*explicit_memset(void *, int, size_t);
+#endif
+
 #if !defined(HAVE_FGETLN)
 char	*fgetln(FILE *, size_t *);
 #endif

Added files:

Index: othersrc/libexec/tnftpd/libnetbsd/explicit_memset.c
diff -u /dev/null othersrc/libexec/tnftpd/libnetbsd/explicit_memset.c:1.1
--- /dev/null	Tue Jan 29 13:06:14 2019
+++ othersrc/libexec/tnftpd/libnetbsd/explicit_memset.c	Tue Jan 29 13:06:14 2019
@@ -0,0 +1,37 @@
+/* $NetBSD: explicit_memset.c,v 1.1 2019/01/29 13:06:14 lukem Exp $ */
+/* from	NetBSD: explicit_memset.c,v 1.4 2014/06/24 16:39:39 drochner Exp */
+
+/*
+ * Written by Matthias Drochner <droch...@netbsd.org>.
+ * Public domain.
+ */
+
+#include "tnftpd.h"
+
+#if 0
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include "namespace.h"
+#include <string.h>
+#ifdef __weak_alias
+__weak_alias(explicit_memset,_explicit_memset)
+#endif
+#define explicit_memset_impl __explicit_memset_impl
+#else
+#include <lib/libkern/libkern.h>
+#endif
+
+#endif
+
+/*
+ * The use of a volatile pointer guarantees that the compiler
+ * will not optimise the call away.
+ */
+void *(* volatile explicit_memset_impl)(void *, int, size_t) = memset;
+
+void *
+explicit_memset(void *b, int c, size_t len)
+{
+
+	return (*explicit_memset_impl)(b, c, len);
+}

Reply via email to