svn commit: r303642 - in user/alc/PQ_LAUNDRY: . bin/sh cddl/contrib/opensolaris/lib/libdtrace/arm cddl/contrib/opensolaris/lib/libdtrace/i386 cddl/contrib/opensolaris/lib/libzpool/common contrib/bl...
Alan Cox
alc at FreeBSD.org
Mon Aug 1 21:28:38 UTC 2016
Author: alc
Date: Mon Aug 1 21:28:34 2016
New Revision: 303642
URL: https://svnweb.freebsd.org/changeset/base/303642
Log:
MFH r303641
Added:
user/alc/PQ_LAUNDRY/share/man/man4/ng_checksum.4
- copied unchanged from r303641, head/share/man/man4/ng_checksum.4
user/alc/PQ_LAUNDRY/sys/arm/arm/gic.h
- copied unchanged from r303641, head/sys/arm/arm/gic.h
user/alc/PQ_LAUNDRY/sys/arm/arm/gic_fdt.c
- copied unchanged from r303641, head/sys/arm/arm/gic_fdt.c
user/alc/PQ_LAUNDRY/sys/modules/netgraph/checksum/
- copied from r303641, head/sys/modules/netgraph/checksum/
user/alc/PQ_LAUNDRY/sys/netgraph/ng_checksum.c
- copied unchanged from r303641, head/sys/netgraph/ng_checksum.c
user/alc/PQ_LAUNDRY/sys/netgraph/ng_checksum.h
- copied unchanged from r303641, head/sys/netgraph/ng_checksum.h
Modified:
user/alc/PQ_LAUNDRY/Makefile.inc1
user/alc/PQ_LAUNDRY/bin/sh/expand.c
user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c
user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c
user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/lib/libzpool/common/util.c
user/alc/PQ_LAUNDRY/contrib/blacklist/lib/bl.c
user/alc/PQ_LAUNDRY/contrib/libexecinfo/backtrace.c
user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp
user/alc/PQ_LAUNDRY/contrib/ofed/usr.lib/libibverbs/config.h
user/alc/PQ_LAUNDRY/include/grp.h
user/alc/PQ_LAUNDRY/include/stdio.h
user/alc/PQ_LAUNDRY/lib/libc/gen/getgrent.3
user/alc/PQ_LAUNDRY/lib/libc/gen/getgrent.c
user/alc/PQ_LAUNDRY/lib/libc/gen/glob.3
user/alc/PQ_LAUNDRY/lib/libc/gen/glob.c
user/alc/PQ_LAUNDRY/lib/libc/stdio/dprintf.c
user/alc/PQ_LAUNDRY/lib/libc/stdio/getline.3
user/alc/PQ_LAUNDRY/lib/libc/stdio/getline.c
user/alc/PQ_LAUNDRY/lib/libc/stdio/printf.3
user/alc/PQ_LAUNDRY/lib/libc/tests/stdio/getdelim_test.c
user/alc/PQ_LAUNDRY/lib/libproc/Makefile
user/alc/PQ_LAUNDRY/lib/libproc/_libproc.h
user/alc/PQ_LAUNDRY/lib/libproc/libproc.h
user/alc/PQ_LAUNDRY/lib/libproc/proc_create.c
user/alc/PQ_LAUNDRY/lib/libproc/proc_rtld.c
user/alc/PQ_LAUNDRY/lib/libproc/proc_util.c
user/alc/PQ_LAUNDRY/lib/librtld_db/Makefile
user/alc/PQ_LAUNDRY/lib/librtld_db/rtld_db.c
user/alc/PQ_LAUNDRY/lib/librtld_db/rtld_db.h
user/alc/PQ_LAUNDRY/sbin/fsdb/fsdb.c
user/alc/PQ_LAUNDRY/sbin/ipfw/tables.c
user/alc/PQ_LAUNDRY/sbin/resolvconf/Makefile
user/alc/PQ_LAUNDRY/share/man/man4/gpioled.4
user/alc/PQ_LAUNDRY/share/man/man9/bitset.9
user/alc/PQ_LAUNDRY/share/man/man9/cpuset.9
user/alc/PQ_LAUNDRY/share/mk/src.libnames.mk
user/alc/PQ_LAUNDRY/sys/amd64/amd64/support.S
user/alc/PQ_LAUNDRY/sys/arm/arm/gic.c
user/alc/PQ_LAUNDRY/sys/arm64/arm64/machdep.c
user/alc/PQ_LAUNDRY/sys/arm64/arm64/mp_machdep.c
user/alc/PQ_LAUNDRY/sys/arm64/arm64/nexus.c
user/alc/PQ_LAUNDRY/sys/arm64/arm64/pmap.c
user/alc/PQ_LAUNDRY/sys/arm64/include/armreg.h
user/alc/PQ_LAUNDRY/sys/arm64/include/machdep.h
user/alc/PQ_LAUNDRY/sys/boot/common/bcache.c
user/alc/PQ_LAUNDRY/sys/boot/common/interp_parse.c
user/alc/PQ_LAUNDRY/sys/boot/zfs/libzfs.h
user/alc/PQ_LAUNDRY/sys/boot/zfs/zfs.c
user/alc/PQ_LAUNDRY/sys/boot/zfs/zfsimpl.c
user/alc/PQ_LAUNDRY/sys/cddl/boot/zfs/zfsimpl.h
user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c
user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c
user/alc/PQ_LAUNDRY/sys/conf/files.arm
user/alc/PQ_LAUNDRY/sys/conf/files.arm64
user/alc/PQ_LAUNDRY/sys/contrib/libnv/nvlist.c
user/alc/PQ_LAUNDRY/sys/dev/ath/if_athioctl.h
user/alc/PQ_LAUNDRY/sys/dev/cfe/cfe_api.c
user/alc/PQ_LAUNDRY/sys/dev/cfe/cfe_api.h
user/alc/PQ_LAUNDRY/sys/dev/cfe/cfe_api_int.h
user/alc/PQ_LAUNDRY/sys/dev/cfe/cfe_error.h
user/alc/PQ_LAUNDRY/sys/dev/cfe/cfe_ioctl.h
user/alc/PQ_LAUNDRY/sys/dev/cxgbe/t4_main.c
user/alc/PQ_LAUNDRY/sys/dev/e1000/if_em.c
user/alc/PQ_LAUNDRY/sys/dev/gpio/gpioled.c
user/alc/PQ_LAUNDRY/sys/dev/hyperv/include/vmbus.h
user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_net_vsc.h
user/alc/PQ_LAUNDRY/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
user/alc/PQ_LAUNDRY/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_brvar.h
user/alc/PQ_LAUNDRY/sys/dev/hyperv/vmbus/vmbus_chan.c
user/alc/PQ_LAUNDRY/sys/dev/iwm/if_iwm.c
user/alc/PQ_LAUNDRY/sys/dev/ntb/if_ntb/if_ntb.c
user/alc/PQ_LAUNDRY/sys/dev/ntb/ntb.c
user/alc/PQ_LAUNDRY/sys/dev/ntb/ntb_hw/ntb_hw.c
user/alc/PQ_LAUNDRY/sys/dev/pci/pci_pci.c
user/alc/PQ_LAUNDRY/sys/geom/geom_disk.c
user/alc/PQ_LAUNDRY/sys/kern/kern_mutex.c
user/alc/PQ_LAUNDRY/sys/kern/kern_rwlock.c
user/alc/PQ_LAUNDRY/sys/kern/kern_sx.c
user/alc/PQ_LAUNDRY/sys/kern/kern_tc.c
user/alc/PQ_LAUNDRY/sys/mips/atheros/ar71xx_gpio.c
user/alc/PQ_LAUNDRY/sys/mips/broadcom/uart_cpu_chipc.c
user/alc/PQ_LAUNDRY/sys/mips/conf/SENTRY5.hints
user/alc/PQ_LAUNDRY/sys/mips/conf/TL-WDR4300.hints
user/alc/PQ_LAUNDRY/sys/netgraph/ng_patch.c
user/alc/PQ_LAUNDRY/sys/netgraph/ng_patch.h
user/alc/PQ_LAUNDRY/sys/netinet/tcp_subr.c
user/alc/PQ_LAUNDRY/sys/netinet6/icmp6.c
user/alc/PQ_LAUNDRY/sys/netinet6/ip6_output.c
user/alc/PQ_LAUNDRY/sys/ofed/drivers/infiniband/core/cma.c
user/alc/PQ_LAUNDRY/sys/vm/vm_pageout.c
user/alc/PQ_LAUNDRY/tools/regression/zfs/zpool/add/option-f_size_mismatch.t
user/alc/PQ_LAUNDRY/tools/regression/zfs/zpool/add/option-f_type_mismatch.t
user/alc/PQ_LAUNDRY/tools/regression/zfs/zpool/create/files.t
user/alc/PQ_LAUNDRY/usr.bin/at/at.c
user/alc/PQ_LAUNDRY/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.common
user/alc/PQ_LAUNDRY/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.holiday (contents, props changed)
user/alc/PQ_LAUNDRY/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.military
user/alc/PQ_LAUNDRY/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.orthodox
user/alc/PQ_LAUNDRY/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.pagan
user/alc/PQ_LAUNDRY/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.common
user/alc/PQ_LAUNDRY/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.military
user/alc/PQ_LAUNDRY/usr.bin/calendar/calendars/ru_RU.UTF-8/calendar.pagan
user/alc/PQ_LAUNDRY/usr.bin/calendar/io.c
user/alc/PQ_LAUNDRY/usr.bin/checknr/checknr.c
user/alc/PQ_LAUNDRY/usr.bin/comm/comm.c
user/alc/PQ_LAUNDRY/usr.bin/cpuset/cpuset.1
user/alc/PQ_LAUNDRY/usr.bin/grep/grep.c
user/alc/PQ_LAUNDRY/usr.bin/gzip/gzip.c
user/alc/PQ_LAUNDRY/usr.bin/indent/args.c
user/alc/PQ_LAUNDRY/usr.bin/indent/indent.c
user/alc/PQ_LAUNDRY/usr.bin/indent/indent.h
user/alc/PQ_LAUNDRY/usr.bin/indent/indent_codes.h
user/alc/PQ_LAUNDRY/usr.bin/indent/indent_globs.h
user/alc/PQ_LAUNDRY/usr.bin/indent/io.c
user/alc/PQ_LAUNDRY/usr.bin/indent/lexi.c
user/alc/PQ_LAUNDRY/usr.bin/indent/parse.c
user/alc/PQ_LAUNDRY/usr.bin/indent/pr_comment.c
user/alc/PQ_LAUNDRY/usr.bin/locale/locale.c
user/alc/PQ_LAUNDRY/usr.bin/mandoc/Makefile
user/alc/PQ_LAUNDRY/usr.bin/netstat/pfkey.c
user/alc/PQ_LAUNDRY/usr.bin/nl/nl.c
user/alc/PQ_LAUNDRY/usr.bin/procstat/procstat_files.c
user/alc/PQ_LAUNDRY/usr.bin/sdiff/sdiff.c
user/alc/PQ_LAUNDRY/usr.bin/sed/compile.c
user/alc/PQ_LAUNDRY/usr.bin/sed/main.c
user/alc/PQ_LAUNDRY/usr.bin/soelim/soelim.c
user/alc/PQ_LAUNDRY/usr.bin/uniq/uniq.c
user/alc/PQ_LAUNDRY/usr.sbin/autofs/common.c
user/alc/PQ_LAUNDRY/usr.sbin/bsdinstall/scripts/hardening
user/alc/PQ_LAUNDRY/usr.sbin/pkg/pkg.c
user/alc/PQ_LAUNDRY/usr.sbin/pw/pw.h
user/alc/PQ_LAUNDRY/usr.sbin/pw/pw_vpw.c
user/alc/PQ_LAUNDRY/usr.sbin/pw/pwupd.h
user/alc/PQ_LAUNDRY/usr.sbin/services_mkdb/services_mkdb.c
user/alc/PQ_LAUNDRY/usr.sbin/uathload/uathload.c
Directory Properties:
user/alc/PQ_LAUNDRY/ (props changed)
user/alc/PQ_LAUNDRY/cddl/ (props changed)
user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/ (props changed)
user/alc/PQ_LAUNDRY/contrib/libexecinfo/ (props changed)
user/alc/PQ_LAUNDRY/contrib/llvm/ (props changed)
user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/ (props changed)
user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/ (props changed)
Modified: user/alc/PQ_LAUNDRY/Makefile.inc1
==============================================================================
--- user/alc/PQ_LAUNDRY/Makefile.inc1 Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/Makefile.inc1 Mon Aug 1 21:28:34 2016 (r303642)
@@ -2095,7 +2095,10 @@ cddl/lib/libctf__L: lib/libz__L
# cddl/lib/libdtrace requires lib/libproc and lib/librtld_db; it's only built
# on select architectures though (see cddl/lib/Makefile)
.if ${MACHINE_CPUARCH} != "sparc64"
-_prebuild_libs+= lib/libproc lib/librtld_db
+_prebuild_libs+= lib/libprocstat lib/libproc lib/librtld_db
+lib/libprocstat__L: lib/libelf__L lib/libkvm__L lib/libutil__L
+lib/libproc__L: lib/libprocstat__L
+lib/librtld_db__L: lib/libprocstat__L
.endif
.if ${MK_CRYPT} != "no"
Modified: user/alc/PQ_LAUNDRY/bin/sh/expand.c
==============================================================================
--- user/alc/PQ_LAUNDRY/bin/sh/expand.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/bin/sh/expand.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -473,7 +473,8 @@ expbackq(union node *cmd, int quoted, in
if (--in.nleft < 0) {
if (in.fd < 0)
break;
- while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR);
+ while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR)
+ ;
TRACE(("expbackq: read returns %d\n", i));
if (i <= 0)
break;
Modified: user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c
==============================================================================
--- user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -38,9 +38,7 @@
#include <dt_impl.h>
#include <dt_pid.h>
-#if !defined(sun)
-#define PR_MODEL_ILP32 1
-#define PR_MODEL_LP64 2
+#ifdef __FreeBSD__
#include <libproc_compat.h>
#endif
Modified: user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c
==============================================================================
--- user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -39,9 +39,8 @@
#include <dis_tables.h>
-#ifndef illumos
-#define PR_MODEL_ILP32 1
-#define PR_MODEL_LP64 2
+#ifdef __FreeBSD__
+#include <libproc.h>
#include <libproc_compat.h>
#endif
@@ -93,11 +92,7 @@ dt_pid_has_jump_table(struct ps_prochand
char dmodel = Pstatus(P)->pr_dmodel;
#else
pid_t pid = proc_getpid(P);
-#if __i386__
- char dmodel = PR_MODEL_ILP32;
-#elif __amd64__
- char dmodel = PR_MODEL_LP64;
-#endif
+ char dmodel = proc_getmodel(P);
#endif
/*
@@ -149,11 +144,7 @@ dt_pid_create_return_probe(struct ps_pro
char dmodel = Pstatus(P)->pr_dmodel;
#else
pid_t pid = proc_getpid(P);
-#if __i386__
- char dmodel = PR_MODEL_ILP32;
-#elif __amd64__
- char dmodel = PR_MODEL_LP64;
-#endif
+ char dmodel = proc_getmodel(P);
#endif
/*
@@ -310,11 +301,7 @@ dt_pid_create_offset_probe(struct ps_pro
char dmodel = Pstatus(P)->pr_dmodel;
#else
pid_t pid = proc_getpid(P);
-#if __i386__
- char dmodel = PR_MODEL_ILP32;
-#elif __amd64__
- char dmodel = PR_MODEL_LP64;
-#endif
+ char dmodel = proc_getmodel(P);
#endif
if ((text = malloc(symp->st_size)) == NULL) {
@@ -393,11 +380,7 @@ dt_pid_create_glob_offset_probes(struct
char dmodel = Pstatus(P)->pr_dmodel;
#else
pid_t pid = proc_getpid(P);
-#if __i386__
- char dmodel = PR_MODEL_ILP32;
-#elif __amd64__
- char dmodel = PR_MODEL_LP64;
-#endif
+ char dmodel = proc_getmodel(P);
#endif
ftp->ftps_type = DTFTP_OFFSETS;
Modified: user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/lib/libzpool/common/util.c
==============================================================================
--- user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/lib/libzpool/common/util.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/cddl/contrib/opensolaris/lib/libzpool/common/util.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -108,7 +108,7 @@ show_vdev_stats(const char *desc, const
(void) printf("%*s%s%*s%*s%*s %5s %5s %5s %5s %5s %5s %5s\n",
indent, "",
prefix,
- indent + strlen(prefix) - 25 - (vs->vs_space ? 0 : 12),
+ (int)(indent + strlen(prefix) - 25 - (vs->vs_space ? 0 : 12)),
desc,
vs->vs_space ? 6 : 0, vs->vs_space ? used : "",
vs->vs_space ? 6 : 0, vs->vs_space ? avail : "",
Modified: user/alc/PQ_LAUNDRY/contrib/blacklist/lib/bl.c
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/blacklist/lib/bl.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/contrib/blacklist/lib/bl.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -152,8 +152,8 @@ bl_init(bl_t b, bool srv)
b->b_fd = socket(PF_LOCAL,
SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK|SOCK_NOSIGPIPE, 0);
if (b->b_fd == -1) {
- bl_log(b->b_fun, LOG_ERR, "%s: socket failed (%m)",
- __func__);
+ bl_log(b->b_fun, LOG_ERR, "%s: socket failed (%s)",
+ __func__, strerror(errno));
BL_UNLOCK(b);
return -1;
}
@@ -200,8 +200,8 @@ bl_init(bl_t b, bool srv)
*/
if (b->b_connected != 1) {
bl_log(b->b_fun, LOG_DEBUG,
- "%s: connect failed for `%s' (%m)",
- __func__, sun->sun_path);
+ "%s: connect failed for `%s' (%s)",
+ __func__, sun->sun_path, strerror(errno));
b->b_connected = 1;
}
BL_UNLOCK(b);
@@ -220,8 +220,8 @@ bl_init(bl_t b, bool srv)
errno = serrno;
if (rv == -1) {
bl_log(b->b_fun, LOG_ERR,
- "%s: bind failed for `%s' (%m)",
- __func__, sun->sun_path);
+ "%s: bind failed for `%s' (%s)",
+ __func__, sun->sun_path, strerror(errno));
goto out;
}
}
@@ -260,7 +260,8 @@ bl_init(bl_t b, bool srv)
if (setsockopt(b->b_fd, CRED_LEVEL, CRED_NAME,
&one, (socklen_t)sizeof(one)) == -1) {
bl_log(b->b_fun, LOG_ERR, "%s: setsockopt %s "
- "failed (%m)", __func__, __STRING(CRED_NAME));
+ "failed (%s)", __func__, __STRING(CRED_NAME),
+ strerror(errno));
goto out;
}
#endif
@@ -296,7 +297,8 @@ bl_create(bool srv, const char *path, vo
return b;
out:
free(b);
- bl_log(fun, LOG_ERR, "%s: malloc failed (%m)", __func__);
+ bl_log(fun, LOG_ERR, "%s: malloc failed (%s)", __func__,
+ strerror(errno));
return NULL;
}
@@ -451,7 +453,8 @@ bl_recv(bl_t b)
rlen = recvmsg(b->b_fd, &msg, 0);
if (rlen == -1) {
- bl_log(b->b_fun, LOG_ERR, "%s: recvmsg failed (%m)", __func__);
+ bl_log(b->b_fun, LOG_ERR, "%s: recvmsg failed (%s)", __func__,
+ strerror(errno));
return NULL;
}
Modified: user/alc/PQ_LAUNDRY/contrib/libexecinfo/backtrace.c
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/libexecinfo/backtrace.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/contrib/libexecinfo/backtrace.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -33,7 +33,6 @@ __RCSID("$NetBSD: backtrace.c,v 1.3 2013
#include <sys/param.h>
#include <assert.h>
-#define _WITH_DPRINTF
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Modified: user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/contrib/llvm/projects/libunwind/src/Unwind-EHABI.cpp Mon Aug 1 21:28:34 2016 (r303642)
@@ -572,7 +572,7 @@ static _Unwind_Reason_Code unwind_phase2
unw_get_reg(cursor, UNW_REG_SP, &sp);
if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
_LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info "
- "failed => _URC_FATAL_PHASE1_ERROR\n",
+ "failed => _URC_FATAL_PHASE2_ERROR\n",
static_cast<void *>(exception_object));
return _URC_FATAL_PHASE2_ERROR;
}
Modified: user/alc/PQ_LAUNDRY/contrib/ofed/usr.lib/libibverbs/config.h
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/ofed/usr.lib/libibverbs/config.h Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/contrib/ofed/usr.lib/libibverbs/config.h Mon Aug 1 21:28:34 2016 (r303642)
@@ -1,2 +1 @@
-#define _WITH_GETLINE
#include <alloca.h>
Modified: user/alc/PQ_LAUNDRY/include/grp.h
==============================================================================
--- user/alc/PQ_LAUNDRY/include/grp.h Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/include/grp.h Mon Aug 1 21:28:34 2016 (r303642)
@@ -75,8 +75,7 @@ int pwcache_groupdb(int (*)(int), void
struct group * (*)(gid_t));
#endif
#if __XSI_VISIBLE
-/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */
-int setgrent(void);
+void setgrent(void);
#endif
#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
int getgrgid_r(gid_t, struct group *, char *, size_t,
Modified: user/alc/PQ_LAUNDRY/include/stdio.h
==============================================================================
--- user/alc/PQ_LAUNDRY/include/stdio.h Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/include/stdio.h Mon Aug 1 21:28:34 2016 (r303642)
@@ -357,44 +357,8 @@ ssize_t getdelim(char ** __restrict, si
FILE *open_memstream(char **, size_t *);
int renameat(int, const char *, int, const char *);
int vdprintf(int, const char * __restrict, __va_list);
-
-/*
- * Every programmer and his dog wrote functions called getline() and dprintf()
- * before POSIX.1-2008 came along and decided to usurp the names, so we
- * don't prototype them by default unless one of the following is true:
- * a) the app has requested them specifically by defining _WITH_GETLINE or
- * _WITH_DPRINTF, respectively
- * b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE
- * c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE
- */
-#ifndef _WITH_GETLINE
-#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
-#define _WITH_GETLINE
-#elif defined(_POSIX_C_SOURCE)
-#if _POSIX_C_SOURCE >= 200809
-#define _WITH_GETLINE
-#endif
-#endif
-#endif
-
-#ifdef _WITH_GETLINE
ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
-#endif
-
-#ifndef _WITH_DPRINTF
-#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
-#define _WITH_DPRINTF
-#elif defined(_POSIX_C_SOURCE)
-#if _POSIX_C_SOURCE >= 200809
-#define _WITH_DPRINTF
-#endif
-#endif
-#endif
-
-#ifdef _WITH_DPRINTF
-int (dprintf)(int, const char * __restrict, ...);
-#endif
-
+int dprintf(int, const char * __restrict, ...);
#endif /* __POSIX_VISIBLE >= 200809 */
/*
Modified: user/alc/PQ_LAUNDRY/lib/libc/gen/getgrent.3
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/gen/getgrent.3 Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libc/gen/getgrent.3 Mon Aug 1 21:28:34 2016 (r303642)
@@ -28,7 +28,7 @@
.\" From: @(#)getgrent.3 8.2 (Berkeley) 4/19/94
.\" $FreeBSD$
.\"
-.Dd April 16, 2003
+.Dd July 31, 2016
.Dt GETGRENT 3
.Os
.Sh NAME
@@ -60,7 +60,7 @@
.Fn getgrgid_r "gid_t gid" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result"
.Ft int
.Fn setgroupent "int stayopen"
-.Ft int
+.Ft void
.Fn setgrent void
.Ft void
.Fn endgrent void
@@ -188,14 +188,13 @@ is set to
.Dv NULL
and the return value is 0, no matching entry exists.)
.Pp
-The functions
+The function
.Fn setgroupent
-and
-.Fn setgrent
-return the value 1 if successful, otherwise the value
+returns the value 1 if successful, otherwise the value
0 is returned.
The functions
-.Fn endgrent
+.Fn endgrent ,
+.Fn setgrent
and
.Fn setgrfile
have no return value.
Modified: user/alc/PQ_LAUNDRY/lib/libc/gen/getgrent.c
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/gen/getgrent.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libc/gen/getgrent.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -533,12 +533,10 @@ out:
return (rv);
}
-/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */
-int
+void
setgrent(void)
{
(void)_nsdispatch(NULL, setgrent_dtab, NSDB_GROUP, "setgrent", defaultsrc, 0);
- return (1);
}
Modified: user/alc/PQ_LAUNDRY/lib/libc/gen/glob.3
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/gen/glob.3 Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libc/gen/glob.3 Mon Aug 1 21:28:34 2016 (r303642)
@@ -363,7 +363,7 @@ file
.It Dv GLOB_NOSPACE
An attempt to allocate memory failed, or if
.Fa errno
-was 0
+was E2BIG,
.Dv GLOB_LIMIT
was specified in the flags and
.Fa pglob\->gl_matchc
Modified: user/alc/PQ_LAUNDRY/lib/libc/gen/glob.c
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/gen/glob.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libc/gen/glob.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -270,7 +270,7 @@ globexp0(const Char *pattern, glob_t *pg
if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS) {
if ((pglob->gl_flags & GLOB_LIMIT) &&
limit->l_brace_cnt++ >= GLOB_LIMIT_BRACE) {
- errno = 0;
+ errno = E2BIG;
return (GLOB_NOSPACE);
}
return (glob0(pattern, pglob, limit, origpat));
@@ -297,7 +297,7 @@ globexp1(const Char *pattern, glob_t *pg
if ((ptr = g_strchr(pattern, LBRACE)) != NULL) {
if ((pglob->gl_flags & GLOB_LIMIT) &&
limit->l_brace_cnt++ >= GLOB_LIMIT_BRACE) {
- errno = 0;
+ errno = E2BIG;
return (GLOB_NOSPACE);
}
return (globexp2(ptr, pattern, pglob, limit));
@@ -538,7 +538,7 @@ glob0(const Char *pattern, glob_t *pglob
qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob);
if (qpatnext == NULL) {
- errno = 0;
+ errno = E2BIG;
return (GLOB_NOSPACE);
}
oldpathc = pglob->gl_pathc;
@@ -672,7 +672,7 @@ glob2(Char *pathbuf, Char *pathend, Char
if ((pglob->gl_flags & GLOB_LIMIT) &&
limit->l_stat_cnt++ >= GLOB_LIMIT_STAT) {
- errno = 0;
+ errno = E2BIG;
return (GLOB_NOSPACE);
}
if ((pglob->gl_flags & GLOB_MARK) &&
@@ -682,7 +682,7 @@ glob2(Char *pathbuf, Char *pathend, Char
g_stat(pathbuf, &sb, pglob) == 0 &&
S_ISDIR(sb.st_mode)))) {
if (pathend + 1 > pathend_last) {
- errno = 0;
+ errno = E2BIG;
return (GLOB_NOSPACE);
}
*pathend++ = SEP;
@@ -699,7 +699,7 @@ glob2(Char *pathbuf, Char *pathend, Char
if (ismeta(*p))
anymeta = 1;
if (q + 1 > pathend_last) {
- errno = 0;
+ errno = E2BIG;
return (GLOB_NOSPACE);
}
*q++ = *p++;
@@ -710,7 +710,7 @@ glob2(Char *pathbuf, Char *pathend, Char
pattern = p;
while (UNPROT(*pattern) == SEP) {
if (pathend + 1 > pathend_last) {
- errno = 0;
+ errno = E2BIG;
return (GLOB_NOSPACE);
}
*pathend++ = *pattern++;
@@ -729,30 +729,36 @@ glob3(Char *pathbuf, Char *pathend, Char
{
struct dirent *dp;
DIR *dirp;
- int err, too_long, saverrno;
+ int err, too_long, saverrno, saverrno2;
char buf[MAXPATHLEN + MB_LEN_MAX - 1];
struct dirent *(*readdirfunc)(DIR *);
if (pathend > pathend_last) {
- errno = 0;
+ errno = E2BIG;
return (GLOB_NOSPACE);
}
*pathend = EOS;
if (pglob->gl_errfunc != NULL &&
g_Ctoc(pathbuf, buf, sizeof(buf))) {
- errno = 0;
+ errno = E2BIG;
return (GLOB_NOSPACE);
}
+ saverrno = errno;
errno = 0;
if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
if (errno == ENOENT || errno == ENOTDIR)
return (0);
if ((pglob->gl_errfunc != NULL &&
pglob->gl_errfunc(buf, errno)) ||
- (pglob->gl_flags & GLOB_ERR))
+ (pglob->gl_flags & GLOB_ERR)) {
+ if (errno == 0)
+ errno = saverrno;
return (GLOB_ABORTED);
+ }
+ if (errno == 0)
+ errno = saverrno;
return (0);
}
@@ -775,14 +781,16 @@ glob3(Char *pathbuf, Char *pathend, Char
if ((pglob->gl_flags & GLOB_LIMIT) &&
limit->l_readdir_cnt++ >= GLOB_LIMIT_READDIR) {
- errno = 0;
+ errno = E2BIG;
err = GLOB_NOSPACE;
break;
}
/* Initial DOT must be matched literally. */
- if (dp->d_name[0] == '.' && UNPROT(*pattern) != DOT)
+ if (dp->d_name[0] == '.' && UNPROT(*pattern) != DOT) {
+ errno = 0;
continue;
+ }
memset(&mbs, 0, sizeof(mbs));
dc = pathend;
sc = dp->d_name;
@@ -801,10 +809,20 @@ glob3(Char *pathbuf, Char *pathend, Char
}
sc += clen;
}
+ if (too_long && ((pglob->gl_errfunc != NULL &&
+ pglob->gl_errfunc(buf, ENAMETOOLONG)) ||
+ (pglob->gl_flags & GLOB_ERR))) {
+ errno = ENAMETOOLONG;
+ err = GLOB_ABORTED;
+ break;
+ }
if (too_long || !match(pathend, pattern, restpattern)) {
*pathend = EOS;
+ errno = 0;
continue;
}
+ if (errno == 0)
+ errno = saverrno;
err = glob2(pathbuf, --dc, pathend_last, restpattern,
pglob, limit);
if (err)
@@ -812,12 +830,12 @@ glob3(Char *pathbuf, Char *pathend, Char
errno = 0;
}
- saverrno = errno;
+ saverrno2 = errno;
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
(*pglob->gl_closedir)(dirp);
else
closedir(dirp);
- errno = saverrno;
+ errno = saverrno2;
if (err)
return (err);
@@ -826,6 +844,8 @@ glob3(Char *pathbuf, Char *pathend, Char
pglob->gl_errfunc(buf, errno)) || (pglob->gl_flags & GLOB_ERR)))
return (GLOB_ABORTED);
+ if (errno == 0)
+ errno = saverrno;
return (0);
}
@@ -855,7 +875,7 @@ globextend(const Char *path, glob_t *pgl
if ((pglob->gl_flags & GLOB_LIMIT) &&
pglob->gl_matchc > limit->l_path_lim) {
- errno = 0;
+ errno = E2BIG;
return (GLOB_NOSPACE);
}
@@ -882,7 +902,7 @@ globextend(const Char *path, glob_t *pgl
if ((copy = malloc(len)) != NULL) {
if (g_Ctoc(path, copy, len)) {
free(copy);
- errno = 0;
+ errno = E2BIG;
return (GLOB_NOSPACE);
}
}
@@ -892,7 +912,7 @@ globextend(const Char *path, glob_t *pgl
if ((pglob->gl_flags & GLOB_LIMIT) &&
limit->l_string_cnt >= GLOB_LIMIT_STRING) {
free(copy);
- errno = 0;
+ errno = E2BIG;
return (GLOB_NOSPACE);
}
pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
Modified: user/alc/PQ_LAUNDRY/lib/libc/stdio/dprintf.c
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/stdio/dprintf.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libc/stdio/dprintf.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -27,7 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _WITH_DPRINTF
#include "namespace.h"
#include <stdarg.h>
#include <stdio.h>
Modified: user/alc/PQ_LAUNDRY/lib/libc/stdio/getline.3
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/stdio/getline.3 Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libc/stdio/getline.3 Mon Aug 1 21:28:34 2016 (r303642)
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 30, 2012
+.Dd July 30, 2016
.Dt GETLINE 3
.Os
.Sh NAME
@@ -34,7 +34,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.Fd "#define _WITH_GETLINE"
.In stdio.h
.Ft ssize_t
.Fn getdelim "char ** restrict linep" "size_t * restrict linecapp" "int delimiter" " FILE * restrict stream"
@@ -97,34 +96,6 @@ while ((linelen = getline(&line, &lineca
fwrite(line, linelen, 1, stdout);
free(line);
.Ed
-.Sh COMPATIBILITY
-Many application writers used the name
-.Va getline
-before the
-.Fn getline
-function was introduced in
-.St -p1003.1 ,
-so a prototype is not provided by default in order to avoid
-compatibility problems.
-Applications that wish to use the
-.Fn getline
-function described herein should either request a strict
-.St -p1003.1-2008
-environment by defining the macro
-.Dv _POSIX_C_SOURCE
-to the value 200809 or greater, or by defining the macro
-.Dv _WITH_GETLINE ,
-prior to the inclusion of
-.In stdio.h .
-For compatibility with GNU libc, defining either
-.Dv _BSD_SOURCE
-or
-.Dv _GNU_SOURCE
-prior to the inclusion of
-.In stdio.h
-will also make
-.Fn getline
-available.
.Sh ERRORS
These functions may fail if:
.Bl -tag -width Er
Modified: user/alc/PQ_LAUNDRY/lib/libc/stdio/getline.c
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/stdio/getline.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libc/stdio/getline.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -27,7 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _WITH_GETLINE
#include <stdio.h>
ssize_t
Modified: user/alc/PQ_LAUNDRY/lib/libc/stdio/printf.3
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/stdio/printf.3 Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libc/stdio/printf.3 Mon Aug 1 21:28:34 2016 (r303642)
@@ -32,7 +32,7 @@
.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd December 2, 2009
+.Dd July 30, 2016
.Dt PRINTF 3
.Os
.Sh NAME
@@ -42,7 +42,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.Fd "#define _WITH_DPRINTF"
.In stdio.h
.Ft int
.Fn printf "const char * restrict format" ...
@@ -715,34 +714,6 @@ char *newfmt(const char *fmt, ...)
}
.Ed
.Sh COMPATIBILITY
-Many application writers used the name
-.Va dprintf
-before the
-.Fn dprintf
-function was introduced in
-.St -p1003.1 ,
-so a prototype is not provided by default in order to avoid
-compatibility problems.
-Applications that wish to use the
-.Fn dprintf
-function described herein should either request a strict
-.St -p1003.1-2008
-environment by defining the macro
-.Dv _POSIX_C_SOURCE
-to the value 200809 or greater, or by defining the macro
-.Dv _WITH_DPRINTF ,
-prior to the inclusion of
-.In stdio.h .
-For compatibility with GNU libc, defining either
-.Dv _BSD_SOURCE
-or
-.Dv _GNU_SOURCE
-prior to the inclusion of
-.In stdio.h
-will also make
-.Fn dprintf
-available.
-.Pp
The conversion formats
.Cm \&%D , \&%O ,
and
Modified: user/alc/PQ_LAUNDRY/lib/libc/tests/stdio/getdelim_test.c
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/tests/stdio/getdelim_test.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libc/tests/stdio/getdelim_test.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -27,7 +27,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _WITH_GETLINE
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
Modified: user/alc/PQ_LAUNDRY/lib/libproc/Makefile
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libproc/Makefile Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libproc/Makefile Mon Aug 1 21:28:34 2016 (r303642)
@@ -24,7 +24,7 @@ LIBADD+= cxxrt
LIBADD+= supcplusplus
.endif
-LIBADD+= elf rtld_db util
+LIBADD+= elf procstat rtld_db util
.if ${MK_CDDL} != "no"
LIBADD+= ctf
Modified: user/alc/PQ_LAUNDRY/lib/libproc/_libproc.h
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libproc/_libproc.h Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libproc/_libproc.h Mon Aug 1 21:28:34 2016 (r303642)
@@ -26,28 +26,29 @@
* $FreeBSD$
*/
-#include <sys/cdefs.h>
-#include <sys/param.h>
#include <sys/types.h>
-#include <sys/event.h>
#include <sys/ptrace.h>
+
#include <rtld_db.h>
#include "libproc.h"
+struct procstat;
+
struct proc_handle {
pid_t pid; /* Process ID. */
- int kq; /* Kernel event queue ID. */
int flags; /* Process flags. */
int status; /* Process status (PS_*). */
int wstat; /* Process wait status. */
+ int model; /* Process data model. */
rd_agent_t *rdap; /* librtld_db agent */
- rd_loadobj_t *rdobjs;
- 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. */
+ rd_loadobj_t *rdobjs; /* Array of loaded objects. */
+ size_t rdobjsz; /* Array size. */
+ size_t nobjs; /* Num. objects currently loaded. */
+ rd_loadobj_t *rdexec; /* rdobj for program executable. */
+ struct lwpstatus lwps; /* Process status. */
+ struct procstat *procstat; /* libprocstat handle. */
+ char execpath[MAXPATHLEN]; /* Path to program executable. */
};
#ifdef DEBUG
Modified: user/alc/PQ_LAUNDRY/lib/libproc/libproc.h
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libproc/libproc.h Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libproc/libproc.h Mon Aug 1 21:28:34 2016 (r303642)
@@ -113,6 +113,9 @@ typedef struct lwpstatus {
#define FLTBPT -1
} lwpstatus_t;
+#define PR_MODEL_ILP32 1
+#define PR_MODEL_LP64 2
+
/* Function prototype definitions. */
__BEGIN_DECLS
@@ -136,6 +139,7 @@ int proc_name2sym(struct proc_handle *,
struct ctf_file *proc_name2ctf(struct proc_handle *, const char *);
int proc_setflags(struct proc_handle *, int);
int proc_state(struct proc_handle *);
+int proc_getmodel(struct proc_handle *);
pid_t proc_getpid(struct proc_handle *);
int proc_wstatus(struct proc_handle *);
int proc_getwstat(struct proc_handle *);
Modified: user/alc/PQ_LAUNDRY/lib/libproc/proc_create.c
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libproc/proc_create.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libproc/proc_create.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <sys/sysctl.h>
+#include <sys/user.h>
#include <sys/wait.h>
#include <err.h>
@@ -38,57 +39,103 @@
#include <string.h>
#include <unistd.h>
+#include <libelf.h>
+#include <libprocstat.h>
+
#include "_libproc.h"
-static int proc_init(pid_t, int, int, struct proc_handle *);
+static int getelfclass(int);
+static int proc_init(pid_t, int, int, struct proc_handle **);
+
+static int
+getelfclass(int fd)
+{
+ GElf_Ehdr ehdr;
+ Elf *e;
+ int class;
+
+ class = ELFCLASSNONE;
+
+ if ((e = elf_begin(fd, ELF_C_READ, NULL)) == NULL)
+ goto out;
+ if (gelf_getehdr(e, &ehdr) == NULL)
+ goto out;
+ class = ehdr.e_ident[EI_CLASS];
+out:
+ (void)elf_end(e);
+ return (class);
+}
static int
-proc_init(pid_t pid, int flags, int status, struct proc_handle *phdl)
+proc_init(pid_t pid, int flags, int status, struct proc_handle **pphdl)
{
- int mib[4], error;
- size_t len;
+ struct kinfo_proc *kp;
+ struct proc_handle *phdl;
+ int error, class, count, fd;
+
+ *pphdl = NULL;
+ if ((phdl = malloc(sizeof(*phdl))) == NULL)
+ return (ENOMEM);
memset(phdl, 0, sizeof(*phdl));
phdl->pid = pid;
phdl->flags = flags;
phdl->status = status;
+ phdl->procstat = procstat_open_sysctl();
+ if (phdl->procstat == NULL)
+ return (ENOMEM);
- 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);
+ /* Obtain a path to the executable. */
+ if ((kp = procstat_getprocs(phdl->procstat, KERN_PROC_PID, pid,
+ &count)) == NULL)
+ return (ENOMEM);
+ error = procstat_getpathname(phdl->procstat, kp, phdl->execpath,
+ sizeof(phdl->execpath));
+ procstat_freeprocs(phdl->procstat, kp);
+ if (error != 0)
return (error);
+
+ /* Use it to determine the data model for the process. */
+ if ((fd = open(phdl->execpath, O_RDONLY)) < 0) {
+ error = errno;
+ goto out;
}
- if (len == 0)
- phdl->execname[0] = '\0';
+ class = getelfclass(fd);
+ switch (class) {
+ case ELFCLASS64:
+ phdl->model = PR_MODEL_LP64;
+ break;
+ case ELFCLASS32:
+ phdl->model = PR_MODEL_ILP32;
+ break;
+ case ELFCLASSNONE:
+ default:
+ error = EINVAL;
+ break;
+ }
+ (void)close(fd);
- return (0);
+out:
+ *pphdl = phdl;
+ return (error);
}
int
proc_attach(pid_t pid, int flags, struct proc_handle **pphdl)
{
struct proc_handle *phdl;
- int error = 0;
- int status;
+ int error, status;
if (pid == 0 || pid == getpid())
return (EINVAL);
+ if (elf_version(EV_CURRENT) == EV_NONE)
+ return (ENOENT);
/*
* Allocate memory for the process handle, a structure containing
* all things related to the process.
*/
- if ((phdl = malloc(sizeof(struct proc_handle))) == NULL)
- return (ENOMEM);
-
- elf_version(EV_CURRENT);
-
- error = proc_init(pid, flags, PS_RUN, phdl);
+ error = proc_init(pid, flags, PS_RUN, &phdl);
if (error != 0)
goto out;
@@ -106,16 +153,17 @@ proc_attach(pid_t pid, int flags, struct
}
/* Check for an unexpected status. */
- if (WIFSTOPPED(status) == 0)
+ if (!WIFSTOPPED(status))
DPRINTFX("ERROR: child process %d status 0x%x", pid, status);
else
phdl->status = PS_STOP;
out:
- if (error)
+ if (error && phdl != NULL) {
proc_free(phdl);
- else
- *pphdl = phdl;
+ phdl = NULL;
+ }
+ *pphdl = phdl;
return (error);
}
@@ -128,14 +176,8 @@ proc_create(const char *file, char * con
int status;
pid_t pid;
- /*
- * Allocate memory for the process handle, a structure containing
- * all things related to the process.
- */
- if ((phdl = malloc(sizeof(struct proc_handle))) == NULL)
- return (ENOMEM);
-
- elf_version(EV_CURRENT);
+ if (elf_version(EV_CURRENT) == EV_NONE)
+ return (ENOENT);
/* Fork a new process. */
if ((pid = vfork()) == -1)
@@ -153,9 +195,10 @@ proc_create(const char *file, char * con
/* Couldn't execute the file. */
_exit(2);
+ /* NOTREACHED */
} else {
/* The parent owns the process handle. */
- error = proc_init(pid, 0, PS_IDLE, phdl);
+ error = proc_init(pid, 0, PS_IDLE, &phdl);
if (error != 0)
goto bad;
@@ -167,7 +210,7 @@ proc_create(const char *file, char * con
}
/* Check for an unexpected status. */
- if (WIFSTOPPED(status) == 0) {
+ if (!WIFSTOPPED(status)) {
error = errno;
DPRINTFX("ERROR: child process %d status 0x%x", pid, status);
goto bad;
@@ -175,15 +218,19 @@ proc_create(const char *file, char * con
phdl->status = PS_STOP;
}
bad:
- if (error)
+ if (error && phdl != NULL) {
proc_free(phdl);
- else
- *pphdl = phdl;
+ phdl = NULL;
+ }
+ *pphdl = phdl;
return (error);
}
void
proc_free(struct proc_handle *phdl)
{
+
+ if (phdl->procstat != NULL)
+ procstat_close(phdl->procstat);
free(phdl);
}
Modified: user/alc/PQ_LAUNDRY/lib/libproc/proc_rtld.c
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libproc/proc_rtld.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libproc/proc_rtld.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -49,7 +49,7 @@ map_iter(const rd_loadobj_t *lop, void *
if (phdl->rdobjs == NULL)
return (-1);
}
- if (strcmp(lop->rdl_path, phdl->execname) == 0 &&
+ if (strcmp(lop->rdl_path, phdl->execpath) == 0 &&
(lop->rdl_prot & RD_RDL_X) != 0)
phdl->rdexec = &phdl->rdobjs[phdl->nobjs];
memcpy(&phdl->rdobjs[phdl->nobjs++], lop, sizeof(*lop));
Modified: user/alc/PQ_LAUNDRY/lib/libproc/proc_util.c
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libproc/proc_util.c Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/libproc/proc_util.c Mon Aug 1 21:28:34 2016 (r303642)
@@ -140,6 +140,16 @@ proc_getpid(struct proc_handle *phdl)
}
int
+proc_getmodel(struct proc_handle *phdl)
+{
+
+ if (phdl == NULL)
+ return (-1);
+
+ return (phdl->model);
+}
+
+int
proc_wstatus(struct proc_handle *phdl)
{
int status;
Modified: user/alc/PQ_LAUNDRY/lib/librtld_db/Makefile
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/librtld_db/Makefile Mon Aug 1 21:21:26 2016 (r303641)
+++ user/alc/PQ_LAUNDRY/lib/librtld_db/Makefile Mon Aug 1 21:28:34 2016 (r303642)
@@ -14,4 +14,6 @@ CFLAGS+= -I${.CURDIR}
# Avoid circular dependency, we only need the libproc.h header here.
CFLAGS+= -I${.CURDIR:H}/libproc
+LIBADD+= elf procstat
+
.include <bsd.lib.mk>
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-user
mailing list