Merge ^/head r352537 through r352586.

This commit is contained in:
Dimitry Andric 2019-09-21 21:02:57 +00:00
commit f05b9584fa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/clang900-import/; revision=352587
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/libpjdlog__L: lib/libutil__L
lib/libcasper__L: lib/libnv__L lib/libcasper__L: lib/libnv__L
lib/liblzma__L: lib/libthr__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 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib
.if ${MK_IPFILTER} != "no" .if ${MK_IPFILTER} != "no"

View File

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

View File

@ -999,7 +999,7 @@ ntpdmain(
# if defined(HAVE_MLOCKALL) # if defined(HAVE_MLOCKALL)
# ifdef HAVE_SETRLIMIT # ifdef HAVE_SETRLIMIT
ntp_rlimit(RLIMIT_STACK, DFLT_RLIMIT_STACK * 4096, 4096, "4k"); 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. * The default RLIMIT_MEMLOCK is very low on Linux systems.
* Unless we increase this limit malloc calls are likely to * Unless we increase this limit malloc calls are likely to

View File

@ -28,7 +28,7 @@
.\" @(#)ascii.7 8.1 (Berkeley) 6/5/93 .\" @(#)ascii.7 8.1 (Berkeley) 6/5/93
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd October 30, 2017 .Dd September 21, 2019
.Dt ASCII 7 .Dt ASCII 7
.Os .Os
.Sh NAME .Sh NAME
@ -146,8 +146,15 @@ ESC ; [ { 11011
.Bl -tag -width /usr/share/misc/ascii -compact .Bl -tag -width /usr/share/misc/ascii -compact
.It Pa /usr/share/misc/ascii .It Pa /usr/share/misc/ascii
.El .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 .Sh HISTORY
An An
.Nm .Nm
manual page appeared in manual page appeared in
.At v7 . .At v2 .

View File

@ -27,12 +27,14 @@
marker task-color.4th marker task-color.4th
\ This function returns FALSE if the `loader_color' environment variable is set \ 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 s" loader_color" getenv dup -1 <> if
\ `loader_color' is set.
\ Check if it is explicitly disabled.
2dup s" NO" compare-insensitive 0= if 2dup s" NO" compare-insensitive 0= if
2drop 2drop
FALSE exit FALSE exit
@ -42,8 +44,12 @@ marker task-color.4th
FALSE exit FALSE exit
then then
drop drop
\ It is enabled.
TRUE
else
\ `loader_color' is unset.
\ Default to using color unless serial boot is active.
drop
boot_serial? 0=
then then
drop
boot_serial? if FALSE else TRUE then
; ;

View File

@ -125,7 +125,8 @@ znalloc(MemPool *mp, uintptr_t bytes, size_t align)
continue; 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) { if (extra != 0) {

View File

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

View File

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

View File

@ -10030,13 +10030,13 @@ sysctl_kmaps_dump(struct sbuf *sb, struct pmap_kernel_map_range *range,
mode = "WC"; mode = "WC";
break; break;
default: 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); __func__, i, range->sva, eva);
mode = "??"; mode = "??";
break; 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->sva, eva,
(range->attrs & X86_PG_RW) != 0 ? 'w' : '-', (range->attrs & X86_PG_RW) != 0 ? 'w' : '-',
(range->attrs & pg_nx) != 0 ? '-' : 'x', (range->attrs & pg_nx) != 0 ? '-' : 'x',
@ -10271,25 +10271,25 @@ DB_SHOW_COMMAND(pte, pmap_print_pte)
PG_V = pmap_valid_bit(pmap); PG_V = pmap_valid_bit(pmap);
pml4 = pmap_pml4e(pmap, va); 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) { if ((*pml4 & PG_V) == 0) {
db_printf("\n"); db_printf("\n");
return; return;
} }
pdp = pmap_pml4e_to_pdpe(pml4, va); 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) { if ((*pdp & PG_V) == 0 || (*pdp & PG_PS) != 0) {
db_printf("\n"); db_printf("\n");
return; return;
} }
pde = pmap_pdpe_to_pde(pdp, va); 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) { if ((*pde & PG_V) == 0 || (*pde & PG_PS) != 0) {
db_printf("\n"); db_printf("\n");
return; return;
} }
pte = pmap_pde_to_pte(pde, va); 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) 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_L1:
case ISS_DATA_DFSC_TF_L2: case ISS_DATA_DFSC_TF_L2:
case ISS_DATA_DFSC_TF_L3: case ISS_DATA_DFSC_TF_L3:
PMAP_LOCK(pmap);
/* 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 * Retry the translation. A break-before-make sequence can
* due to a break-before-make sequence. We can unlock and * produce a transient fault.
* return success to the trap handler.
*/ */
if (PAR_SUCCESS(par)) if (pmap == kernel_pmap) {
rv = KERN_SUCCESS; /*
* 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. */
intr = intr_disable();
par = arm64_address_translate_s1e0r(far);
intr_restore(intr);
PMAP_UNLOCK(pmap);
/*
* If the translation was successful, then we can
* return success to the trap handler.
*/
if (PAR_SUCCESS(par))
rv = KERN_SUCCESS;
}
break; break;
} }

View File

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

View File

@ -442,6 +442,8 @@ struct ioat_softc {
}) })
device_t device; device_t device;
int domain;
int cpu;
int version; int version;
unsigned chan_idx; 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", 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); 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); temp = XREAD4(sc, capa, XHCI_HCSPARAMS1);
/* get number of device slots */ /* 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 */ /* clear TD SIZE to zero, hence this is the last TRB */
/* remove chain bit because this is the last data TRB in the chain */ /* 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); td->td_trb[td->ntrb - 1].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT);
/* remove CHAIN-BIT from last LINK TRB */ /* remove CHAIN-BIT from last LINK TRB */
td->td_trb[td->ntrb].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT); 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 do_probe; /* set if USB should be re-probed */
uint8_t no_explore; /* don't explore USB ports */ uint8_t no_explore; /* don't explore USB ports */
uint8_t dma_bits; /* number of DMA address lines */ uint8_t dma_bits; /* number of DMA address lines */
uint8_t control_ep_quirk; /* need 64kByte buffer for data stage */
}; };
#endif /* _USB_BUS_H_ */ #endif /* _USB_BUS_H_ */

View File

@ -224,7 +224,7 @@ struct usb_fs_uninit {
} USB_IOCTL_STRUCT_ALIGN(1); } USB_IOCTL_STRUCT_ALIGN(1);
struct usb_fs_open { struct usb_fs_open {
#define USB_FS_MAX_BUFSIZE (1 << 18) #define USB_FS_MAX_BUFSIZE (1 << 25) /* 32 MBytes */
uint32_t max_bufsize; uint32_t max_bufsize;
#define USB_FS_MAX_FRAMES (1U << 12) #define USB_FS_MAX_FRAMES (1U << 12)
#define USB_FS_MAX_FRAMES_PRE_SCALE (1U << 31) /* for ISOCHRONOUS transfers */ #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 */ /* function prototypes */
static void usbd_update_max_frame_size(struct usb_xfer *); 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 * context, else there is a chance of
* deadlock! * 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 = info->done_p =
USB_BUS_CONTROL_XFER_PROC(udev->bus); USB_BUS_CONTROL_XFER_PROC(udev->bus);
else if (xfer_mtx == &Giant) else if (xfer_mtx == &Giant)
@ -3149,7 +3177,8 @@ usbd_ctrl_transfer_setup(struct usb_device *udev)
*/ */
iface_index = 0; iface_index = 0;
if (usbd_transfer_setup(udev, &iface_index, 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)) { &udev->device_mtx)) {
DPRINTFN(0, "could not setup default " DPRINTFN(0, "could not setup default "
"USB transfer\n"); "USB transfer\n");

View File

@ -79,7 +79,7 @@ de_vncmpf(struct vnode *vp, void *arg)
a = arg; a = arg;
de = VTODE(vp); 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 * address of "." entry. For root dir (if not FAT32) use cluster
* MSDOSFSROOT, offset MSDOSFSROOT_OFS * MSDOSFSROOT, offset MSDOSFSROOT_OFS
* *
* NOTE: The check for de_refcnt > 0 below insures the denode being * NOTE: de_vncmpf will explicitly skip any denodes that do not have
* examined does not represent an unlinked but still open file. * 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 * These files are not to be accessible even when the directory
* entry that represented the file happens to be reused while the * entry that represented the file happens to be reused while the
* deleted file is still open. * 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"); "enable execution from readable segments");
#endif #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, 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) #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 (baddr == 0) {
if ((sv->sv_flags & SV_ASLR) == 0 || if ((sv->sv_flags & SV_ASLR) == 0 ||
(fctl0 & NT_FREEBSD_FCTL_ASLR_DISABLE) != 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) && else if ((__elfN(pie_aslr_enabled) &&
(imgp->proc->p_flag2 & P2_ASLR_DISABLE) == 0) || (imgp->proc->p_flag2 & P2_ASLR_DISABLE) == 0) ||
(imgp->proc->p_flag2 & P2_ASLR_ENABLE) != 0) (imgp->proc->p_flag2 & P2_ASLR_ENABLE) != 0)
et_dyn_addr = ET_DYN_ADDR_RAND; et_dyn_addr = ET_DYN_ADDR_RAND;
else 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/systm.h>
#include <sys/bus.h> #include <sys/bus.h>
#include <sys/callout.h> #include <sys/callout.h>
#include <sys/domainset.h>
#include <sys/file.h> #include <sys/file.h>
#include <sys/interrupt.h> #include <sys/interrupt.h>
#include <sys/kernel.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); mtx_init(&cc->cc_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE);
SLIST_INIT(&cc->cc_callfree); SLIST_INIT(&cc->cc_callfree);
cc->cc_inited = 1; cc->cc_inited = 1;
cc->cc_callwheel = malloc(sizeof(struct callout_list) * callwheelsize, cc->cc_callwheel = malloc_domainset(sizeof(struct callout_list) *
M_CALLOUT, M_WAITOK); callwheelsize, M_CALLOUT,
DOMAINSET_PREF(pcpu_find(cpu)->pc_domain), M_WAITOK);
for (i = 0; i < callwheelsize; i++) for (i = 0; i < callwheelsize; i++)
LIST_INIT(&cc->cc_callwheel[i]); LIST_INIT(&cc->cc_callwheel[i]);
TAILQ_INIT(&cc->cc_expireq); TAILQ_INIT(&cc->cc_expireq);

View File

@ -287,7 +287,7 @@ lock_prof_init(void *arg)
{ {
int cpu; int cpu;
for (cpu = 0; cpu <= mp_maxid; cpu++) { CPU_FOREACH(cpu) {
lp_cpu[cpu] = malloc(sizeof(*lp_cpu[cpu]), M_DEVBUF, lp_cpu[cpu] = malloc(sizeof(*lp_cpu[cpu]), M_DEVBUF,
M_WAITOK | M_ZERO); M_WAITOK | M_ZERO);
lock_prof_init_type(&lp_cpu[cpu]->lpc_types[0]); 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 * before we zero the structures. Some items may still be linked
* into per-thread lists as well. * into per-thread lists as well.
*/ */
for (cpu = 0; cpu <= mp_maxid; cpu++) { CPU_FOREACH(cpu) {
lpc = lp_cpu[cpu]; lpc = lp_cpu[cpu];
for (i = 0; i < LPROF_CACHE_SIZE; i++) { for (i = 0; i < LPROF_CACHE_SIZE; i++) {
LIST_REMOVE(&lpc->lpc_types[0].lpt_objs[i], lpo_link); LIST_REMOVE(&lpc->lpc_types[0].lpt_objs[i], lpo_link);
LIST_REMOVE(&lpc->lpc_types[1].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]; lpc = lp_cpu[cpu];
bzero(lpc, sizeof(*lpc)); bzero(lpc, sizeof(*lpc));
lock_prof_init_type(&lpc->lpc_types[0]); 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->class = match->class;
dst->name = match->name; dst->name = match->name;
for (cpu = 0; cpu <= mp_maxid; cpu++) { CPU_FOREACH(cpu) {
if (lp_cpu[cpu] == NULL)
continue;
type = &lp_cpu[cpu]->lpc_types[spin]; type = &lp_cpu[cpu]->lpc_types[spin];
SLIST_FOREACH(l, &type->lpt_hash[hash], link) { SLIST_FOREACH(l, &type->lpt_hash[hash], link) {
if (l->ticks == t) 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; dst->cnt_contest_locking += l->cnt_contest_locking;
} }
} }
} }
static void static void
@ -438,9 +435,7 @@ dump_lock_prof_stats(SYSCTL_HANDLER_ARGS)
lock_prof_enable = 0; lock_prof_enable = 0;
quiesce_all_cpus("profstat", 0); quiesce_all_cpus("profstat", 0);
t = ticks; t = ticks;
for (cpu = 0; cpu <= mp_maxid; cpu++) { CPU_FOREACH(cpu) {
if (lp_cpu[cpu] == NULL)
continue;
lock_prof_type_stats(&lp_cpu[cpu]->lpc_types[0], sb, 0, t); 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); 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); STAILQ_INIT(&ktls_wq[i].head);
mtx_init(&ktls_wq[i].mtx, "ktls work queue", NULL, MTX_DEF); mtx_init(&ktls_wq[i].mtx, "ktls work queue", NULL, MTX_DEF);
error = kproc_kthread_add(ktls_work_thread, &ktls_wq[i], 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) if (error)
panic("Can't add KTLS thread %d error %d", i, 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, 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); 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)) { if (param_length <= sizeof(struct sctp_paramhdr)) {
SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: param length (%u) too short\n", param_length); SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: param length (%u) too short\n", param_length);
sctp_m_freem(m_ack); sctp_m_freem(m_ack);
return;
} }
/* get the entire parameter */ /* get the entire parameter */
aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, param_length, aparam_buf); 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_DELAY_LOAD 0x10
#define LL_DELTA 0x20 #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. */ /* Values for n_type used in executables. */
#define NT_FREEBSD_ABI_TAG 1 #define NT_FREEBSD_ABI_TAG 1
#define NT_FREEBSD_NOINIT_TAG 2 #define NT_FREEBSD_NOINIT_TAG 2

View File

@ -226,7 +226,7 @@ struct mount {
struct lock mnt_explock; /* vfs_export walkers lock */ struct lock mnt_explock; /* vfs_export walkers lock */
TAILQ_ENTRY(mount) mnt_upper_link; /* (m) we in the all uppers */ TAILQ_ENTRY(mount) mnt_upper_link; /* (m) we in the all uppers */
TAILQ_HEAD(, mount) mnt_uppers; /* (m) upper mounts over us*/ 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_thread_in_ops_pcpu;
int *mnt_ref_pcpu; int *mnt_ref_pcpu;
int *mnt_lockref_pcpu; int *mnt_lockref_pcpu;

View File

@ -28,7 +28,7 @@
.\" @(#)jot.1 8.1 (Berkeley) 6/6/93 .\" @(#)jot.1 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd April 7, 2015 .Dd September 21, 2019
.Dt JOT 1 .Dt JOT 1
.Os .Os
.Sh NAME .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 If four are specified and the given and computed values of
.Ar reps .Ar reps
conflict, the lower value is used. conflict, the lower value is used.
If fewer than three are specified, defaults are assigned If one or two are specified, defaults are assigned
left to right, except for starting with
.Ar s , .Ar s ,
which assumes a default of 1 or -1 if both which assumes a default of 1 (or -1 if
.Ar begin .Ar begin
and and
.Ar end .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 .Pp
Defaults for the four arguments are, respectively, Defaults for the four arguments are, respectively,
100, 1, 100, and 1, except that when random data are requested, 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, call_stat = callaurpc(host, RQUOTAPROG, EXT_RQUOTAVERS,
RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_ext_getquota_args, (char *)&gq_args, RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_ext_getquota_args, (char *)&gq_args,
(xdrproc_t)xdr_getquota_rslt, (char *)&gq_rslt); (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) { if (quotatype == USRQUOTA) {
old_gq_args.gqa_pathp = cp + 1; old_gq_args.gqa_pathp = cp + 1;
old_gq_args.gqa_uid = id; 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 void
i_uptime(struct timeval *bt, time_t *tod) i_uptime(struct timeval *bt, time_t *tod)
{ {

View File

@ -11,7 +11,6 @@ int display_updatecpus(struct statics *statics);
void clear_message(void); void clear_message(void);
int display_resize(void); int display_resize(void);
void i_header(const char *text); void i_header(const char *text);
char *printable(char *string);
void display_header(int t); void display_header(int t);
int display_init(struct statics *statics); int display_init(struct statics *statics);
void i_arc(int *stats); 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; len = (argbuflen - (dst - argbuf) - 1) / 4;
strvisx(dst, src, strvisx(dst, src,
MIN(strlen(src), len), MIN(strlen(src), len),
VIS_NL | VIS_CSTYLE); VIS_NL | VIS_CSTYLE | VIS_OCTAL | VIS_SAFE);
while (*dst != '\0') while (*dst != '\0')
dst++; dst++;
if ((argbuflen - (dst - argbuf) - 1) / 4 > 0) 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, "%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, "%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); free(cmdbuf);
return (sbuf_data(procbuf)); return (sbuf_data(procbuf));
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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