Commit 286d4785 authored by Peter Pentchev's avatar Peter Pentchev
Browse files

Update upstream source from tag 'upstream/20200505+ds1'

Update to upstream version '20200505+ds1'
with Debian dir 484f3ef1981d1e1efc81bf1064836d67a0a5c2f5
parents 6ec1e190 4379e474
2020505:
- configure fix for some powerpc toolchains
- update config.sub and config.guess
- added option to perform direct I/Os on temporary file
20191016:
- autoadjust dependent parameters
- human readable buffer size information instead of kiB
......
......@@ -31,6 +31,10 @@
#include <time.h>
#include <unistd.h>
#if __STDC_VERSION__ < 199901L
#define restrict
#endif
#ifdef __sun
#if defined(__SunOS_5_8) || defined(__SunOS_5_9)
int SemWait(sema_t *s)
......
This diff is collapsed.
......@@ -67,6 +67,9 @@
/* seteuid ? */
#undef HAVE_SETEUID
/* mkostemp */
#undef HAVE_MKOSTEMP
/* alloca in alloca.h */
#undef HAVE_ALLOCA_H
......
This diff is collapsed.
This diff is collapsed.
......@@ -17,13 +17,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
AC_INIT([mbuffer],[20191016])
AC_INIT([mbuffer],[20200505])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_SRCDIR([mbuffer.c])
AC_LANG([C])
AC_CANONICAL_SYSTEM
AC_EXEEXT
AC_USE_SYSTEM_EXTENSIONS
if test "${LD_LIBRARY_PATH}" != "" ; then
echo ""
......@@ -43,8 +44,7 @@ test "$exec_prefix" = NONE && exec_prefix=$prefix
USRCFLAGS=${CFLAGS}
AC_LANG_C
AC_PROG_CC_C99
AC_PROG_CC(cc gcc)
AC_PROG_CC_C99(cc gcc)
AC_C_RESTRICT
AC_C_INLINE
......@@ -131,6 +131,7 @@ AC_SEARCH_LIBS(gethostbyname,nsl,,AC_MSG_ERROR(could not find the library contai
AC_SEARCH_LIBS(sendfile,sendfile,AC_DEFINE([HAVE_SENDFILE],[1],[libsendfile is available]),)
AC_CHECK_HEADER(sys/sendfile.h,AC_DEFINE([HAVE_SENDFILE_H],[1],[sendfile in sendfile.h]),)
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(mkostemp)
AC_ARG_ENABLE(debug,
......
/*
* Copyright (C) 2000-2017, Thomas Maier-Komor
* Copyright (C) 2000-2020, Thomas Maier-Komor
*
* This file is part of mbuffer's source code.
*
......@@ -20,7 +20,7 @@
#include "dest.h"
#include "globals.h"
#include <fcntl.h>
#include <sys/time.h>
#include <time.h>
dest_t *Dest = 0;
......
......@@ -447,12 +447,22 @@ void initBuffer()
(void) memcpy(Tmpfile,tmpdir,tl);
Tmpfile[tl] = '/';
(void) strncpy(Tmpfile+tl+1,tmplname,sizeof(tmplname));
Tmp = mkstemp(Tmpfile);
infomsg("tmpfile is %s\n",Tmpfile);
#ifdef HAVE_MKOSTEMP
Tmp = mkostemp(Tmpfile,(Tmp == -2) ? O_DIRECT : 0);
#else
int tmp = mkstemp(Tmpfile);
if ((tmp != -1) && (Tmp == -2) && (-1 == fcntl(tmp,F_SETFL, O_DIRECT)))
warningmsg("error setting tempfile %s to O_DIRECT: %s\n",Tmpfile,strerror(errno));
Tmp = tmp;
#endif
if (Tmp >= 0)
infomsg("tmpfile is %s\n",Tmpfile);
} else {
mode_t mode = O_RDWR | O_LARGEFILE;
if (strncmp(Tmpfile,"/dev/",5))
mode |= O_CREAT|O_EXCL;
if (Tmp == -2)
mode |= O_DIRECT;
Tmp = open(Tmpfile,mode,0600);
}
if (-1 == Tmp)
......@@ -597,6 +607,7 @@ static void usage(void)
"--tcpbuffer: size for TCP buffer\n"
"--tapeaware: write to end of tape instead of stopping when the drive signals\n"
" the media end is approaching (write until 2x ENOSPC errors)\n"
"--direct : use direct I/O for temporary file buffer\n"
"-V\n"
"--version : print version information\n"
"Unsupported buffer options: -t -Z -B\n"
......@@ -902,7 +913,10 @@ int parseOption(int c, int argc, const char **argv)
infomsg("started watchdog with Timeout = %lu sec.\n",Timeout);
Watchdog = 1;
} else if (!strcmp("--direct",argv[c])) {
warningmsg("Option --direct is deprecated. O_DIRECT is used automatically, if possible.\n");
if (Tmp >= 0)
enable_directio(Tmp,Tmpfile);
else if (Tmp == -1)
Tmp = -2;
} else if (!strcmp("--help",argv[c]) || !strcmp("-h",argv[c])) {
usage();
} else if (!strcmp("--version",argv[c]) || !strcmp("-V",argv[c])) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment