summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile2
-rw-r--r--lib/atf/Makefile2
-rw-r--r--lib/atf/libatf-c++/Makefile1
-rw-r--r--lib/atf/libatf-c/Makefile1
-rw-r--r--lib/clang/Makefile2
-rw-r--r--lib/clang/clang.build.mk2
-rw-r--r--lib/clang/libllvmanalysis/Makefile2
-rw-r--r--lib/clang/libllvmipa/Makefile2
-rw-r--r--lib/clang/libllvmipo/Makefile2
-rw-r--r--lib/clang/libllvmmc/Makefile2
-rw-r--r--lib/clang/libllvmscalaropts/Makefile2
-rw-r--r--lib/clang/libllvmsupport/Makefile2
-rw-r--r--lib/clang/libllvmtransformutils/Makefile2
-rw-r--r--lib/clang/libllvmx86disassembler/Makefile2
-rw-r--r--lib/libarchive/Makefile2
-rw-r--r--lib/libbsnmp/libbsnmp/Makefile2
-rw-r--r--lib/libc/Makefile2
-rw-r--r--lib/libc/arm/gen/fpsetmask_vfp.c2
-rw-r--r--lib/libc/locale/utf8.c7
-rw-r--r--lib/libc/regex/engine.c7
-rw-r--r--lib/libc/regex/regcomp.c1
-rw-r--r--lib/libc/rpc/clnt_vc.c14
-rw-r--r--lib/libc/sys/msync.212
-rw-r--r--lib/libc_nonshared/Makefile2
-rw-r--r--lib/libcapsicum/libcapsicum_dns.c1
-rw-r--r--lib/libcompiler_rt/Makefile2
-rw-r--r--lib/libcrypt/Makefile2
-rw-r--r--lib/libfetch/Makefile2
-rw-r--r--lib/libipsec/Makefile2
-rw-r--r--lib/libkiconv/Makefile2
-rw-r--r--lib/libmagic/Makefile2
-rw-r--r--lib/libmilter/Makefile2
-rw-r--r--lib/libpam/modules/modules.inc2
-rw-r--r--lib/libpam/modules/pam_unix/Makefile1
-rw-r--r--lib/libpcap/Makefile2
-rw-r--r--lib/libproc/Makefile2
-rw-r--r--lib/libproc/_libproc.h2
-rw-r--r--lib/libproc/libproc.h1
-rw-r--r--lib/libproc/proc_bkpt.c29
-rw-r--r--lib/libproc/proc_create.c52
-rw-r--r--lib/libproc/proc_rtld.c3
-rw-r--r--lib/libproc/proc_sym.c25
-rw-r--r--lib/libproc/proc_util.c24
-rw-r--r--lib/libprocstat/Makefile2
-rw-r--r--lib/libradius/Makefile2
-rw-r--r--lib/librpcsvc/Makefile2
-rw-r--r--lib/librtld_db/librtld_db.36
-rw-r--r--lib/librtld_db/rtld_db.c46
-rw-r--r--lib/librtld_db/rtld_db.h4
-rw-r--r--lib/libsm/Makefile2
-rw-r--r--lib/libsmb/Makefile2
-rw-r--r--lib/libstand/Makefile2
-rw-r--r--lib/libtelnet/Makefile2
-rw-r--r--lib/libthr/Makefile2
-rw-r--r--lib/libulog/Makefile2
-rw-r--r--lib/libutil/Makefile2
-rw-r--r--lib/libutil/kinfo_getfile.32
-rw-r--r--lib/libvmmapi/vmmapi.c7
-rw-r--r--lib/libvmmapi/vmmapi.h2
-rw-r--r--lib/libwrap/Makefile2
-rw-r--r--lib/ncurses/Makefile2
-rw-r--r--lib/ncurses/ncurses/Makefile2
62 files changed, 209 insertions, 119 deletions
diff --git a/lib/Makefile b/lib/Makefile
index fe99085..de87cba 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,7 +1,7 @@
# @(#)Makefile 8.1 (Berkeley) 6/4/93
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
# To satisfy shared library or ELF linkage when only the libraries being
# built are visible:
diff --git a/lib/atf/Makefile b/lib/atf/Makefile
index a191f0d..0772065 100644
--- a/lib/atf/Makefile
+++ b/lib/atf/Makefile
@@ -25,7 +25,7 @@
#
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
SUBDIR= libatf-c \
libatf-c++ \
diff --git a/lib/atf/libatf-c++/Makefile b/lib/atf/libatf-c++/Makefile
index d52e496..84477f7 100644
--- a/lib/atf/libatf-c++/Makefile
+++ b/lib/atf/libatf-c++/Makefile
@@ -25,6 +25,7 @@
#
# $FreeBSD$
+.include <src.opts.mk>
.include <bsd.init.mk>
LIB= atf-c++
diff --git a/lib/atf/libatf-c/Makefile b/lib/atf/libatf-c/Makefile
index 69c4611..5c607f7 100644
--- a/lib/atf/libatf-c/Makefile
+++ b/lib/atf/libatf-c/Makefile
@@ -25,6 +25,7 @@
#
# $FreeBSD$
+.include <src.opts.mk>
.include <bsd.init.mk>
LIB= atf-c
diff --git a/lib/clang/Makefile b/lib/clang/Makefile
index d335d80..ae7ae4a 100644
--- a/lib/clang/Makefile
+++ b/lib/clang/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
.if !make(install)
.if !defined(EARLY_BUILD)
diff --git a/lib/clang/clang.build.mk b/lib/clang/clang.build.mk
index 0ba18f0..27c0ca0 100644
--- a/lib/clang/clang.build.mk
+++ b/lib/clang/clang.build.mk
@@ -1,5 +1,7 @@
# $FreeBSD$
+.include <src.opts.mk>
+
CLANG_SRCS= ${LLVM_SRCS}/tools/clang
CFLAGS+= -I${LLVM_SRCS}/include -I${CLANG_SRCS}/include \
diff --git a/lib/clang/libllvmanalysis/Makefile b/lib/clang/libllvmanalysis/Makefile
index 34725fc..ea2a718 100644
--- a/lib/clang/libllvmanalysis/Makefile
+++ b/lib/clang/libllvmanalysis/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= llvmanalysis
diff --git a/lib/clang/libllvmipa/Makefile b/lib/clang/libllvmipa/Makefile
index 85b75af..c866ca0 100644
--- a/lib/clang/libllvmipa/Makefile
+++ b/lib/clang/libllvmipa/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= llvmipa
diff --git a/lib/clang/libllvmipo/Makefile b/lib/clang/libllvmipo/Makefile
index b1e9016..85af036 100644
--- a/lib/clang/libllvmipo/Makefile
+++ b/lib/clang/libllvmipo/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= llvmipo
diff --git a/lib/clang/libllvmmc/Makefile b/lib/clang/libllvmmc/Makefile
index 7fdc474..84ba618 100644
--- a/lib/clang/libllvmmc/Makefile
+++ b/lib/clang/libllvmmc/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= llvmmc
diff --git a/lib/clang/libllvmscalaropts/Makefile b/lib/clang/libllvmscalaropts/Makefile
index 1f4edff..8da4bf0 100644
--- a/lib/clang/libllvmscalaropts/Makefile
+++ b/lib/clang/libllvmscalaropts/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= llvmscalaropts
diff --git a/lib/clang/libllvmsupport/Makefile b/lib/clang/libllvmsupport/Makefile
index eb3f633..b7cfe6a 100644
--- a/lib/clang/libllvmsupport/Makefile
+++ b/lib/clang/libllvmsupport/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= llvmsupport
diff --git a/lib/clang/libllvmtransformutils/Makefile b/lib/clang/libllvmtransformutils/Makefile
index f742092..cfad040 100644
--- a/lib/clang/libllvmtransformutils/Makefile
+++ b/lib/clang/libllvmtransformutils/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= llvmtransformutils
diff --git a/lib/clang/libllvmx86disassembler/Makefile b/lib/clang/libllvmx86disassembler/Makefile
index 797f2bf..e5489a0 100644
--- a/lib/clang/libllvmx86disassembler/Makefile
+++ b/lib/clang/libllvmx86disassembler/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= llvmx86disassembler
diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile
index eb39219..bbe03a0 100644
--- a/lib/libarchive/Makefile
+++ b/lib/libarchive/Makefile
@@ -1,5 +1,5 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive
diff --git a/lib/libbsnmp/libbsnmp/Makefile b/lib/libbsnmp/libbsnmp/Makefile
index 20015b9..0b9087d 100644
--- a/lib/libbsnmp/libbsnmp/Makefile
+++ b/lib/libbsnmp/libbsnmp/Makefile
@@ -2,7 +2,7 @@
#
# Author: Harti Brandt <harti@freebsd.org>
-.include <bsd.own.mk>
+.include <src.opts.mk>
CONTRIB= ${.CURDIR}/../../../contrib/bsnmp/lib
.PATH: ${CONTRIB}
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index 6f88dac..e9bc33b 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -3,7 +3,7 @@
SHLIBDIR?= /lib
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIBC_SRCTOP?= ${.CURDIR}
diff --git a/lib/libc/arm/gen/fpsetmask_vfp.c b/lib/libc/arm/gen/fpsetmask_vfp.c
index 061c033..170e06d 100644
--- a/lib/libc/arm/gen/fpsetmask_vfp.c
+++ b/lib/libc/arm/gen/fpsetmask_vfp.c
@@ -45,7 +45,7 @@ fpsetmask(fp_except_t mask)
__asm __volatile("vmrs %0, fpscr" : "=&r"(old));
mask = (mask & FP_X_MASK) << 8;
new = (old & ~(FP_X_MASK << 8)) | mask;
- __asm __volatile("vmsr fpscr, %0" : : "r"(old));
+ __asm __volatile("vmsr fpscr, %0" : : "r"(new));
return ((old >> 8) & FP_X_MASK);
}
diff --git a/lib/libc/locale/utf8.c b/lib/libc/locale/utf8.c
index 40f0e17..cffa241 100644
--- a/lib/libc/locale/utf8.c
+++ b/lib/libc/locale/utf8.c
@@ -203,6 +203,13 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
errno = EILSEQ;
return ((size_t)-1);
}
+ if (wch >= 0xd800 && wch <= 0xdfff) {
+ /*
+ * Malformed input; invalid code points.
+ */
+ errno = EILSEQ;
+ return ((size_t)-1);
+ }
if (pwc != NULL)
*pwc = wch;
us->want = 0;
diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c
index 2a1a75e..589bb9d 100644
--- a/lib/libc/regex/engine.c
+++ b/lib/libc/regex/engine.c
@@ -686,19 +686,16 @@ backref(struct match *m,
while (m->g->strip[ss] != SOP(O_BACK, i))
ss++;
return(backref(m, sp+len, stop, ss+1, stopst, lev, rec));
- break;
case OQUEST_: /* to null or not */
dp = backref(m, sp, stop, ss+1, stopst, lev, rec);
if (dp != NULL)
return(dp); /* not */
return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev, rec));
- break;
case OPLUS_:
assert(m->lastpos != NULL);
assert(lev+1 <= m->g->nplus);
m->lastpos[lev+1] = sp;
return(backref(m, sp, stop, ss+1, stopst, lev+1, rec));
- break;
case O_PLUS:
if (sp == m->lastpos[lev]) /* last pass matched null */
return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
@@ -709,7 +706,6 @@ backref(struct match *m,
return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
else
return(dp);
- break;
case OCH_: /* find the right one, if any */
ssub = ss + 1;
esub = ss + OPND(s) - 1;
@@ -730,6 +726,7 @@ backref(struct match *m,
else
assert(OP(m->g->strip[esub]) == O_CH);
}
+ /* NOTREACHED */
break;
case OLPAREN: /* must undo assignment if rest fails */
i = OPND(s);
@@ -741,7 +738,6 @@ backref(struct match *m,
return(dp);
m->pmatch[i].rm_so = offsave;
return(NULL);
- break;
case ORPAREN: /* must undo assignment if rest fails */
i = OPND(s);
assert(0 < i && i <= m->g->nsub);
@@ -752,7 +748,6 @@ backref(struct match *m,
return(dp);
m->pmatch[i].rm_eo = offsave;
return(NULL);
- break;
default: /* uh oh */
assert(nope);
break;
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c
index f3a41e9..55f9c04 100644
--- a/lib/libc/regex/regcomp.c
+++ b/lib/libc/regex/regcomp.c
@@ -746,7 +746,6 @@ p_b_term(struct parse *p, cset *cs)
case '-':
SETERROR(REG_ERANGE);
return; /* NOTE RETURN */
- break;
default:
c = '\0';
break;
diff --git a/lib/libc/rpc/clnt_vc.c b/lib/libc/rpc/clnt_vc.c
index 7cd93b3..117cfba 100644
--- a/lib/libc/rpc/clnt_vc.c
+++ b/lib/libc/rpc/clnt_vc.c
@@ -301,15 +301,13 @@ clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
return (cl);
err:
- if (cl) {
- if (ct) {
- if (ct->ct_addr.len)
- mem_free(ct->ct_addr.buf, ct->ct_addr.len);
- mem_free(ct, sizeof (struct ct_data));
- }
- if (cl)
- mem_free(cl, sizeof (CLIENT));
+ if (ct) {
+ if (ct->ct_addr.len)
+ mem_free(ct->ct_addr.buf, ct->ct_addr.len);
+ mem_free(ct, sizeof (struct ct_data));
}
+ if (cl)
+ mem_free(cl, sizeof (CLIENT));
return ((CLIENT *)NULL);
}
diff --git a/lib/libc/sys/msync.2 b/lib/libc/sys/msync.2
index 42d8005..a91faf2 100644
--- a/lib/libc/sys/msync.2
+++ b/lib/libc/sys/msync.2
@@ -87,11 +87,13 @@ The
.Fa addr
argument
is not a multiple of the hardware page size.
-.It Bq Er EINVAL
-The
+.It Bq Er ENOMEM
+The addresses in the range starting at
+.Fa addr
+and continuing for
.Fa len
-argument
-is too large or negative.
+bytes are outside the range allowed for the address space of a
+process or specify one or more pages that are not mapped.
.It Bq Er EINVAL
The
.Fa flags
@@ -99,7 +101,7 @@ argument
was both MS_ASYNC and MS_INVALIDATE.
Only one of these flags is allowed.
.It Bq Er EIO
- An error occurred while writing at least one of the pages in
+An error occurred while writing at least one of the pages in
the specified region.
.El
.Sh SEE ALSO
diff --git a/lib/libc_nonshared/Makefile b/lib/libc_nonshared/Makefile
index e65fca0..db4fb32 100644
--- a/lib/libc_nonshared/Makefile
+++ b/lib/libc_nonshared/Makefile
@@ -5,7 +5,7 @@
# compile modes.
# bsd.lib.mk doesn't have an easy way to express that.
MK_PROFILE?=no
-.include <bsd.own.mk>
+.include <src.opts.mk>
NO_PIC=
# -fpic on some platforms, -fPIC on others.
CFLAGS+=${PICFLAG} -DPIC -fvisibility=hidden
diff --git a/lib/libcapsicum/libcapsicum_dns.c b/lib/libcapsicum/libcapsicum_dns.c
index 170e0d0..113f8dc 100644
--- a/lib/libcapsicum/libcapsicum_dns.c
+++ b/lib/libcapsicum/libcapsicum_dns.c
@@ -247,6 +247,7 @@ cap_getaddrinfo(cap_channel_t *chan, const char *hostname, const char *servname,
prevai->ai_next = curai;
else if (firstai == NULL)
firstai = curai;
+ prevai = curai;
}
nvlist_destroy(nvl);
if (curai == NULL && nvlai != NULL) {
diff --git a/lib/libcompiler_rt/Makefile b/lib/libcompiler_rt/Makefile
index 5f8039b..91ce965 100644
--- a/lib/libcompiler_rt/Makefile
+++ b/lib/libcompiler_rt/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= compiler_rt
NO_PIC=
diff --git a/lib/libcrypt/Makefile b/lib/libcrypt/Makefile
index aca24d8..85bf948 100644
--- a/lib/libcrypt/Makefile
+++ b/lib/libcrypt/Makefile
@@ -4,7 +4,7 @@
SHLIBDIR?= /lib
-.include <bsd.own.mk>
+.include <src.opts.mk>
SHLIB_MAJOR= 5
LIB= crypt
diff --git a/lib/libfetch/Makefile b/lib/libfetch/Makefile
index 085aba2..cef5f5a 100644
--- a/lib/libfetch/Makefile
+++ b/lib/libfetch/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= fetch
CFLAGS+= -I.
diff --git a/lib/libipsec/Makefile b/lib/libipsec/Makefile
index 840aefa..7d3e94a 100644
--- a/lib/libipsec/Makefile
+++ b/lib/libipsec/Makefile
@@ -29,7 +29,7 @@
SHLIBDIR?= /lib
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= ipsec
SHLIB_MAJOR= 4
diff --git a/lib/libkiconv/Makefile b/lib/libkiconv/Makefile
index bda505e..c7b2179 100644
--- a/lib/libkiconv/Makefile
+++ b/lib/libkiconv/Makefile
@@ -2,7 +2,7 @@
SHLIBDIR?= /lib
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= kiconv
SRCS= kiconv_sysctl.c xlat16_iconv.c xlat16_sysctl.c
diff --git a/lib/libmagic/Makefile b/lib/libmagic/Makefile
index d341a3a..59d772d 100644
--- a/lib/libmagic/Makefile
+++ b/lib/libmagic/Makefile
@@ -32,7 +32,7 @@ MAGFILES= ${CONTRDIR}/Header\
${CONTRDIR}/Magdir/[a-z]*
magic: ${MAGFILES}
- cat ${.ALLSRC} > ${.TARGET}
+ cat ${.ALLSRC:O} > ${.TARGET}
magic.mgc: mkmagic magic
./mkmagic magic
diff --git a/lib/libmilter/Makefile b/lib/libmilter/Makefile
index 0e625d0..ca9838d 100644
--- a/lib/libmilter/Makefile
+++ b/lib/libmilter/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail
.PATH: ${SENDMAIL_DIR}/libmilter ${SENDMAIL_DIR}/libsm
diff --git a/lib/libpam/modules/modules.inc b/lib/libpam/modules/modules.inc
index c570cfd..66fc63c 100644
--- a/lib/libpam/modules/modules.inc
+++ b/lib/libpam/modules/modules.inc
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
MODULES =
MODULES += pam_chroot
diff --git a/lib/libpam/modules/pam_unix/Makefile b/lib/libpam/modules/pam_unix/Makefile
index 4d28cfd..ea9e639 100644
--- a/lib/libpam/modules/pam_unix/Makefile
+++ b/lib/libpam/modules/pam_unix/Makefile
@@ -34,6 +34,7 @@
#
# $FreeBSD$
+.include <src.opts.mk>
.include <bsd.init.mk>
LIB= pam_unix
diff --git a/lib/libpcap/Makefile b/lib/libpcap/Makefile
index 1a3e634..8cae1f1 100644
--- a/lib/libpcap/Makefile
+++ b/lib/libpcap/Makefile
@@ -3,7 +3,7 @@
SHLIBDIR?= /lib
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= pcap
SRCS= grammar.y tokdefs.h version.h pcap-bpf.c \
diff --git a/lib/libproc/Makefile b/lib/libproc/Makefile
index d221296..9302496 100644
--- a/lib/libproc/Makefile
+++ b/lib/libproc/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= proc
diff --git a/lib/libproc/_libproc.h b/lib/libproc/_libproc.h
index 8099ba1..ffc89cf 100644
--- a/lib/libproc/_libproc.h
+++ b/lib/libproc/_libproc.h
@@ -46,6 +46,8 @@ struct proc_handle {
size_t rdobjsz;
size_t nobjs;
struct lwpstatus lwps;
+ rd_loadobj_t *rdexec; /* rdobj index of program executable. */
+ char execname[MAXPATHLEN]; /* Path to program executable. */
};
#ifdef DEBUG
diff --git a/lib/libproc/libproc.h b/lib/libproc/libproc.h
index d80e88c..be77e4b 100644
--- a/lib/libproc/libproc.h
+++ b/lib/libproc/libproc.h
@@ -102,6 +102,7 @@ typedef struct lwpstatus {
#define PR_FAULTED 2
#define PR_SYSENTRY 3
#define PR_SYSEXIT 4
+#define PR_SIGNALLED 5
int pr_what;
#define FLTBPT -1
} lwpstatus_t;
diff --git a/lib/libproc/proc_bkpt.c b/lib/libproc/proc_bkpt.c
index 2c2761a..fe6ed4a 100644
--- a/lib/libproc/proc_bkpt.c
+++ b/lib/libproc/proc_bkpt.c
@@ -55,13 +55,6 @@ __FBSDID("$FreeBSD$");
#error "Add support for your architecture"
#endif
-static void
-proc_cont(struct proc_handle *phdl)
-{
-
- ptrace(PT_CONTINUE, proc_getpid(phdl), (caddr_t)1, 0);
-}
-
static int
proc_stop(struct proc_handle *phdl)
{
@@ -87,7 +80,7 @@ proc_bkptset(struct proc_handle *phdl, uintptr_t address,
{
struct ptrace_io_desc piod;
unsigned long paddr, caddr;
- int ret = 0;
+ int ret = 0, stopped;
*saved = 0;
if (phdl->status == PS_DEAD || phdl->status == PS_UNDEAD ||
@@ -98,9 +91,12 @@ proc_bkptset(struct proc_handle *phdl, uintptr_t address,
DPRINTFX("adding breakpoint at 0x%lx", address);
- if (phdl->status != PS_STOP)
+ stopped = 0;
+ if (phdl->status != PS_STOP) {
if (proc_stop(phdl) != 0)
return (-1);
+ stopped = 1;
+ }
/*
* Read the original instruction.
@@ -135,9 +131,9 @@ proc_bkptset(struct proc_handle *phdl, uintptr_t address,
}
done:
- if (phdl->status != PS_STOP)
+ if (stopped)
/* Restart the process if we had to stop it. */
- proc_cont(phdl);
+ proc_continue(phdl);
return (ret);
}
@@ -148,7 +144,7 @@ proc_bkptdel(struct proc_handle *phdl, uintptr_t address,
{
struct ptrace_io_desc piod;
unsigned long paddr, caddr;
- int ret = 0;
+ int ret = 0, stopped;
if (phdl->status == PS_DEAD || phdl->status == PS_UNDEAD ||
phdl->status == PS_IDLE) {
@@ -158,9 +154,12 @@ proc_bkptdel(struct proc_handle *phdl, uintptr_t address,
DPRINTFX("removing breakpoint at 0x%lx", address);
- if (phdl->status != PS_STOP)
+ stopped = 0;
+ if (phdl->status != PS_STOP) {
if (proc_stop(phdl) != 0)
return (-1);
+ stopped = 1;
+ }
/*
* Overwrite the breakpoint instruction that we setup previously.
@@ -177,9 +176,9 @@ proc_bkptdel(struct proc_handle *phdl, uintptr_t address,
ret = -1;
}
- if (phdl->status != PS_STOP)
+ if (stopped)
/* Restart the process if we had to stop it. */
- proc_cont(phdl);
+ proc_continue(phdl);
return (ret);
}
diff --git a/lib/libproc/proc_create.c b/lib/libproc/proc_create.c
index d02eccf..4a92580 100644
--- a/lib/libproc/proc_create.c
+++ b/lib/libproc/proc_create.c
@@ -26,8 +26,10 @@
* $FreeBSD$
*/
-#include "_libproc.h"
-#include <stdio.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/wait.h>
+
#include <err.h>
#include <errno.h>
#include <fcntl.h>
@@ -35,7 +37,37 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <sys/wait.h>
+
+#include "_libproc.h"
+
+static int proc_init(pid_t, int, int, struct proc_handle *);
+
+static int
+proc_init(pid_t pid, int flags, int status, struct proc_handle *phdl)
+{
+ int mib[4], error;
+ size_t len;
+
+ memset(phdl, 0, sizeof(*phdl));
+ phdl->pid = pid;
+ phdl->flags = flags;
+ phdl->status = status;
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PATHNAME;
+ mib[3] = pid;
+ len = sizeof(phdl->execname);
+ if (sysctl(mib, 4, phdl->execname, &len, NULL, 0) != 0) {
+ error = errno;
+ DPRINTF("ERROR: cannot get pathname for child process %d", pid);
+ return (error);
+ }
+ if (len == 0)
+ phdl->execname[0] = '\0';
+
+ return (0);
+}
int
proc_attach(pid_t pid, int flags, struct proc_handle **pphdl)
@@ -54,12 +86,12 @@ proc_attach(pid_t pid, int flags, struct proc_handle **pphdl)
if ((phdl = malloc(sizeof(struct proc_handle))) == NULL)
return (ENOMEM);
- memset(phdl, 0, sizeof(struct proc_handle));
- phdl->pid = pid;
- phdl->flags = flags;
- phdl->status = PS_RUN;
elf_version(EV_CURRENT);
+ error = proc_init(pid, flags, PS_RUN, phdl);
+ if (error != 0)
+ goto out;
+
if (ptrace(PT_ATTACH, phdl->pid, 0, 0) != 0) {
error = errno;
DPRINTF("ERROR: cannot ptrace child process %d", pid);
@@ -123,9 +155,9 @@ proc_create(const char *file, char * const *argv, proc_child_func *pcf,
_exit(2);
} else {
/* The parent owns the process handle. */
- memset(phdl, 0, sizeof(struct proc_handle));
- phdl->pid = pid;
- phdl->status = PS_IDLE;
+ error = proc_init(pid, 0, PS_IDLE, phdl);
+ if (error != 0)
+ goto bad;
/* Wait for the child process to stop. */
if (waitpid(pid, &status, WUNTRACED) == -1) {
diff --git a/lib/libproc/proc_rtld.c b/lib/libproc/proc_rtld.c
index 5259049..8dff3b7 100644
--- a/lib/libproc/proc_rtld.c
+++ b/lib/libproc/proc_rtld.c
@@ -49,6 +49,9 @@ map_iter(const rd_loadobj_t *lop, void *arg)
if (phdl->rdobjs == NULL)
return (-1);
}
+ if (strcmp(lop->rdl_path, phdl->execname) == 0 &&
+ (lop->rdl_prot & RD_RDL_X) != 0)
+ phdl->rdexec = &phdl->rdobjs[phdl->nobjs];
memcpy(&phdl->rdobjs[phdl->nobjs++], lop, sizeof(*lop));
return (0);
diff --git a/lib/libproc/proc_sym.c b/lib/libproc/proc_sym.c
index 2338895..3777a46 100644
--- a/lib/libproc/proc_sym.c
+++ b/lib/libproc/proc_sym.c
@@ -112,17 +112,23 @@ proc_obj2map(struct proc_handle *p, const char *objname)
rd_loadobj_t *rdl;
char path[MAXPATHLEN];
+ rdl = NULL;
for (i = 0; i < p->nobjs; i++) {
- rdl = &p->rdobjs[i];
- basename_r(rdl->rdl_path, path);
+ basename_r(p->rdobjs[i].rdl_path, path);
if (strcmp(path, objname) == 0) {
- if ((map = malloc(sizeof(*map))) == NULL)
- return (NULL);
- proc_rdl2prmap(rdl, map);
- return (map);
+ rdl = &p->rdobjs[i];
+ break;
}
}
- return (NULL);
+ if (rdl == NULL && strcmp(objname, "a.out") == 0 && p->rdexec != NULL)
+ rdl = p->rdexec;
+ else
+ return (NULL);
+
+ if ((map = malloc(sizeof(*map))) == NULL)
+ return (NULL);
+ proc_rdl2prmap(rdl, map);
+ return (map);
}
int
@@ -386,8 +392,9 @@ proc_name2map(struct proc_handle *p, const char *name)
free(kves);
return (NULL);
}
- if (name == NULL || strcmp(name, "a.out") == 0) {
- map = proc_addr2map(p, p->rdobjs[0].rdl_saddr);
+ if ((name == NULL || strcmp(name, "a.out") == 0) &&
+ p->rdexec != NULL) {
+ map = proc_addr2map(p, p->rdexec->rdl_saddr);
return (map);
}
for (i = 0; i < p->nobjs; i++) {
diff --git a/lib/libproc/proc_util.c b/lib/libproc/proc_util.c
index 1c3d522..4d9aa20 100644
--- a/lib/libproc/proc_util.c
+++ b/lib/libproc/proc_util.c
@@ -35,10 +35,9 @@
#include <sys/wait.h>
#include <err.h>
#include <errno.h>
-#include <unistd.h>
-#include <stdio.h>
#include <signal.h>
#include <string.h>
+#include <unistd.h>
#include "_libproc.h"
int
@@ -59,11 +58,14 @@ proc_clearflags(struct proc_handle *phdl, int mask)
int
proc_continue(struct proc_handle *phdl)
{
+ int pending = 0;
if (phdl == NULL)
return (-1);
- if (ptrace(PT_CONTINUE, phdl->pid, (caddr_t)(uintptr_t) 1, 0) != 0)
+ if (phdl->status == PS_STOP && WSTOPSIG(phdl->wstat) != SIGTRAP)
+ pending = WSTOPSIG(phdl->wstat);
+ if (ptrace(PT_CONTINUE, phdl->pid, (caddr_t)(uintptr_t)1, pending) != 0)
return (-1);
phdl->status = PS_RUN;
@@ -208,12 +210,16 @@ proc_getlwpstatus(struct proc_handle *phdl)
return (NULL);
siginfo = &lwpinfo.pl_siginfo;
if (lwpinfo.pl_event == PL_EVENT_SIGNAL &&
- (lwpinfo.pl_flags & PL_FLAG_SI) &&
- siginfo->si_signo == SIGTRAP &&
- (siginfo->si_code == TRAP_BRKPT ||
- siginfo->si_code == TRAP_TRACE)) {
- psp->pr_why = PR_FAULTED;
- psp->pr_what = FLTBPT;
+ (lwpinfo.pl_flags & PL_FLAG_SI) != 0) {
+ if (siginfo->si_signo == SIGTRAP &&
+ (siginfo->si_code == TRAP_BRKPT ||
+ siginfo->si_code == TRAP_TRACE)) {
+ psp->pr_why = PR_FAULTED;
+ psp->pr_what = FLTBPT;
+ } else {
+ psp->pr_why = PR_SIGNALLED;
+ psp->pr_what = siginfo->si_signo;
+ }
} else if (lwpinfo.pl_flags & PL_FLAG_SCE) {
psp->pr_why = PR_SYSENTRY;
} else if (lwpinfo.pl_flags & PL_FLAG_SCX) {
diff --git a/lib/libprocstat/Makefile b/lib/libprocstat/Makefile
index af5a775..32c7daa 100644
--- a/lib/libprocstat/Makefile
+++ b/lib/libprocstat/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= procstat
diff --git a/lib/libradius/Makefile b/lib/libradius/Makefile
index cb68eaa..2b769d9 100644
--- a/lib/libradius/Makefile
+++ b/lib/libradius/Makefile
@@ -24,7 +24,7 @@
#
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= radius
SRCS= radlib.c
diff --git a/lib/librpcsvc/Makefile b/lib/librpcsvc/Makefile
index 9c9e3ae..ba972ac 100644
--- a/lib/librpcsvc/Makefile
+++ b/lib/librpcsvc/Makefile
@@ -1,7 +1,7 @@
# from: @(#)Makefile 5.10 (Berkeley) 6/24/90
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
.PATH: ${.CURDIR}/../../include/rpcsvc
diff --git a/lib/librtld_db/librtld_db.3 b/lib/librtld_db/librtld_db.3
index 0c9a762..4645142 100644
--- a/lib/librtld_db/librtld_db.3
+++ b/lib/librtld_db/librtld_db.3
@@ -48,7 +48,7 @@
.Fc
.Ft rd_err_e
.Fo rd_event_addr
-.Fa "rd_agent_t *rdap, rd_notify_t *notify"
+.Fa "rd_agent_t *rdap, rd_event_e event, rd_notify_t *notify"
.Fc
.Ft rd_err_e
.Fo rd_event_enable
@@ -142,10 +142,10 @@ enables reporting of events.
This function always returns RD_OK.
.Pp
.Fn rd_event_addr
-returns the event address in the
+returns the event address corresponding to the
.Ft event
parameter.
-At the moment we only report RD_NOTIFY_BPT events.
+At the moment we only report events of type RD_NOTIFY_BPT.
.Pp
.Fn rd_event_getmsg
returns the message associated with the latest event.
diff --git a/lib/librtld_db/rtld_db.c b/lib/librtld_db/rtld_db.c
index fef8d46..2d1f6e6 100644
--- a/lib/librtld_db/rtld_db.c
+++ b/lib/librtld_db/rtld_db.c
@@ -81,20 +81,40 @@ rd_errstr(rd_err_e rderr)
}
rd_err_e
-rd_event_addr(rd_agent_t *rdap, rd_event_e event __unused, rd_notify_t *notify)
+rd_event_addr(rd_agent_t *rdap, rd_event_e event, rd_notify_t *notify)
{
- DPRINTF("%s rdap %p notify %p\n", __func__, rdap, notify);
-
- notify->type = RD_NOTIFY_BPT;
- notify->u.bptaddr = rdap->rda_addr;
-
- return (RD_OK);
+ rd_err_e ret;
+
+ DPRINTF("%s rdap %p event %d notify %p\n", __func__, rdap, event,
+ notify);
+
+ ret = RD_OK;
+ switch (event) {
+ case RD_NONE:
+ break;
+ case RD_PREINIT:
+ notify->type = RD_NOTIFY_BPT;
+ notify->u.bptaddr = rdap->rda_preinit_addr;
+ break;
+ case RD_POSTINIT:
+ notify->type = RD_NOTIFY_BPT;
+ notify->u.bptaddr = rdap->rda_postinit_addr;
+ break;
+ case RD_DLACTIVITY:
+ notify->type = RD_NOTIFY_BPT;
+ notify->u.bptaddr = rdap->rda_dlactivity_addr;
+ break;
+ default:
+ ret = RD_ERR;
+ break;
+ }
+ return (ret);
}
rd_err_e
rd_event_enable(rd_agent_t *rdap __unused, int onoff)
{
- DPRINTF("%s onoff %d\n", __func__, onoff);
+ DPRINTF("%s onoff %d\n", __func__, onoff);
return (RD_OK);
}
@@ -220,7 +240,15 @@ rd_reset(rd_agent_t *rdap)
&sym) < 0)
return (RD_ERR);
DPRINTF("found r_debug_state at 0x%lx\n", (unsigned long)sym.st_value);
- rdap->rda_addr = sym.st_value;
+ rdap->rda_preinit_addr = sym.st_value;
+ rdap->rda_dlactivity_addr = sym.st_value;
+
+ if (proc_name2sym(rdap->rda_php, "ld-elf.so.1", "_r_debug_postinit",
+ &sym) < 0)
+ return (RD_ERR);
+ DPRINTF("found _r_debug_postinit at 0x%lx\n",
+ (unsigned long)sym.st_value);
+ rdap->rda_postinit_addr = sym.st_value;
return (RD_OK);
}
diff --git a/lib/librtld_db/rtld_db.h b/lib/librtld_db/rtld_db.h
index 33da4d3..9dd53f0 100644
--- a/lib/librtld_db/rtld_db.h
+++ b/lib/librtld_db/rtld_db.h
@@ -51,7 +51,9 @@ typedef enum {
typedef struct rd_agent {
struct proc_handle *rda_php;
- uintptr_t rda_addr; /* address of r_debug_state */
+ uintptr_t rda_dlactivity_addr;
+ uintptr_t rda_preinit_addr;
+ uintptr_t rda_postinit_addr;
} rd_agent_t;
typedef struct rd_loadobj {
diff --git a/lib/libsm/Makefile b/lib/libsm/Makefile
index 07172c7..b30ba42 100644
--- a/lib/libsm/Makefile
+++ b/lib/libsm/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail
.PATH: ${SENDMAIL_DIR}/libsm
diff --git a/lib/libsmb/Makefile b/lib/libsmb/Makefile
index e464a8f..ea7327b 100644
--- a/lib/libsmb/Makefile
+++ b/lib/libsmb/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
CONTRIBDIR= ${.CURDIR}/../../contrib/smbfs
.PATH: ${CONTRIBDIR}/lib/smb
diff --git a/lib/libstand/Makefile b/lib/libstand/Makefile
index 5f64520..0e074d2 100644
--- a/lib/libstand/Makefile
+++ b/lib/libstand/Makefile
@@ -9,7 +9,7 @@
MK_PROFILE= no
MK_SSP= no
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= stand
NO_PIC=
diff --git a/lib/libtelnet/Makefile b/lib/libtelnet/Makefile
index e98fd53..a11138e 100644
--- a/lib/libtelnet/Makefile
+++ b/lib/libtelnet/Makefile
@@ -1,7 +1,7 @@
# From: @(#)Makefile 8.2 (Berkeley) 12/15/93
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
TELNETDIR= ${.CURDIR}/../../contrib/telnet
.PATH: ${TELNETDIR}/libtelnet
diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile
index 1c70a5e..cfcc41e 100644
--- a/lib/libthr/Makefile
+++ b/lib/libthr/Makefile
@@ -10,7 +10,7 @@
SHLIBDIR?= /lib
-.include <bsd.own.mk>
+.include <src.opts.mk>
MK_SSP= no
LIB=thr
diff --git a/lib/libulog/Makefile b/lib/libulog/Makefile
index 074d9db..efbaece 100644
--- a/lib/libulog/Makefile
+++ b/lib/libulog/Makefile
@@ -2,7 +2,7 @@
SHLIBDIR?=/lib
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= ulog
SHLIB_MAJOR= 0
diff --git a/lib/libutil/Makefile b/lib/libutil/Makefile
index 582ccef..5e5139f 100644
--- a/lib/libutil/Makefile
+++ b/lib/libutil/Makefile
@@ -3,7 +3,7 @@
SHLIBDIR?= /lib
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= util
SHLIB_MAJOR= 9
diff --git a/lib/libutil/kinfo_getfile.3 b/lib/libutil/kinfo_getfile.3
index ca8c55c..1e0bab7 100644
--- a/lib/libutil/kinfo_getfile.3
+++ b/lib/libutil/kinfo_getfile.3
@@ -48,7 +48,7 @@ field contains the process identifier.
This should be the a process that you have privilege to access.
The
.Ar cntp
-field is allows the caller to know how many records are returned.
+field allows the caller to know how many records are returned.
.Pp
This function is a wrapper around
.Xr sysctl 3
diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c
index 60d3105..4a7f852 100644
--- a/lib/libvmmapi/vmmapi.c
+++ b/lib/libvmmapi/vmmapi.c
@@ -343,10 +343,13 @@ vm_run(struct vmctx *ctx, int vcpu, uint64_t rip, struct vm_exit *vmexit)
}
int
-vm_suspend(struct vmctx *ctx)
+vm_suspend(struct vmctx *ctx, enum vm_suspend_how how)
{
+ struct vm_suspend vmsuspend;
- return (ioctl(ctx->fd, VM_SUSPEND, 0));
+ bzero(&vmsuspend, sizeof(vmsuspend));
+ vmsuspend.how = how;
+ return (ioctl(ctx->fd, VM_SUSPEND, &vmsuspend));
}
static int
diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h
index ed63fb2..2a2ca6b 100644
--- a/lib/libvmmapi/vmmapi.h
+++ b/lib/libvmmapi/vmmapi.h
@@ -61,7 +61,7 @@ int vm_set_register(struct vmctx *ctx, int vcpu, int reg, uint64_t val);
int vm_get_register(struct vmctx *ctx, int vcpu, int reg, uint64_t *retval);
int vm_run(struct vmctx *ctx, int vcpu, uint64_t rip,
struct vm_exit *ret_vmexit);
-int vm_suspend(struct vmctx *ctx);
+int vm_suspend(struct vmctx *ctx, enum vm_suspend_how how);
int vm_apicid2vcpu(struct vmctx *ctx, int apicid);
int vm_inject_exception(struct vmctx *ctx, int vcpu, int vec);
int vm_inject_exception2(struct vmctx *ctx, int vcpu, int vec, int errcode);
diff --git a/lib/libwrap/Makefile b/lib/libwrap/Makefile
index 2ae6821..7c2ca9a 100644
--- a/lib/libwrap/Makefile
+++ b/lib/libwrap/Makefile
@@ -2,7 +2,7 @@
# $FreeBSD$
#
-.include <bsd.own.mk>
+.include <src.opts.mk>
LIB= wrap
SHLIB_MAJOR= 6
diff --git a/lib/ncurses/Makefile b/lib/ncurses/Makefile
index b363f64..822905f 100644
--- a/lib/ncurses/Makefile
+++ b/lib/ncurses/Makefile
@@ -1,6 +1,6 @@
# $FreeBSD$
-.include <bsd.own.mk>
+.include <src.opts.mk>
SUBDIR= ncurses form menu panel
diff --git a/lib/ncurses/ncurses/Makefile b/lib/ncurses/ncurses/Makefile
index 9cf3cc8..3821d46 100644
--- a/lib/ncurses/ncurses/Makefile
+++ b/lib/ncurses/ncurses/Makefile
@@ -7,7 +7,7 @@ SHLIBDIR?= /lib
MK_MAN=no
.endif
-.include <bsd.own.mk>
+.include <src.opts.mk>
.include "${.CURDIR}/../config.mk"
OpenPOWER on IntegriCloud