Skip to content

Commit

Permalink
MFH
Browse files Browse the repository at this point in the history
Sponsored by:	The FreeBSD Foundation
  • Loading branch information
Glen Barber authored and Glen Barber committed Mar 7, 2016
2 parents b655ec9 + 737d4f6 commit 7e2d468
Show file tree
Hide file tree
Showing 58 changed files with 984 additions and 746 deletions.
2 changes: 2 additions & 0 deletions ObsoleteFiles.inc
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ OLD_FILES+=usr/lib/clang/3.7.1/include/xopintrin.h
OLD_FILES+=usr/lib/clang/3.7.1/include/xtestintrin.h
OLD_DIRS+=usr/lib/clang/3.7.1/include
OLD_FILES+=usr/lib/clang/3.7.1/lib/freebsd/libclang_rt.asan-i386.a
OLD_FILES+=usr/lib/clang/3.7.1/lib/freebsd/libclang_rt.asan-preinit-i386.a
OLD_FILES+=usr/lib/clang/3.7.1/lib/freebsd/libclang_rt.asan-preinit-x86_64.a
OLD_FILES+=usr/lib/clang/3.7.1/lib/freebsd/libclang_rt.asan-x86_64.a
OLD_FILES+=usr/lib/clang/3.7.1/lib/freebsd/libclang_rt.asan_cxx-i386.a
OLD_FILES+=usr/lib/clang/3.7.1/lib/freebsd/libclang_rt.asan_cxx-x86_64.a
Expand Down
14 changes: 14 additions & 0 deletions UPDATING
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)

20160306:
On amd64, clang 3.8.0 can now insert sections of type AMD64_UNWIND into
kernel modules. Therefore, if you load any kernel modules at boot time,
please install the boot loaders after you install the kernel, but before
rebooting, e.g.:

make buildworld
make kernel KERNCONF=YOUR_KERNEL_HERE
make -C sys/boot install
<reboot in single user>

Then follow the usual steps, described in the General Notes section,
below.

20160305:
Clang, llvm, lldb and compiler-rt have been upgraded to 3.8.0. Please
see the 20141231 entry below for information about prerequisites and
Expand Down
3 changes: 1 addition & 2 deletions bin/sh/expand.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ expbackq(union node *cmd, int quoted, int flag, struct worddest *dst)
argbackq = saveargbackq;

p = in.buf;
lastc = '\0';
nnl = 0;
if (!quoted && flag & EXP_SPLIT)
ifs = ifsset() ? ifsval() : " \t\n";
Expand Down Expand Up @@ -1288,7 +1287,7 @@ patmatch(const char *pattern, const char *string)
if (wc == 0)
goto backtrack;
} else
wc = (unsigned char)*q++;
q++;
break;
case '*':
c = *p;
Expand Down
2 changes: 1 addition & 1 deletion bin/sh/histedit.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ histcmd(int argc, char **argv __unused)
* cursor, set it back to the current
* entry.
*/
retval = history(hist, &he,
history(hist, &he,
H_NEXT_EVENT, oldhistnum);
}
} else
Expand Down
6 changes: 5 additions & 1 deletion lib/libc/db/db/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,18 @@ __FBSDID("$FreeBSD$");

static int __dberr(void);

#ifndef O_CLOEXEC
#define O_CLOEXEC 0
#endif

DB *
dbopen(const char *fname, int flags, int mode, DBTYPE type, const void *openinfo)
{

#define DB_FLAGS (DB_LOCK | DB_SHMEM | DB_TXN)
#define USE_OPEN_FLAGS \
(O_CREAT | O_EXCL | O_EXLOCK | O_NOFOLLOW | O_NONBLOCK | \
O_RDONLY | O_RDWR | O_SHLOCK | O_SYNC | O_TRUNC)
O_RDONLY | O_RDWR | O_SHLOCK | O_SYNC | O_TRUNC | O_CLOEXEC)

if ((flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0)
switch (type) {
Expand Down
1 change: 1 addition & 0 deletions lib/libc/tests/string/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PACKAGE= tests
FILESGROUPS= TESTS
TESTSPACKAGE= ${PACKAGE}

ATF_TESTS_C+= memcmp_test
ATF_TESTS_C+= stpncpy_test
ATF_TESTS_C+= strerror2_test
ATF_TESTS_C+= wcscasecmp_test
Expand Down
124 changes: 124 additions & 0 deletions lib/libc/tests/string/memcmp_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/*-
* Copyright (c) 2016 Jilles Tjoelker <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <atf-c.h>

ATF_TC_WITHOUT_HEAD(zero);
ATF_TC_BODY(zero, tc)
{

assert(memcmp("a", "b", 0) == 0);
assert(memcmp("", "", 0) == 0);
}

ATF_TC_WITHOUT_HEAD(eq);
ATF_TC_BODY(eq, tc)
{
unsigned char data1[256], data2[256];
int i;

for (i = 0; i < 256; i++)
data1[i] = data2[i] = i ^ 0x55;
for (i = 1; i < 256; i++)
assert(memcmp(data1, data2, i) == 0);
for (i = 1; i < 256; i++)
assert(memcmp(data1 + i, data2 + i, 256 - i) == 0);
}

ATF_TC_WITHOUT_HEAD(neq);
ATF_TC_BODY(neq, tc)
{
unsigned char data1[256], data2[256];
int i;

for (i = 0; i < 256; i++) {
data1[i] = i;
data2[i] = i ^ 0x55;
}
for (i = 1; i < 256; i++)
assert(memcmp(data1, data2, i) != 0);
for (i = 1; i < 256; i++)
assert(memcmp(data1 + i, data2 + i, 256 - i) != 0);
}

ATF_TC_WITHOUT_HEAD(diff);
ATF_TC_BODY(diff, tc)
{
unsigned char data1[256], data2[256];
int i;

memset(data1, 'a', sizeof(data1));
memset(data2, 'a', sizeof(data2));
data1[128] = 255;
data2[128] = 0;
for (i = 1; i < 66; i++) {
assert(memcmp(data1 + 128, data2 + 128, i) == 255);
assert(memcmp(data2 + 128, data1 + 128, i) == -255);
assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == 255);
assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == -255);
assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == 255);
assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == -255);
}
data1[128] = 'c';
data2[128] = 'e';
for (i = 1; i < 66; i++) {
assert(memcmp(data1 + 128, data2 + 128, i) == -2);
assert(memcmp(data2 + 128, data1 + 128, i) == 2);
assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == -2);
assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == 2);
assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == -2);
assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == 2);
}
memset(data1 + 129, 'A', sizeof(data1) - 129);
memset(data2 + 129, 'Z', sizeof(data2) - 129);
for (i = 1; i < 66; i++) {
assert(memcmp(data1 + 128, data2 + 128, i) == -2);
assert(memcmp(data2 + 128, data1 + 128, i) == 2);
assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == -2);
assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == 2);
assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == -2);
assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == 2);
}
}

ATF_TP_ADD_TCS(tp)
{

ATF_TP_ADD_TC(tp, zero);
ATF_TP_ADD_TC(tp, eq);
ATF_TP_ADD_TC(tp, neq);
ATF_TP_ADD_TC(tp, diff);

return (atf_no_error());
}
5 changes: 3 additions & 2 deletions lib/libedit/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.55 2016/02/24 14:25:38 christos Exp $
# $NetBSD: Makefile,v 1.37 2009/01/18 12:17:49 lukem Exp $
# @(#)Makefile 8.1 (Berkeley) 6/4/93
# $FreeBSD$

Expand All @@ -7,7 +7,7 @@ LIB= edit
SHLIB_MAJOR= 7
SHLIBDIR?= /lib

OSRCS= chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \
OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \
hist.c keymacro.c map.c chartype.c \
parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c

Expand Down Expand Up @@ -35,6 +35,7 @@ CLEANFILES+= common.h editline.c emacs.h fcns.c fcns.h help.c help.h vi.h

INCS= histedit.h

OSRCS+= eln.c
SRCS+= tokenizern.c historyn.c
CLEANFILES+= tokenizern.c historyn.c
CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/edit -DWIDECHAR
Expand Down
16 changes: 8 additions & 8 deletions lib/libedit/TEST/tc1.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $NetBSD: tc1.c,v 1.7 2016/02/17 19:47:49 christos Exp $ */
/* $NetBSD: tc1.c,v 1.6 2014/06/18 20:12:15 christos Exp $ */

/*-
* Copyright (c) 1992, 1993
Expand Down Expand Up @@ -42,23 +42,23 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
#if 0
static char sccsid[] = "@(#)test.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: tc1.c,v 1.7 2016/02/17 19:47:49 christos Exp $");
__RCSID("$NetBSD: tc1.c,v 1.6 2014/06/18 20:12:15 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
__FBSDID("$FreeBSD$");

/*
* test.c: A little test program
*/
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <sys/wait.h>
#include <ctype.h>
#include <dirent.h>
#include <locale.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dirent.h>
#include <locale.h>

#include "histedit.h"

Expand Down Expand Up @@ -158,7 +158,7 @@ main(int argc, char *argv[])
/* Add a user-defined function */
el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete);

/* Bind tab to it */
/* Bind tab to it */
el_set(el, EL_BIND, "^I", "ed-complete", NULL);

/*
Expand Down
9 changes: 3 additions & 6 deletions lib/libedit/TEST/wtc1.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <signal.h>
#include <sys/wait.h>
#include <err.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <dirent.h>
#include <err.h>
#include <limits.h>
#include <locale.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "../histedit.h"

Expand Down
Loading

0 comments on commit 7e2d468

Please sign in to comment.