Merge ^/head r352537 through r352586.

This commit is contained in:
Dimitry Andric 2019-09-21 21:02:57 +00:00
commit f05b9584fa
38 changed files with 230 additions and 136 deletions

View File

@ -2835,6 +2835,7 @@ _lib_casper= lib/libcasper
lib/libpjdlog__L: lib/libutil__L
lib/libcasper__L: lib/libnv__L
lib/liblzma__L: lib/libthr__L
lib/libzstd__L: lib/libthr__L
_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib
.if ${MK_IPFILTER} != "no"

View File

@ -1289,13 +1289,11 @@ dump_snapshot(zfs_handle_t *zhp, void *arg)
fromorigin = sdd->prevsnap[0] == '\0' &&
(sdd->fromorigin || sdd->replicate);
if (sdd->progress && sdd->dryrun) {
if (sdd->verbose || sdd->progress) {
(void) estimate_ioctl(zhp, sdd->prevsnap_obj,
fromorigin, flags, &size);
sdd->size += size;
}
if (sdd->verbose) {
send_print_verbose(fout, zhp->zfs_name,
sdd->prevsnap[0] ? sdd->prevsnap : NULL,
size, sdd->parsable);
@ -1663,7 +1661,7 @@ zfs_send_resume(libzfs_handle_t *hdl, sendflags_t *flags, int outfd,
fromname = name;
}
if (flags->progress) {
if (flags->progress || flags->verbose) {
error = lzc_send_space(zhp->zfs_name, fromname,
lzc_flags, &size);
if (error == 0)
@ -1933,7 +1931,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
sdd.cleanup_fd = -1;
sdd.snapholds = NULL;
}
if (flags->progress || sdd.snapholds != NULL) {
if (flags->progress || flags->verbose || sdd.snapholds != NULL) {
/*
* Do a verbose no-op dry run to get all the verbose output
* or to gather snapshot hold's before generating any data,

View File

@ -999,7 +999,7 @@ ntpdmain(
# if defined(HAVE_MLOCKALL)
# ifdef HAVE_SETRLIMIT
ntp_rlimit(RLIMIT_STACK, DFLT_RLIMIT_STACK * 4096, 4096, "4k");
# ifdef RLIMIT_MEMLOCK
# if defined(RLIMIT_MEMLOCK) && defined(DFLT_RLIMIT_MEMLOCK) && DFLT_RLIMIT_MEMLOCK != -1
/*
* The default RLIMIT_MEMLOCK is very low on Linux systems.
* Unless we increase this limit malloc calls are likely to

View File

@ -28,7 +28,7 @@
.\" @(#)ascii.7 8.1 (Berkeley) 6/5/93
.\" $FreeBSD$
.\"
.Dd October 30, 2017
.Dd September 21, 2019
.Dt ASCII 7
.Os
.Sh NAME
@ -146,8 +146,15 @@ ESC ; [ { 11011
.Bl -tag -width /usr/share/misc/ascii -compact
.It Pa /usr/share/misc/ascii
.El
.Sh STANDARDS
.Rs
.%T Information Systems - Coded Character Sets - 7-Bit American National\
Standard Code for Information Interchange (7-Bit ASCII)
.%R INCITS 4-1986[R2017]
.%Q InterNational Committee for Information Technology Standards
.Re
.Sh HISTORY
An
.Nm
manual page appeared in
.At v7 .
.At v2 .

View File

@ -27,12 +27,14 @@
marker task-color.4th
\ This function returns FALSE if the `loader_color' environment variable is set
\ to NO, no, or 0. Otherwise, TRUE is returned (unless booting serial).
\ to NO, no, or 0. It returns TRUE if `loader_color' is set to any other value.
\ If `loader_color' is unset, TRUE is returned (unless booting serial).
\
: loader_color? ( -- N )
: loader_color? ( -- t )
s" loader_color" getenv dup -1 <> if
\ `loader_color' is set.
\ Check if it is explicitly disabled.
2dup s" NO" compare-insensitive 0= if
2drop
FALSE exit
@ -42,8 +44,12 @@ marker task-color.4th
FALSE exit
then
drop
then
\ It is enabled.
TRUE
else
\ `loader_color' is unset.
\ Default to using color unless serial boot is active.
drop
boot_serial? if FALSE else TRUE then
boot_serial? 0=
then
;

View File

@ -125,7 +125,8 @@ znalloc(MemPool *mp, uintptr_t bytes, size_t align)
continue;
/*
* Cut extra from head and create new memory node from reminder.
* Cut extra from head and create new memory node from
* remainder.
*/
if (extra != 0) {

View File

@ -49,9 +49,7 @@ color.DIM = 2
function color.isEnabled()
local c = loader.getenv("loader_color")
if c ~= nil then
if c:lower() == "no" or c == "0" then
return false
end
return c:lower() ~= "no" and c ~= "0"
end
return not core.isSerialBoot()
end

View File

@ -13,6 +13,7 @@ LOADER_BZIP2_SUPPORT?= no
BINDIR= /boot/uboot
PROG= ubldr
STRIP=
NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH}
INSTALLFLAGS= -b

View File

@ -10030,13 +10030,13 @@ sysctl_kmaps_dump(struct sbuf *sb, struct pmap_kernel_map_range *range,
mode = "WC";
break;
default:
printf("%s: unknown PAT mode %#x for range %#016lx-%#016lx\n",
printf("%s: unknown PAT mode %#x for range 0x%016lx-0x%016lx\n",
__func__, i, range->sva, eva);
mode = "??";
break;
}
sbuf_printf(sb, "%#016lx-%#016lx r%c%c%c%c %s %d %d %d\n",
sbuf_printf(sb, "0x%016lx-0x%016lx r%c%c%c%c %s %d %d %d\n",
range->sva, eva,
(range->attrs & X86_PG_RW) != 0 ? 'w' : '-',
(range->attrs & pg_nx) != 0 ? '-' : 'x',
@ -10271,25 +10271,25 @@ DB_SHOW_COMMAND(pte, pmap_print_pte)
PG_V = pmap_valid_bit(pmap);
pml4 = pmap_pml4e(pmap, va);
db_printf("VA %#016lx pml4e %#016lx", va, *pml4);
db_printf("VA 0x%016lx pml4e 0x%016lx", va, *pml4);
if ((*pml4 & PG_V) == 0) {
db_printf("\n");
return;
}
pdp = pmap_pml4e_to_pdpe(pml4, va);
db_printf(" pdpe %#016lx", *pdp);
db_printf(" pdpe 0x%016lx", *pdp);
if ((*pdp & PG_V) == 0 || (*pdp & PG_PS) != 0) {
db_printf("\n");
return;
}
pde = pmap_pdpe_to_pde(pdp, va);
db_printf(" pde %#016lx", *pde);
db_printf(" pde 0x%016lx", *pde);
if ((*pde & PG_V) == 0 || (*pde & PG_PS) != 0) {
db_printf("\n");
return;
}
pte = pmap_pde_to_pte(pde, va);
db_printf(" pte %#016lx\n", *pte);
db_printf(" pte 0x%016lx\n", *pte);
}
DB_SHOW_COMMAND(phys2dmap, pmap_phys2dmap)

View File

@ -5810,23 +5810,33 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far)
case ISS_DATA_DFSC_TF_L1:
case ISS_DATA_DFSC_TF_L2:
case ISS_DATA_DFSC_TF_L3:
/*
* Retry the translation. A break-before-make sequence can
* produce a transient fault.
*/
if (pmap == kernel_pmap) {
/*
* The translation fault may have occurred within a
* critical section. Therefore, we must check the
* address without acquiring the kernel pmap's lock.
*/
if (pmap_kextract(far) != 0)
rv = KERN_SUCCESS;
} else {
PMAP_LOCK(pmap);
/* Ask the MMU to check the address */
/* Ask the MMU to check the address. */
intr = intr_disable();
if (pmap == kernel_pmap)
par = arm64_address_translate_s1e1r(far);
else
par = arm64_address_translate_s1e0r(far);
intr_restore(intr);
PMAP_UNLOCK(pmap);
/*
* If the translation was successful the address was invalid
* due to a break-before-make sequence. We can unlock and
* If the translation was successful, then we can
* return success to the trap handler.
*/
if (PAR_SUCCESS(par))
rv = KERN_SUCCESS;
}
break;
}

View File

@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/domainset.h>
#include <sys/fail.h>
#include <sys/ioccom.h>
#include <sys/kernel.h>
@ -44,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/rman.h>
#include <sys/sbuf.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <sys/time.h>
@ -266,6 +268,11 @@ ioat_attach(device_t device)
ioat = DEVICE2SOFTC(device);
ioat->device = device;
if (bus_get_domain(device, &ioat->domain) != 0)
ioat->domain = 0;
ioat->cpu = CPU_FFS(&cpuset_domain[ioat->domain]) - 1;
if (ioat->cpu < 0)
ioat->cpu = CPU_FIRST();
error = ioat_map_pci_bar(ioat);
if (error != 0)
@ -600,8 +607,8 @@ ioat3_attach(device_t device)
__func__, error);
return (error);
}
ioat->ring = malloc(num_descriptors * sizeof(*ring), M_IOAT,
M_ZERO | M_WAITOK);
ioat->ring = malloc_domainset(num_descriptors * sizeof(*ring), M_IOAT,
DOMAINSET_PREF(ioat->domain), M_ZERO | M_WAITOK);
ring = ioat->ring;
for (i = 0; i < num_descriptors; i++) {
@ -1107,8 +1114,8 @@ ioat_release(bus_dmaengine_t dmaengine)
(uint16_t)ioat->head);
if (!callout_pending(&ioat->poll_timer)) {
callout_reset(&ioat->poll_timer, 1,
ioat_poll_timer_callback, ioat);
callout_reset_on(&ioat->poll_timer, 1,
ioat_poll_timer_callback, ioat, ioat->cpu);
}
}
mtx_unlock(&ioat->submit_lock);
@ -1644,7 +1651,7 @@ ioat_free_ring(struct ioat_softc *ioat, uint32_t size,
struct ioat_descriptor *ring)
{
free(ring, M_IOAT);
free_domain(ring, M_IOAT);
}
static struct ioat_descriptor *

View File

@ -442,6 +442,8 @@ struct ioat_softc {
})
device_t device;
int domain;
int cpu;
int version;
unsigned chan_idx;

View File

@ -601,6 +601,9 @@ xhci_init(struct xhci_softc *sc, device_t self, uint8_t dma32)
device_printf(self, "%d bytes context size, %d-bit DMA\n",
sc->sc_ctx_is_64_byte ? 64 : 32, (int)sc->sc_bus.dma_bits);
/* enable 64Kbyte control endpoint quirk */
sc->sc_bus.control_ep_quirk = 1;
temp = XREAD4(sc, capa, XHCI_HCSPARAMS1);
/* get number of device slots */
@ -2003,7 +2006,7 @@ xhci_setup_generic_chain_sub(struct xhci_std_temp *temp)
/* clear TD SIZE to zero, hence this is the last TRB */
/* remove chain bit because this is the last data TRB in the chain */
td->td_trb[td->ntrb - 1].dwTrb2 &= ~htole32(XHCI_TRB_2_TDSZ_SET(15));
td->td_trb[td->ntrb - 1].dwTrb2 &= ~htole32(XHCI_TRB_2_TDSZ_SET(31));
td->td_trb[td->ntrb - 1].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT);
/* remove CHAIN-BIT from last LINK TRB */
td->td_trb[td->ntrb].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT);

View File

@ -131,6 +131,7 @@ struct usb_bus {
uint8_t do_probe; /* set if USB should be re-probed */
uint8_t no_explore; /* don't explore USB ports */
uint8_t dma_bits; /* number of DMA address lines */
uint8_t control_ep_quirk; /* need 64kByte buffer for data stage */
};
#endif /* _USB_BUS_H_ */

View File

@ -224,7 +224,7 @@ struct usb_fs_uninit {
} USB_IOCTL_STRUCT_ALIGN(1);
struct usb_fs_open {
#define USB_FS_MAX_BUFSIZE (1 << 18)
#define USB_FS_MAX_BUFSIZE (1 << 25) /* 32 MBytes */
uint32_t max_bufsize;
#define USB_FS_MAX_FRAMES (1U << 12)
#define USB_FS_MAX_FRAMES_PRE_SCALE (1U << 31) /* for ISOCHRONOUS transfers */

View File

@ -106,6 +106,33 @@ static const struct usb_config usb_control_ep_cfg[USB_CTRL_XFER_MAX] = {
},
};
static const struct usb_config usb_control_ep_quirk_cfg[USB_CTRL_XFER_MAX] = {
/* This transfer is used for generic control endpoint transfers */
[0] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control endpoint */
.direction = UE_DIR_ANY,
.bufsize = 65535, /* bytes */
.callback = &usb_request_callback,
.usb_mode = USB_MODE_DUAL, /* both modes */
},
/* This transfer is used for generic clear stall only */
[1] = {
.type = UE_CONTROL,
.endpoint = 0x00, /* Control pipe */
.direction = UE_DIR_ANY,
.bufsize = sizeof(struct usb_device_request),
.callback = &usb_do_clear_stall_callback,
.timeout = 1000, /* 1 second */
.interval = 50, /* 50ms */
.usb_mode = USB_MODE_HOST,
},
};
/* function prototypes */
static void usbd_update_max_frame_size(struct usb_xfer *);
@ -1021,7 +1048,8 @@ usbd_transfer_setup(struct usb_device *udev,
* context, else there is a chance of
* deadlock!
*/
if (setup_start == usb_control_ep_cfg)
if (setup_start == usb_control_ep_cfg ||
setup_start == usb_control_ep_quirk_cfg)
info->done_p =
USB_BUS_CONTROL_XFER_PROC(udev->bus);
else if (xfer_mtx == &Giant)
@ -3149,7 +3177,8 @@ usbd_ctrl_transfer_setup(struct usb_device *udev)
*/
iface_index = 0;
if (usbd_transfer_setup(udev, &iface_index,
udev->ctrl_xfer, usb_control_ep_cfg, USB_CTRL_XFER_MAX, NULL,
udev->ctrl_xfer, udev->bus->control_ep_quirk ?
usb_control_ep_quirk_cfg : usb_control_ep_cfg, USB_CTRL_XFER_MAX, NULL,
&udev->device_mtx)) {
DPRINTFN(0, "could not setup default "
"USB transfer\n");

View File

@ -79,7 +79,7 @@ de_vncmpf(struct vnode *vp, void *arg)
a = arg;
de = VTODE(vp);
return (de->de_inode != *a);
return (de->de_inode != *a) || (de->de_refcnt <= 0);
}
/*
@ -124,8 +124,9 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset,
* address of "." entry. For root dir (if not FAT32) use cluster
* MSDOSFSROOT, offset MSDOSFSROOT_OFS
*
* NOTE: The check for de_refcnt > 0 below insures the denode being
* examined does not represent an unlinked but still open file.
* NOTE: de_vncmpf will explicitly skip any denodes that do not have
* a de_refcnt > 0. This insures that that we do not attempt to use
* a denode that represents an unlinked but still open file.
* These files are not to be accessible even when the directory
* entry that represented the file happens to be reused while the
* deleted file is still open.

View File

@ -135,6 +135,27 @@ SYSCTL_INT(_kern_elf32, OID_AUTO, read_exec, CTLFLAG_RW, &i386_read_exec, 0,
"enable execution from readable segments");
#endif
static u_long __elfN(pie_base) = ET_DYN_LOAD_ADDR;
static int
sysctl_pie_base(SYSCTL_HANDLER_ARGS)
{
u_long val;
int error;
val = __elfN(pie_base);
error = sysctl_handle_long(oidp, &val, 0, req);
if (error != 0 || req->newptr == NULL)
return (error);
if ((val & PAGE_MASK) != 0)
return (EINVAL);
__elfN(pie_base) = val;
return (0);
}
SYSCTL_PROC(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, pie_base,
CTLTYPE_ULONG | CTLFLAG_MPSAFE | CTLFLAG_RW, NULL, 0,
sysctl_pie_base, "LU",
"PIE load base without randomization");
SYSCTL_NODE(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, aslr, CTLFLAG_RW, 0,
"");
#define ASLR_NODE_OID __CONCAT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), _aslr)
@ -1146,13 +1167,13 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
if (baddr == 0) {
if ((sv->sv_flags & SV_ASLR) == 0 ||
(fctl0 & NT_FREEBSD_FCTL_ASLR_DISABLE) != 0)
et_dyn_addr = ET_DYN_LOAD_ADDR;
et_dyn_addr = __elfN(pie_base);
else if ((__elfN(pie_aslr_enabled) &&
(imgp->proc->p_flag2 & P2_ASLR_DISABLE) == 0) ||
(imgp->proc->p_flag2 & P2_ASLR_ENABLE) != 0)
et_dyn_addr = ET_DYN_ADDR_RAND;
else
et_dyn_addr = ET_DYN_LOAD_ADDR;
et_dyn_addr = __elfN(pie_base);
}
}

View File

@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/callout.h>
#include <sys/domainset.h>
#include <sys/file.h>
#include <sys/interrupt.h>
#include <sys/kernel.h>
@ -325,8 +326,9 @@ callout_cpu_init(struct callout_cpu *cc, int cpu)
mtx_init(&cc->cc_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE);
SLIST_INIT(&cc->cc_callfree);
cc->cc_inited = 1;
cc->cc_callwheel = malloc(sizeof(struct callout_list) * callwheelsize,
M_CALLOUT, M_WAITOK);
cc->cc_callwheel = malloc_domainset(sizeof(struct callout_list) *
callwheelsize, M_CALLOUT,
DOMAINSET_PREF(pcpu_find(cpu)->pc_domain), M_WAITOK);
for (i = 0; i < callwheelsize; i++)
LIST_INIT(&cc->cc_callwheel[i]);
TAILQ_INIT(&cc->cc_expireq);

View File

@ -287,7 +287,7 @@ lock_prof_init(void *arg)
{
int cpu;
for (cpu = 0; cpu <= mp_maxid; cpu++) {
CPU_FOREACH(cpu) {
lp_cpu[cpu] = malloc(sizeof(*lp_cpu[cpu]), M_DEVBUF,
M_WAITOK | M_ZERO);
lock_prof_init_type(&lp_cpu[cpu]->lpc_types[0]);
@ -330,14 +330,14 @@ lock_prof_reset(void)
* before we zero the structures. Some items may still be linked
* into per-thread lists as well.
*/
for (cpu = 0; cpu <= mp_maxid; cpu++) {
CPU_FOREACH(cpu) {
lpc = lp_cpu[cpu];
for (i = 0; i < LPROF_CACHE_SIZE; i++) {
LIST_REMOVE(&lpc->lpc_types[0].lpt_objs[i], lpo_link);
LIST_REMOVE(&lpc->lpc_types[1].lpt_objs[i], lpo_link);
}
}
for (cpu = 0; cpu <= mp_maxid; cpu++) {
CPU_FOREACH(cpu) {
lpc = lp_cpu[cpu];
bzero(lpc, sizeof(*lpc));
lock_prof_init_type(&lpc->lpc_types[0]);
@ -378,9 +378,7 @@ lock_prof_sum(struct lock_prof *match, struct lock_prof *dst, int hash,
dst->class = match->class;
dst->name = match->name;
for (cpu = 0; cpu <= mp_maxid; cpu++) {
if (lp_cpu[cpu] == NULL)
continue;
CPU_FOREACH(cpu) {
type = &lp_cpu[cpu]->lpc_types[spin];
SLIST_FOREACH(l, &type->lpt_hash[hash], link) {
if (l->ticks == t)
@ -399,7 +397,6 @@ lock_prof_sum(struct lock_prof *match, struct lock_prof *dst, int hash,
dst->cnt_contest_locking += l->cnt_contest_locking;
}
}
}
static void
@ -438,9 +435,7 @@ dump_lock_prof_stats(SYSCTL_HANDLER_ARGS)
lock_prof_enable = 0;
quiesce_all_cpus("profstat", 0);
t = ticks;
for (cpu = 0; cpu <= mp_maxid; cpu++) {
if (lp_cpu[cpu] == NULL)
continue;
CPU_FOREACH(cpu) {
lock_prof_type_stats(&lp_cpu[cpu]->lpc_types[0], sb, 0, t);
lock_prof_type_stats(&lp_cpu[cpu]->lpc_types[1], sb, 1, t);
}

View File

@ -349,7 +349,7 @@ ktls_init(void *dummy __unused)
STAILQ_INIT(&ktls_wq[i].head);
mtx_init(&ktls_wq[i].mtx, "ktls work queue", NULL, MTX_DEF);
error = kproc_kthread_add(ktls_work_thread, &ktls_wq[i],
&ktls_proc, &td, 0, 0, "KTLS", "ktls_thr_%d", i);
&ktls_proc, &td, 0, 0, "KTLS", "thr_%d", i);
if (error)
panic("Can't add KTLS thread %d error %d", i, error);

View File

@ -157,7 +157,7 @@ vfs_mount_init(void *dummy __unused)
{
mount_zone = uma_zcreate("Mountpoints", sizeof(struct mount), NULL,
NULL, mount_init, mount_fini, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
NULL, mount_init, mount_fini, UMA_ALIGN_CACHE, UMA_ZONE_NOFREE);
}
SYSINIT(vfs_mount, SI_SUB_VFS, SI_ORDER_ANY, vfs_mount_init, NULL);

View File

@ -703,6 +703,7 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset,
if (param_length <= sizeof(struct sctp_paramhdr)) {
SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: param length (%u) too short\n", param_length);
sctp_m_freem(m_ack);
return;
}
/* get the entire parameter */
aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, param_length, aparam_buf);

View File

@ -769,6 +769,12 @@ typedef struct {
#define LL_DELAY_LOAD 0x10
#define LL_DELTA 0x20
/* Note section names */
#define ELF_NOTE_FREEBSD "FreeBSD"
#define ELF_NOTE_NETBSD "NetBSD"
#define ELF_NOTE_SOLARIS "SUNW Solaris"
#define ELF_NOTE_GNU "GNU"
/* Values for n_type used in executables. */
#define NT_FREEBSD_ABI_TAG 1
#define NT_FREEBSD_NOINIT_TAG 2

View File

@ -226,7 +226,7 @@ struct mount {
struct lock mnt_explock; /* vfs_export walkers lock */
TAILQ_ENTRY(mount) mnt_upper_link; /* (m) we in the all uppers */
TAILQ_HEAD(, mount) mnt_uppers; /* (m) upper mounts over us*/
int mnt_vfs_ops; /* (i) pending vfs ops */
int __aligned(CACHE_LINE_SIZE) mnt_vfs_ops;/* (i) pending vfs ops */
int *mnt_thread_in_ops_pcpu;
int *mnt_ref_pcpu;
int *mnt_lockref_pcpu;

View File

@ -28,7 +28,7 @@
.\" @(#)jot.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
.Dd April 7, 2015
.Dd September 21, 2019
.Dt JOT 1
.Os
.Sh NAME
@ -108,14 +108,16 @@ Any three of these arguments determines the fourth.
If four are specified and the given and computed values of
.Ar reps
conflict, the lower value is used.
If fewer than three are specified, defaults are assigned
left to right, except for
If one or two are specified, defaults are assigned
starting with
.Ar s ,
which assumes a default of 1 or -1 if both
which assumes a default of 1 (or -1 if
.Ar begin
and
.Ar end
are given.
specify a descending range).
Then the default values are assigned to the leftmost omitted arguments until
three arguments are set.
.Pp
Defaults for the four arguments are, respectively,
100, 1, 100, and 1, except that when random data are requested,

View File

@ -606,7 +606,7 @@ getnfsquota(struct statfs *fst, struct quotause *qup, long id, int quotatype)
call_stat = callaurpc(host, RQUOTAPROG, EXT_RQUOTAVERS,
RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_ext_getquota_args, (char *)&gq_args,
(xdrproc_t)xdr_getquota_rslt, (char *)&gq_rslt);
if (call_stat == RPC_PROGVERSMISMATCH) {
if (call_stat == RPC_PROGVERSMISMATCH || call_stat == RPC_PROGNOTREGISTERED) {
if (quotatype == USRQUOTA) {
old_gq_args.gqa_pathp = cp + 1;
old_gq_args.gqa_uid = id;

View File

@ -1291,31 +1291,6 @@ line_update(char *old, char *new, int start, int line)
}
}
/*
* printable(str) - make the string pointed to by "str" into one that is
* printable (i.e.: all ascii), by converting all non-printable
* characters into '?'. Replacements are done in place and a pointer
* to the original buffer is returned.
*/
char *
printable(char str[])
{
char *ptr;
char ch;
ptr = str;
while ((ch = *ptr) != '\0')
{
if (!isprint(ch))
{
*ptr = '?';
}
ptr++;
}
return(str);
}
void
i_uptime(struct timeval *bt, time_t *tod)
{

View File

@ -11,7 +11,6 @@ int display_updatecpus(struct statics *statics);
void clear_message(void);
int display_resize(void);
void i_header(const char *text);
char *printable(char *string);
void display_header(int t);
int display_init(struct statics *statics);
void i_arc(int *stats);

View File

@ -1003,7 +1003,7 @@ format_next_process(struct handle * xhandle, char *(*get_userid)(int), int flags
len = (argbuflen - (dst - argbuf) - 1) / 4;
strvisx(dst, src,
MIN(strlen(src), len),
VIS_NL | VIS_CSTYLE);
VIS_NL | VIS_CSTYLE | VIS_OCTAL | VIS_SAFE);
while (*dst != '\0')
dst++;
if ((argbuflen - (dst - argbuf) - 1) / 4 > 0)
@ -1102,7 +1102,7 @@ format_next_process(struct handle * xhandle, char *(*get_userid)(int), int flags
sbuf_printf(procbuf, "%6s ", format_time(cputime));
sbuf_printf(procbuf, "%6.2f%% ", ps.wcpu ? 100.0 * weighted_cpu(PCTCPU(pp), pp) : 100.0 * PCTCPU(pp));
}
sbuf_printf(procbuf, "%s", printable(cmdbuf));
sbuf_printf(procbuf, "%s", cmdbuf);
free(cmdbuf);
return (sbuf_data(procbuf));
}

View File

@ -1,5 +1,5 @@
.\" $FreeBSD$
.Dd October 2, 2018
.Dd September 21, 2019
.Dt TOP 1
.Os
.Sh NAME
@ -66,6 +66,9 @@ It it useful when you want to watch applications, that
puts their status information there.
If the real name differs from argv[0],
it will be displayed in parenthesis.
Non-printable characters in the command line are
encoded in C-style backslash sequences or
a three digit octal sequences.
.It Fl b
Use \*(lqbatch\*(rq mode.
In this mode, all input from the terminal is
@ -422,6 +425,12 @@ bytes paged out to swap devices (last interval)
.It Ev TOP
Default set of arguments to
.Nm .
.It Ev LC_CTYPE
The locale to use when displaying the
.Va argv
vector when
.Fl a
flag is specified.
.El
.Sh SEE ALSO
.Xr kill 1 ,

View File

@ -25,6 +25,7 @@
#include <errno.h>
#include <getopt.h>
#include <jail.h>
#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@ -265,6 +266,11 @@ main(int argc, const char *argv[])
setbuffer(stdout, stdoutbuf, Buffersize);
#endif
if (setlocale(LC_ALL, "") == NULL) {
fprintf(stderr, "invalid locale.\n");
exit(1);
}
mypid = getpid();
/* get our name */

View File

@ -220,6 +220,14 @@ config_KeepModifiedMetadata () {
# Add to the list of components which should be kept updated.
config_Components () {
for C in $@; do
COMPONENTS="${COMPONENTS} ${C}"
done
}
# Remove src component from list if it isn't installed
finalize_components_config () {
COMPONENTS=""
for C in $@; do
if [ "$C" = "src" ]; then
if [ -e "${BASEDIR}/usr/src/COPYRIGHT" ]; then
@ -3284,6 +3292,7 @@ get_params () {
parse_cmdline $@
parse_conffile
default_params
finalize_components_config ${COMPONENTS}
}
# Fetch command. Make sure that we're being called

View File

@ -4,11 +4,12 @@ PROG= rpc.statd
MAN= rpc.statd.8
SRCS= file.c sm_inter_svc.c sm_inter.h statd.c procs.c
CFLAGS+= -I.
WARNS?= 2
CFLAGS+= -I${.OBJDIR}
LIBADD= rpcsvc
# XXX: mismatch between (xdrproc_t) and xdr_void().
WARNS?= 2
CLEANFILES= sm_inter_svc.c sm_inter.h
RPCSRC= ${SYSROOT:U${DESTDIR}}/usr/include/rpcsvc/sm_inter.x
@ -20,7 +21,8 @@ sm_inter_svc.c: ${RPCSRC}
sm_inter.h: ${RPCSRC}
${RPCGEN} -h -o ${.TARGET} ${.ALLSRC}
test: test.c
cc -o test test.c -lrpcsvc
test: test.o
${CC} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} ${LIBADD:S/^/-l/}
CLEANFILES+= test test.o
.include <bsd.prog.mk>

View File

@ -201,8 +201,8 @@ void init_file(const char *filename)
/* defective, re-create from scratch. */
if (!new_file)
{
if ((status_file_len < HEADER_LEN) || (status_file_len
< (HEADER_LEN + sizeof(HostInfo) * status_info->noOfHosts)) )
if ((status_file_len < (off_t)HEADER_LEN) || (status_file_len
< (off_t)(HEADER_LEN + sizeof(HostInfo) * status_info->noOfHosts)) )
{
warnx("status file is corrupt");
new_file = TRUE;

View File

@ -52,9 +52,10 @@ __FBSDID("$FreeBSD$");
#include "statd.h"
static const char *from_addr(struct sockaddr *);
static const char *
from_addr(saddr)
struct sockaddr *saddr;
from_addr(struct sockaddr *saddr)
{
static char inet_buf[INET6_ADDRSTRLEN];

View File

@ -62,9 +62,9 @@ __FBSDID("$FreeBSD$");
int debug = 0; /* Controls syslog() calls for debug messages */
char **hosts, *svcport_str = NULL;
int nhosts = 0;
int xcreated = 0;
static char **hosts, *svcport_str = NULL;
static int nhosts = 0;
static int xcreated = 0;
static int mallocd_svcport = 0;
static int *sock_fd;
static int sock_fdcnt;
@ -86,7 +86,8 @@ main(int argc, char **argv)
void *nc_handle;
in_port_t svcport;
int ch, i, s;
char *endptr, **hosts_bak;
char *endptr;
char **hosts_bak;
int have_v6 = 1;
int maxrec = RPC_MAXDATASIZE;
int attempt_cnt, port_len, port_pos, ret;
@ -156,7 +157,7 @@ main(int argc, char **argv)
if (hosts == NULL)
out_of_mem();
hosts[0] = "*";
hosts[0] = strdup("*");
nhosts = 1;
} else {
hosts_bak = hosts;
@ -172,7 +173,7 @@ main(int argc, char **argv)
hosts = hosts_bak;
nhosts += 2;
hosts[nhosts - 2] = "::1";
hosts[nhosts - 2] = strdup("::1");
} else {
hosts_bak = realloc(hosts, (nhosts + 1) * sizeof(char *));
if (hosts_bak == NULL) {
@ -186,7 +187,7 @@ main(int argc, char **argv)
hosts = hosts_bak;
}
}
hosts[nhosts - 1] = "127.0.0.1";
hosts[nhosts - 1] = strdup("127.0.0.1");
}
attempt_cnt = 1;

View File

@ -1,14 +1,14 @@
#ifndef lint
static const char rcsid[] =
"$FreeBSD$";
#endif /* not lint */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rpc/rpc.h>
#include <rpcsvc/sm_inter.h>
/* Default timeout can be changed using clnt_control() */
static struct timeval TIMEOUT = { 25, 0 };
@ -20,7 +20,8 @@ sm_stat_1(argp, clnt)
static struct sm_stat_res res;
bzero((char *)&res, sizeof(res));
if (clnt_call(clnt, SM_STAT, xdr_sm_name, argp, xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) {
if (clnt_call(clnt, SM_STAT, (xdrproc_t)xdr_sm_name, argp,
(xdrproc_t)xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
return (&res);
@ -35,7 +36,8 @@ sm_mon_1(argp, clnt)
static struct sm_stat_res res;
bzero((char *)&res, sizeof(res));
if (clnt_call(clnt, SM_MON, xdr_mon, argp, xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) {
if (clnt_call(clnt, SM_MON, (xdrproc_t)xdr_mon, argp,
(xdrproc_t)xdr_sm_stat_res, &res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
return (&res);
@ -50,7 +52,8 @@ sm_unmon_1(argp, clnt)
static struct sm_stat res;
bzero((char *)&res, sizeof(res));
if (clnt_call(clnt, SM_UNMON, xdr_mon_id, argp, xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) {
if (clnt_call(clnt, SM_UNMON, (xdrproc_t)xdr_mon_id, argp,
(xdrproc_t)xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
return (&res);
@ -65,7 +68,8 @@ sm_unmon_all_1(argp, clnt)
static struct sm_stat res;
bzero((char *)&res, sizeof(res));
if (clnt_call(clnt, SM_UNMON_ALL, xdr_my_id, argp, xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) {
if (clnt_call(clnt, SM_UNMON_ALL, (xdrproc_t)xdr_my_id, argp,
(xdrproc_t)xdr_sm_stat, &res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
return (&res);
@ -80,7 +84,8 @@ sm_simu_crash_1(argp, clnt)
static char res;
bzero((char *)&res, sizeof(res));
if (clnt_call(clnt, SM_SIMU_CRASH, xdr_void, argp, xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
if (clnt_call(clnt, SM_SIMU_CRASH, (xdrproc_t)xdr_void, argp,
(xdrproc_t)xdr_void, &res, TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
return ((void *)&res);
@ -119,26 +124,21 @@ int main(int argc, char **argv)
{
/* Hostname given */
struct sm_stat_res *res;
if (res = sm_mon_1(&mon, cli))
{
res = sm_mon_1(&mon, cli);
if (res)
printf("Success!\n");
}
else
{
printf("Fail\n");
}
}
else
{
if (out = sm_simu_crash_1(&dummy, cli))
{
out = sm_simu_crash_1(&dummy, cli);
if (out)
printf("Success!\n");
}
else
{
printf("Fail\n");
}
}
return 0;
}