Skip to content

Commit b8b951e

Browse files
committed
Merge branches 'kernel-src' and 'user-src' into appstack-src
3 parents f08dfa4 + c50bbe0 + 4289ab8 commit b8b951e

File tree

1,392 files changed

+61291
-48096
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,392 files changed

+61291
-48096
lines changed

bin/cat/cat.c

+10-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: cat.c,v 1.55 2015/07/25 16:17:01 sevan Exp $ */
1+
/* $NetBSD: cat.c,v 1.57 2016/06/16 00:52:37 sevan Exp $ */
22

33
/*
44
* Copyright (c) 1989, 1993
@@ -44,7 +44,7 @@ __COPYRIGHT(
4444
#if 0
4545
static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95";
4646
#else
47-
__RCSID("$NetBSD: cat.c,v 1.55 2015/07/25 16:17:01 sevan Exp $");
47+
__RCSID("$NetBSD: cat.c,v 1.57 2016/06/16 00:52:37 sevan Exp $");
4848
#endif
4949
#endif /* not lint */
5050

@@ -113,6 +113,7 @@ main(int argc, char *argv[])
113113
vflag = 1;
114114
break;
115115
default:
116+
case '?':
116117
(void)fprintf(stderr,
117118
"Usage: %s [-beflnstuv] [-B bsize] [-] "
118119
"[file ...]\n", getprogname());
@@ -174,18 +175,16 @@ cook_buf(FILE *fp)
174175
line = gobble = 0;
175176
for (prev = '\n'; (ch = getc(fp)) != EOF; prev = ch) {
176177
if (prev == '\n') {
177-
if (ch == '\n') {
178-
if (sflag) {
179-
if (!gobble && nflag && !bflag)
180-
(void)fprintf(stdout,
181-
"%6d\t\n", ++line);
182-
else if (!gobble && putchar(ch) == EOF)
183-
break;
178+
if (sflag) {
179+
if (ch == '\n') {
180+
if (gobble)
181+
continue;
184182
gobble = 1;
185-
continue;
183+
} else
184+
gobble = 0;
186185
}
187186
if (nflag) {
188-
if (!bflag) {
187+
if (!bflag || ch != '\n') {
189188
(void)fprintf(stdout,
190189
"%6d\t", ++line);
191190
if (ferror(stdout))
@@ -197,13 +196,7 @@ cook_buf(FILE *fp)
197196
break;
198197
}
199198
}
200-
} else if (nflag) {
201-
(void)fprintf(stdout, "%6d\t", ++line);
202-
if (ferror(stdout))
203-
break;
204199
}
205-
}
206-
gobble = 0;
207200
if (ch == '\n') {
208201
if (eflag)
209202
if (putchar('$') == EOF)

bin/ls/ls.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: ls.c,v 1.74 2014/04/02 10:55:47 wiz Exp $ */
1+
/* $NetBSD: ls.c,v 1.75 2016/05/30 17:26:29 dholland Exp $ */
22

33
/*
44
* Copyright (c) 1989, 1993, 1994
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\
4242
#if 0
4343
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
4444
#else
45-
__RCSID("$NetBSD: ls.c,v 1.74 2014/04/02 10:55:47 wiz Exp $");
45+
__RCSID("$NetBSD: ls.c,v 1.75 2016/05/30 17:26:29 dholland Exp $");
4646
#endif
4747
#endif /* not lint */
4848

@@ -631,7 +631,7 @@ display(FTSENT *p, FTSENT *list)
631631
if (f_humanize) {
632632
d.s_block = 4; /* min buf length for humanize_number */
633633
} else {
634-
(void)snprintf(buf, sizeof(buf), "%llu",
634+
(void)snprintf(buf, sizeof(buf), "%lld",
635635
(long long)howmany(maxblock, blocksize));
636636
d.s_block = strlen(buf);
637637
if (f_commas) /* allow for commas before every third digit */
@@ -647,17 +647,17 @@ display(FTSENT *p, FTSENT *list)
647647
if (f_humanize) {
648648
d.s_size = 4; /* min buf length for humanize_number */
649649
} else {
650-
(void)snprintf(buf, sizeof(buf), "%llu",
650+
(void)snprintf(buf, sizeof(buf), "%lld",
651651
(long long)maxsize);
652652
d.s_size = strlen(buf);
653653
if (f_commas) /* allow for commas before every third digit */
654654
d.s_size += (d.s_size - 1) / 3;
655655
}
656656
d.s_user = maxuser;
657657
if (bcfile) {
658-
(void)snprintf(buf, sizeof(buf), "%u", maxmajor);
658+
(void)snprintf(buf, sizeof(buf), "%d", maxmajor);
659659
d.s_major = strlen(buf);
660-
(void)snprintf(buf, sizeof(buf), "%u", maxminor);
660+
(void)snprintf(buf, sizeof(buf), "%d", maxminor);
661661
d.s_minor = strlen(buf);
662662
if (d.s_major + d.s_minor + 2 > d.s_size)
663663
d.s_size = d.s_major + d.s_minor + 2;

bin/pax/ar_io.c

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: ar_io.c,v 1.56 2015/03/09 23:38:08 sevan Exp $ */
1+
/* $NetBSD: ar_io.c,v 1.57 2016/05/31 03:32:36 dholland Exp $ */
22

33
/*-
44
* Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
4242
#if 0
4343
static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
4444
#else
45-
__RCSID("$NetBSD: ar_io.c,v 1.56 2015/03/09 23:38:08 sevan Exp $");
45+
__RCSID("$NetBSD: ar_io.c,v 1.57 2016/05/31 03:32:36 dholland Exp $");
4646
#endif
4747
#endif /* not lint */
4848

@@ -1631,7 +1631,6 @@ void
16311631
ar_summary(int n)
16321632
{
16331633
time_t secs;
1634-
int len;
16351634
char buf[BUFSIZ];
16361635
char tbuf[MAXPATHLEN/4]; /* XXX silly size! */
16371636
char s1buf[MAXPATHLEN/8]; /* XXX very silly size! */
@@ -1657,33 +1656,32 @@ ar_summary(int n)
16571656
* could have written anything yet.
16581657
*/
16591658
if (frmt == NULL && act != COPY) {
1660-
len = snprintf(buf, sizeof(buf),
1659+
snprintf(buf, sizeof(buf),
16611660
"unknown format, %s skipped in %s\n",
16621661
sizefmt(s1buf, sizeof(s1buf), rdcnt),
16631662
timefmt(tbuf, sizeof(tbuf), rdcnt, secs, "bytes"));
16641663
if (n == 0)
16651664
(void)fprintf(outf, "%s: %s", argv0, buf);
16661665
else
1667-
(void)write(STDERR_FILENO, buf, len);
1666+
(void)write(STDERR_FILENO, buf, strlen(buf));
16681667
return;
16691668
}
16701669

16711670

16721671
if (n != 0 && *archd.name) {
1673-
len = snprintf(buf, sizeof(buf), "Working on `%s' (%s)\n",
1672+
snprintf(buf, sizeof(buf), "Working on `%s' (%s)\n",
16741673
archd.name, sizefmt(s1buf, sizeof(s1buf), archd.sb.st_size));
1675-
(void)write(STDERR_FILENO, buf, len);
1676-
len = 0;
1674+
(void)write(STDERR_FILENO, buf, strlen(buf));
16771675
}
16781676

16791677

16801678
if (act == COPY) {
1681-
len = snprintf(buf, sizeof(buf),
1679+
snprintf(buf, sizeof(buf),
16821680
"%lu files in %s\n",
16831681
(unsigned long)flcnt,
16841682
timefmt(tbuf, sizeof(tbuf), flcnt, secs, "files"));
16851683
} else {
1686-
len = snprintf(buf, sizeof(buf),
1684+
snprintf(buf, sizeof(buf),
16871685
"%s vol %d, %lu files, %s read, %s written in %s\n",
16881686
frmt->name, arvol-1, (unsigned long)flcnt,
16891687
sizefmt(s1buf, sizeof(s1buf), rdcnt),

bin/pax/dumptar.c

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: dumptar.c,v 1.2 2008/04/28 20:22:51 martin Exp $ */
1+
/* $NetBSD: dumptar.c,v 1.3 2016/05/30 17:34:35 dholland Exp $ */
22

33
/*-
44
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,29 +30,38 @@
3030
*/
3131

3232
#include <stdio.h>
33-
#include <err.h>
33+
#include <string.h>
34+
#include <stdlib.h>
35+
#include <unistd.h>
3436
#include <fcntl.h>
37+
#include <err.h>
38+
#include <assert.h>
3539
#include <sys/stat.h>
3640
#include <sys/mman.h>
3741

3842
#include "tar.h"
3943

4044
#define ussum(a) 1
4145

46+
/*
47+
* Ensure null termination.
48+
*/
4249
static char *
4350
buf(const char *p, size_t s)
4451
{
4552
static char buf[1024];
46-
(void)snprintf(buf, sizeof(buf), "%s", p);
53+
54+
assert(s < sizeof(buf));
55+
memcpy(buf, p, s);
4756
buf[s] = '\0';
4857
return buf;
4958
}
5059

51-
int
60+
static int
5261
intarg(const char *p, size_t s)
5362
{
5463
char *ep, *b = buf(p, s);
55-
int r = (int)strtol(p, &ep, 8);
64+
int r = (int)strtol(b, &ep, 8);
5665
return r;
5766
}
5867

build.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /usr/bin/env sh
2-
# $NetBSD: build.sh,v 1.309 2016/04/29 16:08:09 christos Exp $
2+
# $NetBSD: build.sh,v 1.310 2016/06/03 00:00:01 kre Exp $
33
#
44
# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
55
# All rights reserved.
@@ -506,7 +506,7 @@ initdefaults()
506506
# XXX Except that doesn't work on Solaris. Or many Linuces.
507507
#
508508
unset PWD
509-
TOP=$(/bin/pwd -P 2>/dev/null || /bin/pwd 2>/dev/null)
509+
TOP=$( (exec pwd -P 2>/dev/null) || (exec pwd 2>/dev/null) )
510510

511511
# The user can set HOST_SH in the environment, or we try to
512512
# guess an appropriate value. Then we set several other
@@ -1876,7 +1876,7 @@ createmakewrapper()
18761876
eval cat <<EOF ${makewrapout}
18771877
#! ${HOST_SH}
18781878
# Set proper variables to allow easy "make" building of a NetBSD subtree.
1879-
# Generated from: \$NetBSD: build.sh,v 1.309 2016/04/29 16:08:09 christos Exp $
1879+
# Generated from: \$NetBSD: build.sh,v 1.310 2016/06/03 00:00:01 kre Exp $
18801880
# with these arguments: ${_args}
18811881
#
18821882

common/include/prop/prop_array.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: prop_array.h,v 1.13 2011/09/30 22:08:18 jym Exp $ */
1+
/* $NetBSD: prop_array.h,v 1.14 2016/05/31 09:29:25 pgoyette Exp $ */
22

33
/*-
44
* Copyright (c) 2006, 2009 The NetBSD Foundation, Inc.
@@ -144,11 +144,13 @@ bool prop_array_add_uint32(prop_array_t, uint32_t);
144144
bool prop_array_add_int64(prop_array_t, int64_t);
145145
bool prop_array_add_uint64(prop_array_t, uint64_t);
146146

147+
bool prop_array_add_cstring(prop_array_t, const char *);
147148
bool prop_array_get_cstring(prop_array_t, unsigned int,
148149
char **);
149150
bool prop_array_set_cstring(prop_array_t, unsigned int,
150151
const char *);
151152

153+
bool prop_array_add_cstring_nocopy(prop_array_t, const char *);
152154
bool prop_array_get_cstring_nocopy(prop_array_t,
153155
unsigned int,
154156
const char **);

common/lib/libc/arch/sparc/atomic/Makefile.inc

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# $NetBSD: Makefile.inc,v 1.21 2016/02/27 19:19:33 joerg Exp $
1+
# $NetBSD: Makefile.inc,v 1.22 2016/05/29 05:10:34 nakayama Exp $
22

33
.include <bsd.own.mk>
44

55
# This is called with MACHINE=sparc64 && MACHINE_ARCH=sparc when building
66
# 32 bit kernels for ultrasparc hardware
7-
.if ${MACHINE} == "sparc64" && ${HAVE_LLVM:Uno} == "no"
7+
.if ${MACHINE} == "sparc64" && \
8+
(${HAVE_LLVM:Uno} == "no" || (defined(LIB) && ${LIB} == "kern"))
89

910
SPARC64DIR= ${.PARSEDIR}/../../sparc64/atomic
1011
.PATH.c: ${SPARC64DIR}

common/lib/libprop/Makefile.inc

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
# $NetBSD: Makefile.inc,v 1.9 2012/07/27 09:10:59 pooka Exp $
1+
# $NetBSD: Makefile.inc,v 1.10 2016/06/28 05:18:11 pgoyette Exp $
22

33
.PATH: ${.PARSEDIR}
44

55
SRCS+= prop_array.c prop_array_util.c prop_bool.c prop_data.c \
66
prop_dictionary.c prop_dictionary_util.c prop_ingest.c \
77
prop_kern.c prop_number.c prop_object.c prop_stack.c prop_string.c
8-
9-
.ifdef (PROPLIB_WANT_RB)
10-
SRCS+= prop_rb.c
11-
.endif

common/lib/libprop/prop_array_util.3

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" $NetBSD: prop_array_util.3,v 1.7 2011/10/17 09:24:54 wiz Exp $
1+
.\" $NetBSD: prop_array_util.3,v 1.9 2016/05/31 09:31:13 wiz Exp $
22
.\"
33
.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
44
.\" All rights reserved.
@@ -27,7 +27,7 @@
2727
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2828
.\" POSSIBILITY OF SUCH DAMAGE.
2929
.\"
30-
.Dd March 12, 2011
30+
.Dd May 31, 2016
3131
.Dt PROP_ARRAY_UTIL 3
3232
.Os
3333
.Sh NAME
@@ -58,8 +58,10 @@
5858
.Nm prop_array_add_uint32 ,
5959
.Nm prop_array_add_int64 ,
6060
.Nm prop_array_add_uint64 ,
61+
.Nm prop_array_add_cstring ,
6162
.Nm prop_array_get_cstring ,
6263
.Nm prop_array_set_cstring ,
64+
.Nm prop_array_add_cstring_nocopy ,
6365
.Nm prop_array_get_cstring_nocopy ,
6466
.Nm prop_array_set_cstring_nocopy ,
6567
.Nm prop_array_add_and_rel
@@ -153,13 +155,17 @@
153155
.Fn prop_array_add_uint64 "prop_array_t dict" "uint64_t val"
154156
.\"
155157
.Ft bool
158+
.Fn prop_array_add_cstring "prop_array_t dict" "const char *cp"
159+
.Ft bool
156160
.Fn prop_array_get_cstring "prop_array_t dict" "unsigned int indx" \
157161
"char **strp"
158162
.Ft bool
159163
.Fn prop_array_set_cstring "prop_array_t dict" "unsigned int indx" \
160164
"const char *str"
161165
.\"
162166
.Ft bool
167+
.Fn prop_array_add_cstring_nocopy "prop_array_t dict" "const char *cp"
168+
.Ft bool
163169
.Fn prop_array_get_cstring_nocopy "prop_array_t dict" \
164170
"unsigned int indx" "const char **strp"
165171
.Ft bool
@@ -181,14 +187,17 @@ value type.
181187
The setters handle object creation and release for the caller.
182188
.Pp
183189
The
190+
.Fn prop_array_add_cstring
191+
and
184192
.Fn prop_array_get_cstring
185-
function returns dynamically allocated memory.
193+
functions returns dynamically allocated memory.
186194
See
187195
.Xr prop_string 3
188196
for more information.
189197
.Pp
190198
The
191-
.Fn prop_array_get_cstring_nocopy
199+
.Fn prop_array_add_cstring_nocopy ,
200+
.Fn prop_array_get_cstring_nocopy ,
192201
and
193202
.Fn prop_array_set_cstring_nocopy
194203
functions do not copy the string that is set or returned.

common/lib/libprop/prop_array_util.c

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: prop_array_util.c,v 1.4 2012/07/27 09:10:59 pooka Exp $ */
1+
/* $NetBSD: prop_array_util.c,v 1.5 2016/05/31 09:29:25 pgoyette Exp $ */
22

33
/*-
44
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -201,6 +201,21 @@ TEMPLATE(64)
201201
#undef TEMPLATE
202202

203203
#define TEMPLATE(variant, qualifier) \
204+
bool \
205+
prop_array_add_cstring ## variant (prop_array_t array, \
206+
const char *cp) \
207+
{ \
208+
prop_string_t str; \
209+
bool rv; \
210+
\
211+
str = prop_string_create_cstring ## variant (cp); \
212+
if (str == NULL) \
213+
return false; \
214+
rv = prop_array_add(array, str); \
215+
prop_object_release(str); \
216+
return rv; \
217+
} \
218+
\
204219
bool \
205220
prop_array_get_cstring ## variant (prop_array_t array, \
206221
unsigned int indx, \

0 commit comments

Comments
 (0)