From owner-svn-src-head@freebsd.org Sun Apr 30 02:08:48 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D8A0D56BDB; Sun, 30 Apr 2017 02:08:48 +0000 (UTC) (envelope-from anish@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CF7C18D9; Sun, 30 Apr 2017 02:08:47 +0000 (UTC) (envelope-from anish@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3U28lVr093448; Sun, 30 Apr 2017 02:08:47 GMT (envelope-from anish@FreeBSD.org) Received: (from anish@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3U28lZo093446; Sun, 30 Apr 2017 02:08:47 GMT (envelope-from anish@FreeBSD.org) Message-Id: <201704300208.v3U28lZo093446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: anish set sender to anish@FreeBSD.org using -f From: Anish Gupta Date: Sun, 30 Apr 2017 02:08:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317600 - in head/sys: amd64/vmm/amd modules/vmm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2017 02:08:48 -0000 Author: anish Date: Sun Apr 30 02:08:46 2017 New Revision: 317600 URL: https://svnweb.freebsd.org/changeset/base/317600 Log: Add AMD IOMMU/AMD-Vi support in bhyve for passthrough/direct assignment to VMs. To enable AMD-Vi, set hw.vmm.amdvi.enable=1. Reviewed by:bcr Approved by:grehan Tested by:rgrimes Differential Revision:https://reviews.freebsd.org/D10049 Added: head/sys/amd64/vmm/amd/amdvi_hw.c (contents, props changed) head/sys/amd64/vmm/amd/amdvi_priv.h (contents, props changed) head/sys/amd64/vmm/amd/ivrs_drv.c (contents, props changed) Modified: head/sys/modules/vmm/Makefile Added: head/sys/amd64/vmm/amd/amdvi_hw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/vmm/amd/amdvi_hw.c Sun Apr 30 02:08:46 2017 (r317600) @@ -0,0 +1,1509 @@ +/*- + * Copyright (c) 2016, Anish Gupta (anish@freebsd.org) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include "pcib_if.h" + +#include "io/iommu.h" +#include "amdvi_priv.h" + +SYSCTL_DECL(_hw_vmm); +SYSCTL_NODE(_hw_vmm, OID_AUTO, amdvi, CTLFLAG_RW, NULL, NULL); + +#define MOD_INC(a, s, m) (((a) + (s)) % ((m) * (s))) +#define MOD_DEC(a, s, m) (((a) - (s)) % ((m) * (s))) + +/* Print RID or device ID in PCI string format. */ +#define RID2PCI_STR(d) PCI_RID2BUS(d), PCI_RID2SLOT(d), PCI_RID2FUNC(d) + +static void amdvi_dump_cmds(struct amdvi_softc *softc); +static void amdvi_print_dev_cap(struct amdvi_softc *softc); + +MALLOC_DEFINE(M_AMDVI, "amdvi", "amdvi"); + +extern device_t *ivhd_devs; + +extern int ivhd_count; +SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, count, CTLFLAG_RDTUN, &ivhd_count, + 0, NULL); + +static int amdvi_enable_user = 0; +SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, enable, CTLFLAG_RDTUN, + &amdvi_enable_user, 0, NULL); +TUNABLE_INT("hw.vmm.amdvi_enable", &amdvi_enable_user); + +#ifdef AMDVI_ATS_ENABLE +/* XXX: ATS is not tested. */ +static int amdvi_enable_iotlb = 1; +SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, iotlb_enabled, CTLFLAG_RDTUN, + &amdvi_enable_iotlb, 0, NULL); +TUNABLE_INT("hw.vmm.enable_iotlb", &amdvi_enable_iotlb); +#endif + +static int amdvi_host_ptp = 1; /* Use page tables for host. */ +SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, host_ptp, CTLFLAG_RDTUN, + &amdvi_host_ptp, 0, NULL); +TUNABLE_INT("hw.vmm.amdvi.host_ptp", &amdvi_host_ptp); + +/* Page table level used <= supported by h/w[v1=7]. */ +static int amdvi_ptp_level = 4; +SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, ptp_level, CTLFLAG_RDTUN, + &amdvi_ptp_level, 0, NULL); +TUNABLE_INT("hw.vmm.amdvi.ptp_level", &amdvi_ptp_level); + +/* Disable fault event reporting. */ +static int amdvi_disable_io_fault = 0; +SYSCTL_INT(_hw_vmm_amdvi, OID_AUTO, disable_io_fault, CTLFLAG_RDTUN, + &amdvi_disable_io_fault, 0, NULL); +TUNABLE_INT("hw.vmm.amdvi.disable_io_fault", &amdvi_disable_io_fault); + +static uint32_t amdvi_dom_id = 0; /* 0 is reserved for host. */ +SYSCTL_UINT(_hw_vmm_amdvi, OID_AUTO, domain_id, CTLFLAG_RD, + &amdvi_dom_id, 0, NULL); +/* + * Device table entry. + * Bus(256) x Dev(32) x Fun(8) x DTE(256 bits or 32 bytes). + * = 256 * 2 * PAGE_SIZE. + */ +static struct amdvi_dte amdvi_dte[PCI_NUM_DEV_MAX] __aligned(PAGE_SIZE); +CTASSERT(PCI_NUM_DEV_MAX == 0x10000); +CTASSERT(sizeof(amdvi_dte) == 0x200000); + +static SLIST_HEAD (, amdvi_domain) dom_head; + +static inline void +amdvi_pci_write(struct amdvi_softc *softc, int off, uint32_t data) +{ + + pci_cfgregwrite(PCI_RID2BUS(softc->pci_rid), + PCI_RID2SLOT(softc->pci_rid), PCI_RID2FUNC(softc->pci_rid), + off, data, 4); +} + +static inline uint32_t +amdvi_pci_read(struct amdvi_softc *softc, int off) +{ + + return (pci_cfgregread(PCI_RID2BUS(softc->pci_rid), + PCI_RID2SLOT(softc->pci_rid), PCI_RID2FUNC(softc->pci_rid), + off, 4)); +} + +static int +amdvi_find_pci_cap(struct amdvi_softc *softc, uint8_t capability, int *off) +{ + uint32_t read; + uint8_t ptr; + + read = amdvi_pci_read(softc, PCIR_COMMAND); + if (((read >> 16) & PCIM_STATUS_CAPPRESENT) == 0) + return (ENXIO); + + /* Read the starting of capability pointer. */ + read = amdvi_pci_read(softc, PCIR_CAP_PTR); + ptr = read & 0xFF; + + while (ptr != 0) { + read = amdvi_pci_read(softc, ptr); + if ((read & 0xFF) == capability) { + *off = ptr; + return (0); + } + ptr = (read >> 8) & 0xFF; + } + + return (ENOENT); +} + +#ifdef AMDVI_ATS_ENABLE +/* XXX: Should be in pci.c */ +/* + * Check if device has ATS capability and its enabled. + * If ATS is absent or disabled, return (-1), otherwise ATS + * queue length. + */ +static int +amdvi_find_ats_qlen(uint16_t devid) +{ + device_t dev; + uint32_t off, cap; + int qlen = -1; + + dev = pci_find_bsf(PCI_RID2BUS(devid), PCI_RID2SLOT(devid), + PCI_RID2FUNC(devid)); + + if (!dev) { + return (-1); + } +#define PCIM_ATS_EN BIT(31) + + if (pci_find_extcap(dev, PCIZ_ATS, &off) == 0) { + cap = pci_read_config(dev, off + 4, 4); + qlen = (cap & 0x1F); + qlen = qlen ? qlen : 32; + printf("AMD-Vi: PCI device %d.%d.%d ATS %s qlen=%d\n", + RID2PCI_STR(devid), + (cap & PCIM_ATS_EN) ? "enabled" : "Disabled", + qlen); + qlen = (cap & PCIM_ATS_EN) ? qlen : -1; + } + + return (qlen); +} + +/* + * Check if an endpoint device support device IOTLB or ATS. + */ +static inline bool +amdvi_dev_support_iotlb(struct amdvi_softc *softc, uint16_t devid) +{ + struct ivhd_dev_cfg *cfg; + int qlen, i; + bool pci_ats, ivhd_ats; + + qlen = amdvi_find_ats_qlen(devid); + if (qlen < 0) + return (false); + + KASSERT(softc, ("softc is NULL")); + cfg = softc->dev_cfg; + + ivhd_ats = false; + for (i = 0; i < softc->dev_cfg_cnt; i++) { + if ((cfg->start_id <= devid) && (cfg->end_id >= devid)) { + ivhd_ats = cfg->enable_ats; + break; + } + cfg++; + } + + pci_ats = (qlen < 0) ? false : true; + if (pci_ats != ivhd_ats) + device_printf(softc->dev, + "BIOS bug: mismatch in ATS setting for %d.%d.%d," + "ATS inv qlen = %d\n", RID2PCI_STR(devid), qlen); + + /* Ignore IVRS setting and respect PCI setting. */ + return (pci_ats); +} +#endif + +/* Enable IOTLB support for IOMMU if its supported. */ +static inline void +amdvi_hw_enable_iotlb(struct amdvi_softc *softc) +{ +#ifndef AMDVI_ATS_ENABLE + softc->iotlb = false; +#else + bool supported; + + supported = (softc->ivhd_flag & IVHD_FLAG_IOTLB) ? true : false; + + if (softc->pci_cap & AMDVI_PCI_CAP_IOTLB) { + if (!supported) + device_printf(softc->dev, "IOTLB disabled by BIOS.\n"); + + if (supported && !amdvi_enable_iotlb) { + device_printf(softc->dev, "IOTLB disabled by user.\n"); + supported = false; + } + } else + supported = false; + + softc->iotlb = supported; + +#endif +} + +static int +amdvi_init_cmd(struct amdvi_softc *softc) +{ + struct amdvi_ctrl *ctrl = softc->ctrl; + + ctrl->cmd.len = 8; /* Use 256 command buffer entries. */ + softc->cmd_max = 1 << ctrl->cmd.len; + + softc->cmd = malloc(sizeof(struct amdvi_cmd) * + softc->cmd_max, M_AMDVI, M_WAITOK | M_ZERO); + + if ((uintptr_t)softc->cmd & PAGE_MASK) + panic("AMDVi: Command buffer not aligned on page boundary."); + + ctrl->cmd.base = vtophys(softc->cmd) / PAGE_SIZE; + /* + * XXX: Reset the h/w pointers in case IOMMU is restarting, + * h/w doesn't clear these pointers based on empirical data. + */ + ctrl->cmd_tail = 0; + ctrl->cmd_head = 0; + + return (0); +} + +/* + * Note: Update tail pointer after we have written the command since tail + * pointer update cause h/w to execute new commands, see section 3.3 + * of AMD IOMMU spec ver 2.0. + */ +/* Get the command tail pointer w/o updating it. */ +static struct amdvi_cmd * +amdvi_get_cmd_tail(struct amdvi_softc *softc) +{ + struct amdvi_ctrl *ctrl; + struct amdvi_cmd *tail; + + KASSERT(softc, ("softc is NULL")); + KASSERT(softc->cmd != NULL, ("cmd is NULL")); + + ctrl = softc->ctrl; + KASSERT(ctrl != NULL, ("ctrl is NULL")); + + tail = (struct amdvi_cmd *)((uint8_t *)softc->cmd + + ctrl->cmd_tail); + + return (tail); +} + +/* + * Update the command tail pointer which will start command execution. + */ +static void +amdvi_update_cmd_tail(struct amdvi_softc *softc) +{ + struct amdvi_ctrl *ctrl; + int size; + + size = sizeof(struct amdvi_cmd); + KASSERT(softc->cmd != NULL, ("cmd is NULL")); + + ctrl = softc->ctrl; + KASSERT(ctrl != NULL, ("ctrl is NULL")); + + ctrl->cmd_tail = MOD_INC(ctrl->cmd_tail, size, softc->cmd_max); + softc->total_cmd++; + +#ifdef AMDVI_DEBUG_CMD + device_printf(softc->dev, "cmd_tail: %s Tail:0x%x, Head:0x%x.\n", + ctrl->cmd_tail, + ctrl->cmd_head); +#endif + +} + +/* + * Various commands supported by IOMMU. + */ + +/* Completion wait command. */ +static void +amdvi_cmd_cmp(struct amdvi_softc *softc, const uint64_t data) +{ + struct amdvi_cmd *cmd; + uint64_t pa; + + cmd = amdvi_get_cmd_tail(softc); + KASSERT(cmd != NULL, ("Cmd is NULL")); + + pa = vtophys(&softc->cmp_data); + cmd->opcode = AMDVI_CMP_WAIT_OPCODE; + cmd->word0 = (pa & 0xFFFFFFF8) | + (AMDVI_CMP_WAIT_STORE); + //(AMDVI_CMP_WAIT_FLUSH | AMDVI_CMP_WAIT_STORE); + cmd->word1 = (pa >> 32) & 0xFFFFF; + cmd->addr = data; + + amdvi_update_cmd_tail(softc); +} + +/* Invalidate device table entry. */ +static void +amdvi_cmd_inv_dte(struct amdvi_softc *softc, uint16_t devid) +{ + struct amdvi_cmd *cmd; + + cmd = amdvi_get_cmd_tail(softc); + KASSERT(cmd != NULL, ("Cmd is NULL")); + cmd->opcode = AMDVI_INVD_DTE_OPCODE; + cmd->word0 = devid; + amdvi_update_cmd_tail(softc); +#ifdef AMDVI_DEBUG_CMD + device_printf(softc->dev, "Invalidated DTE:0x%x\n", devid); +#endif +} + +/* Invalidate IOMMU page, use for invalidation of domain. */ +static void +amdvi_cmd_inv_iommu_pages(struct amdvi_softc *softc, uint16_t domain_id, + uint64_t addr, bool guest_nested, + bool pde, bool page) +{ + struct amdvi_cmd *cmd; + + cmd = amdvi_get_cmd_tail(softc); + KASSERT(cmd != NULL, ("Cmd is NULL")); + + + cmd->opcode = AMDVI_INVD_PAGE_OPCODE; + cmd->word1 = domain_id; + /* + * Invalidate all addresses for this domain. + */ + cmd->addr = addr; + cmd->addr |= pde ? AMDVI_INVD_PAGE_PDE : 0; + cmd->addr |= page ? AMDVI_INVD_PAGE_S : 0; + + amdvi_update_cmd_tail(softc); +} + +#ifdef AMDVI_ATS_ENABLE +/* Invalidate device IOTLB. */ +static void +amdvi_cmd_inv_iotlb(struct amdvi_softc *softc, uint16_t devid) +{ + struct amdvi_cmd *cmd; + int qlen; + + if (!softc->iotlb) + return; + + qlen = amdvi_find_ats_qlen(devid); + if (qlen < 0) { + panic("AMDVI: Invalid ATS qlen(%d) for device %d.%d.%d\n", + qlen, RID2PCI_STR(devid)); + } + cmd = amdvi_get_cmd_tail(softc); + KASSERT(cmd != NULL, ("Cmd is NULL")); + +#ifdef AMDVI_DEBUG_CMD + device_printf(softc->dev, "Invalidate IOTLB devID 0x%x" + " Qlen:%d\n", devid, qlen); +#endif + cmd->opcode = AMDVI_INVD_IOTLB_OPCODE; + cmd->word0 = devid; + cmd->word1 = qlen; + cmd->addr = AMDVI_INVD_IOTLB_ALL_ADDR | + AMDVI_INVD_IOTLB_S; + amdvi_update_cmd_tail(softc); +} +#endif + +#ifdef notyet /* For Interrupt Remap. */ +static void +amdvi_cmd_inv_intr_map(struct amdvi_softc *softc, + uint16_t devid) +{ + struct amdvi_cmd *cmd; + + cmd = amdvi_get_cmd_tail(softc); + KASSERT(cmd != NULL, ("Cmd is NULL")); + cmd->opcode = AMDVI_INVD_INTR_OPCODE; + cmd->word0 = devid; + amdvi_update_cmd_tail(softc); +#ifdef AMDVI_DEBUG_CMD + device_printf(softc->dev, "Invalidate INTR map of devID 0x%x\n", devid); +#endif +} +#endif + +/* Invalidate domain using INVALIDATE_IOMMU_PAGES command. */ +static void +amdvi_inv_domain(struct amdvi_softc *softc, uint16_t domain_id) +{ + struct amdvi_cmd *cmd; + + cmd = amdvi_get_cmd_tail(softc); + KASSERT(cmd != NULL, ("Cmd is NULL")); + + /* + * See section 3.3.3 of IOMMU spec rev 2.0, software note + * for invalidating domain. + */ + amdvi_cmd_inv_iommu_pages(softc, domain_id, AMDVI_INVD_PAGE_ALL_ADDR, + false, true, true); + +#ifdef AMDVI_DEBUG_CMD + device_printf(softc->dev, "Invalidate domain:0x%x\n", domain_id); + +#endif +} + +static bool +amdvi_cmp_wait(struct amdvi_softc *softc) +{ + struct amdvi_ctrl *ctrl; + const uint64_t VERIFY = 0xA5A5; + volatile uint64_t *read; + int i; + bool status; + + ctrl = softc->ctrl; + read = &softc->cmp_data; + *read = 0; + amdvi_cmd_cmp(softc, VERIFY); + /* Wait for h/w to update completion data. */ + for (i = 0; i < 100 && (*read != VERIFY); i++) { + DELAY(1000); /* 1 ms */ + } + status = (VERIFY == softc->cmp_data) ? true : false; + +#ifdef AMDVI_DEBUG_CMD + if (status) + device_printf(softc->dev, "CMD completion DONE Tail:0x%x, + "Head:0x%x, loop:%d.\n", ctrl->cmd_tail, + ctrl->cmd_head, loop); +#endif + return (status); +} + +static void +amdvi_wait(struct amdvi_softc *softc) +{ + struct amdvi_ctrl *ctrl; + int i; + + KASSERT(softc, ("softc is NULL")); + + ctrl = softc->ctrl; + KASSERT(ctrl != NULL, ("ctrl is NULL")); + /* Don't wait if h/w is not enabled. */ + if ((ctrl->control & AMDVI_CTRL_EN) == 0) + return; + + for (i = 0; i < 10; i++) { + if (amdvi_cmp_wait(softc)) + return; + } + + device_printf(softc->dev, "Error: completion failed" + " tail:0x%x, head:0x%x.\n", + ctrl->cmd_tail, ctrl->cmd_head); + amdvi_dump_cmds(softc); +} + +static void +amdvi_dump_cmds(struct amdvi_softc *softc) +{ + struct amdvi_ctrl *ctrl; + struct amdvi_cmd *cmd; + int off, i; + + ctrl = softc->ctrl; + device_printf(softc->dev, "Dump all the commands:\n"); + /* + * If h/w is stuck in completion, it is the previous command, + * start dumping from previous command onward. + */ + off = MOD_DEC(ctrl->cmd_head, sizeof(struct amdvi_cmd), + softc->cmd_max); + for (i = 0; off != ctrl->cmd_tail && + i < softc->cmd_max; i++) { + cmd = (struct amdvi_cmd *)((uint8_t *)softc->cmd + off); + printf(" [CMD%d, off:0x%x] opcode= 0x%x 0x%x" + " 0x%x 0x%lx\n", i, off, cmd->opcode, + cmd->word0, cmd->word1, cmd->addr); + off = (off + sizeof(struct amdvi_cmd)) % + (softc->cmd_max * sizeof(struct amdvi_cmd)); + } +} + +static int +amdvi_init_event(struct amdvi_softc *softc) +{ + struct amdvi_ctrl *ctrl; + + ctrl = softc->ctrl; + ctrl->event.len = 8; + softc->event_max = 1 << ctrl->event.len; + softc->event = malloc(sizeof(struct amdvi_event) * + softc->event_max, M_AMDVI, M_WAITOK | M_ZERO); + if ((uintptr_t)softc->event & PAGE_MASK) { + device_printf(softc->dev, "Event buffer not aligned on page."); + return (false); + } + ctrl->event.base = vtophys(softc->event) / PAGE_SIZE; + + /* Reset the pointers. */ + ctrl->evt_head = 0; + ctrl->evt_tail = 0; + + return (0); +} + +static inline void +amdvi_decode_evt_flag(uint16_t flag) +{ + + flag &= AMDVI_EVENT_FLAG_MASK; + printf("0x%b]\n", flag, + "\020" + "\001GN" + "\002NX" + "\003US" + "\004I" + "\005PR" + "\006RW" + "\007PE" + "\010RZ" + "\011TR" + ); +} + +/* See section 2.5.4 of AMD IOMMU spec ver 2.62.*/ +static inline void +amdvi_decode_evt_flag_type(uint8_t type) +{ + + switch (AMDVI_EVENT_FLAG_TYPE(type)) { + case 0: + printf("RSVD\n"); + break; + case 1: + printf("Master Abort\n"); + break; + case 2: + printf("Target Abort\n"); + break; + case 3: + printf("Data Err\n"); + break; + default: + break; + } +} + +static void +amdvi_decode_inv_dte_evt(uint16_t devid, uint16_t domid, uint64_t addr, + uint16_t flag) +{ + + printf("\t[IO_PAGE_FAULT EVT: devId:0x%x DomId:0x%x" + " Addr:0x%lx", + devid, domid, addr); + amdvi_decode_evt_flag(flag); +} + +static void +amdvi_decode_pf_evt(uint16_t devid, uint16_t domid, uint64_t addr, + uint16_t flag) +{ + + printf("\t[IO_PAGE_FAULT EVT: devId:0x%x DomId:0x%x" + " Addr:0x%lx", + devid, domid, addr); + amdvi_decode_evt_flag(flag); +} + +static void +amdvi_decode_dte_hwerr_evt(uint16_t devid, uint16_t domid, + uint64_t addr, uint16_t flag) +{ + + printf("\t[DEV_TAB_HW_ERR EVT: devId:0x%x DomId:0x%x" + " Addr:0x%lx", devid, domid, addr); + amdvi_decode_evt_flag(flag); + amdvi_decode_evt_flag_type(flag); +} + +static void +amdvi_decode_page_hwerr_evt(uint16_t devid, uint16_t domid, uint64_t addr, + uint16_t flag) +{ + + printf("\t[PAGE_TAB_HW_ERR EVT: devId:0x%x DomId:0x%x" + " Addr:0x%lx", devid, domid, addr); + amdvi_decode_evt_flag(flag); + amdvi_decode_evt_flag_type(AMDVI_EVENT_FLAG_TYPE(flag)); +} + +static void +amdvi_decode_evt(struct amdvi_event *evt) +{ + struct amdvi_cmd *cmd; + + switch (evt->opcode) { + case AMDVI_EVENT_INVALID_DTE: + amdvi_decode_inv_dte_evt(evt->devid, evt->pasid_domid, + evt->addr, evt->flag); + break; + + case AMDVI_EVENT_PFAULT: + amdvi_decode_pf_evt(evt->devid, evt->pasid_domid, + evt->addr, evt->flag); + break; + + case AMDVI_EVENT_DTE_HW_ERROR: + amdvi_decode_dte_hwerr_evt(evt->devid, evt->pasid_domid, + evt->addr, evt->flag); + break; + + case AMDVI_EVENT_PAGE_HW_ERROR: + amdvi_decode_page_hwerr_evt(evt->devid, evt->pasid_domid, + evt->addr, evt->flag); + break; + + case AMDVI_EVENT_ILLEGAL_CMD: + /* FALL THROUGH */ + case AMDVI_EVENT_CMD_HW_ERROR: + printf("\t[%s EVT]", (evt->opcode == AMDVI_EVENT_ILLEGAL_CMD) ? + "ILLEGAL CMD" : "CMD HW ERR"); + cmd = (struct amdvi_cmd *)PHYS_TO_DMAP(evt->addr); + printf("\tCMD opcode= 0x%x 0x%x 0x%x 0x%lx\n", + cmd->opcode, cmd->word0, cmd->word1, cmd->addr); + break; + + case AMDVI_EVENT_IOTLB_TIMEOUT: + printf("\t[IOTLB_INV_TIMEOUT devid:0x%x addr:0x%lx", + evt->devid, evt->addr); + break; + + case AMDVI_EVENT_INVALID_DTE_REQ: + printf("\t[INV_DTE devid:0x%x addr:0x%lx", + evt->devid, evt->addr); + break; + + case AMDVI_EVENT_INVALID_PPR_REQ: + case AMDVI_EVENT_COUNTER_ZERO: + printf("AMD-Vi: v2 events.\n"); + break; + + default: + printf("Unsupported AMD-Vi event:%d", evt->opcode); + } +} + +static void +amdvi_print_events(struct amdvi_softc *softc) +{ + struct amdvi_ctrl *ctrl; + struct amdvi_event *event; + int i, size; + + ctrl = softc->ctrl; + size = sizeof(struct amdvi_event); + for (i = 0; i < softc->event_max; i++) { + event = &softc->event[ctrl->evt_head / size]; + if (!event->opcode) + break; + device_printf(softc->dev, "\t[Event%d: Head:0x%x Tail:0x%x]\n", + i, ctrl->evt_head, ctrl->evt_tail); + amdvi_decode_evt(event); + ctrl->evt_head = MOD_INC(ctrl->evt_head, size, + softc->event_max); + } +} + +static int +amdvi_init_dte(struct amdvi_softc *softc) +{ + struct amdvi_ctrl *ctrl; + + ctrl = softc->ctrl; + ctrl->dte.base = vtophys(amdvi_dte) / PAGE_SIZE; + ctrl->dte.size = 0x1FF; /* 2MB device table. */ + + return (0); +} + +/* + * Not all capabilities of IOMMU are available in ACPI IVHD flag + * or EFR entry, read directly from device. + */ +static int +amdvi_print_pci_cap(device_t dev) +{ + struct amdvi_softc *softc; + uint32_t off, cap; + + + softc = device_get_softc(dev); + off = softc->cap_off; + + /* + * Section 3.7.1 of IOMMU sepc rev 2.0. + * Read capability from device. + */ + cap = amdvi_pci_read(softc, off); + + /* Make sure capability type[18:16] is 3. */ + KASSERT((((cap >> 16) & 0x7) == 0x3), + ("Not a IOMMU capability 0x%x@0x%x", cap, off)); + + softc->pci_cap = cap >> 24; + device_printf(softc->dev, "PCI cap 0x%x@0x%x feature:%b\n", + cap, off, softc->pci_cap, + "\020\001IOTLB\002HT\003NPCache\004EFR"); + + /* IOMMU spec Rev 2.0, section 3.7.2.1 */ + softc->pci_efr = softc->ctrl->ex_feature; + if (softc->pci_efr) { + device_printf(softc->dev, "PCI extended Feature:%b\n", + (int)softc->pci_efr, + "\020\001PreFSup\002PPRSup\003XTSup\004NXSup\006IASup" + "\007GASup\008HESup\009PCSup"); + device_printf(softc->dev, + "PCI HATS = %d GATS = %d GLXSup = %d, max PASID: 0x%x ", + (int)((softc->pci_efr >> 10) & 0x3), + (int)((softc->pci_efr >> 12) & 0x3), + (int)((softc->pci_efr >> 14) & 0x3), + (int)((softc->pci_efr >> 32) & 0x1F) + 1); + } + + return (0); +} + +static void +amdvi_event_intr(void *arg) +{ + struct amdvi_softc *softc; + struct amdvi_ctrl *ctrl; + + softc = (struct amdvi_softc *)arg; + ctrl = softc->ctrl; + device_printf(softc->dev, "EVT INTR %ld Status:0x%x" + " EVT Head:0x%x Tail:0x%x]\n", softc->event_intr_cnt++, + ctrl->status, ctrl->evt_head, ctrl->evt_tail); + printf(" [CMD Total 0x%lx] Tail:0x%x, Head:0x%x.\n", + softc->total_cmd, ctrl->cmd_tail, ctrl->cmd_head); + + amdvi_print_events(softc); +} + +static void +amdvi_free_evt_intr_res(device_t dev) +{ + + struct amdvi_softc *softc; + + softc = device_get_softc(dev); + if (softc->event_tag != NULL) { + bus_teardown_intr(dev, softc->event_res, softc->event_tag); + } + if (softc->event_res != NULL) { + bus_release_resource(dev, SYS_RES_IRQ, softc->event_rid, + softc->event_res); + } + bus_delete_resource(dev, SYS_RES_IRQ, softc->event_rid); + PCIB_RELEASE_MSI(device_get_parent(device_get_parent(dev)), + dev, 1, &softc->event_irq); +} + +static bool +amdvi_alloc_intr_resources(struct amdvi_softc *softc) +{ + device_t dev, pcib; + uint64_t msi_addr; + uint32_t msi_data, temp; + int err, msi_off; + + dev = softc->dev; + pcib = device_get_parent(device_get_parent(dev)); + softc->event_irq = -1; + softc->event_rid = 0; + /* + * Section 3.7.1 of IOMMU rev 2.0. With MSI, there is only one + * interrupt. XXX: Enable MSI/X support. + */ + + err = PCIB_ALLOC_MSI(pcib, dev, 1, 1, &softc->event_irq); + if (err) { + device_printf(dev, + "Couldn't find event MSI IRQ resource.\n"); + return (ENOENT); + } + err = bus_set_resource(dev, SYS_RES_IRQ, softc->event_rid, + softc->event_irq, 1); + if (err) { + device_printf(dev, "Couldn't set event MSI resource.\n"); + return (ENXIO); + } + softc->event_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &softc->event_rid, RF_ACTIVE); + if (!softc->event_res) { + device_printf(dev, + "Unable to allocate event INTR resource.\n"); + return (ENOMEM); + } + + if (bus_setup_intr(dev, softc->event_res, + INTR_TYPE_MISC | INTR_MPSAFE, NULL, amdvi_event_intr, + softc, &softc->event_tag)) { + device_printf(dev, "Fail to setup event intr\n"); + bus_release_resource(softc->dev, SYS_RES_IRQ, + softc->event_rid, softc->event_res); + softc->event_res = NULL; + return (ENXIO); + } + + bus_describe_intr(dev, softc->event_res, softc->event_tag, + "fault"); + + err = amdvi_find_pci_cap(softc, PCIY_MSI, &msi_off); + if (err) { + device_printf(dev, "Couldn't find MSI capability, err = %d.\n", + err); + return (err); + } + + err = PCIB_MAP_MSI(pcib, dev, softc->event_irq, &msi_addr, + &msi_data); + if (err) { + device_printf(dev, + "Event interrupt config failed, err=%d.\n", + err); + amdvi_free_evt_intr_res(softc->dev); + return (err); + } + + /* Configure MSI */ + amdvi_pci_write(softc, msi_off + PCIR_MSI_ADDR, msi_addr); + amdvi_pci_write(softc, msi_off + PCIR_MSI_ADDR_HIGH, + msi_addr >> 32); + amdvi_pci_write(softc, msi_off + PCIR_MSI_DATA_64BIT, msi_data); + + /* Now enable MSI interrupt. */ + temp = amdvi_pci_read(softc, msi_off); + temp |= (PCIM_MSICTRL_MSI_ENABLE << 16); /* MSI enable. */ + amdvi_pci_write(softc, msi_off, temp); + + return (0); +} + + +static void +amdvi_print_dev_cap(struct amdvi_softc *softc) +{ + struct ivhd_dev_cfg *cfg; + int i; + + cfg = softc->dev_cfg; + for (i = 0; i < softc->dev_cfg_cnt; i++) { + device_printf(softc->dev, "device [0x%x - 0x%x]" + "config:%b%s\n", cfg->start_id, cfg->end_id, + cfg->data, + "\020\001INIT\002ExtInt\003NMI" + "\007LINT0\008LINT1", + cfg->enable_ats ? "ATS enabled" : ""); + cfg++; + } +} + +static int +amdvi_handle_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct amdvi_softc *softc; + int result, type, error = 0; + + softc = (struct amdvi_softc *)arg1; + type = arg2; + + switch (type) { + case 0: + result = softc->ctrl->cmd_head; + error = sysctl_handle_int(oidp, &result, 0, + req); + break; + case 1: + result = softc->ctrl->cmd_tail; + error = sysctl_handle_int(oidp, &result, 0, + req); + break; + case 2: + result = softc->ctrl->evt_head; + error = sysctl_handle_int(oidp, &result, 0, + req); + break; + case 3: + result = softc->ctrl->evt_tail; + error = sysctl_handle_int(oidp, &result, 0, + req); + break; + + default: + device_printf(softc->dev, "Unknown sysctl:%d\n", type); + } + + return (error); +} + +static void +amdvi_add_sysctl(struct amdvi_softc *softc) +{ + struct sysctl_oid_list *child; + struct sysctl_ctx_list *ctx; + device_t dev; + + dev = softc->dev; + ctx = device_get_sysctl_ctx(dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); + + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "event_intr_count", CTLFLAG_RD, + &softc->event_intr_cnt, "Event interrupt count"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "command_count", CTLFLAG_RD, + &softc->total_cmd, "Command submitted count"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "pci_rid", CTLFLAG_RD, + (int *)&softc->pci_rid, 0, + "IOMMU RID"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "start_dev_rid", CTLFLAG_RD, + (int *)&softc->start_dev_rid, 0, + "Start of device under this IOMMU"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "end_dev_rid", CTLFLAG_RD, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Apr 30 05:56:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B0BED54BA1; Sun, 30 Apr 2017 05:56:59 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D2131180; Sun, 30 Apr 2017 05:56:59 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3U5uwtI088897; Sun, 30 Apr 2017 05:56:58 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3U5uwZ8088896; Sun, 30 Apr 2017 05:56:58 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201704300556.v3U5uwZ8088896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 30 Apr 2017 05:56:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317601 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2017 05:56:59 -0000 Author: dchagin Date: Sun Apr 30 05:56:57 2017 New Revision: 317601 URL: https://svnweb.freebsd.org/changeset/base/317601 Log: Fix symlinkat() which use the newdfd argument to look up the old path, while it should use it for the new path instead. Reported by: trasz@ MFC after: 1 month Modified: head/sys/compat/linux/linux_file.c Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Sun Apr 30 02:08:46 2017 (r317600) +++ head/sys/compat/linux/linux_file.c Sun Apr 30 05:56:57 2017 (r317601) @@ -826,7 +826,7 @@ linux_symlinkat(struct thread *td, struc int error, dfd; dfd = (args->newdfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->newdfd; - LCONVPATHEXIST_AT(td, args->oldname, &path, dfd); + LCONVPATHEXIST(td, args->oldname, &path); /* Expand LCONVPATHCREATE so that `path' can be freed on errors */ error = linux_emul_convpath(td, args->newname, UIO_USERSPACE, &to, 1, dfd); if (to == NULL) { From owner-svn-src-head@freebsd.org Sun Apr 30 07:31:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB1B8D5761E; Sun, 30 Apr 2017 07:31:49 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2495D79; Sun, 30 Apr 2017 07:31:49 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3U7VmwT026901; Sun, 30 Apr 2017 07:31:48 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3U7Vmod026900; Sun, 30 Apr 2017 07:31:48 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201704300731.v3U7Vmod026900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sun, 30 Apr 2017 07:31:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317604 - head/sys/dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2017 07:31:50 -0000 Author: loos Date: Sun Apr 30 07:31:48 2017 New Revision: 317604 URL: https://svnweb.freebsd.org/changeset/base/317604 Log: Set the correct default for #address-cells variable when the property does not exist. This has never caused any issue because #address-cells is mandatory. Sponsored by: Rubicon Communications, LLC (Netgate) MFC after: 2 weeks Modified: head/sys/dev/fdt/fdt_common.c Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Sun Apr 30 06:15:56 2017 (r317603) +++ head/sys/dev/fdt/fdt_common.c Sun Apr 30 07:31:48 2017 (r317604) @@ -422,7 +422,7 @@ fdt_addrsize_cells(phandle_t node, int * */ cell_size = sizeof(cell); if (OF_getencprop(node, "#address-cells", &cell, cell_size) < cell_size) - *addr_cells = 2; + cell = 2; *addr_cells = (int)cell; if (OF_getencprop(node, "#size-cells", &cell, cell_size) < cell_size) From owner-svn-src-head@freebsd.org Sun Apr 30 07:51:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52B05D57BA1; Sun, 30 Apr 2017 07:51:33 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0AF9C172C; Sun, 30 Apr 2017 07:51:32 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3U7pWob036470; Sun, 30 Apr 2017 07:51:32 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3U7pWYg036469; Sun, 30 Apr 2017 07:51:32 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201704300751.v3U7pWYg036469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Sun, 30 Apr 2017 07:51:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317605 - head/sys/dev/etherswitch/e6000sw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2017 07:51:33 -0000 Author: loos Date: Sun Apr 30 07:51:31 2017 New Revision: 317605 URL: https://svnweb.freebsd.org/changeset/base/317605 Log: When the switch is set to operate in the Multi Chip Addressing Mode we cannot access the GLOBAL2 register directly. Despite the comment in code (which was misleading), the indirect access is only used to read the switch CONFIG data from the scrap register and not for the GLOBAL2 access. Use the dsa data to define when the switch is in the Multi Chip Addressing Mode (a even address different than zero). While here fix a typo. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c ============================================================================== --- head/sys/dev/etherswitch/e6000sw/e6000sw.c Sun Apr 30 07:31:48 2017 (r317604) +++ head/sys/dev/etherswitch/e6000sw/e6000sw.c Sun Apr 30 07:51:31 2017 (r317605) @@ -214,7 +214,6 @@ e6000sw_probe(device_t dev) e6000sw_softc_t *sc; const char *description; unsigned int id; - uint16_t dev_addr; phandle_t dsa_node, switch_node; dsa_node = fdt_find_compatible(OF_finddevice("/"), @@ -229,21 +228,11 @@ e6000sw_probe(device_t dev) sc->dev = dev; sc->node = switch_node; - /* Read ADDR[4:1]n using indirect access */ - MDIO_WRITE(dev, REG_GLOBAL2, SCR_AND_MISC_REG, - SCR_AND_MISC_PTR_CFG); - dev_addr = MDIO_READ(dev, REG_GLOBAL2, SCR_AND_MISC_REG) & - SCR_AND_MISC_DATA_CFG_MASK; - if (dev_addr != 0) { - sc->multi_chip = true; - device_printf(dev, "multi-chip addresing mode\n"); - } else { - device_printf(dev, "single-chip addressing mode\n"); - } - if (OF_getencprop(sc->node, "reg", &sc->sw_addr, sizeof(sc->sw_addr)) < 0) return (ENXIO); + if (sc->sw_addr != 0 && (sc->sw_addr % 2) == 0) + sc->multi_chip = true; /* Lock is necessary due to assertions. */ sx_init(&sc->sx, "e6000sw"); @@ -368,6 +357,11 @@ e6000sw_attach(device_t dev) err = 0; sc = device_get_softc(dev); + if (sc->multi_chip) + device_printf(dev, "multi-chip addressing mode\n"); + else + device_printf(dev, "single-chip addressing mode\n"); + E6000SW_LOCK(sc); e6000sw_setup(dev, sc); bzero(member_ports, sizeof(member_ports)); From owner-svn-src-head@freebsd.org Sun Apr 30 10:48:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79DA5D57C8B; Sun, 30 Apr 2017 10:48:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 51E6F841; Sun, 30 Apr 2017 10:48:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3UAlxjq007875; Sun, 30 Apr 2017 10:47:59 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3UAlxoH007874; Sun, 30 Apr 2017 10:47:59 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704301047.v3UAlxoH007874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 30 Apr 2017 10:47:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317606 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2017 10:48:00 -0000 Author: kib Date: Sun Apr 30 10:47:59 2017 New Revision: 317606 URL: https://svnweb.freebsd.org/changeset/base/317606 Log: Style. - Use ANSI C function definitions. - Remove redundand cast. - Minor style compliance tweaks. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libc/gen/sem_new.c Modified: head/lib/libc/gen/sem_new.c ============================================================================== --- head/lib/libc/gen/sem_new.c Sun Apr 30 07:51:31 2017 (r317605) +++ head/lib/libc/gen/sem_new.c Sun Apr 30 10:47:59 2017 (r317606) @@ -77,24 +77,26 @@ struct sem_nameinfo { static pthread_once_t once = PTHREAD_ONCE_INIT; static pthread_mutex_t sem_llock; -static LIST_HEAD(,sem_nameinfo) sem_list = LIST_HEAD_INITIALIZER(sem_list); +static LIST_HEAD(, sem_nameinfo) sem_list = LIST_HEAD_INITIALIZER(sem_list); static void -sem_prefork() +sem_prefork(void) { _pthread_mutex_lock(&sem_llock); } static void -sem_postfork() +sem_postfork(void) { + _pthread_mutex_unlock(&sem_llock); } static void -sem_child_postfork() +sem_child_postfork(void) { + _pthread_mutex_unlock(&sem_llock); } @@ -116,10 +118,8 @@ sem_check_validity(sem_t *sem) if (sem->_magic == SEM_MAGIC) return (0); - else { - errno = EINVAL; - return (-1); - } + errno = EINVAL; + return (-1); } int @@ -142,13 +142,16 @@ sem_t * _sem_open(const char *name, int flags, ...) { char path[PATH_MAX]; - struct stat sb; va_list ap; - struct sem_nameinfo *ni = NULL; - sem_t *sem = NULL; - int fd = -1, mode, len, errsave; - int value = 0; + struct sem_nameinfo *ni; + sem_t *sem, tmp; + int errsave, fd, len, mode, value; + + ni = NULL; + sem = NULL; + fd = -1; + value = 0; if (name[0] != '/') { errno = EINVAL; @@ -213,8 +216,6 @@ _sem_open(const char *name, int flags, . goto error; } if (sb.st_size < sizeof(sem_t)) { - sem_t tmp; - tmp._magic = SEM_MAGIC; tmp._kern._count = value; tmp._kern._flags = USYNC_PROCESS_SHARED | SEM_NAMED; @@ -222,8 +223,8 @@ _sem_open(const char *name, int flags, . goto error; } flock(fd, LOCK_UN); - sem = (sem_t *)mmap(NULL, sizeof(sem_t), PROT_READ|PROT_WRITE, - MAP_SHARED|MAP_NOSYNC, fd, 0); + sem = mmap(NULL, sizeof(sem_t), PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_NOSYNC, fd, 0); if (sem == MAP_FAILED) { sem = NULL; if (errno == ENOMEM) @@ -277,12 +278,11 @@ _sem_close(sem_t *sem) _pthread_mutex_unlock(&sem_llock); return (0); } - else - break; + break; } } - if (ni) { + if (ni != NULL) { LIST_REMOVE(ni, next); _pthread_mutex_unlock(&sem_llock); munmap(sem, sizeof(*sem)); @@ -342,7 +342,8 @@ _sem_getvalue(sem_t * __restrict sem, in static __inline int usem_wake(struct _usem2 *sem) { - return _umtx_op(sem, UMTX_OP_SEM2_WAKE, 0, NULL, NULL); + + return (_umtx_op(sem, UMTX_OP_SEM2_WAKE, 0, NULL, NULL)); } static __inline int @@ -436,6 +437,7 @@ int _sem_timedwait(sem_t * __restrict sem, const struct timespec * __restrict abstime) { + return (_sem_clockwait_np(sem, CLOCK_REALTIME, TIMER_ABSTIME, abstime, NULL)); }; @@ -443,7 +445,8 @@ _sem_timedwait(sem_t * __restrict sem, int _sem_wait(sem_t *sem) { - return _sem_timedwait(sem, NULL); + + return (_sem_timedwait(sem, NULL)); } /* From owner-svn-src-head@freebsd.org Sun Apr 30 14:35:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E6ECD577E2; Sun, 30 Apr 2017 14:35:31 +0000 (UTC) (envelope-from rionda@gmail.com) Received: from mail-qt0-x236.google.com (mail-qt0-x236.google.com [IPv6:2607:f8b0:400d:c0d::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2593DA91; Sun, 30 Apr 2017 14:35:31 +0000 (UTC) (envelope-from rionda@gmail.com) Received: by mail-qt0-x236.google.com with SMTP id m36so77978383qtb.0; Sun, 30 Apr 2017 07:35:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AMTYd9Vg/gxep0ZomHUJOXNXkcQVSFRiRweHUgh0CPE=; b=aIbfEhq86/YTqafvtgvbNuvSdUuC/aCHG1fcFDeVEaXNbl/dbgl/Bdg+a1c8qVKmQ8 4LYwtxVRVYZNBLWiK3Sz+ELJ0Fw5RuTtC0WUSzo8JPDE4Rwn1s5fUORq4KGjBEc6+M2p 9ohG1wjeG+dMQ0qcPfEti1lWyATC5Zg6AbH3b0LdUL3BIuRE4+gNZ7Bv5IX65mQ/dHco H8HglZWwBjDZsImkqR6cd6pJW7R113ZKYvg6Y8L77EQ8jh2NvEjg/fDKP/GaKUn4Kr7x GnrQ5iAMXcEgACwjBYGpYvO+eSOoTlonVPIfBIUeZGzZLPtvuz8rL1PFViqGa1ICWJyl E78g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AMTYd9Vg/gxep0ZomHUJOXNXkcQVSFRiRweHUgh0CPE=; b=a8eAtK/bvo0aH8DSnaWE6J9duO4msMhiaovYBzfD7yFI7y9/fDBFNoek5cSQ5jQxPe GjtRq0bedio9Bzr3XrxyHOTd/A8UoJcJ2Yl7aWkpOUpkO91VLg3r7vAz7dMC6l8J0+Ld vFY5ex53LALUbPsRZM3KTOaoL/fRcUX33QP+j43rPeOKs1Jl6zZVf5UTrIcknPI79Rjo 0O8wakZEg0En++9ZnpXkCbuQ6IrP73+SRWBj9tn9bNQasZEpVxDMk4mI72DXYzYLHYyk udWpv58HgZF22fr4CC3mm1vlsOjqhpGgeyhhl0OGXQYqIcqwLdaFC6soR00Hlwa+vHK7 TgBw== X-Gm-Message-State: AN3rC/4vMbOLhRJrV8p/y9y5vzdbtkK5asA/m8paPCN1+u0vNwZ6SV7D HPh8l9Nc9FVykUVFFdo= X-Received: by 10.200.44.130 with SMTP id 2mr19023058qtw.59.1493562930039; Sun, 30 Apr 2017 07:35:30 -0700 (PDT) Received: from abulafia.home (pool-72-92-236-111.prvdri.fios.verizon.net. [72.92.236.111]) by smtp.gmail.com with ESMTPSA id o190sm8174005qkc.65.2017.04.30.07.35.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Apr 2017 07:35:28 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r317600 - in head/sys: amd64/vmm/amd modules/vmm From: Matteo Riondato In-Reply-To: <201704300208.v3U28lZo093446@repo.freebsd.org> Date: Sun, 30 Apr 2017 10:35:33 -0400 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <11FF3746-5B36-47A2-B44C-9ED53AE02F03@gmail.com> References: <201704300208.v3U28lZo093446@repo.freebsd.org> To: Anish Gupta X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2017 14:35:31 -0000 > On Apr 29, 2017, at 10:08 PM, Anish Gupta wrote: >=20 > Author: anish > Date: Sun Apr 30 02:08:46 2017 > New Revision: 317600 > URL: https://svnweb.freebsd.org/changeset/base/317600 >=20 > Log: > Add AMD IOMMU/AMD-Vi support in bhyve for passthrough/direct = assignment to VMs. To enable AMD-Vi, set hw.vmm.amdvi.enable=3D1. This knob should likely be documented somewhere, and maybe also = "Relnotes: yes" ? Thank you, Matteo From owner-svn-src-head@freebsd.org Sun Apr 30 16:12:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FF6FD570DE; Sun, 30 Apr 2017 16:12:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3F07C57; Sun, 30 Apr 2017 16:12:24 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3UGCNPk048028; Sun, 30 Apr 2017 16:12:23 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3UGCNLl048027; Sun, 30 Apr 2017 16:12:23 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201704301612.v3UGCNLl048027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 30 Apr 2017 16:12:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317608 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2017 16:12:25 -0000 Author: emaste Date: Sun Apr 30 16:12:23 2017 New Revision: 317608 URL: https://svnweb.freebsd.org/changeset/base/317608 Log: revert r313473 (Disable LLD_IS_LD option combinations that fail) r316647 corrected the build of tblgen and libllvm as dependencies for LLD so undo the temporary seat-belt. We still want to extend the build infrastructure to automatically detect the case where the host LLD can be used instead of building a bootstrap LLD, and likely extend libllvmminimal to meet LLD's needs for cases where the build includes LLD but not Clang. Sponsored by: The FreeBSD Foundation Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Sun Apr 30 13:25:10 2017 (r317607) +++ head/share/mk/src.opts.mk Sun Apr 30 16:12:23 2017 (r317608) @@ -339,16 +339,6 @@ MK_LDNS_UTILS:= no MK_UNBOUND:= no .endif -.if ${MK_LLD} == "no" -MK_LLD_IS_LD:= no -.endif - -# LLD requires LLVM libraries, and we do not yet compare in-tree and host LLD -# versions to avoid building it if they are identical. -.if ${MK_LLD_IS_LD} != "no" -MK_SYSTEM_COMPILER:= no -.endif - .if ${MK_SOURCELESS} == "no" MK_SOURCELESS_HOST:= no MK_SOURCELESS_UCODE:= no From owner-svn-src-head@freebsd.org Sun Apr 30 19:32:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD39CD57F53; Sun, 30 Apr 2017 19:32:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D93618D3; Sun, 30 Apr 2017 19:32:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3UJWpsw029580; Sun, 30 Apr 2017 19:32:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3UJWpHH029579; Sun, 30 Apr 2017 19:32:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704301932.v3UJWpHH029579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 30 Apr 2017 19:32:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317610 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2017 19:32:52 -0000 Author: kib Date: Sun Apr 30 19:32:51 2017 New Revision: 317610 URL: https://svnweb.freebsd.org/changeset/base/317610 Log: Restructure normal (non-error) control flow in sem_close(). Do not retest for the found semaphore after the loop to look it up. Instead, handle both cases of last and non-last close simultaneously, which allows to consolidate the list unlock and successful return. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libc/gen/sem_new.c Modified: head/lib/libc/gen/sem_new.c ============================================================================== --- head/lib/libc/gen/sem_new.c Sun Apr 30 18:39:31 2017 (r317609) +++ head/lib/libc/gen/sem_new.c Sun Apr 30 19:32:51 2017 (r317610) @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -260,6 +261,7 @@ int _sem_close(sem_t *sem) { struct sem_nameinfo *ni; + bool last; if (sem_check_validity(sem) != 0) return (-1); @@ -274,21 +276,17 @@ _sem_close(sem_t *sem) _pthread_mutex_lock(&sem_llock); LIST_FOREACH(ni, &sem_list, next) { if (sem == ni->sem) { - if (--ni->open_count > 0) { - _pthread_mutex_unlock(&sem_llock); - return (0); + last = --ni->open_count == 0; + if (last) + LIST_REMOVE(ni, next); + _pthread_mutex_unlock(&sem_llock); + if (last) { + munmap(sem, sizeof(*sem)); + free(ni); } - break; + return (0); } } - - if (ni != NULL) { - LIST_REMOVE(ni, next); - _pthread_mutex_unlock(&sem_llock); - munmap(sem, sizeof(*sem)); - free(ni); - return (0); - } _pthread_mutex_unlock(&sem_llock); errno = EINVAL; return (-1); From owner-svn-src-head@freebsd.org Sun Apr 30 19:37:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DB47D57081; Sun, 30 Apr 2017 19:37:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E3471ADC; Sun, 30 Apr 2017 19:37:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3UJbjTk029819; Sun, 30 Apr 2017 19:37:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3UJbjGE029818; Sun, 30 Apr 2017 19:37:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704301937.v3UJbjGE029818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 30 Apr 2017 19:37:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317611 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2017 19:37:46 -0000 Author: kib Date: Sun Apr 30 19:37:45 2017 New Revision: 317611 URL: https://svnweb.freebsd.org/changeset/base/317611 Log: Make semaphore names list mutex non-recursive. The mutex is used in sem_open() and sem_close(), which cannot recurse. The atfork handlers cannot collide with the open and close code. Reviewed by: vangyzen Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D10545 Modified: head/lib/libc/gen/sem_new.c Modified: head/lib/libc/gen/sem_new.c ============================================================================== --- head/lib/libc/gen/sem_new.c Sun Apr 30 19:32:51 2017 (r317610) +++ head/lib/libc/gen/sem_new.c Sun Apr 30 19:37:45 2017 (r317611) @@ -104,12 +104,8 @@ sem_child_postfork(void) static void sem_module_init(void) { - pthread_mutexattr_t ma; - _pthread_mutexattr_init(&ma); - _pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE); - _pthread_mutex_init(&sem_llock, &ma); - _pthread_mutexattr_destroy(&ma); + _pthread_mutex_init(&sem_llock, NULL); _pthread_atfork(sem_prefork, sem_postfork, sem_child_postfork); } From owner-svn-src-head@freebsd.org Sun Apr 30 19:43:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AAEDD572EF; Sun, 30 Apr 2017 19:43:51 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id 53BD41F4A; Sun, 30 Apr 2017 19:43:51 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from ford.home.vangyzen.net (unknown [76.164.15.242]) by smtp.vangyzen.net (Postfix) with ESMTPSA id B10875646C; Sun, 30 Apr 2017 14:43:50 -0500 (CDT) Subject: Re: svn commit: r315526 - in head: contrib/netbsd-tests/lib/libc/sys include lib/libc/include lib/libc/sys lib/libc/tests/sys lib/libthr/thread share/man/man3 sys/compat/freebsd32 sys/kern sys/sys To: Chagin Dmitry Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201703190051.v2J0pDW9028513@repo.freebsd.org> <20170429093946.GA2227@mordor.heemeyer.club> From: Eric van Gyzen Message-ID: <878e48b9-2680-e4ba-c578-8e8c6ed43cb0@FreeBSD.org> Date: Sun, 30 Apr 2017 14:43:45 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <20170429093946.GA2227@mordor.heemeyer.club> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2017 19:43:51 -0000 On 04/29/2017 04:39, Chagin Dmitry wrote: > On Sun, Mar 19, 2017 at 12:51:13AM +0000, Eric van Gyzen wrote: >> Author: vangyzen >> Date: Sun Mar 19 00:51:12 2017 >> New Revision: 315526 >> URL: https://svnweb.freebsd.org/changeset/base/315526 >> >> Log: >> Add clock_nanosleep() > > hi, why it is not merged still? There is no technical reason, just time and other priorities. I'm starting the merge now. Eric From owner-svn-src-head@freebsd.org Sun Apr 30 20:13:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EABB0D57B85; Sun, 30 Apr 2017 20:13:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90F22D2; Sun, 30 Apr 2017 20:13:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v3UKDP6n046704 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 30 Apr 2017 23:13:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v3UKDP6n046704 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v3UKDPZO046703; Sun, 30 Apr 2017 23:13:25 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 30 Apr 2017 23:13:25 +0300 From: Konstantin Belousov To: Bruce Evans Cc: Alan Somers , Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs... Message-ID: <20170430201324.GV1622@kib.kiev.ua> References: <201704171734.v3HHYlf5022945@repo.freebsd.org> <20170419130428.J956@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170419130428.J956@besplex.bde.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2017 20:13:32 -0000 On Wed, Apr 19, 2017 at 02:09:58PM +1000, Bruce Evans wrote: > On Tue, 18 Apr 2017, Alan Somers wrote: > > > On Mon, Apr 17, 2017 at 11:34 AM, Gleb Smirnoff wrote: > > >> head/usr.bin/top/machine.c > >> head/usr.bin/vmstat/vmstat.c > > The previous 2 lines turn out to be relevant. I missed the update to > vmstat and checked a wrong version in my bug report described below > I checked an updated top, but the change seemed too small to help. > systat was not updated. > > > This change broke backwards compatibility with old top binaries. When > > I use a kernel at version 317094 but a top from 14-April, I get the > > error "top: sysctl(vm.stats.vm.v_swappgsin...) failed: Cannot allocate > > memory". I get the same error when running top from an 11.0-RELEASE > > jail. Can you please add backward compatibility shims? > > I sent a much longer (30 times longer) bug report to the author of the > bug. > > Most or all statistics utilities that use vmmeter are broken. vmstat > is too broken to even notice the bug -- it silently ignores the error, > an has type errors which prevent other errors which it doesn't ignore. > The result is silently truncating to 32 bits, like a quick fix would > do intentionally. systat -v detects the errors but prints warning > messages to the status line where they overwrite each other so make > the problem look smaller than it is. The result is unsilently > truncating to 32 bits. > > I've never seen any backwards compatibility shims added for sysctls. > None should be needed, but there are few or no utilities other than > sysctl(8) which use sysctl(3) in a portable way. See vfs.bufspace handled by vfs_bio.c:sysctl_bufspace(). In fact, not only top and vmstat are broken. Quite unexpected and worrying, reboot(8) is broken as well. This is due to get_pageins() failing and system stopping userspace much earlier than it is desirable. I now believe that compat shims to handle int-sized vmstat queries are required. From owner-svn-src-head@freebsd.org Mon May 1 00:53:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19B61D45DBE; Mon, 1 May 2017 00:53:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFEF4C82; Mon, 1 May 2017 00:53:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v410r7Y5061694; Mon, 1 May 2017 00:53:07 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v410r7eB061693; Mon, 1 May 2017 00:53:07 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705010053.v410r7eB061693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 1 May 2017 00:53:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317614 - head/usr.sbin/makefs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 00:53:09 -0000 Author: emaste Date: Mon May 1 00:53:07 2017 New Revision: 317614 URL: https://svnweb.freebsd.org/changeset/base/317614 Log: makefs: remove unused cd9660_defaults_set global Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/makefs/cd9660.c Modified: head/usr.sbin/makefs/cd9660.c ============================================================================== --- head/usr.sbin/makefs/cd9660.c Mon May 1 00:42:31 2017 (r317613) +++ head/usr.sbin/makefs/cd9660.c Mon May 1 00:53:07 2017 (r317614) @@ -186,8 +186,6 @@ cd9660_allocate_cd9660node(void) return temp; } -int cd9660_defaults_set = 0; - /** * Set default values for cd9660 extension to makefs */ @@ -234,8 +232,6 @@ cd9660_set_defaults(iso9660_disk *diskSt strcpy(diskStructure->primaryDescriptor.system_id, "FreeBSD"); - cd9660_defaults_set = 1; - /* Boot support: Initially disabled */ diskStructure->has_generic_bootimage = 0; diskStructure->generic_bootimage = NULL; From owner-svn-src-head@freebsd.org Mon May 1 01:42:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D67BFD58E14; Mon, 1 May 2017 01:42:27 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A86131CC0; Mon, 1 May 2017 01:42:27 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v411gQoe082716; Mon, 1 May 2017 01:42:26 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v411gQlH082715; Mon, 1 May 2017 01:42:26 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201705010142.v411gQlH082715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 1 May 2017 01:42:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317620 - head/sbin/ifconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 01:42:27 -0000 Author: asomers Date: Mon May 1 01:42:26 2017 New Revision: 317620 URL: https://svnweb.freebsd.org/changeset/base/317620 Log: Fix a comment that's been wrong ever since this file was imported in 1997 Modified: head/sbin/ifconfig/ifmedia.c Modified: head/sbin/ifconfig/ifmedia.c ============================================================================== --- head/sbin/ifconfig/ifmedia.c Mon May 1 01:40:24 2017 (r317619) +++ head/sbin/ifconfig/ifmedia.c Mon May 1 01:42:26 2017 (r317620) @@ -371,7 +371,7 @@ setmediamode(const char *val, int d, int } /********************************************************************** - * A good chunk of this is duplicated from sys/net/ifmedia.c + * A good chunk of this is duplicated from sys/net/if_media.c **********************************************************************/ static struct ifmedia_description ifm_type_descriptions[] = From owner-svn-src-head@freebsd.org Mon May 1 01:56:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 214FDD58342; Mon, 1 May 2017 01:56:13 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E760CBD0; Mon, 1 May 2017 01:56:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v411uBM7087622; Mon, 1 May 2017 01:56:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v411uBGM087621; Mon, 1 May 2017 01:56:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705010156.v411uBGM087621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 1 May 2017 01:56:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317626 - head/contrib/elftoolchain/cxxfilt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 01:56:13 -0000 Author: emaste Date: Mon May 1 01:56:11 2017 New Revision: 317626 URL: https://svnweb.freebsd.org/changeset/base/317626 Log: revert r308465: c++filt: flush output after newline The ELF Tool Chain update to r3520 uses setvbuf to set line buffering. Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/cxxfilt/cxxfilt.c Modified: head/contrib/elftoolchain/cxxfilt/cxxfilt.c ============================================================================== --- head/contrib/elftoolchain/cxxfilt/cxxfilt.c Mon May 1 01:54:03 2017 (r317625) +++ head/contrib/elftoolchain/cxxfilt/cxxfilt.c Mon May 1 01:56:11 2017 (r317626) @@ -189,8 +189,6 @@ main(int argc, char **argv) if (c == EOF) break; putchar(c); - if (c == '\n') - fflush(stdout); } else { if ((size_t) p >= sizeof(buf) - 1) warnx("buffer overflowed"); From owner-svn-src-head@freebsd.org Mon May 1 04:32:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D34CD58797; Mon, 1 May 2017 04:32:23 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 39E42F37; Mon, 1 May 2017 04:32:23 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x244.google.com with SMTP id v1so14588216pgv.3; Sun, 30 Apr 2017 21:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=QHCJDH8h/9D0X3lgF+rcHEIYiYof6Ymnaragme3/uao=; b=dawkuwDVjQKRk4aFU7zF8cNQ6MKWCGXV04GuBoZcOgP8BunLSEHZgRXGyT4cZBnJ5R Wj6NdCwB0wRRLFmKFRaBVIngu382jFL99SwSQdUy1DfJLW/GWNQYgCRuw/5DUClJbO8O 4gqV/fLLrm/5TDZz2NKZDVYf11M22K7XVdaYEF3AOl3w/L+ozCrhQbQXBfkBHFCbScYd h8Wl4frU3aINZESVkdMDv+UvwF/HlqXHSGUDu2B6serbz8lQZUtfLzLhyAYoucsiBCsI xLLm/b++RnQcFSV1c7ryHSI3xl7qiDBdd3iH1gbh/AdfOszoJ4/3kZJNgZ1rodxIQ2ZE ocoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=QHCJDH8h/9D0X3lgF+rcHEIYiYof6Ymnaragme3/uao=; b=ZKJAaLKOW+85zA0fnEracOsGqKOSnEtPamRJO6gA7Ijk+A/13jD+Rygqy0h5gz+6p2 puE43hp9xaPkMVgsH1nsatMz9V2av6p88B56tiEQ+oDJcANXw1jN12vXVQc+AL+gi+IK NKjQY4i0YMbFJD7ZvPXyhHNY3v8jihtyoCy3na3UHzIbegMmAxlqbyv7CZoU6v6ZG71g zq9jmVd/FjIppGVXpphYkXi/iuotcrhUyPF2UDUNymb3B7yAZJSHOKoaClch/MpjaomK Qzn13/9EIKZ37dteJf8ssF91m0Oi4aILPxRa4U3eX0XUnnaM7ga5anInEbg++iR0qCzs NSZg== X-Gm-Message-State: AN3rC/6HqlLOOR87N/C8XQGMGyAZOq8cpKgz7wJQOsaznyz7QWZ7WD9P UCSzWOJJLz2u8re3jsA= X-Received: by 10.84.205.70 with SMTP id o6mr31595234plh.63.1493613142828; Sun, 30 Apr 2017 21:32:22 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id s89sm21862005pfi.79.2017.04.30.21.32.21 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 30 Apr 2017 21:32:21 -0700 (PDT) Subject: Re: svn commit: r317600 - in head/sys: amd64/vmm/amd modules/vmm Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_B8AD2F48-D6E0-496F-A3D4-5C8EB5B6E0CC"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <11FF3746-5B36-47A2-B44C-9ED53AE02F03@gmail.com> Date: Sun, 30 Apr 2017 21:32:20 -0700 Cc: Anish Gupta , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <90675112-83AD-4012-8BA2-F0736DAE88D5@gmail.com> References: <201704300208.v3U28lZo093446@repo.freebsd.org> <11FF3746-5B36-47A2-B44C-9ED53AE02F03@gmail.com> To: Matteo Riondato X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 04:32:23 -0000 --Apple-Mail=_B8AD2F48-D6E0-496F-A3D4-5C8EB5B6E0CC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Apr 30, 2017, at 07:35, Matteo Riondato wrote: >=20 >=20 >> On Apr 29, 2017, at 10:08 PM, Anish Gupta wrote: >>=20 >> Author: anish >> Date: Sun Apr 30 02:08:46 2017 >> New Revision: 317600 >> URL: https://svnweb.freebsd.org/changeset/base/317600 >>=20 >> Log: >> Add AMD IOMMU/AMD-Vi support in bhyve for passthrough/direct = assignment to VMs. To enable AMD-Vi, set hw.vmm.amdvi.enable=3D1. >=20 > This knob should likely be documented somewhere, and maybe also = "Relnotes: yes" ? Good catch. The knob should be documented in the driver manpage. Thanks! -Ngie --Apple-Mail=_B8AD2F48-D6E0-496F-A3D4-5C8EB5B6E0CC Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZBrpUAAoJEPWDqSZpMIYVW6gP/3EtwQmgdwsWc0oYiEtaiCeO W+w3X2PL/QgPVg8dWJ9WIQCcnhd/5U6GZao5vEjiUMKs8CsJe6hsz1DsT6WsCT4W KChrgUwriXybIzS/Vc2BFuONAkTOMw/m3QtG2TMovffU8Yjp8V+iHgDI0O2hy5Sz c8HsfcFP4sYhydshnE16XbM3hi+9rwSNE02BDgEU8AvM2ONZ6KNLFskBAZ0h1fu5 qE7ll/F0Ij+C6zcPIYGhz5buje3zBy4LyGpg/i/Z48JINIMbqr54pI7fkt9vRZgh jtnp+Z3QHzcqZKLEpbsxaPSuXzwagfOkEHm5oSNf+nHkYGvWUNaR4LxtIj6WGhu2 ICOkzHnjpOlAqDetWYtR05O68KfbQn9Lu2AX5mLR99fKwsBz6UZnt9geuv3E41Xw r6DPqeNeaCExMEAubcH0wbBj35rSYlpbD3PA4j80+WUyrM6IvfN+67Eb5/eFn3Yh cMC7kw3A/1PjFyJu2Im78zAzvpw+Uym/aj6PoyRkJf4dBhfJPcNwUgaU5cE9HHk6 fCTs/jCG3MtVm+PcgwQ+29eanAB0nOt2riVDxhqlIScl4JdfMOZmusQ5QmAK1WUx 4eHqPR0E7Dj2LZfeN8N7hEB3JEpK258T6bTG123HZF0pWvYBZL8Kilpyp7oj7xoc mmczb++/aN82GAqiKxAH =IW7c -----END PGP SIGNATURE----- --Apple-Mail=_B8AD2F48-D6E0-496F-A3D4-5C8EB5B6E0CC-- From owner-svn-src-head@freebsd.org Mon May 1 05:59:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE99ED5CE8C; Mon, 1 May 2017 05:59:53 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE3AAF44; Mon, 1 May 2017 05:59:53 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v415xq0n085700; Mon, 1 May 2017 05:59:52 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v415xqx2085699; Mon, 1 May 2017 05:59:52 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201705010559.v415xqx2085699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 1 May 2017 05:59:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317632 - head/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 05:59:54 -0000 Author: ngie Date: Mon May 1 05:59:52 2017 New Revision: 317632 URL: https://svnweb.freebsd.org/changeset/base/317632 Log: Fix "make cscope-clean" when .OBJDIR already exists The cscope generated files are always put in .CURDIR . MFC after: 1 month Sponsored by: Dell EMC Isilon Modified: head/sys/Makefile Modified: head/sys/Makefile ============================================================================== --- head/sys/Makefile Mon May 1 05:54:33 2017 (r317631) +++ head/sys/Makefile Mon May 1 05:59:52 2017 (r317632) @@ -32,7 +32,8 @@ ${.CURDIR}/cscope.files: .PHONY find ${CSCOPEDIRS} -name "*.[chSsly]" -a -type f > ${.TARGET} cscope-clean: - rm -f cscope.files cscope.out cscope.in.out cscope.po.out + cd ${.CURDIR}; \ + rm -f cscope.files cscope.out cscope.in.out cscope.po.out # # Installs SCM hooks to update the cscope database every time the source tree From owner-svn-src-head@freebsd.org Mon May 1 05:54:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22B6BD5C74F; Mon, 1 May 2017 05:54:35 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E77EAD73; Mon, 1 May 2017 05:54:34 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v415sXwD085476; Mon, 1 May 2017 05:54:33 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v415sX3A085475; Mon, 1 May 2017 05:54:33 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201705010554.v415sX3A085475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 1 May 2017 05:54:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317631 - head/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 05:54:35 -0000 Author: ngie Date: Mon May 1 05:54:33 2017 New Revision: 317631 URL: https://svnweb.freebsd.org/changeset/base/317631 Log: Fix "make cscope" after r317411 Sponsored by: Dell EMC Isilon Modified: head/sys/Makefile Modified: head/sys/Makefile ============================================================================== --- head/sys/Makefile Mon May 1 02:08:44 2017 (r317630) +++ head/sys/Makefile Mon May 1 05:54:33 2017 (r317631) @@ -3,7 +3,7 @@ # Directories to include in cscope name file and TAGS. CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \ geom gnu isa kern libkern modules net net80211 \ - netgraph netinet netinet6 netipsec netnatm netpfil \ + netgraph netinet netinet6 netipsec netpfil \ netsmb nfs nfsclient nfsserver nlm ofed opencrypto \ rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR} .if !defined(CSCOPE_ARCHDIR) From owner-svn-src-head@freebsd.org Mon May 1 08:25:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72EA1D58889; Mon, 1 May 2017 08:25:27 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id EAD031E2C; Mon, 1 May 2017 08:25:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 5F24A106670; Mon, 1 May 2017 18:25:15 +1000 (AEST) Date: Mon, 1 May 2017 18:25:11 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , Alan Somers , Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs... In-Reply-To: <20170430201324.GV1622@kib.kiev.ua> Message-ID: <20170501163725.U972@besplex.bde.org> References: <201704171734.v3HHYlf5022945@repo.freebsd.org> <20170419130428.J956@besplex.bde.org> <20170430201324.GV1622@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=AYLBJzfG c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=3k7yWw-cxINEvggbrqQA:9 a=3FEMvmqPBOvLgTTy:21 a=ADBJ0AdOzlxKT8_j:21 a=1DRM5oOrNcreRuyr:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 08:25:27 -0000 On Sun, 30 Apr 2017, Konstantin Belousov wrote: > On Wed, Apr 19, 2017 at 02:09:58PM +1000, Bruce Evans wrote: >> On Tue, 18 Apr 2017, Alan Somers wrote: >> >>> On Mon, Apr 17, 2017 at 11:34 AM, Gleb Smirnoff wrote: >> >>>> head/usr.bin/top/machine.c >>>> head/usr.bin/vmstat/vmstat.c >> >> The previous 2 lines turn out to be relevant. I missed the update to >> vmstat and checked a wrong version in my bug report described below >> I checked an updated top, but the change seemed too small to help. >> systat was not updated. >> >>> This change broke backwards compatibility with old top binaries. When >>> I use a kernel at version 317094 but a top from 14-April, I get the >>> error "top: sysctl(vm.stats.vm.v_swappgsin...) failed: Cannot allocate >>> memory". I get the same error when running top from an 11.0-RELEASE >>> jail. Can you please add backward compatibility shims? >> >> I sent a much longer (30 times longer) bug report to the author of the >> bug. >> >> Most or all statistics utilities that use vmmeter are broken. vmstat >> is too broken to even notice the bug -- it silently ignores the error, >> an has type errors which prevent other errors which it doesn't ignore. >> The result is silently truncating to 32 bits, like a quick fix would >> do intentionally. systat -v detects the errors but prints warning >> messages to the status line where they overwrite each other so make >> the problem look smaller than it is. The result is unsilently >> truncating to 32 bits. >> >> I've never seen any backwards compatibility shims added for sysctls. >> None should be needed, but there are few or no utilities other than >> sysctl(8) which use sysctl(3) in a portable way. > See vfs.bufspace handled by vfs_bio.c:sysctl_bufspace(). Ugh. My fix for this continues to work fine. It handles about 162 combinations of integer sizes/signedness for all sysctls in not much more space than sysctl_bufspace(). Unfortunately, the full version breaks the API slightly (it even breaks sysctl(8)), and the dumbed down version causes problems although it technically doesn't change the API. sysctl_bufspace() also changes the API slightly, much like my dumbed down version. This tends to break probes. > In fact, not only top and vmstat are broken. Quite unexpected and > worrying, reboot(8) is broken as well. This is due to get_pageins() > failing and system stopping userspace much earlier than it is desirable. > > I now believe that compat shims to handle int-sized vmstat queries are > required. Here are my current versions and a test program (mainly for old design and implementation bugs with short reads and writes). XX Index: kern_sysctl.c XX =================================================================== XX --- kern_sysctl.c (revision 317604) XX +++ kern_sysctl.c (working copy) This version changes the API too much, and I now use the simpler patch to fix the immediate problem with counters. The full version of it does: - let userland do reads and writes of integers with any size large enough to hold the value - new errno EOVERFLOW for userland sizes that are not large enough. This replaces ENOMEM in most cases for integer sysctls. Only oldlen = 0 should mean to probe. - new errno EOVERFLOW for kernel sizes that are not large enough. Be more careful not to write anything if the kernel size is not large enough. The previous errno for this is EINVAL. - it is no longer very fragile to read with a type larger than the kernel type. The kernel expands to the requested size. This used to be a non-error with garbage in the bits after the end of the unexpanded kernel size. - it is now possible to write with a type smaller than the kernel type. The kernel expands to its size. The case is documented to fail with EINVAL, and works as documented IIRC. - it is now possible to write correctly with a type larger than the kernel type, provided the value fits. The case is documented to fail with EINVAL, but IIRC it is the case that has been broken for almost 20 years. Usually, the bug is harmless since the value fits (due to are 0's or 1's in the unwritten top bits). The dumbed down version keeps ENOMEM instead of EOVERFLOW, and doesn't allow all combinations of sizes. For the counter ABI change, the case where the userland variable is smaller must be supported for reading, and the opposite is not needed yet. I forget what happens for writing. XX @@ -1344,6 +1344,302 @@ XX return (error); XX } XX XX +int sysctl_uicvt(const void *src, size_t srclen, void *dst, size_t dstlen); XX +int XX +sysctl_uicvt(const void *src, size_t srclen, void *dst, size_t dstlen) XX +{ XX + uintmax_t val, valtrunc; XX + uint64_t val64; XX + uint32_t val32; XX + uint16_t val16; XX + uint8_t val8; XX + XX + if (dstlen > sizeof(uintmax_t)) XX + dstlen = sizeof(uintmax_t); XX + if (dstlen > srclen) XX + dstlen = srclen; The conversion functions are trivial, but not as small or as fast as they could be. In most case, no conversion is needed. These dstlen adjustments are dumbing down. The first one is mainly to reduce the number of cases, but is not quite write. Suppose that the userland uintmax_t is larger than the kernel's, or userland is reading into a large u_char array or struct for some reason. Then reducing dstlen to sizeof(uintmax_t) gives garbage after the end of a uintmax_t, the same as in the current API. The second one loses the size adjustment in 1 direction -- see below. This is complicated and perhaps buggy because it tries to support both directions in userland <-> kernel in shared code. XX + switch (srclen) { XX + case 1: XX + val = *(const int8_t *)src; XX + break; XX + case 2: XX + val = *(const int16_t *)src; XX + break; XX + case 4: XX + val = *(const int32_t *)src; XX + break; XX + case 8: XX + val = *(const int64_t *)src; XX + break; XX + default: XX + bcopy(src, dst, MIN(srclen, dstlen)); XX + return (srclen); XX + } XX + XX + switch (dstlen) { XX + case 1: XX + valtrunc = val8 = val; XX + src = &val8; XX + break; XX + case 2: XX + valtrunc = val16 = val; XX + src = &val16; XX + break; XX + case 4: XX + valtrunc = val32 = val; XX + src = &val32; XX + break; XX + case 8: XX + valtrunc = val64 = val; XX + src = &val64; XX + break; XX + default: XX + valtrunc = val - 1; XX + break; XX + } XX + if (valtrunc != val) { XX + if (dstlen != 0) XX + printf("val %#jx, valtrunc %#jx\n", val, valtrunc); XX + bcopy(src, dst, dstlen); XX + return (srclen); XX + } else { XX + bcopy(src, dst, dstlen); XX + return (dstlen); XX + } XX +} XX + XX +/* Output a signed integer if possible. */ XX +static int XX +sysctl_out_i(struct sysctl_req *req, intmax_t val, size_t kernlen) XX +{ XX + size_t len; XX + intmax_t valtrunc; XX + int64_t val64; XX + int32_t val32; XX + int16_t val16; XX + int8_t val8; XX + int error; XX + XX + len = req->oldlen != 0 ? req->oldlen : kernlen; XX + /* XX + * XXX: sysctl(8) determines the correct length, but then twee-ly XX + * doubles it, so we can't tell the application's integer size. XX + * If we supplied the doubled length (as is possible up to size 4), XX + * then sysctl(8) would treat the result as an array. XX + * XX + * Work around this by only supplying the default length if that XX + * fits. This restores the original broken behaviour of not XX + * extending, so applications get garbage in the top bits if they XX + * use a larger integer size. XX + */ XX + if (len > kernlen) XX + len = kernlen; See the comment. Without this hack, sysctl(8) prints most variables as "v 0", where v is the correct output, because it sees int as [u_]int[2]. Statistics utilities are not as "smart" as sysctl, so they kept seeing plain [u_]int, as intended for the counter variables which became uint64_t. XX + switch (len) { XX + case 1: XX + valtrunc = val8 = val; XX + error = SYSCTL_OUT(req, &val8, 1); XX + break; XX + case 2: XX + valtrunc = val16 = val; XX + error = SYSCTL_OUT(req, &val16, 2); XX + break; XX + case 4: XX + valtrunc = val32 = val; XX + error = SYSCTL_OUT(req, &val32, 4); XX + break; XX + case 8: XX + valtrunc = val64 = val; XX + error = SYSCTL_OUT(req, &val64, 8); XX + break; XX + default: XX + /* XXX: not quite compat; should convert back to kernel type. */ XX + return (SYSCTL_OUT(req, &val, sizeof(val))); XX + } XX + if (valtrunc != val && error == 0) { XX + printf("val %#jx, valtrunc %#jx\n", val, valtrunc); XX + error = ENOMEM; /* should be EOVERFLOW */ XX + } XX + return (error); XX +} XX + XX +/* Output an usigned integer if possible. */ XX +static int XX +sysctl_out_ui(struct sysctl_req *req, uintmax_t val, size_t kernlen) XX +{ XX + size_t len; XX + uintmax_t valtrunc; XX + uint64_t val64; XX + uint32_t val32; XX + uint16_t val16; XX + uint8_t val8; XX + int error; XX + XX + len = req->oldlen != 0 ? req->oldlen : kernlen; XX + if (len > kernlen) XX + len = kernlen; XX + switch (len) { XX + case 1: XX + valtrunc = val8 = val; XX + error = SYSCTL_OUT(req, &val8, 1); XX + break; XX + case 2: XX + valtrunc = val16 = val; XX + error = SYSCTL_OUT(req, &val16, 2); XX + break; XX + case 4: XX + valtrunc = val32 = val; XX + error = SYSCTL_OUT(req, &val32, 4); XX + break; XX + case 8: XX + valtrunc = val64 = val; XX + error = SYSCTL_OUT(req, &val64, 8); XX + break; XX + default: XX + return (SYSCTL_OUT(req, &val, sizeof(val))); XX + } XX + if (valtrunc != val && error == 0) { XX + printf("val %#jx, valtrunc %#jx\n", val, valtrunc); XX + error = ENOMEM; /* should be EOVERFLOW */ XX + } XX + return (error); XX +} XX + XX +/* Input a signed integer if possible. */ XX +static int XX +sysctl_in_i(struct sysctl_req *req, void *valp, size_t kernlen) XX +{ XX + intmax_t val; XX + int64_t val64; XX + int32_t val32; XX + int16_t val16; XX + int8_t val8; XX + int error; XX + XX + switch (req->newlen) { XX + case 1: XX + error = SYSCTL_IN(req, &val8, 1); XX + val = val8; XX + break; XX + case 2: XX + error = SYSCTL_IN(req, &val16, 2); XX + val = val16; XX + break; XX + case 4: XX + error = SYSCTL_IN(req, &val32, 4); XX + val = val32; XX + break; XX + case 8: XX + error = SYSCTL_IN(req, &val64, 8); XX + val = val64; XX + break; XX + default: XX + /* Only kernel lengths are supported; we hard-code {1,2,4,8}. */ XX + error = EINVAL; XX + break; XX + } XX + if (error != 0) XX + return (error); XX + XX + switch (kernlen) { XX + case 1: XX + if ((int8_t)val == val) XX + *(int8_t *)valp = val; XX + else XX + error = EINVAL; /* should be EOVERFLOW everywhere */ XX + break; XX + case 2: XX + if ((int16_t)val == val) XX + *(int16_t *)valp = val; XX + else XX + error = EINVAL; XX + break; XX + case 4: XX + if ((int32_t)val == val) XX + *(int32_t *)valp = val; XX + else XX + error = EINVAL; XX + break; XX + case 8: XX + if ((uint64_t)val == val) XX + *(uint64_t *)valp = val; XX + else XX + error = EINVAL; XX + default: XX + error = EDOOFUS; XX + break; XX + } XX + return (error); XX +} XX + XX +/* Input an unsigned integer if possible. */ XX +static int XX +sysctl_in_ui(struct sysctl_req *req, void *valp, size_t kernlen) XX +{ XX + uintmax_t val; XX + uint64_t val64; XX + uint32_t val32; XX + uint16_t val16; XX + uint8_t val8; XX + int error; XX + XX + switch (req->newlen) { XX + case 1: XX + error = SYSCTL_IN(req, &val8, 1); XX + val = val8; XX + break; XX + case 2: XX + error = SYSCTL_IN(req, &val16, 2); XX + val = val16; XX + break; XX + case 4: XX + error = SYSCTL_IN(req, &val32, 4); XX + val = val32; XX + break; XX + case 8: XX + default: XX + if (req->newlen == sizeof(val)) XX + error = SYSCTL_IN(req, &val, sizeof(val)); XX + else if (req->newlen == 8) { XX + error = SYSCTL_IN(req, &val64, 8); XX + val = val64; XX + } else XX + error = EINVAL; XX + break; XX + } XX + if (error != 0) XX + return (error); XX + XX + switch (kernlen) { XX + case 1: XX + if ((uint8_t)val == val) XX + *(uint8_t *)valp = val; XX + else XX + error = EINVAL; XX + break; XX + case 2: XX + if ((uint16_t)val == val) XX + *(uint16_t *)valp = val; XX + else XX + error = EINVAL; XX + break; XX + case 4: XX + if ((uint32_t)val == val) XX + *(uint32_t *)valp = val; XX + else XX + error = EINVAL; XX + break; XX + case 8: XX + if ((uint64_t)val == val) XX + *(uint64_t *)valp = val; XX + else XX + error = EINVAL; XX + break; XX + default: XX + error = EDOOFUS; XX + } XX + return (error); XX +} XX + XX /* XX * Handle an int, signed or unsigned. XX * Two cases: XX @@ -1354,24 +1650,35 @@ XX int XX sysctl_handle_int(SYSCTL_HANDLER_ARGS) XX { XX - int tmpout, error = 0; XX + int error; XX XX - /* XX - * Attempt to get a coherent snapshot by making a copy of the data. XX - */ XX - if (arg1) XX - tmpout = *(int *)arg1; XX - else XX - tmpout = arg2; XX - error = SYSCTL_OUT(req, &tmpout, sizeof(int)); XX + switch (oidp->oid_kind & CTLTYPE) { XX + case CTLTYPE_UINT: XX + error = sysctl_out_ui(req, XX + arg1 != NULL ? *(u_int *)arg1 : arg2, sizeof(u_int)); XX + break; XX + case CTLTYPE_INT: XX + default: XX + error = sysctl_out_i(req, XX + arg1 != NULL ? *(int *)arg1 : arg2, sizeof(int)); XX + break; XX + } XX XX if (error || !req->newptr) XX return (error); XX XX if (!arg1) XX - error = EPERM; XX - else XX - error = SYSCTL_IN(req, arg1, sizeof(int)); XX + return (EPERM); XX + XX + switch (oidp->oid_kind & CTLTYPE) { XX + case CTLTYPE_UINT: XX + error = sysctl_in_ui(req, arg1, sizeof(int)); XX + break; XX + case CTLTYPE_INT: XX + default: XX + error = sysctl_in_i(req, arg1, sizeof(int)); XX + break; XX + } XX return (error); XX } I only fixed sysctl_handle_int(), including style bugs and its type puns for u_int. All of the integer handling functions should be in this one, with the case statement expanded in the obvious way. XX XX Index: subr_counter.c XX =================================================================== XX --- subr_counter.c (revision 317604) XX +++ subr_counter.c (working copy) XX @@ -78,11 +78,15 @@ XX sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS) XX { XX uint64_t out; XX + uint32_t out32; XX int error; XX XX out = counter_u64_fetch(*(counter_u64_t *)arg1); XX XX - error = SYSCTL_OUT(req, &out, sizeof(uint64_t)); XX + if (req->oldlen == 4 && (out32 = out) == out) XX + error = SYSCTL_OUT(req, &out32, sizeof(out32)); XX + else XX + error = SYSCTL_OUT(req, &out, sizeof(out)); XX XX if (error || !req->newptr) XX return (error); This does the minimum necessary to fix the current problem. This works until the counters become too large for a u_int. There could be an option to get truncation with no error, but that would require an API change, so applications should be required to do the truncation for themself if that is what they want. "Smart" applications are still broken by the above. They might have support for reading with 64 bit sizes, but probe with 32-bit sizes. Then the above will succeed early, but later when the counters overflow the sysctl will start failing. It fails with the old errno of ENOMEM, so the "smart" applications should start using 64 bit sizes, but it might assume that the initial sizing is enough for integers. After all, the size of an integer can't change in the kernel while the kernel is running, and the API tacitly implies returning actual kernel integers and not their representation in any convenient smaller type. Test program. It tests mainly for old bugs involving no errors for short reads and writes. After the API change, these non-errors become correct. YY #include YY #include YY YY #include YY #include YY #include YY #include YY YY #define TESTMIB "vfs.ffs.doasyncfree" YY YY /* Use for initialization and later tests. */ YY static void YY get(int32_t *oldvalp) YY { YY size_t oldlen; YY YY oldlen = sizeof(*oldvalp); YY if (sysctlbyname(TESTMIB, oldvalp, &oldlen, NULL, 0) != 0) YY err(1, "basic: read failed"); YY /* YY * It is currently difficult to find the correct size/type to use. YY * Assume that the size is 32 bits here since the focus is not quite YY * on the design errors behind that, and we want to do a safe null YY * change to the MIB (the kernel variable should be a bool or a YY * 1-bit bit-field, and we should be able to set it to 0 or 1 but YY * no other values using any integer type (but not a bit-field). YY */ YY if (oldlen != sizeof(*oldvalp)) YY err(1, "basic: size mismatch"); YY } YY YY /* Use for initial test and unclobber. */ YY static void YY set(int32_t newval) YY { YY size_t newlen; YY YY newlen = sizeof(newval); YY if (sysctlbyname(TESTMIB, NULL, NULL, &newval, YY newlen) != 0) YY err(1, "basic: write failed"); YY } YY YY int YY main(void) YY { YY size_t newlen, oldlen; YY int64_t longnewval, longoldval; YY int32_t oldval, origval; YY int16_t shortnewval, shortoldval; YY int error; YY YY /* Normal operation. */ YY get(&origval); YY set(origval); YY warnx("basic: passed: val %d", origval); YY YY /* Long read. No bugs expected. Just design errors. */ YY shortoldval = ~origval; YY oldlen = sizeof(shortoldval); YY error = sysctlbyname(TESTMIB, &shortoldval, &oldlen, NULL, 0); YY if (error == 0 && shortoldval == origval) YY warnx("long read: unexpectedly worked right"); YY else if (error == 0) YY warnx("long read: unexpectedly succeeded, but gave garbage"); YY else if (errno != ENOMEM) YY warn("long read: failed with unexpected errno"); YY else YY warnx("long read: passed"); YY YY /* Short read. No bugs expected. Just design errors. */ YY longoldval = ~origval; YY oldlen = sizeof(longoldval); YY error = sysctlbyname(TESTMIB, &longoldval, &oldlen, NULL, 0); YY if (error != 0) YY warn("short read: failed"); YY else if (longoldval != origval) YY warnx("short read: passed: garbage in top bits as expected"); YY else if (oldlen == sizeof(longoldval) && longoldval == origval) YY warnx("short read: unexpectedly worked right"); YY else YY warnx("short read: succeeded with right val but wrong length"); YY YY /* Long write. Expect success with top bits not written (broken). */ YY longnewval = 0x100000666; /* unrepresentable */ YY newlen = sizeof(longnewval); YY error = sysctlbyname(TESTMIB, NULL, NULL, &longnewval, newlen); YY get(&oldval); YY if (error != 0 && errno == EINVAL) YY warnx("long write: unexpectedly unbroken (failed with EINVAL)"); YY else if (error == 0 && oldval == 0x666) YY warnx("long write: broken as expected (success and value)"); YY else if (error == 0) YY warnx("long write: more broken than expected (succ. and !val)"); YY else YY warn("long write: failed with unexpected errno"); YY if (oldval == origval) YY warnx("long write: preserved value"); YY else if (oldval == longnewval) YY warnx("long write: set value correctly (impossible)"); YY else YY warnx("long write: clobbered value"); YY set(origval); YY YY /* Another case for long write. */ YY longnewval = -1; /* representable assuming signed */ YY newlen = sizeof(longnewval); YY error = sysctlbyname(TESTMIB, NULL, NULL, &longnewval, newlen); YY get(&oldval); YY if (error != 0 && errno == EINVAL) YY warnx("long write: unexpectedly unbroken (failed with EINVAL)"); YY else if (error == 0 && oldval == longnewval) YY warnx("long write: broken as expected, or working"); YY else if (error == 0) YY warnx("long write: more broken than expected (succ. and !val)"); YY else YY warn("long write: failed with unexpected errno"); YY if (oldval == origval) YY warnx("long write: preserved value"); YY else if (oldval == longnewval) YY warnx("long write: set value correctly"); YY else YY warnx("long write: clobbered value"); YY set(origval); YY YY /* Short write. No bugs expected. Just design errors. */ YY shortnewval = origval + 1; YY newlen = sizeof(shortnewval); YY error = sysctlbyname(TESTMIB, NULL, NULL, &shortnewval, newlen); YY get(&oldval); YY if (error == 0 && oldval == shortnewval) YY warnx("short write: unexpectedly worked"); YY else if (error == 0) YY warnx("short write: unexpectedly succeed but set garbage"); YY else if (errno != EINVAL) YY warn("short write: failed with unexpected errno"); YY else YY warnx("short write: passed"); YY if (oldval == origval) YY warnx("short write: preserved value"); YY else if (oldval == shortnewval) YY warnx("short write: set value correctly"); YY else YY warnx("short write: clobbered value"); YY set(origval); YY return (0); YY } Bruce From owner-svn-src-head@freebsd.org Mon May 1 12:25:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B4A7D58CF0; Mon, 1 May 2017 12:25:38 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D509922; Mon, 1 May 2017 12:25:38 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41CPbPX043211; Mon, 1 May 2017 12:25:37 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41CPbA6043210; Mon, 1 May 2017 12:25:37 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201705011225.v41CPbA6043210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Mon, 1 May 2017 12:25:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317645 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 12:25:38 -0000 Author: dchagin Date: Mon May 1 12:25:37 2017 New Revision: 317645 URL: https://svnweb.freebsd.org/changeset/base/317645 Log: Fix NULL pointer dereference in futex_wake_op() in case when the same address specified for arguments uaddr and uaddr2. PR: 218987 Reported by: luke.tw gmail MFC after: 1 week Modified: head/sys/compat/linux/linux_futex.c Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Mon May 1 10:12:59 2017 (r317644) +++ head/sys/compat/linux/linux_futex.c Mon May 1 12:25:37 2017 (r317645) @@ -952,6 +952,11 @@ retry1: args->uaddr, args->val, args->uaddr2, args->val3, args->timeout); + if (args->uaddr == args->uaddr2) { + LIN_SDT_PROBE1(futex, linux_sys_futex, return, EINVAL); + return (EINVAL); + } + retry2: error = futex_get(args->uaddr, NULL, &f, flags | FUTEX_DONTLOCK); if (error) { @@ -959,9 +964,7 @@ retry2: return (error); } - if (args->uaddr != args->uaddr2) - error = futex_get(args->uaddr2, NULL, &f2, - flags | FUTEX_DONTLOCK); + error = futex_get(args->uaddr2, NULL, &f2, flags | FUTEX_DONTLOCK); if (error) { futex_put(f, NULL); From owner-svn-src-head@freebsd.org Mon May 1 12:56:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9907D58BE3; Mon, 1 May 2017 12:56:13 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B985E357; Mon, 1 May 2017 12:56:13 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41CuCGl058366; Mon, 1 May 2017 12:56:12 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41CuChd058365; Mon, 1 May 2017 12:56:12 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201705011256.v41CuChd058365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Mon, 1 May 2017 12:56:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317648 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 12:56:14 -0000 Author: jpaetzel Date: Mon May 1 12:56:12 2017 New Revision: 317648 URL: https://svnweb.freebsd.org/changeset/base/317648 Log: Fix misport of compressed ZFS send/recv from 317414 Reported by: Michael Jung Reviewed by: avg Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon May 1 12:42:06 2017 (r317647) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Mon May 1 12:56:12 2017 (r317648) @@ -962,7 +962,7 @@ zio_free_sync(zio_t *pio, spa_t *spa, ui flags |= ZIO_FLAG_DONT_QUEUE; zio = zio_create(pio, spa, txg, bp, NULL, size, - BP_GET_PSIZE(bp), NULL, NULL, ZIO_TYPE_FREE, ZIO_PRIORITY_NOW, + size, NULL, NULL, ZIO_TYPE_FREE, ZIO_PRIORITY_NOW, flags, NULL, 0, NULL, ZIO_STAGE_OPEN, stage); return (zio); From owner-svn-src-head@freebsd.org Mon May 1 16:28:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45E63D5837F; Mon, 1 May 2017 16:28:47 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0444615E2; Mon, 1 May 2017 16:28:46 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v41GSjgL090809; Mon, 1 May 2017 09:28:45 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v41GSj5b090808; Mon, 1 May 2017 09:28:45 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201705011628.v41GSj5b090808@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r317631 - head/sys In-Reply-To: <201705010554.v415sX3A085475@repo.freebsd.org> To: Ngie Cooper Date: Mon, 1 May 2017 09:28:45 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 16:28:47 -0000 > Author: ngie > Date: Mon May 1 05:54:33 2017 > New Revision: 317631 > URL: https://svnweb.freebsd.org/changeset/base/317631 > > Log: > Fix "make cscope" after r317411 This commit is disconnect netnatm module from build ? Mixed 2 commit messages perhaps? > Sponsored by: Dell EMC Isilon > > Modified: > head/sys/Makefile > > Modified: head/sys/Makefile > ============================================================================== > --- head/sys/Makefile Mon May 1 02:08:44 2017 (r317630) > +++ head/sys/Makefile Mon May 1 05:54:33 2017 (r317631) > @@ -3,7 +3,7 @@ > # Directories to include in cscope name file and TAGS. > CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \ > geom gnu isa kern libkern modules net net80211 \ > - netgraph netinet netinet6 netipsec netnatm netpfil \ > + netgraph netinet netinet6 netipsec netpfil \ > netsmb nfs nfsclient nfsserver nlm ofed opencrypto \ > rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR} > .if !defined(CSCOPE_ARCHDIR) > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Mon May 1 16:30:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16BA8D585B1; Mon, 1 May 2017 16:30:43 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA1BA17C2; Mon, 1 May 2017 16:30:42 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v41GUfCJ090825; Mon, 1 May 2017 09:30:41 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v41GUfVV090824; Mon, 1 May 2017 09:30:41 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201705011630.v41GUfVV090824@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r317632 - head/sys In-Reply-To: <201705010559.v415xqx2085699@repo.freebsd.org> To: Ngie Cooper Date: Mon, 1 May 2017 09:30:41 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 16:30:43 -0000 > Author: ngie > Date: Mon May 1 05:59:52 2017 > New Revision: 317632 > URL: https://svnweb.freebsd.org/changeset/base/317632 > > Log: > Fix "make cscope-clean" when .OBJDIR already exists > > The cscope generated files are always put in .CURDIR . If this is writing to src dir then it should be fixed, or have we abandoned all hope of readonly src tree? > MFC after: 1 month > Sponsored by: Dell EMC Isilon > > Modified: > head/sys/Makefile > > Modified: head/sys/Makefile > ============================================================================== > --- head/sys/Makefile Mon May 1 05:54:33 2017 (r317631) > +++ head/sys/Makefile Mon May 1 05:59:52 2017 (r317632) > @@ -32,7 +32,8 @@ ${.CURDIR}/cscope.files: .PHONY > find ${CSCOPEDIRS} -name "*.[chSsly]" -a -type f > ${.TARGET} > > cscope-clean: > - rm -f cscope.files cscope.out cscope.in.out cscope.po.out > + cd ${.CURDIR}; \ > + rm -f cscope.files cscope.out cscope.in.out cscope.po.out > > # > # Installs SCM hooks to update the cscope database every time the source tree > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Mon May 1 16:31:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C9FCD588F5 for ; Mon, 1 May 2017 16:31:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x229.google.com (mail-it0-x229.google.com [IPv6:2607:f8b0:4001:c0b::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 065B01C53 for ; Mon, 1 May 2017 16:31:52 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x229.google.com with SMTP id e65so26190100ita.1 for ; Mon, 01 May 2017 09:31:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=oLjhCz9w2ZrqrRQNK/4/4hDMJXWBr4nYXc3usROrhyQ=; b=z88QxqP2lczj/WIH4OO/mVzadOV4epsjSWi/ucRGbdaF9z3itiF3N4yu+Nsmoq2eH8 mY9ba2BFiwPvKzzcwtg9mRphYDbUv9CMXdL+uO0O/7FUc8QTMxJhlla2zJBhvJWXOU4D MMDxQonQOF6LQE1k64hSp/uq80IwP3Z9TkZstO1mkwlgwO4d2IYkX5WNMtZtfeyQiZ17 eXOxHB4FEFyh3N/eNLgZhut5nIVCEKrY8RyIU9IiPhJlX3YE1xxUihhQKfaeIVuJISt8 VrZax3LmrxofyIzyrTos10Pj6q9pGJAkguFqew2plj98LkeJbCccM6lyl8YaDDVZFoXQ ktNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=oLjhCz9w2ZrqrRQNK/4/4hDMJXWBr4nYXc3usROrhyQ=; b=HcnGpHSJtIX5DRxvd+npjI47zGPfirxRzLwX1ANzyHOjyZ2OO6EGl5Od2007zlHbYq mwOQgvMQkhtpMWCKQEj8PGqoVnBWrr9RA7H0iwnWSIiNViwADitLJK+0VFlKlg0epi9q aPUKfwaiH0kmweemqEZ5CpHBRk/QkFBV27JYDfOUt9ajsdcjFpmUU5qmQiptCnM8zITd nX01fCt+gcB+cQ0OElugzciTJ/9tIvCrZl6GCHhZyovLD/eZsHR7ve9lD1LyPokNty5X OSM9mhaF/nswR+swiQXP4FJV7c9gKVEqBvg7so9UGAGM0pi67tDAFXk9t6CnHawp71Io Y83g== X-Gm-Message-State: AN3rC/7/mVBjq2r2daplqm3EjCBiLmLtiosXpWealQR9pXK+GYVqWd9u w5Egh/1QIhW/BCS6sGAeUJW1/RSO9g== X-Received: by 10.36.3.136 with SMTP id e130mr6319267ite.64.1493656312053; Mon, 01 May 2017 09:31:52 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.126.6 with HTTP; Mon, 1 May 2017 09:31:51 -0700 (PDT) X-Originating-IP: [2607:fb10:7021:1::4e6c] In-Reply-To: <201705011628.v41GSj5b090808@pdx.rh.CN85.dnsmgr.net> References: <201705010554.v415sX3A085475@repo.freebsd.org> <201705011628.v41GSj5b090808@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Mon, 1 May 2017 10:31:51 -0600 X-Google-Sender-Auth: vQUI7DxIa1L5C_BJupslmHD7U_o Message-ID: Subject: Re: svn commit: r317631 - head/sys To: "Rodney W. Grimes" Cc: Ngie Cooper , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 16:31:53 -0000 No, this disconnected netnatm from the cscope target. sys/Makefile is normally unused otherwise in the build process. Warner On Mon, May 1, 2017 at 10:28 AM, Rodney W. Grimes wrote: >> Author: ngie >> Date: Mon May 1 05:54:33 2017 >> New Revision: 317631 >> URL: https://svnweb.freebsd.org/changeset/base/317631 >> >> Log: >> Fix "make cscope" after r317411 > > This commit is disconnect netnatm module from build > > ? Mixed 2 commit messages perhaps? > >> Sponsored by: Dell EMC Isilon >> >> Modified: >> head/sys/Makefile >> >> Modified: head/sys/Makefile >> ============================================================================== >> --- head/sys/Makefile Mon May 1 02:08:44 2017 (r317630) >> +++ head/sys/Makefile Mon May 1 05:54:33 2017 (r317631) >> @@ -3,7 +3,7 @@ >> # Directories to include in cscope name file and TAGS. >> CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \ >> geom gnu isa kern libkern modules net net80211 \ >> - netgraph netinet netinet6 netipsec netnatm netpfil \ >> + netgraph netinet netinet6 netipsec netpfil \ >> netsmb nfs nfsclient nfsserver nlm ofed opencrypto \ >> rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR} >> .if !defined(CSCOPE_ARCHDIR) >> >> > > -- > Rod Grimes rgrimes@freebsd.org > From owner-svn-src-head@freebsd.org Mon May 1 16:32:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3A77D589FD; Mon, 1 May 2017 16:32:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76CA71E47; Mon, 1 May 2017 16:32:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41GWSxb052898; Mon, 1 May 2017 16:32:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41GWS67052895; Mon, 1 May 2017 16:32:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201705011632.v41GWS67052895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 1 May 2017 16:32:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317651 - in head/sys/compat/linuxkpi/common: include/asm include/linux src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 16:32:29 -0000 Author: markj Date: Mon May 1 16:32:28 2017 New Revision: 317651 URL: https://svnweb.freebsd.org/changeset/base/317651 Log: Add on_each_cpu() and wbinvd_on_all_cpus(). Reviewed by: hselasky MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10550 Added: head/sys/compat/linuxkpi/common/include/asm/smp.h (contents, props changed) head/sys/compat/linuxkpi/common/include/linux/smp.h (contents, props changed) Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c Added: head/sys/compat/linuxkpi/common/include/asm/smp.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/asm/smp.h Mon May 1 16:32:28 2017 (r317651) @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2017 Mark Johnston + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ASM_SMP_H_ +#define _ASM_SMP_H_ + +#if defined(__i386__) || defined(__amd64__) + +#define wbinvd_on_all_cpus() linux_wbinvd_on_all_cpus() + +int linux_wbinvd_on_all_cpus(void); + +#endif + +#endif /* _ASM_SMP_H_ */ Added: head/sys/compat/linuxkpi/common/include/linux/smp.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linuxkpi/common/include/linux/smp.h Mon May 1 16:32:28 2017 (r317651) @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2017 Mark Johnston + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LINUX_SMP_H_ +#define _LINUX_SMP_H_ + +#define on_each_cpu(cb, data, wait) ({ \ + CTASSERT(wait); \ + linux_on_each_cpu(cb, data); \ +}) + +extern int linux_on_each_cpu(void (*)(void *), void *); + +#endif /* _LINUX_SMP_H_ */ Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Mon May 1 15:03:40 2017 (r317650) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Mon May 1 16:32:28 2017 (r317651) @@ -48,6 +48,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include #include @@ -74,8 +77,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include -#include +#if defined(__i386__) || defined(__amd64__) +#include +#endif SYSCTL_NODE(_compat, OID_AUTO, linuxkpi, CTLFLAG_RW, 0, "LinuxKPI parameters"); @@ -1619,6 +1625,31 @@ linux_irq_handler(void *ent) irqe->handler(irqe->irq, irqe->arg); } +#if defined(__i386__) || defined(__amd64__) +static void +wbinvd_cb(void *arg __unused) +{ + + wbinvd(); +} + +int +linux_wbinvd_on_all_cpus(void) +{ + + return (linux_on_each_cpu(wbinvd_cb, NULL)); +} +#endif + +int +linux_on_each_cpu(void callback(void *), void *data) +{ + + smp_rendezvous(smp_no_rendezvous_barrier, callback, + smp_no_rendezvous_barrier, data); + return (0); +} + struct linux_cdev * linux_find_cdev(const char *name, unsigned major, unsigned minor) { From owner-svn-src-head@freebsd.org Mon May 1 16:34:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1EE89D58AEF for ; Mon, 1 May 2017 16:34:13 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB4AE2000 for ; Mon, 1 May 2017 16:34:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22f.google.com with SMTP id r185so31614994itd.1 for ; Mon, 01 May 2017 09:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=s36RarNDXTa7YBsIYecTJDmd4xPBdVKWa21h24HZ5aI=; b=MY8dhKMM/tjZN9w7M5MnQ4wvk2nDspyiFTRy70lo70KEl0VBCQWU/cAu5Yc/wz7P27 QFvk4Gzpt1CeNYjPZsu/KG4HOzyyLY0alZrkZFyPogsN5AVxN2d/gW/aTzUcn9K9kmWv XTRV+EcdICqUTjRxNFJHwzQwdyUxr+5LSolHaUONVLncj6bZcw1RhrX8leQ2mm0C/60l LUn1CJ6uw+calJaIyi3ShcZ1nxgPDjelm24oGbcMakSLAPPHeiPvOsy/4D1uTuTDBqRy cJtN/Le4v9l7d0IcMrw+8cFoCRWH6pvkZzm74MMbZHxgdAzNjpGyxcU/HtXVArGax782 N+xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=s36RarNDXTa7YBsIYecTJDmd4xPBdVKWa21h24HZ5aI=; b=uddvk8j/rlqu5FNCMowOADi42CK9GUA6XdwqkNiWxMWmzd5wFyiaWqvzCr2DgbQUlu WpVYz0hLJ+0LgwnKdqO6/Z6xrMEKdHqzz21WgxWKQ4epeVcbi3+m+1I4lcu4rCklBQ+V kbLBWakVuvZgpavNSinw9UcpLO+6IlqQGf5U7bhaPnVyYb1XftIyOEghjUHV8uYfN4oL BNCD58WD9Zk0vRCwufSnB6pJnepWdFBztglbIbSUatQSU/wgyk1f/XtRl83VL1ZyszVt EYQnKoP7zc2C9Ff5uE6YsHiOwVcTtwuwIUkNkhzxiLzN0QVYeenelYSPpP43GiyDoWgG +O+Q== X-Gm-Message-State: AN3rC/4Td3Rb6FOqXqu5uPTTpyPzT8kNhEimNyqrq2KwF3Qs6nE11htf CatmSGmzKmxoJpePJkbIDnHhqNh1Aw== X-Received: by 10.36.6.142 with SMTP id 136mr6452115itv.0.1493656452200; Mon, 01 May 2017 09:34:12 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.126.6 with HTTP; Mon, 1 May 2017 09:34:11 -0700 (PDT) X-Originating-IP: [2607:fb10:7021:1::4e6c] In-Reply-To: <201705011630.v41GUfVV090824@pdx.rh.CN85.dnsmgr.net> References: <201705010559.v415xqx2085699@repo.freebsd.org> <201705011630.v41GUfVV090824@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Mon, 1 May 2017 10:34:11 -0600 X-Google-Sender-Auth: iJqsW6bOyfPhG4-8HMrlQ-UDeMM Message-ID: Subject: Re: svn commit: r317632 - head/sys To: "Rodney W. Grimes" Cc: Ngie Cooper , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 16:34:13 -0000 On Mon, May 1, 2017 at 10:30 AM, Rodney W. Grimes wrote: >> Author: ngie >> Date: Mon May 1 05:59:52 2017 >> New Revision: 317632 >> URL: https://svnweb.freebsd.org/changeset/base/317632 >> >> Log: >> Fix "make cscope-clean" when .OBJDIR already exists >> >> The cscope generated files are always put in .CURDIR . > > If this is writing to src dir then it should be fixed, > or have we abandoned all hope of readonly src tree? This is only for the cscope target, which isn't part of the normal build. readonly src tree works great still.... Warner From owner-svn-src-head@freebsd.org Mon May 1 16:56:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30D02D591C2; Mon, 1 May 2017 16:56:36 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3F72E1A; Mon, 1 May 2017 16:56:35 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41GuYig061433; Mon, 1 May 2017 16:56:34 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41GuY8R061432; Mon, 1 May 2017 16:56:34 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201705011656.v41GuY8R061432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 1 May 2017 16:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317652 - head/sys/boot/efi/loader X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 16:56:36 -0000 Author: tsoome Date: Mon May 1 16:56:34 2017 New Revision: 317652 URL: https://svnweb.freebsd.org/changeset/base/317652 Log: loader.efi: ResetSystem does not use data with EFI_SUCCESS The current reboot command in efi/loader/main.c is passing extra data with ResetSystem, however, UEFI spec 2.6, page 265 does state: "ResetData is only valid if ResetStatus is something other than EFI_SUCCESS unless the ResetType is EfiResetPlatformSpecific where a minimum amount of ResetData is always required." Therefore we should use DataSize 0 and ResetData NULL - those are two last arguments for the call. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D10562 Modified: head/sys/boot/efi/loader/main.c Modified: head/sys/boot/efi/loader/main.c ============================================================================== --- head/sys/boot/efi/loader/main.c Mon May 1 16:32:28 2017 (r317651) +++ head/sys/boot/efi/loader/main.c Mon May 1 16:56:34 2017 (r317652) @@ -507,8 +507,7 @@ command_reboot(int argc, char *argv[]) if (devsw[i]->dv_cleanup != NULL) (devsw[i]->dv_cleanup)(); - RS->ResetSystem(EfiResetCold, EFI_SUCCESS, 23, - (CHAR16 *)"Reboot from the loader"); + RS->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL); /* NOTREACHED */ return (CMD_ERROR); From owner-svn-src-head@freebsd.org Mon May 1 17:01:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0E2BD593EA; Mon, 1 May 2017 17:01:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C09F71453; Mon, 1 May 2017 17:01:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41H10HA061760; Mon, 1 May 2017 17:01:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41H10W0061759; Mon, 1 May 2017 17:01:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201705011701.v41H10W0061759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 1 May 2017 17:01:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317654 - head/sys/cddl/dev/dtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 17:01:02 -0000 Author: markj Date: Mon May 1 17:01:00 2017 New Revision: 317654 URL: https://svnweb.freebsd.org/changeset/base/317654 Log: Fix a harmless LOR in dtrace_load(). MFC after: 1 week Modified: head/sys/cddl/dev/dtrace/dtrace_load.c Modified: head/sys/cddl/dev/dtrace/dtrace_load.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_load.c Mon May 1 16:59:54 2017 (r317653) +++ head/sys/cddl/dev/dtrace/dtrace_load.c Mon May 1 17:01:00 2017 (r317654) @@ -97,11 +97,9 @@ dtrace_load(void *dummy) mutex_init(&dtrace_errlock,"dtrace error lock", MUTEX_DEFAULT, NULL); #endif + mutex_enter(&cpu_lock); mutex_enter(&dtrace_provider_lock); mutex_enter(&dtrace_lock); - mutex_enter(&cpu_lock); - - ASSERT(MUTEX_HELD(&cpu_lock)); dtrace_state_cache = kmem_cache_create("dtrace_state_cache", sizeof (dtrace_dstate_percpu_t) * NCPU, DTRACE_STATE_ALIGN, @@ -151,13 +149,9 @@ dtrace_load(void *dummy) dtrace_probeid_error = dtrace_probe_create((dtrace_provider_id_t) dtrace_provider, NULL, NULL, "ERROR", 1, NULL); - mutex_exit(&cpu_lock); - mutex_exit(&dtrace_lock); mutex_exit(&dtrace_provider_lock); - mutex_enter(&cpu_lock); - #ifdef EARLY_AP_STARTUP CPU_FOREACH(i) { (void) dtrace_cpu_setup(CPU_CONFIG, i); @@ -173,6 +167,4 @@ dtrace_load(void *dummy) "dtrace/dtrace"); helper_dev = make_dev(&helper_cdevsw, 0, UID_ROOT, GID_WHEEL, 0660, "dtrace/helper"); - - return; } From owner-svn-src-head@freebsd.org Mon May 1 18:53:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08278D58428; Mon, 1 May 2017 18:53:49 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC1A2DE7; Mon, 1 May 2017 18:53:48 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41IrlJf010562; Mon, 1 May 2017 18:53:47 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41IrlrC010559; Mon, 1 May 2017 18:53:47 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705011853.v41IrlrC010559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Mon, 1 May 2017 18:53:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317657 - head/sbin/camcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 18:53:49 -0000 Author: ken Date: Mon May 1 18:53:47 2017 New Revision: 317657 URL: https://svnweb.freebsd.org/changeset/base/317657 Log: Fix camcontrol timestamp setting and update the man page. camcontrol timestamp -s would somtimes fail due to stack garbage. Zero out the timestamp parameters to fix it. Fix another nearby bug, and update the man page. sbin/camcontrol/timestamp.c: In set_timestamp(), bzero ts_p prior to creating the timestamp. Previously stack garbage could cause some tape drives to reject the timestamp. In set_timestamp(), check for failures from strptime(). sbin/camcontrol/camcontrol.8: Add the time argument to the -T option to camcontrol timestamp -s in the long description. Change the time/date format used in the camcontrol timestamp example to RFC 2822 format. This fixes a time zone issue with the original example by specifying the time zone as -0600. Otherwise, the time zone seems to default to standard time in the current locale, which makes the time, when reported back from the drive, 1 hour off from the intended setting. This also fixes a duplicate day of the week ("Wednesday Wed") in the previous example. Submitted by: Sam Klopsch MFC after: 3 days Sponsored by: Spectra Logic Modified: head/sbin/camcontrol/camcontrol.8 head/sbin/camcontrol/timestamp.c Modified: head/sbin/camcontrol/camcontrol.8 ============================================================================== --- head/sbin/camcontrol/camcontrol.8 Mon May 1 17:10:43 2017 (r317656) +++ head/sbin/camcontrol/camcontrol.8 Mon May 1 18:53:47 2017 (r317657) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 17, 2017 +.Dd May 1, 2017 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -2488,7 +2488,7 @@ Specify the strptime format string, as d The time must also be specified with the .Fl T option. -.It Fl T +.It Fl T Ar time Provide the time in the format specified with the .Fl f option. @@ -2814,8 +2814,8 @@ drive .Pa ada0 . .Pp .Bd -literal -offset indent -camcontrol timestamp sa0 -s -f "%A %c" \e - -T "Wednesday Wed Oct 26 21:43:57 2016" +camcontrol timestamp sa0 -s -f "%a, %d %b %Y %T %z" \e + -T "Wed, 26 Oct 2016 21:43:57 -0600" .Ed .Pp Set the timestamp of drive Modified: head/sbin/camcontrol/timestamp.c ============================================================================== --- head/sbin/camcontrol/timestamp.c Mon May 1 17:10:43 2017 (r317656) +++ head/sbin/camcontrol/timestamp.c Mon May 1 18:53:47 2017 (r317657) @@ -282,12 +282,18 @@ set_timestamp(struct cam_device *device, ts = (uint64_t) time_value; } else { bzero(&time_struct, sizeof(struct tm)); - strptime(timestamp_string, format_string, &time_struct); + if (strptime(timestamp_string, format_string, + &time_struct) == NULL) { + warnx("%s: strptime(3) failed", __func__); + error = 1; + goto bailout; + } time_value = mktime(&time_struct); ts = (uint64_t) time_value; } /* Convert time from seconds to milliseconds */ ts *= 1000; + bzero(&ts_p, sizeof(ts_p)); scsi_create_timestamp(ts_p.timestamp, ts); scsi_set_timestamp(&ccb->csio, From owner-svn-src-head@freebsd.org Mon May 1 19:34:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23BAFD5924D; Mon, 1 May 2017 19:34:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E813DC6A; Mon, 1 May 2017 19:34:16 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41JYFls027859; Mon, 1 May 2017 19:34:15 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41JYFks027858; Mon, 1 May 2017 19:34:15 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201705011934.v41JYFks027858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 1 May 2017 19:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317658 - head/usr.bin X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 19:34:17 -0000 Author: bdrewery Date: Mon May 1 19:34:15 2017 New Revision: 317658 URL: https://svnweb.freebsd.org/changeset/base/317658 Log: Redo r288270: Hookup mkcsmapper_static and mkesdb_static for 'make clean' These are only built as part of the top-level 'build-tools' call for 'make buildworld'. They still need to be cleaned during the 'make clean' treewalks though. Reported by: markj MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/usr.bin/Makefile Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Mon May 1 18:53:47 2017 (r317657) +++ head/usr.bin/Makefile Mon May 1 19:34:15 2017 (r317658) @@ -301,6 +301,12 @@ SUBDIR.${MK_UTMPX}+= who SUBDIR.${MK_SVN}+= svn SUBDIR.${MK_SVNLITE}+= svn +# These are normally only handled for build-tools. +.if make(clean*) +SUBDIR+= mkcsmapper_static +SUBDIR+= mkesdb_static +.endif + .include SUBDIR:= ${SUBDIR:O:u} From owner-svn-src-head@freebsd.org Mon May 1 19:47:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6186ED59468; Mon, 1 May 2017 19:47:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CF6A218; Mon, 1 May 2017 19:47:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41JlBcR031964; Mon, 1 May 2017 19:47:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41JlAIv031962; Mon, 1 May 2017 19:47:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705011947.v41JlAIv031962@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 1 May 2017 19:47:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317659 - head/sys/dev/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 19:47:12 -0000 Author: mav Date: Mon May 1 19:47:10 2017 New Revision: 317659 URL: https://svnweb.freebsd.org/changeset/base/317659 Log: Make some UART consoles to not spin wait for data to be sent. At least with Tx FIFO enabled it shows me ~10% reduction of verbose boot time with serial console at 115200 baud. Reviewed by: marcel MFC after: 2 weeks Modified: head/sys/dev/uart/uart_dev_lpc.c head/sys/dev/uart/uart_dev_ns8250.c Modified: head/sys/dev/uart/uart_dev_lpc.c ============================================================================== --- head/sys/dev/uart/uart_dev_lpc.c Mon May 1 19:34:15 2017 (r317658) +++ head/sys/dev/uart/uart_dev_lpc.c Mon May 1 19:47:10 2017 (r317659) @@ -345,9 +345,6 @@ lpc_ns8250_putc(struct uart_bas *bas, in DELAY(4); uart_setreg(bas, REG_DATA, c); uart_barrier(bas); - limit = 250000; - while ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0 && --limit) - DELAY(4); } static int @@ -890,8 +887,13 @@ lpc_ns8250_bus_transmit(struct uart_soft bas = &sc->sc_bas; uart_lock(sc->sc_hwmtx); - while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0) - ; + if (sc->sc_txdatasz > 1) { + if ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0) + ns8250_drain(bas, UART_DRAIN_TRANSMITTER); + } else { + while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0) + DELAY(4); + } for (i = 0; i < sc->sc_txdatasz; i++) { uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]); uart_barrier(bas); Modified: head/sys/dev/uart/uart_dev_ns8250.c ============================================================================== --- head/sys/dev/uart/uart_dev_ns8250.c Mon May 1 19:34:15 2017 (r317658) +++ head/sys/dev/uart/uart_dev_ns8250.c Mon May 1 19:47:10 2017 (r317659) @@ -315,7 +315,7 @@ ns8250_init(struct uart_bas *bas, int ba /* Disable the FIFO (if present). */ val = 0; #ifdef CPU_XBURST - val = FCR_UART_ON; + val |= FCR_UART_ON; #endif uart_setreg(bas, REG_FCR, val); uart_barrier(bas); @@ -346,9 +346,6 @@ ns8250_putc(struct uart_bas *bas, int c) DELAY(4); uart_setreg(bas, REG_DATA, c); uart_barrier(bas); - limit = 250000; - while ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0 && --limit) - DELAY(4); } static int @@ -999,8 +996,13 @@ ns8250_bus_transmit(struct uart_softc *s bas = &sc->sc_bas; uart_lock(sc->sc_hwmtx); - while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0) - ; + if (sc->sc_txdatasz > 1) { + if ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0) + ns8250_drain(bas, UART_DRAIN_TRANSMITTER); + } else { + while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0) + DELAY(4); + } for (i = 0; i < sc->sc_txdatasz; i++) { uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]); uart_barrier(bas); From owner-svn-src-head@freebsd.org Mon May 1 20:04:08 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F059CD59B7A; Mon, 1 May 2017 20:04:08 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C25ACF14; Mon, 1 May 2017 20:04:08 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v41K47xN040265; Mon, 1 May 2017 20:04:07 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v41K47IF040264; Mon, 1 May 2017 20:04:07 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201705012004.v41K47IF040264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 1 May 2017 20:04:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317660 - head/lib/libc/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 20:04:09 -0000 Author: brooks Date: Mon May 1 20:04:07 2017 New Revision: 317660 URL: https://svnweb.freebsd.org/changeset/base/317660 Log: Support clnt_raw's use of FD_SETSIZE as a fake file descriptor. Accomplish this by allocating space for it in __svc_xports and allowing it to be registered. The failure to allocate space was causing an out-of-bounds read in svc_getreq_common(). The failure to register caused PR 211804. The bug was found with CHERI bounds checking. PR: 211804 Obtained from: CheriBSD Sponsored by: DARPA, AFRL Reviewed by: ngie MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10528 Modified: head/lib/libc/rpc/svc.c Modified: head/lib/libc/rpc/svc.c ============================================================================== --- head/lib/libc/rpc/svc.c Mon May 1 19:47:10 2017 (r317659) +++ head/lib/libc/rpc/svc.c Mon May 1 20:04:07 2017 (r317660) @@ -108,18 +108,19 @@ xprt_register(SVCXPRT *xprt) rwlock_wrlock(&svc_fd_lock); if (__svc_xports == NULL) { __svc_xports = (SVCXPRT **) - mem_alloc(FD_SETSIZE * sizeof(SVCXPRT *)); + mem_alloc((FD_SETSIZE + 1) * sizeof(SVCXPRT *)); if (__svc_xports == NULL) { rwlock_unlock(&svc_fd_lock); return; } - memset(__svc_xports, '\0', FD_SETSIZE * sizeof(SVCXPRT *)); + memset(__svc_xports, '\0', (FD_SETSIZE + 1) * sizeof(SVCXPRT *)); } if (sock < FD_SETSIZE) { __svc_xports[sock] = xprt; FD_SET(sock, &svc_fdset); svc_maxfd = max(svc_maxfd, sock); - } + } else if (sock == FD_SETSIZE) + __svc_xports[sock] = xprt; rwlock_unlock(&svc_fd_lock); } @@ -157,7 +158,8 @@ __xprt_do_unregister(SVCXPRT *xprt, bool if (__svc_xports[svc_maxfd]) break; } - } + } else if ((sock == FD_SETSIZE) && (__svc_xports[sock] == xprt)) + __svc_xports[sock] = NULL; if (dolock) rwlock_unlock(&svc_fd_lock); } From owner-svn-src-head@freebsd.org Mon May 1 20:55:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6504D596B9; Mon, 1 May 2017 20:55:43 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F0C0BD3; Mon, 1 May 2017 20:55:43 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x230.google.com with SMTP id e65so2334133ita.1; Mon, 01 May 2017 13:55:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=WE9Ti6DJDhdMmEYkeyu+L4JQqzyy0/TfKE4Ll05r3Qo=; b=E+MfO3WA5F4re6KIvoQabmb680ADG2YHbYFEV3kEtCy9ruRHE3xgh3k0PtyJ6EbE6m VfrEkbxs5qaSB/Hqn40TjJqUScqbCfJ91noWda4rbaZMih4F4EPHfpUNkqtgmiRXBydk QrsvYITmEixZZIOW5llvq99JIufqJVudbG3qNgBRPOpro3owSHi3/DbUjf1gXgAuCLIx aGjCW/MjXFVviiSD88XCAJXM6AiT4ozHNh/EJayOT+oYx8jTHO+Wo7hj/ykAHnsdwooX PHPYqJFfeFYpb2HDkXxZT/nT5c+Iamvtxddmu80bsRM3PRLAS5DbfM2PE773cO5D5XGN Vx6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=WE9Ti6DJDhdMmEYkeyu+L4JQqzyy0/TfKE4Ll05r3Qo=; b=EcmLvGIBqdIhae78gx2ra2gdaNhaSChIBIQReEN+kdQA3Oc3deVCuYiqLzGdsAAGUj PIAZ9GuGiIMVHWvxI22rr6alkcBsg01xJ+CQDbwraxzReoOhqMwgN/sbMqKrPJu2qtIX gZ4LYkJ3JTpVkIeYTUnUdtPvU+pSo5alAYopoby+JbusveOPVa39q0N9uD9wp+0Rr4ey YYbzbB6TNZuTawAcat1lILQJJ/pc/1AcAFk5cJmJ5saTjm7IUcyqwZ9hhZY8HYMZPXH9 f5seBjWd4AlfxIuWOEsrGyOdh0jdoE8gx+GyxKQInhJp1M/g6kQogK9Cm3HY08pWplUu JmRA== X-Gm-Message-State: AN3rC/51CGvGWzumQsPtfZrEYwSIJl3sBOCpLGafM4LBPfScu8L7IOuJ q1ZflUBFD0NG7NGzpp0NI9zVCrSdrBhF0p8= X-Received: by 10.36.190.205 with SMTP id i196mr540338itf.88.1493672142551; Mon, 01 May 2017 13:55:42 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.30.136 with HTTP; Mon, 1 May 2017 13:55:22 -0700 (PDT) In-Reply-To: References: <201704192221.v3JMLFPs032866@repo.freebsd.org> From: Ed Maste Date: Mon, 1 May 2017 16:55:22 -0400 X-Google-Sender-Auth: TXSW0pwnBWZEcF6DAkPAcp3MuOo Message-ID: Subject: Re: svn commit: r317171 - head/sys/dev/vt To: Jung-uk Kim Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 20:55:43 -0000 On 20 April 2017 at 14:06, Jung-uk Kim wrote: > > Maybe but I haven't seen much improvement in the area for many years. > Do you have any reason to believe someone is working on it? > > Even if we have such backend, I don't expect much difference in drawing > small area, i.e., redrawing narrow borders. On top of that, I don't > like "if (vd->vd_driver->vd_drawrect == NULL) return (ENOTSUP)" stuff. I don't believe anyone is working on it at the moment, but I expect that effort will go into improved VGA / VESA support at some point and that might implement an improved drawrect. I agree that there's unlikely to be a noticeable difference in the case of occasional operations filling a small region (e.g., border clearing after vt switch). However, the vd_drawrect == NULL case is really no different than vd_setpixel == NULL. All vt drivers except ofwfb provide both, and ofwfb provides neither. From owner-svn-src-head@freebsd.org Mon May 1 22:26:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86143D59E94; Mon, 1 May 2017 22:26:36 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) by mx1.freebsd.org (Postfix) with ESMTP id 0453814F4; Mon, 1 May 2017 22:26:35 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: svn commit: r317171 - head/sys/dev/vt To: Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" References: <201704192221.v3JMLFPs032866@repo.freebsd.org> From: Jung-uk Kim Message-ID: Date: Mon, 1 May 2017 18:26:30 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6aPrr0tDOmCmg8qbDKsFTuBjbaVbdugQW" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 May 2017 22:26:36 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --6aPrr0tDOmCmg8qbDKsFTuBjbaVbdugQW Content-Type: multipart/mixed; boundary="AskN0PpHWXPevlE3cejCgW0Qsvn95lF3D"; protected-headers="v1" From: Jung-uk Kim To: Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-ID: Subject: Re: svn commit: r317171 - head/sys/dev/vt References: <201704192221.v3JMLFPs032866@repo.freebsd.org> In-Reply-To: --AskN0PpHWXPevlE3cejCgW0Qsvn95lF3D Content-Type: multipart/mixed; boundary="------------E589CBB9D5721B08A742F296" Content-Language: en-US This is a multi-part message in MIME format. --------------E589CBB9D5721B08A742F296 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/01/2017 16:55, Ed Maste wrote: > On 20 April 2017 at 14:06, Jung-uk Kim wrote: >> >> Maybe but I haven't seen much improvement in the area for many years. >> Do you have any reason to believe someone is working on it? >> >> Even if we have such backend, I don't expect much difference in drawin= g >> small area, i.e., redrawing narrow borders. On top of that, I don't >> like "if (vd->vd_driver->vd_drawrect =3D=3D NULL) return (ENOTSUP)" st= uff. >=20 > I don't believe anyone is working on it at the moment, but I expect > that effort will go into improved VGA / VESA support at some point and > that might implement an improved drawrect. I agree that there's > unlikely to be a noticeable difference in the case of occasional > operations filling a small region (e.g., border clearing after vt > switch). >=20 > However, the vd_drawrect =3D=3D NULL case is really no different than > vd_setpixel =3D=3D NULL. All vt drivers except ofwfb provide both, and > ofwfb provides neither. I can revert it but I don't like the previous implementation. There were overlapping regions and off-by-one issues. Please see the attached patch, which is against the previous version. Jung-uk Kim --------------E589CBB9D5721B08A742F296 Content-Type: text/x-patch; name="vt_core.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="vt_core.diff" --- vt_core.c.orig +++ vt_core.c @@ -1546,21 +1546,23 @@ /* Left bar. */ if (vw->vw_draw_area.tr_begin.tp_col > 0) vd->vd_driver->vd_drawrect(vd, - 0, 0, - vw->vw_draw_area.tr_begin.tp_col - 1, vd->vd_height - 1, + 0, vw->vw_draw_area.tr_begin.tp_row, + vw->vw_draw_area.tr_begin.tp_col - 1, + vw->vw_draw_area.tr_end.tp_row - 1, 1, c); =20 /* Right bar. */ if (vw->vw_draw_area.tr_end.tp_col < vd->vd_width) vd->vd_driver->vd_drawrect(vd, - vw->vw_draw_area.tr_end.tp_col - 1, 0, - vd->vd_width - 1, vd->vd_height - 1, + vw->vw_draw_area.tr_end.tp_col, + vw->vw_draw_area.tr_begin.tp_row, + vd->vd_width - 1, vw->vw_draw_area.tr_end.tp_row - 1, 1, c); =20 /* Bottom bar. */ if (vw->vw_draw_area.tr_end.tp_row < vd->vd_height) vd->vd_driver->vd_drawrect(vd, - 0, vw->vw_draw_area.tr_end.tp_row - 1, + 0, vw->vw_draw_area.tr_end.tp_row, vd->vd_width - 1, vd->vd_height - 1, 1, c); =20 --------------E589CBB9D5721B08A742F296-- --AskN0PpHWXPevlE3cejCgW0Qsvn95lF3D-- --6aPrr0tDOmCmg8qbDKsFTuBjbaVbdugQW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEl1bqgKaRyqfWXu/CfJ+WJvzb8UYFAlkHthYACgkQfJ+WJvzb 8Ub8xQf+LSNyv25YHjZXI26jjDmtinxhhRVAA0+hsfBYvKgWnjU04L/K2820wza1 8vhoKnjQRUPFMmCY1V1aXXkk/1yl/IfCc/6D1BdpvrJEBW0T+8HnRxfk28FG+9Z3 G5ruRBZHSI3urBF8FcU4lY3349YGEzykjAZCSin9cCiQN5fUTlfZYejniDpOJuBo CXuQptxw80V5vP9p+0TkPiPRc89nmy2OMFgsNxXCUuAXHJQIFmoNvsGgT/9xzH9I LE2UpRbSQKjARZUZEc7ZEVdLiv0tI0PNQ6e8S6igLLn683AUeNKOI1eCVYnYnaGJ nUortZ3bSyCMSI3m8MNOK8AK0QzNHA== =p+Wt -----END PGP SIGNATURE----- --6aPrr0tDOmCmg8qbDKsFTuBjbaVbdugQW-- From owner-svn-src-head@freebsd.org Tue May 2 00:16:14 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3D64D59802; Tue, 2 May 2017 00:16:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B419DE1B; Tue, 2 May 2017 00:16:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id EB29A10A7B9; Mon, 1 May 2017 20:16:12 -0400 (EDT) From: John Baldwin To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317651 - in head/sys/compat/linuxkpi/common: include/asm include/linux src Date: Mon, 01 May 2017 14:19:02 -0700 Message-ID: <6396628.i00z9sPEvp@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201705011632.v41GWS67052895@repo.freebsd.org> References: <201705011632.v41GWS67052895@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 01 May 2017 20:16:13 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 00:16:14 -0000 On Monday, May 01, 2017 04:32:28 PM Mark Johnston wrote: > Author: markj > Date: Mon May 1 16:32:28 2017 > New Revision: 317651 > URL: https://svnweb.freebsd.org/changeset/base/317651 > > Log: > Add on_each_cpu() and wbinvd_on_all_cpus(). For wbinvd_on_all_cpus() we do have a dedicated IPI. You could just use 'pmap_invalidate_cache()' in place of wbinvd_on_all_cpus() directly. -- John Baldwin From owner-svn-src-head@freebsd.org Tue May 2 01:04:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1DDCD58514; Tue, 2 May 2017 01:04:00 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50A5F89E; Tue, 2 May 2017 01:04:00 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4213xsU062863; Tue, 2 May 2017 01:03:59 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4213xEM062862; Tue, 2 May 2017 01:03:59 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201705020103.v4213xEM062862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 2 May 2017 01:03:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317663 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 01:04:00 -0000 Author: ae Date: Tue May 2 01:03:59 2017 New Revision: 317663 URL: https://svnweb.freebsd.org/changeset/base/317663 Log: Properly initialize ipfw_range_tlv variable to fix possible EINVAL in case when ipfw delete/zero/resetlog command issued for several rules in the loop. Also reorder some variables by size. PR: 218993 MFC after: 1 week Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon May 1 21:21:04 2017 (r317662) +++ head/sbin/ipfw/ipfw2.c Tue May 2 01:03:59 2017 (r317663) @@ -3187,15 +3187,14 @@ fill_flags_cmd(ipfw_insn *cmd, enum ipfw void ipfw_delete(char *av[]) { + ipfw_range_tlv rt; + char *sep; int i, j; int exitval = EX_OK; int do_set = 0; - char *sep; - ipfw_range_tlv rt; av++; NEED1("missing rule specification"); - memset(&rt, 0, sizeof(rt)); if ( *av && _substrcmp(*av, "set") == 0) { /* Do not allow using the following syntax: * ipfw set N delete set M @@ -3222,6 +3221,7 @@ ipfw_delete(char *av[]) } else if (co.do_pipe) { exitval = ipfw_delete_pipe(co.do_pipe, i); } else { + memset(&rt, 0, sizeof(rt)); if (do_set != 0) { rt.set = i & 31; rt.flags = IPFW_RCFLAG_SET; @@ -5157,18 +5157,17 @@ void ipfw_zero(int ac, char *av[], int optname) { ipfw_range_tlv rt; - uint32_t arg; - int failed = EX_OK; char const *errstr; char const *name = optname ? "RESETLOG" : "ZERO"; + uint32_t arg; + int failed = EX_OK; optname = optname ? IP_FW_XRESETLOG : IP_FW_XZERO; - memset(&rt, 0, sizeof(rt)); - av++; ac--; if (ac == 0) { /* clear all entries */ + memset(&rt, 0, sizeof(rt)); rt.flags = IPFW_RCFLAG_ALL; if (do_range_cmd(optname, &rt) < 0) err(EX_UNAVAILABLE, "setsockopt(IP_FW_X%s)", name); @@ -5186,6 +5185,7 @@ ipfw_zero(int ac, char *av[], int optnam if (errstr) errx(EX_DATAERR, "invalid rule number %s\n", *av); + memset(&rt, 0, sizeof(rt)); rt.start_rule = arg; rt.end_rule = arg; rt.flags |= IPFW_RCFLAG_RANGE; From owner-svn-src-head@freebsd.org Tue May 2 02:32:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99E2FD59A7A; Tue, 2 May 2017 02:32:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D0CC10AB; Tue, 2 May 2017 02:32:11 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v422WA08099081; Tue, 2 May 2017 02:32:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v422WAdu099079; Tue, 2 May 2017 02:32:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705020232.v422WAdu099079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 May 2017 02:32:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317665 - in head: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 02:32:11 -0000 Author: emaste Date: Tue May 2 02:32:10 2017 New Revision: 317665 URL: https://svnweb.freebsd.org/changeset/base/317665 Log: bsdgrep: fix -w -v matching improperly with certain patterns -w and -v flag matching was mostly functional but had some minor problems: 1. -w flag processing only allowed one iteration through pattern matching on a line. This was problematic if one pattern could match more than once, or if there were multiple patterns and the earliest/ longest match was not the most ideal, and 2. Previous work "fixed" things to not further process a line if the first iteration through patterns produced no matches. This is clearly wrong if we're dealing with the more restrictive -w matching. #2 breakage could have also occurred before recent broad rewrites, but it would be more arbitrary based on input patterns as to whether or not it actually affected things. Fix both of these by forcing a retry of the patterns after advancing just past the start of the first match if we're doing more restrictive -w matching and we didn't get any hits to start with. Also move -v flag processing outside of the loop so that we have a greater change to match in the more restrictive cases. This wasn't strictly wrong, but it could be a little more error prone. While here, introduce some regressions tests for this behavior and fix some excessive wrapping nearby that hindered readability. GNU grep passes these new tests. PR: 218467, 218811 Submitted by: Kyle Evans Reviewed by: cem, ngie Differential Revision: https://reviews.freebsd.org/D10329 Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh head/usr.bin/grep/util.c Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Tue May 2 01:30:46 2017 (r317664) +++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Tue May 2 02:32:10 2017 (r317665) @@ -93,6 +93,12 @@ word_regexps_body() { atf_check -o file:"$(atf_get_srcdir)/d_word_regexps.out" \ grep -w separated $(atf_get_srcdir)/d_input + + # Begin FreeBSD + printf "xmatch pmatch\n" > test1 + + atf_check -o inline:"pmatch\n" grep -Eow "(match )?pmatch" test1 + # End FreeBSD } atf_test_case begin_end @@ -439,6 +445,23 @@ grep_sanity_body() atf_check -o inline:"M\n" grep -o -e "M\{1\}" test2 } + +atf_test_case wv_combo_break +wv_combo_break_head() +{ + atf_set "descr" "Check for incorrectly matching lines with both -w and -v flags (PR 218467)" +} +wv_combo_break_body() +{ + printf "x xx\n" > test1 + printf "xx x\n" > test2 + + atf_check -o file:test1 grep -w "x" test1 + atf_check -o file:test2 grep -w "x" test2 + + atf_check -s exit:1 grep -v -w "x" test1 + atf_check -s exit:1 grep -v -w "x" test2 +} # End FreeBSD atf_init_test_cases() @@ -467,6 +490,7 @@ atf_init_test_cases() atf_add_test_case escmap atf_add_test_case egrep_empty_invalid atf_add_test_case zerolen + atf_add_test_case wv_combo_break atf_add_test_case fgrep_sanity atf_add_test_case egrep_sanity atf_add_test_case grep_sanity Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Tue May 2 01:30:46 2017 (r317664) +++ head/usr.bin/grep/util.c Tue May 2 02:32:10 2017 (r317665) @@ -305,6 +305,7 @@ procline(struct str *l, int nottext) unsigned int i; int c = 0, m = 0, r = 0, lastmatches = 0, leflags = eflags; int startm = 0; + int retry; /* Initialize to avoid a false positive warning from GCC. */ lastmatch.rm_so = lastmatch.rm_eo = 0; @@ -313,6 +314,7 @@ procline(struct str *l, int nottext) while (st <= l->len) { lastmatches = 0; startm = m; + retry = 0; if (st > 0) leflags |= REG_NOTBOL; /* Loop to compare with all the patterns */ @@ -356,6 +358,17 @@ procline(struct str *l, int nottext) else if (iswword(wbegin) || iswword(wend)) r = REG_NOMATCH; + /* + * If we're doing whole word matching and we + * matched once, then we should try the pattern + * again after advancing just past the start of + * the earliest match. This allows the pattern + * to match later on in the line and possibly + * still match a whole word. + */ + if (r == REG_NOMATCH && + (retry == 0 || pmatch.rm_so + 1 < retry)) + retry = pmatch.rm_so + 1; } if (r == 0) { lastmatches++; @@ -385,9 +398,14 @@ procline(struct str *l, int nottext) } } - if (vflag) { - c = !c; - break; + /* + * Advance to just past the start of the earliest match, try + * again just in case we still have a chance to match later in + * the string. + */ + if (lastmatches == 0 && retry > 0) { + st = retry; + continue; } /* One pass if we are not recording matches */ @@ -410,6 +428,9 @@ procline(struct str *l, int nottext) } + if (vflag) + c = !c; + /* Count the matches if we have a match limit */ if (mflag) mcount -= c; From owner-svn-src-head@freebsd.org Tue May 2 05:02:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8CB2D5AC2C; Tue, 2 May 2017 05:02:13 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7965A985; Tue, 2 May 2017 05:02:13 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4252CY7061391; Tue, 2 May 2017 05:02:12 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4252ClR061390; Tue, 2 May 2017 05:02:12 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201705020502.v4252ClR061390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 2 May 2017 05:02:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317666 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 05:02:13 -0000 Author: ae Date: Tue May 2 05:02:12 2017 New Revision: 317666 URL: https://svnweb.freebsd.org/changeset/base/317666 Log: Add sets support for ipfw table info/list/flush commands. PR: 212668 MFC after: 1 week Modified: head/sbin/ipfw/tables.c Modified: head/sbin/ipfw/tables.c ============================================================================== --- head/sbin/ipfw/tables.c Tue May 2 02:32:10 2017 (r317665) +++ head/sbin/ipfw/tables.c Tue May 2 05:02:12 2017 (r317666) @@ -1628,18 +1628,19 @@ tables_foreach(table_cb_t *f, void *arg, } if (sort != 0) - qsort(olh + 1, olh->count, olh->objsize, tablename_cmp); + qsort(olh + 1, olh->count, olh->objsize, + tablename_cmp); info = (ipfw_xtable_info *)(olh + 1); for (i = 0; i < olh->count; i++) { - error = f(info, arg); /* Ignore errors for now */ - info = (ipfw_xtable_info *)((caddr_t)info + olh->objsize); + if (co.use_set == 0 || info->set == co.use_set - 1) + error = f(info, arg); + info = (ipfw_xtable_info *)((caddr_t)info + + olh->objsize); } - free(olh); break; } - return (0); } From owner-svn-src-head@freebsd.org Tue May 2 05:20:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F241D59501; Tue, 2 May 2017 05:20:56 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D59C01334; Tue, 2 May 2017 05:20:55 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v425Ks4t065763; Tue, 2 May 2017 05:20:54 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v425Ks6J065762; Tue, 2 May 2017 05:20:54 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201705020520.v425Ks6J065762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 2 May 2017 05:20:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317667 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 05:20:56 -0000 Author: ae Date: Tue May 2 05:20:54 2017 New Revision: 317667 URL: https://svnweb.freebsd.org/changeset/base/317667 Log: In parse_range() validate both range values instead of checking the top value twice. PR: 202295 MFC after: 1 week Modified: head/sbin/ipfw/dummynet.c Modified: head/sbin/ipfw/dummynet.c ============================================================================== --- head/sbin/ipfw/dummynet.c Tue May 2 05:02:12 2017 (r317666) +++ head/sbin/ipfw/dummynet.c Tue May 2 05:20:54 2017 (r317667) @@ -1881,7 +1881,7 @@ parse_range(int ac, char *av[], uint32_t av--; } if (v[1] < v[0] || - v[1] >= DN_MAX_ID-1 || + v[0] >= DN_MAX_ID-1 || v[1] >= DN_MAX_ID-1) { continue; /* invalid entry */ } From owner-svn-src-head@freebsd.org Tue May 2 09:55:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AB87D5AF7B; Tue, 2 May 2017 09:55:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B27051D29; Tue, 2 May 2017 09:55:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v429tSTq044051 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 May 2017 12:55:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v429tSTq044051 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v429tRYa044043; Tue, 2 May 2017 12:55:27 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 2 May 2017 12:55:27 +0300 From: Konstantin Belousov To: Bruce Evans Cc: Alan Somers , Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs... Message-ID: <20170502095527.GB1622@kib.kiev.ua> References: <201704171734.v3HHYlf5022945@repo.freebsd.org> <20170419130428.J956@besplex.bde.org> <20170430201324.GV1622@kib.kiev.ua> <20170501163725.U972@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170501163725.U972@besplex.bde.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 09:55:35 -0000 On Mon, May 01, 2017 at 06:25:11PM +1000, Bruce Evans wrote: > XX Index: subr_counter.c > XX =================================================================== > XX --- subr_counter.c (revision 317604) > XX +++ subr_counter.c (working copy) > XX @@ -78,11 +78,15 @@ > XX sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS) > XX { > XX uint64_t out; > XX + uint32_t out32; > XX int error; > XX > XX out = counter_u64_fetch(*(counter_u64_t *)arg1); > XX > XX - error = SYSCTL_OUT(req, &out, sizeof(uint64_t)); > XX + if (req->oldlen == 4 && (out32 = out) == out) > XX + error = SYSCTL_OUT(req, &out32, sizeof(out32)); > XX + else > XX + error = SYSCTL_OUT(req, &out, sizeof(out)); > XX > XX if (error || !req->newptr) > XX return (error); > > This does the minimum necessary to fix the current problem. > > This works until the counters become too large for a u_int. There > could be an option to get truncation with no error, but that would > require an API change, so applications should be required to do the > truncation for themself if that is what they want. Yes, this is approximately what I consider to be enough fix, but with some details which I do not like and which did not worked well on my test machine with enough memory to generate lot of increments. Below is what I consider to be good enough. I will proceed with this version unless very strong objections appear. diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index 5f4cd46ab1e..93d5161de89 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -266,8 +266,29 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0, "VM meter vm stats"); SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats"); +static int +sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS) +{ + uint64_t out; +#ifdef COMPAT_FREEBSD11 + uint32_t out1; +#endif + + out = counter_u64_fetch(*(counter_u64_t *)arg1); +#ifdef COMPAT_FREEBSD11 + if (req->oldlen == sizeof(uint32_t)) { + out1 = 0xffffffff; + if (out < out1) + out1 = out; + return (SYSCTL_OUT(req, &out1, sizeof(uint32_t))); + } +#endif + return (SYSCTL_OUT(req, &out, sizeof(uint64_t))); +} + #define VM_STATS(parent, var, descr) \ - SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, &vm_cnt.var, descr) + SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \ + CTLFLAG_RD, &vm_cnt.var, 0, sysctl_handle_vmstat, "QU", descr); #define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) #define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr) From owner-svn-src-head@freebsd.org Tue May 2 10:04:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 261BFD57361; Tue, 2 May 2017 10:04:28 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCE422CC; Tue, 2 May 2017 10:04:27 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id E940D2617C3; Tue, 2 May 2017 12:04:25 +0200 (CEST) Subject: Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs... To: Konstantin Belousov , Bruce Evans Cc: Alan Somers , Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" References: <201704171734.v3HHYlf5022945@repo.freebsd.org> <20170419130428.J956@besplex.bde.org> <20170430201324.GV1622@kib.kiev.ua> <20170501163725.U972@besplex.bde.org> <20170502095527.GB1622@kib.kiev.ua> From: Hans Petter Selasky Message-ID: <27c9a2b4-b993-2370-1da8-b4beef354a1b@selasky.org> Date: Tue, 2 May 2017 12:02:32 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: <20170502095527.GB1622@kib.kiev.ua> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 10:04:28 -0000 On 05/02/17 11:55, Konstantin Belousov wrote: > + out1 = 0xffffffff; Nitpicking: Should this be written: 0xffffffffU ?? --HPS From owner-svn-src-head@freebsd.org Tue May 2 10:29:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61FE7D57B2E; Tue, 2 May 2017 10:29:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE06C338; Tue, 2 May 2017 10:29:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v42ATWO3052312 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 May 2017 13:29:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v42ATWO3052312 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v42ATWFV052311; Tue, 2 May 2017 13:29:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 2 May 2017 13:29:32 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: Bruce Evans , Alan Somers , Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs... Message-ID: <20170502102932.GC1622@kib.kiev.ua> References: <201704171734.v3HHYlf5022945@repo.freebsd.org> <20170419130428.J956@besplex.bde.org> <20170430201324.GV1622@kib.kiev.ua> <20170501163725.U972@besplex.bde.org> <20170502095527.GB1622@kib.kiev.ua> <27c9a2b4-b993-2370-1da8-b4beef354a1b@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <27c9a2b4-b993-2370-1da8-b4beef354a1b@selasky.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 10:29:38 -0000 On Tue, May 02, 2017 at 12:02:32PM +0200, Hans Petter Selasky wrote: > On 05/02/17 11:55, Konstantin Belousov wrote: > > + out1 = 0xffffffff; > > Nitpicking: > > Should this be written: 0xffffffffU ?? Compiler must do it on its own. The constant is not representable as int so it is auto-promoted to unsigned int, if fitting. From owner-svn-src-head@freebsd.org Tue May 2 11:25:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8D6BD590BD; Tue, 2 May 2017 11:25:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 98E03879; Tue, 2 May 2017 11:25:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id B91FC104AC0D; Tue, 2 May 2017 21:25:40 +1000 (AEST) Date: Tue, 2 May 2017 21:25:40 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , Alan Somers , Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs... In-Reply-To: <20170502095527.GB1622@kib.kiev.ua> Message-ID: <20170502203703.I1176@besplex.bde.org> References: <201704171734.v3HHYlf5022945@repo.freebsd.org> <20170419130428.J956@besplex.bde.org> <20170430201324.GV1622@kib.kiev.ua> <20170501163725.U972@besplex.bde.org> <20170502095527.GB1622@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VbSHBBh9 c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=9c1YXFi_s6pBL_uy8JYA:9 a=2h5AcP7PeoVhcE4n:21 a=dWn9O7JRpMvWnKfk:21 a=ecD9VUfY_Hat2frr:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 11:25:52 -0000 On Tue, 2 May 2017, Konstantin Belousov wrote: > On Mon, May 01, 2017 at 06:25:11PM +1000, Bruce Evans wrote: >> XX Index: subr_counter.c >> XX =================================================================== >> XX --- subr_counter.c (revision 317604) >> XX +++ subr_counter.c (working copy) >> XX @@ -78,11 +78,15 @@ >> XX sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS) >> XX { >> XX uint64_t out; >> XX + uint32_t out32; >> XX int error; >> XX >> XX out = counter_u64_fetch(*(counter_u64_t *)arg1); >> XX >> XX - error = SYSCTL_OUT(req, &out, sizeof(uint64_t)); >> XX + if (req->oldlen == 4 && (out32 = out) == out) >> XX + error = SYSCTL_OUT(req, &out32, sizeof(out32)); >> XX + else >> XX + error = SYSCTL_OUT(req, &out, sizeof(out)); >> XX >> XX if (error || !req->newptr) >> XX return (error); >> >> This does the minimum necessary to fix the current problem. >> >> This works until the counters become too large for a u_int. There >> could be an option to get truncation with no error, but that would >> require an API change, so applications should be required to do the >> truncation for themself if that is what they want. > > Yes, this is approximately what I consider to be enough fix, but with > some details which I do not like and which did not worked well on my > test machine with enough memory to generate lot of increments. > > Below is what I consider to be good enough. I will proceed with this > version unless very strong objections appear. I prefer my version. It is the same as for sysctl_bufspace(), except for simplifications and bug fixes that are easier because the types are unsigned. Your version is especially broken for the case of a lot of increments. Clamping breaks many cases in systat -v which just needs unsigned counters to calculate small differences. Not many counters overflow faster than the refresh interval in systat or top. These cases used to appear to work perfectly for most counters when the kernel did blind truncations. Clamping breaks the API. Not returing ENOMEM breaks the API. In my version, this is handled as specified by the API by truncating and returning ENOMEM. Then: - top sees the ENOMEM and mishandles it by aborting - systat sees the ENOMEM (and also sees a short count, if it has the newer breakage of hard-coding 64-bit counters instead of u_int ones, and is run on a kernel with u_int counters) and mishandles it better by printing an error message but not aborting. Thus it appears to work just as well as when the kernel did blind truncation, except for the error message. Clamping would be difficult for the application to handle even if an error is returned. This would be like the situation for clamping for strtoul(), but worse since it changes the API. Many applications don't understand how to handle errno for strtoul(), but they do do a bogus check of the clamped value. For sysctl(), clamping is not part of the API now, so applications shouldn't check for the clamped values. Ones that work with deltas like systat -v would see the counters stop incrementing when the clamped value is reached, while truncated values allow them to continue to appear to work perfectly. > diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c > index 5f4cd46ab1e..93d5161de89 100644 > --- a/sys/vm/vm_meter.c > +++ b/sys/vm/vm_meter.c > @@ -266,8 +266,29 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0, > "VM meter vm stats"); > SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats"); > > +static int > +sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS) > +{ > + uint64_t out; > +#ifdef COMPAT_FREEBSD11 > + uint32_t out1; > +#endif The extra wrapper and the ifdef limit the damage from the API change. Otherwise, I don't like them. I prefer my variable name out32 to the nondescript out1. ('out' should also be renamed out64, but I wanted to keep the diffs small.) > + > + out = counter_u64_fetch(*(counter_u64_t *)arg1); > +#ifdef COMPAT_FREEBSD11 > + if (req->oldlen == sizeof(uint32_t)) { sizeof(uint32_t) is an obfuscated spelling of '4'. The size is already hard-coded in '32'. This depends on sizeof(char) being 1. It is, and won't change. POSIX started specifying this in 2001, and the mere existence of uint8_t probably requires 8-bit chars since u_char must be the smallest type of an object. This depends on the size of a u_int being 32 bits/4 bytes in the old ABI. This won't change, and is already hard-coded as 32, as it must be because sizeof(u_int) may change. > + out1 = 0xffffffff; > + if (out < out1) > + out1 = out; This does the clamping. Clamping is probably better expressed as: out1 = MIN(out, 0xffffffff) > + return (SYSCTL_OUT(req, &out1, sizeof(uint32_t))); Here sizeof(uint32_t) is an obfuscated spelling of sizeof(out1). I think the sizeof() is justified in this case, to limit the hard-coding to of sizes to 1 place. Truncation by assigment to the destination variable also helps limit this (sysctl_bufspace() could also be improved by truncation by assignment. Its integers are signed, so the result is implementation-defined, but we know that it is benign 2's complement and don't really care what it is provided it is reasonable. This is better than laboriously checking the lower limit or neglecting to check it). Here the limit 0xffffffff also depends on the size. > + } > +#endif > + return (SYSCTL_OUT(req, &out, sizeof(uint64_t))); > +} > + > #define VM_STATS(parent, var, descr) \ > - SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, &vm_cnt.var, descr) > + SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \ > + CTLFLAG_RD, &vm_cnt.var, 0, sysctl_handle_vmstat, "QU", descr); I see a new problem, shared with my version. The sysctl data says that this sysctl is pure 64 bits, but it can return 32 bits. The sysctl data just can't describe the variation. I guess this is not much a problem, since it takes magic to read the sysctl data from the kernel and not many programs except sysctl know how to do it. There programs will see the pure 64 bits and only attempt to use 64 bit types. > #define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) > #define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr) Bruce From owner-svn-src-head@freebsd.org Tue May 2 11:52:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45D6CD599D6; Tue, 2 May 2017 11:52:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 09E0E7AC; Tue, 2 May 2017 11:51:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id CD9B4102199; Tue, 2 May 2017 21:51:49 +1000 (AEST) Date: Tue, 2 May 2017 21:51:49 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Hans Petter Selasky , Bruce Evans , Alan Somers , Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs... In-Reply-To: <20170502102932.GC1622@kib.kiev.ua> Message-ID: <20170502212549.Y1176@besplex.bde.org> References: <201704171734.v3HHYlf5022945@repo.freebsd.org> <20170419130428.J956@besplex.bde.org> <20170430201324.GV1622@kib.kiev.ua> <20170501163725.U972@besplex.bde.org> <20170502095527.GB1622@kib.kiev.ua> <27c9a2b4-b993-2370-1da8-b4beef354a1b@selasky.org> <20170502102932.GC1622@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VbSHBBh9 c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=5cO7WIxmaFd0sSc_HjoA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 11:52:00 -0000 On Tue, 2 May 2017, Konstantin Belousov wrote: > On Tue, May 02, 2017 at 12:02:32PM +0200, Hans Petter Selasky wrote: >> On 05/02/17 11:55, Konstantin Belousov wrote: >>> + out1 = 0xffffffff; >> >> Nitpicking: >> >> Should this be written: 0xffffffffU ?? No, 0xffffffffU should be written 0xffffffff except in very delicate code which needs it to have type precisely u_int (and u_int has at least 32 bits, else the constant would still not be u_int). > Compiler must do it on its own. The constant is not representable as > int so it is auto-promoted to unsigned int, if fitting. It doesn't really matter here, but we must make too many assumptions and do too many type analyses to see that it doesn't matter (or too see that either 0xffffffff or 0xffffffffU is correct or needed, but plain 0xffffffff usually works better since it lets the compiler decide). Here you assume <= 32-bit ints for simplicity (otherwise, 0xffffffff would be int). POSIX and practice also requires >= 32-bit ints. So ints are assumed to be precisely 32 bits, and then 0xffffffff is just a better spelling of 0xffffffffU. Here we only need that the constant is non-negative. Its type is irrelevant, so it would be a style bug to force the type to unsigned or larger (with < 32-bit ints) using a U suffix. All integer constants are non-negative. We could even spell the constant in decimal here. It would then have type int64_t. Spelling it in hex makes its value clearer and allows its type to be unsigned. Bruce From owner-svn-src-head@freebsd.org Tue May 2 12:17:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6ECE6D5A959; Tue, 2 May 2017 12:17:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF33EBA3; Tue, 2 May 2017 12:17:17 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v42CHBTf076523 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 May 2017 15:17:11 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v42CHBTf076523 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v42CHB8o076522; Tue, 2 May 2017 15:17:11 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 2 May 2017 15:17:11 +0300 From: Konstantin Belousov To: Bruce Evans Cc: Alan Somers , Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs... Message-ID: <20170502121711.GE1622@kib.kiev.ua> References: <201704171734.v3HHYlf5022945@repo.freebsd.org> <20170419130428.J956@besplex.bde.org> <20170430201324.GV1622@kib.kiev.ua> <20170501163725.U972@besplex.bde.org> <20170502095527.GB1622@kib.kiev.ua> <20170502203703.I1176@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170502203703.I1176@besplex.bde.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 12:17:18 -0000 On Tue, May 02, 2017 at 09:25:40PM +1000, Bruce Evans wrote: > On Tue, 2 May 2017, Konstantin Belousov wrote: > > > On Mon, May 01, 2017 at 06:25:11PM +1000, Bruce Evans wrote: > >> XX Index: subr_counter.c > >> XX =================================================================== > >> XX --- subr_counter.c (revision 317604) > >> XX +++ subr_counter.c (working copy) > >> XX @@ -78,11 +78,15 @@ > >> XX sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS) > >> XX { > >> XX uint64_t out; > >> XX + uint32_t out32; > >> XX int error; > >> XX > >> XX out = counter_u64_fetch(*(counter_u64_t *)arg1); > >> XX > >> XX - error = SYSCTL_OUT(req, &out, sizeof(uint64_t)); > >> XX + if (req->oldlen == 4 && (out32 = out) == out) > >> XX + error = SYSCTL_OUT(req, &out32, sizeof(out32)); > >> XX + else > >> XX + error = SYSCTL_OUT(req, &out, sizeof(out)); > >> XX > >> XX if (error || !req->newptr) > >> XX return (error); > >> > >> This does the minimum necessary to fix the current problem. > >> > >> This works until the counters become too large for a u_int. There > >> could be an option to get truncation with no error, but that would > >> require an API change, so applications should be required to do the > >> truncation for themself if that is what they want. > > > > Yes, this is approximately what I consider to be enough fix, but with > > some details which I do not like and which did not worked well on my > > test machine with enough memory to generate lot of increments. > > > > Below is what I consider to be good enough. I will proceed with this > > version unless very strong objections appear. > > I prefer my version. It is the same as for sysctl_bufspace(), except > for simplifications and bug fixes that are easier because the types > are unsigned. > > Your version is especially broken for the case of a lot of increments. You consider the 'differentiators' as the main users, but I only want systat and top to not abort, I have no intent of making them work for updated counters if overflown. Instead, I want something human-visible so that person looking at raw counters values using old tools detected the failure. > > Clamping breaks many cases in systat -v which just needs unsigned counters > to calculate small differences. Not many counters overflow faster than > the refresh interval in systat or top. These cases used to appear to > work perfectly for most counters when the kernel did blind truncations. > Clamping breaks the API. Not returing ENOMEM breaks the API. > > In my version, this is handled as specified by the API by truncating and > returning ENOMEM. Then: > - top sees the ENOMEM and mishandles it by aborting > - systat sees the ENOMEM (and also sees a short count, if it has the newer > breakage of hard-coding 64-bit counters instead of u_int ones, and is > run on a kernel with u_int counters) and mishandles it better by > printing an error message but not aborting. Thus it appears to work > just as well as when the kernel did blind truncation, except for the > error message. ENOMEM is, of course, the situation which I want to avoid. > > Clamping would be difficult for the application to handle even if an > error is returned. This would be like the situation for clamping for > strtoul(), but worse since it changes the API. Many applications don't > understand how to handle errno for strtoul(), but they do do a bogus > check of the clamped value. For sysctl(), clamping is not part of > the API now, so applications shouldn't check for the clamped values. > Ones that work with deltas like systat -v would see the counters stop > incrementing when the clamped value is reached, while truncated values > allow them to continue to appear to work perfectly. > > > diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c > > index 5f4cd46ab1e..93d5161de89 100644 > > --- a/sys/vm/vm_meter.c > > +++ b/sys/vm/vm_meter.c > > @@ -266,8 +266,29 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0, > > "VM meter vm stats"); > > SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats"); > > > > +static int > > +sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS) > > +{ > > + uint64_t out; > > +#ifdef COMPAT_FREEBSD11 > > + uint32_t out1; > > +#endif > > The extra wrapper and the ifdef limit the damage from the API change. > Otherwise, I don't like them. > > I prefer my variable name out32 to the nondescript out1. ('out' should > also be renamed out64, but I wanted to keep the diffs small.) Changed to the out32 name. > > > + > > + out = counter_u64_fetch(*(counter_u64_t *)arg1); > > +#ifdef COMPAT_FREEBSD11 > > + if (req->oldlen == sizeof(uint32_t)) { > > sizeof(uint32_t) is an obfuscated spelling of '4'. The size is already > hard-coded in '32'. This depends on sizeof(char) being 1. It is, and > won't change. POSIX started specifying this in 2001, and the mere > existence of uint8_t probably requires 8-bit chars since u_char must > be the smallest type of an object. This depends on the size of a u_int > being 32 bits/4 bytes in the old ABI. This won't change, and is already > hard-coded as 32, as it must be because sizeof(u_int) may change. I prefer the sizeof over 4. > > > + out1 = 0xffffffff; > > + if (out < out1) > > + out1 = out; > > This does the clamping. Clamping is probably better expressed as: > > out1 = MIN(out, 0xffffffff) Changed as well. > > > + return (SYSCTL_OUT(req, &out1, sizeof(uint32_t))); > > Here sizeof(uint32_t) is an obfuscated spelling of sizeof(out1). I think > the sizeof() is justified in this case, to limit the hard-coding to of > sizes to 1 place. Truncation by assigment to the destination variable also > helps limit this > (sysctl_bufspace() could also be improved by truncation by assignment. > Its integers are signed, so the result is implementation-defined, but > we know that it is benign 2's complement and don't really care what it > is provided it is reasonable. This is better than laboriously checking > the lower limit or neglecting to check it). > Here the limit 0xffffffff also depends on the size. Yes, there is no UINT32_MAX, and never will. > > > + } > > +#endif > > + return (SYSCTL_OUT(req, &out, sizeof(uint64_t))); > > +} > > + > > #define VM_STATS(parent, var, descr) \ > > - SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, &vm_cnt.var, descr) > > + SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \ > > + CTLFLAG_RD, &vm_cnt.var, 0, sysctl_handle_vmstat, "QU", descr); > > I see a new problem, shared with my version. The sysctl data says that this > sysctl is pure 64 bits, but it can return 32 bits. The sysctl data just > can't describe the variation. I guess this is not much a problem, since it > takes magic to read the sysctl data from the kernel and not many programs > except sysctl know how to do it. There programs will see the pure 64 > bits and only attempt to use 64 bit types. It can return 32bit only on improper use, which we allow for ABI compat. So I do not see this as a problem either. diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index 5f4cd46ab1e..67f24609b5a 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0, "VM meter vm stats"); SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats"); +static int +sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS) +{ + uint64_t out; +#ifdef COMPAT_FREEBSD11 + uint32_t out32; +#endif + + out = counter_u64_fetch(*(counter_u64_t *)arg1); +#ifdef COMPAT_FREEBSD11 + if (req->oldlen == sizeof(uint32_t)) { + out32 = MIN(out, 0xffffffff); + return (SYSCTL_OUT(req, &out32, sizeof(uint32_t))); + } +#endif + return (SYSCTL_OUT(req, &out, sizeof(uint64_t))); +} + #define VM_STATS(parent, var, descr) \ - SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, &vm_cnt.var, descr) + SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \ + CTLFLAG_RD, &vm_cnt.var, 0, sysctl_handle_vmstat, "QU", descr); #define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) #define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr) From owner-svn-src-head@freebsd.org Tue May 2 13:31:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FF69D5A22F; Tue, 2 May 2017 13:31:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id D055AEFA; Tue, 2 May 2017 13:31:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 3F6D2428B61; Tue, 2 May 2017 23:31:25 +1000 (AEST) Date: Tue, 2 May 2017 23:31:21 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , Alan Somers , Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs... In-Reply-To: <20170502121711.GE1622@kib.kiev.ua> Message-ID: <20170502223324.P1508@besplex.bde.org> References: <201704171734.v3HHYlf5022945@repo.freebsd.org> <20170419130428.J956@besplex.bde.org> <20170430201324.GV1622@kib.kiev.ua> <20170501163725.U972@besplex.bde.org> <20170502095527.GB1622@kib.kiev.ua> <20170502203703.I1176@besplex.bde.org> <20170502121711.GE1622@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=mHWIdm293UD_E3JX448A:9 a=puMN4P7tOccZgmq3:21 a=Us1PpGA1RNK12n6-:21 a=Wqx8G2oh0YgEZZqx:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 13:31:35 -0000 On Tue, 2 May 2017, Konstantin Belousov wrote: > On Tue, May 02, 2017 at 09:25:40PM +1000, Bruce Evans wrote: >> On Tue, 2 May 2017, Konstantin Belousov wrote: >> >>> On Mon, May 01, 2017 at 06:25:11PM +1000, Bruce Evans wrote: >>>> XX Index: subr_counter.c >>>> XX =================================================================== >>>> XX --- subr_counter.c (revision 317604) >>>> XX +++ subr_counter.c (working copy) >>>> XX @@ -78,11 +78,15 @@ >>>> XX sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS) >>>> XX { >>>> XX uint64_t out; >>>> XX + uint32_t out32; >>>> XX int error; >>>> XX >>>> XX out = counter_u64_fetch(*(counter_u64_t *)arg1); >>>> XX >>>> XX - error = SYSCTL_OUT(req, &out, sizeof(uint64_t)); >>>> XX + if (req->oldlen == 4 && (out32 = out) == out) >>>> XX + error = SYSCTL_OUT(req, &out32, sizeof(out32)); >>>> XX + else >>>> XX + error = SYSCTL_OUT(req, &out, sizeof(out)); >>>> XX >>>> XX if (error || !req->newptr) >>>> XX return (error); >>>> >>>> This does the minimum necessary to fix the current problem. >>>> >>>> This works until the counters become too large for a u_int. There >>>> could be an option to get truncation with no error, but that would >>>> require an API change, so applications should be required to do the >>>> truncation for themself if that is what they want. >>> >>> Yes, this is approximately what I consider to be enough fix, but with >>> some details which I do not like and which did not worked well on my >>> test machine with enough memory to generate lot of increments. >>> >>> Below is what I consider to be good enough. I will proceed with this >>> version unless very strong objections appear. >> >> I prefer my version. It is the same as for sysctl_bufspace(), except >> for simplifications and bug fixes that are easier because the types >> are unsigned. >> >> Your version is especially broken for the case of a lot of increments. > You consider the 'differentiators' as the main users, but I only want > systat and top to not abort, I have no intent of making them work > for updated counters if overflown. Instead, I want something human-visible > so that person looking at raw counters values using old tools detected the > failure. Clamping doesn't work for that either. Truncating either just works using differences like it has done for 30 years or so, or gives weirder values that clamping. Arguably, the API is that the counters may wrap, and applications must handle this as well as possible by sampling them more often than they wrap, so that only the initial values might be wrong. Applications should also have attempt to guess when the initial values are wrong, and print hints about this that are more visible than printing blindly wrapped value. >> Clamping breaks many cases in systat -v which just needs unsigned counters >> to calculate small differences. Not many counters overflow faster than >> the refresh interval in systat or top. These cases used to appear to >> work perfectly for most counters when the kernel did blind truncations. >> Clamping breaks the API. Not returing ENOMEM breaks the API. >> >> In my version, this is handled as specified by the API by truncating and >> returning ENOMEM. Then: >> - top sees the ENOMEM and mishandles it by aborting >> - systat sees the ENOMEM (and also sees a short count, if it has the newer >> breakage of hard-coding 64-bit counters instead of u_int ones, and is >> run on a kernel with u_int counters) and mishandles it better by >> printing an error message but not aborting. Thus it appears to work >> just as well as when the kernel did blind truncation, except for the >> error message. > ENOMEM is, of course, the situation which I want to avoid. Then you have to return no error, but truncate the value instead of clamping. Anything else is incompatible. To find the buggy applications, it is better to return a new errno, not ENOMEM. EOVERFLOW resulted in top aborting with a useful error message. >>> ... >>> + out = counter_u64_fetch(*(counter_u64_t *)arg1); >>> +#ifdef COMPAT_FREEBSD11 >>> + if (req->oldlen == sizeof(uint32_t)) { >> >> sizeof(uint32_t) is an obfuscated spelling of '4'. The size is already >> hard-coded in '32'. This depends on sizeof(char) being 1. It is, and >> won't change. POSIX started specifying this in 2001, and the mere >> existence of uint8_t probably requires 8-bit chars since u_char must >> be the smallest type of an object. This depends on the size of a u_int >> being 32 bits/4 bytes in the old ABI. This won't change, and is already >> hard-coded as 32, as it must be because sizeof(u_int) may change. > I prefer the sizeof over 4. sizeof is really bloated when you handle all the sizes as in my larger patch. The basic sizes are 1, 2, 4 and 8 bytes (and possibly a larger intmax_t), and it is a detail that the sizes in the integer types are in bits. However, once we have set up the variables to match the sizes in bytes, it is not so bad to use sizeof(var) instead of sizeof(typename). The size is then hard-coded in only 1 place. That works here too: use sizeof(out32). >>> + out1 = 0xffffffff; >>> + if (out < out1) >>> + out1 = out; >> >> This does the clamping. Clamping is probably better expressed as: >> >> out1 = MIN(out, 0xffffffff) > Changed as well. I forgot to mention that I don't really like MIN(). It is an unsafe macro with ugly spelling indicating that it is unsafe. 4.4BSD removed it in the kernel and tried to replace it by the imin() family of inline functions, but this API is hard to use because it is not type-generic. The kernel was reinfected with MIN() via contrib'ed code using home-made versions of MIN(). uqmin() would work here, but quad_t is another mistake... >> >>> + return (SYSCTL_OUT(req, &out1, sizeof(uint32_t))); sizeof(var) works even better here when it is used above. >> >> Here sizeof(uint32_t) is an obfuscated spelling of sizeof(out1). I think >> the sizeof() is justified in this case, to limit the hard-coding to of >> sizes to 1 place. Truncation by assigment to the destination variable also >> helps limit this >> (sysctl_bufspace() could also be improved by truncation by assignment. >> Its integers are signed, so the result is implementation-defined, but >> we know that it is benign 2's complement and don't really care what it >> is provided it is reasonable. This is better than laboriously checking >> the lower limit or neglecting to check it). >> Here the limit 0xffffffff also depends on the size. > Yes, there is no UINT32_MAX, and never will. You mean that you don't want to use it here. Of course, UINT32_MAX does exist, and is quite delicate due to complications to give it the correct type. It must have the type of its default promotion, and this depends on the size of int and long. So it is defined in an MD file, and has an unnecessary U suffix on i386. This contrasts with UINT16_MAX, which is also defined in an MD file but has type signed int on all arches and must be defined without a U suffix, since all arches have more than 16 bits in it. There is also the UINT32_C() macro which has to append U on x86 since smaller constants or the same constant in decimal would not be naturally unsigned. >>> + } >>> +#endif >>> + return (SYSCTL_OUT(req, &out, sizeof(uint64_t))); >>> +} >>> + >>> #define VM_STATS(parent, var, descr) \ >>> - SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, &vm_cnt.var, descr) >>> + SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \ >>> + CTLFLAG_RD, &vm_cnt.var, 0, sysctl_handle_vmstat, "QU", descr); >> >> I see a new problem, shared with my version. The sysctl data says that this >> sysctl is pure 64 bits, but it can return 32 bits. The sysctl data just >> can't describe the variation. I guess this is not much a problem, since it >> takes magic to read the sysctl data from the kernel and not many programs >> except sysctl know how to do it. There programs will see the pure 64 >> bits and only attempt to use 64 bit types. > > It can return 32bit only on improper use, which we allow for ABI compat. > So I do not see this as a problem either. I'm trying to fix the API. Another bug in the public API is that there is no way to probe for the sign of a type. This is the only useful thing in the sysct data. > diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c > index 5f4cd46ab1e..67f24609b5a 100644 > --- a/sys/vm/vm_meter.c > +++ b/sys/vm/vm_meter.c > @@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0, > "VM meter vm stats"); > SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats"); > > +static int > +sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS) > +{ > + uint64_t out; > +#ifdef COMPAT_FREEBSD11 > + uint32_t out32; > +#endif > + > + out = counter_u64_fetch(*(counter_u64_t *)arg1); > +#ifdef COMPAT_FREEBSD11 > + if (req->oldlen == sizeof(uint32_t)) { > + out32 = MIN(out, 0xffffffff); Incompatible for negative advantages. It should truncate. > + return (SYSCTL_OUT(req, &out32, sizeof(uint32_t))); It seems to be necessary to drop the error reporting for compatility. How does sysctl_bufspace() work when it intentionally keeps the error reporting and even has a comment about this? > + } > +#endif > + return (SYSCTL_OUT(req, &out, sizeof(uint64_t))); > +} This still has the style bug 'sizeof(typename)'. If you want to use the type name too much, then you can also use it to spell 0xffffffff as (uint32_t)-1. Then the size 4 bytes would be consistently represented as 32 bits. Going from type variable out32 to its maximum should be spellable as __maxof(out32) but __maxof() doesn't exist. > + > #define VM_STATS(parent, var, descr) \ > - SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, &vm_cnt.var, descr) > + SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \ > + CTLFLAG_RD, &vm_cnt.var, 0, sysctl_handle_vmstat, "QU", descr); > #define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) > #define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr) Bruce From owner-svn-src-head@freebsd.org Tue May 2 13:38:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1190DD5A57E; Tue, 2 May 2017 13:38:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D7E9612F7; Tue, 2 May 2017 13:38:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42DcLCf076667; Tue, 2 May 2017 13:38:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42DcKpq076654; Tue, 2 May 2017 13:38:20 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705021338.v42DcKpq076654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 May 2017 13:38:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317678 - in head/usr.bin/grep: . nls X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 13:38:23 -0000 Author: emaste Date: Tue May 2 13:38:20 2017 New Revision: 317678 URL: https://svnweb.freebsd.org/changeset/base/317678 Log: bsdgrep: Add GNU compatible version string indicator As reported in r218614 it's useful to have an indication of whether or not BSD grep was built with GNU_GREP_COMPAT. Submitted by: Kyle Evans Reported by: mandree Differential Revision: https://reviews.freebsd.org/D10451 Modified: head/usr.bin/grep/Makefile head/usr.bin/grep/grep.c head/usr.bin/grep/nls/C.msg head/usr.bin/grep/nls/es_ES.ISO8859-1.msg head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg head/usr.bin/grep/nls/ja_JP.SJIS.msg head/usr.bin/grep/nls/ja_JP.UTF-8.msg head/usr.bin/grep/nls/ja_JP.eucJP.msg head/usr.bin/grep/nls/pt_BR.ISO8859-1.msg head/usr.bin/grep/nls/ru_RU.KOI8-R.msg head/usr.bin/grep/nls/uk_UA.UTF-8.msg head/usr.bin/grep/nls/zh_CN.UTF-8.msg Modified: head/usr.bin/grep/Makefile ============================================================================== --- head/usr.bin/grep/Makefile Tue May 2 10:13:50 2017 (r317677) +++ head/usr.bin/grep/Makefile Tue May 2 13:38:20 2017 (r317678) @@ -82,7 +82,7 @@ CFLAGS+= -DWITHOUT_BZIP2 .endif .if ${MK_GNU_GREP_COMPAT} != "no" -CFLAGS+= -I${DESTDIR}/usr/include/gnu +CFLAGS+= -I${DESTDIR}/usr/include/gnu -DWITH_GNU LIBADD+= gnuregex .endif Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Tue May 2 10:13:50 2017 (r317677) +++ head/usr.bin/grep/grep.c Tue May 2 13:38:20 2017 (r317678) @@ -74,6 +74,7 @@ const char *errstr[] = { /* 7*/ "\t[--null] [pattern] [file ...]\n", /* 8*/ "Binary file %s matches\n", /* 9*/ "%s (BSD grep) %s\n", +/* 10*/ "%s (BSD grep, GNU compatible) %s\n", }; /* Flags passed to regcomp() and regexec() */ @@ -596,7 +597,11 @@ main(int argc, char *argv[]) filebehave = FILE_MMAP; break; case 'V': +#ifdef WITH_GNU + printf(getstr(10), getprogname(), VERSION); +#else printf(getstr(9), getprogname(), VERSION); +#endif exit(0); case 'v': vflag = true; Modified: head/usr.bin/grep/nls/C.msg ============================================================================== --- head/usr.bin/grep/nls/C.msg Tue May 2 10:13:50 2017 (r317677) +++ head/usr.bin/grep/nls/C.msg Tue May 2 13:38:20 2017 (r317678) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [pattern] [file ...]\n" 8 "Binary file %s matches\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: head/usr.bin/grep/nls/es_ES.ISO8859-1.msg ============================================================================== --- head/usr.bin/grep/nls/es_ES.ISO8859-1.msg Tue May 2 10:13:50 2017 (r317677) +++ head/usr.bin/grep/nls/es_ES.ISO8859-1.msg Tue May 2 13:38:20 2017 (r317678) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [pauta] [fichero ...]\n" 8 "fichero binario %s se ajusta\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg ============================================================================== --- head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg Tue May 2 10:13:50 2017 (r317677) +++ head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg Tue May 2 13:38:20 2017 (r317678) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [pauta] [ficheiro ...]\n" 8 "ficheiro binario %s conforma\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg ============================================================================== --- head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg Tue May 2 10:13:50 2017 (r317677) +++ head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg Tue May 2 13:38:20 2017 (r317678) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [minta] [fájl ...]\n" 8 "%s bináris fájl illeszkedik\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: head/usr.bin/grep/nls/ja_JP.SJIS.msg ============================================================================== --- head/usr.bin/grep/nls/ja_JP.SJIS.msg Tue May 2 10:13:50 2017 (r317677) +++ head/usr.bin/grep/nls/ja_JP.SJIS.msg Tue May 2 13:38:20 2017 (r317678) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [ƒpƒ^[ƒ“] [ƒtƒ@ƒCƒ‹–¼ ...]\n" 8 "ƒoƒCƒiƒŠƒtƒ@ƒCƒ‹ %s ‚Ƀ}ƒbƒ`‚µ‚Ü‚µ‚½\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: head/usr.bin/grep/nls/ja_JP.UTF-8.msg ============================================================================== --- head/usr.bin/grep/nls/ja_JP.UTF-8.msg Tue May 2 10:13:50 2017 (r317677) +++ head/usr.bin/grep/nls/ja_JP.UTF-8.msg Tue May 2 13:38:20 2017 (r317678) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [パターン] [ファイルå ...]\n" 8 "ãƒã‚¤ãƒŠãƒªãƒ•ã‚¡ã‚¤ãƒ« %s ã«ãƒžãƒƒãƒã—ã¾ã—ãŸ\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: head/usr.bin/grep/nls/ja_JP.eucJP.msg ============================================================================== --- head/usr.bin/grep/nls/ja_JP.eucJP.msg Tue May 2 10:13:50 2017 (r317677) +++ head/usr.bin/grep/nls/ja_JP.eucJP.msg Tue May 2 13:38:20 2017 (r317678) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [¥Ñ¥¿¡¼¥ó] [¥Õ¥¡¥¤¥ë̾ ...]\n" 8 "¥Ð¥¤¥Ê¥ê¥Õ¥¡¥¤¥ë %s ¤Ë¥Þ¥Ã¥Á¤·¤Þ¤·¤¿\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: head/usr.bin/grep/nls/pt_BR.ISO8859-1.msg ============================================================================== --- head/usr.bin/grep/nls/pt_BR.ISO8859-1.msg Tue May 2 10:13:50 2017 (r317677) +++ head/usr.bin/grep/nls/pt_BR.ISO8859-1.msg Tue May 2 13:38:20 2017 (r317678) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [padrão] [arquivo ...]\n" 8 "arquivo binário %s casa com o padrão\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: head/usr.bin/grep/nls/ru_RU.KOI8-R.msg ============================================================================== --- head/usr.bin/grep/nls/ru_RU.KOI8-R.msg Tue May 2 10:13:50 2017 (r317677) +++ head/usr.bin/grep/nls/ru_RU.KOI8-R.msg Tue May 2 13:38:20 2017 (r317678) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [ÛÁÂÌÏÎ] [ÆÁÊÌ ...]\n" 8 "Ä×ÏÉÞÎÙÊ ÆÁÊÌ %s ÓÏ×ÐÁÄÁÅÔ\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: head/usr.bin/grep/nls/uk_UA.UTF-8.msg ============================================================================== --- head/usr.bin/grep/nls/uk_UA.UTF-8.msg Tue May 2 10:13:50 2017 (r317677) +++ head/usr.bin/grep/nls/uk_UA.UTF-8.msg Tue May 2 13:38:20 2017 (r317678) @@ -10,3 +10,4 @@ $quote " 7 "\t[--null] [шаблон] [файл ...]\n" 8 "двійковий файл %s Ñпівпадає\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" Modified: head/usr.bin/grep/nls/zh_CN.UTF-8.msg ============================================================================== --- head/usr.bin/grep/nls/zh_CN.UTF-8.msg Tue May 2 10:13:50 2017 (r317677) +++ head/usr.bin/grep/nls/zh_CN.UTF-8.msg Tue May 2 13:38:20 2017 (r317678) @@ -11,3 +11,4 @@ $quote " 7 "\t[--null] [模å¼] [文件å ...]\n" 8 "二进制文件 %s 包å«æ¨¡å¼\n" 9 "%s (BSD grep) %s\n" +10 "%s (BSD grep, GNU compatible) %s\n" From owner-svn-src-head@freebsd.org Tue May 2 13:47:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B66F0D5A842; Tue, 2 May 2017 13:47:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 936CB1A44; Tue, 2 May 2017 13:47:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42DlGhg080753; Tue, 2 May 2017 13:47:16 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42DlFYj080741; Tue, 2 May 2017 13:47:15 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705021347.v42DlFYj080741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 May 2017 13:47:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317679 - head/usr.bin/grep/nls X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 13:47:17 -0000 Author: emaste Date: Tue May 2 13:47:15 2017 New Revision: 317679 URL: https://svnweb.freebsd.org/changeset/base/317679 Log: bsdgrep: correct nls usage data after r317049 r317049 added -z/--null-data to BSD grep but missed the update to nls catalogs. Submitted by: Kyle Evans Differential Revision: https://reviews.freebsd.org/D10456 Modified: head/usr.bin/grep/nls/C.msg head/usr.bin/grep/nls/es_ES.ISO8859-1.msg head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg head/usr.bin/grep/nls/ja_JP.SJIS.msg head/usr.bin/grep/nls/ja_JP.UTF-8.msg head/usr.bin/grep/nls/ja_JP.eucJP.msg head/usr.bin/grep/nls/pt_BR.ISO8859-1.msg head/usr.bin/grep/nls/ru_RU.KOI8-R.msg head/usr.bin/grep/nls/uk_UA.UTF-8.msg head/usr.bin/grep/nls/zh_CN.UTF-8.msg Modified: head/usr.bin/grep/nls/C.msg ============================================================================== --- head/usr.bin/grep/nls/C.msg Tue May 2 13:38:20 2017 (r317678) +++ head/usr.bin/grep/nls/C.msg Tue May 2 13:47:15 2017 (r317679) @@ -5,7 +5,7 @@ $quote " 1 "(standard input)" 2 "cannot read bzip2 compressed file" 3 "unknown %s option" -4 "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n" +4 "usage: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A num] [-B num] [-C[num]]\n" 5 "\t[-e pattern] [-f file] [--binary-files=value] [--color=when]\n" 6 "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n" 7 "\t[--null] [pattern] [file ...]\n" Modified: head/usr.bin/grep/nls/es_ES.ISO8859-1.msg ============================================================================== --- head/usr.bin/grep/nls/es_ES.ISO8859-1.msg Tue May 2 13:38:20 2017 (r317678) +++ head/usr.bin/grep/nls/es_ES.ISO8859-1.msg Tue May 2 13:47:15 2017 (r317679) @@ -5,7 +5,7 @@ $quote " 1 "(entrada estándar)" 2 "no se puede leer el fichero comprimido bzip2" 3 "opción desconocida de %s" -4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A no] [-B no] [-C[no]]\n" +4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A no] [-B no] [-C[no]]\n" 5 "\t[-e pauta] [-f fichero] [--binary-files=valor] [--color=cuando]\n" 6 "\t[--context[=no]] [--directories=acción] [--label] [--line-buffered]\n" 7 "\t[--null] [pauta] [fichero ...]\n" Modified: head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg ============================================================================== --- head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg Tue May 2 13:38:20 2017 (r317678) +++ head/usr.bin/grep/nls/gl_ES.ISO8859-1.msg Tue May 2 13:47:15 2017 (r317679) @@ -5,7 +5,7 @@ $quote " 1 "(entrada estándar)" 2 "non se pode ler o ficheiro comprimido bzip2" 3 "opción descoñecida de %s" -4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A no] [-B no] [-C[no]]\n" +4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A no] [-B no] [-C[no]]\n" 5 "\t[-e pauta] [-f ficheiro] [--binary-files=valor] [--color=cando]\n" 6 "\t[--context[=no]] [--directories=acción] [--label] [--line-buffered]\n" 7 "\t[--null] [pauta] [ficheiro ...]\n" Modified: head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg ============================================================================== --- head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg Tue May 2 13:38:20 2017 (r317678) +++ head/usr.bin/grep/nls/hu_HU.ISO8859-2.msg Tue May 2 13:47:15 2017 (r317679) @@ -5,7 +5,7 @@ $quote " 1 "(szabványos bemenet)" 2 "bzip2 tömörített fájl nem olvasható" 3 "ismeretlen %s opció" -4 "használat: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A szám] [-B szám] [-C[szám]]\n" +4 "használat: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A szám] [-B szám] [-C[szám]]\n" 5 "\t[-e minta] [-f fájl] [--binary-files=érték] [--color=mikor]\n" 6 "\t[--context[=szám]] [--directories=mûvelet] [--label] [--line-buffered]\n" 7 "\t[--null] [minta] [fájl ...]\n" Modified: head/usr.bin/grep/nls/ja_JP.SJIS.msg ============================================================================== --- head/usr.bin/grep/nls/ja_JP.SJIS.msg Tue May 2 13:38:20 2017 (r317678) +++ head/usr.bin/grep/nls/ja_JP.SJIS.msg Tue May 2 13:47:15 2017 (r317679) @@ -5,7 +5,7 @@ $quote " 1 "(•W€“ü—Í)" 2 "bzip2 ˆ³kƒtƒ@ƒCƒ‹‚ð“Ç‚Ýž‚Þ‚±‚Æ‚ª‚Å‚«‚Ü‚¹‚ñ" 3 "%s ƒIƒvƒVƒ‡ƒ“‚ÌŽw’è’l‚ÉŒë‚肪‚ ‚è‚Ü‚·" -4 "Žg‚¢•û: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A ”Žš] [-B ”Žš] [-C[”Žš]]\n" +4 "Žg‚¢•û: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A ”Žš] [-B ”Žš] [-C[”Žš]]\n" 5 "\t[-e ƒpƒ^[ƒ“] [-f ƒtƒ@ƒCƒ‹–¼] [--binary-files=’l] [--color=’l]\n" 6 "\t[--context[=”Žš]] [--directories=“®ì] [--label] [--line-buffered]\n" 7 "\t[--null] [ƒpƒ^[ƒ“] [ƒtƒ@ƒCƒ‹–¼ ...]\n" Modified: head/usr.bin/grep/nls/ja_JP.UTF-8.msg ============================================================================== --- head/usr.bin/grep/nls/ja_JP.UTF-8.msg Tue May 2 13:38:20 2017 (r317678) +++ head/usr.bin/grep/nls/ja_JP.UTF-8.msg Tue May 2 13:47:15 2017 (r317679) @@ -5,7 +5,7 @@ $quote " 1 "(標準入力)" 2 "bzip2 圧縮ファイルを読ã¿è¾¼ã‚€ã“ã¨ãŒã§ãã¾ã›ã‚“" 3 "%s オプションã®æŒ‡å®šå€¤ã«èª¤ã‚ŠãŒã‚ã‚Šã¾ã™" -4 "使ã„æ–¹: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A æ•°å­—] [-B æ•°å­—] [-C[æ•°å­—]]\n" +4 "使ã„æ–¹: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A æ•°å­—] [-B æ•°å­—] [-C[æ•°å­—]]\n" 5 "\t[-e パターン] [-f ファイルå] [--binary-files=値] [--color=値]\n" 6 "\t[--context[=æ•°å­—]] [--directories=動作] [--label] [--line-buffered]\n" 7 "\t[--null] [パターン] [ファイルå ...]\n" Modified: head/usr.bin/grep/nls/ja_JP.eucJP.msg ============================================================================== --- head/usr.bin/grep/nls/ja_JP.eucJP.msg Tue May 2 13:38:20 2017 (r317678) +++ head/usr.bin/grep/nls/ja_JP.eucJP.msg Tue May 2 13:47:15 2017 (r317679) @@ -5,7 +5,7 @@ $quote " 1 "(ɸ½àÆþÎÏ)" 2 "bzip2 °µ½Ì¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤à¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó" 3 "%s ¥ª¥×¥·¥ç¥ó¤Î»ØÄêÃͤ˸í¤ê¤¬¤¢¤ê¤Þ¤¹" -4 "»È¤¤Êý: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A ¿ô»ú] [-B ¿ô»ú] [-C[¿ô»ú]]\n" +4 "»È¤¤Êý: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A ¿ô»ú] [-B ¿ô»ú] [-C[¿ô»ú]]\n" 5 "\t[-e ¥Ñ¥¿¡¼¥ó] [-f ¥Õ¥¡¥¤¥ë̾] [--binary-files=ÃÍ] [--color=ÃÍ]\n" 6 "\t[--context[=¿ô»ú]] [--directories=Æ°ºî] [--label] [--line-buffered]\n" 7 "\t[--null] [¥Ñ¥¿¡¼¥ó] [¥Õ¥¡¥¤¥ë̾ ...]\n" Modified: head/usr.bin/grep/nls/pt_BR.ISO8859-1.msg ============================================================================== --- head/usr.bin/grep/nls/pt_BR.ISO8859-1.msg Tue May 2 13:38:20 2017 (r317678) +++ head/usr.bin/grep/nls/pt_BR.ISO8859-1.msg Tue May 2 13:47:15 2017 (r317679) @@ -5,7 +5,7 @@ $quote " 1 "(entrada padrão)" 2 "não se posso ler o fichero comprimido bzip2" 3 "opcão não conhecida de %s" -4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n" +4 "uso: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A num] [-B num] [-C[num]]\n" 5 "\t[-e padrão] [-f arquivo] [--binary-files=valor] [--color=quando]\n" 6 "\t[--context[=num]] [--directories=ação] [--label] [--line-buffered]\n" 7 "\t[--null] [padrão] [arquivo ...]\n" Modified: head/usr.bin/grep/nls/ru_RU.KOI8-R.msg ============================================================================== --- head/usr.bin/grep/nls/ru_RU.KOI8-R.msg Tue May 2 13:38:20 2017 (r317678) +++ head/usr.bin/grep/nls/ru_RU.KOI8-R.msg Tue May 2 13:47:15 2017 (r317679) @@ -5,7 +5,7 @@ $quote " 1 "(ÓÔÁÎÄÁÒÔÎÙÊ ××ÏÄ)" 2 "ÎÅ ÍÏÇÕ ÐÒÏÞÉÔÁÔØ ÓÖÁÔÙÊ × bzip2 ÆÁÊÌ" 3 "ÎÅÉÚ×ÅÓÔÎÙÊ ËÌÀÞ %s" -4 "ÉÓÐÏÌØÚÏ×ÁÎÉÅ: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A ÞÉÓ] [-B ÞÉÓ] [-C[ÞÉÓ]]\n" +4 "ÉÓÐÏÌØÚÏ×ÁÎÉÅ: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A ÞÉÓ] [-B ÞÉÓ] [-C[ÞÉÓ]]\n" 5 "\t[-e ÛÁÂÌÏÎ] [-f ÆÁÊÌ] [--binary-files=ÚÎÁÞÅÎÉÅ] [--color=ËÏÇÄÁ]\n" 6 "\t[--context[=ÞÉÓ]] [--directories=ÄÅÊÓÔ×ÉÅ] [--label] [--line-buffered]\n" 7 "\t[--null] [ÛÁÂÌÏÎ] [ÆÁÊÌ ...]\n" Modified: head/usr.bin/grep/nls/uk_UA.UTF-8.msg ============================================================================== --- head/usr.bin/grep/nls/uk_UA.UTF-8.msg Tue May 2 13:38:20 2017 (r317678) +++ head/usr.bin/grep/nls/uk_UA.UTF-8.msg Tue May 2 13:47:15 2017 (r317679) @@ -4,7 +4,7 @@ $quote " 1 "(Ñтандартний ввід)" 2 "не можу прочитати ÑтиÑнутий bzip2 файл" 3 "невiдома Ð¾Ð¿Ñ†Ñ–Ñ %s" -4 "викориÑтаннÑ: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A чиÑ] [-B чиÑ] [-C[чиÑ]]\n" +4 "викориÑтаннÑ: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A чиÑ] [-B чиÑ] [-C[чиÑ]]\n" 5 "\t[-e шаблон] [-f файл] [--binary-files=значеннÑ] [--color=коли]\n" 6 "\t[--context[=чиÑ] [--directories=діÑ] [--label] [--line-buffered]\n" 7 "\t[--null] [шаблон] [файл ...]\n" Modified: head/usr.bin/grep/nls/zh_CN.UTF-8.msg ============================================================================== --- head/usr.bin/grep/nls/zh_CN.UTF-8.msg Tue May 2 13:38:20 2017 (r317678) +++ head/usr.bin/grep/nls/zh_CN.UTF-8.msg Tue May 2 13:47:15 2017 (r317679) @@ -5,7 +5,7 @@ $quote " 1 "(标准输入)" 2 "è¯»å– bzip2 压缩文件时出错" 3 "选项 %s 无法识别" -4 "用法: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZ] [-A 行数] [-B 行数] [-C[行数]]\n" +4 "用法: %s [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A 行数] [-B 行数] [-C[行数]]\n" 5 "\t[-e 模å¼] [-f 文件] [--binary-files=值] [--color=何时]\n" 6 "\t[--context[=行数]] [--directories=动作] [--label] [--line-buffered]\n" 7 "\t[--null] [模å¼] [文件å ...]\n" From owner-svn-src-head@freebsd.org Tue May 2 14:48:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67087D5AFA7; Tue, 2 May 2017 14:48:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D95E974; Tue, 2 May 2017 14:48:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v42EmOgw009725 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 May 2017 17:48:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v42EmOgw009725 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v42EmNSH009724; Tue, 2 May 2017 17:48:23 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 2 May 2017 17:48:23 +0300 From: Konstantin Belousov To: Bruce Evans Cc: Alan Somers , Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs... Message-ID: <20170502144823.GH1622@kib.kiev.ua> References: <201704171734.v3HHYlf5022945@repo.freebsd.org> <20170419130428.J956@besplex.bde.org> <20170430201324.GV1622@kib.kiev.ua> <20170501163725.U972@besplex.bde.org> <20170502095527.GB1622@kib.kiev.ua> <20170502203703.I1176@besplex.bde.org> <20170502121711.GE1622@kib.kiev.ua> <20170502223324.P1508@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170502223324.P1508@besplex.bde.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 14:48:34 -0000 On Tue, May 02, 2017 at 11:31:21PM +1000, Bruce Evans wrote: > On Tue, 2 May 2017, Konstantin Belousov wrote: > > ENOMEM is, of course, the situation which I want to avoid. > > Then you have to return no error, but truncate the value instead of > clamping. Anything else is incompatible. I do not quite agree with the truncation part, bit I do not think that it is too important. As I noted before, IMO the absolute numbers for the counters have more values than per-interval diffs displayed by e.g. systat. But if truncating causes less disagreement than clamping, lets do truncation. diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index 5f4cd46ab1e..6266ef670a6 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0, "VM meter vm stats"); SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats"); +static int +sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS) +{ + uint64_t out; +#ifdef COMPAT_FREEBSD11 + uint32_t out32; +#endif + + out = counter_u64_fetch(*(counter_u64_t *)arg1); +#ifdef COMPAT_FREEBSD11 + if (req->oldlen == sizeof(out32)) { + out32 = (uint32_t)out; /* truncate */ + return (SYSCTL_OUT(req, &out32, sizeof(out32))); + } +#endif + return (SYSCTL_OUT(req, &out, sizeof(out))); +} + #define VM_STATS(parent, var, descr) \ - SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, &vm_cnt.var, descr) + SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \ + CTLFLAG_RD, &vm_cnt.var, 0, sysctl_handle_vmstat, "QU", descr); #define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) #define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr) From owner-svn-src-head@freebsd.org Tue May 2 14:52:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15715D5A285; Tue, 2 May 2017 14:52:30 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D93EBE01; Tue, 2 May 2017 14:52:29 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42EqSjg010066; Tue, 2 May 2017 14:52:28 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42EqSdJ010065; Tue, 2 May 2017 14:52:28 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705021452.v42EqSdJ010065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Tue, 2 May 2017 14:52:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317680 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 14:52:30 -0000 Author: ken Date: Tue May 2 14:52:28 2017 New Revision: 317680 URL: https://svnweb.freebsd.org/changeset/base/317680 Log: Add the SCSI SSC Manufacturer assigned serial number VPD page. This is current as of SSC-5r03. Submitted by: Sam Klopsch MFC after: 3 days Modified: head/sys/cam/scsi/scsi_sa.h Modified: head/sys/cam/scsi/scsi_sa.h ============================================================================== --- head/sys/cam/scsi/scsi_sa.h Tue May 2 13:47:15 2017 (r317679) +++ head/sys/cam/scsi/scsi_sa.h Tue May 2 14:52:28 2017 (r317680) @@ -487,6 +487,19 @@ struct scsi_medium_type_data { }; /* + * Manufacturer-assigned Serial Number VPD page. + * Current as of SSC-5r03, 28 September 2016. + */ +struct scsi_vpd_mfg_serial_number +{ + u_int8_t device; + u_int8_t page_code; +#define SVPD_MFG_SERIAL_NUMBER_PAGE_CODE 0xB1 + u_int8_t page_length[2]; + u_int8_t mfg_serial_num[]; +}; + +/* * Security Protocol Specific values for the Tape Data Encryption protocol * (0x20) used with SECURITY PROTOCOL IN. See below for values used with * SECURITY PROTOCOL OUT. Current as of SSC4r03. From owner-svn-src-head@freebsd.org Tue May 2 14:52:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39203D5A2B2; Tue, 2 May 2017 14:52:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E45FBE67; Tue, 2 May 2017 14:52:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42EqZjb010116; Tue, 2 May 2017 14:52:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42EqZSB010115; Tue, 2 May 2017 14:52:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201705021452.v42EqZSB010115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 2 May 2017 14:52:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317681 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 14:52:37 -0000 Author: kib Date: Tue May 2 14:52:35 2017 New Revision: 317681 URL: https://svnweb.freebsd.org/changeset/base/317681 Log: Document time_t size. Reviewed by: emaste, imp, vangyzen Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D10568 Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Tue May 2 14:52:28 2017 (r317680) +++ head/share/man/man7/arch.7 Tue May 2 14:52:35 2017 (r317681) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 21, 2017 +.Dd May 2, 2017 .Dt ARCH 7 .Os .Sh NAME @@ -47,27 +47,27 @@ On all supported architectures, .It float Ta 4 .It double Ta 8 .El -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) -.It amd64 Ta 8 Ta 16 -.It arm Ta 4 Ta 8 -.It armeb Ta 4 Ta 8 -.It armv6 Ta 4 Ta 8 -.It arm64 Ta 8 Ta 16 -.It i386 Ta 4 Ta 12 -.It mips Ta 4 Ta 8 -.It mipsel Ta 4 Ta 8 -.It mipselhf Ta 4 Ta 8 -.It mipshf Ta 4 Ta 8 -.It mipsn32 Ta 4 Ta 8 -.It mips64 Ta 8 Ta 8 -.It mips64el Ta 8 Ta 8 -.It mips64elhf Ta 8 Ta 8 -.It mips64hf Ta 8 Ta 8 -.It powerpc Ta 4 Ta 8 -.It powerpc64 Ta 8 Ta 8 -.It riscv Ta 8 Ta 16 -.It sparc64 Ta 8 Ta 16 +.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" +.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) +.It amd64 Ta 8 Ta 16 Ta 8 +.It arm Ta 4 Ta 8 Ta 8 +.It armeb Ta 4 Ta 8 Ta 8 +.It armv6 Ta 4 Ta 8 Ta 8 +.It arm64 Ta 8 Ta 16 Ta 8 +.It i386 Ta 4 Ta 12 Ta 4 +.It mips Ta 4 Ta 8 Ta 8 +.It mipsel Ta 4 Ta 8 Ta 8 +.It mipselhf Ta 4 Ta 8 Ta 8 +.It mipshf Ta 4 Ta 8 Ta 8 +.It mipsn32 Ta 4 Ta 8 Ta 8 +.It mips64 Ta 8 Ta 8 Ta 8 +.It mips64el Ta 8 Ta 8 Ta 8 +.It mips64elhf Ta 8 Ta 8 Ta 8 +.It mips64hf Ta 8 Ta 8 Ta 8 +.It powerpc Ta 4 Ta 8 Ta 4 +.It powerpc64 Ta 8 Ta 8 Ta 8 +.It riscv Ta 8 Ta 16 Ta 8 +.It sparc64 Ta 8 Ta 16 Ta 8 .El .Ss Endianness and Char Signedness .Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char Signedness" From owner-svn-src-head@freebsd.org Tue May 2 15:31:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 145BDD5A2EC; Tue, 2 May 2017 15:31:15 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 9ECA6E22; Tue, 2 May 2017 15:31:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 045131048B19; Wed, 3 May 2017 01:31:11 +1000 (AEST) Date: Wed, 3 May 2017 01:31:10 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , Alan Somers , Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs... In-Reply-To: <20170502144823.GH1622@kib.kiev.ua> Message-ID: <20170503005322.K1968@besplex.bde.org> References: <201704171734.v3HHYlf5022945@repo.freebsd.org> <20170419130428.J956@besplex.bde.org> <20170430201324.GV1622@kib.kiev.ua> <20170501163725.U972@besplex.bde.org> <20170502095527.GB1622@kib.kiev.ua> <20170502203703.I1176@besplex.bde.org> <20170502121711.GE1622@kib.kiev.ua> <20170502223324.P1508@besplex.bde.org> <20170502144823.GH1622@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VbSHBBh9 c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=t0vv-wrxefp5Oj2dI0IA:9 a=LDhBBNh50KkugDdz:21 a=PFlbG7WVNzEJfU_R:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 15:31:15 -0000 On Tue, 2 May 2017, Konstantin Belousov wrote: > On Tue, May 02, 2017 at 11:31:21PM +1000, Bruce Evans wrote: >> On Tue, 2 May 2017, Konstantin Belousov wrote: >>> ENOMEM is, of course, the situation which I want to avoid. >> >> Then you have to return no error, but truncate the value instead of >> clamping. Anything else is incompatible. > I do not quite agree with the truncation part, bit I do not think that > it is too important. As I noted before, IMO the absolute numbers for > the counters have more values than per-interval diffs displayed by e.g. > systat. But if truncating causes less disagreement than clamping, lets > do truncation. This is better. I also thought of changing the scale when the values get high. The values would increase slower above about 2G instead of stabilizing at 4G-1. This is basically floating point and too complicated since nothing would understand it. Which counters wrap faster than a reasonable refresh interval of 1-10 seconds (which should be shorter if wrapping is a problem)? > diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c > index 5f4cd46ab1e..6266ef670a6 100644 > --- a/sys/vm/vm_meter.c > +++ b/sys/vm/vm_meter.c > @@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0, > "VM meter vm stats"); > SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats"); > > +static int > +sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS) > +{ > + uint64_t out; > +#ifdef COMPAT_FREEBSD11 > + uint32_t out32; > +#endif > + > + out = counter_u64_fetch(*(counter_u64_t *)arg1); > +#ifdef COMPAT_FREEBSD11 > + if (req->oldlen == sizeof(out32)) { > + out32 = (uint32_t)out; /* truncate */ Style: - redundant cast. Especially not needed with the commit. Compilers might warn about this since they don't trust programmers, but don't because implicit downwards conversions are used often. - comment not indented I would also omit the ifdefs, and rename 'out' to out64, and may rename 'out*' to val*. > + return (SYSCTL_OUT(req, &out32, sizeof(out32))); > + } > +#endif > + return (SYSCTL_OUT(req, &out, sizeof(out))); > +} > + > #define VM_STATS(parent, var, descr) \ > - SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, &vm_cnt.var, descr) > + SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \ > + CTLFLAG_RD, &vm_cnt.var, 0, sysctl_handle_vmstat, "QU", descr); > #define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) > #define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr) I just noticed that this sysctl is r/o (I thought I was preserving support for resetting 64-bit counters using a 32-bit size in my fix in sysctl_handle_counter_64(). That function has the dubious feature of not checking the size, so it allows writes of any length (0 to SIZE_MAX, possibly larger than the user data) to reset the counter to zero.) The r/o misfeature goes back to at least FreeBSD-3. 64-bit counters need resetting less than 32-bit ones, and it is more useful to ever reset them since they can hold the full counts since boot time, but there is no reason to limit resetting them now that the low-level code supports it. Is there already a better atomic reset of all vm stats? Bruce From owner-svn-src-head@freebsd.org Tue May 2 16:35:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6813BD5B7F7; Tue, 2 May 2017 16:35:28 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id F08DBC3B; Tue, 2 May 2017 16:35:27 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id BE3FED64D47; Wed, 3 May 2017 02:35:18 +1000 (AEST) Date: Wed, 3 May 2017 02:35:17 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317681 - head/share/man/man7 In-Reply-To: <201705021452.v42EqZSB010115@repo.freebsd.org> Message-ID: <20170503013818.F2099@besplex.bde.org> References: <201705021452.v42EqZSB010115@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VbSHBBh9 c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=RxVg6HnhAFfXALl6JzsA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 16:35:28 -0000 On Tue, 2 May 2017, Konstantin Belousov wrote: > Log: > Document time_t size. > > Modified: head/share/man/man7/arch.7 > ============================================================================== > --- head/share/man/man7/arch.7 Tue May 2 14:52:28 2017 (r317680) > +++ head/share/man/man7/arch.7 Tue May 2 14:52:35 2017 (r317681) > @@ -47,27 +47,27 @@ On all supported architectures, > .It float Ta 4 > .It double Ta 8 > .El > -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" > -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) > ... > +.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" > +.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) > +.It amd64 Ta 8 Ta 16 Ta 8 > +.It arm Ta 4 Ta 8 Ta 8 Verbose types mess up the formatting of man pages too. The header is obviously too long. -current man misformats it to 91 columns on 80-column terminals. FreeBSD-5 man respects COLUMNS, but mangles the header more completely to do this (1). -current man can't handle macros like "Sy" with -width or some other things including the things used above. This causes it to produce excessive column spacing. The formatting is bad enough without this (verbose headers but all columns except "Architecture" have only 1-2 digits). -current man just considers "Sy " as literal and increases the column spacing by 3, giving a spacing of 7 columns instead of 4, where we really want a negative number but 2 would work OK. Also, these Sy's have syntax errors. They really are literals, since they are not preceded by a dot. With -current man, dots would unimprove the formatting further by producing an extra column for each dot. Perhaps that is why it is already left out (it might break other lists). The syntax is something like ".Sy ... Architecture" where other macros in "..." don't need (and shouldn't have?) dots. Removing all 4 Sy's only reduces the column widths by 3*3, so the total width to 82. There is a different problem before the first collumn. The Sy's are already not present in the previous -column directive, and this might what causes different leading indentation for the previous list. But I didn't touch the Sy's in the later -column directions, and all the following first columns line up with this one. (1) gnu man/groff splits the long line in the middle of 'long double', long before the new problem with time_t. Before that, it produces the same wrong separation of 7 columns. It then prints a long line, with 87 blanks to misformat "double)" 1 line and 7 columns into the next (in the middle of nowhere under "Architecture"), then a further 7 columns to sizeof(time_t) in the middle of nowhere. It prints a diagnostic about not being able to split the long line. Gnu man/groff does understand .Sy, but treats Sy as literal. Changing the Sy's to .Sy's doesn't work any better than removing them in this list, but it improves all the other lists. The formatting for the first list can be fixed by changing '-indent' in it to 'indent' to match the other list. This [-]indent controls indentation in ways that I don't understand, but experiment shows that the '-' in it gives an unwanted extra column of indentation, and adding more minus signs gives more indentation. The minus sign is only used for the first list. We really want outdentation. I tried ++indent for that, but it gave the same indentation as --indent. Bruce From owner-svn-src-head@freebsd.org Tue May 2 17:07:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA153D5A333; Tue, 2 May 2017 17:07:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68B6769C; Tue, 2 May 2017 17:07:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v42H7Lcp040956 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 May 2017 20:07:21 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v42H7Lcp040956 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v42H7Lkh040955; Tue, 2 May 2017 20:07:21 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 2 May 2017 20:07:21 +0300 From: Konstantin Belousov To: Bruce Evans Cc: Alan Somers , Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs... Message-ID: <20170502170721.GI1622@kib.kiev.ua> References: <20170419130428.J956@besplex.bde.org> <20170430201324.GV1622@kib.kiev.ua> <20170501163725.U972@besplex.bde.org> <20170502095527.GB1622@kib.kiev.ua> <20170502203703.I1176@besplex.bde.org> <20170502121711.GE1622@kib.kiev.ua> <20170502223324.P1508@besplex.bde.org> <20170502144823.GH1622@kib.kiev.ua> <20170503005322.K1968@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170503005322.K1968@besplex.bde.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 17:07:28 -0000 On Wed, May 03, 2017 at 01:31:10AM +1000, Bruce Evans wrote: > > > On Tue, 2 May 2017, Konstantin Belousov wrote: > I also thought of changing the scale when the values get high. The values > would increase slower above about 2G instead of stabilizing at 4G-1. > This is basically floating point and too complicated since nothing would > understand it. > > Which counters wrap faster than a reasonable refresh interval of 1-10 > seconds (which should be shorter if wrapping is a problem)? Things like various counters for pages freed due to a reason can. E.g. freed due to the process exit is the counter which I saw changing fast. Wire counts might fluctuate relatively quickly, but I think that wiring is slower. Unwiring might be fast. > Style: > - redundant cast. Especially not needed with the commit. Compilers might > warn about this since they don't trust programmers, but don't because > implicit downwards conversions are used often. > - comment not indented > > I would also omit the ifdefs, and rename 'out' to out64, and may rename > 'out*' to val*. Ok. > I just noticed that this sysctl is r/o (I thought I was preserving support > for resetting 64-bit counters using a 32-bit size in my fix in > sysctl_handle_counter_64(). That function has the dubious feature of not > checking the size, so it allows writes of any length (0 to SIZE_MAX, > possibly larger than the user data) to reset the counter to zero.) > > The r/o misfeature goes back to at least FreeBSD-3. 64-bit counters need > resetting less than 32-bit ones, and it is more useful to ever reset them > since they can hold the full counts since boot time, but there is no reason > to limit resetting them now that the low-level code supports it. Is there > already a better atomic reset of all vm stats? I do not see why vmstat counters ever need to be reset. I do not think that truncating the value to present small values to 32bit readers is a reasonable cause. diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index 5f4cd46ab1e..b4666a400b2 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0, "VM meter vm stats"); SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats"); +static int +sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS) +{ + uint64_t val; +#ifdef COMPAT_FREEBSD11 + uint32_t val32; +#endif + + val = counter_u64_fetch(*(counter_u64_t *)arg1); +#ifdef COMPAT_FREEBSD11 + if (req->oldlen == sizeof(val32)) { + val32 = val; /* truncate */ + return (SYSCTL_OUT(req, &val32, sizeof(val32))); + } +#endif + return (SYSCTL_OUT(req, &val, sizeof(val))); +} + #define VM_STATS(parent, var, descr) \ - SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, &vm_cnt.var, descr) + SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \ + CTLFLAG_RD, &vm_cnt.var, 0, sysctl_handle_vmstat, "QU", descr); #define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) #define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr) From owner-svn-src-head@freebsd.org Tue May 2 17:16:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5FC5D5A599; Tue, 2 May 2017 17:16:25 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87EACC57; Tue, 2 May 2017 17:16:25 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42HGOXV069472; Tue, 2 May 2017 17:16:24 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42HGOBd069470; Tue, 2 May 2017 17:16:24 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201705021716.v42HGOBd069470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 2 May 2017 17:16:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317682 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 17:16:25 -0000 Author: ae Date: Tue May 2 17:16:24 2017 New Revision: 317682 URL: https://svnweb.freebsd.org/changeset/base/317682 Log: Add `ipfw table all destroy` support. PR: 212669 MFC after: 1 week Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/tables.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Tue May 2 14:52:35 2017 (r317681) +++ head/sbin/ipfw/ipfw.8 Tue May 2 17:16:24 2017 (r317682) @@ -50,7 +50,9 @@ in-kernel NAT. .Nm .Oo Cm set Ar N Oc Cm table Ar name Cm create Ar create-options .Nm -.Oo Cm set Ar N Oc Cm table Ar name Cm destroy +.Oo Cm set Ar N Oc Cm table +.Brq Ar name | all +.Cm destroy .Nm .Oo Cm set Ar N Oc Cm table Ar name Cm modify Ar modify-options .Nm Modified: head/sbin/ipfw/tables.c ============================================================================== --- head/sbin/ipfw/tables.c Tue May 2 14:52:35 2017 (r317681) +++ head/sbin/ipfw/tables.c Tue May 2 17:16:24 2017 (r317682) @@ -54,6 +54,7 @@ static int table_swap(ipfw_obj_header *o static int table_get_info(ipfw_obj_header *oh, ipfw_xtable_info *i); static int table_show_info(ipfw_xtable_info *i, void *arg); +static int table_destroy_one(ipfw_xtable_info *i, void *arg); static int table_flush_one(ipfw_xtable_info *i, void *arg); static int table_show_one(ipfw_xtable_info *i, void *arg); static int table_do_get_list(ipfw_xtable_info *i, ipfw_obj_header **poh); @@ -132,7 +133,7 @@ lookup_host (char *host, struct in_addr * This one handles all table-related commands * ipfw table NAME create ... * ipfw table NAME modify ... - * ipfw table NAME destroy + * ipfw table {NAME | all} destroy * ipfw table NAME swap NAME * ipfw table NAME lock * ipfw table NAME unlock @@ -200,6 +201,7 @@ ipfw_table_handler(int ac, char *av[]) case TOK_INFO: case TOK_DETAIL: case TOK_FLUSH: + case TOK_DESTROY: break; default: if (is_all != 0) @@ -223,13 +225,21 @@ ipfw_table_handler(int ac, char *av[]) table_modify(&oh, ac, av); break; case TOK_DESTROY: - if (table_destroy(&oh) == 0) - break; - if (errno != ESRCH) - err(EX_OSERR, "failed to destroy table %s", tablename); - /* ESRCH isn't fatal, warn if not quiet mode */ - if (co.do_quiet == 0) - warn("failed to destroy table %s", tablename); + if (is_all == 0) { + if (table_destroy(&oh) == 0) + break; + if (errno != ESRCH) + err(EX_OSERR, "failed to destroy table %s", + tablename); + /* ESRCH isn't fatal, warn if not quiet mode */ + if (co.do_quiet == 0) + warn("failed to destroy table %s", tablename); + } else { + error = tables_foreach(table_destroy_one, &oh, 1); + if (error != 0) + err(EX_OSERR, + "failed to destroy tables list"); + } break; case TOK_FLUSH: if (is_all == 0) { @@ -567,6 +577,22 @@ table_destroy(ipfw_obj_header *oh) return (0); } +static int +table_destroy_one(ipfw_xtable_info *i, void *arg) +{ + ipfw_obj_header *oh; + + oh = (ipfw_obj_header *)arg; + table_fill_ntlv(&oh->ntlv, i->tablename, i->set, 1); + if (table_destroy(oh) != 0) { + if (co.do_quiet == 0) + warn("failed to destroy table(%s) in set %u", + i->tablename, i->set); + return (-1); + } + return (0); +} + /* * Flushes given table specified by @oh->ntlv. * Returns 0 on success. From owner-svn-src-head@freebsd.org Tue May 2 17:32:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC1D3D5ABE2; Tue, 2 May 2017 17:32:32 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA409A0E; Tue, 2 May 2017 17:32:32 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x242.google.com with SMTP id s62so11969533pgc.0; Tue, 02 May 2017 10:32:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=qrzA7LL0kKxVkzxRH5qp/aWZ7epK/1gd4vwp22bPYNA=; b=BDCFQN1+8yGWuhtN4cp56aVeOqIYG3jYcdsohpulJ4cyt7uf+4+BOLvadgDGPwwvFU JWfv/NfZ6eRg0dShipFyCyjYmuStdVQTGzGTZK6MnNYM1tRZOdtY1oIuYhMNecmj6u67 h7pK2GFJiu4UInczLWlLS3Bk5lpq8iEDhm/NCaWFP1Sxtl8kZq/p3vHoJbs68ofHGgPn sQBB+xLE820FUnhZjkPPUaV7kL4j2HV6xKFyLYUNrrA1Hvo74C8pt9dA/VM3T7FEzJoD W2Du6gcIFdr8TmMoRsAoagyh5dJgRwN392q6LtU7Y5QNG1YYNU9pgeEy5KIkGeDenTxF GR/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=qrzA7LL0kKxVkzxRH5qp/aWZ7epK/1gd4vwp22bPYNA=; b=bxcwVfuduygB29ZaalIbpf9gqIaHKhBPFUkT+Q1fwFvOdvVrCXVcD87h1M4VpdUGSA TPSfRdy/2wkbcxhcN+rCv97Zf8XyfeQ0FNqX8crgNy4NOwG6ZI8lGuyuPx9sifxUUn1p iHTqYKsIgj/l7PIK4Uld96Zhhg3sE5NS0b0OaE7McC/2dMvWRpuvKjyj07EgHZzdoVkh gapj6QL2kqgtdtkSJsXEXHgFcHwCg7dyYBdIkSYjOIYnFyJPhxBJj+rnRrJpaVDNb/TT Do1ra99epa7xsm+0tB9tIh6tocTnQzgo0JtqV+r9EMECbybZ7LMfaJ6fZ8LmByx0Y8yM FcDw== X-Gm-Message-State: AN3rC/4FFnHpLDwIvl3VwCMFVPVeyrwPVy4Vf42zVDgoP7Da3durjB7o 8BNRirhr5YR9/HMim3E= X-Received: by 10.84.231.136 with SMTP id g8mr42766739plk.12.1493746352086; Tue, 02 May 2017 10:32:32 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id c83sm58709pfd.113.2017.05.02.10.32.31 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 May 2017 10:32:31 -0700 (PDT) Subject: Re: svn commit: r317631 - head/sys Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_2B7E30A1-8EAE-4803-8DDD-81FDD9E9D061"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201705011628.v41GSj5b090808@pdx.rh.CN85.dnsmgr.net> Date: Tue, 2 May 2017 10:32:29 -0700 Cc: Ngie Cooper , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <22AB91F2-131C-497A-A490-94D8DBD8B221@gmail.com> References: <201705011628.v41GSj5b090808@pdx.rh.CN85.dnsmgr.net> To: rgrimes@freebsd.org X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 17:32:33 -0000 --Apple-Mail=_2B7E30A1-8EAE-4803-8DDD-81FDD9E9D061 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 1, 2017, at 09:28, Rodney W. Grimes = wrote: >=20 >> Author: ngie >> Date: Mon May 1 05:54:33 2017 >> New Revision: 317631 >> URL: https://svnweb.freebsd.org/changeset/base/317631 >>=20 >> Log: >> Fix "make cscope" after r317411 >=20 > This commit is disconnect netnatm module from build >=20 > ? Mixed 2 commit messages perhaps? No, it was intentional (I made the readers read between the = lines as to why this commit was necessary, so mea culpa). r317411 removed sys/netatm, which broke the =E2=80=9Cmake = cscope=E2=80=9D target, as it tried to iterate down that directory with = find and failed. Thanks! -Ngie $ svn log -c r317411 ------------------------------------------------------------------------ r317411 | brooks | 2017-04-25 10:00:08 -0700 (Tue, 25 Apr 2017) | 4 = lines Remove directories made empty by NATM, EISA, and IEEE488 removals. Reported by: ak = =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80= =94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2= =80=94=E2=80=94=E2=80=94 $ svn diff -c r317411 --summarize D sbin/atm/atmconfig D sbin/atm D sys/netnatm D sys/dev/eisa D sys/dev/fatm D sys/dev/hatm D sys/dev/patm/genrtab D sys/dev/patm D sys/dev/ahb D sys/dev/ieee488 D sys/dev/en D sys/dev/utopia D sys/modules/fatm D sys/modules/hatm D sys/modules/patm D sys/modules/ahb D sys/modules/en D sys/modules/utopia D sys/modules/aic7xxx/ahc/ahc_eisa D sys/modules/netgraph/atm/atm D usr.sbin/bsnmpd/modules/snmp_atm --Apple-Mail=_2B7E30A1-8EAE-4803-8DDD-81FDD9E9D061 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZCMKuAAoJEPWDqSZpMIYVGFMP/1DMKLO3EYxcjvNQIJreryTg pZVRYZUplNw60tzQ4XUIU/sqP4z+dX4s+EoieWQFtoxTb9thckhA+S9Olk8oEvNx grJ0BxjMJsZtnsYI40g7wSXT5iexwwYfFRk2UrtvgliVGvro0z7rMio6PleQi2kQ PtuVQXfS+NFv+1XqVFVS8F/QcleNowJD5ChwsJ3jXbiaZhkryu8Nh332iNJIcbNO AnjPTKZSFsNfgmocBbFsPR93B7R8iAkjbRu+CRImlAgC0a5ESviFDXCHqTAfM8mu px0fg6qSNsaqoP9YzqKUL4v12DSUm9I81Nnp0j/lGu+ahhSr7NvK+betPGDoeUlB boIj9/cU+J+Ncw/kKgWnCJOnGRWamLQCaatfQY6ZqTd64w9RX6dBG/0sqj6TjibK Wi44tyerrozop24syl5j/wmomdZBRxPtKbo6ik0Nhq9zWljja+hLD3GD7e5qrmcn nt4MAF8IHiWY/HdWBB33Acqcykdb7q7nE2Cy9PVh6MN7/cGBUQaBpwFGVP+8nMvG cKukh4TQ2CwxSBP+lgYOO7NQHt1oiWAolmrqiP4g4tM3So6IsD45AylHUizkJMZo Xpupasu60zS4eG0KO45kuj5JJQ31ECRG8og+knXkxxiLtU5PeDy5A8a7O5g0+zOb lVoybJOAoTqI6SIEejTj =xGNV -----END PGP SIGNATURE----- --Apple-Mail=_2B7E30A1-8EAE-4803-8DDD-81FDD9E9D061-- From owner-svn-src-head@freebsd.org Tue May 2 17:40:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20E3BD5AE28; Tue, 2 May 2017 17:40:31 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E019FE5C; Tue, 2 May 2017 17:40:30 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x243.google.com with SMTP id v1so23639623pgv.3; Tue, 02 May 2017 10:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=qP1/jB7RwqT6E0ZVS9859amI+i3X1XFwL+kRdtUueTg=; b=OA8/QlBiRJWOf+se+HfN1/i9tmVTI8jcqvyS3OIk3ZrrvxaR8gvJRfJY8PkMA4ABOk nYU2ZhVZai2EonA069ysJTqFj8JbtowEMGOUJATiu4JEHlsInz5U6mZX0j9h1oKZ5CB9 hRDYPprD3J3nU4Q4G1NhfMOMUrQaweTKT4xSNHHmicsute6tyV2nvGMQgQca24JNrUkZ Tz9Q/MCTWsWjbRTTPxEuNpfTXNP0KyBmHSeifs5P5klcMXABnm+HRdVPZwMAyCtrXnVg u6ztrp36+LJi2/vfMzI6zq63yW2ifGZ4jq8bYDdMS86LCGF+wm6Cif60FfV0RpB9vplm xc6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=qP1/jB7RwqT6E0ZVS9859amI+i3X1XFwL+kRdtUueTg=; b=eMxDxDO+JfE4QV/Y/LHK4+c40ocxcV9KZE5K4ML8rlaT+MXJnHO3qLZC/djLG8pSE/ +jQp7vkz0dHmMjKTgveGgfHbbMwApTTSSC2oI5y8M0xWUu0JvIBM61LgIDOHxUg7o7eT GwC66ssZjxuBeV5m38fPdJZx7DT7SlT/77uqTPG5NYEAg/Y9z4SclHheWwfIzfdGhi+8 TDD2odRgctbZWNKQ7rDasikrkPUC2byU3Xfqeu05IQgB6UzH8HXLPasaGxEGQmB+KA4T hJu4CQPCfcy9DLtWeimNn18RbvwrBb1VCi1KbWTj5/tcHTE4MyARDh/cq1t0SzaPG87R 8MOQ== X-Gm-Message-State: AN3rC/6ARENuA+VtOgSi5fxRBCwMYCMcOB228+kVmDR+ERTkR1VSFbNQ bwjTr5Qft8eO3g== X-Received: by 10.98.155.206 with SMTP id e75mr229485pfk.24.1493746830388; Tue, 02 May 2017 10:40:30 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id a190sm30502790pgc.60.2017.05.02.10.40.28 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 May 2017 10:40:29 -0700 (PDT) Subject: Re: svn commit: r317632 - head/sys Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/signed; boundary="Apple-Mail=_CA59FF78-3F84-4AB5-9B21-5F4C75A7EB05"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail From: "Ngie Cooper (yaneurabeya)" In-Reply-To: Date: Tue, 2 May 2017 10:40:28 -0700 Cc: "Rodney W. Grimes" , Ngie Cooper , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-Id: <17C74380-374C-40A8-A3C4-0401D32E9A06@gmail.com> References: <201705010559.v415xqx2085699@repo.freebsd.org> <201705011630.v41GUfVV090824@pdx.rh.CN85.dnsmgr.net> To: Warner Losh X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 17:40:31 -0000 --Apple-Mail=_CA59FF78-3F84-4AB5-9B21-5F4C75A7EB05 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 1, 2017, at 09:34, Warner Losh wrote: >=20 > On Mon, May 1, 2017 at 10:30 AM, Rodney W. Grimes > wrote: >>> Author: ngie >>> Date: Mon May 1 05:59:52 2017 >>> New Revision: 317632 >>> URL: https://svnweb.freebsd.org/changeset/base/317632 >>>=20 >>> Log: >>> Fix "make cscope-clean" when .OBJDIR already exists >>>=20 >>> The cscope generated files are always put in .CURDIR . >>=20 >> If this is writing to src dir then it should be fixed, >> or have we abandoned all hope of readonly src tree? >=20 > This is only for the cscope target, which isn't part of the normal = build. >=20 > readonly src tree works great still=E2=80=A6. Hi Rod, I can=E2=80=99t personally vouch for readonly src trees working = in all cases, but readonly src trees work well for installation purposes = (I use readonly obj and src trees at work when installing over NFS). As Warner noted, =E2=80=9Cmake cscope=E2=80=9D is a developer = target that aids with building the cscope database in a consistent = manner. It doesn=E2=80=99t conform to the existing =E2=80=9Cnorms=E2=80=9D= of build targets in the tree; changing the behavior doesn=E2=80=99t = seem prudent at this point in time because it would violate POLA. Thanks! -Ngie --Apple-Mail=_CA59FF78-3F84-4AB5-9B21-5F4C75A7EB05 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJZCMSMAAoJEPWDqSZpMIYVZW8P+wYGhwukc0EkRcScm/cLo8J4 WP9BRc1hzoYnsK1O55yMlBh6nWcC5BCDrJ7BwPdrXmE5xZnF0DwSvzXDlzEkFE/N ZdWFJcYNnnH0fvMOHmvem0n3UJmJ8V0S3zffodIm3Y6Wt7P/cQ+b9Gc3oLfsK2gI Ia5RaU86WCi8jmn3zs9IAJI5JhutvWJZzxI3mltlhVQocgvq7ScAEsCcUrQ6XJOk 5FVfnZrkXbvmrdp5DcHC5UjOt3bSbWcTV4ZrG584u+H9N+LIKl8q0Hh+GmkFkDH7 VSeeUxFhXzfDqbGU2IZsFM3FlIs/gwPhDHf6b14apGnd7BgVLA9YG0DWiUiN3mgz tcvWGZ1z4pASsuztRY3+4nbr4fSqSpIe9WskExEbwb799E7RBWVGAbocSEpY6JLu siUTZPqZ4JI6/cKQ1elE0lrOktiMv8xUauMGrW1OD+VPrGbWUSuZ2t8CBcQnyspX vC2gwxXLsna6FnW4Zt63R+lTxk3ylA10Z5j/OIkZV+ahkBYau1Kgrp+z3y8rDrIc rM4okOX6V2e0/KTuq9z9GNOrCHA/SR5Wgd3/L8zu02gfbHXe4KaLeGj8SZ7BOFdb zB3EflUxcGYksB0O8/T1xm+mBeSPd/RKHiGUkz+NslGy1VimCeIjbQfSaZ47MFoW bndcMAb88saO5aTXtLgo =HMqn -----END PGP SIGNATURE----- --Apple-Mail=_CA59FF78-3F84-4AB5-9B21-5F4C75A7EB05-- From owner-svn-src-head@freebsd.org Tue May 2 17:45:05 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8B2BD5B0F2; Tue, 2 May 2017 17:45:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FE801310; Tue, 2 May 2017 17:45:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v42HitHB048802 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 May 2017 20:44:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v42HitHB048802 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v42Hit3M048801; Tue, 2 May 2017 20:44:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 2 May 2017 20:44:55 +0300 From: Konstantin Belousov To: Bruce Evans Cc: emaste@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317681 - head/share/man/man7 Message-ID: <20170502174455.GJ1622@kib.kiev.ua> References: <201705021452.v42EqZSB010115@repo.freebsd.org> <20170503013818.F2099@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170503013818.F2099@besplex.bde.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 17:45:06 -0000 On Wed, May 03, 2017 at 02:35:17AM +1000, Bruce Evans wrote: > On Tue, 2 May 2017, Konstantin Belousov wrote: > > > Log: > > Document time_t size. > > > > Modified: head/share/man/man7/arch.7 > > ============================================================================== > > --- head/share/man/man7/arch.7 Tue May 2 14:52:28 2017 (r317680) > > +++ head/share/man/man7/arch.7 Tue May 2 14:52:35 2017 (r317681) > > @@ -47,27 +47,27 @@ On all supported architectures, > > .It float Ta 4 > > .It double Ta 8 > > .El > > -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" > > -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) > > ... > > +.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" > > +.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) > > +.It amd64 Ta 8 Ta 16 Ta 8 > > +.It arm Ta 4 Ta 8 Ta 8 > > Verbose types mess up the formatting of man pages too. > > The header is obviously too long. -current man misformats it to 91 columns > on 80-column terminals. FreeBSD-5 man respects COLUMNS, but mangles the > header more completely to do this (1). I removed excessive sizeof(), which fixed width. diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 index 1ce397a303e..73552d60209 100644 --- a/share/man/man7/arch.7 +++ b/share/man/man7/arch.7 @@ -47,8 +47,10 @@ On all supported architectures, .It float Ta 4 .It double Ta 8 .El -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) +.Pp +Machine-depended type's sizes: +.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t" +.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t .It amd64 Ta 8 Ta 16 Ta 8 .It arm Ta 4 Ta 8 Ta 8 .It armeb Ta 4 Ta 8 Ta 8 From owner-svn-src-head@freebsd.org Tue May 2 17:47:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25B2BD5B190; Tue, 2 May 2017 17:47:50 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id AE9561507; Tue, 2 May 2017 17:47:48 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 85FD3D43E1A; Wed, 3 May 2017 03:47:41 +1000 (AEST) Date: Wed, 3 May 2017 03:47:37 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , Alan Somers , Gleb Smirnoff , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317061 - in head: libexec/rpc.rstatd sys/amd64/amd64 sys/amd64/include sys/arm/arm sys/arm/include sys/arm64/include sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/compat/linprocfs... In-Reply-To: <20170502170721.GI1622@kib.kiev.ua> Message-ID: <20170503032643.K2791@besplex.bde.org> References: <20170419130428.J956@besplex.bde.org> <20170430201324.GV1622@kib.kiev.ua> <20170501163725.U972@besplex.bde.org> <20170502095527.GB1622@kib.kiev.ua> <20170502203703.I1176@besplex.bde.org> <20170502121711.GE1622@kib.kiev.ua> <20170502223324.P1508@besplex.bde.org> <20170502144823.GH1622@kib.kiev.ua> <20170503005322.K1968@besplex.bde.org> <20170502170721.GI1622@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=rddVpAsjNRg6FjyyaoQA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 17:47:50 -0000 On Tue, 2 May 2017, Konstantin Belousov wrote: > On Wed, May 03, 2017 at 01:31:10AM +1000, Bruce Evans wrote: >> >> >> On Tue, 2 May 2017, Konstantin Belousov wrote: >> I also thought of changing the scale when the values get high. The values >> would increase slower above about 2G instead of stabilizing at 4G-1. >> This is basically floating point and too complicated since nothing would >> understand it. >> >> Which counters wrap faster than a reasonable refresh interval of 1-10 >> seconds (which should be shorter if wrapping is a problem)? > Things like various counters for pages freed due to a reason can. E.g. > freed due to the process exit is the counter which I saw changing fast. 4 billion page operations/second or 10 is impossible. It is difficult to even increment a register to count events that fast. > Wire counts might fluctuate relatively quickly, but I think that wiring > is slower. Unwiring might be fast. The need to zero pages before reuse limits the speed. >> I just noticed that this sysctl is r/o (I thought I was preserving support >> for resetting 64-bit counters using a 32-bit size in my fix in >> sysctl_handle_counter_64(). That function has the dubious feature of not >> checking the size, so it allows writes of any length (0 to SIZE_MAX, >> possibly larger than the user data) to reset the counter to zero.) >> >> The r/o misfeature goes back to at least FreeBSD-3. 64-bit counters need >> resetting less than 32-bit ones, and it is more useful to ever reset them >> since they can hold the full counts since boot time, but there is no reason >> to limit resetting them now that the low-level code supports it. Is there >> already a better atomic reset of all vm stats? > > I do not see why vmstat counters ever need to be reset. I do not think > that truncating the value to present small values to 32bit readers is > a reasonable cause. It would be mostly for presenting a consistent set of values. > diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c > index 5f4cd46ab1e..b4666a400b2 100644 > --- a/sys/vm/vm_meter.c > +++ b/sys/vm/vm_meter.c > @@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0, > "VM meter vm stats"); > SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats"); > > +static int > +sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS) > +{ > + uint64_t val; > +#ifdef COMPAT_FREEBSD11 > + uint32_t val32; > +#endif > + > + val = counter_u64_fetch(*(counter_u64_t *)arg1); > +#ifdef COMPAT_FREEBSD11 > + if (req->oldlen == sizeof(val32)) { > + val32 = val; /* truncate */ > + return (SYSCTL_OUT(req, &val32, sizeof(val32))); > + } > +#endif > + return (SYSCTL_OUT(req, &val, sizeof(val))); > +} > + > #define VM_STATS(parent, var, descr) \ > - SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, &vm_cnt.var, descr) > + SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \ > + CTLFLAG_RD, &vm_cnt.var, 0, sysctl_handle_vmstat, "QU", descr); > #define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) > #define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr) OK. Bruce From owner-svn-src-head@freebsd.org Tue May 2 18:04:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6C5DD5B6F9; Tue, 2 May 2017 18:04:31 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x231.google.com (mail-io0-x231.google.com [IPv6:2607:f8b0:4001:c06::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5ACD31A5; Tue, 2 May 2017 18:04:31 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x231.google.com with SMTP id o22so38186527iod.0; Tue, 02 May 2017 11:04:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=2UMghvtxkLR190uYsl7PDyQUeatN+DpeKrnR2wFw5kw=; b=qv+VBM4L7RxodCe1UPlmLqljH1XFyGGA1TqZjN/o2viLGeBaV1KOI0pVt6Of10WVD0 MJk7DmHecH/W8Y8l2srrM2qCSWH6tEeQdv1dtg+/Mkg1+0iXvECUPmJIR6StKDctAgRl BF+fEFyKuaYCejo8CK0AxvLOuOKtN9Mc1kk5AMQasNNUPxtodj8AvWfW4Co/kcBGSLw3 6vxeoA3IbXS3ZVTyVl5xoQr+34/fM6ZdpSnwLKg1Z5yMk/Q3L2eRigmlBDC2e9XnfCjD nrIxZU1r9CPbEsE5g3nfl8C0IIGuRmPhX5TsAM1b+l6AfNaMV/X0c0hb8jVcWvmE/jr5 dM2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=2UMghvtxkLR190uYsl7PDyQUeatN+DpeKrnR2wFw5kw=; b=COFfJmO9JBdu6nCcoyPet2cPz8b2jwXMT4byOSLRmFsCf01rD5Oy/Emj+ylozEpZPT 60nIlavJ13WjBN/NFaEH14SSISSsPDo5BsHcf+DuFJ9pGSVaSbsRUt70cuciIx564q6Q V+LJRQwm8BUzoIuZ6brwV4nZseLhycbPD2JO1HPkVeZTm5c5tzPHQbDk5Gp1EIS9H3vO 5mG3WR3p+Tkucdcmqk2Eex2QEBX6lyXjpqAJeMPiB+2t9GwxAP+Be7DolEzpRNAqtfn4 q9b2mIaRukRfm23m8wbLzoy0OeNgkt7nkEQL0wzb3y/vl+I89s2+VCRKFLxRnVmncIvL 3rfQ== X-Gm-Message-State: AN3rC/7H0S8SJGLq2GMJifY5yyF2Y/y0vE7F4N8Hgsry/aqnuUA9OX3B XStAi5aXvUrNfDX14lD8O8+aELGifQ== X-Received: by 10.107.167.19 with SMTP id q19mr14347133ioe.110.1493748270675; Tue, 02 May 2017 11:04:30 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.30.136 with HTTP; Tue, 2 May 2017 11:04:09 -0700 (PDT) In-Reply-To: <20170503013818.F2099@besplex.bde.org> References: <201705021452.v42EqZSB010115@repo.freebsd.org> <20170503013818.F2099@besplex.bde.org> From: Ed Maste Date: Tue, 2 May 2017 14:04:09 -0400 X-Google-Sender-Auth: mp5bMj_ohBERHk4zya_ii9QvSqI Message-ID: Subject: Re: svn commit: r317681 - head/share/man/man7 To: Bruce Evans Cc: Konstantin Belousov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 18:04:31 -0000 On 2 May 2017 at 12:35, Bruce Evans wrote: > > -current man can't handle macros like "Sy" with -width or some other > things including the things used above. This causes it to produce > excessive column spacing. The formatting is bad enough without this > (verbose headers but all columns except "Architecture" have only 1-2 > digits). -current man just considers "Sy " as literal and increases > the column spacing by 3, giving a spacing of 7 columns instead of 4, > where we really want a negative number but 2 would work OK. We discussed this in review D7261. I created arch.7 with ".Sy based on an example from FreeBSD 10's mdoc(7). In D7261 I noted that there were existing man pages with both ".Sy and "Sy . Do you believe we should remove them altogether? On 2 May 2017 at 13:44, Konstantin Belousov wrote: > > I removed excessive sizeof(), which fixed width. > > diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 > index 1ce397a303e..73552d60209 100644 > --- a/share/man/man7/arch.7 > +++ b/share/man/man7/arch.7 > @@ -47,8 +47,10 @@ On all supported architectures, > .It float Ta 4 > .It double Ta 8 > .El > -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" > -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) > +.Pp > +Machine-depended type's sizes: Probably "Machine-dependent type sizes" From owner-svn-src-head@freebsd.org Tue May 2 18:35:54 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 103ABD5A293; Tue, 2 May 2017 18:35:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7DC061433; Tue, 2 May 2017 18:35:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v42IZhns060608 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 May 2017 21:35:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v42IZhns060608 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v42IZg6I060606; Tue, 2 May 2017 21:35:42 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 2 May 2017 21:35:42 +0300 From: Konstantin Belousov To: Ed Maste Cc: Bruce Evans , Konstantin Belousov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317681 - head/share/man/man7 Message-ID: <20170502183542.GK1622@kib.kiev.ua> References: <201705021452.v42EqZSB010115@repo.freebsd.org> <20170503013818.F2099@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 18:35:54 -0000 On Tue, May 02, 2017 at 02:04:09PM -0400, Ed Maste wrote: > > +Machine-depended type's sizes: > > Probably "Machine-dependent type sizes" Sure. diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 index 1ce397a303e..f30dfbb8145 100644 --- a/share/man/man7/arch.7 +++ b/share/man/man7/arch.7 @@ -47,8 +47,10 @@ On all supported architectures, .It float Ta 4 .It double Ta 8 .El -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) +.Pp +Machine-dependent type sizes: +.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t" +.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t .It amd64 Ta 8 Ta 16 Ta 8 .It arm Ta 4 Ta 8 Ta 8 .It armeb Ta 4 Ta 8 Ta 8 From owner-svn-src-head@freebsd.org Tue May 2 18:37:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0F37D5A329; Tue, 2 May 2017 18:37:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8036115ED; Tue, 2 May 2017 18:37:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42IbBsb003350; Tue, 2 May 2017 18:37:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42IbBbi003349; Tue, 2 May 2017 18:37:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705021837.v42IbBbi003349@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 May 2017 18:37:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317694 - head/contrib/netbsd-tests/usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 18:37:12 -0000 Author: emaste Date: Tue May 2 18:37:11 2017 New Revision: 317694 URL: https://svnweb.freebsd.org/changeset/base/317694 Log: bsdgrep: revise test case which will soon become a failure Work in progress (D10315) is going to make egrep_empty_invalid an actually invalid regex, to be consistent with the equivalent BRE "{" behavior, when using regex(3). Any non-0 exit value is acceptable, depending on how the installed grep interprets the expression. GNU grep interprets it as non-matching, and in the future BSD grep will interpret it is an error. Submitted by: Kyle Evans Reviewed by: cem, ngie Differential Revision: https://reviews.freebsd.org/D10572` Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Tue May 2 18:31:26 2017 (r317693) +++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Tue May 2 18:37:11 2017 (r317694) @@ -369,7 +369,7 @@ egrep_empty_invalid_head() } egrep_empty_invalid_body() { - atf_check -s exit:1 egrep '{' /dev/null + atf_check -e ignore -s not-exit:0 egrep '{' /dev/null } atf_test_case zerolen From owner-svn-src-head@freebsd.org Tue May 2 18:40:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B467ED5A5A5; Tue, 2 May 2017 18:40:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 851D417E0; Tue, 2 May 2017 18:40:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42Ief0K003550; Tue, 2 May 2017 18:40:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42Ief5R003549; Tue, 2 May 2017 18:40:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201705021840.v42Ief5R003549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 2 May 2017 18:40:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317695 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 18:40:42 -0000 Author: kib Date: Tue May 2 18:40:41 2017 New Revision: 317695 URL: https://svnweb.freebsd.org/changeset/base/317695 Log: Emulate pre-r317061 ABI. This restores 32bit-sized accesses to vmcnt sysctls, making old binaries like top(1), systat(8) and reboot(8) mostly functional on newer kernel. Reviewed by: bde Sponsored by: The FreeBSD Foundation Modified: head/sys/vm/vm_meter.c Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Tue May 2 18:37:11 2017 (r317694) +++ head/sys/vm/vm_meter.c Tue May 2 18:40:41 2017 (r317695) @@ -266,8 +266,27 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, "VM meter vm stats"); SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats"); +static int +sysctl_handle_vmstat(SYSCTL_HANDLER_ARGS) +{ + uint64_t val; +#ifdef COMPAT_FREEBSD11 + uint32_t val32; +#endif + + val = counter_u64_fetch(*(counter_u64_t *)arg1); +#ifdef COMPAT_FREEBSD11 + if (req->oldlen == sizeof(val32)) { + val32 = val; /* truncate */ + return (SYSCTL_OUT(req, &val32, sizeof(val32))); + } +#endif + return (SYSCTL_OUT(req, &val, sizeof(val))); +} + #define VM_STATS(parent, var, descr) \ - SYSCTL_COUNTER_U64(parent, OID_AUTO, var, CTLFLAG_RD, &vm_cnt.var, descr) + SYSCTL_OID(parent, OID_AUTO, var, CTLTYPE_U64 | CTLFLAG_MPSAFE | \ + CTLFLAG_RD, &vm_cnt.var, 0, sysctl_handle_vmstat, "QU", descr); #define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) #define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr) From owner-svn-src-head@freebsd.org Tue May 2 18:41:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E9B3D5A63C; Tue, 2 May 2017 18:41:55 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id F15BE1B93; Tue, 2 May 2017 18:41:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 6365542A56B; Wed, 3 May 2017 04:41:53 +1000 (AEST) Date: Wed, 3 May 2017 04:41:52 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , emaste@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317681 - head/share/man/man7 In-Reply-To: <20170502174455.GJ1622@kib.kiev.ua> Message-ID: <20170503035045.Q2870@besplex.bde.org> References: <201705021452.v42EqZSB010115@repo.freebsd.org> <20170503013818.F2099@besplex.bde.org> <20170502174455.GJ1622@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=AYLBJzfG c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=Djy7nJjW-yCcCk350V0A:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 18:41:55 -0000 On Tue, 2 May 2017, Konstantin Belousov wrote: > On Wed, May 03, 2017 at 02:35:17AM +1000, Bruce Evans wrote: >> On Tue, 2 May 2017, Konstantin Belousov wrote: >> >>> Log: >>> Document time_t size. >>> >>> Modified: head/share/man/man7/arch.7 >>> ============================================================================== >>> --- head/share/man/man7/arch.7 Tue May 2 14:52:28 2017 (r317680) >>> +++ head/share/man/man7/arch.7 Tue May 2 14:52:35 2017 (r317681) >>> @@ -47,27 +47,27 @@ On all supported architectures, >>> .It float Ta 4 >>> .It double Ta 8 >>> .El >>> -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" >>> -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) >>> ... >>> +.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" >>> +.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) >>> +.It amd64 Ta 8 Ta 16 Ta 8 >>> +.It arm Ta 4 Ta 8 Ta 8 >> >> Verbose types mess up the formatting of man pages too. >> >> The header is obviously too long. -current man misformats it to 91 columns >> on 80-column terminals. FreeBSD-5 man respects COLUMNS, but mangles the >> header more completely to do this (1). > > I removed excessive sizeof(), which fixed width. Hmm. It leaves no mention of the scale. More below. > diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 > index 1ce397a303e..73552d60209 100644 > --- a/share/man/man7/arch.7 > +++ b/share/man/man7/arch.7 > @@ -47,8 +47,10 @@ On all supported architectures, > .It float Ta 4 > .It double Ta 8 > .El > -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" > -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) > +.Pp > +Machine-depended type's sizes: > +.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t" > +.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t Remove the buggy Sy's too. > .It amd64 Ta 8 Ta 16 Ta 8 > .It arm Ta 4 Ta 8 Ta 8 > .It armeb Ta 4 Ta 8 Ta 8 It would be good to mention that the type of time_t is signed somewhere. There is a whole column for the signedess of char in another table. Signedness can be given consisely using some markup like -8 or 8- for signed. The scale (often bytes or bits) could be given similarly. E.g, 8-B could mean signed 8 bits and 80.b could mean 80 bits floating pint. The Page Size table says "Page Sizes" redundantly in 1 column but doesn't gives units, and depends on everyone knowing that 4K is real K and bytes. The Floating Point table already doesn't say "sizeof()" in the header but gives a lot of details including units in some cases in the values. The long double in the table that you changed would be better placed in the FP table, except it is short of space too. The size info for a long double on {amd64,i386} is in 2 tables in different incomplete forms: - first table gives sizes {16, 12} with no mention of either sizes or units; these are object sizes in bytes - second table gives values {80, 80} with no mention of sizes but mention of bits; these are the unpadded object/register sizes (not really available in C), expressed in different units. This column in the table is mostly about the precision. It says "double precision" in some places, "identical to double" in others, and "quad precision" for arm64 and sparc64 ("hard" for sparc64 is broken. sparc64 can have either, but the default is soft since hard it is rearely or never implemented in hardware and is emulated even more slowly by doing it softly in trap handlers). The 80's for amd64 and i386 are don't give the precision like the others. The precision is 64 bits, and the 80-bit size is not really available in C. Better table entries would be something like (hard | soft), (8 | 10 | 12 | 16) bytes, (53 | 64 | 113) bit precision or for the longest case "hard, 16 bytes, 113 bit precision". There is just enough space for this after removing the Sy's. I don't like the duplication in this. So better go back to "identical to double" where it applies, and apply it more. Double is described as just hard or soft with no mention that the precision is always 53 bits (this should be in the ealier table of MI sizes). Long double is then the same on some arches. arm64 doesn't have an _fpmath.h for it in libc, so I don't see how it can have the soft quad precision claimed in the table. Similarly in msun/arm/Makefile.inc. riscv has an _fpmath.h stating quad precision, but isn't in any table in arch.7. This _fpmath.h seems quite buggy, with inconsistent commenting out and macros not matching the struct, so I don't see how it can work either. msun/riscv/Makefile.inc claims 113 bits, and the struct is consistent with this, but the macros consistent with this are commented out, so I don't see how it can compile. aarch64 is like riscv except its _fpmath.h seems to be correct. Bruce From owner-svn-src-head@freebsd.org Tue May 2 18:54:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F74DD5A885; Tue, 2 May 2017 18:54:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 46C14289; Tue, 2 May 2017 18:54:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id A018AD48B68; Wed, 3 May 2017 04:54:17 +1000 (AEST) Date: Wed, 3 May 2017 04:54:16 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Maste cc: Bruce Evans , Konstantin Belousov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317681 - head/share/man/man7 In-Reply-To: Message-ID: <20170503044547.N3070@besplex.bde.org> References: <201705021452.v42EqZSB010115@repo.freebsd.org> <20170503013818.F2099@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=1Dp2HpvB65-dm67t7doA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 18:54:21 -0000 On Tue, 2 May 2017, Ed Maste wrote: > On 2 May 2017 at 12:35, Bruce Evans wrote: >> >> -current man can't handle macros like "Sy" with -width or some other >> things including the things used above. This causes it to produce >> excessive column spacing. The formatting is bad enough without this >> (verbose headers but all columns except "Architecture" have only 1-2 >> digits). -current man just considers "Sy " as literal and increases >> the column spacing by 3, giving a spacing of 7 columns instead of 4, >> where we really want a negative number but 2 would work OK. > > We discussed this in review D7261. I created arch.7 with ".Sy based on > an example from FreeBSD 10's mdoc(7). In D7261 I noted that there were > existing man pages with both ".Sy and "Sy . All examples in at least FreeBSD-5's mdoc(7) use ".Sy" if it is the first macro in a ``subsection''. "Sy" is used more often but not as the first macro. Typically after '.It'. > Do you believe we should remove them altogether? I think you mean "all of them in .Bl and similar macros". I don't like removing features that once worked. Someone might be using them. I only noticed that I was using this one when it stopped working :-). Bruce From owner-svn-src-head@freebsd.org Tue May 2 19:09:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 209C5D5AD7A; Tue, 2 May 2017 19:09:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E143EECB; Tue, 2 May 2017 19:09:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42J9Blh016483; Tue, 2 May 2017 19:09:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42J9BoK016481; Tue, 2 May 2017 19:09:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705021909.v42J9BoK016481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 2 May 2017 19:09:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317696 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 19:09:13 -0000 Author: mav Date: Tue May 2 19:09:11 2017 New Revision: 317696 URL: https://svnweb.freebsd.org/changeset/base/317696 Log: Introduce sleepable locks into if_lagg. Before this change if_lagg was using nonsleepable rmlocks to protect its internal state. This patch introduces another sx lock to protect code paths that require sleeping, while still uses old rmlock to protect hot nonsleepable data paths. This change allows to remove taskqueue decoupling used before to change interface addresses without holding the lock. Instead it uses sx lock to protect direct if_ioctl() calls. As another bonus, the new code synchronizes enabled capabilities of member interfaces, and allows to control them with ifconfig laggX, that was impossible before. This part should fix interoperation with if_bridge, that may need to disable some capabilities, such as TXCSUM or LRO, to allow bridging with noncapable interfaces. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D10514 Modified: head/sys/net/if_lagg.c head/sys/net/if_lagg.h Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Tue May 2 18:40:41 2017 (r317695) +++ head/sys/net/if_lagg.c Tue May 2 19:09:11 2017 (r317696) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -99,10 +100,7 @@ static VNET_DEFINE(struct if_clone *, la #define V_lagg_cloner VNET(lagg_cloner) static const char laggname[] = "lagg"; -static void lagg_lladdr(struct lagg_softc *, uint8_t *); static void lagg_capabilities(struct lagg_softc *); -static void lagg_port_lladdr(struct lagg_port *, uint8_t *, lagg_llqtype); -static void lagg_port_setlladdr(void *, int); static int lagg_port_create(struct lagg_softc *, struct ifnet *); static int lagg_port_destroy(struct lagg_port *, int); static struct mbuf *lagg_input(struct ifnet *, struct mbuf *); @@ -124,8 +122,9 @@ static int lagg_snd_tag_alloc(struct ifn union if_snd_tag_alloc_params *, struct m_snd_tag **); #endif -static int lagg_ether_setmulti(struct lagg_softc *); -static int lagg_ether_cmdmulti(struct lagg_port *, int); +static int lagg_setmulti(struct lagg_port *); +static int lagg_clrmulti(struct lagg_port *); +static int lagg_setcaps(struct lagg_port *, int cap); static int lagg_setflag(struct lagg_port *, int, int, int (*func)(struct ifnet *, int)); static int lagg_setflags(struct lagg_port *, int status); @@ -317,6 +316,7 @@ static void lagg_proto_attach(struct lagg_softc *sc, lagg_proto pr) { + LAGG_XLOCK_ASSERT(sc); KASSERT(sc->sc_proto == LAGG_PROTO_NONE, ("%s: sc %p has proto", __func__, sc)); @@ -333,8 +333,8 @@ lagg_proto_detach(struct lagg_softc *sc) { lagg_proto pr; + LAGG_XLOCK_ASSERT(sc); LAGG_WLOCK_ASSERT(sc); - pr = sc->sc_proto; sc->sc_proto = LAGG_PROTO_NONE; @@ -433,15 +433,14 @@ lagg_register_vlan(void *arg, struct ifn { struct lagg_softc *sc = ifp->if_softc; struct lagg_port *lp; - struct rm_priotracker tracker; if (ifp->if_softc != arg) /* Not our event */ return; - LAGG_RLOCK(sc, &tracker); + LAGG_SLOCK(sc); SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag); - LAGG_RUNLOCK(sc, &tracker); + LAGG_SUNLOCK(sc); } /* @@ -453,15 +452,14 @@ lagg_unregister_vlan(void *arg, struct i { struct lagg_softc *sc = ifp->if_softc; struct lagg_port *lp; - struct rm_priotracker tracker; if (ifp->if_softc != arg) /* Not our event */ return; - LAGG_RLOCK(sc, &tracker); + LAGG_SLOCK(sc); SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag); - LAGG_RUNLOCK(sc, &tracker); + LAGG_SUNLOCK(sc); } static int @@ -477,7 +475,10 @@ lagg_clone_create(struct if_clone *ifc, free(sc, M_DEVBUF); return (ENOSPC); } + LAGG_LOCK_INIT(sc); + LAGG_SX_INIT(sc); + LAGG_XLOCK(sc); if (V_def_use_flowid) sc->sc_opts |= LAGG_OPT_USE_FLOWID; sc->flowid_shift = V_def_flowid_shift; @@ -487,9 +488,7 @@ lagg_clone_create(struct if_clone *ifc, lagg_proto_attach(sc, LAGG_PROTO_DEFAULT); - LAGG_LOCK_INIT(sc); SLIST_INIT(&sc->sc_ports); - TASK_INIT(&sc->sc_lladdr_task, 0, lagg_port_setlladdr, sc); /* Initialise pseudo media types */ ifmedia_init(&sc->sc_media, 0, lagg_media_change, @@ -527,6 +526,7 @@ lagg_clone_create(struct if_clone *ifc, LAGG_LIST_LOCK(); SLIST_INSERT_HEAD(&V_lagg_list, sc, sc_entries); LAGG_LIST_UNLOCK(); + LAGG_XUNLOCK(sc); return (0); } @@ -537,8 +537,8 @@ lagg_clone_destroy(struct ifnet *ifp) struct lagg_softc *sc = (struct lagg_softc *)ifp->if_softc; struct lagg_port *lp; - LAGG_WLOCK(sc); - + LAGG_XLOCK(sc); + sc->sc_destroying = 1; lagg_stop(sc); ifp->if_flags &= ~IFF_UP; @@ -546,15 +546,14 @@ lagg_clone_destroy(struct ifnet *ifp) EVENTHANDLER_DEREGISTER(vlan_unconfig, sc->vlan_detach); /* Shutdown and remove lagg ports */ - while ((lp = SLIST_FIRST(&sc->sc_ports)) != NULL) { - lp->lp_detaching = LAGG_CLONE_DESTROY; + while ((lp = SLIST_FIRST(&sc->sc_ports)) != NULL) lagg_port_destroy(lp, 1); - } + /* Unhook the aggregation protocol */ + LAGG_WLOCK(sc); lagg_proto_detach(sc); LAGG_UNLOCK_ASSERT(sc); - taskqueue_drain(taskqueue_swi, &sc->sc_lladdr_task); ifmedia_removeall(&sc->sc_media); ether_ifdetach(ifp); if_free(ifp); @@ -562,48 +561,13 @@ lagg_clone_destroy(struct ifnet *ifp) LAGG_LIST_LOCK(); SLIST_REMOVE(&V_lagg_list, sc, lagg_softc, sc_entries); LAGG_LIST_UNLOCK(); + LAGG_XUNLOCK(sc); + LAGG_SX_DESTROY(sc); LAGG_LOCK_DESTROY(sc); free(sc, M_DEVBUF); } -/* - * Set link-layer address on the lagg interface itself. - * - * Set noinline to be dtrace-friendly - */ -static __noinline void -lagg_lladdr(struct lagg_softc *sc, uint8_t *lladdr) -{ - struct ifnet *ifp = sc->sc_ifp; - struct lagg_port lp; - - if (memcmp(lladdr, IF_LLADDR(ifp), ETHER_ADDR_LEN) == 0) - return; - - LAGG_WLOCK_ASSERT(sc); - /* - * Set the link layer address on the lagg interface. - * lagg_proto_lladdr() notifies the MAC change to - * the aggregation protocol. iflladdr_event handler which - * may trigger gratuitous ARPs for INET will be handled in - * a taskqueue. - */ - bcopy(lladdr, IF_LLADDR(ifp), ETHER_ADDR_LEN); - lagg_proto_lladdr(sc); - - /* - * Send notification request for lagg interface - * itself. Note that new lladdr is already set. - */ - bzero(&lp, sizeof(lp)); - lp.lp_ifp = sc->sc_ifp; - lp.lp_softc = sc; - - /* Do not request lladdr change */ - lagg_port_lladdr(&lp, lladdr, LAGG_LLQTYPE_VIRT); -} - static void lagg_capabilities(struct lagg_softc *sc) { @@ -612,7 +576,7 @@ lagg_capabilities(struct lagg_softc *sc) u_long hwa = ~0UL; struct ifnet_hw_tsomax hw_tsomax; - LAGG_WLOCK_ASSERT(sc); + LAGG_XLOCK_ASSERT(sc); memset(&hw_tsomax, 0, sizeof(hw_tsomax)); @@ -640,97 +604,10 @@ lagg_capabilities(struct lagg_softc *sc) if_printf(sc->sc_ifp, "capabilities 0x%08x enabled 0x%08x\n", cap, ena); } -} -/* - * Enqueue interface lladdr notification. - * If request is already queued, it is updated. - * If setting lladdr is also desired, @do_change has to be set to 1. - * - * Set noinline to be dtrace-friendly - */ -static __noinline void -lagg_port_lladdr(struct lagg_port *lp, uint8_t *lladdr, lagg_llqtype llq_type) -{ - struct lagg_softc *sc = lp->lp_softc; - struct ifnet *ifp = lp->lp_ifp; - struct lagg_llq *llq; - - LAGG_WLOCK_ASSERT(sc); - - /* - * Do not enqueue requests where lladdr is the same for - * "physical" interfaces (e.g. ports in lagg) - */ - if (llq_type == LAGG_LLQTYPE_PHYS && - memcmp(IF_LLADDR(ifp), lladdr, ETHER_ADDR_LEN) == 0) - return; - - /* Check to make sure its not already queued to be changed */ - SLIST_FOREACH(llq, &sc->sc_llq_head, llq_entries) { - if (llq->llq_ifp == ifp) { - /* Update lladdr, it may have changed */ - bcopy(lladdr, llq->llq_lladdr, ETHER_ADDR_LEN); - return; - } - } - - llq = malloc(sizeof(struct lagg_llq), M_DEVBUF, M_NOWAIT | M_ZERO); - if (llq == NULL) /* XXX what to do */ - return; - - if_ref(ifp); - llq->llq_ifp = ifp; - llq->llq_type = llq_type; - bcopy(lladdr, llq->llq_lladdr, ETHER_ADDR_LEN); - /* XXX: We should insert to tail */ - SLIST_INSERT_HEAD(&sc->sc_llq_head, llq, llq_entries); - - taskqueue_enqueue(taskqueue_swi, &sc->sc_lladdr_task); -} - -/* - * Set the interface MAC address from a taskqueue to avoid a LOR. - * - * Set noinline to be dtrace-friendly - */ -static __noinline void -lagg_port_setlladdr(void *arg, int pending) -{ - struct lagg_softc *sc = (struct lagg_softc *)arg; - struct lagg_llq *llq, *head; - struct ifnet *ifp; - - /* Grab a local reference of the queue and remove it from the softc */ - LAGG_WLOCK(sc); - head = SLIST_FIRST(&sc->sc_llq_head); - SLIST_FIRST(&sc->sc_llq_head) = NULL; - LAGG_WUNLOCK(sc); - - /* - * Traverse the queue and set the lladdr on each ifp. It is safe to do - * unlocked as we have the only reference to it. - */ - for (llq = head; llq != NULL; llq = head) { - ifp = llq->llq_ifp; - - CURVNET_SET(ifp->if_vnet); - - /* - * Set the link layer address on the laggport interface. - * Note that if_setlladdr() or iflladdr_event handler - * may result in arp transmission / lltable updates. - */ - if (llq->llq_type == LAGG_LLQTYPE_PHYS) - if_setlladdr(ifp, llq->llq_lladdr, - ETHER_ADDR_LEN); - else - EVENTHANDLER_INVOKE(iflladdr_event, ifp); - CURVNET_RESTORE(); - head = SLIST_NEXT(llq, llq_entries); - if_rele(ifp); - free(llq, M_DEVBUF); - } + /* Apply unified capabilities back to the lagg ports. */ + SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) + lagg_setcaps(lp, ena); } static int @@ -741,7 +618,7 @@ lagg_port_create(struct lagg_softc *sc, int error, i; uint64_t *pval; - LAGG_WLOCK_ASSERT(sc); + LAGG_XLOCK_ASSERT(sc); /* Limit the maximal number of lagg ports */ if (sc->sc_count >= LAGG_MAX_PORTS) @@ -769,9 +646,8 @@ lagg_port_create(struct lagg_softc *sc, return (EINVAL); } - if ((lp = malloc(sizeof(struct lagg_port), - M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL) - return (ENOMEM); + lp = malloc(sizeof(struct lagg_port), M_DEVBUF, M_WAITOK|M_ZERO); + lp->lp_softc = sc; /* Check if port is a stacked lagg */ LAGG_LIST_LOCK(); @@ -794,6 +670,26 @@ lagg_port_create(struct lagg_softc *sc, } LAGG_LIST_UNLOCK(); + if_ref(ifp); + lp->lp_ifp = ifp; + + bcopy(IF_LLADDR(ifp), lp->lp_lladdr, ETHER_ADDR_LEN); + lp->lp_ifcapenable = ifp->if_capenable; + if (SLIST_EMPTY(&sc->sc_ports)) { + LAGG_WLOCK(sc); + bcopy(IF_LLADDR(ifp), IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN); + lagg_proto_lladdr(sc); + LAGG_WUNLOCK(sc); + EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp); + } else { + if_setlladdr(ifp, IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN); + } + lagg_setflags(lp, 1); + + LAGG_WLOCK(sc); + if (SLIST_EMPTY(&sc->sc_ports)) + sc->sc_primary = lp; + /* Change the interface type */ lp->lp_iftype = ifp->if_type; ifp->if_type = IFT_IEEE8023ADLAG; @@ -803,25 +699,10 @@ lagg_port_create(struct lagg_softc *sc, lp->lp_output = ifp->if_output; ifp->if_output = lagg_port_output; - if_ref(ifp); - lp->lp_ifp = ifp; - lp->lp_softc = sc; - - /* Save port link layer address */ - bcopy(IF_LLADDR(ifp), lp->lp_lladdr, ETHER_ADDR_LEN); - - if (SLIST_EMPTY(&sc->sc_ports)) { - sc->sc_primary = lp; - /* First port in lagg. Update/notify lagg lladdress */ - lagg_lladdr(sc, IF_LLADDR(ifp)); - } else { - - /* - * Update link layer address for this port and - * send notifications to other subsystems. - */ - lagg_port_lladdr(lp, IF_LLADDR(sc->sc_ifp), LAGG_LLQTYPE_PHYS); - } + /* Read port counters */ + pval = lp->port_counters.val; + for (i = 0; i < IFCOUNTERS; i++, pval++) + *pval = ifp->if_get_counter(ifp, i); /* * Insert into the list of ports. @@ -842,24 +723,21 @@ lagg_port_create(struct lagg_softc *sc, SLIST_INSERT_HEAD(&sc->sc_ports, lp, lp_entries); sc->sc_count++; - /* Update lagg capabilities */ - lagg_capabilities(sc); - lagg_linkstate(sc); - - /* Read port counters */ - pval = lp->port_counters.val; - for (i = 0; i < IFCOUNTERS; i++, pval++) - *pval = ifp->if_get_counter(ifp, i); - /* Add multicast addresses and interface flags to this port */ - lagg_ether_cmdmulti(lp, 1); - lagg_setflags(lp, 1); + lagg_setmulti(lp); if ((error = lagg_proto_addport(sc, lp)) != 0) { /* Remove the port, without calling pr_delport. */ lagg_port_destroy(lp, 0); + LAGG_UNLOCK_ASSERT(sc); return (error); } + LAGG_WUNLOCK(sc); + + /* Update lagg capabilities */ + lagg_capabilities(sc); + lagg_linkstate(sc); + return (0); } @@ -871,8 +749,7 @@ lagg_port_checkstacking(struct lagg_soft struct lagg_port *lp; int m = 0; - LAGG_WLOCK_ASSERT(sc); - + LAGG_SXLOCK_ASSERT(sc); SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { if (lp->lp_flags & LAGG_PORT_STACK) { sc_ptr = (struct lagg_softc *)lp->lp_ifp->if_softc; @@ -889,25 +766,20 @@ lagg_port_destroy(struct lagg_port *lp, { struct lagg_softc *sc = lp->lp_softc; struct lagg_port *lp_ptr, *lp0; - struct lagg_llq *llq; struct ifnet *ifp = lp->lp_ifp; uint64_t *pval, vdiff; int i; - LAGG_WLOCK_ASSERT(sc); + LAGG_XLOCK_ASSERT(sc); - if (rundelport) + if (rundelport) { + LAGG_WLOCK(sc); lagg_proto_delport(sc, lp); + } else + LAGG_WLOCK_ASSERT(sc); - /* - * Remove multicast addresses and interface flags from this port and - * reset the MAC address, skip if the interface is being detached. - */ - if (lp->lp_detaching == 0) { - lagg_ether_cmdmulti(lp, 0); - lagg_setflags(lp, 0); - lagg_port_lladdr(lp, lp->lp_lladdr, LAGG_LLQTYPE_PHYS); - } + if (lp->lp_detaching == 0) + lagg_clrmulti(lp); /* Restore interface */ ifp->if_type = lp->lp_iftype; @@ -930,43 +802,37 @@ lagg_port_destroy(struct lagg_port *lp, if (lp == sc->sc_primary) { uint8_t lladdr[ETHER_ADDR_LEN]; - if ((lp0 = SLIST_FIRST(&sc->sc_ports)) == NULL) { + if ((lp0 = SLIST_FIRST(&sc->sc_ports)) == NULL) bzero(&lladdr, ETHER_ADDR_LEN); - } else { - bcopy(lp0->lp_lladdr, - lladdr, ETHER_ADDR_LEN); - } - if (lp->lp_detaching != LAGG_CLONE_DESTROY) - lagg_lladdr(sc, lladdr); - - /* Mark lp0 as new primary */ + else + bcopy(lp0->lp_lladdr, lladdr, ETHER_ADDR_LEN); sc->sc_primary = lp0; + if (sc->sc_destroying == 0) { + bcopy(lladdr, IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN); + lagg_proto_lladdr(sc); + LAGG_WUNLOCK(sc); + EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp); + } else + LAGG_WUNLOCK(sc); /* - * Enqueue lladdr update/notification for each port - * (new primary needs update as well, to switch from - * old lladdr to its 'real' one). + * Update lladdr for each port (new primary needs update + * as well, to switch from old lladdr to its 'real' one) */ SLIST_FOREACH(lp_ptr, &sc->sc_ports, lp_entries) - lagg_port_lladdr(lp_ptr, lladdr, LAGG_LLQTYPE_PHYS); - } - - /* Remove any pending lladdr changes from the queue */ - if (lp->lp_detaching != 0) { - SLIST_FOREACH(llq, &sc->sc_llq_head, llq_entries) { - if (llq->llq_ifp == ifp) { - SLIST_REMOVE(&sc->sc_llq_head, llq, lagg_llq, - llq_entries); - if_rele(llq->llq_ifp); - free(llq, M_DEVBUF); - break; /* Only appears once */ - } - } - } + if_setlladdr(lp_ptr->lp_ifp, lladdr, ETHER_ADDR_LEN); + } else + LAGG_WUNLOCK(sc); if (lp->lp_ifflags) if_printf(ifp, "%s: lp_ifflags unclean\n", __func__); + if (lp->lp_detaching == 0) { + lagg_setflags(lp, 0); + lagg_setcaps(lp, lp->lp_ifcapenable); + if_setlladdr(ifp, lp->lp_lladdr, ETHER_ADDR_LEN); + } + if_rele(ifp); free(lp, M_DEVBUF); @@ -984,7 +850,6 @@ lagg_port_ioctl(struct ifnet *ifp, u_lon struct lagg_softc *sc; struct lagg_port *lp = NULL; int error = 0; - struct rm_priotracker tracker; /* Should be checked by the caller */ if (ifp->if_type != IFT_IEEE8023ADLAG || @@ -999,15 +864,15 @@ lagg_port_ioctl(struct ifnet *ifp, u_lon break; } - LAGG_RLOCK(sc, &tracker); + LAGG_SLOCK(sc); if ((lp = ifp->if_lagg) == NULL || lp->lp_softc != sc) { error = ENOENT; - LAGG_RUNLOCK(sc, &tracker); + LAGG_SUNLOCK(sc); break; } lagg_port2req(lp, rp); - LAGG_RUNLOCK(sc, &tracker); + LAGG_SUNLOCK(sc); break; case SIOCSIFCAP: @@ -1020,9 +885,9 @@ lagg_port_ioctl(struct ifnet *ifp, u_lon break; /* Update lagg interface capabilities */ - LAGG_WLOCK(sc); + LAGG_XLOCK(sc); lagg_capabilities(sc); - LAGG_WUNLOCK(sc); + LAGG_XUNLOCK(sc); break; case SIOCSIFMTU: @@ -1132,10 +997,10 @@ lagg_port_ifdetach(void *arg __unused, s sc = lp->lp_softc; - LAGG_WLOCK(sc); - lp->lp_detaching = LAGG_PORT_DETACH; + LAGG_XLOCK(sc); + lp->lp_detaching = 1; lagg_port_destroy(lp, 1); - LAGG_WUNLOCK(sc); + LAGG_XUNLOCK(sc); } static void @@ -1185,10 +1050,11 @@ lagg_init(void *xsc) struct ifnet *ifp = sc->sc_ifp; struct lagg_port *lp; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + LAGG_XLOCK(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + LAGG_XUNLOCK(sc); return; - - LAGG_WLOCK(sc); + } ifp->if_drv_flags |= IFF_DRV_RUNNING; @@ -1197,12 +1063,15 @@ lagg_init(void *xsc) * This might be if_setlladdr() notification * that lladdr has been changed. */ - SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) - lagg_port_lladdr(lp, IF_LLADDR(ifp), LAGG_LLQTYPE_PHYS); + SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { + if (memcmp(IF_LLADDR(ifp), IF_LLADDR(lp->lp_ifp), + ETHER_ADDR_LEN) != 0) + if_setlladdr(lp->lp_ifp, IF_LLADDR(ifp), ETHER_ADDR_LEN); + } lagg_proto_init(sc); - LAGG_WUNLOCK(sc); + LAGG_XUNLOCK(sc); } static void @@ -1210,7 +1079,7 @@ lagg_stop(struct lagg_softc *sc) { struct ifnet *ifp = sc->sc_ifp; - LAGG_WLOCK_ASSERT(sc); + LAGG_XLOCK_ASSERT(sc); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; @@ -1234,22 +1103,14 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd struct thread *td = curthread; char *buf, *outbuf; int count, buflen, len, error = 0; - struct rm_priotracker tracker; bzero(&rpbuf, sizeof(rpbuf)); switch (cmd) { case SIOCGLAGG: - LAGG_RLOCK(sc, &tracker); - count = 0; - SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) - count++; - buflen = count * sizeof(struct lagg_reqport); - LAGG_RUNLOCK(sc, &tracker); - + LAGG_SLOCK(sc); + buflen = sc->sc_count * sizeof(struct lagg_reqport); outbuf = malloc(buflen, M_TEMP, M_WAITOK | M_ZERO); - - LAGG_RLOCK(sc, &tracker); ra->ra_proto = sc->sc_proto; lagg_proto_request(sc, &ra->ra_psc); count = 0; @@ -1265,7 +1126,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd buf += sizeof(rpbuf); len -= sizeof(rpbuf); } - LAGG_RUNLOCK(sc, &tracker); + LAGG_SUNLOCK(sc); ra->ra_ports = count; ra->ra_size = count * sizeof(rpbuf); error = copyout(outbuf, ra->ra_port, ra->ra_size); @@ -1280,12 +1141,15 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd break; } + LAGG_XLOCK(sc); LAGG_WLOCK(sc); lagg_proto_detach(sc); LAGG_UNLOCK_ASSERT(sc); lagg_proto_attach(sc, ra->ra_proto); + LAGG_XUNLOCK(sc); break; case SIOCGLAGGOPTS: + LAGG_SLOCK(sc); ro->ro_opts = sc->sc_opts; if (sc->sc_proto == LAGG_PROTO_LACP) { struct lacp_softc *lsc; @@ -1309,6 +1173,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd ro->ro_bkt = sc->sc_bkt; ro->ro_flapping = sc->sc_flapping; ro->ro_flowid_shift = sc->flowid_shift; + LAGG_SUNLOCK(sc); break; case SIOCSLAGGOPTS: if (sc->sc_proto == LAGG_PROTO_ROUNDROBIN) { @@ -1350,13 +1215,13 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd break; } - LAGG_WLOCK(sc); + LAGG_XLOCK(sc); if (valid == 0 || (lacp == 1 && sc->sc_proto != LAGG_PROTO_LACP)) { /* Invalid combination of options specified. */ error = EINVAL; - LAGG_WUNLOCK(sc); + LAGG_XUNLOCK(sc); break; /* Return from SIOCSLAGGOPTS. */ } /* @@ -1411,18 +1276,18 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd break; } } - LAGG_WUNLOCK(sc); + LAGG_XUNLOCK(sc); break; case SIOCGLAGGFLAGS: rf->rf_flags = 0; - LAGG_RLOCK(sc, &tracker); + LAGG_SLOCK(sc); if (sc->sc_flags & MBUF_HASHFLAG_L2) rf->rf_flags |= LAGG_F_HASHL2; if (sc->sc_flags & MBUF_HASHFLAG_L3) rf->rf_flags |= LAGG_F_HASHL3; if (sc->sc_flags & MBUF_HASHFLAG_L4) rf->rf_flags |= LAGG_F_HASHL4; - LAGG_RUNLOCK(sc, &tracker); + LAGG_SUNLOCK(sc); break; case SIOCSLAGGHASH: error = priv_check(td, PRIV_NET_LAGG); @@ -1432,7 +1297,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd error = EINVAL; break; } - LAGG_WLOCK(sc); + LAGG_XLOCK(sc); sc->sc_flags = 0; if (rf->rf_flags & LAGG_F_HASHL2) sc->sc_flags |= MBUF_HASHFLAG_L2; @@ -1440,7 +1305,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd sc->sc_flags |= MBUF_HASHFLAG_L3; if (rf->rf_flags & LAGG_F_HASHL4) sc->sc_flags |= MBUF_HASHFLAG_L4; - LAGG_WUNLOCK(sc); + LAGG_XUNLOCK(sc); break; case SIOCGLAGGPORT: if (rp->rp_portname[0] == '\0' || @@ -1449,17 +1314,17 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd break; } - LAGG_RLOCK(sc, &tracker); + LAGG_SLOCK(sc); if ((lp = (struct lagg_port *)tpif->if_lagg) == NULL || lp->lp_softc != sc) { error = ENOENT; - LAGG_RUNLOCK(sc, &tracker); + LAGG_SUNLOCK(sc); if_rele(tpif); break; } lagg_port2req(lp, rp); - LAGG_RUNLOCK(sc, &tracker); + LAGG_SUNLOCK(sc); if_rele(tpif); break; case SIOCSLAGGPORT: @@ -1491,9 +1356,9 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd tpif->if_xname); } #endif - LAGG_WLOCK(sc); + LAGG_XLOCK(sc); error = lagg_port_create(sc, tpif); - LAGG_WUNLOCK(sc); + LAGG_XUNLOCK(sc); if_rele(tpif); break; case SIOCSLAGGDELPORT: @@ -1506,26 +1371,25 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd break; } - LAGG_WLOCK(sc); + LAGG_XLOCK(sc); if ((lp = (struct lagg_port *)tpif->if_lagg) == NULL || lp->lp_softc != sc) { error = ENOENT; - LAGG_WUNLOCK(sc); + LAGG_XUNLOCK(sc); if_rele(tpif); break; } error = lagg_port_destroy(lp, 1); - LAGG_WUNLOCK(sc); + LAGG_XUNLOCK(sc); if_rele(tpif); break; case SIOCSIFFLAGS: /* Set flags on ports too */ - LAGG_WLOCK(sc); + LAGG_XLOCK(sc); SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { lagg_setflags(lp, 1); } - LAGG_WUNLOCK(sc); if (!(ifp->if_flags & IFF_UP) && (ifp->if_drv_flags & IFF_DRV_RUNNING)) { @@ -1533,23 +1397,28 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd * If interface is marked down and it is running, * then stop and disable it. */ - LAGG_WLOCK(sc); lagg_stop(sc); - LAGG_WUNLOCK(sc); + LAGG_XUNLOCK(sc); } else if ((ifp->if_flags & IFF_UP) && !(ifp->if_drv_flags & IFF_DRV_RUNNING)) { /* * If interface is marked up and it is stopped, then * start it. */ + LAGG_XUNLOCK(sc); (*ifp->if_init)(sc); - } + } else + LAGG_XUNLOCK(sc); break; case SIOCADDMULTI: case SIOCDELMULTI: LAGG_WLOCK(sc); - error = lagg_ether_setmulti(sc); + SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { + lagg_clrmulti(lp); + lagg_setmulti(lp); + } LAGG_WUNLOCK(sc); + error = 0; break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: @@ -1557,8 +1426,18 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd break; case SIOCSIFCAP: + LAGG_XLOCK(sc); + SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { + if (lp->lp_ioctl != NULL) + (*lp->lp_ioctl)(lp->lp_ifp, cmd, data); + } + lagg_capabilities(sc); + LAGG_XUNLOCK(sc); + error = 0; + break; + case SIOCSIFMTU: - /* Do not allow the MTU or caps to be directly changed */ + /* Do not allow the MTU to be directly changed */ error = EINVAL; break; @@ -1616,67 +1495,70 @@ lagg_snd_tag_alloc(struct ifnet *ifp, #endif static int -lagg_ether_setmulti(struct lagg_softc *sc) +lagg_setmulti(struct lagg_port *lp) { - struct lagg_port *lp; + struct lagg_softc *sc = lp->lp_softc; + struct ifnet *ifp = lp->lp_ifp; + struct ifnet *scifp = sc->sc_ifp; + struct lagg_mc *mc; + struct ifmultiaddr *ifma; + int error; LAGG_WLOCK_ASSERT(sc); - - SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { - /* First, remove any existing filter entries. */ - lagg_ether_cmdmulti(lp, 0); - /* copy all addresses from the lagg interface to the port */ - lagg_ether_cmdmulti(lp, 1); + IF_ADDR_WLOCK(scifp); + TAILQ_FOREACH(ifma, &scifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + mc = malloc(sizeof(struct lagg_mc), M_DEVBUF, M_NOWAIT); + if (mc == NULL) { + IF_ADDR_WUNLOCK(scifp); + return (ENOMEM); + } + bcopy(ifma->ifma_addr, &mc->mc_addr, + ifma->ifma_addr->sa_len); + mc->mc_addr.sdl_index = ifp->if_index; + mc->mc_ifma = NULL; + SLIST_INSERT_HEAD(&lp->lp_mc_head, mc, mc_entries); + } + IF_ADDR_WUNLOCK(scifp); + SLIST_FOREACH (mc, &lp->lp_mc_head, mc_entries) { + error = if_addmulti(ifp, + (struct sockaddr *)&mc->mc_addr, &mc->mc_ifma); + if (error) + return (error); } return (0); } static int -lagg_ether_cmdmulti(struct lagg_port *lp, int set) +lagg_clrmulti(struct lagg_port *lp) { struct lagg_softc *sc = lp->lp_softc; - struct ifnet *ifp = lp->lp_ifp; - struct ifnet *scifp = sc->sc_ifp; struct lagg_mc *mc; - struct ifmultiaddr *ifma; - int error; LAGG_WLOCK_ASSERT(sc); - - if (set) { - IF_ADDR_WLOCK(scifp); - TAILQ_FOREACH(ifma, &scifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - mc = malloc(sizeof(struct lagg_mc), M_DEVBUF, M_NOWAIT); - if (mc == NULL) { - IF_ADDR_WUNLOCK(scifp); - return (ENOMEM); - } - bcopy(ifma->ifma_addr, &mc->mc_addr, - ifma->ifma_addr->sa_len); - mc->mc_addr.sdl_index = ifp->if_index; - mc->mc_ifma = NULL; - SLIST_INSERT_HEAD(&lp->lp_mc_head, mc, mc_entries); - } - IF_ADDR_WUNLOCK(scifp); - SLIST_FOREACH (mc, &lp->lp_mc_head, mc_entries) { - error = if_addmulti(ifp, - (struct sockaddr *)&mc->mc_addr, &mc->mc_ifma); - if (error) - return (error); - } - } else { - while ((mc = SLIST_FIRST(&lp->lp_mc_head)) != NULL) { - SLIST_REMOVE(&lp->lp_mc_head, mc, lagg_mc, mc_entries); - if (mc->mc_ifma && lp->lp_detaching == 0) - if_delmulti_ifma(mc->mc_ifma); - free(mc, M_DEVBUF); - } + while ((mc = SLIST_FIRST(&lp->lp_mc_head)) != NULL) { + SLIST_REMOVE(&lp->lp_mc_head, mc, lagg_mc, mc_entries); + if (mc->mc_ifma && lp->lp_detaching == 0) + if_delmulti_ifma(mc->mc_ifma); + free(mc, M_DEVBUF); } return (0); } +static int +lagg_setcaps(struct lagg_port *lp, int cap) +{ + struct ifreq ifr; + + if (lp->lp_ifp->if_capenable == cap) + return (0); + if (lp->lp_ioctl == NULL) + return (ENXIO); + ifr.ifr_reqcap = cap; + return ((*lp->lp_ioctl)(lp->lp_ifp, SIOCSIFCAP, (caddr_t)&ifr)); +} + /* Handle a ref counted flag that should be set on the lagg port as well */ static int lagg_setflag(struct lagg_port *lp, int flag, int status, @@ -1687,7 +1569,7 @@ lagg_setflag(struct lagg_port *lp, int f struct ifnet *ifp = lp->lp_ifp; int error; - LAGG_WLOCK_ASSERT(sc); + LAGG_XLOCK_ASSERT(sc); status = status ? (scifp->if_flags & flag) : 0; /* Now "status" contains the flag value or 0 */ @@ -1821,17 +1703,16 @@ lagg_media_status(struct ifnet *ifp, str { struct lagg_softc *sc = (struct lagg_softc *)ifp->if_softc; struct lagg_port *lp; - struct rm_priotracker tracker; imr->ifm_status = IFM_AVALID; imr->ifm_active = IFM_ETHER | IFM_AUTO; - LAGG_RLOCK(sc, &tracker); + LAGG_SLOCK(sc); SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { if (LAGG_PORTACTIVE(lp)) imr->ifm_status |= IFM_ACTIVE; } - LAGG_RUNLOCK(sc, &tracker); + LAGG_SUNLOCK(sc); } static void @@ -1841,6 +1722,8 @@ lagg_linkstate(struct lagg_softc *sc) int new_link = LINK_STATE_DOWN; uint64_t speed; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue May 2 19:45:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0ED69D5B984; Tue, 2 May 2017 19:45:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E119D91; Tue, 2 May 2017 19:45:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v42JjPMS075588 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 May 2017 22:45:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v42JjPMS075588 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v42JjPV8075587; Tue, 2 May 2017 22:45:25 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 2 May 2017 22:45:25 +0300 From: Konstantin Belousov To: Bruce Evans Cc: emaste@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317681 - head/share/man/man7 Message-ID: <20170502194525.GL1622@kib.kiev.ua> References: <201705021452.v42EqZSB010115@repo.freebsd.org> <20170503013818.F2099@besplex.bde.org> <20170502174455.GJ1622@kib.kiev.ua> <20170503035045.Q2870@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170503035045.Q2870@besplex.bde.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 19:45:32 -0000 On Wed, May 03, 2017 at 04:41:52AM +1000, Bruce Evans wrote: > It would be good to mention that the type of time_t is signed somewhere. > There is a whole column for the signedess of char in another table. > Signedness can be given consisely using some markup like -8 or 8- for > signed. The scale (often bytes or bits) could be given similarly. E.g, > 8-B could mean signed 8 bits and 80.b could mean 80 bits floating pint. > > The Page Size table says "Page Sizes" redundantly in 1 column but doesn't > gives units, and depends on everyone knowing that 4K is real K and bytes. I added a note at the very beginning, saying that sizes are in bytes. For time_t, I added a short narration besides the table data. > > The Floating Point table already doesn't say "sizeof()" in the header but [omited, I do not want to change the scope of the fix] diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 index 1ce397a303e..ad1abccc2e5 100644 --- a/share/man/man7/arch.7 +++ b/share/man/man7/arch.7 @@ -37,6 +37,8 @@ Differences between CPU architectures and platforms supported by .Fx . .Pp .Ss Type sizes +If not explicitely mentioned, sizes are in bytes. +.Pp On all supported architectures, .Bl -column -offset -indent "long long" "Size" .It Sy Type Ta Sy Size @@ -47,8 +49,10 @@ On all supported architectures, .It float Ta 4 .It double Ta 8 .El -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) +.Pp +Machine-dependent type sizes: +.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t" +.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t .It amd64 Ta 8 Ta 16 Ta 8 .It arm Ta 4 Ta 8 Ta 8 .It armeb Ta 4 Ta 8 Ta 8 @@ -69,6 +73,9 @@ On all supported architectures, .It riscv Ta 8 Ta 16 Ta 8 .It sparc64 Ta 8 Ta 16 Ta 8 .El +.Pp +.Sy time_t +is always signed, it is 64-bits everywere except on i386 and 32-bit powerpc. .Ss Endianness and Char Signedness .Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char Signedness" .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness From owner-svn-src-head@freebsd.org Tue May 2 19:56:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33315D5BC8A; Tue, 2 May 2017 19:56:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02D557C0; Tue, 2 May 2017 19:56:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42JuhSY037352; Tue, 2 May 2017 19:56:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42JuhSu037351; Tue, 2 May 2017 19:56:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705021956.v42JuhSu037351@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 May 2017 19:56:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317700 - head/usr.bin/grep/regex X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 19:56:44 -0000 Author: emaste Date: Tue May 2 19:56:42 2017 New Revision: 317700 URL: https://svnweb.freebsd.org/changeset/base/317700 Log: bsdgrep: use calloc where appropriate in grep's tre-fastmatch Also apply style(9) to a related NULL check. Submitted by: Kyle Evans (D10098) Modified: head/usr.bin/grep/regex/tre-fastmatch.c Modified: head/usr.bin/grep/regex/tre-fastmatch.c ============================================================================== --- head/usr.bin/grep/regex/tre-fastmatch.c Tue May 2 19:30:42 2017 (r317699) +++ head/usr.bin/grep/regex/tre-fastmatch.c Tue May 2 19:56:42 2017 (r317700) @@ -630,7 +630,7 @@ tre_compile_fast(fastmatch_t *fg, const if (escaped) { if (!_escmap) - _escmap = malloc(n * sizeof(bool)); + _escmap = calloc(n, sizeof(bool)); if (!_escmap) { free(tmp); @@ -714,8 +714,8 @@ badpat: { if (fg->wescmap != NULL) { - fg->escmap = malloc(fg->len * sizeof(bool)); - if (!fg->escmap) + fg->escmap = calloc(fg->len, sizeof(bool)); + if (fg->escmap != NULL) { tre_free_fast(fg); return REG_ESPACE; From owner-svn-src-head@freebsd.org Tue May 2 20:08:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50077D5BEE2; Tue, 2 May 2017 20:08:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1531AD11; Tue, 2 May 2017 20:08:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42K85qa041424; Tue, 2 May 2017 20:08:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42K85t6041423; Tue, 2 May 2017 20:08:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705022008.v42K85t6041423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 May 2017 20:08:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317701 - head/usr.bin/grep/regex X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 20:08:06 -0000 Author: emaste Date: Tue May 2 20:08:04 2017 New Revision: 317701 URL: https://svnweb.freebsd.org/changeset/base/317701 Log: bsdgrep: correct test sense from r317700 Kyle's change in review D10098 was correct. I introduced the error when extracting a portion of that change. Modified: head/usr.bin/grep/regex/tre-fastmatch.c Modified: head/usr.bin/grep/regex/tre-fastmatch.c ============================================================================== --- head/usr.bin/grep/regex/tre-fastmatch.c Tue May 2 19:56:42 2017 (r317700) +++ head/usr.bin/grep/regex/tre-fastmatch.c Tue May 2 20:08:04 2017 (r317701) @@ -715,7 +715,7 @@ badpat: if (fg->wescmap != NULL) { fg->escmap = calloc(fg->len, sizeof(bool)); - if (fg->escmap != NULL) + if (fg->escmap == NULL) { tre_free_fast(fg); return REG_ESPACE; From owner-svn-src-head@freebsd.org Tue May 2 20:36:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA762D5B78A for ; Tue, 2 May 2017 20:36:37 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 887C4FDB for ; Tue, 2 May 2017 20:36:36 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 04fc46b7-2f77-11e7-b96e-2378c10e3beb X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.eu.mailhop.org (Halon) with ESMTPSA id 04fc46b7-2f77-11e7-b96e-2378c10e3beb; Tue, 02 May 2017 20:36:30 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v42KaOJO001819; Tue, 2 May 2017 14:36:24 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1493757384.66427.72.camel@freebsd.org> Subject: Re: svn commit: r317681 - head/share/man/man7 From: Ian Lepore To: Konstantin Belousov Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 02 May 2017 14:36:24 -0600 In-Reply-To: <20170502194525.GL1622@kib.kiev.ua> References: <201705021452.v42EqZSB010115@repo.freebsd.org> <20170503013818.F2099@besplex.bde.org> <20170502174455.GJ1622@kib.kiev.ua> <20170503035045.Q2870@besplex.bde.org> <20170502194525.GL1622@kib.kiev.ua> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 20:36:38 -0000 On Tue, 2017-05-02 at 22:45 +0300, Konstantin Belousov wrote: > +is always signed, it is 64-bits everywere except on i386 and 32-bit > powerpc. s/everywere/everywhere/ -- Ian From owner-svn-src-head@freebsd.org Tue May 2 20:38:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACFEAD5B81F; Tue, 2 May 2017 20:38:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 753A51094; Tue, 2 May 2017 20:38:12 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42KcBbd053982; Tue, 2 May 2017 20:38:11 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42KcBaQ053975; Tue, 2 May 2017 20:38:11 GMT (envelope-from np@FreeBSD.org) Message-Id: <201705022038.v42KcBaQ053975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 2 May 2017 20:38:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317702 - in head/sys: conf dev/cxgbe dev/cxgbe/common modules/cxgbe/if_cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 20:38:12 -0000 Author: np Date: Tue May 2 20:38:10 2017 New Revision: 317702 URL: https://svnweb.freebsd.org/changeset/base/317702 Log: cxgbe(4): Support routines for Tx traffic scheduling. - Create a new file, t4_sched.c, and move all of the code related to traffic management from t4_main.c and t4_sge.c to this file. - Track both Channel Rate Limiter (ch_rl) and Class Rate Limiter (cl_rl) parameters in the PF driver. - Initialize all the cl_rl limiters with somewhat arbitrary default rates and provide routines to update them on the fly. - Provide routines to reserve and release traffic classes. MFC after: 1 month Sponsored by: Chelsio Communications Added: head/sys/dev/cxgbe/t4_sched.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/t4_vf.c head/sys/modules/cxgbe/if_cxgbe/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue May 2 20:08:04 2017 (r317701) +++ head/sys/conf/files Tue May 2 20:38:10 2017 (r317702) @@ -1331,6 +1331,8 @@ dev/cxgbe/t4_main.c optional cxgbe pci compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/t4_netmap.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" +dev/cxgbe/t4_sched.c optional cxgbe pci \ + compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/t4_sge.c optional cxgbe pci \ compile-with "${NORMAL_C} -I$S/dev/cxgbe" dev/cxgbe/t4_l2t.c optional cxgbe pci \ Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Tue May 2 20:08:04 2017 (r317701) +++ head/sys/dev/cxgbe/adapter.h Tue May 2 20:38:10 2017 (r317702) @@ -231,15 +231,36 @@ struct vi_info { uint8_t hw_addr[ETHER_ADDR_LEN]; /* factory MAC address, won't change */ }; +struct tx_ch_rl_params { + enum fw_sched_params_rate ratemode; /* %port (REL) or kbps (ABS) */ + uint32_t maxrate; +}; + enum { - /* tx_sched_class flags */ - TX_SC_OK = (1 << 0), /* Set up in hardware, active. */ + TX_CLRL_REFRESH = (1 << 0), /* Need to update hardware state. */ + TX_CLRL_ERROR = (1 << 1), /* Error, hardware state unknown. */ }; -struct tx_sched_class { +struct tx_cl_rl_params { int refcount; - int flags; - struct t4_sched_class_params params; + u_int flags; + enum fw_sched_params_rate ratemode; /* %port REL or ABS value */ + enum fw_sched_params_unit rateunit; /* kbps or pps (when ABS) */ + enum fw_sched_params_mode mode; /* aggr or per-flow */ + uint32_t maxrate; + uint16_t pktsize; +}; + +/* Tx scheduler parameters for a channel/port */ +struct tx_sched_params { + /* Channel Rate Limiter */ + struct tx_ch_rl_params ch_rl; + + /* Class WRR */ + /* XXX */ + + /* Class Rate Limiter */ + struct tx_cl_rl_params cl_rl[]; }; struct port_info { @@ -251,7 +272,7 @@ struct port_info { int up_vis; int uld_vis; - struct tx_sched_class *tc; /* traffic classes for this channel */ + struct tx_sched_params *sched_params; struct mtx pi_lock; char lockname[16]; @@ -825,6 +846,9 @@ struct adapter { struct memwin memwin[NUM_MEMWIN]; /* memory windows */ + struct mtx tc_lock; + struct task tc_task; + const char *last_op; const void *last_op_thr; int last_op_flags; @@ -1106,8 +1130,6 @@ int t4_detach_common(device_t); int t4_filter_rpl(struct sge_iq *, const struct rss_header *, struct mbuf *); int t4_map_bars_0_and_4(struct adapter *); int t4_map_bar_2(struct adapter *); -int t4_set_sched_class(struct adapter *, struct t4_sched_params *); -int t4_set_sched_queue(struct adapter *, struct t4_sched_queue *); int t4_setup_intr_handlers(struct adapter *); void t4_sysctls(struct adapter *); int begin_synchronized_op(struct adapter *, struct vi_info *, int, char *); @@ -1168,6 +1190,15 @@ int t4_set_tracer(struct adapter *, stru int t4_trace_pkt(struct sge_iq *, const struct rss_header *, struct mbuf *); int t5_trace_pkt(struct sge_iq *, const struct rss_header *, struct mbuf *); +/* t4_sched.c */ +int t4_set_sched_class(struct adapter *, struct t4_sched_params *); +int t4_set_sched_queue(struct adapter *, struct t4_sched_queue *); +int t4_init_tx_sched(struct adapter *); +int t4_free_tx_sched(struct adapter *); +void t4_update_tx_sched(struct adapter *); +int t4_reserve_cl_rl_kbps(struct adapter *, int, u_int, int *); +void t4_release_cl_rl_kbps(struct adapter *, int, int); + static inline struct wrqe * alloc_wrqe(int wr_len, struct sge_wrq *wrq) { Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Tue May 2 20:08:04 2017 (r317701) +++ head/sys/dev/cxgbe/common/common.h Tue May 2 20:38:10 2017 (r317702) @@ -774,6 +774,13 @@ int t4_sched_params(struct adapter *adap int rateunit, int ratemode, int channel, int cl, int minrate, int maxrate, int weight, int pktsize, int sleep_ok); +int t4_sched_params_ch_rl(struct adapter *adapter, int channel, int ratemode, + unsigned int maxrate, int sleep_ok); +int t4_sched_params_cl_wrr(struct adapter *adapter, int channel, int cl, + int weight, int sleep_ok); +int t4_sched_params_cl_rl_kbps(struct adapter *adapter, int channel, int cl, + int mode, unsigned int maxrate, int pktsize, + int sleep_ok); int t4_config_watchdog(struct adapter *adapter, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int timeout, unsigned int action); Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Tue May 2 20:08:04 2017 (r317701) +++ head/sys/dev/cxgbe/common/t4_hw.c Tue May 2 20:38:10 2017 (r317702) @@ -9396,6 +9396,79 @@ int t4_sched_params(struct adapter *adap NULL, sleep_ok); } +int t4_sched_params_ch_rl(struct adapter *adapter, int channel, int ratemode, + unsigned int maxrate, int sleep_ok) +{ + struct fw_sched_cmd cmd; + + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_write = cpu_to_be32(V_FW_CMD_OP(FW_SCHED_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_WRITE); + cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); + + cmd.u.params.sc = FW_SCHED_SC_PARAMS; + cmd.u.params.type = FW_SCHED_TYPE_PKTSCHED; + cmd.u.params.level = FW_SCHED_PARAMS_LEVEL_CH_RL; + cmd.u.params.ch = channel; + cmd.u.params.rate = ratemode; /* REL or ABS */ + cmd.u.params.max = cpu_to_be32(maxrate);/* % or kbps */ + + return t4_wr_mbox_meat(adapter,adapter->mbox, &cmd, sizeof(cmd), + NULL, sleep_ok); +} + +int t4_sched_params_cl_wrr(struct adapter *adapter, int channel, int cl, + int weight, int sleep_ok) +{ + struct fw_sched_cmd cmd; + + if (weight < 0 || weight > 100) + return -EINVAL; + + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_write = cpu_to_be32(V_FW_CMD_OP(FW_SCHED_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_WRITE); + cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); + + cmd.u.params.sc = FW_SCHED_SC_PARAMS; + cmd.u.params.type = FW_SCHED_TYPE_PKTSCHED; + cmd.u.params.level = FW_SCHED_PARAMS_LEVEL_CL_WRR; + cmd.u.params.ch = channel; + cmd.u.params.cl = cl; + cmd.u.params.weight = cpu_to_be16(weight); + + return t4_wr_mbox_meat(adapter,adapter->mbox, &cmd, sizeof(cmd), + NULL, sleep_ok); +} + +int t4_sched_params_cl_rl_kbps(struct adapter *adapter, int channel, int cl, + int mode, unsigned int maxrate, int pktsize, int sleep_ok) +{ + struct fw_sched_cmd cmd; + + memset(&cmd, 0, sizeof(cmd)); + cmd.op_to_write = cpu_to_be32(V_FW_CMD_OP(FW_SCHED_CMD) | + F_FW_CMD_REQUEST | + F_FW_CMD_WRITE); + cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd)); + + cmd.u.params.sc = FW_SCHED_SC_PARAMS; + cmd.u.params.type = FW_SCHED_TYPE_PKTSCHED; + cmd.u.params.level = FW_SCHED_PARAMS_LEVEL_CL_RL; + cmd.u.params.mode = mode; + cmd.u.params.ch = channel; + cmd.u.params.cl = cl; + cmd.u.params.unit = FW_SCHED_PARAMS_UNIT_BITRATE; + cmd.u.params.rate = FW_SCHED_PARAMS_RATE_ABS; + cmd.u.params.max = cpu_to_be32(maxrate); + cmd.u.params.pktsize = cpu_to_be16(pktsize); + + return t4_wr_mbox_meat(adapter,adapter->mbox, &cmd, sizeof(cmd), + NULL, sleep_ok); +} + /* * t4_config_watchdog - configure (enable/disable) a watchdog timer * @adapter: the adapter Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue May 2 20:08:04 2017 (r317701) +++ head/sys/dev/cxgbe/t4_main.c Tue May 2 20:38:10 2017 (r317702) @@ -998,9 +998,6 @@ t4_attach(device_t dev) mtx_init(&pi->pi_lock, pi->lockname, 0, MTX_DEF); sc->chan_map[pi->tx_chan] = i; - pi->tc = malloc(sizeof(struct tx_sched_class) * - sc->chip_params->nsched_cls, M_CXGBE, M_ZERO | M_WAITOK); - if (port_top_speed(pi) >= 10) { n10g++; } else { @@ -1088,6 +1085,7 @@ t4_attach(device_t dev) M_ZERO | M_WAITOK); t4_init_l2t(sc, M_WAITOK); + t4_init_tx_sched(sc); /* * Second pass over the ports. This time we know the number of rx and @@ -1312,6 +1310,9 @@ t4_detach_common(device_t dev) for (i = 0; i < sc->intr_count; i++) t4_free_irq(sc, &sc->irq[i]); + if ((sc->flags & (IS_VF | FW_OK)) == FW_OK) + t4_free_tx_sched(sc); + for (i = 0; i < MAX_NPORTS; i++) { pi = sc->port[i]; if (pi) { @@ -1321,7 +1322,6 @@ t4_detach_common(device_t dev) mtx_destroy(&pi->pi_lock); free(pi->vi, M_CXGBE); - free(pi->tc, M_CXGBE); free(pi, M_CXGBE); } } @@ -5338,9 +5338,9 @@ cxgbe_sysctls(struct port_info *pi) * dev.(cxgbe|cxl).X.tc. */ oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "tc", CTLFLAG_RD, NULL, - "Tx scheduler traffic classes"); + "Tx scheduler traffic classes (cl_rl)"); for (i = 0; i < sc->chip_params->nsched_cls; i++) { - struct tx_sched_class *tc = &pi->tc[i]; + struct tx_cl_rl_params *tc = &pi->sched_params->cl_rl[i]; snprintf(name, sizeof(name), "%d", i); children2 = SYSCTL_CHILDREN(SYSCTL_ADD_NODE(ctx, @@ -7855,10 +7855,9 @@ static int sysctl_tc_params(SYSCTL_HANDLER_ARGS) { struct adapter *sc = arg1; - struct tx_sched_class *tc; - struct t4_sched_class_params p; + struct tx_cl_rl_params tc; struct sbuf *sb; - int i, rc, port_id, flags, mbps, gbps; + int i, rc, port_id, mbps, gbps; rc = sysctl_wire_old_buffer(req, 0); if (rc != 0) @@ -7873,52 +7872,34 @@ sysctl_tc_params(SYSCTL_HANDLER_ARGS) MPASS(sc->port[port_id] != NULL); i = arg2 & 0xffff; MPASS(i < sc->chip_params->nsched_cls); - tc = &sc->port[port_id]->tc[i]; - - rc = begin_synchronized_op(sc, NULL, HOLD_LOCK | SLEEP_OK | INTR_OK, - "t4tc_p"); - if (rc) - goto done; - flags = tc->flags; - p = tc->params; - end_synchronized_op(sc, LOCK_HELD); - if ((flags & TX_SC_OK) == 0) { - sbuf_printf(sb, "none"); - goto done; - } + mtx_lock(&sc->tc_lock); + tc = sc->port[port_id]->sched_params->cl_rl[i]; + mtx_unlock(&sc->tc_lock); - if (p.level == SCHED_CLASS_LEVEL_CL_WRR) { - sbuf_printf(sb, "cl-wrr weight %u", p.weight); - goto done; - } else if (p.level == SCHED_CLASS_LEVEL_CL_RL) - sbuf_printf(sb, "cl-rl"); - else if (p.level == SCHED_CLASS_LEVEL_CH_RL) - sbuf_printf(sb, "ch-rl"); - else { - rc = ENXIO; + if (tc.flags & TX_CLRL_ERROR) { + sbuf_printf(sb, "error"); goto done; } - if (p.ratemode == SCHED_CLASS_RATEMODE_REL) { + if (tc.ratemode == SCHED_CLASS_RATEMODE_REL) { /* XXX: top speed or actual link speed? */ gbps = port_top_speed(sc->port[port_id]); - sbuf_printf(sb, " %u%% of %uGbps", p.maxrate, gbps); - } - else if (p.ratemode == SCHED_CLASS_RATEMODE_ABS) { - switch (p.rateunit) { + sbuf_printf(sb, " %u%% of %uGbps", tc.maxrate, gbps); + } else if (tc.ratemode == SCHED_CLASS_RATEMODE_ABS) { + switch (tc.rateunit) { case SCHED_CLASS_RATEUNIT_BITS: - mbps = p.maxrate / 1000; - gbps = p.maxrate / 1000000; - if (p.maxrate == gbps * 1000000) + mbps = tc.maxrate / 1000; + gbps = tc.maxrate / 1000000; + if (tc.maxrate == gbps * 1000000) sbuf_printf(sb, " %uGbps", gbps); - else if (p.maxrate == mbps * 1000) + else if (tc.maxrate == mbps * 1000) sbuf_printf(sb, " %uMbps", mbps); else - sbuf_printf(sb, " %uKbps", p.maxrate); + sbuf_printf(sb, " %uKbps", tc.maxrate); break; case SCHED_CLASS_RATEUNIT_PKTS: - sbuf_printf(sb, " %upps", p.maxrate); + sbuf_printf(sb, " %upps", tc.maxrate); break; default: rc = ENXIO; @@ -7926,7 +7907,7 @@ sysctl_tc_params(SYSCTL_HANDLER_ARGS) } } - switch (p.mode) { + switch (tc.mode) { case SCHED_CLASS_MODE_CLASS: sbuf_printf(sb, " aggregate"); break; @@ -8828,225 +8809,6 @@ read_i2c(struct adapter *sc, struct t4_i return (rc); } -static int -in_range(int val, int lo, int hi) -{ - - return (val < 0 || (val <= hi && val >= lo)); -} - -static int -set_sched_class_config(struct adapter *sc, int minmax) -{ - int rc; - - if (minmax < 0) - return (EINVAL); - - rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4sscc"); - if (rc) - return (rc); - rc = -t4_sched_config(sc, FW_SCHED_TYPE_PKTSCHED, minmax, 1); - end_synchronized_op(sc, 0); - - return (rc); -} - -static int -set_sched_class_params(struct adapter *sc, struct t4_sched_class_params *p, - int sleep_ok) -{ - int rc, top_speed, fw_level, fw_mode, fw_rateunit, fw_ratemode; - struct port_info *pi; - struct tx_sched_class *tc; - - if (p->level == SCHED_CLASS_LEVEL_CL_RL) - fw_level = FW_SCHED_PARAMS_LEVEL_CL_RL; - else if (p->level == SCHED_CLASS_LEVEL_CL_WRR) - fw_level = FW_SCHED_PARAMS_LEVEL_CL_WRR; - else if (p->level == SCHED_CLASS_LEVEL_CH_RL) - fw_level = FW_SCHED_PARAMS_LEVEL_CH_RL; - else - return (EINVAL); - - if (p->mode == SCHED_CLASS_MODE_CLASS) - fw_mode = FW_SCHED_PARAMS_MODE_CLASS; - else if (p->mode == SCHED_CLASS_MODE_FLOW) - fw_mode = FW_SCHED_PARAMS_MODE_FLOW; - else - return (EINVAL); - - if (p->rateunit == SCHED_CLASS_RATEUNIT_BITS) - fw_rateunit = FW_SCHED_PARAMS_UNIT_BITRATE; - else if (p->rateunit == SCHED_CLASS_RATEUNIT_PKTS) - fw_rateunit = FW_SCHED_PARAMS_UNIT_PKTRATE; - else - return (EINVAL); - - if (p->ratemode == SCHED_CLASS_RATEMODE_REL) - fw_ratemode = FW_SCHED_PARAMS_RATE_REL; - else if (p->ratemode == SCHED_CLASS_RATEMODE_ABS) - fw_ratemode = FW_SCHED_PARAMS_RATE_ABS; - else - return (EINVAL); - - /* Vet our parameters ... */ - if (!in_range(p->channel, 0, sc->chip_params->nchan - 1)) - return (ERANGE); - - pi = sc->port[sc->chan_map[p->channel]]; - if (pi == NULL) - return (ENXIO); - MPASS(pi->tx_chan == p->channel); - top_speed = port_top_speed(pi) * 1000000; /* Gbps -> Kbps */ - - if (!in_range(p->cl, 0, sc->chip_params->nsched_cls) || - !in_range(p->minrate, 0, top_speed) || - !in_range(p->maxrate, 0, top_speed) || - !in_range(p->weight, 0, 100)) - return (ERANGE); - - /* - * Translate any unset parameters into the firmware's - * nomenclature and/or fail the call if the parameters - * are required ... - */ - if (p->rateunit < 0 || p->ratemode < 0 || p->channel < 0 || p->cl < 0) - return (EINVAL); - - if (p->minrate < 0) - p->minrate = 0; - if (p->maxrate < 0) { - if (p->level == SCHED_CLASS_LEVEL_CL_RL || - p->level == SCHED_CLASS_LEVEL_CH_RL) - return (EINVAL); - else - p->maxrate = 0; - } - if (p->weight < 0) { - if (p->level == SCHED_CLASS_LEVEL_CL_WRR) - return (EINVAL); - else - p->weight = 0; - } - if (p->pktsize < 0) { - if (p->level == SCHED_CLASS_LEVEL_CL_RL || - p->level == SCHED_CLASS_LEVEL_CH_RL) - return (EINVAL); - else - p->pktsize = 0; - } - - rc = begin_synchronized_op(sc, NULL, - sleep_ok ? (SLEEP_OK | INTR_OK) : HOLD_LOCK, "t4sscp"); - if (rc) - return (rc); - tc = &pi->tc[p->cl]; - tc->params = *p; - rc = -t4_sched_params(sc, FW_SCHED_TYPE_PKTSCHED, fw_level, fw_mode, - fw_rateunit, fw_ratemode, p->channel, p->cl, p->minrate, p->maxrate, - p->weight, p->pktsize, sleep_ok); - if (rc == 0) - tc->flags |= TX_SC_OK; - else { - /* - * Unknown state at this point, see tc->params for what was - * attempted. - */ - tc->flags &= ~TX_SC_OK; - } - end_synchronized_op(sc, sleep_ok ? 0 : LOCK_HELD); - - return (rc); -} - -int -t4_set_sched_class(struct adapter *sc, struct t4_sched_params *p) -{ - - if (p->type != SCHED_CLASS_TYPE_PACKET) - return (EINVAL); - - if (p->subcmd == SCHED_CLASS_SUBCMD_CONFIG) - return (set_sched_class_config(sc, p->u.config.minmax)); - - if (p->subcmd == SCHED_CLASS_SUBCMD_PARAMS) - return (set_sched_class_params(sc, &p->u.params, 1)); - - return (EINVAL); -} - -int -t4_set_sched_queue(struct adapter *sc, struct t4_sched_queue *p) -{ - struct port_info *pi = NULL; - struct vi_info *vi; - struct sge_txq *txq; - uint32_t fw_mnem, fw_queue, fw_class; - int i, rc; - - rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4setsq"); - if (rc) - return (rc); - - if (p->port >= sc->params.nports) { - rc = EINVAL; - goto done; - } - - /* XXX: Only supported for the main VI. */ - pi = sc->port[p->port]; - vi = &pi->vi[0]; - if (!(vi->flags & VI_INIT_DONE)) { - /* tx queues not set up yet */ - rc = EAGAIN; - goto done; - } - - if (!in_range(p->queue, 0, vi->ntxq - 1) || - !in_range(p->cl, 0, sc->chip_params->nsched_cls - 1)) { - rc = EINVAL; - goto done; - } - - /* - * Create a template for the FW_PARAMS_CMD mnemonic and value (TX - * Scheduling Class in this case). - */ - fw_mnem = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) | - V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH)); - fw_class = p->cl < 0 ? 0xffffffff : p->cl; - - /* - * If op.queue is non-negative, then we're only changing the scheduling - * on a single specified TX queue. - */ - if (p->queue >= 0) { - txq = &sc->sge.txq[vi->first_txq + p->queue]; - fw_queue = (fw_mnem | V_FW_PARAMS_PARAM_YZ(txq->eq.cntxt_id)); - rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &fw_queue, - &fw_class); - goto done; - } - - /* - * Change the scheduling on all the TX queues for the - * interface. - */ - for_each_txq(vi, i, txq) { - fw_queue = (fw_mnem | V_FW_PARAMS_PARAM_YZ(txq->eq.cntxt_id)); - rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &fw_queue, - &fw_class); - if (rc) - goto done; - } - - rc = 0; -done: - end_synchronized_op(sc, 0); - return (rc); -} - int t4_os_find_pci_capability(struct adapter *sc, int cap) { Added: head/sys/dev/cxgbe/t4_sched.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/cxgbe/t4_sched.c Tue May 2 20:38:10 2017 (r317702) @@ -0,0 +1,461 @@ +/*- + * Copyright (c) 2017 Chelsio Communications, Inc. + * All rights reserved. + * Written by: Navdeep Parhar + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_inet.h" +#include "opt_inet6.h" + +#include +#include +#include +#include +#include +#include + +#include "common/common.h" +#include "common/t4_regs.h" +#include "common/t4_regs_values.h" +#include "common/t4_msg.h" + + +static int +in_range(int val, int lo, int hi) +{ + + return (val < 0 || (val <= hi && val >= lo)); +} + +static int +set_sched_class_config(struct adapter *sc, int minmax) +{ + int rc; + + if (minmax < 0) + return (EINVAL); + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4sscc"); + if (rc) + return (rc); + rc = -t4_sched_config(sc, FW_SCHED_TYPE_PKTSCHED, minmax, 1); + end_synchronized_op(sc, 0); + + return (rc); +} + +static int +set_sched_class_params(struct adapter *sc, struct t4_sched_class_params *p, + int sleep_ok) +{ + int rc, top_speed, fw_level, fw_mode, fw_rateunit, fw_ratemode; + struct port_info *pi; + struct tx_cl_rl_params *tc; + + if (p->level == SCHED_CLASS_LEVEL_CL_RL) + fw_level = FW_SCHED_PARAMS_LEVEL_CL_RL; + else if (p->level == SCHED_CLASS_LEVEL_CL_WRR) + fw_level = FW_SCHED_PARAMS_LEVEL_CL_WRR; + else if (p->level == SCHED_CLASS_LEVEL_CH_RL) + fw_level = FW_SCHED_PARAMS_LEVEL_CH_RL; + else + return (EINVAL); + + if (p->mode == SCHED_CLASS_MODE_CLASS) + fw_mode = FW_SCHED_PARAMS_MODE_CLASS; + else if (p->mode == SCHED_CLASS_MODE_FLOW) + fw_mode = FW_SCHED_PARAMS_MODE_FLOW; + else + return (EINVAL); + + if (p->rateunit == SCHED_CLASS_RATEUNIT_BITS) + fw_rateunit = FW_SCHED_PARAMS_UNIT_BITRATE; + else if (p->rateunit == SCHED_CLASS_RATEUNIT_PKTS) + fw_rateunit = FW_SCHED_PARAMS_UNIT_PKTRATE; + else + return (EINVAL); + + if (p->ratemode == SCHED_CLASS_RATEMODE_REL) + fw_ratemode = FW_SCHED_PARAMS_RATE_REL; + else if (p->ratemode == SCHED_CLASS_RATEMODE_ABS) + fw_ratemode = FW_SCHED_PARAMS_RATE_ABS; + else + return (EINVAL); + + /* Vet our parameters ... */ + if (!in_range(p->channel, 0, sc->chip_params->nchan - 1)) + return (ERANGE); + + pi = sc->port[sc->chan_map[p->channel]]; + if (pi == NULL) + return (ENXIO); + MPASS(pi->tx_chan == p->channel); + top_speed = port_top_speed(pi) * 1000000; /* Gbps -> Kbps */ + + if (!in_range(p->cl, 0, sc->chip_params->nsched_cls) || + !in_range(p->minrate, 0, top_speed) || + !in_range(p->maxrate, 0, top_speed) || + !in_range(p->weight, 0, 100)) + return (ERANGE); + + /* + * Translate any unset parameters into the firmware's + * nomenclature and/or fail the call if the parameters + * are required ... + */ + if (p->rateunit < 0 || p->ratemode < 0 || p->channel < 0 || p->cl < 0) + return (EINVAL); + + if (p->minrate < 0) + p->minrate = 0; + if (p->maxrate < 0) { + if (p->level == SCHED_CLASS_LEVEL_CL_RL || + p->level == SCHED_CLASS_LEVEL_CH_RL) + return (EINVAL); + else + p->maxrate = 0; + } + if (p->weight < 0) { + if (p->level == SCHED_CLASS_LEVEL_CL_WRR) + return (EINVAL); + else + p->weight = 0; + } + if (p->pktsize < 0) { + if (p->level == SCHED_CLASS_LEVEL_CL_RL || + p->level == SCHED_CLASS_LEVEL_CH_RL) + return (EINVAL); + else + p->pktsize = 0; + } + + rc = begin_synchronized_op(sc, NULL, + sleep_ok ? (SLEEP_OK | INTR_OK) : HOLD_LOCK, "t4sscp"); + if (rc) + return (rc); + if (p->level == SCHED_CLASS_LEVEL_CL_RL) { + tc = &pi->sched_params->cl_rl[p->cl]; + if (tc->refcount > 0) { + rc = EBUSY; + goto done; + } else { + tc->ratemode = fw_ratemode; + tc->rateunit = fw_rateunit; + tc->mode = fw_mode; + tc->maxrate = p->maxrate; + tc->pktsize = p->pktsize; + } + } + rc = -t4_sched_params(sc, FW_SCHED_TYPE_PKTSCHED, fw_level, fw_mode, + fw_rateunit, fw_ratemode, p->channel, p->cl, p->minrate, p->maxrate, + p->weight, p->pktsize, sleep_ok); + if (p->level == SCHED_CLASS_LEVEL_CL_RL && rc != 0) { + /* + * Unknown state at this point, see parameters in tc for what + * was attempted. + */ + tc->flags |= TX_CLRL_ERROR; + } +done: + end_synchronized_op(sc, sleep_ok ? 0 : LOCK_HELD); + + return (rc); +} + +static void +update_tx_sched(void *context, int pending) +{ + int i, j, mode, rateunit, ratemode, maxrate, pktsize, rc; + struct port_info *pi; + struct tx_cl_rl_params *tc; + struct adapter *sc = context; + const int n = sc->chip_params->nsched_cls; + + mtx_lock(&sc->tc_lock); + for_each_port(sc, i) { + pi = sc->port[i]; + tc = &pi->sched_params->cl_rl[0]; + for (j = 0; j < n; j++, tc++) { + MPASS(mtx_owned(&sc->tc_lock)); + if ((tc->flags & TX_CLRL_REFRESH) == 0) + continue; + + mode = tc->mode; + rateunit = tc->rateunit; + ratemode = tc->ratemode; + maxrate = tc->maxrate; + pktsize = tc->pktsize; + mtx_unlock(&sc->tc_lock); + + if (begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, + "t4utxs") != 0) { + mtx_lock(&sc->tc_lock); + continue; + } + rc = t4_sched_params(sc, FW_SCHED_TYPE_PKTSCHED, + FW_SCHED_PARAMS_LEVEL_CL_RL, mode, rateunit, + ratemode, pi->tx_chan, j, 0, maxrate, 0, pktsize, + 1); + end_synchronized_op(sc, 0); + + mtx_lock(&sc->tc_lock); + if (rc != 0) { + tc->flags |= TX_CLRL_ERROR; + } else if (tc->mode == mode && + tc->rateunit == rateunit && + tc->maxrate == maxrate && + tc->pktsize == tc->pktsize) { + tc->flags &= ~(TX_CLRL_REFRESH | TX_CLRL_ERROR); + } + } + } + mtx_unlock(&sc->tc_lock); +} + +int +t4_set_sched_class(struct adapter *sc, struct t4_sched_params *p) +{ + + if (p->type != SCHED_CLASS_TYPE_PACKET) + return (EINVAL); + + if (p->subcmd == SCHED_CLASS_SUBCMD_CONFIG) + return (set_sched_class_config(sc, p->u.config.minmax)); + + if (p->subcmd == SCHED_CLASS_SUBCMD_PARAMS) + return (set_sched_class_params(sc, &p->u.params, 1)); + + return (EINVAL); +} + +int +t4_set_sched_queue(struct adapter *sc, struct t4_sched_queue *p) +{ + struct port_info *pi = NULL; + struct vi_info *vi; + struct sge_txq *txq; + uint32_t fw_mnem, fw_queue, fw_class; + int i, rc; + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4setsq"); + if (rc) + return (rc); + + if (p->port >= sc->params.nports) { + rc = EINVAL; + goto done; + } + + /* XXX: Only supported for the main VI. */ + pi = sc->port[p->port]; + vi = &pi->vi[0]; + if (!(vi->flags & VI_INIT_DONE)) { + /* tx queues not set up yet */ + rc = EAGAIN; + goto done; + } + + if (!in_range(p->queue, 0, vi->ntxq - 1) || + !in_range(p->cl, 0, sc->chip_params->nsched_cls - 1)) { + rc = EINVAL; + goto done; + } + + /* + * Create a template for the FW_PARAMS_CMD mnemonic and value (TX + * Scheduling Class in this case). + */ + fw_mnem = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DMAQ) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH)); + fw_class = p->cl < 0 ? 0xffffffff : p->cl; + + /* + * If op.queue is non-negative, then we're only changing the scheduling + * on a single specified TX queue. + */ + if (p->queue >= 0) { + txq = &sc->sge.txq[vi->first_txq + p->queue]; + fw_queue = (fw_mnem | V_FW_PARAMS_PARAM_YZ(txq->eq.cntxt_id)); + rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &fw_queue, + &fw_class); + goto done; + } + + /* + * Change the scheduling on all the TX queues for the + * interface. + */ + for_each_txq(vi, i, txq) { + fw_queue = (fw_mnem | V_FW_PARAMS_PARAM_YZ(txq->eq.cntxt_id)); + rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, &fw_queue, + &fw_class); + if (rc) + goto done; + } + + rc = 0; +done: + end_synchronized_op(sc, 0); + return (rc); +} + +int +t4_init_tx_sched(struct adapter *sc) +{ + int i, j; + const int n = sc->chip_params->nsched_cls; + struct port_info *pi; + struct tx_cl_rl_params *tc; + static const uint32_t init_kbps[] = { + 100 * 1000, + 200 * 1000, + 400 * 1000, + 500 * 1000, + 800 * 1000, + 1000 * 1000, + 1200 * 1000, + 1500 * 1000, + 1800 * 1000, + 2000 * 1000, + 2500 * 1000, + 3000 * 1000, + 3500 * 1000, + 4000 * 1000, + 5000 * 1000, + 10000 * 1000 + }; + + mtx_init(&sc->tc_lock, "tx_sched lock", NULL, MTX_DEF); + TASK_INIT(&sc->tc_task, 0, update_tx_sched, sc); + for_each_port(sc, i) { + pi = sc->port[i]; + pi->sched_params = malloc(sizeof(*pi->sched_params) + + n * sizeof(*tc), M_CXGBE, M_ZERO | M_WAITOK); + tc = &pi->sched_params->cl_rl[0]; + for (j = 0; j < n; j++, tc++) { + tc->flags = TX_CLRL_REFRESH; + tc->refcount = 0; + tc->ratemode = FW_SCHED_PARAMS_RATE_ABS; + tc->rateunit = FW_SCHED_PARAMS_UNIT_BITRATE; + tc->mode = FW_SCHED_PARAMS_MODE_FLOW; + tc->maxrate = init_kbps[min(j, nitems(init_kbps) - 1)]; + tc->pktsize = ETHERMTU; /* XXX */ + + t4_sched_params_cl_rl_kbps(sc, pi->tx_chan, j, tc->mode, + tc->maxrate, tc->pktsize, 1); + } + } + + return (0); +} + +int +t4_free_tx_sched(struct adapter *sc) +{ + int i; + + taskqueue_drain(taskqueue_thread, &sc->tc_task); + + for_each_port(sc, i) + free(sc->port[i]->sched_params, M_CXGBE); + + if (mtx_initialized(&sc->tc_lock)) + mtx_destroy(&sc->tc_lock); + + return (0); +} + +void +t4_update_tx_sched(struct adapter *sc) +{ + + taskqueue_enqueue(taskqueue_thread, &sc->tc_task); +} + +int +t4_reserve_cl_rl_kbps(struct adapter *sc, int port_id, u_int maxrate, + int *tc_idx) +{ + int rc = 0, fa = -1, i; + struct tx_cl_rl_params *tc; + + MPASS(port_id >= 0 && port_id < sc->params.nports); + + tc = &sc->port[port_id]->sched_params->cl_rl[0]; + mtx_lock(&sc->tc_lock); + for (i = 0; i < sc->chip_params->nsched_cls; i++, tc++) { + if (fa < 0 && tc->refcount == 0) + fa = i; + + if (tc->ratemode == FW_SCHED_PARAMS_RATE_ABS && + tc->rateunit == FW_SCHED_PARAMS_UNIT_BITRATE && + tc->mode == FW_SCHED_PARAMS_MODE_FLOW && + tc->maxrate == maxrate) { + tc->refcount++; + *tc_idx = i; + goto done; + } + } + /* Not found */ + MPASS(i == sc->chip_params->nsched_cls); + if (fa != -1) { + tc = &sc->port[port_id]->sched_params->cl_rl[fa]; + tc->flags = TX_CLRL_REFRESH; + tc->refcount = 1; + tc->ratemode = FW_SCHED_PARAMS_RATE_ABS; + tc->rateunit = FW_SCHED_PARAMS_UNIT_BITRATE; + tc->mode = FW_SCHED_PARAMS_MODE_FLOW; + tc->maxrate = maxrate; + tc->pktsize = ETHERMTU; /* XXX */ + *tc_idx = fa; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue May 2 20:39:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8DA5D5B890; Tue, 2 May 2017 20:39:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B234F1252; Tue, 2 May 2017 20:39:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42KdY8F054096; Tue, 2 May 2017 20:39:34 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42KdXn2054086; Tue, 2 May 2017 20:39:33 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705022039.v42KdXn2054086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 May 2017 20:39:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317703 - in head: contrib/netbsd-tests/usr.bin/grep usr.bin/grep usr.bin/grep/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 20:39:36 -0000 Author: emaste Date: Tue May 2 20:39:33 2017 New Revision: 317703 URL: https://svnweb.freebsd.org/changeset/base/317703 Log: bsdgrep: fix -w flag matching with an empty pattern -w flag matching with an empty pattern was generally 'broken', allowing matches to occur on any line whether or not it actually matches -w criteria. This fix required a good amount of refactoring to address. procline() is altered to *only* process the line and return whether it was a match or not, necessary to be able to short-circuit the whole function in case of this matchall flag. -m flag handling is moved out as well because it suffers from the same fate as context handling if we bypass any actual pattern matching. The matching context (matches, mostly) didn't previously exist outside of procline(), so we go ahead and create context object for file processing bits to pass around. grep_printline() was created due to this, for the scenarios where the matches don't actually matter and we just want to print a line or two, a la flushing the context queue and no -o or --color specified. Damage from this broken behavior would have been mitigated by the fact that it is unlikely users would invoke grep -w with an empty pattern. This was identified while checking PR 105221 for problems it this may cause in BSD grep, but PR 105221 is *not* a report of this behavior. Submitted by: Kyle Evans Differential Revision: https://reviews.freebsd.org/D10433 Added: head/contrib/netbsd-tests/usr.bin/grep/d_context_e.in (contents, props changed) head/contrib/netbsd-tests/usr.bin/grep/d_context_e.out (contents, props changed) head/contrib/netbsd-tests/usr.bin/grep/d_context_f.out (contents, props changed) head/contrib/netbsd-tests/usr.bin/grep/d_context_g.out (contents, props changed) Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh head/usr.bin/grep/grep.c head/usr.bin/grep/grep.h head/usr.bin/grep/queue.c head/usr.bin/grep/tests/Makefile head/usr.bin/grep/util.c Added: head/contrib/netbsd-tests/usr.bin/grep/d_context_e.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/netbsd-tests/usr.bin/grep/d_context_e.in Tue May 2 20:39:33 2017 (r317703) @@ -0,0 +1,10 @@ +monkey +banana +apple +fruit +monkey +banna +apple +fruit +apple +monkey Added: head/contrib/netbsd-tests/usr.bin/grep/d_context_e.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/netbsd-tests/usr.bin/grep/d_context_e.out Tue May 2 20:39:33 2017 (r317703) @@ -0,0 +1,9 @@ +monkey +banana +apple +fruit +monkey +banna +-- +apple +monkey Added: head/contrib/netbsd-tests/usr.bin/grep/d_context_f.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/netbsd-tests/usr.bin/grep/d_context_f.out Tue May 2 20:39:33 2017 (r317703) @@ -0,0 +1,9 @@ +monkey +banana +apple +fruit +monkey +banna +apple +fruit +apple Added: head/contrib/netbsd-tests/usr.bin/grep/d_context_g.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/netbsd-tests/usr.bin/grep/d_context_g.out Tue May 2 20:39:33 2017 (r317703) @@ -0,0 +1,8 @@ +apple +fruit +-- +banna +apple +fruit +apple +monkey Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Tue May 2 20:38:10 2017 (r317702) +++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Tue May 2 20:39:33 2017 (r317703) @@ -171,6 +171,12 @@ context_body() atf_check -o file:d_context_b.out grep -A3 tilt d_context_a.in atf_check -o file:d_context_c.out grep -B4 Whig d_context_a.in atf_check -o file:d_context_d.out grep -C1 pig d_context_a.in d_context_b.in + atf_check -o file:d_context_e.out \ + grep -E -C1 '(banana|monkey)' d_context_e.in + atf_check -o file:d_context_f.out \ + grep -Ev -B2 '(banana|monkey|fruit)' d_context_e.in + atf_check -o file:d_context_g.out \ + grep -Ev -A1 '(banana|monkey|fruit)' d_context_e.in } atf_test_case file_exp @@ -386,6 +392,32 @@ zerolen_body() atf_check -o inline:"Eggs\nCheese\n" grep -v -e "^$" test1 } +atf_test_case wflag_emptypat +wflag_emptypat_head() +{ + atf_set "descr" "Check for proper handling of -w with an empty pattern (PR 105221)" +} +wflag_emptypat_body() +{ + grep_type + if [ $? -eq $GREP_TYPE_GNU_FREEBSD ]; then + atf_expect_fail "this test does not pass with GNU grep in base" + fi + + printf "" > test1 + printf "\n" > test2 + printf "qaz" > test3 + printf " qaz\n" > test4 + + atf_check -s exit:1 -o empty grep -w -e "" test1 + + atf_check -o file:test2 grep -w -e "" test2 + + atf_check -s exit:1 -o empty grep -w -e "" test3 + + atf_check -o file:test4 grep -w -e "" test4 +} + atf_test_case fgrep_sanity fgrep_sanity_head() { @@ -490,6 +522,7 @@ atf_init_test_cases() atf_add_test_case escmap atf_add_test_case egrep_empty_invalid atf_add_test_case zerolen + atf_add_test_case wflag_emptypat atf_add_test_case wv_combo_break atf_add_test_case fgrep_sanity atf_add_test_case egrep_sanity Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Tue May 2 20:38:10 2017 (r317702) +++ head/usr.bin/grep/grep.c Tue May 2 20:39:33 2017 (r317703) @@ -81,7 +81,13 @@ const char *errstr[] = { int cflags = REG_NOSUB; int eflags = REG_STARTEND; -/* Shortcut for matching all cases like empty regex */ +/* XXX TODO: Get rid of this flag. + * matchall is a gross hack that means that an empty pattern was passed to us. + * It is a necessary evil at the moment because our regex(3) implementation + * does not allow for empty patterns, as supported by POSIX's definition of + * grammar for BREs/EREs. When libregex becomes available, it would be wise + * to remove this and let regex(3) handle the dirty details of empty patterns. + */ bool matchall; /* Searching patterns */ @@ -153,9 +159,6 @@ enum { static inline const char *init_color(const char *); /* Housekeeping */ -bool first = true; /* flag whether we are processing the first match */ -bool prev; /* flag whether or not the previous line matched */ -int tail; /* lines left to print */ bool file_err; /* file reading error */ /* @@ -729,20 +732,25 @@ main(int argc, char *argv[]) #endif r_pattern = grep_calloc(patterns, sizeof(*r_pattern)); - /* Check if cheating is allowed (always is for fgrep). */ - for (i = 0; i < patterns; ++i) { + /* Don't process any patterns if we have a blank one */ + if (!matchall) { + /* Check if cheating is allowed (always is for fgrep). */ + for (i = 0; i < patterns; ++i) { #ifndef WITHOUT_FASTMATCH - /* Attempt compilation with fastmatch regex and fallback to - regex(3) if it fails. */ - if (fastncomp(&fg_pattern[i], pattern[i].pat, - pattern[i].len, cflags) == 0) - continue; + /* + * Attempt compilation with fastmatch regex and + * fallback to regex(3) if it fails. + */ + if (fastncomp(&fg_pattern[i], pattern[i].pat, + pattern[i].len, cflags) == 0) + continue; #endif - c = regcomp(&r_pattern[i], pattern[i].pat, cflags); - if (c != 0) { - regerror(c, &r_pattern[i], re_error, - RE_ERROR_BUF); - errx(2, "%s", re_error); + c = regcomp(&r_pattern[i], pattern[i].pat, cflags); + if (c != 0) { + regerror(c, &r_pattern[i], re_error, + RE_ERROR_BUF); + errx(2, "%s", re_error); + } } } Modified: head/usr.bin/grep/grep.h ============================================================================== --- head/usr.bin/grep/grep.h Tue May 2 20:38:10 2017 (r317702) +++ head/usr.bin/grep/grep.h Tue May 2 20:39:33 2017 (r317703) @@ -123,8 +123,7 @@ extern char *label; extern const char *color; extern int binbehave, devbehave, dirbehave, filebehave, grepbehave, linkbehave; -extern bool file_err, first, matchall, prev; -extern int tail; +extern bool file_err, matchall; extern unsigned int dpatterns, fpatterns, patterns; extern struct pat *pattern; extern struct epat *dpattern, *fpattern; @@ -145,10 +144,10 @@ void *grep_malloc(size_t size); void *grep_calloc(size_t nmemb, size_t size); void *grep_realloc(void *ptr, size_t size); char *grep_strdup(const char *str); -void printline(struct str *line, int sep, regmatch_t *matches, int m); +void grep_printline(struct str *line, int sep); /* queue.c */ -void enqueue(struct str *x); +bool enqueue(struct str *x); void printqueue(void); void clearqueue(void); Modified: head/usr.bin/grep/queue.c ============================================================================== --- head/usr.bin/grep/queue.c Tue May 2 20:38:10 2017 (r317702) +++ head/usr.bin/grep/queue.c Tue May 2 20:39:33 2017 (r317703) @@ -53,7 +53,10 @@ static unsigned long long count; static struct qentry *dequeue(void); -void +/* + * Enqueue another line; return true if we've dequeued a line as a result + */ +bool enqueue(struct str *x) { struct qentry *item; @@ -72,7 +75,9 @@ enqueue(struct str *x) item = dequeue(); free(item->data.dat); free(item); + return (true); } + return (false); } static struct qentry * @@ -95,7 +100,7 @@ printqueue(void) struct qentry *item; while ((item = dequeue()) != NULL) { - printline(&item->data, '-', NULL, 0); + grep_printline(&item->data, '-'); free(item->data.dat); free(item); } Modified: head/usr.bin/grep/tests/Makefile ============================================================================== --- head/usr.bin/grep/tests/Makefile Tue May 2 20:38:10 2017 (r317702) +++ head/usr.bin/grep/tests/Makefile Tue May 2 20:39:33 2017 (r317703) @@ -20,9 +20,13 @@ ${PACKAGE}FILES+= d_context2_c.out ${PACKAGE}FILES+= d_context_a.in ${PACKAGE}FILES+= d_context_a.out ${PACKAGE}FILES+= d_context_b.in +${PACKAGE}FILES+= d_context_e.in ${PACKAGE}FILES+= d_context_b.out ${PACKAGE}FILES+= d_context_c.out ${PACKAGE}FILES+= d_context_d.out +${PACKAGE}FILES+= d_context_e.out +${PACKAGE}FILES+= d_context_f.out +${PACKAGE}FILES+= d_context_g.out ${PACKAGE}FILES+= d_egrep.out ${PACKAGE}FILES+= d_escmap.in ${PACKAGE}FILES+= d_f_file_empty.in Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Tue May 2 20:38:10 2017 (r317702) +++ head/usr.bin/grep/util.c Tue May 2 20:39:33 2017 (r317703) @@ -54,11 +54,23 @@ __FBSDID("$FreeBSD$"); #endif #include "grep.h" -static int linesqueued; -static int procline(struct str *l, int); +static bool first_match = true; + +/* + * Parsing context; used to hold things like matches made and + * other useful bits + */ +struct parsec { + regmatch_t matches[MAX_LINE_MATCHES]; /* Matches made */ + struct str ln; /* Current line */ + size_t matchidx; /* Latest used match index */ + bool binary; /* Binary file? */ +}; -static int lasta; -static bool ctxover; + +static int procline(struct parsec *pc); +static void printline(struct parsec *pc, int sep); +static void printline_metadata(struct str *line, int sep); bool file_matching(const char *fname) @@ -183,12 +195,18 @@ grep_tree(char **argv) int procfile(const char *fn) { + struct parsec pc; struct file *f; struct stat sb; - struct str ln; + struct str *ln; mode_t s; - int c, t; + int c, last_outed, t, tail; + bool doctx, same_file; + doctx = false; + if ((!pc.binary || binbehave != BINFILE_BIN) && !cflag && !qflag && + !lflag && !Lflag && (Aflag != 0 || Bflag != 0)) + doctx = true; mcount = mlimit; if (strcmp(fn, "-") == 0) { @@ -213,57 +231,91 @@ procfile(const char *fn) return (0); } - ln.file = grep_malloc(strlen(fn) + 1); - strcpy(ln.file, fn); - ln.line_no = 0; - ln.len = 0; - ctxover = false; - linesqueued = 0; + /* Convenience */ + ln = &pc.ln; + pc.ln.file = grep_malloc(strlen(fn) + 1); + strcpy(pc.ln.file, fn); + pc.ln.line_no = 0; + pc.ln.len = 0; + pc.ln.off = -1; + pc.binary = f->binary; tail = 0; - lasta = 0; - ln.off = -1; + last_outed = 0; + same_file = false; for (c = 0; c == 0 || !(lflag || qflag); ) { - ln.off += ln.len + 1; - if ((ln.dat = grep_fgetln(f, &ln.len)) == NULL || ln.len == 0) { - if (ln.line_no == 0 && matchall) - exit(0); + /* Reset match count for every line processed */ + pc.matchidx = 0; + pc.ln.off += pc.ln.len + 1; + if ((pc.ln.dat = grep_fgetln(f, &pc.ln.len)) == NULL || + pc.ln.len == 0) { + if (pc.ln.line_no == 0 && matchall) + /* + * An empty file with an empty pattern and the + * -w flag does not match + */ + exit(matchall && wflag ? 1 : 0); else break; } - if (ln.len > 0 && ln.dat[ln.len - 1] == fileeol) - --ln.len; - ln.line_no++; + + if (pc.ln.len > 0 && pc.ln.dat[pc.ln.len - 1] == fileeol) + --pc.ln.len; + pc.ln.line_no++; /* Return if we need to skip a binary file */ - if (f->binary && binbehave == BINFILE_SKIP) { + if (pc.binary && binbehave == BINFILE_SKIP) { grep_close(f); - free(ln.file); + free(pc.ln.file); free(f); return (0); } - /* Process the file line-by-line, enqueue non-matching lines */ - if ((t = procline(&ln, f->binary)) == 0 && Bflag > 0) { - /* Except don't enqueue lines that appear in -A ctx */ - if (ln.line_no == 0 || lasta != ln.line_no) { - /* queue is maxed to Bflag number of lines */ - enqueue(&ln); - linesqueued++; - ctxover = false; + if ((t = procline(&pc)) == 0) + ++c; + + /* Deal with any -B context or context separators */ + if (t == 0 && doctx) { + if (!first_match && (!same_file || last_outed > 0)) + printf("--\n"); + if (Bflag > 0) + printqueue(); + tail = Aflag; + } + /* Print the matching line, but only if not quiet/binary */ + if (t == 0 && !qflag && !pc.binary) { + printline(&pc, ':'); + first_match = false; + same_file = true; + last_outed = 0; + } + if (t != 0 && doctx) { + /* Deal with any -A context */ + if (tail > 0) { + printline(&pc, '-'); + tail--; + if (Bflag > 0) + clearqueue(); } else { /* - * Indicate to procline() that we have ctx - * overlap and make sure queue is empty. + * Enqueue non-matching lines for -B context. + * If we're not actually doing -B context or if + * the enqueue resulted in a line being rotated + * out, then go ahead and increment last_outed + * to signify a gap between context/match. */ - if (!ctxover) - clearqueue(); - ctxover = true; + if (Bflag == 0 || (Bflag > 0 && enqueue(ln))) + ++last_outed; } } - c += t; - if (mflag && mcount <= 0) - break; + + /* Count the matches if we have a match limit */ + if (t == 0 && mflag) { + --mcount; + if (mflag && mcount <= 0) + break; + } + } if (Bflag > 0) clearqueue(); @@ -271,7 +323,7 @@ procfile(const char *fn) if (cflag) { if (!hflag) - printf("%s:", ln.file); + printf("%s:", pc.ln.file); printf("%u\n", c); } if (lflag && !qflag && c != 0) @@ -282,7 +334,7 @@ procfile(const char *fn) binbehave == BINFILE_BIN && f->binary && !qflag) printf(getstr(8), fn); - free(ln.file); + free(pc.ln.file); free(f); return (c); } @@ -297,62 +349,72 @@ procfile(const char *fn) * appropriate output. */ static int -procline(struct str *l, int nottext) +procline(struct parsec *pc) { - regmatch_t matches[MAX_LINE_MATCHES]; - regmatch_t pmatch, lastmatch; + regmatch_t pmatch, lastmatch, chkmatch; + wchar_t wbegin, wend; size_t st = 0, nst = 0; unsigned int i; - int c = 0, m = 0, r = 0, lastmatches = 0, leflags = eflags; - int startm = 0; + int c = 0, r = 0, lastmatches = 0, leflags = eflags; + size_t startm = 0, matchidx; int retry; + matchidx = pc->matchidx; + + /* Special case: empty pattern with -w flag, check first character */ + if (matchall && wflag) { + if (pc->ln.len == 0) + return (0); + wend = L' '; + if (sscanf(&pc->ln.dat[0], "%lc", &wend) != 1 || iswword(wend)) + return (1); + else + return (0); + } else if (matchall) + return (0); + /* Initialize to avoid a false positive warning from GCC. */ lastmatch.rm_so = lastmatch.rm_eo = 0; /* Loop to process the whole line */ - while (st <= l->len) { + while (st <= pc->ln.len) { lastmatches = 0; - startm = m; + startm = matchidx; retry = 0; if (st > 0) leflags |= REG_NOTBOL; /* Loop to compare with all the patterns */ for (i = 0; i < patterns; i++) { pmatch.rm_so = st; - pmatch.rm_eo = l->len; + pmatch.rm_eo = pc->ln.len; #ifndef WITHOUT_FASTMATCH if (fg_pattern[i].pattern) r = fastexec(&fg_pattern[i], - l->dat, 1, &pmatch, leflags); + pc->ln.dat, 1, &pmatch, leflags); else #endif - r = regexec(&r_pattern[i], l->dat, 1, + r = regexec(&r_pattern[i], pc->ln.dat, 1, &pmatch, leflags); - r = (r == 0) ? 0 : REG_NOMATCH; - if (r == REG_NOMATCH) + if (r != 0) continue; /* Check for full match */ - if (r == 0 && xflag) - if (pmatch.rm_so != 0 || - (size_t)pmatch.rm_eo != l->len) - r = REG_NOMATCH; + if (xflag && (pmatch.rm_so != 0 || + (size_t)pmatch.rm_eo != pc->ln.len)) + continue; /* Check for whole word match */ #ifndef WITHOUT_FASTMATCH - if (r == 0 && (wflag || fg_pattern[i].word)) { + if (wflag || fg_pattern[i].word) { #else - if (r == 0 && wflag) { + if (wflag) { #endif - wchar_t wbegin, wend; - wbegin = wend = L' '; if (pmatch.rm_so != 0 && - sscanf(&l->dat[pmatch.rm_so - 1], + sscanf(&pc->ln.dat[pmatch.rm_so - 1], "%lc", &wbegin) != 1) r = REG_NOMATCH; else if ((size_t)pmatch.rm_eo != - l->len && - sscanf(&l->dat[pmatch.rm_eo], + pc->ln.len && + sscanf(&pc->ln.dat[pmatch.rm_eo], "%lc", &wend) != 1) r = REG_NOMATCH; else if (iswword(wbegin) || @@ -361,7 +423,7 @@ procline(struct str *l, int nottext) /* * If we're doing whole word matching and we * matched once, then we should try the pattern - * again after advancing just past the start of + * again after advancing just past the start of * the earliest match. This allows the pattern * to match later on in the line and possibly * still match a whole word. @@ -369,33 +431,40 @@ procline(struct str *l, int nottext) if (r == REG_NOMATCH && (retry == 0 || pmatch.rm_so + 1 < retry)) retry = pmatch.rm_so + 1; + if (r == REG_NOMATCH) + continue; } - if (r == 0) { - lastmatches++; - lastmatch = pmatch; - if (m == 0) - c++; - - if (m < MAX_LINE_MATCHES) { - /* Replace previous match if the new one is earlier and/or longer */ - if (m > startm) { - if (pmatch.rm_so < matches[m-1].rm_so || - (pmatch.rm_so == matches[m-1].rm_so && (pmatch.rm_eo - pmatch.rm_so) > (matches[m-1].rm_eo - matches[m-1].rm_so))) { - matches[m-1] = pmatch; - nst = pmatch.rm_eo; - } - } else { - /* Advance as normal if not */ - matches[m++] = pmatch; - nst = pmatch.rm_eo; - } - } - /* matches - skip further patterns */ - if ((color == NULL && !oflag) || - qflag || lflag) - break; + lastmatches++; + lastmatch = pmatch; + + if (matchidx == 0) + c++; + + /* + * Replace previous match if the new one is earlier + * and/or longer. This will lead to some amount of + * extra work if -o/--color are specified, but it's + * worth it from a correctness point of view. + */ + if (matchidx > startm) { + chkmatch = pc->matches[matchidx - 1]; + if (pmatch.rm_so < chkmatch.rm_so || + (pmatch.rm_so == chkmatch.rm_so && + (pmatch.rm_eo - pmatch.rm_so) > + (chkmatch.rm_eo - chkmatch.rm_so))) { + pc->matches[matchidx - 1] = pmatch; + nst = pmatch.rm_eo; + } + } else { + /* Advance as normal if not */ + pc->matches[matchidx++] = pmatch; + nst = pmatch.rm_eo; } + /* avoid excessive matching - skip further patterns */ + if ((color == NULL && !oflag) || qflag || lflag || + matchidx >= MAX_LINE_MATCHES) + break; } /* @@ -414,7 +483,7 @@ procline(struct str *l, int nottext) /* If we didn't have any matches or REG_NOSUB set */ if (lastmatches == 0 || (cflags & REG_NOSUB)) - nst = l->len; + nst = pc->ln.len; if (lastmatches == 0) /* No matches */ @@ -427,45 +496,11 @@ procline(struct str *l, int nottext) st = nst; } - + /* Reflect the new matchidx in the context */ + pc->matchidx = matchidx; if (vflag) c = !c; - - /* Count the matches if we have a match limit */ - if (mflag) - mcount -= c; - - if (c && binbehave == BINFILE_BIN && nottext) - return (c); /* Binary file */ - - /* Dealing with the context */ - if ((tail || c) && !cflag && !qflag && !lflag && !Lflag) { - if (c) { - if (!first && !prev && !tail && (Bflag || Aflag) && - !ctxover) - printf("--\n"); - tail = Aflag; - if (Bflag > 0) { - printqueue(); - ctxover = false; - } - linesqueued = 0; - printline(l, ':', matches, m); - } else { - /* Print -A lines following matches */ - lasta = l->line_no; - printline(l, '-', matches, m); - tail--; - } - } - - if (c) { - prev = true; - first = false; - } else - prev = false; - - return (c); + return (c ? 0 : 1); } /* @@ -520,69 +555,89 @@ grep_strdup(const char *str) } /* - * Prints a matching line according to the command line options. + * Print an entire line as-is, there are no inline matches to consider. This is + * used for printing context. */ -void -printline(struct str *line, int sep, regmatch_t *matches, int m) -{ - size_t a = 0; - int i, n = 0; +void grep_printline(struct str *line, int sep) { + printline_metadata(line, sep); + fwrite(line->dat, line->len, 1, stdout); + putchar(fileeol); +} - /* If matchall, everything matches but don't actually print for -o */ - if (oflag && matchall) - return; +static void +printline_metadata(struct str *line, int sep) +{ + bool printsep; + printsep = false; if (!hflag) { if (!nullflag) { fputs(line->file, stdout); - ++n; + printsep = true; } else { printf("%s", line->file); putchar(0); } } if (nflag) { - if (n > 0) + if (printsep) putchar(sep); printf("%d", line->line_no); - ++n; + printsep = true; } if (bflag) { - if (n > 0) + if (printsep) putchar(sep); printf("%lld", (long long)line->off); - ++n; + printsep = true; } - if (n) + if (printsep) putchar(sep); +} + +/* + * Prints a matching line according to the command line options. + */ +static void +printline(struct parsec *pc, int sep) +{ + size_t a = 0; + size_t i, matchidx; + regmatch_t match; + + /* If matchall, everything matches but don't actually print for -o */ + if (oflag && matchall) + return; + + matchidx = pc->matchidx; + /* --color and -o */ - if ((oflag || color) && m > 0) { - for (i = 0; i < m; i++) { + if ((oflag || color) && matchidx > 0) { + printline_metadata(&pc->ln, sep); + for (i = 0; i < matchidx; i++) { + match = pc->matches[i]; /* Don't output zero length matches */ - if (matches[i].rm_so == matches[i].rm_eo) + if (match.rm_so == match.rm_eo) continue; if (!oflag) - fwrite(line->dat + a, matches[i].rm_so - a, 1, + fwrite(pc->ln.dat + a, match.rm_so - a, 1, stdout); - if (color) + if (color) fprintf(stdout, "\33[%sm\33[K", color); - - fwrite(line->dat + matches[i].rm_so, - matches[i].rm_eo - matches[i].rm_so, 1, - stdout); - if (color) + fwrite(pc->ln.dat + match.rm_so, + match.rm_eo - match.rm_so, 1, stdout); + if (color) fprintf(stdout, "\33[m\33[K"); - a = matches[i].rm_eo; + a = match.rm_eo; if (oflag) putchar('\n'); } if (!oflag) { - if (line->len - a > 0) - fwrite(line->dat + a, line->len - a, 1, stdout); + if (pc->ln.len - a > 0) + fwrite(pc->ln.dat + a, pc->ln.len - a, 1, + stdout); putchar('\n'); } - } else { - fwrite(line->dat, line->len, 1, stdout); - putchar(fileeol); - } + } else + grep_printline(&pc->ln, sep); } From owner-svn-src-head@freebsd.org Tue May 2 20:40:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2F5C3D5BA32; Tue, 2 May 2017 20:40:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0A0D1440; Tue, 2 May 2017 20:40:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v42KenZF088304 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 May 2017 23:40:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v42KenZF088304 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v42KenRu088302; Tue, 2 May 2017 23:40:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 2 May 2017 23:40:49 +0300 From: Konstantin Belousov To: Ian Lepore Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317681 - head/share/man/man7 Message-ID: <20170502204049.GN1622@kib.kiev.ua> References: <201705021452.v42EqZSB010115@repo.freebsd.org> <20170503013818.F2099@besplex.bde.org> <20170502174455.GJ1622@kib.kiev.ua> <20170503035045.Q2870@besplex.bde.org> <20170502194525.GL1622@kib.kiev.ua> <1493757384.66427.72.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1493757384.66427.72.camel@freebsd.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 20:40:55 -0000 On Tue, May 02, 2017 at 02:36:24PM -0600, Ian Lepore wrote: > On Tue, 2017-05-02 at 22:45 +0300, Konstantin Belousov wrote: > > +is always signed, it is 64-bits everywere except on i386 and 32-bit > > powerpc. > > s/everywere/everywhere/ Fixed, thank you. diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 index 1ce397a303e..7cb05ea5271 100644 --- a/share/man/man7/arch.7 +++ b/share/man/man7/arch.7 @@ -37,6 +37,8 @@ Differences between CPU architectures and platforms supported by .Fx . .Pp .Ss Type sizes +If not explicitely mentioned, sizes are in bytes. +.Pp On all supported architectures, .Bl -column -offset -indent "long long" "Size" .It Sy Type Ta Sy Size @@ -47,8 +49,10 @@ On all supported architectures, .It float Ta 4 .It double Ta 8 .El -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) +.Pp +Machine-dependent type sizes: +.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t" +.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t .It amd64 Ta 8 Ta 16 Ta 8 .It arm Ta 4 Ta 8 Ta 8 .It armeb Ta 4 Ta 8 Ta 8 @@ -69,6 +73,9 @@ On all supported architectures, .It riscv Ta 8 Ta 16 Ta 8 .It sparc64 Ta 8 Ta 16 Ta 8 .El +.Pp +.Sy time_t +is always signed, it is 64-bits everywhere except on i386 and 32-bit powerpc. .Ss Endianness and Char Signedness .Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char Signedness" .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness From owner-svn-src-head@freebsd.org Tue May 2 20:44:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DA1AD5BAD5; Tue, 2 May 2017 20:44:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3988017B4; Tue, 2 May 2017 20:44:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42Ki6Ws057847; Tue, 2 May 2017 20:44:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42Ki6TY057846; Tue, 2 May 2017 20:44:06 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705022044.v42Ki6TY057846@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 May 2017 20:44:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317704 - head/usr.bin/grep/regex X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 20:44:07 -0000 Author: emaste Date: Tue May 2 20:44:06 2017 New Revision: 317704 URL: https://svnweb.freebsd.org/changeset/base/317704 Log: bsdgrep: fix escape map building for multibyte strings In BSD grep, fix escape map building in the regex parser. It was previously using memory not explicitly initialized, and the MBS escape map was being built based on a version of the pattern with escapes already parsed out. This is Kyle's change, but I restored the broken style that already exists in this file. Submitted by: Kyle Evans Reviewed by: cem, Kyle Evans (my style changes) Differential Revision: https://reviews.freebsd.org/D10098 Modified: head/usr.bin/grep/regex/tre-fastmatch.c Modified: head/usr.bin/grep/regex/tre-fastmatch.c ============================================================================== --- head/usr.bin/grep/regex/tre-fastmatch.c Tue May 2 20:39:33 2017 (r317703) +++ head/usr.bin/grep/regex/tre-fastmatch.c Tue May 2 20:44:06 2017 (r317704) @@ -98,6 +98,18 @@ static int fastcmp(const fastmatch_t *fg fg->pattern[siz] = '\0'; \ } \ +#define CONV_MBS_PAT(src, dest, destsz) \ + { \ + destsz = wcstombs(NULL, src, 0); \ + if (destsz == (size_t)-1) \ + return REG_BADPAT; \ + dest = malloc(destsz + 1); \ + if (dest == NULL) \ + return REG_ESPACE; \ + wcstombs(dest, src, destsz); \ + dest[destsz] = '\0'; \ + } \ + #define IS_OUT_OF_BOUNDS \ ((!fg->reversed \ ? ((type == STR_WIDE) ? ((j + fg->wlen) > len) \ @@ -723,15 +735,29 @@ badpat: } escaped = false; - for (unsigned int i = 0; i < fg->len; i++) - if (fg->pattern[i] == '\\') - escaped = !escaped; - else if (fg->pattern[i] == '.' && fg->escmap && escaped) + char *_checkpat = NULL; + size_t _checklen = 0; + unsigned int escofs = 0; + /* + * Make a copy here of the original pattern, because fg->pattern has + * already been stripped of all escape sequences in the above processing. + * This is necessary if we wish to later treat fg->escmap as an actual, + * functional replacement of fg->wescmap. + */ + CONV_MBS_PAT(pat, _checkpat, _checklen); + for (unsigned int i = 0; i < n; i++) + if (_checkpat[i] == '\\') + { + escaped = !escaped; + if (escaped) + ++escofs; + } + else if (_checkpat[i] == '.' && fg->escmap != NULL && escaped) { - fg->escmap[i] = true; + fg->escmap[i - escofs] = true; escaped = false; } - else if (fg->pattern[i] == '.' && !escaped) + else if (_checkpat[i] == '.' && !escaped) { hasdot = i; if (firstdot == -1) @@ -739,6 +765,7 @@ badpat: } else escaped = false; + free(_checkpat); } #else SAVE_PATTERN(tmp, pos, fg->pattern, fg->len); From owner-svn-src-head@freebsd.org Tue May 2 21:08:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB9A2D5BEEE; Tue, 2 May 2017 21:08:39 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9FDB191B; Tue, 2 May 2017 21:08:39 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42L8cvV066477; Tue, 2 May 2017 21:08:38 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42L8c9M066476; Tue, 2 May 2017 21:08:38 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705022108.v42L8c9M066476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 2 May 2017 21:08:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317705 - head/usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 21:08:40 -0000 Author: emaste Date: Tue May 2 21:08:38 2017 New Revision: 317705 URL: https://svnweb.freebsd.org/changeset/base/317705 Log: bsdgrep: avoid use of magic number for REG_NOSPEC Submitted by: Kyle Evans Differential Revision: https://reviews.freebsd.org/D10420 Modified: head/usr.bin/grep/grep.c Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Tue May 2 20:44:06 2017 (r317704) +++ head/usr.bin/grep/grep.c Tue May 2 21:08:38 2017 (r317705) @@ -716,8 +716,13 @@ main(int argc, char *argv[]) case GREP_BASIC: break; case GREP_FIXED: - /* XXX: header mess, REG_LITERAL not defined in gnu/regex.h */ - cflags |= 0020; +#if defined(REG_NOSPEC) + cflags |= REG_NOSPEC; +#elif defined(REG_LITERAL) + cflags |= REG_LITERAL; +#else + errx(2, "literal expressions not supported at compile time"); +#endif break; case GREP_EXTENDED: cflags |= REG_EXTENDED; From owner-svn-src-head@freebsd.org Tue May 2 21:09:08 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B8468D5BF4D; Tue, 2 May 2017 21:09:08 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 88789A5E; Tue, 2 May 2017 21:09:08 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42L97ie066547; Tue, 2 May 2017 21:09:07 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42L97Oh066546; Tue, 2 May 2017 21:09:07 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201705022109.v42L97Oh066546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 2 May 2017 21:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317706 - head/usr.bin/proccontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 21:09:08 -0000 Author: brooks Date: Tue May 2 21:09:07 2017 New Revision: 317706 URL: https://svnweb.freebsd.org/changeset/base/317706 Log: Use MAN= rather than MK_MAN=no to not install a manpage. MFC after: 1 week Modified: head/usr.bin/proccontrol/Makefile Modified: head/usr.bin/proccontrol/Makefile ============================================================================== --- head/usr.bin/proccontrol/Makefile Tue May 2 21:08:38 2017 (r317705) +++ head/usr.bin/proccontrol/Makefile Tue May 2 21:09:07 2017 (r317706) @@ -2,6 +2,6 @@ PROG= proccontrol WARNS?= 6 -MK_MAN=no +MAN= .include From owner-svn-src-head@freebsd.org Tue May 2 21:17:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03B87D5A256; Tue, 2 May 2017 21:17:13 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA0E8FDF; Tue, 2 May 2017 21:17:12 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id D3E155A9F15; Tue, 2 May 2017 21:17:05 +0000 (UTC) Date: Tue, 2 May 2017 21:17:05 +0000 From: Brooks Davis To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317706 - head/usr.bin/proccontrol Message-ID: <20170502211705.GA86001@spindle.one-eyed-alien.net> References: <201705022109.v42L97Oh066546@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sm4nu43k4a2Rpi4c" Content-Disposition: inline In-Reply-To: <201705022109.v42L97Oh066546@repo.freebsd.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 21:17:13 -0000 --sm4nu43k4a2Rpi4c Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 02, 2017 at 09:09:07PM +0000, Brooks Davis wrote: > Author: brooks > Date: Tue May 2 21:09:07 2017 > New Revision: 317706 > URL: https://svnweb.freebsd.org/changeset/base/317706 >=20 > Log: > Use MAN=3D rather than MK_MAN=3Dno to not install a manpage. With this change, the only remaining ordinary users of MK_MAN=3Dno is lib/ncurses/ncurses/Makefile where it's set when building libncursesw (wide). I'd argue this case is wrong as there are wide-character specific manpages and they should be installed with the correct library. -- Brooks --sm4nu43k4a2Rpi4c Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJZCPdRAAoJEKzQXbSebgfAsg8H/A/y7TpmTZ9co6RJF67TlALX x79ufhtRnQZmM3Z6dcVzCfAdatLG86d7yLKkuGErNI2L3+fuE/DbYKiwp3BUS1/O uaXL6spgsme4V09x2Q0XIpzQC/NKBNv6IHFIM3rB/ygUJOZPKBxeZP/JpWPEVOm7 Q5p9dSyZhNBWm5PA13EFEjmsWI9fPLfIrI6hN4zOAlCVvxciSVw9je82lzpbeH4l xHpTedjY9ETjGiT2FqTlUJ26dtIgvB7wJwXp0FaTD8QikX1V5nLHIdMUtNzP75to Xs7RlXoqo2jYbwQBoFNt6NOWdPcimfzFqm3SvVv2JgqHqccAgGV6dONY2TZep0g= =3PFN -----END PGP SIGNATURE----- --sm4nu43k4a2Rpi4c-- From owner-svn-src-head@freebsd.org Tue May 2 21:20:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17734D5A378; Tue, 2 May 2017 21:20:29 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DDB6811FE; Tue, 2 May 2017 21:20:28 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42LKREb070622; Tue, 2 May 2017 21:20:27 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42LKR2I070621; Tue, 2 May 2017 21:20:27 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201705022120.v42LKR2I070621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 2 May 2017 21:20:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317707 - head/lib/libc/regex X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 21:20:29 -0000 Author: brooks Date: Tue May 2 21:20:27 2017 New Revision: 317707 URL: https://svnweb.freebsd.org/changeset/base/317707 Log: Correct an out-of-bounds read in regcomp when the RE is bad. When passed the invalid regular expression "a**", the error is eventually detected and seterr() is called. It sets p->error appropriatly and p->next and p->end to nuls which is a never used char nuls[10] which is zeros due to .bss initialization. Unfortunatly, p_ere_exp() and p_simp_re() both have fall through cases where they set the error, decrement p->next and access it which means a read from what ever .bss variable comes before nuls. Found with regex_test:repet_multi and CHERI bounds checking. Reviewed by: ngie, pfg, emaste Obtained from: CheriBSD Sponsored by: DARPA, AFRL MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D10541 Modified: head/lib/libc/regex/regcomp.c Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Tue May 2 21:09:07 2017 (r317706) +++ head/lib/libc/regex/regcomp.c Tue May 2 21:20:27 2017 (r317707) @@ -444,6 +444,8 @@ p_ere_exp(struct parse *p) (void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT); /* FALLTHROUGH */ default: + if (p->error != 0) + return; p->next--; wc = WGETNEXT(); ordinary(p, wc); @@ -651,6 +653,8 @@ p_simp_re(struct parse *p, (void)REQUIRE(starordinary, REG_BADRPT); /* FALLTHROUGH */ default: + if (p->error != 0) + return(0); /* Definitely not $... */ p->next--; wc = WGETNEXT(); ordinary(p, wc); From owner-svn-src-head@freebsd.org Tue May 2 21:33:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8D06D5AADC; Tue, 2 May 2017 21:33:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F0B01E98; Tue, 2 May 2017 21:33:28 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42LXR2i078654; Tue, 2 May 2017 21:33:27 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42LXRF7078653; Tue, 2 May 2017 21:33:27 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201705022133.v42LXRF7078653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 2 May 2017 21:33:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317708 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 21:33:28 -0000 Author: jhibbits Date: Tue May 2 21:33:27 2017 New Revision: 317708 URL: https://svnweb.freebsd.org/changeset/base/317708 Log: Add powerpcspe to arch(7) Reviewed by: emaste Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Tue May 2 21:20:27 2017 (r317707) +++ head/share/man/man7/arch.7 Tue May 2 21:33:27 2017 (r317708) @@ -65,6 +65,7 @@ On all supported architectures, .It mips64elhf Ta 8 Ta 8 Ta 8 .It mips64hf Ta 8 Ta 8 Ta 8 .It powerpc Ta 4 Ta 8 Ta 4 +.It powerpcspe Ta 4 Ta 8 Ta 4 .It powerpc64 Ta 8 Ta 8 Ta 8 .It riscv Ta 8 Ta 16 Ta 8 .It sparc64 Ta 8 Ta 16 Ta 8 @@ -88,6 +89,7 @@ On all supported architectures, .It mips64elhf Ta little Ta signed .It mips64hf Ta big Ta signed .It powerpc Ta big Ta unsigned +.It powerpcspe Ta big Ta unsigned .It powerpc64 Ta big Ta unsigned .It riscv Ta little Ta signed .It sparc64 Ta big Ta signed @@ -111,6 +113,7 @@ On all supported architectures, .It mips64elhf Ta 4K .It mips64hf Ta 4K .It powerpc Ta 4K +.It powerpcspe Ta 4K .It powerpc64 Ta 4K .It riscv Ta 4K .It sparc64 Ta 8K @@ -134,6 +137,7 @@ On all supported architectures, .It mips64elhf Ta hard Ta identical to double .It mips64hf Ta hard Ta identical to double .It powerpc Ta hard Ta hard, double precision +.It powerpcspe Ta hard Ta hard, double precision .It powerpc64 Ta hard Ta hard, double precision .It riscv64 Ta hard Ta hard, double precision .It riscv64sf Ta soft Ta soft, double precision @@ -180,6 +184,7 @@ Architecture-specific macros: .It mips64elhf Ta Dv __mips__, Dv __mips_n64 .It mips64hf Ta Dv __mips__, Dv __MIPSEB__, Dv __mips_n64 .It powerpc Ta Dv __powerpc__ +.It powerpcspe Ta Dv __powerpc__, Dv __SPE__ .It powerpc64 Ta Dv __powerpc__, Dv __powerpc64__ .It riscv Ta Dv __riscv__, Dv __riscv64 .It sparc64 Ta Dv __sparc64__ From owner-svn-src-head@freebsd.org Tue May 2 21:56:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CA00D5B656; Tue, 2 May 2017 21:56:21 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4735F1CD3; Tue, 2 May 2017 21:56:21 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42LuKHD088900; Tue, 2 May 2017 21:56:20 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42LuKbp088899; Tue, 2 May 2017 21:56:20 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201705022156.v42LuKbp088899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Tue, 2 May 2017 21:56:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317709 - head/usr.bin/csplit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 21:56:21 -0000 Author: jilles Date: Tue May 2 21:56:20 2017 New Revision: 317709 URL: https://svnweb.freebsd.org/changeset/base/317709 Log: csplit: Fix check of fputs() return value, making csplit work again. As of r295638, fputs() returns the number of bytes written (if not more than INT_MAX). This broke csplit completely, since csplit assumed only success only for the return value 0. PR: 213510 Submitted by: J.R. Oldroyd MFC after: 1 week Relnotes: yes Modified: head/usr.bin/csplit/csplit.c Modified: head/usr.bin/csplit/csplit.c ============================================================================== --- head/usr.bin/csplit/csplit.c Tue May 2 21:33:27 2017 (r317708) +++ head/usr.bin/csplit/csplit.c Tue May 2 21:56:20 2017 (r317709) @@ -195,7 +195,7 @@ main(int argc, char *argv[]) /* Copy the rest into a new file. */ if (!feof(infile)) { ofp = newfile(); - while ((p = get_line()) != NULL && fputs(p, ofp) == 0) + while ((p = get_line()) != NULL && fputs(p, ofp) != EOF) ; if (!sflag) printf("%jd\n", (intmax_t)ftello(ofp)); @@ -392,7 +392,7 @@ do_rexp(const char *expr) /* Read and output lines until we get a match. */ first = 1; while ((p = get_line()) != NULL) { - if (fputs(p, ofp) != 0) + if (fputs(p, ofp) == EOF) break; if (!first && regexec(&cre, p, 0, NULL, 0) == 0) break; @@ -453,7 +453,7 @@ do_lineno(const char *expr) while (lineno + 1 != lastline) { if ((p = get_line()) == NULL) errx(1, "%ld: out of range", lastline); - if (fputs(p, ofp) != 0) + if (fputs(p, ofp) == EOF) break; } if (!sflag) From owner-svn-src-head@freebsd.org Tue May 2 21:59:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DB99D5B75F; Tue, 2 May 2017 21:59:09 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x22a.google.com (mail-qk0-x22a.google.com [IPv6:2607:f8b0:400d:c09::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ECB1A1FBF; Tue, 2 May 2017 21:59:08 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x22a.google.com with SMTP id r189so726939qkf.1; Tue, 02 May 2017 14:59:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=tjNq5pxC/Nz6u/aXjzeHiQDdrmzGLM50pfw1Su2fkMQ=; b=KYhn1lEeC/4T3pPYjJownXmspcq4XPv+6SAuDI3qrhqdse+MOgBmbkbBdi1QzvOtkK CiUqPfv1kuCP78g3BT4Pf2HfQV2ysgLhmoRLw9a4t8WVUQoYPKeZWlIgHjncBFlkX1LU j/rGmGMtEGCJvz9hK116ONngz92CDhSZF1Jb5cAPoHrflrNw+QPQ95Pzz3dm0PjtQXZT 6C6gx84rtuRSSd6FR6Op3nX1iybpzTM/kUQDObfIXNvr9HL+/05e14MFEZQKwdyqQO/j 5mQLLFh3gI4Q3NUOtLhRFUIpIfLXCa9RkoRN8KEyMFIIOHHLQq2c8QTe+7FDZjo+E0Dt voJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=tjNq5pxC/Nz6u/aXjzeHiQDdrmzGLM50pfw1Su2fkMQ=; b=ObXQTJG9c0IbTDBo5yHGbKEzna1ZeupVcCF6q4PGkyEgw7R25ianIJEEwa9oH3dbDZ 8Rw+j0l40xQDmCDC3QrJhg2Eq9/XLjUv9SDXWBfRbeDcPZy0vwurtTR8MLR3NRamPonh WApVKRhE04EXkxD8eXQwHo9Mkqa0Ewk5ugthi4DaQqQVpYss/YpZ5qDy7QKgLgiTvE/n /oPfh7H8FgOCUeSp25tKnYnQnvNhRKD8x4jru5X+ORo+1SrplfDmghHhuV8tQl8lwc9m s4j903xlLalX0/8ShEN1jkVcxLrtBacAbSwJDfK9pmSOrLiOWatLjZ7W+bNNiDUFoqIW DeQQ== X-Gm-Message-State: AODbwcDQO9sVwtzUQXK+iX8kVPgDAwpSNGPbdmt153feqpOq5KiucY47 PVjQL/kUta+tEr5A+qvkCB3Skebpug== X-Received: by 10.55.73.71 with SMTP id w68mr145296qka.76.1493762348163; Tue, 02 May 2017 14:59:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.93.83 with HTTP; Tue, 2 May 2017 14:59:07 -0700 (PDT) In-Reply-To: <20170502194525.GL1622@kib.kiev.ua> References: <201705021452.v42EqZSB010115@repo.freebsd.org> <20170503013818.F2099@besplex.bde.org> <20170502174455.GJ1622@kib.kiev.ua> <20170503035045.Q2870@besplex.bde.org> <20170502194525.GL1622@kib.kiev.ua> From: Ngie Cooper Date: Tue, 2 May 2017 14:59:07 -0700 Message-ID: Subject: Re: svn commit: r317681 - head/share/man/man7 To: Konstantin Belousov Cc: Bruce Evans , Ed Maste , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 21:59:09 -0000 On Tue, May 2, 2017 at 12:45 PM, Konstantin Belousov wrote: ... > .Fx . > .Pp > .Ss Type sizes > +If not explicitely mentioned, sizes are in bytes. *explicitly > +.Pp > On all supported architectures, > .Bl -column -offset -indent "long long" "Size" > .It Sy Type Ta Sy Size > @@ -47,8 +49,10 @@ On all supported architectures, > .It float Ta 4 > .It double Ta 8 > .El > -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" > -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) > +.Pp > +Machine-dependent type sizes: > +.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t" > +.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t > .It amd64 Ta 8 Ta 16 Ta 8 > .It arm Ta 4 Ta 8 Ta 8 > .It armeb Ta 4 Ta 8 Ta 8 > @@ -69,6 +73,9 @@ On all supported architectures, > .It riscv Ta 8 Ta 16 Ta 8 > .It sparc64 Ta 8 Ta 16 Ta 8 > .El > +.Pp > +.Sy time_t > +is always signed, it is 64-bits everywere except on i386 and 32-bit powerpc. *everywhere Thanks! -Ngie From owner-svn-src-head@freebsd.org Tue May 2 22:14:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25F9CD5BBA2; Tue, 2 May 2017 22:14:57 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DBD9FCA5; Tue, 2 May 2017 22:14:56 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42MEtiY097365; Tue, 2 May 2017 22:14:55 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42MEt8b097364; Tue, 2 May 2017 22:14:55 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201705022214.v42MEt8b097364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 2 May 2017 22:14:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317710 - head/contrib/netbsd-tests/lib/libc/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 22:14:57 -0000 Author: brooks Date: Tue May 2 22:14:55 2017 New Revision: 317710 URL: https://svnweb.freebsd.org/changeset/base/317710 Log: Remove expected failure now that it was fixed in r317660. PR: 211804 Reviewed by: ngie Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D10576 Modified: head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Modified: head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Tue May 2 21:56:20 2017 (r317709) +++ head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Tue May 2 22:14:55 2017 (r317710) @@ -325,10 +325,6 @@ ATF_TC_HEAD(raw, tc) ATF_TC_BODY(raw, tc) { -#ifdef __FreeBSD__ - atf_tc_expect_fail("fails with: clnt_call: " - "RPC: Can't decode result -- PR # 211804"); -#endif rawtest(NULL); } From owner-svn-src-head@freebsd.org Tue May 2 23:04:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A32A2D5B9E4 for ; Tue, 2 May 2017 23:04:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm10-vm3.bullet.mail.ne1.yahoo.com (nm10-vm3.bullet.mail.ne1.yahoo.com [98.138.91.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F1F3E9A for ; Tue, 2 May 2017 23:04:21 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1493765896; bh=ejSGqeuDKVSXytjRUvgO0uvKJLXGtnNjXTJJGhgBTbg=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=m6dXlZJarD5h0avvcaQXX3ha42xnu5muPZPQHx4+LP7AmKevTxvlwZ3NVElvVYX3xC5b3rZiBgXi2t4ZCxdcfaRlOTMvAcwSMl2GKEOycUkOMAmp1Pbp0z+mV8LdLIAVcYfA2w6wQRI5cE6j50X3/ShkOCUMDPDqD6ZrUDp4U1Q4QNc+hFLkbZF6r/Y7au73R2tHyfbZ2PaY1Pw9CBDvyKqdL2x4kBTpfxCcy/Eq4hNwQSA/7/+Rw0247iFjy00R98nfAZIYIAnLsKG3MyPtqc//RH2xuJ8ZFhE8C7TbrKCueHKiH6LXMXMBqs1Z6R7arSKyo8xVOjnhmAxybcI8fw== Received: from [98.138.226.176] by nm10.bullet.mail.ne1.yahoo.com with NNFMP; 02 May 2017 22:58:16 -0000 Received: from [98.138.226.60] by tm11.bullet.mail.ne1.yahoo.com with NNFMP; 02 May 2017 22:58:16 -0000 Received: from [127.0.0.1] by smtp211.mail.ne1.yahoo.com with NNFMP; 02 May 2017 22:58:16 -0000 X-Yahoo-Newman-Id: 870516.15814.bm@smtp211.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: uKO1.ZoVM1nXBffmoYroh5DH2Zm0lMpPs7TdEMVl9l261YG GOCXxTMlYgK9rA6iVhJa1fizmfD2iTuWZmhElbnJTiS6y5yTSZOE5nBZsEkn WiTRzDjREgGWeiuB_OCuO_nkF9xTd._Ffj52Fpi0Mlo_dbIvW2egcwGL_e3n 6KJKyx.aiAzMBoB7lANWvGb9InE7xK0gdBOpi4l9V4FBDeQe2s1awppXt8ce 5SBMdXZIfPXwwskboUrAtyieeLsIkrN0cpSXsDmj8CZSFyI0L.goyJ2Z.NEV ErcFqf7hO5B64AoqOSMo7Qr5IKLLp1Om.nAaRBCKviggbIe5CprqurIAoRep Pc5Omd25XicHu8LRGzPltGY5ITdfZPu50kF4p9iszxgE1z4e..N50rKX46SL cPfbi0BnXOSbAHynheMeCkGsfZ3atZ2s6EEBfdc6LvyKtS9Uv7VAgtBWMUOc TavX7pdFeLNM5wImOqghLfLZFXoX1d5hGmjgR7A47nAn5qbNsLLcZRKrULCK 6LFWR3_9di.lnWCVTu5n0SgurSwt6ZxYXiHjXQ5tRDEWQ X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r317709 - head/usr.bin/csplit To: Jilles Tjoelker , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201705022156.v42LuKbp088899@repo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Project Message-ID: Date: Tue, 2 May 2017 17:58:18 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <201705022156.v42LuKbp088899@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 23:04:21 -0000 Very interesting ... On 2/5/2017 16:56, Jilles Tjoelker wrote: > Author: jilles > Date: Tue May 2 21:56:20 2017 > New Revision: 317709 > URL: https://svnweb.freebsd.org/changeset/base/317709 > > Log: > csplit: Fix check of fputs() return value, making csplit work again. > > As of r295638, fputs() returns the number of bytes written (if not more than > INT_MAX). This broke csplit completely, since csplit assumed only success > only for the return value 0. > Actually r295631 explains better why the change was made. I now checked with opengrok and it appears only csplit was hit. Thanks! Pedro. From owner-svn-src-head@freebsd.org Tue May 2 23:29:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FD61D5BE8E; Tue, 2 May 2017 23:29:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C5C0B02; Tue, 2 May 2017 23:29:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42NThAd026372; Tue, 2 May 2017 23:29:43 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42NThUI026371; Tue, 2 May 2017 23:29:43 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201705022329.v42NThUI026371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 2 May 2017 23:29:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317712 - head/sys/geom/mirror X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 23:29:44 -0000 Author: markj Date: Tue May 2 23:29:42 2017 New Revision: 317712 URL: https://svnweb.freebsd.org/changeset/base/317712 Log: Synchronize unclean mirrors before adding them to a running gmirror. During gmirror startup, if component mirrors are found to be dirty as is typical after a system crash, the mirrors are synchronized to the mirror with highest priority. However if a gmirror starts without all of its mirrors present, for example because of some transient delays during tasting, the remaining mirrors must be synchronized before they may become active. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Tue May 2 22:57:27 2017 (r317711) +++ head/sys/geom/mirror/g_mirror.c Tue May 2 23:29:42 2017 (r317712) @@ -2225,7 +2225,9 @@ g_mirror_determine_state(struct g_mirror sc = disk->d_softc; if (sc->sc_syncid == disk->d_sync.ds_syncid) { if ((disk->d_flags & - G_MIRROR_DISK_FLAG_SYNCHRONIZING) == 0) { + G_MIRROR_DISK_FLAG_SYNCHRONIZING) == 0 && + (g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE) == 0 || + (disk->d_flags & G_MIRROR_DISK_FLAG_DIRTY) == 0)) { /* Disk does not need synchronization. */ state = G_MIRROR_DISK_STATE_ACTIVE; } else { From owner-svn-src-head@freebsd.org Tue May 2 23:31:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C55DD5BF41; Tue, 2 May 2017 23:31:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D14A8E82; Tue, 2 May 2017 23:31:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v42NVdTM027350; Tue, 2 May 2017 23:31:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v42NVdFC027346; Tue, 2 May 2017 23:31:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201705022331.v42NVdFC027346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 2 May 2017 23:31:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317713 - head/tests/sys/geom/class/mirror X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 May 2017 23:31:41 -0000 Author: markj Date: Tue May 2 23:31:39 2017 New Revision: 317713 URL: https://svnweb.freebsd.org/changeset/base/317713 Log: Add regression tests for r317712 and r306743. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Added: head/tests/sys/geom/class/mirror/8_test.sh (contents, props changed) head/tests/sys/geom/class/mirror/9_test.sh (contents, props changed) Modified: head/tests/sys/geom/class/mirror/Makefile Added: head/tests/sys/geom/class/mirror/8_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/mirror/8_test.sh Tue May 2 23:31:39 2017 (r317713) @@ -0,0 +1,53 @@ +#!/bin/sh +# $FreeBSD$ + +# Regression test for r317712. + +. `dirname $0`/conf.sh + +echo 1..1 + +ddbs=2048 +m1=`mktemp $base.XXXXXX` || exit 1 +m2=`mktemp $base.XXXXXX` || exit 1 + +dd if=/dev/zero of=$m1 bs=$ddbs count=1024 >/dev/null 2>&1 +dd if=/dev/zero of=$m2 bs=$ddbs count=1024 >/dev/null 2>&1 + +us0=$(mdconfig -t vnode -f $m1) || exit 1 +us1=$(mdconfig -t vnode -f $m2) || exit 1 + +gmirror label $name /dev/$us0 /dev/$us1 || exit 1 +devwait + +# Ensure that the mirrors are marked dirty, and then disconnect them. +# We need to have the gmirror provider open when destroying the MDs since +# gmirror will automatically mark the mirrors clean when the provider is closed. +exec 9>/dev/mirror/$name +dd if=/dev/zero bs=$ddbs count=1 >&9 2>/dev/null +mdconfig -d -u ${us0#md} -o force || exit 1 +mdconfig -d -u ${us1#md} -o force || exit 1 +exec 9>&- + +dd if=/dev/random of=$m1 bs=$ddbs count=1 conv=notrunc >/dev/null 2>&1 +us0=$(attach_md -t vnode -f $m1) || exit 1 +devwait # This will take kern.geom.mirror.timeout seconds. + +# Re-attach the second mirror and wait for it to synchronize. +us1=$(attach_md -t vnode -f $m2) || exit 1 +while [ $(gmirror status $name | grep ACTIVE | wc -l) -ne 2 ]; do + sleep 1 +done + +# Verify the two mirrors are identical. Destroy the gmirror first so that +# the mirror metadata is wiped; otherwise the metadata blocks will fail +# the comparison. It would be nice to do this with a "gmirror verify" +# command instead. +gmirror destroy $name +if cmp -s ${m1} ${m2}; then + echo "ok 1" +else + echo "not ok 1" +fi + +rm -f $m1 $m2 Added: head/tests/sys/geom/class/mirror/9_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/mirror/9_test.sh Tue May 2 23:31:39 2017 (r317713) @@ -0,0 +1,62 @@ +#!/bin/sh +# $FreeBSD$ + +# Regression test for r306743. + +. `dirname $0`/conf.sh + +echo 1..1 + +ddbs=2048 +m1=`mktemp $base.XXXXXX` || exit 1 +m2=`mktemp $base.XXXXXX` || exit 1 +m3=`mktemp $base.XXXXXX` || exit 1 + +dd if=/dev/zero of=$m1 bs=$ddbs count=1024 >/dev/null 2>&1 +dd if=/dev/zero of=$m2 bs=$ddbs count=1024 >/dev/null 2>&1 +dd if=/dev/zero of=$m3 bs=$ddbs count=1024 >/dev/null 2>&1 + +us0=$(attach_md -t vnode -f $m1) || exit 1 +us1=$(attach_md -t vnode -f $m2) || exit 1 +us2=$(attach_md -t vnode -f $m3) || exit 1 + +gmirror label $name /dev/$us0 /dev/$us1 || exit 1 +devwait + +# Break one of the mirrors by forcing a single metadata write error. +# When dd closes the mirror provider, gmirror will attempt to mark the mirrors +# clean, and will kick one of the mirrors out upon hitting the error. +sysctl debug.fail_point.g_mirror_metadata_write='1*return(5)' || exit 1 +dd if=/dev/random of=/dev/mirror/$name bs=$ddbs count=1 >/dev/null 2>&1 +sysctl debug.fail_point.g_mirror_metadata_write='off' || exit 1 + +# Replace the broken mirror, and then stop the gmirror. +gmirror forget $name || exit 1 +gmirror insert $name /dev/$us2 || exit 1 +while [ $(gmirror status $name | grep ACTIVE | wc -l) -ne 2 ]; do + sleep 1 +done +gmirror stop $name || exit 1 + +# Restart the gmirror on the original two mirrors. One of them is broken, +# so we should end up with a degraded gmirror. +gmirror activate $name /dev/$us0 /dev/$us1 || exit 1 +devwait +dd if=/dev/random of=/dev/mirror/$name bs=$ddbs count=1 >/dev/null 2>&1 + +# Re-add the replacement mirror and verify the two mirrors are synchronized. +# Destroy the gmirror first so that the mirror metadata is wiped; otherwise +# the metadata blocks will fail the comparison. It would be nice to do this +# with a "gmirror verify" command instead. +gmirror activate $name /dev/$us2 || exit 1 +while [ $(gmirror status $name | grep ACTIVE | wc -l) -ne 2 ]; do + sleep 1 +done +gmirror destroy $name || exit 1 +if cmp -s $m1 $m3; then + echo "ok 1" +else + echo "not ok 1" +fi + +rm -f $m1 $m2 $m3 Modified: head/tests/sys/geom/class/mirror/Makefile ============================================================================== --- head/tests/sys/geom/class/mirror/Makefile Tue May 2 23:29:42 2017 (r317712) +++ head/tests/sys/geom/class/mirror/Makefile Tue May 2 23:31:39 2017 (r317713) @@ -11,6 +11,8 @@ TAP_TESTS_SH+= 4_test TAP_TESTS_SH+= 5_test TAP_TESTS_SH+= 6_test TAP_TESTS_SH+= 7_test +TAP_TESTS_SH+= 8_test +TAP_TESTS_SH+= 9_test ${PACKAGE}FILES+= conf.sh From owner-svn-src-head@freebsd.org Wed May 3 01:46:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67D06D5B509; Wed, 3 May 2017 01:46:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38243B39; Wed, 3 May 2017 01:46:40 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v431kdhh084218; Wed, 3 May 2017 01:46:39 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v431kd6m084217; Wed, 3 May 2017 01:46:39 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201705030146.v431kd6m084217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 3 May 2017 01:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317715 - head/sbin/ifconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 01:46:40 -0000 Author: asomers Date: Wed May 3 01:46:39 2017 New Revision: 317715 URL: https://svnweb.freebsd.org/changeset/base/317715 Log: ifconfig displays ND6_IFF_NO_DAD as "IGNORELOOP" PR: 218958 Reviewed by: kristof MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D10543 Modified: head/sbin/ifconfig/af_nd6.c Modified: head/sbin/ifconfig/af_nd6.c ============================================================================== --- head/sbin/ifconfig/af_nd6.c Wed May 3 01:06:56 2017 (r317714) +++ head/sbin/ifconfig/af_nd6.c Wed May 3 01:46:39 2017 (r317715) @@ -57,8 +57,7 @@ static const char rcsid[] = #define MAX_SYSCTL_TRY 5 #define ND6BITS "\020\001PERFORMNUD\002ACCEPT_RTADV\003PREFER_SOURCE" \ "\004IFDISABLED\005DONT_SET_IFROUTE\006AUTO_LINKLOCAL" \ - "\007NO_RADR\010NO_PREFER_IFACE\011IGNORELOOP\012NO_DAD" \ - "\020DEFAULTIF" + "\007NO_RADR\010NO_PREFER_IFACE\011NO_DAD\020DEFAULTIF" static int isnd6defif(int); void setnd6flags(const char *, int, int, const struct afswtch *); From owner-svn-src-head@freebsd.org Wed May 3 02:54:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C43CDD5AB3A; Wed, 3 May 2017 02:54:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A0DEB84; Wed, 3 May 2017 02:54:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v432sB3I013160; Wed, 3 May 2017 02:54:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v432sBZ6013159; Wed, 3 May 2017 02:54:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705030254.v432sBZ6013159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 3 May 2017 02:54:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317723 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 02:54:12 -0000 Author: mav Date: Wed May 3 02:54:11 2017 New Revision: 317723 URL: https://svnweb.freebsd.org/changeset/base/317723 Log: Fix r317696 build without debug. MFC after: 2 weeks Modified: head/sys/net/if_lagg.c Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Wed May 3 02:37:44 2017 (r317722) +++ head/sys/net/if_lagg.c Wed May 3 02:54:11 2017 (r317723) @@ -1533,10 +1533,9 @@ lagg_setmulti(struct lagg_port *lp) static int lagg_clrmulti(struct lagg_port *lp) { - struct lagg_softc *sc = lp->lp_softc; struct lagg_mc *mc; - LAGG_WLOCK_ASSERT(sc); + LAGG_WLOCK_ASSERT(lp->lp_softc); while ((mc = SLIST_FIRST(&lp->lp_mc_head)) != NULL) { SLIST_REMOVE(&lp->lp_mc_head, mc, lagg_mc, mc_entries); if (mc->mc_ifma && lp->lp_detaching == 0) From owner-svn-src-head@freebsd.org Wed May 3 05:13:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69276D59B13 for ; Wed, 3 May 2017 05:13:47 +0000 (UTC) (envelope-from 0100015bccba63ab-edf2debb-6781-4d23-b21a-fa25b2a11803-000000@amazonses.com) Received: from a8-60.smtp-out.amazonses.com (a8-60.smtp-out.amazonses.com [54.240.8.60]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FFF3B70 for ; Wed, 3 May 2017 05:13:47 +0000 (UTC) (envelope-from 0100015bccba63ab-edf2debb-6781-4d23-b21a-fa25b2a11803-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ae7m2yrxjw65l2cqdpjxuucyrvy564tn; d=tarsnap.com; t=1493788419; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=+WJwCjqygjym8FdUpyll75KOafZSX250l/F3GokTzX4=; b=s9UJRJuZOT7Jx3xHjjsC88KpzrSTIkezd/6svPcLSBNxfgr/7F5t4RNnGNvhxude ZcdnsKYTT2eOWnm89WPQ9BwU8+2zPaOdwKdM9WtYt9wEQkpeUQ8BNljF52OZ/imdf+e JsXF/p9iCNHd36c6fTkAcPEdZLfg7eM7z1ShDmBY= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1493788419; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=+WJwCjqygjym8FdUpyll75KOafZSX250l/F3GokTzX4=; b=nYYEekhf02xo/hLsLHb2hMIQTfsDmTu8KdloWe0oWQ7Yx1sgLyjNp3zhbDLzWfDT hdwYu1uJmAP2u1UCZepDWv6H9rggda3zS6fgvBwyS8y9EMxbbYGBwEEeMEnpTUFAfL/ rDy24zv4VzDZX3ppwlB64bI+vOJ1YS/74847b66E= Subject: Re: svn commit: r301198 - head/sys/dev/xen/netfront To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201606021116.u52BGajD047287@repo.freebsd.org> From: Colin Percival Message-ID: <0100015bccba63ab-edf2debb-6781-4d23-b21a-fa25b2a11803-000000@email.amazonses.com> Date: Wed, 3 May 2017 05:13:39 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <201606021116.u52BGajD047287@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SES-Outgoing: 2017.05.03-54.240.8.60 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 05:13:47 -0000 On 06/02/16 04:16, Roger Pau Monné wrote: > Author: royger > Date: Thu Jun 2 11:16:35 2016 > New Revision: 301198 > URL: https://svnweb.freebsd.org/changeset/base/301198 I think this commit is responsible for panics I'm seeing in EC2 on T2 family instances. Every time a DHCP request is made, we call into xn_ifinit_locked (not sure why -- something to do with making the interface promiscuous?) and hit this code > @@ -1760,7 +1715,7 @@ xn_ifinit_locked(struct netfront_info *n > xn_alloc_rx_buffers(rxq); > rxq->ring.sring->rsp_event = rxq->ring.rsp_cons + 1; > if (RING_HAS_UNCONSUMED_RESPONSES(&rxq->ring)) > - taskqueue_enqueue(rxq->tq, &rxq->intrtask); > + xn_rxeof(rxq); > XN_RX_UNLOCK(rxq); > } but under high traffic volumes I think a separate thread can already be running in xn_rxeof, having dropped the RX lock while it passes a packet up the stack. This would result in two different threads trying to process the same set of responses from the ring, with (unsurprisingly) bad results. I'm not 100% sure that this is what's causing the panic, but it's definitely happening under high traffic conditions immediately after xn_ifinit_locked is called, so I think my speculation is well-founded. There are a few things I don't understand here: 1. Why DHCP requests are resulting in calls into xn_ifinit_locked. 2. Why the calls into xn_ifinit_locked are only happening on T2 instances and not on any of the other EC2 instances I've tried. 3. Why xn_ifinit_locked is consuming ring responses. so I'm not sure what the solution is, but hopefully someone who knows this code better will be able to help... -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-head@freebsd.org Wed May 3 05:33:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48F2DD5A23F; Wed, 3 May 2017 05:33:17 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B1507FE; Wed, 3 May 2017 05:33:17 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v435XGxX078424; Wed, 3 May 2017 05:33:16 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v435XGkR078423; Wed, 3 May 2017 05:33:16 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201705030533.v435XGkR078423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Wed, 3 May 2017 05:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317726 - head/sys/cam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 05:33:17 -0000 Author: scottl Date: Wed May 3 05:33:15 2017 New Revision: 317726 URL: https://svnweb.freebsd.org/changeset/base/317726 Log: Fix an unsafe malloc usage with sbufs. Reported by: ken Sponsored by: Netflix Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Wed May 3 04:42:35 2017 (r317725) +++ head/sys/cam/cam_periph.c Wed May 3 05:33:15 2017 (r317726) @@ -643,8 +643,9 @@ cam_periph_invalidate(struct cam_periph CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n")); if ((periph->flags & CAM_PERIPH_ANNOUNCED) && !rebooting) { struct sbuf sb; + char buffer[160]; - sbuf_new(&sb, NULL, 160, SBUF_FIXEDLEN); + sbuf_new(&sb, buffer, 160, SBUF_FIXEDLEN); xpt_denounce_periph_sbuf(periph, &sb); sbuf_finish(&sb); sbuf_putbuf(&sb); From owner-svn-src-head@freebsd.org Wed May 3 05:45:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACF0AD5A46A; Wed, 3 May 2017 05:45:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E623CDF; Wed, 3 May 2017 05:45:44 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v435jhSO082765; Wed, 3 May 2017 05:45:43 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v435jhnm082762; Wed, 3 May 2017 05:45:43 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705030545.v435jhnm082762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 3 May 2017 05:45:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317727 - head/sys/mips/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 05:45:44 -0000 Author: adrian Date: Wed May 3 05:45:43 2017 New Revision: 317727 URL: https://svnweb.freebsd.org/changeset/base/317727 Log: [mips] default AR933x/AR934x to include mips24k hwpmc and limit umtx chain memory wastage. Tested: * AR933x SoC (Carambola2) * AR934x SoC (TP-Link WDR3600) Modified: head/sys/mips/conf/CARAMBOLA2 head/sys/mips/conf/std.AR933X head/sys/mips/conf/std.AR934X Modified: head/sys/mips/conf/CARAMBOLA2 ============================================================================== --- head/sys/mips/conf/CARAMBOLA2 Wed May 3 05:33:15 2017 (r317726) +++ head/sys/mips/conf/CARAMBOLA2 Wed May 3 05:45:43 2017 (r317727) @@ -24,6 +24,8 @@ hints "CARAMBOLA2.hints" # Board memory - 64MB options AR71XX_REALMEM=(64*1024*1024) +options EARLY_PRINTF + # i2c GPIO bus #device gpioiic #device iicbb Modified: head/sys/mips/conf/std.AR933X ============================================================================== --- head/sys/mips/conf/std.AR933X Wed May 3 05:33:15 2017 (r317726) +++ head/sys/mips/conf/std.AR933X Wed May 3 05:45:43 2017 (r317727) @@ -20,7 +20,7 @@ files "../atheros/files.ar71xx" hints "AR933X_BASE.hints" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 rtwn rtwn_usb rtwnfw otus otusfw" +makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 rtwn rtwn_usb rtwnfw otus otusfw hwpmc_mips24k" options DDB options KDB @@ -51,10 +51,10 @@ options VM_KMEM_SIZE_SCALE=1 options NBUF=128 # Limit UMTX hash size -# options UMTX_NUM_CHAINS=64 +options UMTX_CHAINS=64 # PMC -#options HWPMC_HOOKS +options HWPMC_HOOKS #device hwpmc #device hwpmc_mips24k Modified: head/sys/mips/conf/std.AR934X ============================================================================== --- head/sys/mips/conf/std.AR934X Wed May 3 05:33:15 2017 (r317726) +++ head/sys/mips/conf/std.AR934X Wed May 3 05:45:43 2017 (r317727) @@ -20,7 +20,7 @@ files "../atheros/files.ar71xx" hints "AR934X_BASE.hints" makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 rtwn rtwn_usb rtwnfw otus otusfw" +makeoptions MODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_tap if_tun if_bridge bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp wlan_rssadapt wlan_amrr hwpmc ipfw ipfw_nat libalias ipfw_nptv6 rtwn rtwn_usb rtwnfw otus otusfw hwpmc_mips24k" # makeoptions MODULES_OVERRIDE="" options DDB @@ -47,10 +47,10 @@ options NO_SYSCTL_DESCR options NBUF=128 # Limit UMTX hash size -# options UMTX_NUM_CHAINS=64 +options UMTX_CHAINS=64 # PMC -#options HWPMC_HOOKS +options HWPMC_HOOKS #device hwpmc #device hwpmc_mips24k From owner-svn-src-head@freebsd.org Wed May 3 06:19:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F16A6D5ABFD; Wed, 3 May 2017 06:19:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 7537512D; Wed, 3 May 2017 06:19:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id A325742E058; Wed, 3 May 2017 16:19:13 +1000 (AEST) Date: Wed, 3 May 2017 16:19:08 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: emaste@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317681 - head/share/man/man7 In-Reply-To: <20170502194525.GL1622@kib.kiev.ua> Message-ID: <20170503153946.M910@besplex.bde.org> References: <201705021452.v42EqZSB010115@repo.freebsd.org> <20170503013818.F2099@besplex.bde.org> <20170502174455.GJ1622@kib.kiev.ua> <20170503035045.Q2870@besplex.bde.org> <20170502194525.GL1622@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VbSHBBh9 c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=u1C0g8uIfgy_RRVr9QoA:9 a=UjpWL7i-dYAsd4vD:21 a=jWr4OM5M7pbHu-F2:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 06:19:55 -0000 On Tue, 2 May 2017, Konstantin Belousov wrote: > On Wed, May 03, 2017 at 04:41:52AM +1000, Bruce Evans wrote: >> It would be good to mention that the type of time_t is signed somewhere. >> There is a whole column for the signedess of char in another table. >> Signedness can be given consisely using some markup like -8 or 8- for >> signed. The scale (often bytes or bits) could be given similarly. E.g, >> 8-B could mean signed 8 bits and 80.b could mean 80 bits floating pint. >> >> The Page Size table says "Page Sizes" redundantly in 1 column but doesn't >> gives units, and depends on everyone knowing that 4K is real K and bytes. > I added a note at the very beginning, saying that sizes are in bytes. > For time_t, I added a short narration besides the table data. > >> >> The Floating Point table already doesn't say "sizeof()" in the header but > [omited, I do not want to change the scope of the fix] OK. Including corrections by ngie: > diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 > index 1ce397a303e..ad1abccc2e5 100644 > --- a/share/man/man7/arch.7 > +++ b/share/man/man7/arch.7 > @@ -37,6 +37,8 @@ Differences between CPU architectures and platforms supported by > .Fx . > .Pp This .Pp gives misformatting (an extra blank line) when followed by .Ss. Apparently, .Ss gives its own paragraph break. > .Ss Type sizes > +If not explicitely mentioned, sizes are in bytes. "explicitly" This should be moved higher, so that it applies to the "Page Size" section. The first clause isn't needed, since there are no explicit mentions of sizes not in bytes (there is only "80 bits" for some FP values which don't claim to be sizes and aren't really sizes and should be changed to "64 bits" and claim to be precisions). > +.Pp Check the formatting after moving the addition higher. There will be 2 very short paragraphs if you keep this .Pp. > On all supported architectures, The comma at the end of this should be a colon. There is no corresponding period to delimit the end of any of the lists except one sublist of "Predefined Macros" where the formatting of the sublist is probably wrong to have this (it has separate sentences with punctuation, unlike in all other tables). This section correctly uses colons. > .Bl -column -offset -indent "long long" "Size" > .It Sy Type Ta Sy Size > @@ -47,8 +49,10 @@ On all supported architectures, > .It float Ta 4 > .It double Ta 8 > .El > -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" > -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) > +.Pp > +Machine-dependent type sizes: > +.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t" > +.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t > .It amd64 Ta 8 Ta 16 Ta 8 > .It arm Ta 4 Ta 8 Ta 8 > .It armeb Ta 4 Ta 8 Ta 8 > @@ -69,6 +73,9 @@ On all supported architectures, > .It riscv Ta 8 Ta 16 Ta 8 > .It sparc64 Ta 8 Ta 16 Ta 8 > .El > +.Pp > +.Sy time_t > +is always signed, it is 64-bits everywere except on i386 and 32-bit powerpc. Change "is always" to "On all supported arches" as elsewhere. "everywhere" "everywhere" is redundant. The whole second clause is redundant. Remove it. Leave it to the reader to notice that the table has more 8's than 4's, and where the 4's are. This also fixes: - bad grammar (comma splice). In general, use separate sentences, since the rules for splicing clauses using commas and semicolons or avoiding these using a word are complicated, though I used splicing in this sentence to help make it so complicated (IIRC, "since" here is a splicing method with some technical name like "conjunctive adjective"). - inconsistent units (bytes in the table and bits here). > .Ss Endianness and Char Signedness > .Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char Signedness" > .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness Bruce From owner-svn-src-head@freebsd.org Wed May 3 06:31:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6103CD5AE70; Wed, 3 May 2017 06:31:30 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 240C996D; Wed, 3 May 2017 06:31:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id B977242DD1C; Wed, 3 May 2017 16:29:13 +1000 (AEST) Date: Wed, 3 May 2017 16:29:13 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Justin Hibbits cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317708 - head/share/man/man7 In-Reply-To: <201705022133.v42LXRF7078653@repo.freebsd.org> Message-ID: <20170503162733.O1062@besplex.bde.org> References: <201705022133.v42LXRF7078653@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=VcZ33-Ma-BFnhg84X3oA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 06:31:30 -0000 On Tue, 2 May 2017, Justin Hibbits wrote: > Log: > Add powerpcspe to arch(7) > > Reviewed by: emaste > ... > Modified: head/share/man/man7/arch.7 > ============================================================================== > --- head/share/man/man7/arch.7 Tue May 2 21:20:27 2017 (r317707) > +++ head/share/man/man7/arch.7 Tue May 2 21:33:27 2017 (r317708) > @@ -65,6 +65,7 @@ On all supported architectures, > .It mips64elhf Ta 8 Ta 8 Ta 8 > .It mips64hf Ta 8 Ta 8 Ta 8 > .It powerpc Ta 4 Ta 8 Ta 4 > +.It powerpcspe Ta 4 Ta 8 Ta 4 > .It powerpc64 Ta 8 Ta 8 Ta 8 Insertion sort error here and later. The lists were sorted on name, not on size. 64 is only after spe in size. Bruce From owner-svn-src-head@freebsd.org Wed May 3 06:56:58 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4120ED5B623; Wed, 3 May 2017 06:56:58 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 0C302AAD; Wed, 3 May 2017 06:56:57 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 830FC10725B; Wed, 3 May 2017 16:55:33 +1000 (AEST) Date: Wed, 3 May 2017 16:55:33 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jilles Tjoelker cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317709 - head/usr.bin/csplit In-Reply-To: <201705022156.v42LuKbp088899@repo.freebsd.org> Message-ID: <20170503162918.U1062@besplex.bde.org> References: <201705022156.v42LuKbp088899@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VbSHBBh9 c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=SdYdQEDqucMlUsDrDG4A:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 06:56:58 -0000 On Tue, 2 May 2017, Jilles Tjoelker wrote: > Log: > csplit: Fix check of fputs() return value, making csplit work again. > > As of r295638, fputs() returns the number of bytes written (if not more than > INT_MAX). This broke csplit completely, since csplit assumed only success > only for the return value 0. > > PR: 213510 > Submitted by: J.R. Oldroyd > MFC after: 1 week > Relnotes: yes > > Modified: > head/usr.bin/csplit/csplit.c > > Modified: head/usr.bin/csplit/csplit.c > ============================================================================== > --- head/usr.bin/csplit/csplit.c Tue May 2 21:33:27 2017 (r317708) > +++ head/usr.bin/csplit/csplit.c Tue May 2 21:56:20 2017 (r317709) > @@ -195,7 +195,7 @@ main(int argc, char *argv[]) > /* Copy the rest into a new file. */ > if (!feof(infile)) { > ofp = newfile(); > - while ((p = get_line()) != NULL && fputs(p, ofp) == 0) > + while ((p = get_line()) != NULL && fputs(p, ofp) != EOF) > ; > if (!sflag) > printf("%jd\n", (intmax_t)ftello(ofp)); I don't like checking for the specific value EOF instead of any negative value, though the EOF is Standard and I like checking for specific -1 for sysctls. stdio is not very consistent, and this bug is due to old versions of FreeBSD documenting and returning the specific value 0 on non-error, which was also Standard. Grepping for fputs in /usr/src shows too many instances to check (mostly without any error handling). The simplest filter 'if (fputs' found the dependency on the old FreeBSD behaviour in csplit and 2 other places: contrib/mdocml/main.c: if (fputs(cp, stdout)) { contrib/mdocml/main.c- fclose(stream); contrib/libreadline/examples/rlcat.c: if (fputs (x, stdout) != 0) contrib/libreadline/examples/rlcat.c- return 1; More complicated filters like 'if ([^(]]*[^a-z_]fputs' failed to find any problems since I messed up the regexp. mdocml is undocumented in its on man page, since that man page is a link to mandoc(1) nad doesn't contain the word mdocml. Bruce From owner-svn-src-head@freebsd.org Wed May 3 07:53:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E54DFD5B26B; Wed, 3 May 2017 07:53:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AEE47940; Wed, 3 May 2017 07:53:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v437rFhp035625; Wed, 3 May 2017 07:53:15 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v437rFaa035624; Wed, 3 May 2017 07:53:15 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705030753.v437rFaa035624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 3 May 2017 07:53:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317728 - head/tools/tools/net80211/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 07:53:17 -0000 Author: adrian Date: Wed May 3 07:53:15 2017 New Revision: 317728 URL: https://svnweb.freebsd.org/changeset/base/317728 Log: [net80211] add another hard-learnt lesson about DWDS setup wlanwds monitors the physical interface for DWDS requests from VAPs, but the clone is created against the physical interface. So, if you have a secondary VAP setup (with a separate, non-physical-default MAC address) which is configured for DWDS, the temporary DWDS VAPs created will have the MAC of the parent physical interface and NOT the actual cloned interface + MAC. This .. stumped me for a few minutes. Maybe I'll fix it. Maybe I won't. At least I now have DWDS+encryption working at home. Tested: * yes, with DWDS 11n repeaters now working on freebsd. Modified: head/tools/tools/net80211/scripts/setup.wdsmain Modified: head/tools/tools/net80211/scripts/setup.wdsmain ============================================================================== --- head/tools/tools/net80211/scripts/setup.wdsmain Wed May 3 05:45:43 2017 (r317727) +++ head/tools/tools/net80211/scripts/setup.wdsmain Wed May 3 07:53:15 2017 (r317728) @@ -15,6 +15,13 @@ # otherwise frames transmitted from the WDS AP to the WDS STA # will not be encrypted. # +# * Because wlanwds is running on the physical interface (for now), +# and NOT the parent VAP, it will create cloned interfaces using +# the MAC address of the physical interface. So, until that +# whole setup is fixed, please only associate DWDS to the first +# VAP on a physical interface, which shares the MAC address of +# the physical NIC. +# # $FreeBSD$ # PATH=.:$PATH From owner-svn-src-head@freebsd.org Wed May 3 08:10:05 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10A7DD5B831; Wed, 3 May 2017 08:10:05 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7DBC10F; Wed, 3 May 2017 08:10:04 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v438A3WE039842; Wed, 3 May 2017 08:10:03 GMT (envelope-from n_hibma@FreeBSD.org) Received: (from n_hibma@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v438A3MO039840; Wed, 3 May 2017 08:10:03 GMT (envelope-from n_hibma@FreeBSD.org) Message-Id: <201705030810.v438A3MO039840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: n_hibma set sender to n_hibma@FreeBSD.org using -f From: Nick Hibma Date: Wed, 3 May 2017 08:10:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317729 - head/etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 08:10:05 -0000 Author: n_hibma Date: Wed May 3 08:10:03 2017 New Revision: 317729 URL: https://svnweb.freebsd.org/changeset/base/317729 Log: Silence sysctl in startup scripts. This makes 'stop' behave consistently with 'start' in the script. Also use $SYSCTL instead of sysctl for consistency within that script. MFC after: 3 weeks Modified: head/etc/rc.d/ipfw head/etc/rc.d/routing Modified: head/etc/rc.d/ipfw ============================================================================== --- head/etc/rc.d/ipfw Wed May 3 07:53:15 2017 (r317728) +++ head/etc/rc.d/ipfw Wed May 3 08:10:03 2017 (r317729) @@ -56,7 +56,7 @@ ipfw_start() # if checkyesno firewall_logging; then echo 'Firewall logging enabled.' - sysctl net.inet.ip.fw.verbose=1 >/dev/null + ${SYSCTL} net.inet.ip.fw.verbose=1 >/dev/null fi if checkyesno firewall_logif; then ifconfig ipfw0 create @@ -78,11 +78,11 @@ ipfw_poststart() # Enable the firewall # - if ! ${SYSCTL} net.inet.ip.fw.enable=1 1>/dev/null 2>&1; then + if ! ${SYSCTL} net.inet.ip.fw.enable=1 >/dev/null 2>&1; then warn "failed to enable IPv4 firewall" fi if afexists inet6; then - if ! ${SYSCTL} net.inet6.ip6.fw.enable=1 1>/dev/null 2>&1 + if ! ${SYSCTL} net.inet6.ip6.fw.enable=1 >/dev/null 2>&1 then warn "failed to enable IPv6 firewall" fi @@ -95,9 +95,9 @@ ipfw_stop() # Disable the firewall # - ${SYSCTL} net.inet.ip.fw.enable=0 + ${SYSCTL} net.inet.ip.fw.enable=0 >/dev/null if afexists inet6; then - ${SYSCTL} net.inet6.ip6.fw.enable=0 + ${SYSCTL} net.inet6.ip6.fw.enable=0 >/dev/null fi # Stop firewall coscripts Modified: head/etc/rc.d/routing ============================================================================== --- head/etc/rc.d/routing Wed May 3 07:53:15 2017 (r317728) +++ head/etc/rc.d/routing Wed May 3 08:10:03 2017 (r317729) @@ -281,7 +281,7 @@ static_inet6() esac ifconfig ${ipv6_default_interface} inet6 defaultif - sysctl net.inet6.ip6.use_defaultzone=1 + ${SYSCTL} net.inet6.ip6.use_defaultzone=1 > /dev/null } ropts_init() From owner-svn-src-head@freebsd.org Wed May 3 09:09:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AE59D5ACC9; Wed, 3 May 2017 09:09:36 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0FD86E0; Wed, 3 May 2017 09:09:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4399Zb1064887; Wed, 3 May 2017 09:09:35 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4399ZhC064886; Wed, 3 May 2017 09:09:35 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201705030909.v4399ZhC064886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 3 May 2017 09:09:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317730 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 09:09:36 -0000 Author: tuexen Date: Wed May 3 09:09:34 2017 New Revision: 317730 URL: https://svnweb.freebsd.org/changeset/base/317730 Log: Add support for listen() call. Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Wed May 3 08:10:03 2017 (r317729) +++ head/usr.bin/truss/syscalls.c Wed May 3 09:09:34 2017 (r317730) @@ -212,7 +212,9 @@ static struct syscall decoded_syscalls[] { .name = "linkat", .ret_type = 1, .nargs = 5, .args = { { Atfd, 0 }, { Name, 1 }, { Atfd, 2 }, { Name, 3 }, { Atflags, 4 } } }, - { .name = "lseek", .ret_type = 2, .nargs = 3, + { .name = "listen", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { Int, 1 } } }, + { .name = "lseek", .ret_type = 2, .nargs = 3, .args = { { Int, 0 }, { QuadHex, 1 }, { Whence, 2 } } }, { .name = "lstat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Stat | OUT, 1 } } }, From owner-svn-src-head@freebsd.org Wed May 3 09:20:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 16A4BD592FE; Wed, 3 May 2017 09:20:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDFB4D01; Wed, 3 May 2017 09:20:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v439KaeT068874; Wed, 3 May 2017 09:20:36 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v439Ka1b068872; Wed, 3 May 2017 09:20:36 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201705030920.v439Ka1b068872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 3 May 2017 09:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317731 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 09:20:38 -0000 Author: tuexen Date: Wed May 3 09:20:36 2017 New Revision: 317731 URL: https://svnweb.freebsd.org/changeset/base/317731 Log: Add Socklent for handling args of type socklen_t. Modified: head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Wed May 3 09:09:34 2017 (r317730) +++ head/usr.bin/truss/syscall.h Wed May 3 09:20:36 2017 (r317731) @@ -46,7 +46,7 @@ enum Argtype { None = 1, Hex, Octal, Int LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long, Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2, CapFcntlRights, Fadvice, FileFlags, Flockop, Getfsstatmode, Kldsymcmd, - Kldunloadflags, Sizet, Madvice, + Kldunloadflags, Sizet, Madvice, Socklent, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Wed May 3 09:09:34 2017 (r317730) +++ head/usr.bin/truss/syscalls.c Wed May 3 09:20:36 2017 (r317731) @@ -86,7 +86,7 @@ static struct syscall decoded_syscalls[] { .name = "access", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Accessmode, 1 } } }, { .name = "bind", .ret_type = 1, .nargs = 3, - .args = { { Int, 0 }, { Sockaddr | IN, 1 }, { Int, 2 } } }, + .args = { { Int, 0 }, { Sockaddr | IN, 1 }, { Socklent, 2 } } }, { .name = "bindat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Int, 1 }, { Sockaddr | IN, 2 }, { Int, 3 } } }, @@ -114,7 +114,7 @@ static struct syscall decoded_syscalls[] { .name = "close", .ret_type = 1, .nargs = 1, .args = { { Int, 0 } } }, { .name = "connect", .ret_type = 1, .nargs = 3, - .args = { { Int, 0 }, { Sockaddr | IN, 1 }, { Int, 2 } } }, + .args = { { Int, 0 }, { Sockaddr | IN, 1 }, { Socklent, 2 } } }, { .name = "connectat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Int, 1 }, { Sockaddr | IN, 2 }, { Int, 3 } } }, @@ -290,7 +290,7 @@ static struct syscall decoded_syscalls[] { Timeval, 4 } } }, { .name = "sendto", .ret_type = 1, .nargs = 6, .args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 }, { Hex, 3 }, - { Sockaddr | IN, 4 }, { Int | IN, 5 } } }, + { Sockaddr | IN, 4 }, { Socklent | IN, 5 } } }, { .name = "setitimer", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Itimerval, 1 }, { Itimerval | OUT, 2 } } }, { .name = "setrlimit", .ret_type = 1, .nargs = 2, @@ -1914,6 +1914,9 @@ print_arg(struct syscall_args *sc, unsig case Madvice: print_integer_arg(sysdecode_madvice, fp, args[sc->offset]); break; + case Socklent: + fprintf(fp, "%u", (socklen_t)args[sc->offset]); + break; case CloudABIAdvice: fputs(xlookup(cloudabi_advice, args[sc->offset]), fp); From owner-svn-src-head@freebsd.org Wed May 3 09:23:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6700DD59593; Wed, 3 May 2017 09:23:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 20B9919A; Wed, 3 May 2017 09:23:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v439NEcY072631; Wed, 3 May 2017 09:23:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v439NEWv072629; Wed, 3 May 2017 09:23:14 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201705030923.v439NEWv072629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 3 May 2017 09:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317732 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 09:23:15 -0000 Author: tuexen Date: Wed May 3 09:23:13 2017 New Revision: 317732 URL: https://svnweb.freebsd.org/changeset/base/317732 Log: Decode the third argument of socket(). Modified: head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Wed May 3 09:20:36 2017 (r317731) +++ head/usr.bin/truss/syscall.h Wed May 3 09:23:13 2017 (r317732) @@ -46,7 +46,7 @@ enum Argtype { None = 1, Hex, Octal, Int LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long, Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2, CapFcntlRights, Fadvice, FileFlags, Flockop, Getfsstatmode, Kldsymcmd, - Kldunloadflags, Sizet, Madvice, Socklent, + Kldunloadflags, Sizet, Madvice, Socklent, Sockprotocol, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Wed May 3 09:20:36 2017 (r317731) +++ head/usr.bin/truss/syscalls.c Wed May 3 09:23:13 2017 (r317732) @@ -317,7 +317,7 @@ static struct syscall decoded_syscalls[] { .name = "sigwaitinfo", .ret_type = 1, .nargs = 2, .args = { { Sigset | IN, 0 }, { Ptr, 1 } } }, { .name = "socket", .ret_type = 1, .nargs = 3, - .args = { { Sockdomain, 0 }, { Socktype, 1 }, { Int, 2 } } }, + .args = { { Sockdomain, 0 }, { Socktype, 1 }, { Sockprotocol, 2 } } }, { .name = "stat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Stat | OUT, 1 } } }, { .name = "statfs", .ret_type = 1, .nargs = 2, @@ -1917,6 +1917,17 @@ print_arg(struct syscall_args *sc, unsig case Socklent: fprintf(fp, "%u", (socklen_t)args[sc->offset]); break; + case Sockprotocol: { + int protocol; + + protocol = args[sc->offset]; + if (protocol == 0) { + fputs("0", fp); + } else { + print_integer_arg(sysdecode_ipproto, fp, protocol); + } + break; + } case CloudABIAdvice: fputs(xlookup(cloudabi_advice, args[sc->offset]), fp); From owner-svn-src-head@freebsd.org Wed May 3 10:06:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 996E9D5B8D2; Wed, 3 May 2017 10:06:40 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 251C2F84; Wed, 3 May 2017 10:06:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v43A6X8U066204 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 3 May 2017 13:06:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v43A6X8U066204 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v43A6W1w066202; Wed, 3 May 2017 13:06:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 3 May 2017 13:06:32 +0300 From: Konstantin Belousov To: Bruce Evans Cc: emaste@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317681 - head/share/man/man7 Message-ID: <20170503100632.GQ1622@kib.kiev.ua> References: <201705021452.v42EqZSB010115@repo.freebsd.org> <20170503013818.F2099@besplex.bde.org> <20170502174455.GJ1622@kib.kiev.ua> <20170503035045.Q2870@besplex.bde.org> <20170502194525.GL1622@kib.kiev.ua> <20170503153946.M910@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170503153946.M910@besplex.bde.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 10:06:40 -0000 On Wed, May 03, 2017 at 04:19:08PM +1000, Bruce Evans wrote: > On Tue, 2 May 2017, Konstantin Belousov wrote: > OK. > > Including corrections by ngie: > > > diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 > > index 1ce397a303e..ad1abccc2e5 100644 > > --- a/share/man/man7/arch.7 > > +++ b/share/man/man7/arch.7 > > @@ -37,6 +37,8 @@ Differences between CPU architectures and platforms supported by > > .Fx . > > .Pp > > This .Pp gives misformatting (an extra blank line) when followed by .Ss. > Apparently, .Ss gives its own paragraph break. > > > .Ss Type sizes > > +If not explicitely mentioned, sizes are in bytes. > > "explicitly" > > This should be moved higher, so that it applies to the "Page Size" section. > The first clause isn't needed, since there are no explicit mentions of > sizes not in bytes (there is only "80 bits" for some FP values which don't > claim to be sizes and aren't really sizes and should be changed to "64 > bits" and claim to be precisions). > > > +.Pp > > Check the formatting after moving the addition higher. There will be 2 > very short paragraphs if you keep this .Pp. Ok, see the cumulative changes in the patch. > > > On all supported architectures, > > The comma at the end of this should be a colon. Ok. > > +.Pp > > +.Sy time_t > > +is always signed, it is 64-bits everywere except on i386 and 32-bit powerpc. > > Change "is always" to "On all supported arches" as elsewhere. > > "everywhere" > > "everywhere" is redundant. Ok. > > The whole second clause is redundant. Remove it. Leave it to the reader > to notice that the table has more 8's than 4's, and where the 4's are. No, this is one of the important reasons why this narrative text added at all. > This also fixes: > - bad grammar (comma splice). In general, use separate sentences, since > the rules for splicing clauses using commas and semicolons or avoiding > these using a word are complicated, though I used splicing in this > sentence to help make it so complicated (IIRC, "since" here is a > splicing method with some technical name like "conjunctive adjective"). > - inconsistent units (bytes in the table and bits here). Ok. diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 index 47a72a1986d..62781430329 100644 --- a/share/man/man7/arch.7 +++ b/share/man/man7/arch.7 @@ -36,8 +36,9 @@ Differences between CPU architectures and platforms supported by .Fx . .Pp +If not explicitly mentioned, sizes are in bytes. .Ss Type sizes -On all supported architectures, +On all supported architectures: .Bl -column -offset -indent "long long" "Size" .It Sy Type Ta Sy Size .It short Ta 2 @@ -47,8 +48,10 @@ On all supported architectures, .It float Ta 4 .It double Ta 8 .El -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) +.Pp +Machine-dependent type sizes: +.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t" +.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t .It amd64 Ta 8 Ta 16 Ta 8 .It arm Ta 4 Ta 8 Ta 8 .It armeb Ta 4 Ta 8 Ta 8 @@ -70,6 +73,10 @@ On all supported architectures, .It riscv Ta 8 Ta 16 Ta 8 .It sparc64 Ta 8 Ta 16 Ta 8 .El +.Pp +.Sy time_t +is 8 bytes on all supported architectures except i386 and 32-bit +variants of powerpc. .Ss Endianness and Char Signedness .Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char Signedness" .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness From owner-svn-src-head@freebsd.org Wed May 3 10:57:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2866D5B51A; Wed, 3 May 2017 10:57:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 9AAA0C59; Wed, 3 May 2017 10:57:16 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id BF8B4D4A0F3; Wed, 3 May 2017 20:57:13 +1000 (AEST) Date: Wed, 3 May 2017 20:57:10 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , emaste@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317681 - head/share/man/man7 In-Reply-To: <20170503100632.GQ1622@kib.kiev.ua> Message-ID: <20170503203449.E1771@besplex.bde.org> References: <201705021452.v42EqZSB010115@repo.freebsd.org> <20170503013818.F2099@besplex.bde.org> <20170502174455.GJ1622@kib.kiev.ua> <20170503035045.Q2870@besplex.bde.org> <20170502194525.GL1622@kib.kiev.ua> <20170503153946.M910@besplex.bde.org> <20170503100632.GQ1622@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=ln2-go5XBsRzc8yLV5wA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 10:57:18 -0000 On Wed, 3 May 2017, Konstantin Belousov wrote: > On Wed, May 03, 2017 at 04:19:08PM +1000, Bruce Evans wrote: >> On Tue, 2 May 2017, Konstantin Belousov wrote: >>> +.Pp >>> +.Sy time_t >>> +is always signed, it is 64-bits everywere except on i386 and 32-bit powerpc. >> >> Change "is always" to "On all supported arches" as elsewhere. >> >> "everywhere" >> >> "everywhere" is redundant. > Ok. > >> >> The whole second clause is redundant. Remove it. Leave it to the reader >> to notice that the table has more 8's than 4's, and where the 4's are. > No, this is one of the important reasons why this narrative text added > at all. Why? You just added time_t to the table. It needs to be described twice less than most types. Now I don't like the indirection long -> sizeof(void *) in the first table. This is the only place where the size is not given as a literal. There used to be space in the second table to give the size of long explicitly. Now the space is used for time_t. It doesn't belong in the same table, since it is not a basic type. Also, intptr_t and intmax_t are not in the tables. > diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 > index 47a72a1986d..62781430329 100644 > --- a/share/man/man7/arch.7 > +++ b/share/man/man7/arch.7 > @@ -36,8 +36,9 @@ > Differences between CPU architectures and platforms supported by > .Fx . > .Pp > +If not explicitly mentioned, sizes are in bytes. The first clause is redundant. There are no explicit mentions of non-byte sizes. > .Ss Type sizes > -On all supported architectures, > +On all supported architectures: I see a further problem with this clause. It is separated from the table that it applies to, by both indentation and a blank line, so it appears to apply to the second table also. Later sections don't have a blank line where they reasonably could. They start with a section header, then no blank line between that and the single table in the section. Bruce From owner-svn-src-head@freebsd.org Wed May 3 11:47:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3ED62D5B5BE for ; Wed, 3 May 2017 11:47:34 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-63.reflexion.net [208.70.210.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E773CC89 for ; Wed, 3 May 2017 11:47:33 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 9591 invoked from network); 3 May 2017 11:47:32 -0000 Received: from unknown (HELO rtc-sm-01.app.dca.reflexion.local) (10.81.150.1) by 0 (rfx-qmail) with SMTP; 3 May 2017 11:47:32 -0000 Received: by rtc-sm-01.app.dca.reflexion.local (Reflexion email security v8.40.0) with SMTP; Wed, 03 May 2017 07:47:32 -0400 (EDT) Received: (qmail 500 invoked from network); 3 May 2017 11:47:31 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 3 May 2017 11:47:31 -0000 Received: from [192.168.1.106] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id 33690EC7E18; Wed, 3 May 2017 04:47:31 -0700 (PDT) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r317659 - head/sys/dev/uart [head -r317729 for armv6/7: ns8250_drain : error: implicit declaration of function 'ns8250_drain' is invalid in C99] Message-Id: Date: Wed, 3 May 2017 04:47:30 -0700 To: mav@FreeBSD.org, svn-src-head@freebsd.org, freebsd-arm , FreeBSD Current X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 11:47:34 -0000 > Author: mav > Date: Mon May 1 19:47:10 2017 > New Revision: 317659 > URL:=20 > https://svnweb.freebsd.org/changeset/base/317659 >=20 >=20 > Log: > Make some UART consoles to not spin wait for data to be sent. > =20 > At least with Tx FIFO enabled it shows me ~10% reduction of verbose = boot > time with serial console at 115200 baud. > =20 > Reviewed by: marcel > MFC after: 2 weeks >=20 > Modified: > head/sys/dev/uart/uart_dev_lpc.c > head/sys/dev/uart/uart_dev_ns8250.c After building head -r317729 for amd64 and aarch64, when I tried armv6 I instead got the following failure: --- uart_dev_lpc.o --- /usr/src/sys/dev/uart/uart_dev_lpc.c:892:4: error: implicit declaration = of function 'ns8250_drain' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] ns8250_drain(bas, UART_DRAIN_TRANSMITTER); ^ /usr/src/sys/dev/uart/uart_dev_lpc.c:892:4: note: did you mean = 'lpc_ns8250_drain'? /usr/src/sys/dev/uart/uart_dev_lpc.c:140:1: note: 'lpc_ns8250_drain' = declared here lpc_ns8250_drain(struct uart_bas *bas, int what) ^ /usr/src/sys/dev/uart/uart_dev_lpc.c:892:4: error: this function = declaration is not a prototype [-Werror,-Wstrict-prototypes] ns8250_drain(bas, UART_DRAIN_TRANSMITTER); ^ 2 errors generated. =3D=3D=3D Mark Millard markmi at dsl-only.net From owner-svn-src-head@freebsd.org Wed May 3 12:18:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32165D5C5C9; Wed, 3 May 2017 12:18:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB0646DC; Wed, 3 May 2017 12:18:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43CIAwR042794; Wed, 3 May 2017 12:18:10 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43CI99v042792; Wed, 3 May 2017 12:18:09 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201705031218.v43CI99v042792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 3 May 2017 12:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317736 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 12:18:11 -0000 Author: tuexen Date: Wed May 3 12:18:09 2017 New Revision: 317736 URL: https://svnweb.freebsd.org/changeset/base/317736 Log: Add support for [gs]etsockopt(). Modified: head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Wed May 3 09:54:37 2017 (r317735) +++ head/usr.bin/truss/syscall.h Wed May 3 12:18:09 2017 (r317736) @@ -46,7 +46,8 @@ enum Argtype { None = 1, Hex, Octal, Int LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long, Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2, CapFcntlRights, Fadvice, FileFlags, Flockop, Getfsstatmode, Kldsymcmd, - Kldunloadflags, Sizet, Madvice, Socklent, Sockprotocol, + Kldunloadflags, Sizet, Madvice, Socklent, Sockprotocol, Sockoptlevel, + Sockoptname, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Wed May 3 09:54:37 2017 (r317735) +++ head/usr.bin/truss/syscalls.c Wed May 3 12:18:09 2017 (r317736) @@ -174,6 +174,9 @@ static struct syscall decoded_syscalls[] .args = { { Int, 0 } } }, { .name = "getsockname", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } }, + { .name = "getsockopt", .ret_type = 1, .nargs = 5, + .args = { { Int, 0 }, { Sockoptlevel, 1 }, { Sockoptname, 2 }, + { Ptr | OUT, 3 }, { Ptr | OUT, 4 } } }, { .name = "gettimeofday", .ret_type = 1, .nargs = 2, .args = { { Timeval | OUT, 0 }, { Ptr, 1 } } }, { .name = "ioctl", .ret_type = 1, .nargs = 3, @@ -295,6 +298,9 @@ static struct syscall decoded_syscalls[] .args = { { Int, 0 }, { Itimerval, 1 }, { Itimerval | OUT, 2 } } }, { .name = "setrlimit", .ret_type = 1, .nargs = 2, .args = { { Resource, 0 }, { Rlimit | IN, 1 } } }, + { .name = "setsockopt", .ret_type = 1, .nargs = 5, + .args = { { Int, 0 }, { Sockoptlevel, 1 }, { Sockoptname, 2 }, + { Ptr | IN, 3 }, { Socklent, 4 } } }, { .name = "shutdown", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Shutdown, 1 } } }, { .name = "sigaction", .ret_type = 1, .nargs = 3, @@ -1928,6 +1934,24 @@ print_arg(struct syscall_args *sc, unsig } break; } + case Sockoptlevel: + print_integer_arg(sysdecode_sockopt_level, fp, + args[sc->offset]); + break; + case Sockoptname: { + const char *temp; + int level, name; + + level = args[sc->offset - 1]; + name = args[sc->offset]; + temp = sysdecode_sockopt_name(level, name); + if (temp) { + fputs(temp, fp); + } else { + fprintf(fp, "%d", name); + } + break; + } case CloudABIAdvice: fputs(xlookup(cloudabi_advice, args[sc->offset]), fp); From owner-svn-src-head@freebsd.org Wed May 3 12:23:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C930CD5C9E3; Wed, 3 May 2017 12:23:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F65ED39; Wed, 3 May 2017 12:23:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43CNwoX046858; Wed, 3 May 2017 12:23:58 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43CNwhU046856; Wed, 3 May 2017 12:23:58 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201705031223.v43CNwhU046856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 3 May 2017 12:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317737 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 12:23:59 -0000 Author: tuexen Date: Wed May 3 12:23:58 2017 New Revision: 317737 URL: https://svnweb.freebsd.org/changeset/base/317737 Log: Decode the fourth argument of sendto and recvfrom call. Modified: head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscall.h ============================================================================== --- head/usr.bin/truss/syscall.h Wed May 3 12:18:09 2017 (r317736) +++ head/usr.bin/truss/syscall.h Wed May 3 12:23:58 2017 (r317737) @@ -47,7 +47,7 @@ enum Argtype { None = 1, Hex, Octal, Int Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2, CapFcntlRights, Fadvice, FileFlags, Flockop, Getfsstatmode, Kldsymcmd, Kldunloadflags, Sizet, Madvice, Socklent, Sockprotocol, Sockoptlevel, - Sockoptname, + Sockoptname, Msgflags, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Wed May 3 12:18:09 2017 (r317736) +++ head/usr.bin/truss/syscalls.c Wed May 3 12:23:58 2017 (r317737) @@ -278,8 +278,9 @@ static struct syscall decoded_syscalls[] .args = { { Atfd, 0 }, { Name, 1 }, { Readlinkres | OUT, 2 }, { Sizet, 3 } } }, { .name = "recvfrom", .ret_type = 1, .nargs = 6, - .args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 }, { Hex, 3 }, - { Sockaddr | OUT, 4 }, { Ptr | OUT, 5 } } }, + .args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 }, + { Msgflags, 3 }, { Sockaddr | OUT, 4 }, + { Ptr | OUT, 5 } } }, { .name = "rename", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Name, 1 } } }, { .name = "renameat", .ret_type = 1, .nargs = 4, @@ -292,8 +293,9 @@ static struct syscall decoded_syscalls[] .args = { { Int, 0 }, { Fd_set, 1 }, { Fd_set, 2 }, { Fd_set, 3 }, { Timeval, 4 } } }, { .name = "sendto", .ret_type = 1, .nargs = 6, - .args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 }, { Hex, 3 }, - { Sockaddr | IN, 4 }, { Socklent | IN, 5 } } }, + .args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 }, + { Msgflags, 3 }, { Sockaddr | IN, 4 }, + { Socklent | IN, 5 } } }, { .name = "setitimer", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Itimerval, 1 }, { Itimerval | OUT, 2 } } }, { .name = "setrlimit", .ret_type = 1, .nargs = 2, @@ -1952,6 +1954,9 @@ print_arg(struct syscall_args *sc, unsig } break; } + case Msgflags: + print_mask_arg(sysdecode_msg_flags, fp, args[sc->offset]); + break; case CloudABIAdvice: fputs(xlookup(cloudabi_advice, args[sc->offset]), fp); From owner-svn-src-head@freebsd.org Wed May 3 12:24:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99A30D5CA3A; Wed, 3 May 2017 12:24:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66A77E93; Wed, 3 May 2017 12:24:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43COVaB046930; Wed, 3 May 2017 12:24:31 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43COVYk046929; Wed, 3 May 2017 12:24:31 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201705031224.v43COVYk046929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 3 May 2017 12:24:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317738 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 12:24:32 -0000 Author: andrew Date: Wed May 3 12:24:31 2017 New Revision: 317738 URL: https://svnweb.freebsd.org/changeset/base/317738 Log: Print all virtual addresses in the show vtop ddb command. The results may be different with PAN enabled. MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Wed May 3 12:23:58 2017 (r317737) +++ head/sys/arm64/arm64/machdep.c Wed May 3 12:24:31 2017 (r317738) @@ -1141,9 +1141,13 @@ DB_SHOW_COMMAND(vtop, db_show_vtop) if (have_addr) { phys = arm64_address_translate_s1e1r(addr); - db_printf("Physical address reg (read): 0x%016lx\n", phys); + db_printf("EL1 physical address reg (read): 0x%016lx\n", phys); phys = arm64_address_translate_s1e1w(addr); - db_printf("Physical address reg (write): 0x%016lx\n", phys); + db_printf("EL1 physical address reg (write): 0x%016lx\n", phys); + phys = arm64_address_translate_s1e0r(addr); + db_printf("EL0 physical address reg (read): 0x%016lx\n", phys); + phys = arm64_address_translate_s1e0w(addr); + db_printf("EL0 physical address reg (write): 0x%016lx\n", phys); } else db_printf("show vtop \n"); } From owner-svn-src-head@freebsd.org Wed May 3 12:26:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AE65D5CAB5; Wed, 3 May 2017 12:26:18 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB4837B; Wed, 3 May 2017 12:26:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43CQGjC047042; Wed, 3 May 2017 12:26:16 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43CQGLg047041; Wed, 3 May 2017 12:26:16 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201705031226.v43CQGLg047041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 3 May 2017 12:26:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317739 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 12:26:18 -0000 Author: tuexen Date: Wed May 3 12:26:16 2017 New Revision: 317739 URL: https://svnweb.freebsd.org/changeset/base/317739 Log: Add support for sendmsg() and recvmsg(). Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Wed May 3 12:24:31 2017 (r317738) +++ head/usr.bin/truss/syscalls.c Wed May 3 12:26:16 2017 (r317739) @@ -281,6 +281,8 @@ static struct syscall decoded_syscalls[] .args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 }, { Msgflags, 3 }, { Sockaddr | OUT, 4 }, { Ptr | OUT, 5 } } }, + { .name = "recvmsg", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Ptr, 1 }, { Msgflags, 2 } } }, { .name = "rename", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Name, 1 } } }, { .name = "renameat", .ret_type = 1, .nargs = 4, @@ -292,6 +294,8 @@ static struct syscall decoded_syscalls[] { .name = "select", .ret_type = 1, .nargs = 5, .args = { { Int, 0 }, { Fd_set, 1 }, { Fd_set, 2 }, { Fd_set, 3 }, { Timeval, 4 } } }, + { .name = "sendmsg", .ret_type = 1, .nargs = 3, + .args = { { Int, 0 }, { Ptr, 1 }, { Msgflags, 2 } } }, { .name = "sendto", .ret_type = 1, .nargs = 6, .args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 }, { Msgflags, 3 }, { Sockaddr | IN, 4 }, From owner-svn-src-head@freebsd.org Wed May 3 12:41:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BDBAD5B044; Wed, 3 May 2017 12:41:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C52E8C49; Wed, 3 May 2017 12:41:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v43CfHCU000303 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 3 May 2017 15:41:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v43CfHCU000303 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v43CfGdt000302; Wed, 3 May 2017 15:41:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 3 May 2017 15:41:16 +0300 From: Konstantin Belousov To: Bruce Evans Cc: emaste@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317681 - head/share/man/man7 Message-ID: <20170503124116.GR1622@kib.kiev.ua> References: <201705021452.v42EqZSB010115@repo.freebsd.org> <20170503013818.F2099@besplex.bde.org> <20170502174455.GJ1622@kib.kiev.ua> <20170503035045.Q2870@besplex.bde.org> <20170502194525.GL1622@kib.kiev.ua> <20170503153946.M910@besplex.bde.org> <20170503100632.GQ1622@kib.kiev.ua> <20170503203449.E1771@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170503203449.E1771@besplex.bde.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 12:41:28 -0000 On Wed, May 03, 2017 at 08:57:10PM +1000, Bruce Evans wrote: > On Wed, 3 May 2017, Konstantin Belousov wrote: > > > On Wed, May 03, 2017 at 04:19:08PM +1000, Bruce Evans wrote: > >> On Tue, 2 May 2017, Konstantin Belousov wrote: > >>> +.Pp > >>> +.Sy time_t > >>> +is always signed, it is 64-bits everywere except on i386 and 32-bit powerpc. > >> > >> Change "is always" to "On all supported arches" as elsewhere. > >> > >> "everywhere" > >> > >> "everywhere" is redundant. > > Ok. > > > >> > >> The whole second clause is redundant. Remove it. Leave it to the reader > >> to notice that the table has more 8's than 4's, and where the 4's are. > > No, this is one of the important reasons why this narrative text added > > at all. > > Why? You just added time_t to the table. It needs to be described twice > less than most types. > > Now I don't like the indirection long -> sizeof(void *) in the first table. > This is the only place where the size is not given as a literal. There > used to be space in the second table to give the size of long explicitly. > Now the space is used for time_t. It doesn't belong in the same table, > since it is not a basic type. > > Also, intptr_t and intmax_t are not in the tables. > > > diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 > > index 47a72a1986d..62781430329 100644 > > --- a/share/man/man7/arch.7 > > +++ b/share/man/man7/arch.7 > > @@ -36,8 +36,9 @@ > > Differences between CPU architectures and platforms supported by > > .Fx . > > .Pp > > +If not explicitly mentioned, sizes are in bytes. > > The first clause is redundant. There are no explicit mentions of non-byte > sizes. > > > .Ss Type sizes > > -On all supported architectures, > > +On all supported architectures: > > I see a further problem with this clause. It is separated from the table > that it applies to, by both indentation and a blank line, so it appears > to apply to the second table also. > > Later sections don't have a blank line where they reasonably could. They > start with a section header, then no blank line between that and the single > table in the section. Th discussion is now reduced to the opinions. Do you have any further objections due to factual mistakes or language errors in the proposed patch ? If not, I will commit it as is. From owner-svn-src-head@freebsd.org Wed May 3 13:17:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CDE9D5BC47; Wed, 3 May 2017 13:17:03 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE007377; Wed, 3 May 2017 13:17:02 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43DH2MI067608; Wed, 3 May 2017 13:17:02 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43DH1Ok067603; Wed, 3 May 2017 13:17:01 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705031317.v43DH1Ok067603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 3 May 2017 13:17:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317740 - head/sys/dev/isp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 13:17:03 -0000 Author: ken Date: Wed May 3 13:17:01 2017 New Revision: 317740 URL: https://svnweb.freebsd.org/changeset/base/317740 Log: Correct loop mode CRN resets to adhere to FCP-4 section 4.10 Prior to this change, the CRN (Command Reference Number) is reset on any firmware LIP, LOOP DOWN, or LOOP RESET event in violation of FCP-4 which specifies that the CRN should only be reset in response to a LIP Reset (LIPyx) primitive. FCP-4 also indicates PLOGI/LOGO and PRLI/PRLO ELS actions as conditions for resetting the CRN for the associated initiator port. These violations manifest themselves when the HBA is removed from the loop, or a target device is removed (especially during an outstanding command) without power cycling. If the HBA and and the target device determine upon re-establishing the loop that no PLOGI or PRLI is required, and the target does not issue a LIPxy to the initiator, the CRN for the target will have been improperly reset by the isp driver. As a result, the target port will silently ignore all FCP commands issued during the device probe (which will time out) preventing the device from attaching. This change corrects thie CRN reset behavior in response to loop state changes, also introduces CRN resets for the above mentioned ELS actions as encountered through async PDB change events. This change also adds cleanup of outstanding commands in isp_loop_dead() that was previously missing. sys/dev/isp/isp.c Add the last login state to debug output when syncing the pdb sys/dev/isp/isp_freebsd.c Replace binary statement setting aborted ccb status in isp_watchdog() with the XS_SETERR macro used elsewhere In isp_loop_dead(), abort or complete pending commands as done in isp_watchdog() In isp_async(), segregate the ISPASYNC_LOOP_RESET action from ISPASYNC_LIP, ISPASYNC_LOOP_DOWN, and ISPASYNC_LOOP_UP fallthroughs, and only reset the CRN in the RESET case. Also add checks to handle false LOOP RESET actions that do not have a proper associated LIP primitive, and log the primitive in the debug messages In isp_async(), remove the goto from ISP_ASYNC_DEV_STAYED, and only reset the CRN in the DEV_CHANGED action In isp_async(), when processing an ISPASYNC_CHANGE_PDB status, reset CRN(s) for the associated nphdl (or all ports) if the change reason is some form of ELS login/logout. Also remove assignment to fc since it is not used in the scope sys/dev/isp/ispmbox.h Add macro definition for the global N-Port handle, and correct a macro typo 'PDB24XX_AE_PRLI_DONJE' sys/dev/isp/ispvar.h Add macros FCP_AL_DA_ALL, FCP_AL_PA, and FCP_IS_DEST_ALPD for more legible code when determining if an AL_PD port matches the portid for a given struct fcparam* by value or by virtue of the AL_PD port being 0xFF Submitted by: Reid Linnemann Sponsored by: Spectra Logic MFC after: 1 week Modified: head/sys/dev/isp/isp.c head/sys/dev/isp/isp_freebsd.c head/sys/dev/isp/ispmbox.h head/sys/dev/isp/ispvar.h Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Wed May 3 12:26:16 2017 (r317739) +++ head/sys/dev/isp/isp.c Wed May 3 13:17:01 2017 (r317740) @@ -2771,10 +2771,11 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui pdb->portid = BITS2WORD_24XX(un.bill.pdb_portid_bits); ISP_MEMCPY(pdb->portname, un.bill.pdb_portname, 8); ISP_MEMCPY(pdb->nodename, un.bill.pdb_nodename, 8); - isp_prt(isp, ISP_LOGDEBUG1, - "Chan %d handle 0x%x Port 0x%06x flags 0x%x curstate %x", + isp_prt(isp, ISP_LOGDEBUG0, + "Chan %d handle 0x%x Port 0x%06x flags 0x%x curstate %x laststate %x", chan, id, pdb->portid, un.bill.pdb_flags, - un.bill.pdb_curstate); + un.bill.pdb_curstate, un.bill.pdb_laststate); + if (un.bill.pdb_curstate < PDB2400_STATE_PLOGI_DONE || un.bill.pdb_curstate > PDB2400_STATE_LOGGED_IN) { mbs.param[0] = MBOX_NOT_LOGGED_IN; return (mbs.param[0]); Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Wed May 3 12:26:16 2017 (r317739) +++ head/sys/dev/isp/isp_freebsd.c Wed May 3 13:17:01 2017 (r317740) @@ -2567,8 +2567,7 @@ isp_watchdog(void *arg) } isp_destroy_handle(isp, handle); isp_prt(isp, ISP_LOGERR, "%s: timeout for handle 0x%x", __func__, handle); - xs->ccb_h.status &= ~CAM_STATUS_MASK; - xs->ccb_h.status |= CAM_CMD_TIMEOUT; + XS_SETERR(xs, CAM_CMD_TIMEOUT); isp_done(xs); } else { if (ohandle != ISP_HANDLE_FREE) { @@ -2739,9 +2738,6 @@ isp_loop_dead(ispsoftc_t *isp, int chan) if (lp->state == FC_PORTDB_STATE_NIL) continue; - /* - * XXX: CLEAN UP AND COMPLETE ANY PENDING COMMANDS FIRST! - */ for (i = 0; i < isp->isp_maxcmds; i++) { struct ccb_scsiio *xs; @@ -2757,6 +2753,25 @@ isp_loop_dead(ispsoftc_t *isp, int chan) isp_prt(isp, ISP_LOGWARN, "command handle 0x%x for %d.%d.%jx orphaned by loop down timeout", isp->isp_xflist[i].handle, chan, XS_TGT(xs), (uintmax_t)XS_LUN(xs)); + + /* + * Just like in isp_watchdog, abort the outstanding + * command or immediately free its resources if it is + * not active + */ + if (isp_control(isp, ISPCTL_ABORT_CMD, xs) == 0) { + continue; + } + + if (XS_XFRLEN(xs)) { + ISP_DMAFREE(isp, xs, isp->isp_xflist[i].handle); + } + isp_destroy_handle(isp, isp->isp_xflist[i].handle); + isp_prt(isp, ISP_LOGWARN, "command handle 0x%x for %d.%d.%jx could not be aborted and was destroyed", + isp->isp_xflist[i].handle, chan, XS_TGT(xs), + (uintmax_t)XS_LUN(xs)); + XS_SETERR(xs, HBA_BUSRESET); + isp_done(xs); } isp_prt(isp, ISP_LOGCONFIG, prom3, chan, dbidx, lp->portid, "Loop Down Timeout"); @@ -3562,7 +3577,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm static const char prom[] = "Chan %d [%d] WWPN 0x%16jx PortID 0x%06x handle 0x%x %s %s"; char buf[64]; char *msg = NULL; - target_id_t tgt; + target_id_t tgt = 0; fcportdb_t *lp; struct isp_fc *fc; struct cam_path *tmppath; @@ -3639,30 +3654,50 @@ isp_async(ispsoftc_t *isp, ispasync_t cm } break; } + case ISPASYNC_LOOP_RESET: + { + uint16_t lipp; + fcparam *fcp; + va_start(ap, cmd); + bus = va_arg(ap, int); + va_end(ap); + + lipp = ISP_READ(isp, OUTMAILBOX1); + fcp = FCPARAM(isp, bus); + + isp_prt(isp, ISP_LOGINFO, "Chan %d LOOP Reset, LIP primitive %x", bus, lipp); + /* + * Per FCP-4, a Reset LIP should result in a CRN reset. Other + * LIPs and loop up/down events should never reset the CRN. For + * an as of yet unknown reason, 24xx series cards (and + * potentially others) can interrupt with a LIP Reset status + * when no LIP reset came down the wire. Additionally, the LIP + * primitive accompanying this status would not be a valid LIP + * Reset primitive, but some variation of an invalid AL_PA + * LIP. As a result, we have to verify the AL_PD in the LIP + * addresses our port before blindly resetting. + */ + if (FCP_IS_DEST_ALPD(fcp, (lipp & 0x00FF))) + isp_fcp_reset_crn(isp, bus, /*tgt*/0, /*tgt_set*/ 0); + isp_loop_changed(isp, bus); + break; + } case ISPASYNC_LIP: if (msg == NULL) msg = "LIP Received"; /* FALLTHROUGH */ - case ISPASYNC_LOOP_RESET: - if (msg == NULL) - msg = "LOOP Reset"; - /* FALLTHROUGH */ case ISPASYNC_LOOP_DOWN: if (msg == NULL) msg = "LOOP Down"; - va_start(ap, cmd); - bus = va_arg(ap, int); - va_end(ap); - isp_fcp_reset_crn(isp, bus, /*tgt*/0, /*tgt_set*/ 0); - isp_loop_changed(isp, bus); - isp_prt(isp, ISP_LOGINFO, "Chan %d %s", bus, msg); - break; + /* FALLTHROUGH */ case ISPASYNC_LOOP_UP: + if (msg == NULL) + msg = "LOOP Up"; va_start(ap, cmd); bus = va_arg(ap, int); va_end(ap); isp_loop_changed(isp, bus); - isp_prt(isp, ISP_LOGINFO, "Chan %d Loop UP", bus); + isp_prt(isp, ISP_LOGINFO, "Chan %d %s", bus, msg); break; case ISPASYNC_DEV_ARRIVED: va_start(ap, cmd); @@ -3692,6 +3727,7 @@ isp_async(ispsoftc_t *isp, ispasync_t cm } break; case ISPASYNC_DEV_CHANGED: + case ISPASYNC_DEV_STAYED: va_start(ap, cmd); bus = va_arg(ap, int); lp = va_arg(ap, fcportdb_t *); @@ -3699,18 +3735,23 @@ isp_async(ispsoftc_t *isp, ispasync_t cm fc = ISP_FC_PC(isp, bus); tgt = FC_PORTDB_TGT(isp, bus, lp); isp_gen_role_str(buf, sizeof (buf), lp->new_prli_word3); - isp_prt(isp, ISP_LOGCONFIG, prom, bus, tgt, lp->port_wwn, lp->new_portid, lp->handle, buf, "changed"); -changed: + if (cmd == ISPASYNC_DEV_CHANGED) + isp_prt(isp, ISP_LOGCONFIG, prom, bus, tgt, lp->port_wwn, lp->new_portid, lp->handle, buf, "changed"); + else + isp_prt(isp, ISP_LOGCONFIG, prom, bus, tgt, lp->port_wwn, lp->portid, lp->handle, buf, "stayed"); + if (lp->is_target != ((FCPARAM(isp, bus)->role & ISP_ROLE_INITIATOR) && (lp->new_prli_word3 & PRLI_WD3_TARGET_FUNCTION))) { lp->is_target = !lp->is_target; if (lp->is_target) { - isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1); + if (cmd == ISPASYNC_DEV_CHANGED) + isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1); isp_make_here(isp, lp, bus, tgt); } else { isp_make_gone(isp, lp, bus, tgt); - isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1); + if (cmd == ISPASYNC_DEV_CHANGED) + isp_fcp_reset_crn(isp, bus, tgt, /*tgt_set*/ 1); } } if (lp->is_initiator != @@ -3726,16 +3767,6 @@ changed: xpt_async(AC_CONTRACT, fc->path, &ac); } break; - case ISPASYNC_DEV_STAYED: - va_start(ap, cmd); - bus = va_arg(ap, int); - lp = va_arg(ap, fcportdb_t *); - va_end(ap); - fc = ISP_FC_PC(isp, bus); - tgt = FC_PORTDB_TGT(isp, bus, lp); - isp_gen_role_str(buf, sizeof (buf), lp->prli_word3); - isp_prt(isp, ISP_LOGCONFIG, prom, bus, tgt, lp->port_wwn, lp->portid, lp->handle, buf, "stayed"); - goto changed; case ISPASYNC_DEV_GONE: va_start(ap, cmd); bus = va_arg(ap, int); @@ -3781,10 +3812,45 @@ changed: va_end(ap); if (evt == ISPASYNC_CHANGE_PDB) { + int tgt_set = 0; msg = "Port Database Changed"; isp_prt(isp, ISP_LOGINFO, "Chan %d %s (nphdl 0x%x state 0x%x reason 0x%x)", bus, msg, nphdl, nlstate, reason); + /* + * Port database syncs are not sufficient for + * determining that logins or logouts are done on the + * loop, but this information is directly available from + * the reason code from the incoming mbox. We must reset + * the fcp crn on these events according to FCP-4 + */ + switch (reason) { + case PDB24XX_AE_IMPL_LOGO_1: + case PDB24XX_AE_IMPL_LOGO_2: + case PDB24XX_AE_IMPL_LOGO_3: + case PDB24XX_AE_PLOGI_RCVD: + case PDB24XX_AE_PRLI_RCVD: + case PDB24XX_AE_PRLO_RCVD: + case PDB24XX_AE_LOGO_RCVD: + case PDB24XX_AE_PLOGI_DONE: + case PDB24XX_AE_PRLI_DONE: + /* + * If the event is not global, twiddle tgt and + * tgt_set to nominate only the target + * associated with the nphdl. + */ + if (nphdl != PDB24XX_AE_GLOBAL) { + /* Break if we don't yet have the pdb */ + if (!isp_find_pdb_by_handle(isp, bus, nphdl, &lp)) + break; + tgt = FC_PORTDB_TGT(isp, bus, lp); + tgt_set = 1; + } + isp_fcp_reset_crn(isp, bus, tgt, tgt_set); + break; + default: + break; /* NOP */ + } } else if (evt == ISPASYNC_CHANGE_SNS) { msg = "Name Server Database Changed"; isp_prt(isp, ISP_LOGINFO, "Chan %d %s (PortID 0x%06x)", Modified: head/sys/dev/isp/ispmbox.h ============================================================================== --- head/sys/dev/isp/ispmbox.h Wed May 3 12:26:16 2017 (r317739) +++ head/sys/dev/isp/ispmbox.h Wed May 3 13:17:01 2017 (r317740) @@ -1421,6 +1421,10 @@ typedef struct { /* * Port Database Changed Async Event information for 24XX cards */ +/* N-Port Handle */ +#define PDB24XX_AE_GLOBAL 0xFFFF + +/* Reason Codes */ #define PDB24XX_AE_OK 0x00 #define PDB24XX_AE_IMPL_LOGO_1 0x01 #define PDB24XX_AE_IMPL_LOGO_2 0x02 @@ -1440,7 +1444,7 @@ typedef struct { #define PDB24XX_AE_FLOGI_TIMO 0x10 #define PDB24XX_AE_ABX_LOGO 0x11 #define PDB24XX_AE_PLOGI_DONE 0x12 -#define PDB24XX_AE_PRLI_DONJE 0x13 +#define PDB24XX_AE_PRLI_DONE 0x13 #define PDB24XX_AE_OPN_1 0x14 #define PDB24XX_AE_OPN_2 0x15 #define PDB24XX_AE_TXERR 0x16 Modified: head/sys/dev/isp/ispvar.h ============================================================================== --- head/sys/dev/isp/ispvar.h Wed May 3 12:26:16 2017 (r317739) +++ head/sys/dev/isp/ispvar.h Wed May 3 13:17:01 2017 (r317740) @@ -502,6 +502,10 @@ typedef struct { #define TOPO_IS_FABRIC(x) ((x) == TOPO_FL_PORT || (x) == TOPO_F_PORT) +#define FCP_AL_DA_ALL 0xFF +#define FCP_AL_PA(fcp) ((uint8_t)(fcp->isp_portid)) +#define FCP_IS_DEST_ALPD(fcp, alpd) (FCP_AL_PA((fcp)) == FCP_AL_DA_ALL || FCP_AL_PA((fcp)) == alpd) + /* * Soft Structure per host adapter */ From owner-svn-src-head@freebsd.org Wed May 3 13:47:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44401D5C48A; Wed, 3 May 2017 13:47:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06E1A7AA; Wed, 3 May 2017 13:47:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43Dl3Wg079991; Wed, 3 May 2017 13:47:03 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43Dl3q1079990; Wed, 3 May 2017 13:47:03 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705031347.v43Dl3q1079990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 3 May 2017 13:47:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317741 - head/usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 13:47:04 -0000 Author: emaste Date: Wed May 3 13:47:02 2017 New Revision: 317741 URL: https://svnweb.freebsd.org/changeset/base/317741 Log: bsdgrep: correct uninitialized variable introduced in r317703 CID: 1374747 Submitted by: Kyle Evans Modified: head/usr.bin/grep/util.c Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Wed May 3 13:17:01 2017 (r317740) +++ head/usr.bin/grep/util.c Wed May 3 13:47:02 2017 (r317741) @@ -203,12 +203,6 @@ procfile(const char *fn) int c, last_outed, t, tail; bool doctx, same_file; - doctx = false; - if ((!pc.binary || binbehave != BINFILE_BIN) && !cflag && !qflag && - !lflag && !Lflag && (Aflag != 0 || Bflag != 0)) - doctx = true; - mcount = mlimit; - if (strcmp(fn, "-") == 0) { fn = label != NULL ? label : getstr(1); f = grep_open(NULL); @@ -242,6 +236,12 @@ procfile(const char *fn) tail = 0; last_outed = 0; same_file = false; + doctx = false; + if ((!pc.binary || binbehave != BINFILE_BIN) && !cflag && !qflag && + !lflag && !Lflag && (Aflag != 0 || Bflag != 0)) + doctx = true; + mcount = mlimit; + for (c = 0; c == 0 || !(lflag || qflag); ) { /* Reset match count for every line processed */ From owner-svn-src-head@freebsd.org Wed May 3 13:57:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29D8CD5C6F2; Wed, 3 May 2017 13:57:33 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFE96F9E; Wed, 3 May 2017 13:57:32 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43DvWkN084342; Wed, 3 May 2017 13:57:32 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43DvWDl084341; Wed, 3 May 2017 13:57:32 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201705031357.v43DvWDl084341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Wed, 3 May 2017 13:57:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317742 - head/usr.sbin/fdread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 13:57:33 -0000 Author: araujo Date: Wed May 3 13:57:31 2017 New Revision: 317742 URL: https://svnweb.freebsd.org/changeset/base/317742 Log: Free the memory allocated to trackbuf before exiting, it might fix a potential memory leak. Submitted by: trix@juniper.net MFC after: 2 weeks. Differential Revision: https://reviews.freebsd.org/D9856 Modified: head/usr.sbin/fdread/fdread.c Modified: head/usr.sbin/fdread/fdread.c ============================================================================== --- head/usr.sbin/fdread/fdread.c Wed May 3 13:47:02 2017 (r317741) +++ head/usr.sbin/fdread/fdread.c Wed May 3 13:57:31 2017 (r317742) @@ -184,6 +184,7 @@ doread(int fd, FILE *of, const char *_de if (rv == 0) { /* EOF? */ warnx("premature EOF after %u bytes", nbytes); + free(trackbuf); return (EX_OK); } if ((unsigned)rv == tracksize) { @@ -215,6 +216,7 @@ doread(int fd, FILE *of, const char *_de if (!quiet) putc('\n', stderr); perror("non-IO error"); + free(trackbuf); return (EX_OSERR); } if (ioctl(fd, FD_GSTAT, &fdcs) == -1) @@ -233,6 +235,7 @@ doread(int fd, FILE *of, const char *_de if (!recover) { if (!quiet) putc('\n', stderr); + free(trackbuf); return (EX_IOERR); } memset(trackbuf, fillbyte, secsize); @@ -284,6 +287,7 @@ doread(int fd, FILE *of, const char *_de continue; } } + free(trackbuf); if (!quiet) { putc('\n', stderr); if (nerrs) From owner-svn-src-head@freebsd.org Wed May 3 14:03:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA44CD5C89D; Wed, 3 May 2017 14:03:47 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC30B1534; Wed, 3 May 2017 14:03:47 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43E3kbO088449; Wed, 3 May 2017 14:03:46 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43E3ksq088448; Wed, 3 May 2017 14:03:46 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201705031403.v43E3ksq088448@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Wed, 3 May 2017 14:03:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317743 - head/usr.sbin/bsdinstall/partedit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 14:03:48 -0000 Author: araujo Date: Wed May 3 14:03:46 2017 New Revision: 317743 URL: https://svnweb.freebsd.org/changeset/base/317743 Log: Use nitems() from sys/param.h. Reviewed by: ngie MFC after: 2 weeks. Differential Revision: https://reviews.freebsd.org/D9942 Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- head/usr.sbin/bsdinstall/partedit/gpart_ops.c Wed May 3 13:57:31 2017 (r317742) +++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c Wed May 3 14:03:46 2017 (r317743) @@ -99,14 +99,14 @@ newfs_command(const char *fstype, char * if (!use_default) { int choice; choice = dlg_checklist("UFS Options", "", 0, 0, 0, - sizeof(items)/sizeof(items[0]), items, NULL, + nitems(items), items, NULL, FLAG_CHECK, &i); if (choice == 1) /* Cancel */ return; } strcpy(command, "newfs "); - for (i = 0; i < (int)(sizeof(items)/sizeof(items[0])); i++) { + for (i = 0; i < (int)nitems(items); i++) { if (items[i].state == 0) continue; if (strcmp(items[i].name, "UFS1") == 0) @@ -137,7 +137,7 @@ newfs_command(const char *fstype, char * if (!use_default) { int choice; choice = dlg_checklist("ZFS Options", "", 0, 0, 0, - sizeof(items)/sizeof(items[0]), items, NULL, + nitems(items), items, NULL, FLAG_CHECK, &i); if (choice == 1) /* Cancel */ return; @@ -153,7 +153,7 @@ newfs_command(const char *fstype, char * sprintf(command, "%s -o cachefile=%s/zpool.cache ", command, zfsboot_path); } - for (i = 0; i < (int)(sizeof(items)/sizeof(items[0])); i++) { + for (i = 0; i < (int)nitems(items); i++) { if (items[i].state == 0) continue; if (strcmp(items[i].name, "fletcher4") == 0) @@ -179,14 +179,14 @@ newfs_command(const char *fstype, char * if (!use_default) { int choice; choice = dlg_checklist("FAT Options", "", 0, 0, 0, - sizeof(items)/sizeof(items[0]), items, NULL, + nitems(items), items, NULL, FLAG_RADIO, &i); if (choice == 1) /* Cancel */ return; } strcpy(command, "newfs_msdos "); - for (i = 0; i < (int)(sizeof(items)/sizeof(items[0])); i++) { + for (i = 0; i < (int)nitems(items); i++) { if (items[i].state == 0) continue; if (strcmp(items[i].name, "FAT32") == 0) @@ -227,7 +227,7 @@ parttypemenu: dialog_vars.default_item = __DECONST(char *, def_scheme); cancel = dlg_menu("Partition Scheme", "Select a partition scheme for this volume:", 0, 0, 0, - sizeof(items) / sizeof(items[0]), items, &choice, NULL); + nitems(items), items, &choice, NULL); dialog_vars.default_item = NULL; if (cancel) @@ -662,7 +662,7 @@ endedit: "freebsd") == 0) gpart_partition(pp->lg_name, "BSD"); - for (i = 0; i < (sizeof(items) / sizeof(items[0])); i++) + for (i = 0; i < nitems(items); i++) if (items[i].text_free) free(items[i].text); } @@ -1200,7 +1200,7 @@ addpartform: set_default_part_metadata(newpartname, scheme, items[0].text, items[2].text, newfs); - for (i = 0; i < (sizeof(items) / sizeof(items[0])); i++) + for (i = 0; i < nitems(items); i++) if (items[i].text_free) free(items[i].text); From owner-svn-src-head@freebsd.org Wed May 3 14:21:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FD2CD5CF4D; Wed, 3 May 2017 14:21:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B49935F; Wed, 3 May 2017 14:21:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43ELITt093371; Wed, 3 May 2017 14:21:18 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43ELIP9093367; Wed, 3 May 2017 14:21:18 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705031421.v43ELIP9093367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 3 May 2017 14:21:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317744 - in head/usr.sbin/makefs: . ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 14:21:19 -0000 Author: emaste Date: Wed May 3 14:21:18 2017 New Revision: 317744 URL: https://svnweb.freebsd.org/changeset/base/317744 Log: makefs: make buf generic it has nothing to do with ffs and will eventually be moved. gc sectorsize. NetBSD versions: ffs.c 1.58 ffs/buf.c 1.14 1.18 ffs/buf.h 1.8 Obtained from: NetBSD Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/makefs/ffs.c head/usr.sbin/makefs/ffs/buf.c head/usr.sbin/makefs/ffs/buf.h Modified: head/usr.sbin/makefs/ffs.c ============================================================================== --- head/usr.sbin/makefs/ffs.c Wed May 3 14:03:46 2017 (r317743) +++ head/usr.sbin/makefs/ffs.c Wed May 3 14:21:18 2017 (r317744) @@ -144,7 +144,6 @@ static void *ffs_build_dinode2(struct u -int sectorsize; /* XXX: for buf.c::getblk() */ /* publicly visible functions */ void @@ -427,8 +426,6 @@ ffs_validate(const char *dir, fsnode *ro printf("ffs_validate: dir %s; %lld bytes, %lld inodes\n", dir, (long long)fsopts->size, (long long)fsopts->inodes); } - sectorsize = fsopts->sectorsize; /* XXX - see earlier */ - /* now check calculated sizes vs requested sizes */ if (fsopts->maxsize > 0 && fsopts->size > fsopts->maxsize) { errx(1, "`%s' size of %lld is larger than the maxsize of %lld.", Modified: head/usr.sbin/makefs/ffs/buf.c ============================================================================== --- head/usr.sbin/makefs/ffs/buf.c Wed May 3 14:03:46 2017 (r317743) +++ head/usr.sbin/makefs/ffs/buf.c Wed May 3 14:21:18 2017 (r317744) @@ -50,14 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include "makefs.h" - -#include -#include - -#include "ffs/buf.h" -#include "ffs/ufs_inode.h" - -extern int sectorsize; /* XXX: from ffs.c & mkfs.c */ +#include "buf.h" TAILQ_HEAD(buftailhead,buf) buftail; @@ -67,16 +60,15 @@ bread(struct vnode *vp, daddr_t blkno, i { off_t offset; ssize_t rv; - struct fs *fs = vp->fs; + fsinfo_t *fs = vp->fs; - assert (fs != NULL); assert (bpp != NULL); if (debug & DEBUG_BUF_BREAD) printf("%s: blkno %lld size %d\n", __func__, (long long)blkno, size); *bpp = getblk(vp, blkno, size, 0, 0, 0); - offset = (*bpp)->b_blkno * sectorsize; /* XXX */ + offset = (*bpp)->b_blkno * fs->sectorsize; if (debug & DEBUG_BUF_BREAD) printf("%s: blkno %lld offset %lld bcount %ld\n", __func__, (long long)(*bpp)->b_blkno, (long long) offset, @@ -133,9 +125,10 @@ bwrite(struct buf *bp) { off_t offset; ssize_t rv; + fsinfo_t *fs = bp->b_fs; assert (bp != NULL); - offset = bp->b_blkno * sectorsize; /* XXX */ + offset = bp->b_blkno * fs->sectorsize; if (debug & DEBUG_BUF_BWRITE) printf("bwrite: blkno %lld offset %lld bcount %ld\n", (long long)bp->b_blkno, (long long) offset, @@ -184,11 +177,7 @@ getblk(struct vnode *vp, daddr_t blkno, static int buftailinitted; struct buf *bp; void *n; - int fd = vp->fd; - struct fs *fs = vp->fs; - blkno += vp->offset; - assert (fs != NULL); if (debug & DEBUG_BUF_GETBLK) printf("getblk: blkno %lld size %d\n", (long long)blkno, size); @@ -209,8 +198,8 @@ getblk(struct vnode *vp, daddr_t blkno, bp = ecalloc(1, sizeof(*bp)); bp->b_bufsize = 0; bp->b_blkno = bp->b_lblkno = blkno; - bp->b_fd = fd; - bp->b_fs = fs; + bp->b_fd = vp->fd; + bp->b_fs = vp->fs; bp->b_data = NULL; TAILQ_INSERT_HEAD(&buftail, bp, b_tailq); } Modified: head/usr.sbin/makefs/ffs/buf.h ============================================================================== --- head/usr.sbin/makefs/ffs/buf.h Wed May 3 14:03:46 2017 (r317743) +++ head/usr.sbin/makefs/ffs/buf.h Wed May 3 14:21:18 2017 (r317744) @@ -59,7 +59,7 @@ struct buf { daddr_t b_blkno; daddr_t b_lblkno; int b_fd; - struct fs * b_fs; + void * b_fs; TAILQ_ENTRY(buf) b_tailq; }; From owner-svn-src-head@freebsd.org Wed May 3 14:53:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21317D5A924; Wed, 3 May 2017 14:53:29 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4E68916; Wed, 3 May 2017 14:53:28 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43ErRX0008725; Wed, 3 May 2017 14:53:27 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43ErRt0008724; Wed, 3 May 2017 14:53:27 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705031453.v43ErRt0008724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 3 May 2017 14:53:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317745 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 14:53:29 -0000 Author: ken Date: Wed May 3 14:53:27 2017 New Revision: 317745 URL: https://svnweb.freebsd.org/changeset/base/317745 Log: Don't bother retrying errors for encrypted drives that are locked. sys/cam/scsi/scsi_all.c: In the asc_table, if we get a 0x20,0x02 error ("Access denied - no access rights"), don't bother retrying. Instead, immediately fail the command. This is the error returned by Self Encrypting Drives (SED) when they are locked. MFC after: 3 days Sponsored by: Spectra Logic Modified: head/sys/cam/scsi/scsi_all.c Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Wed May 3 14:21:18 2017 (r317744) +++ head/sys/cam/scsi/scsi_all.c Wed May 3 14:53:27 2017 (r317745) @@ -1614,7 +1614,7 @@ static struct asc_table_entry asc_table[ { SST(0x20, 0x01, SS_RDEF, /* XXX TBD */ "Access denied - initiator pending-enrolled") }, /* DT PWROMAEBK */ - { SST(0x20, 0x02, SS_RDEF, /* XXX TBD */ + { SST(0x20, 0x02, SS_FATAL | EPERM, "Access denied - no access rights") }, /* DT PWROMAEBK */ { SST(0x20, 0x03, SS_RDEF, /* XXX TBD */ From owner-svn-src-head@freebsd.org Wed May 3 14:57:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25005D5AA4D; Wed, 3 May 2017 14:57:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02020AF1; Wed, 3 May 2017 14:57:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43Ev5Wq008977; Wed, 3 May 2017 14:57:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43Ev4Zo008973; Wed, 3 May 2017 14:57:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705031457.v43Ev4Zo008973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 3 May 2017 14:57:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317746 - in head/usr.sbin/makefs: . ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 14:57:06 -0000 Author: emaste Date: Wed May 3 14:57:04 2017 New Revision: 317746 URL: https://svnweb.freebsd.org/changeset/base/317746 Log: makefs: clean up warnings - make functions and variables static where appropriate - use const char * where appropriate - remove unused variables Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/makefs/cd9660.c head/usr.sbin/makefs/ffs/buf.c head/usr.sbin/makefs/ffs/mkfs.c head/usr.sbin/makefs/makefs.c Modified: head/usr.sbin/makefs/cd9660.c ============================================================================== --- head/usr.sbin/makefs/cd9660.c Wed May 3 14:53:27 2017 (r317745) +++ head/usr.sbin/makefs/cd9660.c Wed May 3 14:57:04 2017 (r317746) @@ -1498,7 +1498,7 @@ cd9660_free_structure(cd9660node *root) * instead of having the TAILQ_ENTRY as part of the cd9660node, * just create a temporary structure */ -struct ptq_entry +static struct ptq_entry { TAILQ_ENTRY(ptq_entry) ptq; cd9660node *node; Modified: head/usr.sbin/makefs/ffs/buf.c ============================================================================== --- head/usr.sbin/makefs/ffs/buf.c Wed May 3 14:53:27 2017 (r317745) +++ head/usr.sbin/makefs/ffs/buf.c Wed May 3 14:57:04 2017 (r317746) @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); #include "makefs.h" #include "buf.h" -TAILQ_HEAD(buftailhead,buf) buftail; +static TAILQ_HEAD(buftailhead,buf) buftail; int bread(struct vnode *vp, daddr_t blkno, int size, struct ucred *u1 __unused, Modified: head/usr.sbin/makefs/ffs/mkfs.c ============================================================================== --- head/usr.sbin/makefs/ffs/mkfs.c Wed May 3 14:53:27 2017 (r317745) +++ head/usr.sbin/makefs/ffs/mkfs.c Wed May 3 14:57:04 2017 (r317746) @@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$"); #define BBSIZE 8192 /* size of boot area, with label */ #endif -static void initcg(int, time_t, const fsinfo_t *); +static void initcg(uint32_t, time_t, const fsinfo_t *); static int ilog2(int); static int count_digits(int); @@ -78,23 +78,22 @@ static int count_digits(int); #define UMASK 0755 #define POWEROF2(num) (((num) & ((num) - 1)) == 0) -union { +static union { struct fs fs; char pad[SBLOCKSIZE]; } fsun; #define sblock fsun.fs -struct csum *fscs; -union { +static union { struct cg cg; char pad[FFS_MAXBSIZE]; } cgun; #define acg cgun.cg -char *iobuf; -int iobufsize; +static char *iobuf; +static int iobufsize; -char writebuf[FFS_MAXBSIZE]; +static char writebuf[FFS_MAXBSIZE]; static int Oflag; /* format as an 4.3BSD file system */ static int64_t fssize; /* file system size */ @@ -117,7 +116,8 @@ struct fs * ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp) { int fragsperinode, optimalfpg, origdensity, minfpg, lastminfpg; - int32_t cylno, i, csfrags; + int32_t csfrags; + uint32_t i, cylno; long long sizepb; void *space; int size; @@ -537,7 +537,8 @@ ffs_mkfs(const char *fsys, const fsinfo_ void ffs_write_superblock(struct fs *fs, const fsinfo_t *fsopts) { - int cylno, size, blks, i, saveflag; + int size, blks, i, saveflag; + uint32_t cylno; void *space; char *wrbuf; @@ -579,10 +580,11 @@ ffs_write_superblock(struct fs *fs, cons * Initialize a cylinder group. */ static void -initcg(int cylno, time_t utime, const fsinfo_t *fsopts) +initcg(uint32_t cylno, time_t utime, const fsinfo_t *fsopts) { daddr_t cbase, dmax; - int32_t i, j, d, dlower, dupper, blkno; + int32_t blkno; + uint32_t i, j, d, dlower, dupper; struct ufs1_dinode *dp1; struct ufs2_dinode *dp2; int start; @@ -643,7 +645,7 @@ initcg(int cylno, time_t utime, const fs acg.cg_nextfreeoff = acg.cg_clusteroff + howmany(fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT); } - if (acg.cg_nextfreeoff > sblock.fs_cgsize) { + if (acg.cg_nextfreeoff > (uint32_t)sblock.fs_cgsize) { printf("Panic: cylinder group too big\n"); exit(37); } Modified: head/usr.sbin/makefs/makefs.c ============================================================================== --- head/usr.sbin/makefs/makefs.c Wed May 3 14:53:27 2017 (r317745) +++ head/usr.sbin/makefs/makefs.c Wed May 3 14:57:04 2017 (r317746) @@ -95,8 +95,8 @@ main(int argc, char *argv[]) fsinfo_t fsoptions; fsnode *root; int ch, i, len; - char *subtree; - char *specfile; + const char *subtree; + const char *specfile; setprogname(argv[0]); From owner-svn-src-head@freebsd.org Wed May 3 15:03:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3AACD5ACC6; Wed, 3 May 2017 15:03:01 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9137E6E; Wed, 3 May 2017 15:03:01 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43F30dT013154; Wed, 3 May 2017 15:03:00 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43F30tY013153; Wed, 3 May 2017 15:03:00 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201705031503.v43F30tY013153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 3 May 2017 15:03:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317747 - head/lib/libsysdecode X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 15:03:02 -0000 Author: tuexen Date: Wed May 3 15:03:00 2017 New Revision: 317747 URL: https://svnweb.freebsd.org/changeset/base/317747 Log: Add support for socket option names related to the IPPROTO_SCTP level. Modified: head/lib/libsysdecode/flags.c head/lib/libsysdecode/mktables Modified: head/lib/libsysdecode/flags.c ============================================================================== --- head/lib/libsysdecode/flags.c Wed May 3 14:57:04 2017 (r317746) +++ head/lib/libsysdecode/flags.c Wed May 3 15:03:00 2017 (r317747) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -750,6 +751,8 @@ sysdecode_sockopt_name(int level, int op if (level == IPPROTO_IP) /* XXX: UNIX domain socket options use a level of 0 also. */ return (lookup_value(sockoptip, optname)); + if (level == IPPROTO_SCTP) + return (lookup_value(sockoptsctp, optname)); if (level == IPPROTO_TCP) return (lookup_value(sockopttcp, optname)); if (level == IPPROTO_UDP) Modified: head/lib/libsysdecode/mktables ============================================================================== --- head/lib/libsysdecode/mktables Wed May 3 14:57:04 2017 (r317746) +++ head/lib/libsysdecode/mktables Wed May 3 15:03:00 2017 (r317747) @@ -130,6 +130,7 @@ gen_table "sockfamily" "AF_[[:alnum gen_table "sockipproto" "IPPROTO_[[:alnum:]]+[[:space:]]+" "netinet/in.h" gen_table "sockopt" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" gen_table "sockoptip" "(IP_[[:alnum:]_]+|MCAST_[[:alnum:]_]+_GROUP)[[:space:]]+" "netinet/in.h" "IP_DEFAULT|IP_MIN|IP_MAX|IP_PORTRANGE" +gen_table "sockoptsctp" "SCTP_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/sctp.h" gen_table "sockopttcp" "TCP_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/tcp.h" "TCP_MIN|TCP_MAX[^S]|TCP_MSS|TCP_[[:alnum:]_]+_MAX" gen_table "sockoptudp" "UDP_[[:alnum:]]+[[:space:]]+[0-9]+" "netinet/udp.h" "UDP_ENCAP_" gen_table "socktype" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h" From owner-svn-src-head@freebsd.org Wed May 3 15:20:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CCE2D5B4F5; Wed, 3 May 2017 15:20:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22B6BE2C; Wed, 3 May 2017 15:20:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43FKfgZ017754; Wed, 3 May 2017 15:20:41 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43FKfhj017752; Wed, 3 May 2017 15:20:41 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201705031520.v43FKfhj017752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 3 May 2017 15:20:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317748 - head/lib/libsysdecode X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 15:20:42 -0000 Author: tuexen Date: Wed May 3 15:20:40 2017 New Revision: 317748 URL: https://svnweb.freebsd.org/changeset/base/317748 Log: Add support for socket option names related to the IPPROTO_IPV6 level. Modified: head/lib/libsysdecode/flags.c head/lib/libsysdecode/mktables Modified: head/lib/libsysdecode/flags.c ============================================================================== --- head/lib/libsysdecode/flags.c Wed May 3 15:03:00 2017 (r317747) +++ head/lib/libsysdecode/flags.c Wed May 3 15:20:40 2017 (r317748) @@ -751,6 +751,8 @@ sysdecode_sockopt_name(int level, int op if (level == IPPROTO_IP) /* XXX: UNIX domain socket options use a level of 0 also. */ return (lookup_value(sockoptip, optname)); + if (level == IPPROTO_IPV6) + return (lookup_value(sockoptipv6, optname)); if (level == IPPROTO_SCTP) return (lookup_value(sockoptsctp, optname)); if (level == IPPROTO_TCP) Modified: head/lib/libsysdecode/mktables ============================================================================== --- head/lib/libsysdecode/mktables Wed May 3 15:03:00 2017 (r317747) +++ head/lib/libsysdecode/mktables Wed May 3 15:20:40 2017 (r317748) @@ -130,6 +130,7 @@ gen_table "sockfamily" "AF_[[:alnum gen_table "sockipproto" "IPPROTO_[[:alnum:]]+[[:space:]]+" "netinet/in.h" gen_table "sockopt" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" gen_table "sockoptip" "(IP_[[:alnum:]_]+|MCAST_[[:alnum:]_]+_GROUP)[[:space:]]+" "netinet/in.h" "IP_DEFAULT|IP_MIN|IP_MAX|IP_PORTRANGE" +gen_table "sockoptipv6" "IPV6_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet6/in6.h" "IPV6_ADDR_|IPV6_TAG_DIRECT|IPV6_OPTIONS|IPV6_RECVOPTS|IPV6_RECVRETOPTS|IPV6_RECVDSTADDR|IPV6_RETOPTS|IPV6_2292|IPV6_RECVRTHDRDSTOPTS|IPV6_REACHCONF|IPV6_PKTOPTIONS" gen_table "sockoptsctp" "SCTP_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/sctp.h" gen_table "sockopttcp" "TCP_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/tcp.h" "TCP_MIN|TCP_MAX[^S]|TCP_MSS|TCP_[[:alnum:]_]+_MAX" gen_table "sockoptudp" "UDP_[[:alnum:]]+[[:space:]]+[0-9]+" "netinet/udp.h" "UDP_ENCAP_" From owner-svn-src-head@freebsd.org Wed May 3 15:24:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B5BCD5B663 for ; Wed, 3 May 2017 15:24:34 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm28-vm5.bullet.mail.ne1.yahoo.com (nm28-vm5.bullet.mail.ne1.yahoo.com [98.138.91.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F360536A for ; Wed, 3 May 2017 15:24:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1493823410; bh=7zSGuw3o1V4/9M1EgMyZBAhP9GEObO5ZfCx4EbsN/aw=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=lSd/nQovXFc7AD1tNkDyj3ocL5M+FIH8sGnypG7MMuFl1APVFcR8WQFrZq/aTnGAmfGm2dlqsE5MofV6RKrRvtTk4ayyswP/9aAhi8MoqkmLhel8UPRKDAyWwOOunx8vXLGtJpnjFqUhsPFB4SvxfOCw970zwPLXmI7B6C5dupye8WUJg4l8xi6qUT+o5u066gWCE4CDv+do3FvUyNXpfTaHiM/CbKv6kEIInq12MaFVfbaBKze/GtXLeD72T6oLYLRj6/+qB0Vq9BqXlg9wkX+xtU53FtSTMHf/sT6PxUeMLYnlW57limBWBO75JnCS98iNDM0qlRbyv/n9zIRztQ== Received: from [98.138.100.102] by nm28.bullet.mail.ne1.yahoo.com with NNFMP; 03 May 2017 14:56:50 -0000 Received: from [98.138.84.39] by tm101.bullet.mail.ne1.yahoo.com with NNFMP; 03 May 2017 14:56:50 -0000 Received: from [127.0.0.1] by smtp107.mail.ne1.yahoo.com with NNFMP; 03 May 2017 14:56:50 -0000 X-Yahoo-Newman-Id: 99512.45305.bm@smtp107.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: EjxUD4oVM1ktQNyxynYm340.yVWuRdXG7UamQguMNGw9iCi Gvfcv9P4bRyjVjAuOU2h6VSRp19ltNFmI_WXw20FwSa1Ep4PBk2WF0TrTnVr COsFNx4yBMsu3VdR_KcxGv48gtjmBlgF4oJ6hjoEx4Gq4F3.Q4DX7NYTLiW7 mNUCTFybekPkLM64bK03XZvFQCpJOtkhCujnjAqaqMs4ATerIw_vV9ZVEUxk XaRmt67o5bfwRo4BoSAnvU.bfxerJeNYQ7Bg1URbSqhXwYrBMfhrXlVwc4iL 3YfhdFzwnHrWwp4CkdGFjdQZYglTqL9QMv6m.4z86TYKRuz4zVK6T.vvoZN3 mLGLBcivlYnPv83_XG_a4hyScsxv.kpnsjTS5AUdRwgHxvsjbhDE5d1xxKC_ _LEf1VaCIBDmyDinEs9SHbV0wMi5m8T3G821fQmVGFzaItFjyNEx7OglD7EK ..Eic4N4Ur2jHiPgHLsrpBypU_M8b13uaAWoydWpxgjH0a_HDhVCyA964TDm e0WQur0ztS2jzPvKK30xzDsb4Y_c.VxQkCrSTPQbryo8A X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r317709 - head/usr.bin/csplit To: Bruce Evans , Jilles Tjoelker References: <201705022156.v42LuKbp088899@repo.freebsd.org> <20170503162918.U1062@besplex.bde.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Organization: FreeBSD Project Message-ID: <2c7bd200-957d-2c36-076e-41d4d04a2956@FreeBSD.org> Date: Wed, 3 May 2017 09:56:49 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170503162918.U1062@besplex.bde.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 15:24:34 -0000 On 3/5/2017 01:55, Bruce Evans wrote: > On Tue, 2 May 2017, Jilles Tjoelker wrote: > >> Log: >> csplit: Fix check of fputs() return value, making csplit work again. >> >> As of r295638, fputs() returns the number of bytes written (if not >> more than >> INT_MAX). This broke csplit completely, since csplit assumed only >> success >> only for the return value 0. >> >> PR: 213510 >> Submitted by: J.R. Oldroyd >> MFC after: 1 week >> Relnotes: yes >> >> Modified: >> head/usr.bin/csplit/csplit.c >> >> Modified: head/usr.bin/csplit/csplit.c >> ============================================================================== >> >> --- head/usr.bin/csplit/csplit.c Tue May 2 21:33:27 2017 (r317708) >> +++ head/usr.bin/csplit/csplit.c Tue May 2 21:56:20 2017 (r317709) >> @@ -195,7 +195,7 @@ main(int argc, char *argv[]) >> /* Copy the rest into a new file. */ >> if (!feof(infile)) { >> ofp = newfile(); >> - while ((p = get_line()) != NULL && fputs(p, ofp) == 0) >> + while ((p = get_line()) != NULL && fputs(p, ofp) != EOF) >> ; >> if (!sflag) >> printf("%jd\n", (intmax_t)ftello(ofp)); > > I don't like checking for the specific value EOF instead of any negative > value, though the EOF is Standard and I like checking for specific -1 > for sysctls. stdio is not very consistent, and this bug is due to old > versions of FreeBSD documenting and returning the specific value 0 on > non-error, which was also Standard. > The standard says non-negative, expecting zero to be the only non-negative value is a bug. The idea was mostly to match the MacOS behavior. MacOS buildbots are expensive and some projects find it's useful to have a FreeBSD builbot to have some idea when non-portable behavior is introduced. > Grepping for fputs in /usr/src shows too many instances to check (mostly > without any error handling). The simplest filter 'if (fputs' found the > dependency on the old FreeBSD behaviour in csplit and 2 other places: > > contrib/mdocml/main.c: if (fputs(cp, stdout)) { > contrib/mdocml/main.c- fclose(stream); > contrib/libreadline/examples/rlcat.c: if (fputs (x, stdout) != 0) > contrib/libreadline/examples/rlcat.c- return 1; > > More complicated filters like 'if ([^(]]*[^a-z_]fputs' failed to find > any problems since I messed up the regexp. > I admittedly ignored contrib, plus I only skimmed for comparisons to zero. Now I am worried: the classic BSD implementation is ubiquitous and this bug is not easy to find, particularly in ports. Do you guys think it we should revert to the previous behavior, at least for 11.1? The bugs should be reported upstream but it is not really our battle to fix the world for Apple is it? Pedro. From owner-svn-src-head@freebsd.org Wed May 3 15:42:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F968D5BC21; Wed, 3 May 2017 15:42:12 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-qt0-x22f.google.com (mail-qt0-x22f.google.com [IPv6:2607:f8b0:400d:c0d::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ECE69124; Wed, 3 May 2017 15:42:11 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-qt0-x22f.google.com with SMTP id c45so140717419qtb.1; Wed, 03 May 2017 08:42:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=d8d1riSYdm93PjM4lsuVoeA5pPPzLbxO5VDGo2WOUSU=; b=Yc4eF19Javm/uUXA2ML1OE8r0ecaS0VJTfY4Y1lysswuhbtZ6fmyoHQ8huXAcOdVmT OIaW9A2+93nI7gg7k/a+en2q18Wn5uNrPh4HHTrFxUUJrXzIO/WWuYOIL3c3oKSy4A/o 3AT20e/uSGk7XqZwztznwNfbn+KlarG1B/1ui6wRkq1kxfI1fx9yAn1yhDn6RCklhvd4 ThZt4ceQZYf5leTuVReNAS/edEWZt0PYH7HSdgOnwVNOwgZuwwsCgMmwQ0TcRPxUJstT 3blnVFno4iAArZ90a+WO6wqo8wJwksTUdw0dOKZaixU0aTnkj1HSb1EyzbJnXzxLZJ7C r9JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=d8d1riSYdm93PjM4lsuVoeA5pPPzLbxO5VDGo2WOUSU=; b=dkkKgQJKL81dljOdMMb2EMIuftaWd5DFolN+sLjmx6iqObWavOWzxwvfpDppI6jyfi norgz8RTp9RlOSBkouTZkCPNsJrocmibdPl9IRnQbqZdhb5max76PXN9UErma55uw8v1 GiqnjPkk1GSzbcBRxUnCuj469H1l+hVrfx/DgFhjk2YtXFELlZxGUpkcXUF8SRXhOw2U gS27kctxRs8+KBdbnqD63iP/Ax9Hgx2NmW5wt8iiVCcPkKy463qC1ybiqKmP2TcqmrM2 Q7BtdZFZ4buiUDGlTcL5CA538Cr5YtopEsb8dbf9eu3sQWU5TVDLkW1JbcAjfqCqiC7Y oP1g== X-Gm-Message-State: AN3rC/75/CgvZJQxMUlxDMr0ELXSF30tv4sBSgriSCQ84ClLQbSJm0c7 lFEg5NbS+9YFIwIE+zqvGl1KPolZIQ== X-Received: by 10.200.36.2 with SMTP id c2mr31889846qtc.271.1493826131073; Wed, 03 May 2017 08:42:11 -0700 (PDT) MIME-Version: 1.0 Sender: chmeeedalf@gmail.com Received: by 10.12.168.203 with HTTP; Wed, 3 May 2017 08:42:10 -0700 (PDT) In-Reply-To: <20170503162733.O1062@besplex.bde.org> References: <201705022133.v42LXRF7078653@repo.freebsd.org> <20170503162733.O1062@besplex.bde.org> From: Justin Hibbits Date: Wed, 3 May 2017 10:42:10 -0500 X-Google-Sender-Auth: 40ENX7-3if5OhGmqSmd9CJ5WRL8 Message-ID: Subject: Re: svn commit: r317708 - head/share/man/man7 To: Bruce Evans Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 15:42:12 -0000 On Wed, May 3, 2017 at 1:29 AM, Bruce Evans wrote: > On Tue, 2 May 2017, Justin Hibbits wrote: > >> Log: >> Add powerpcspe to arch(7) >> >> Reviewed by: emaste >> ... >> Modified: head/share/man/man7/arch.7 >> >> ============================================================================== >> --- head/share/man/man7/arch.7 Tue May 2 21:20:27 2017 (r317707) >> +++ head/share/man/man7/arch.7 Tue May 2 21:33:27 2017 (r317708) >> @@ -65,6 +65,7 @@ On all supported architectures, >> .It mips64elhf Ta 8 Ta 8 Ta 8 >> .It mips64hf Ta 8 Ta 8 Ta 8 >> .It powerpc Ta 4 Ta 8 Ta 4 >> +.It powerpcspe Ta 4 Ta 8 Ta 4 >> .It powerpc64 Ta 8 Ta 8 Ta 8 > > > Insertion sort error here and later. The lists were sorted on name, not on > size. 64 is only after spe in size. > > Bruce I initially sorted it that way, but then noticed arm and mips are grouped by size, so I followed precedent. - Justin From owner-svn-src-head@freebsd.org Wed May 3 15:55:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A267D5C399; Wed, 3 May 2017 15:55:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2D07D83; Wed, 3 May 2017 15:55:30 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43FtUFl035310; Wed, 3 May 2017 15:55:30 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43FtTtj035307; Wed, 3 May 2017 15:55:29 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201705031555.v43FtTtj035307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 3 May 2017 15:55:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317749 - in head/lib/libc: gen tests/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 15:55:31 -0000 Author: cem Date: Wed May 3 15:55:29 2017 New Revision: 317749 URL: https://svnweb.freebsd.org/changeset/base/317749 Log: libc glob: Avoid pathological exponential behavior Adapt glob's match() routine to use a greedy algorithm that avoids exponential runtime in byzantine inputs. While here, add a testcase for the byzantine input. Prompted by: https://research.swtch.com/glob Authored by: Yves Orton Obtained from: Perl (33252c318625f3c6c89b816ee88481940e3e6f95) Sponsored by: Dell EMC Isilon Added: head/lib/libc/tests/gen/glob2_test.c (contents, props changed) Modified: head/lib/libc/gen/glob.c head/lib/libc/tests/gen/Makefile Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Wed May 3 15:20:40 2017 (r317748) +++ head/lib/libc/gen/glob.c Wed May 3 15:55:29 2017 (r317749) @@ -903,61 +903,73 @@ globextend(const Char *path, glob_t *pgl } /* - * pattern matching function for filenames. Each occurrence of the * - * pattern causes a recursion level. + * pattern matching function for filenames. */ static int match(Char *name, Char *pat, Char *patend) { int ok, negate_range; - Char c, k; + Char c, k, *nextp, *nextn; struct xlocale_collate *table = (struct xlocale_collate*)__get_locale()->components[XLC_COLLATE]; - while (pat < patend) { - c = *pat++; - switch (c & M_MASK) { - case M_ALL: - if (pat == patend) - return (1); - do - if (match(name, pat, patend)) - return (1); - while (*name++ != EOS); - return (0); - case M_ONE: - if (*name++ == EOS) - return (0); - break; - case M_SET: - ok = 0; - if ((k = *name++) == EOS) - return (0); - if ((negate_range = ((*pat & M_MASK) == M_NOT)) != 0) - ++pat; - while (((c = *pat++) & M_MASK) != M_END) - if ((*pat & M_MASK) == M_RNG) { - if (table->__collate_load_error ? - CHAR(c) <= CHAR(k) && - CHAR(k) <= CHAR(pat[1]) : - __wcollate_range_cmp(CHAR(c), - CHAR(k)) <= 0 && - __wcollate_range_cmp(CHAR(k), - CHAR(pat[1])) <= 0) + nextn = NULL; + nextp = NULL; + + while (1) { + while (pat < patend) { + c = *pat++; + switch (c & M_MASK) { + case M_ALL: + if (pat == patend) + return (1); + if (*name == EOS) + return (0); + nextn = name + 1; + nextp = pat - 1; + break; + case M_ONE: + if (*name++ == EOS) + goto fail; + break; + case M_SET: + ok = 0; + if ((k = *name++) == EOS) + goto fail; + if ((negate_range = ((*pat & M_MASK) == M_NOT)) != 0) + ++pat; + while (((c = *pat++) & M_MASK) != M_END) + if ((*pat & M_MASK) == M_RNG) { + if (table->__collate_load_error ? + CHAR(c) <= CHAR(k) && + CHAR(k) <= CHAR(pat[1]) : + __wcollate_range_cmp(CHAR(c), + CHAR(k)) <= 0 && + __wcollate_range_cmp(CHAR(k), + CHAR(pat[1])) <= 0) + ok = 1; + pat += 2; + } else if (c == k) ok = 1; - pat += 2; - } else if (c == k) - ok = 1; - if (ok == negate_range) - return (0); - break; - default: - if (*name++ != c) - return (0); - break; + if (ok == negate_range) + goto fail; + break; + default: + if (*name++ != c) + goto fail; + break; + } } + if (*name == EOS) + return (1); + + fail: + if (nextn == NULL) + break; + pat = nextp; + name = nextn; } - return (*name == EOS); + return (0); } /* Free allocated data belonging to a glob_t structure. */ Modified: head/lib/libc/tests/gen/Makefile ============================================================================== --- head/lib/libc/tests/gen/Makefile Wed May 3 15:20:40 2017 (r317748) +++ head/lib/libc/tests/gen/Makefile Wed May 3 15:55:29 2017 (r317749) @@ -8,6 +8,7 @@ ATF_TESTS_C+= fmtmsg_test ATF_TESTS_C+= fnmatch2_test ATF_TESTS_C+= fpclassify2_test ATF_TESTS_C+= ftw_test +ATF_TESTS_C+= glob2_test ATF_TESTS_C+= popen_test ATF_TESTS_C+= posix_spawn_test ATF_TESTS_C+= wordexp_test Added: head/lib/libc/tests/gen/glob2_test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/tests/gen/glob2_test.c Wed May 3 15:55:29 2017 (r317749) @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2017 Dell EMC Isilon + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* + * Derived from Russ Cox' pathological case test program used for the + * https://research.swtch.com/glob article. + */ +ATF_TC_WITHOUT_HEAD(glob_pathological_test); +ATF_TC_BODY(glob_pathological_test, tc) +{ + struct timespec t, t2; + glob_t g; + const char *longname = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + char pattern[1000], *p; + double dt; + unsigned i, j, k, mul; + int fd, rc; + + fd = open(longname, O_CREAT | O_RDWR, 0666); + ATF_REQUIRE(fd >= 0); + + /* + * Test up to 100 a* groups. Exponential implementations typically go + * bang at i=7 or 8. + */ + for (i = 0; i < 100; i++) { + /* + * Create a*...b pattern with i 'a*' groups. + */ + p = pattern; + for (k = 0; k < i; k++) { + *p++ = 'a'; + *p++ = '*'; + } + *p++ = 'b'; + *p = '\0'; + + clock_gettime(CLOCK_REALTIME, &t); + for (j = 0; j < mul; j++) { + memset(&g, 0, sizeof g); + rc = glob(pattern, 0, 0, &g); + if (rc == GLOB_NOSPACE || rc == GLOB_ABORTED) { + ATF_REQUIRE_MSG(rc == GLOB_NOMATCH, + "an unexpected error occurred: " + "rc=%d errno=%d", rc, errno); + /* NORETURN */ + } + + ATF_CHECK_MSG(rc == GLOB_NOMATCH, + "A bogus match occurred: '%s' ~ '%s'", pattern, + g.gl_pathv[0]); + globfree(&g); + } + clock_gettime(CLOCK_REALTIME, &t2); + + t2.tv_sec -= t.tv_sec; + t2.tv_nsec -= t.tv_nsec; + dt = t2.tv_sec + (double)t2.tv_nsec/1e9; + dt /= mul; + + ATF_CHECK_MSG(dt < 1, "glob(3) took far too long: %d %.9f", i, + dt); + + if (dt >= 0.0001) + mul = 1; + } +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, glob_pathological_test); + + return (atf_no_error()); +} From owner-svn-src-head@freebsd.org Wed May 3 16:03:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B451DD5C59A; Wed, 3 May 2017 16:03:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 86284359; Wed, 3 May 2017 16:03:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43G3X2S039159; Wed, 3 May 2017 16:03:33 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43G3Xjw039158; Wed, 3 May 2017 16:03:33 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201705031603.v43G3Xjw039158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 3 May 2017 16:03:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317750 - head/usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 16:03:34 -0000 Author: tuexen Date: Wed May 3 16:03:33 2017 New Revision: 317750 URL: https://svnweb.freebsd.org/changeset/base/317750 Log: Add support for sctp_generic_sendmsg() and sctp_generic_recvmsg(). Modified: head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Wed May 3 15:55:29 2017 (r317749) +++ head/usr.bin/truss/syscalls.c Wed May 3 16:03:33 2017 (r317750) @@ -291,6 +291,14 @@ static struct syscall decoded_syscalls[] .args = { { Rforkflags, 0 } } }, { .name = "rmdir", .ret_type = 1, .nargs = 1, .args = { { Name, 0 } } }, + { .name = "sctp_generic_recvmsg", .ret_type = 1, .nargs = 7, + .args = { { Int, 0 }, { Ptr | IN, 1 }, { Int, 2 }, + { Sockaddr | OUT, 3 }, { Ptr | OUT, 4 }, { Ptr | OUT, 5 }, + { Ptr | OUT, 6 } } }, + { .name = "sctp_generic_sendmsg", .ret_type = 1, .nargs = 7, + .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 }, + { Sockaddr | IN, 3 }, { Socklent, 4 }, { Ptr | IN, 5 }, + { Msgflags, 6 } } }, { .name = "select", .ret_type = 1, .nargs = 5, .args = { { Int, 0 }, { Fd_set, 1 }, { Fd_set, 2 }, { Fd_set, 3 }, { Timeval, 4 } } }, From owner-svn-src-head@freebsd.org Wed May 3 16:12:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0C7AD5C830; Wed, 3 May 2017 16:12:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0577CEC; Wed, 3 May 2017 16:12:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43GChZg043570; Wed, 3 May 2017 16:12:43 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43GChWA043569; Wed, 3 May 2017 16:12:43 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201705031612.v43GChWA043569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 3 May 2017 16:12:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317751 - head/contrib/llvm/lib/Target/ARM X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 16:12:45 -0000 Author: dim Date: Wed May 3 16:12:43 2017 New Revision: 317751 URL: https://svnweb.freebsd.org/changeset/base/317751 Log: Pull in r301983 from upstream llvm trunk (by Tim Northover): ARM: avoid handing a deleted node back to TableGen during ISel. When we replaced the multiplicand the destination node might already exist. When that happens the original gets CSEd and deleted. However, it's actually used as the offset so nonsense is produced. Should fix PR32726. This fixes an assertion failure when building building www/firefox 53.0 for arm. Reported by: Bob Prohaska PR: 218782 MFC after: 3 days Modified: head/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Modified: head/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Wed May 3 16:03:33 2017 (r317750) +++ head/contrib/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Wed May 3 16:12:43 2017 (r317751) @@ -748,7 +748,9 @@ bool ARMDAGToDAGISel::SelectLdStSOReg(SD unsigned PowerOfTwo = 0; SDValue NewMulConst; if (canExtractShiftFromMul(Offset, 31, PowerOfTwo, NewMulConst)) { + HandleSDNode Handle(Offset); replaceDAGValue(Offset.getOperand(1), NewMulConst); + Offset = Handle.getValue(); ShAmt = PowerOfTwo; ShOpcVal = ARM_AM::lsl; } @@ -1428,7 +1430,9 @@ bool ARMDAGToDAGISel::SelectT2AddrModeSo unsigned PowerOfTwo = 0; SDValue NewMulConst; if (canExtractShiftFromMul(OffReg, 3, PowerOfTwo, NewMulConst)) { + HandleSDNode Handle(OffReg); replaceDAGValue(OffReg.getOperand(1), NewMulConst); + OffReg = Handle.getValue(); ShAmt = PowerOfTwo; } } From owner-svn-src-head@freebsd.org Wed May 3 16:34:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FD3ED5CEDC; Wed, 3 May 2017 16:34:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5040ACBA; Wed, 3 May 2017 16:34:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43GY3XH051594; Wed, 3 May 2017 16:34:03 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43GY3rj051593; Wed, 3 May 2017 16:34:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705031634.v43GY3rj051593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 3 May 2017 16:34:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317752 - head/sys/dev/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 16:34:04 -0000 Author: mav Date: Wed May 3 16:34:03 2017 New Revision: 317752 URL: https://svnweb.freebsd.org/changeset/base/317752 Log: Fix typo in r317659. MFC after: 2 weeks Modified: head/sys/dev/uart/uart_dev_lpc.c Modified: head/sys/dev/uart/uart_dev_lpc.c ============================================================================== --- head/sys/dev/uart/uart_dev_lpc.c Wed May 3 16:12:43 2017 (r317751) +++ head/sys/dev/uart/uart_dev_lpc.c Wed May 3 16:34:03 2017 (r317752) @@ -889,7 +889,7 @@ lpc_ns8250_bus_transmit(struct uart_soft uart_lock(sc->sc_hwmtx); if (sc->sc_txdatasz > 1) { if ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0) - ns8250_drain(bas, UART_DRAIN_TRANSMITTER); + lpc_ns8250_drain(bas, UART_DRAIN_TRANSMITTER); } else { while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0) DELAY(4); From owner-svn-src-head@freebsd.org Wed May 3 16:34:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68CCFD5CF48; Wed, 3 May 2017 16:34:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38B35E3C; Wed, 3 May 2017 16:34:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43GYMo2051648; Wed, 3 May 2017 16:34:22 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43GYMNV051647; Wed, 3 May 2017 16:34:22 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201705031634.v43GYMNV051647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 3 May 2017 16:34:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317753 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 16:34:23 -0000 Author: cem Date: Wed May 3 16:34:22 2017 New Revision: 317753 URL: https://svnweb.freebsd.org/changeset/base/317753 Log: glob: Fix an overlong line Trivial style(9) fix, no functional change. There are also some 81 characters lines below, but I don't see a good way to shorten them. Sponsored by: Dell EMC Isilon Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c ============================================================================== --- head/lib/libc/gen/glob.c Wed May 3 16:34:03 2017 (r317752) +++ head/lib/libc/gen/glob.c Wed May 3 16:34:22 2017 (r317753) @@ -936,7 +936,8 @@ match(Char *name, Char *pat, Char *paten ok = 0; if ((k = *name++) == EOS) goto fail; - if ((negate_range = ((*pat & M_MASK) == M_NOT)) != 0) + negate_range = ((*pat & M_MASK) == M_NOT); + if (negate_range != 0) ++pat; while (((c = *pat++) & M_MASK) != M_END) if ((*pat & M_MASK) == M_RNG) { From owner-svn-src-head@freebsd.org Wed May 3 16:55:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60D83D5C794; Wed, 3 May 2017 16:55:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 32B596F; Wed, 3 May 2017 16:55:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43Gt2Nr060133; Wed, 3 May 2017 16:55:02 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43Gt2Wg060132; Wed, 3 May 2017 16:55:02 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201705031655.v43Gt2Wg060132@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 3 May 2017 16:55:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317754 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 16:55:03 -0000 Author: jhb Date: Wed May 3 16:55:02 2017 New Revision: 317754 URL: https://svnweb.freebsd.org/changeset/base/317754 Log: Replace 'riscv' with the RISC-V targets 'riscv64' and 'riscv64sf'. Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Wed May 3 16:34:22 2017 (r317753) +++ head/share/man/man7/arch.7 Wed May 3 16:55:02 2017 (r317754) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 2, 2017 +.Dd May 3, 2017 .Dt ARCH 7 .Os .Sh NAME @@ -67,7 +67,8 @@ On all supported architectures, .It powerpc Ta 4 Ta 8 Ta 4 .It powerpcspe Ta 4 Ta 8 Ta 4 .It powerpc64 Ta 8 Ta 8 Ta 8 -.It riscv Ta 8 Ta 16 Ta 8 +.It riscv64 Ta 8 Ta 16 Ta 8 +.It riscv64sf Ta 8 Ta 16 Ta 8 .It sparc64 Ta 8 Ta 16 Ta 8 .El .Ss Endianness and Char Signedness @@ -91,7 +92,8 @@ On all supported architectures, .It powerpc Ta big Ta unsigned .It powerpcspe Ta big Ta unsigned .It powerpc64 Ta big Ta unsigned -.It riscv Ta little Ta signed +.It riscv64 Ta little Ta signed +.It riscv64sf Ta little Ta signed .It sparc64 Ta big Ta signed .El .Ss Page Size @@ -115,7 +117,8 @@ On all supported architectures, .It powerpc Ta 4K .It powerpcspe Ta 4K .It powerpc64 Ta 4K -.It riscv Ta 4K +.It riscv64 Ta 4K +.It riscv64sf Ta 4K .It sparc64 Ta 8K .El .Ss Floating Point @@ -186,7 +189,8 @@ Architecture-specific macros: .It powerpc Ta Dv __powerpc__ .It powerpcspe Ta Dv __powerpc__, Dv __SPE__ .It powerpc64 Ta Dv __powerpc__, Dv __powerpc64__ -.It riscv Ta Dv __riscv__, Dv __riscv64 +.It riscv64 Ta Dv __riscv__, Dv __riscv64 +.It riscv64sf Ta Dv __riscv__, Dv __riscv64 .It sparc64 Ta Dv __sparc64__ .El .Sh SEE ALSO From owner-svn-src-head@freebsd.org Wed May 3 17:21:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1599D5CFC4; Wed, 3 May 2017 17:21:03 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7DFDD3EB; Wed, 3 May 2017 17:21:03 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43HL2kF071824; Wed, 3 May 2017 17:21:02 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43HL2vS071819; Wed, 3 May 2017 17:21:02 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201705031721.v43HL2vS071819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 3 May 2017 17:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317755 - head/sbin/ifconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 17:21:03 -0000 Author: asomers Date: Wed May 3 17:21:01 2017 New Revision: 317755 URL: https://svnweb.freebsd.org/changeset/base/317755 Log: Various Coverity fixes in ifconfig(8) * Exit early if kldload(2) fails (1011259). This is the only change that affects ifconfig's behavior. * Close memory and resource leaks (1305624, 1305205, 1007100) * Mark usage() as _Noreturn (1305806, 1305750) * Fix some dereference after null checks (1011474, 270774) Reported by: Coverity CID: 1305624, 1305205, 1007100, 1305806, 1305750, 1011474, CID: 270774, 1011259 Reviewed by: cem MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D10587 Modified: head/sbin/ifconfig/af_inet6.c head/sbin/ifconfig/ifclone.c head/sbin/ifconfig/ifconfig.c head/sbin/ifconfig/iflagg.c head/sbin/ifconfig/ifpfsync.c Modified: head/sbin/ifconfig/af_inet6.c ============================================================================== --- head/sbin/ifconfig/af_inet6.c Wed May 3 16:55:02 2017 (r317754) +++ head/sbin/ifconfig/af_inet6.c Wed May 3 17:21:01 2017 (r317755) @@ -349,12 +349,14 @@ in6_getaddr(const char *s, int which) bzero(&hints, sizeof(struct addrinfo)); hints.ai_family = AF_INET6; error = getaddrinfo(s, NULL, &hints, &res); + if (error != 0) { + if (inet_pton(AF_INET6, s, &sin->sin6_addr) != 1) + errx(1, "%s: bad value", s); + } else { + bcopy(res->ai_addr, sin, res->ai_addrlen); + freeaddrinfo(res); + } } - if (error != 0) { - if (inet_pton(AF_INET6, s, &sin->sin6_addr) != 1) - errx(1, "%s: bad value", s); - } else - bcopy(res->ai_addr, sin, res->ai_addrlen); } static int Modified: head/sbin/ifconfig/ifclone.c ============================================================================== --- head/sbin/ifconfig/ifclone.c Wed May 3 16:55:02 2017 (r317754) +++ head/sbin/ifconfig/ifclone.c Wed May 3 17:21:01 2017 (r317755) @@ -87,6 +87,7 @@ list_cloners(void) putchar('\n'); free(buf); + close(s); } struct clone_defcb { Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Wed May 3 16:55:02 2017 (r317754) +++ head/sbin/ifconfig/ifconfig.c Wed May 3 17:21:01 2017 (r317755) @@ -106,7 +106,7 @@ static int ifconfig(int argc, char *cons static void status(const struct afswtch *afp, const struct sockaddr_dl *sdl, struct ifaddrs *ifa); static void tunnel_status(int s); -static void usage(void); +static void usage(void) _Noreturn; static struct afswtch *af_getbyname(const char *name); static struct afswtch *af_getbyfamily(int af); @@ -802,26 +802,24 @@ top: */ p = (setaddr ? &setifdstaddr_cmd : &setifaddr_cmd); } - if (p->c_u.c_func || p->c_u.c_func2) { - if (p->c_parameter == NEXTARG) { - if (argv[1] == NULL) - errx(1, "'%s' requires argument", - p->c_name); - p->c_u.c_func(argv[1], 0, s, afp); + if (p->c_parameter == NEXTARG && p->c_u.c_func) { + if (argv[1] == NULL) + errx(1, "'%s' requires argument", + p->c_name); + p->c_u.c_func(argv[1], 0, s, afp); + argc--, argv++; + } else if (p->c_parameter == OPTARG && p->c_u.c_func) { + p->c_u.c_func(argv[1], 0, s, afp); + if (argv[1] != NULL) argc--, argv++; - } else if (p->c_parameter == OPTARG) { - p->c_u.c_func(argv[1], 0, s, afp); - if (argv[1] != NULL) - argc--, argv++; - } else if (p->c_parameter == NEXTARG2) { - if (argc < 3) - errx(1, "'%s' requires 2 arguments", - p->c_name); - p->c_u.c_func2(argv[1], argv[2], s, afp); - argc -= 2, argv += 2; - } else - p->c_u.c_func(*argv, p->c_parameter, s, afp); - } + } else if (p->c_parameter == NEXTARG2 && p->c_u.c_func2) { + if (argc < 3) + errx(1, "'%s' requires 2 arguments", + p->c_name); + p->c_u.c_func2(argv[1], argv[2], s, afp); + argc -= 2, argv += 2; + } else if (p->c_u.c_func) + p->c_u.c_func(*argv, p->c_parameter, s, afp); argc--, argv++; } @@ -1297,8 +1295,8 @@ printb(const char *s, unsigned v, const printf("%s=%o", s, v); else printf("%s=%x", s, v); - bits++; if (bits) { + bits++; putchar('<'); while ((i = *bits++) != '\0') { if (v & (1 << (i-1))) { @@ -1377,7 +1375,8 @@ ifmaybeload(const char *name) } /* not present, we should try to load it */ - kldload(ifkind); + if (kldload(ifkind) < 0) + err(1, "kldload(%s)", ifkind); } static struct cmd basic_cmds[] = { Modified: head/sbin/ifconfig/iflagg.c ============================================================================== --- head/sbin/ifconfig/iflagg.c Wed May 3 16:55:02 2017 (r317754) +++ head/sbin/ifconfig/iflagg.c Wed May 3 17:21:01 2017 (r317755) @@ -200,24 +200,17 @@ static void lagg_status(int s) { struct lagg_protos lpr[] = LAGG_PROTOS; - struct lagg_reqport rp, rpbuf[LAGG_MAX_PORTS]; + struct lagg_reqport rpbuf[LAGG_MAX_PORTS]; struct lagg_reqall ra; struct lagg_reqopts ro; struct lagg_reqflags rf; struct lacp_opreq *lp; const char *proto = ""; - int i, isport = 0; + int i; - bzero(&rp, sizeof(rp)); bzero(&ra, sizeof(ra)); bzero(&ro, sizeof(ro)); - strlcpy(rp.rp_ifname, name, sizeof(rp.rp_ifname)); - strlcpy(rp.rp_portname, name, sizeof(rp.rp_portname)); - - if (ioctl(s, SIOCGLAGGPORT, &rp) == 0) - isport = 1; - strlcpy(ra.ra_ifname, name, sizeof(ra.ra_ifname)); ra.ra_size = sizeof(rpbuf); ra.ra_port = rpbuf; @@ -257,8 +250,6 @@ lagg_status(int s) sep = ","; } } - if (isport) - printf(" laggdev %s", rp.rp_ifname); putchar('\n'); if (verbose) { printf("\tlagg options:\n"); Modified: head/sbin/ifconfig/ifpfsync.c ============================================================================== --- head/sbin/ifconfig/ifpfsync.c Wed May 3 16:55:02 2017 (r317754) +++ head/sbin/ifconfig/ifpfsync.c Wed May 3 17:21:01 2017 (r317755) @@ -120,6 +120,7 @@ setpfsync_syncpeer(const char *val, int if (ioctl(s, SIOCSETPFSYNC, (caddr_t)&ifr) == -1) err(1, "SIOCSETPFSYNC"); + freeaddrinfo(peerres); } /* ARGSUSED */ From owner-svn-src-head@freebsd.org Wed May 3 17:39:05 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40B7AD5C542; Wed, 3 May 2017 17:39:05 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-io0-x22b.google.com (mail-io0-x22b.google.com [IPv6:2607:f8b0:4001:c06::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 07640144B; Wed, 3 May 2017 17:39:05 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: by mail-io0-x22b.google.com with SMTP id p24so13171038ioi.0; Wed, 03 May 2017 10:39:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=l1wO6IjLU3ae3S6MoW70jG8pYCmaTipffCQxmdpHpdQ=; b=ijv6HYcb02wfRyUIkYweGST7U4ZUToUkX9D/VJVWiQWZ+CGuBm4AcPcG3grzjNxkGA 6p5bF7I9eFFP5V0nYfmrzs5JEyV5rN9wdANUyAQjvyeo37ETmFrzQAv2bxOZjLAuqpBS xZAI0pEJqAnTegCYUy485wC9l2p11igV7Uhv98AvWTzLRITQHO56XW6xfa+EAc28rMjU ZJzI/K2Nx8eT5Dv270Yta/thNpTSC5RcimdBenrH5L5DarWqX/sJ2FwErCBx9r9tWqjH HM81BaWwQE6VwpzwX9k4Fgf4mD50JaDwx+oVKdeT8wFlRH2zErslxAJ8sB9CXM7CuhKH t/hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=l1wO6IjLU3ae3S6MoW70jG8pYCmaTipffCQxmdpHpdQ=; b=WPcIYYKYaKWaygPTSkFoM77VhOS9CUVu5ItBJ0ZygEdukzS9A8/08miSyI/OqAzVfU S2rmAZe2oeauPF6HbIPd5bwrhm+HHPEDgR+4vfqbH00j+5BsZGeuhKPH9r36yt+2SAmL KcGAryM1+CEWzcNV66YlNsZFPhj1CuvztIJL9nZh34IELx75j0pMw6JauCFF0bzFvDzh y+c6SQ92ubxYpEiymb1GbfeHZgEU79a9i6FDt+tZ/SeStDSV5TRIWjGAlU7sz6PxujCK cdwnuDtxTb1cXnRHTczNZwYzFVHDqxJyuJ9znux2FHc+QP/uLpwUlStLcLP/LiuDLauH xOQA== X-Gm-Message-State: AN3rC/49KsjhxhJCgPu4TEhjoVBOjEep8lkkT//Qj5E6ohF+Nsl+FbYI AgdyOFcuxTWO5VXmk6lGbYA/XEGzfg== X-Received: by 10.107.6.27 with SMTP id 27mr7763888iog.53.1493833144234; Wed, 03 May 2017 10:39:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.132.202 with HTTP; Wed, 3 May 2017 10:39:03 -0700 (PDT) In-Reply-To: <201705031721.v43HL2vS071819@repo.freebsd.org> References: <201705031721.v43HL2vS071819@repo.freebsd.org> From: Ryan Stone Date: Wed, 3 May 2017 13:39:03 -0400 Message-ID: Subject: Re: svn commit: r317755 - head/sbin/ifconfig To: Alan Somers Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 17:39:05 -0000 On Wed, May 3, 2017 at 1:21 PM, Alan Somers wrote: > Author: asomers > Date: Wed May 3 17:21:01 2017 > New Revision: 317755 > URL: https://svnweb.freebsd.org/changeset/base/317755 > > Log: > Various Coverity fixes in ifconfig(8) > > * Exit early if kldload(2) fails (1011259). This is the only change that > affects ifconfig's behavior. > > Please revert this ASAP. kldload is expected to fail for a number of benign reasons and this change is likely to prevent any network configuration from being applied to systems, breaking remote access. From owner-svn-src-head@freebsd.org Wed May 3 18:07:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46E28D5CF31; Wed, 3 May 2017 18:07:49 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-it0-x241.google.com (mail-it0-x241.google.com [IPv6:2607:f8b0:4001:c0b::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0ED5BCB8; Wed, 3 May 2017 18:07:49 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: by mail-it0-x241.google.com with SMTP id x188so7052279itb.3; Wed, 03 May 2017 11:07:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nswA4UjDWWLUBGC5qaD0ZjaknqEnYZRayCwvj7Xpckw=; b=kc151v3BikoE0RaNnajcgmGw9d0vK3RXSBcxK3MDbsOV53hXvTtxFAtzQtIr5Q6aL4 hQN6t8ilFiOdzm0wjR7qQXc+/9udbym8zFPqqyfnye5xgev3sKGIDJEO6aQAa2QAFEcY n9qC1zMsGQ5LCCQtNtz4j+kVweOGcc0oU9i+1A1QWOUEadHyYeyLqDgXIHBsS43zdvNZ o+VdeCh9o1a1P0UfTK9pINFWj2an0gFUClKeb3xCzOOSERH1lo3cTp1zXf8RKfGOvTgM Owq/PV2UOuTLWAOUMopZ4sI+DZW6FvyyQ62M8i1TMEKr6HZPlVucATme91qUl9ZbhkPK EehA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=nswA4UjDWWLUBGC5qaD0ZjaknqEnYZRayCwvj7Xpckw=; b=WhmlH58yLZ6vlsloOZv46sW9Z+640eXuZl1CG6PrAwvf/vO9ETV4if921IhcCvrz28 t7Z81S11lfpFCotaaF+JQkNqXKhTbWiWtzFjrf04+jJgIL8gjCu0jieFsn/gA4lV83WU DSLm8D4tyQs6x7PRHUvAv5VOtfDGNH5bXmX/Mv3aFX6jx7ckXBOH7OKF2zjIYrDVBTIR w1I5cWXdbf5z6Nb4zFCunhUF+6J/ecP0DJ7vhXcxRvlitge/V1EKOcgj+3TJhpTXfrID 4xMuZo08lwQeiM5W2p+GOakuzegcPzLOrVDwGJzRBffmaubJVHMlJlK4VAN2auI79cSI /5RA== X-Gm-Message-State: AN3rC/763VqXyI2V10acLfspgzO1TVbZBfahpW1l1kyh86hlBeDmVh8G l6W9oHgmcp+bZlBPYJo0mASuREdhPg== X-Received: by 10.36.57.68 with SMTP id l65mr5452725ita.101.1493834868262; Wed, 03 May 2017 11:07:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.132.202 with HTTP; Wed, 3 May 2017 11:07:47 -0700 (PDT) In-Reply-To: References: <201705031721.v43HL2vS071819@repo.freebsd.org> From: Ryan Stone Date: Wed, 3 May 2017 14:07:47 -0400 Message-ID: Subject: Re: svn commit: r317755 - head/sbin/ifconfig To: Alan Somers Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 18:07:49 -0000 On Wed, May 3, 2017 at 1:39 PM, Ryan Stone wrote: > > > On Wed, May 3, 2017 at 1:21 PM, Alan Somers wrote: > >> Author: asomers >> Date: Wed May 3 17:21:01 2017 >> New Revision: 317755 >> URL: https://svnweb.freebsd.org/changeset/base/317755 >> >> Log: >> Various Coverity fixes in ifconfig(8) >> >> * Exit early if kldload(2) fails (1011259). This is the only change that >> affects ifconfig's behavior. >> >> > > Please revert this ASAP. kldload is expected to fail for a number of > benign reasons and this change is likely to prevent any network > configuration from being applied to systems, breaking remote access. > > It's been pointed out to me off-list that the situation is not quite as dire as I had originally believed. The ifconfig code in question already searches to check if the module in question is loaded before calling kldload. However, there is at least one driver (mlx4_en) that does not follow the "if_" kld module naming convention that this code depends on, so this change will make it impossible to apply configuration to mlx4_en interfaces. Additionally, it is possible that other drivers use the naming convention for their kld file but not for the module declared in the C code, in which case this change would also break configuration of those interfaces. jhb@ suggests that ifconfig should only attempt to load a module if the interface doesn't already exist, by calling if_nametoindex to check for the existence of the interface. That seems to be a reasonable fix for me, but in the interest of not breaking users' networking configuration (potentially making it impossible to fix a remote machine), I'd recommend that the part of the change that checks the return code from kldload() be reverted while a fix for this issue is worked on. From owner-svn-src-head@freebsd.org Wed May 3 18:16:05 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08831D5C33E; Wed, 3 May 2017 18:16:05 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD249926; Wed, 3 May 2017 18:16:04 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x242.google.com with SMTP id v1so29401056pgv.3; Wed, 03 May 2017 11:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=cMTzSGCANFtx/VDMtOd9wBPi2aVekHP0I8Vn28gmWL0=; b=IAhwx01UQ98GxOrp4R+cMwZIyoNzN+h5/k9AaTZqRvJNtbdUpX36J4kT6xAy7QByLj FPBItgqlc1oXbjo0PtjWFdPceRYCL6u6/O4vovUMAEi/4LDXEWfBY6MO03o+EO3wV9Cm hDHGYn2WayC2sz2PbO2MXDLTNtatAOE6h5kM8km48SLdMdoH2nN+j8Ggv5OO91ekHWzu lIBGh9NaTLAgij9AHVP1EI/VHh0b32HYghl0j4cQhyYiNmZ3Bpibr70IwfK7q+4H6v1k KqDmeiDjR6GeI0+O1+w7555xAhQFbdW3wDP6LrGqSVCrGC6636tbKKyOhJDKxJoMDKJr fTZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=cMTzSGCANFtx/VDMtOd9wBPi2aVekHP0I8Vn28gmWL0=; b=fqcXP4oQGtkeg7m6gS6RBjeTycBhoBFfk3vh2q8YCYDRQ+VAeZu2YWxEo5VccR4y9t NNQ2TmnVSUPAi/qK6CABziadzJlt3fJ4pFfcs4pTXQmNrH7LdxaLuNEN05am21aL2j8Z 2Rn73zFH1wXEnqkZAOz3uZLMoBarQJpgjkcIxofNPNTz5VpjPP26XkUBZ0fcGiIAE9+2 gucIJvzQgKoC7uw9FLplHvfAooLt3RUOJboSvoz5NSbl+Q4PztiT1CjMKrSiLoddz14t wYNBOrOW4/4/wQ0FEqTkGu9tB3lu5epHjzgPO0D6IligSl+w5Q7F756gS7O7wdKFgQXJ ylwg== X-Gm-Message-State: AN3rC/5ynyFD1sNQHmFtebGgWKigb6pAuqPMeXJLHKft1CFbuj29SXJT IxX9XcNbTgk9yelEUZE= X-Received: by 10.98.205.14 with SMTP id o14mr6337597pfg.42.1493835364090; Wed, 03 May 2017 11:16:04 -0700 (PDT) Received: from ?IPv6:2607:fb90:834d:7c23:2c95:951c:d460:982b? ([2607:fb90:834d:7c23:2c95:951c:d460:982b]) by smtp.gmail.com with ESMTPSA id t15sm5842883pfg.31.2017.05.03.11.16.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 May 2017 11:16:03 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r317755 - head/sbin/ifconfig From: Ngie Cooper X-Mailer: iPhone Mail (14E304) In-Reply-To: <201705031721.v43HL2vS071819@repo.freebsd.org> Date: Wed, 3 May 2017 11:16:02 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <8EA7A2E9-A429-4DC2-85CE-1B5AAEDF86FD@gmail.com> References: <201705031721.v43HL2vS071819@repo.freebsd.org> To: Alan Somers X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 18:16:05 -0000 > On May 3, 2017, at 10:21, Alan Somers wrote: >=20 > Author: asomers > Date: Wed May 3 17:21:01 2017 > New Revision: 317755 > URL: https://svnweb.freebsd.org/changeset/base/317755 >=20 > Log: > Various Coverity fixes in ifconfig(8) ... > * Mark usage() as _Noreturn (1305806, 1305750) ... > -static void usage(void); > +static void usage(void) _Noreturn; Hi Alan, Please use __dead2 instead to be consistent with legacy use of similar g= cc attributes. Thanks, -Ngie= From owner-svn-src-head@freebsd.org Wed May 3 18:18:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD11BD5C3D9 for ; Wed, 3 May 2017 18:18:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm1-vm4.bullet.mail.ne1.yahoo.com (nm1-vm4.bullet.mail.ne1.yahoo.com [98.138.91.161]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77F00AA6 for ; Wed, 3 May 2017 18:18:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1493835505; bh=W47OE0Mfr0woV7idRw+6QcaWxMKEKwb8TzRsn823zwc=; h=Subject:From:To:Cc:References:Date:In-Reply-To:From:Subject; b=Tj4c8lZHIq9qQ2pgNDiPdmrSdHm4CQ52QMeocsS9c//V/n1CAyjWdJFWPkdFjeytyOv156swsQO/dhGnjDjRaVw0yZBb+YGC7tPGalxUtCJ7+WcPGVEs8EvNqXekURyE6XgLh3EEE9S4JcyuchX36elryOEll5n5IHa3XRED/fSvAED5OZskTIpP/17sfQwGhDwK+2w5OBPrjdi0I4Q8OEvtkn4QAo77QjzN21yxJ/OwJRt8XTX7Gm3wMoPjuttqX9JkpBMUkh0BjjgOHiqE1bSWTT7jF7kij6yup7So2R45QWiRNHwTONW5fNbNEcOLbksJk0/EQTBpAjtuQkykVg== Received: from [98.138.101.128] by nm1.bullet.mail.ne1.yahoo.com with NNFMP; 03 May 2017 18:18:25 -0000 Received: from [98.138.84.47] by tm16.bullet.mail.ne1.yahoo.com with NNFMP; 03 May 2017 18:18:25 -0000 Received: from [127.0.0.1] by smtp115.mail.ne1.yahoo.com with NNFMP; 03 May 2017 18:18:25 -0000 X-Yahoo-Newman-Id: 896281.30057.bm@smtp115.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: NgMhlbsVM1nwIaHlCoXq004atu_OVF4vickvMOBM59LDuwA 8nOFdF_77JYWFyaV8h0vEPz97FCBRUmgR1g1DbwnPY5KxHiYf66jxzVBgEBV c0Djj4HMPONhJlyok8gF0wiol69FssSh8L6NXn9p4qj_c8_IYXroI9eH_RGV 9mDfSNfx5slWskBND2ctRfo4T2I3zNHnct4cMbj8hlTkLlXrBKK4PDIernwP PqxIR0P0rwYCB2o5ag33x7XYuBEjWPe1uzB5FGBJ9gYuniRlLG1quyuX5SY_ QsXt3vZ4ohZ_jN1h2phRw1I4hhBF0imllUoTrHKzoBViMMTfqa3BTHMtyr2n iutXBSgs0ZCml9Wa8jinNi4cBkTnFCFjGXOyBAvZUMaev.5GRYHqPDpATwNl SiWa4shdl0eloCHxMPMAtxiGI1MDbIGgSimbS3mRO7UhmRvoI.CRFqVD8uEs 5q_wS5BWnIYEzFyJlIWbkN.OLXZc08w8FHjZ1ANNM5tMsTaVhHdiW8fkz.r2 ECzBOx6f7i6wz5Q5gtiJktPdMnVS0spuzsE3OShhmoIMm X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r317709 - head/usr.bin/csplit From: Pedro Giffuni To: Bruce Evans , Jilles Tjoelker Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201705022156.v42LuKbp088899@repo.freebsd.org> <20170503162918.U1062@besplex.bde.org> <2c7bd200-957d-2c36-076e-41d4d04a2956@FreeBSD.org> Organization: FreeBSD Message-ID: Date: Wed, 3 May 2017 13:18:23 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: <2c7bd200-957d-2c36-076e-41d4d04a2956@FreeBSD.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 18:18:33 -0000 On 05/03/17 09:56, Pedro Giffuni wrote: > > ... > >> Grepping for fputs in /usr/src shows too many instances to check (mostly >> without any error handling). The simplest filter 'if (fputs' found the >> dependency on the old FreeBSD behaviour in csplit and 2 other places: >> >> contrib/mdocml/main.c: if (fputs(cp, stdout)) { >> contrib/mdocml/main.c- fclose(stream); I can't find the above on the version in FreeBSD-current (or 11-stable). >> contrib/libreadline/examples/rlcat.c: if (fputs (x, stdout) != 0) >> contrib/libreadline/examples/rlcat.c- return 1; >> This is an example so it's luckily not under use. Hopefully libreadline is going away from base but it's still important to report this upstream (will do). >> More complicated filters like 'if ([^(]]*[^a-z_]fputs' failed to find >> any problems since I messed up the regexp. >> > > I admittedly ignored contrib, plus I only skimmed for comparisons to > zero. > > Now I am worried: the classic BSD implementation is ubiquitous and > this bug > is not easy to find, particularly in ports. > I went though the OpenOffice code, and it's dependencies, and I couldn't find any place where a similar issue happens. I did find several places where there was a correct comparison to EOF or >=0, but the vast majority of code just call fputs() without checking the return value. > Do you guys think it we should revert to the previous behavior, at > least for 11.1? > The bugs should be reported upstream but it is not really our battle > to fix the world > for Apple is it? > It seems like most code may have already adapted to the Apple variant. Pedro. From owner-svn-src-head@freebsd.org Wed May 3 18:41:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1AD9D5CCC1; Wed, 3 May 2017 18:41:09 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C97B0C13; Wed, 3 May 2017 18:41:09 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43If8XI002998; Wed, 3 May 2017 18:41:08 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43If85k002993; Wed, 3 May 2017 18:41:08 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201705031841.v43If85k002993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 3 May 2017 18:41:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317756 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 18:41:10 -0000 Author: cem Date: Wed May 3 18:41:08 2017 New Revision: 317756 URL: https://svnweb.freebsd.org/changeset/base/317756 Log: Extend cpuset_get/setaffinity() APIs Add IRQ placement-only and ithread-only API variants. intr_event_bind has been extended with sibling methods, as it has many more callsites in existing code. Reviewed by: kib@, adrian@ (earlier version) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D10586 Modified: head/sys/kern/kern_cpuset.c head/sys/kern/kern_intr.c head/sys/kern/subr_gtaskqueue.c head/sys/sys/cpuset.h head/sys/sys/interrupt.h Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Wed May 3 17:21:01 2017 (r317755) +++ head/sys/kern/kern_cpuset.c Wed May 3 18:41:08 2017 (r317756) @@ -1115,6 +1115,8 @@ kern_cpuset_getaffinity(struct thread *t case CPU_WHICH_JAIL: break; case CPU_WHICH_IRQ: + case CPU_WHICH_INTRHANDLER: + case CPU_WHICH_ITHREAD: case CPU_WHICH_DOMAIN: error = EINVAL; goto out; @@ -1145,7 +1147,9 @@ kern_cpuset_getaffinity(struct thread *t CPU_COPY(&set->cs_mask, mask); break; case CPU_WHICH_IRQ: - error = intr_getaffinity(id, mask); + case CPU_WHICH_INTRHANDLER: + case CPU_WHICH_ITHREAD: + error = intr_getaffinity(id, which, mask); break; case CPU_WHICH_DOMAIN: if (id < 0 || id >= MAXMEMDOM) @@ -1239,6 +1243,8 @@ kern_cpuset_setaffinity(struct thread *t case CPU_WHICH_JAIL: break; case CPU_WHICH_IRQ: + case CPU_WHICH_INTRHANDLER: + case CPU_WHICH_ITHREAD: case CPU_WHICH_DOMAIN: error = EINVAL; goto out; @@ -1268,7 +1274,9 @@ kern_cpuset_setaffinity(struct thread *t } break; case CPU_WHICH_IRQ: - error = intr_setaffinity(id, mask); + case CPU_WHICH_INTRHANDLER: + case CPU_WHICH_ITHREAD: + error = intr_setaffinity(id, which, mask); break; default: error = EINVAL; Modified: head/sys/kern/kern_intr.c ============================================================================== --- head/sys/kern/kern_intr.c Wed May 3 17:21:01 2017 (r317755) +++ head/sys/kern/kern_intr.c Wed May 3 18:41:08 2017 (r317756) @@ -287,13 +287,11 @@ intr_event_create(struct intr_event **ev /* * Bind an interrupt event to the specified CPU. Note that not all * platforms support binding an interrupt to a CPU. For those - * platforms this request will fail. For supported platforms, any - * associated ithreads as well as the primary interrupt context will - * be bound to the specificed CPU. Using a cpu id of NOCPU unbinds + * platforms this request will fail. Using a cpu id of NOCPU unbinds * the interrupt event. */ -int -intr_event_bind(struct intr_event *ie, int cpu) +static int +_intr_event_bind(struct intr_event *ie, int cpu, bool bindirq, bool bindithread) { lwpid_t id; int error; @@ -313,35 +311,75 @@ intr_event_bind(struct intr_event *ie, i * If we have any ithreads try to set their mask first to verify * permissions, etc. */ - mtx_lock(&ie->ie_lock); - if (ie->ie_thread != NULL) { - id = ie->ie_thread->it_thread->td_tid; - mtx_unlock(&ie->ie_lock); - error = cpuset_setithread(id, cpu); - if (error) - return (error); - } else - mtx_unlock(&ie->ie_lock); - error = ie->ie_assign_cpu(ie->ie_source, cpu); - if (error) { + if (bindithread) { mtx_lock(&ie->ie_lock); if (ie->ie_thread != NULL) { - cpu = ie->ie_cpu; id = ie->ie_thread->it_thread->td_tid; mtx_unlock(&ie->ie_lock); - (void)cpuset_setithread(id, cpu); + error = cpuset_setithread(id, cpu); + if (error) + return (error); } else mtx_unlock(&ie->ie_lock); + } + if (bindirq) + error = ie->ie_assign_cpu(ie->ie_source, cpu); + if (error) { + if (bindithread) { + mtx_lock(&ie->ie_lock); + if (ie->ie_thread != NULL) { + cpu = ie->ie_cpu; + id = ie->ie_thread->it_thread->td_tid; + mtx_unlock(&ie->ie_lock); + (void)cpuset_setithread(id, cpu); + } else + mtx_unlock(&ie->ie_lock); + } return (error); } - mtx_lock(&ie->ie_lock); - ie->ie_cpu = cpu; - mtx_unlock(&ie->ie_lock); + if (bindirq) { + mtx_lock(&ie->ie_lock); + ie->ie_cpu = cpu; + mtx_unlock(&ie->ie_lock); + } return (error); } +/* + * Bind an interrupt event to the specified CPU. For supported platforms, any + * associated ithreads as well as the primary interrupt context will be bound + * to the specificed CPU. + */ +int +intr_event_bind(struct intr_event *ie, int cpu) +{ + + return (_intr_event_bind(ie, cpu, true, true)); +} + +/* + * Bind an interrupt event to the specified CPU, but do not bind associated + * ithreads. + */ +int +intr_event_bind_irqonly(struct intr_event *ie, int cpu) +{ + + return (_intr_event_bind(ie, cpu, true, false)); +} + +/* + * Bind an interrupt event's ithread to the specified CPU. + */ +int +intr_event_bind_ithread(struct intr_event *ie, int cpu) +{ + + return (_intr_event_bind(ie, cpu, false, true)); +} + static struct intr_event * intr_lookup(int irq) { @@ -358,7 +396,7 @@ intr_lookup(int irq) } int -intr_setaffinity(int irq, void *m) +intr_setaffinity(int irq, int mode, void *m) { struct intr_event *ie; cpuset_t *mask; @@ -382,26 +420,62 @@ intr_setaffinity(int irq, void *m) ie = intr_lookup(irq); if (ie == NULL) return (ESRCH); - return (intr_event_bind(ie, cpu)); + switch (mode) { + case CPU_WHICH_IRQ: + return (intr_event_bind(ie, cpu)); + case CPU_WHICH_INTRHANDLER: + return (intr_event_bind_irqonly(ie, cpu)); + case CPU_WHICH_ITHREAD: + return (intr_event_bind_ithread(ie, cpu)); + default: + return (EINVAL); + } } int -intr_getaffinity(int irq, void *m) +intr_getaffinity(int irq, int mode, void *m) { struct intr_event *ie; + struct thread *td; + struct proc *p; cpuset_t *mask; + lwpid_t id; + int error; mask = m; ie = intr_lookup(irq); if (ie == NULL) return (ESRCH); + + error = 0; CPU_ZERO(mask); - mtx_lock(&ie->ie_lock); - if (ie->ie_cpu == NOCPU) - CPU_COPY(cpuset_root, mask); - else - CPU_SET(ie->ie_cpu, mask); - mtx_unlock(&ie->ie_lock); + switch (mode) { + case CPU_WHICH_IRQ: + case CPU_WHICH_INTRHANDLER: + mtx_lock(&ie->ie_lock); + if (ie->ie_cpu == NOCPU) + CPU_COPY(cpuset_root, mask); + else + CPU_SET(ie->ie_cpu, mask); + mtx_unlock(&ie->ie_lock); + break; + case CPU_WHICH_ITHREAD: + mtx_lock(&ie->ie_lock); + if (ie->ie_thread == NULL) { + mtx_unlock(&ie->ie_lock); + CPU_COPY(cpuset_root, mask); + } else { + id = ie->ie_thread->it_thread->td_tid; + mtx_unlock(&ie->ie_lock); + error = cpuset_which(CPU_WHICH_TID, id, &p, &td, NULL); + if (error != 0) + return (error); + CPU_COPY(&td->td_cpuset->cs_mask, mask); + PROC_UNLOCK(p); + } + default: + return (EINVAL); + } return (0); } Modified: head/sys/kern/subr_gtaskqueue.c ============================================================================== --- head/sys/kern/subr_gtaskqueue.c Wed May 3 17:21:01 2017 (r317755) +++ head/sys/kern/subr_gtaskqueue.c Wed May 3 18:41:08 2017 (r317756) @@ -679,7 +679,7 @@ taskqgroup_attach(struct taskqgroup *qgr CPU_ZERO(&mask); CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask); mtx_unlock(&qgroup->tqg_lock); - intr_setaffinity(irq, &mask); + intr_setaffinity(irq, CPU_WHICH_IRQ, &mask); } else mtx_unlock(&qgroup->tqg_lock); } @@ -698,7 +698,7 @@ taskqgroup_attach_deferred(struct taskqg CPU_ZERO(&mask); CPU_SET(cpu, &mask); - intr_setaffinity(gtask->gt_irq, &mask); + intr_setaffinity(gtask->gt_irq, CPU_WHICH_IRQ, &mask); mtx_lock(&qgroup->tqg_lock); } @@ -745,7 +745,7 @@ taskqgroup_attach_cpu(struct taskqgroup CPU_ZERO(&mask); CPU_SET(cpu, &mask); if (irq != -1 && tqg_smp_started) - intr_setaffinity(irq, &mask); + intr_setaffinity(irq, CPU_WHICH_IRQ, &mask); return (0); } @@ -779,7 +779,7 @@ taskqgroup_attach_cpu_deferred(struct ta CPU_SET(cpu, &mask); if (irq != -1) - intr_setaffinity(irq, &mask); + intr_setaffinity(irq, CPU_WHICH_IRQ, &mask); return (0); } Modified: head/sys/sys/cpuset.h ============================================================================== --- head/sys/sys/cpuset.h Wed May 3 17:21:01 2017 (r317755) +++ head/sys/sys/cpuset.h Wed May 3 18:41:08 2017 (r317756) @@ -83,6 +83,8 @@ #define CPU_WHICH_IRQ 4 /* Specifies an irq #. */ #define CPU_WHICH_JAIL 5 /* Specifies a jail id. */ #define CPU_WHICH_DOMAIN 6 /* Specifies a NUMA domain id. */ +#define CPU_WHICH_INTRHANDLER 7 /* Specifies an irq # (not ithread). */ +#define CPU_WHICH_ITHREAD 8 /* Specifies an irq's ithread. */ /* * Reserved cpuset identifiers. Modified: head/sys/sys/interrupt.h ============================================================================== --- head/sys/sys/interrupt.h Wed May 3 17:21:01 2017 (r317755) +++ head/sys/sys/interrupt.h Wed May 3 18:41:08 2017 (r317756) @@ -162,6 +162,8 @@ int intr_event_add_handler(struct intr_e driver_filter_t filter, driver_intr_t handler, void *arg, u_char pri, enum intr_type flags, void **cookiep); int intr_event_bind(struct intr_event *ie, int cpu); +int intr_event_bind_irqonly(struct intr_event *ie, int cpu); +int intr_event_bind_ithread(struct intr_event *ie, int cpu); int intr_event_create(struct intr_event **event, void *source, int flags, int irq, void (*pre_ithread)(void *), void (*post_ithread)(void *), void (*post_filter)(void *), @@ -173,9 +175,9 @@ int intr_event_destroy(struct intr_event void intr_event_execute_handlers(struct proc *p, struct intr_event *ie); int intr_event_handle(struct intr_event *ie, struct trapframe *frame); int intr_event_remove_handler(void *cookie); -int intr_getaffinity(int irq, void *mask); +int intr_getaffinity(int irq, int mode, void *mask); void *intr_handler_source(void *cookie); -int intr_setaffinity(int irq, void *mask); +int intr_setaffinity(int irq, int mode, void *mask); void _intr_drain(int irq); /* Linux compat only. */ int swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler, void *arg, int pri, enum intr_type flags, From owner-svn-src-head@freebsd.org Wed May 3 18:46:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5C37D5CED8; Wed, 3 May 2017 18:46:34 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 876D61079; Wed, 3 May 2017 18:46:34 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43IkXlG006175; Wed, 3 May 2017 18:46:33 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43IkXGv006174; Wed, 3 May 2017 18:46:33 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201705031846.v43IkXGv006174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 3 May 2017 18:46:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317757 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 18:46:34 -0000 Author: cem Date: Wed May 3 18:46:33 2017 New Revision: 317757 URL: https://svnweb.freebsd.org/changeset/base/317757 Log: cpuset.2: Document new API options A follow-up to r317756. Adrian will chase up the userspace cpuset(1) additions. Reported by: kib@ Sponsored by: Dell EMC Isilon Modified: head/lib/libc/sys/cpuset.2 Modified: head/lib/libc/sys/cpuset.2 ============================================================================== --- head/lib/libc/sys/cpuset.2 Wed May 3 18:41:08 2017 (r317756) +++ head/lib/libc/sys/cpuset.2 Wed May 3 18:46:33 2017 (r317757) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 20, 2015 +.Dd May 3, 2017 .Dt CPUSET 2 .Os .Sh NAME @@ -101,6 +101,8 @@ argument may have the following values: .It Dv CPU_WHICH_JAIL Ta "id is jid (jail id)" .It Dv CPU_WHICH_CPUSET Ta "id is a cpusetid_t (cpuset id)" .It Dv CPU_WHICH_IRQ Ta "id is an irq number" +.It Dv CPU_WHICH_INTRHANDLER Ta "id is an irq number for an interrupt handler" +.It Dv CPU_WHICH_ITHREAD Ta "id is an irq number for an ithread" .It Dv CPU_WHICH_DOMAIN Ta "id is a NUMA domain" .El .Pp From owner-svn-src-head@freebsd.org Wed May 3 19:03:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 720BCD575A4 for ; Wed, 3 May 2017 19:03:29 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 556DD1CDF for ; Wed, 3 May 2017 19:03:28 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 3cce766d-3033-11e7-bfb5-0d159cd3c324 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 3cce766d-3033-11e7-bfb5-0d159cd3c324; Wed, 03 May 2017 19:03:48 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v43J3J2W001711; Wed, 3 May 2017 13:03:19 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1493838199.80042.14.camel@freebsd.org> Subject: Re: svn commit: r317755 - head/sbin/ifconfig From: Ian Lepore To: Ryan Stone , Alan Somers Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Date: Wed, 03 May 2017 13:03:19 -0600 In-Reply-To: References: <201705031721.v43HL2vS071819@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 19:03:29 -0000 On Wed, 2017-05-03 at 14:07 -0400, Ryan Stone wrote: > On Wed, May 3, 2017 at 1:39 PM, Ryan Stone wrote: > > > > > > > > > On Wed, May 3, 2017 at 1:21 PM, Alan Somers wrote: > > > > > > > > Author: asomers > > > Date: Wed May  3 17:21:01 2017 > > > New Revision: 317755 > > > URL: https://svnweb.freebsd.org/changeset/base/317755 > > > > > > Log: > > >   Various Coverity fixes in ifconfig(8) > > > > > >   * Exit early if kldload(2) fails (1011259). This is the only change that > > >     affects ifconfig's behavior. > > > > > > > > Please revert this ASAP.  kldload is expected to fail for a number of > > benign reasons and this change is likely to prevent any network > > configuration from being applied to systems, breaking remote access. > > > > > It's been pointed out to me off-list that the situation is not quite as > dire as I had originally believed.  The ifconfig code in question already > searches to check if the module in question is loaded before calling > kldload.  However, there is at least one driver (mlx4_en) that does not > follow the "if_" kld module naming convention that this code depends > on, so this change will make it impossible to apply configuration to > mlx4_en interfaces.  Additionally, it is possible that other drivers use > the naming convention for their kld file but not for the module declared in > the C code, in which case this change would also break configuration of > those interfaces. > > jhb@ suggests that ifconfig should only attempt to load a module if the > interface doesn't already exist, by calling if_nametoindex to check for the > existence of the interface.  That seems to be a reasonable fix for me, but > in the interest of not breaking users' networking configuration > (potentially making it impossible to fix a remote machine), I'd recommend > that the part of the change that checks the return code from kldload() be > reverted while a fix for this issue is worked on. It should be noted that the existing code uses if_nametoindex() immediately after ifmaybeload() returns, and handles errors accordingly.  I.e., there wasn't really anything wrong with the code as originally written/structured. -- Ian From owner-svn-src-head@freebsd.org Wed May 3 19:22:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 276CBD57E57; Wed, 3 May 2017 19:22:04 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-yb0-x241.google.com (mail-yb0-x241.google.com [IPv6:2607:f8b0:4002:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D7EE2B34; Wed, 3 May 2017 19:22:03 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-yb0-x241.google.com with SMTP id l192so8595885ybl.1; Wed, 03 May 2017 12:22:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Df0fyDNfaKLR3l9pecApJPOqRwZ34MDYVaO+35/m9U8=; b=cdmDmjGFOAoYo52SO/bgymiEkCyQeX3m3xQ7dyKhGYorZFc8dCxbcmUMRf0S+l8Uzy B1LWbzxqEnzWBju6Yp8TqvL1RDGAZFIY4txiI/BM21FA5Au1fzJJqx6nkhKw1x4tdi5X atPjVLQ1sqlQLFHHEV2PW1xfkSaZbOTb8EcQNjY0dfMmI0nqRtuBc4fbcxVkDoPCSYpN cqNiuAWJu5jKLwUyuS9JtIsp7NtFjsNKAzTYe+NP7L6Xt/AUMYw4nIMmc3Kf/DXG3y2a 1e5zQso/c0AijK3ewuWywFA5oyVHXCc5ZE5EkiodQUR/wFG5fxRZpkxghELl+hygVJQs QSgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Df0fyDNfaKLR3l9pecApJPOqRwZ34MDYVaO+35/m9U8=; b=EsRkKaVrNcQUyV51mCrHX+YO3h/R0V0lGJJX8LirKWUgM/7i4Sg88kxvgXGEJg4bwW oZQCybqFPyt/IdsKfp6Ws11u6qScef761myS3fZpCrxi6MR2kyUBLqT8OJFrKPUUftUo W4wHGND7Lnv2mmSCMzhEfq5vkIsxgx/ayPvRda3bmYuMRMCQ7VB3052BU8tGtWw55Bh4 rm0oTSZStrY9PomAZ4cFSXIEdoy6dUJT/k461Cz5yQ14tfaZdkWVzsVuimqRHgtehMm1 BmQz0FcyBNoTfyKdNcu/uD0RLWuKbhEPQzaCzMi6LkAQp6hkZ3n5AbHmY2KULW/WTfBU OEfw== X-Gm-Message-State: AN3rC/4SyQ9lBooq9UWgOpe8OZVGye9i20vCPl6T0f0Ac0IiUb89VOxE cQyNy8xldhfX0U5AOdarq8hpXmRflm4w X-Received: by 10.37.5.209 with SMTP id 200mr31619233ybf.139.1493839322082; Wed, 03 May 2017 12:22:02 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.129.20.214 with HTTP; Wed, 3 May 2017 12:22:01 -0700 (PDT) In-Reply-To: <1493838199.80042.14.camel@freebsd.org> References: <201705031721.v43HL2vS071819@repo.freebsd.org> <1493838199.80042.14.camel@freebsd.org> From: Alan Somers Date: Wed, 3 May 2017 13:22:01 -0600 X-Google-Sender-Auth: xB4KqykgbWKeSMnbnSJTx65WEiw Message-ID: Subject: Re: svn commit: r317755 - head/sbin/ifconfig To: Ian Lepore Cc: Ryan Stone , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 19:22:04 -0000 On Wed, May 3, 2017 at 1:03 PM, Ian Lepore wrote: > On Wed, 2017-05-03 at 14:07 -0400, Ryan Stone wrote: >> On Wed, May 3, 2017 at 1:39 PM, Ryan Stone wrote: >> >> > >> > >> > >> > On Wed, May 3, 2017 at 1:21 PM, Alan Somers wrote: >> > >> > > >> > > Author: asomers >> > > Date: Wed May 3 17:21:01 2017 >> > > New Revision: 317755 >> > > URL: https://svnweb.freebsd.org/changeset/base/317755 >> > > >> > > Log: >> > > Various Coverity fixes in ifconfig(8) >> > > >> > > * Exit early if kldload(2) fails (1011259). This is the only change that >> > > affects ifconfig's behavior. >> > > >> > > >> > Please revert this ASAP. kldload is expected to fail for a number of >> > benign reasons and this change is likely to prevent any network >> > configuration from being applied to systems, breaking remote access. >> > >> > >> It's been pointed out to me off-list that the situation is not quite as >> dire as I had originally believed. The ifconfig code in question already >> searches to check if the module in question is loaded before calling >> kldload. However, there is at least one driver (mlx4_en) that does not >> follow the "if_" kld module naming convention that this code depends >> on, so this change will make it impossible to apply configuration to >> mlx4_en interfaces. Additionally, it is possible that other drivers use >> the naming convention for their kld file but not for the module declared in >> the C code, in which case this change would also break configuration of >> those interfaces. >> >> jhb@ suggests that ifconfig should only attempt to load a module if the >> interface doesn't already exist, by calling if_nametoindex to check for the >> existence of the interface. That seems to be a reasonable fix for me, but >> in the interest of not breaking users' networking configuration >> (potentially making it impossible to fix a remote machine), I'd recommend >> that the part of the change that checks the return code from kldload() be >> reverted while a fix for this issue is worked on. > > It should be noted that the existing code uses if_nametoindex() > immediately after ifmaybeload() returns, and handles errors > accordingly. I.e., there wasn't really anything wrong with the code as > originally written/structured. > > -- Ian The problem with the original code is that module load errors would be caught too late, and as a result the error printed would be less useful. For example, if you forgot to put "kld_list=if_igb" in /etc/rc.conf and run "ifconfig igb0", it would print "ifconfig: interface igb7 does not exist" instead of the more useful "ifconfig: kldload(if_igb): Operation not permitted". But I didn't know that there were drivers like mlx4en where ifconfig can't load the correct module. So I'll take Ryan's suggestion and revert that part for now. -Alan From owner-svn-src-head@freebsd.org Wed May 3 19:32:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85E91D5821F; Wed, 3 May 2017 19:32:18 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 501DA1108; Wed, 3 May 2017 19:32:18 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 474DED67A8D; Thu, 4 May 2017 05:32:11 +1000 (AEST) Date: Thu, 4 May 2017 05:32:10 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ngie Cooper cc: Alan Somers , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317755 - head/sbin/ifconfig In-Reply-To: <8EA7A2E9-A429-4DC2-85CE-1B5AAEDF86FD@gmail.com> Message-ID: <20170504044558.Y992@besplex.bde.org> References: <201705031721.v43HL2vS071819@repo.freebsd.org> <8EA7A2E9-A429-4DC2-85CE-1B5AAEDF86FD@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=AYLBJzfG c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=ZGSl9oWYpliUKDSVMyYA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 19:32:18 -0000 On Wed, 3 May 2017, Ngie Cooper wrote: >> On May 3, 2017, at 10:21, Alan Somers wrote: >> >> Author: asomers >> Date: Wed May 3 17:21:01 2017 >> New Revision: 317755 >> URL: https://svnweb.freebsd.org/changeset/base/317755 >> >> Log: >> Various Coverity fixes in ifconfig(8) > > ... > >> * Mark usage() as _Noreturn (1305806, 1305750) > > ... > >> -static void usage(void); >> +static void usage(void) _Noreturn; > > Please use __dead2 instead to be consistent with legacy use of similar gcc attributes. _Noreturn after the function is also a syntax error for C++11 and therefore a logic error in all cases (see below). Using either a static function is a style bug. __dead2 and _Noreturn are mostly for functions that can't be directly seen to not return because they are separately compiled, but static functions are never separately compiled. There might be exceptions for functions that don't return but this is not obvious. usage() is not an exception since it it is so simple. style(9) requires it to end with exit(). exit() must be declared as __dead2 so that it is known to not return. This depends on the compiler doing processing the whole file to see which static functions don't return before complaining about probems from them returning in calls earlier in the file, but compilers must do that to avoid spurious warnings. Even gcc-1 seems to have done it, and now -O implies -funit-at-a-time which does it and uses the results more To enlarge this style bug and break portability, use _Noreturn in some places and __dead2 in others, and place it before the function name and misindent it, as in . Actually, there are syntactical problems which require some of the style bugs if _Noreturn is used at all, so it should never be used. _Noreturn expands to [[noreturn]] for c++11. It is a syntax error if you place it where you did (after the function name). OTOH, __dead2 is a syntax error for the compiler it was written for (gcc-2.0) when it is placed before the function name. __dead2 replaced __dead which was for gcc-1 and had the same syntactical restriction as [[noreturn]]. gcc had obscure restrictions on the placement of __attribute__(()) much later than gcc-2.0, but the __noreturn__ attribute used by __dead2 is accepted both before and after the function name by gcc-2.95.4, so it is fairly portable in practice. should be careful about portablity and style, but ifconfig doesn't need to be portable. Bruce From owner-svn-src-head@freebsd.org Wed May 3 19:32:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05445D5824E; Wed, 3 May 2017 19:32:27 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-yw0-x22a.google.com (mail-yw0-x22a.google.com [IPv6:2607:f8b0:4002:c05::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B7F0F1179; Wed, 3 May 2017 19:32:26 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-yw0-x22a.google.com with SMTP id 203so90270342ywe.0; Wed, 03 May 2017 12:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=FCE5sXsEsiZq3aYqJIfY/LwXUUNTk1SQRMg9nib3zuM=; b=Kl3oO3zSZGBPvajZOmpZvpf6s3QcuXzRwjMahPer+27ZAmU+R4rX5uyKZNMZ0iNVwN 82pn6cHmsaCT5pUrYoyE6gbh/fww6mP8CJjYcaXQ90urKx+jsCFTRyH8A02VbEF7/1E7 3eU/OwcVSjtnphBfQNV72HbXSdkjpeoqJHtf5Nf+sHqSk5EaqA/hzzMR+KrNOuPFvXMS S71DcA4HdgrmbrzJIj1vTb6AXcohxlBpXnpdXdkLhNKvR+BnZKPmm6wNyvg/X5zQ8FEt O5Nivlg+onEXJoTmu3+oE2K8jlAqFFz/+hP4BJ0K90rRfm6LFqKJoAfjVtiuFHuJHfEJ YAnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=FCE5sXsEsiZq3aYqJIfY/LwXUUNTk1SQRMg9nib3zuM=; b=oa7AwdUdzN2uLUysi0rBObauMAeRKxlv4kSkDonU8hmhaLXk1KwgXOcsrrjyr4RxWu gNaBQe35tBczGIh8dCbZaxHQPQsSI2QS0K0yBBQX86YEQ98n4yMArby2M5+txQK2y9Jj lUZruvI3EHKzmTJDDq/NO4WoizVkdIOPsGOdK1g7mygR7rNT7DgIbPMar/eYBrzX3hkI /+V00318n4fxcohhPogr6jS4VhHVh43LlgSVBDrhc1w8yrXY95HuEgUUz0GhOgA4kZZD O0QEmbDqJd03Xd0Nxd5Et4mNaUGqbPF7lcetJnUVuBUa/EFeuGWMtEdQEuVR2aifjrN7 qp/A== X-Gm-Message-State: AN3rC/501uFR4Z0O1PdHe8almVAR7Mc5Vv6t/wQTKYOoqjqLHAZu2tdI lzvmgCxQqbABfrWEejkFU3YXJH5cVA== X-Received: by 10.129.52.75 with SMTP id b72mr3848028ywa.271.1493839945922; Wed, 03 May 2017 12:32:25 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.129.20.214 with HTTP; Wed, 3 May 2017 12:32:25 -0700 (PDT) In-Reply-To: <8EA7A2E9-A429-4DC2-85CE-1B5AAEDF86FD@gmail.com> References: <201705031721.v43HL2vS071819@repo.freebsd.org> <8EA7A2E9-A429-4DC2-85CE-1B5AAEDF86FD@gmail.com> From: Alan Somers Date: Wed, 3 May 2017 13:32:25 -0600 X-Google-Sender-Auth: aLmtyeQ7ttA8CUdvaO7RfBQHPQk Message-ID: Subject: Re: svn commit: r317755 - head/sbin/ifconfig To: Ngie Cooper Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 19:32:27 -0000 On Wed, May 3, 2017 at 12:16 PM, Ngie Cooper wrote: > >> On May 3, 2017, at 10:21, Alan Somers wrote: >> >> Author: asomers >> Date: Wed May 3 17:21:01 2017 >> New Revision: 317755 >> URL: https://svnweb.freebsd.org/changeset/base/317755 >> >> Log: >> Various Coverity fixes in ifconfig(8) > > ... > >> * Mark usage() as _Noreturn (1305806, 1305750) > > ... > >> -static void usage(void); >> +static void usage(void) _Noreturn; > > Hi Alan, > Please use __dead2 instead to be consistent with legacy use of similar gcc attributes. > Thanks, > -Ngie Why not use _Noreturn? It's standardized by C11, so tools understand it better than __dead2. -Alan From owner-svn-src-head@freebsd.org Wed May 3 19:34:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7178ED58329 for ; Wed, 3 May 2017 19:34:27 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x231.google.com (mail-io0-x231.google.com [IPv6:2607:f8b0:4001:c06::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4192B14C2 for ; Wed, 3 May 2017 19:34:27 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x231.google.com with SMTP id r16so195898776ioi.2 for ; Wed, 03 May 2017 12:34:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=TFF594BjSX5ipCMoL+BCTMg98HdXZFviA1sY92gfW9k=; b=QhZCUIB8NmmK2Ge5VTZj/EiSHjYYHTXa0Kbf9FhEo7g4NHZxRGhyu/PDHsPpZB9pq/ ZIfbAidwDxtYWZUnnJ0pkZuPMCGXwFzY140bQdw98Jez+wQOW4ugMW5bV43LXQvg2Wno VytFXqQ5HIAOkr71JuivP1yt6Ct9b//5sJqo2J40l0ABxuVPb33kEJ7Qown+1euf2CQj zoUji98dkOKN/2NjnDxH05BoXcxA+gKZCjJMsj0+i9+yy4ywAhrpIW88OF2IFPa+Trbh 4vV2SmNu6lDPCqL3CaFt3roC+sSliCmpjArD70/syXjuOZkeCLMM20r4NRTItykSnvG9 x+NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=TFF594BjSX5ipCMoL+BCTMg98HdXZFviA1sY92gfW9k=; b=PL/nHpkp0L1YCEGQ+o0U1PCdmxv5ku+E4SmPS5FfhAXa6RXEF2J/tH6aV2kPrJJfAr xrVyfusePq1ciLihbUvMo2WqMP3+3UYY+FfRY048AOSuKNGL1oRjRSBYWjL4DkMWDuZ8 wy3hT3m+fBpwScjQOVEVrKQ28O3HqH6cX9JliJWLElDa5bCxwlJrWCdL25mzOXRRUktp axe4agMCgpzI17Tq2Cw7elbIX3p46H7c8NeVEZb19vFyRo4Elc751xghrttcnEmgQLos S7RYaHMVc0hgrxjFlpbYLav5h4AzbG6zLGtI3cPP24NVLVl9dqL5jqT509PH4PEFkAbb uCkQ== X-Gm-Message-State: AN3rC/47C63E+veJZB0hp2/iYcPRNmK491c0gouaRwDpBbFYuyFjY9ou e1EkvjWpyWxsThJrIkoeWOhTaOdYzg== X-Received: by 10.107.8.136 with SMTP id h8mr42151744ioi.134.1493840066324; Wed, 03 May 2017 12:34:26 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.126.6 with HTTP; Wed, 3 May 2017 12:34:25 -0700 (PDT) X-Originating-IP: [2607:fb10:7021:1::44a] In-Reply-To: References: <201705031721.v43HL2vS071819@repo.freebsd.org> <8EA7A2E9-A429-4DC2-85CE-1B5AAEDF86FD@gmail.com> From: Warner Losh Date: Wed, 3 May 2017 13:34:25 -0600 X-Google-Sender-Auth: JuQ9oSIEM3fYj4rYSyH_Fstiw7o Message-ID: Subject: Re: svn commit: r317755 - head/sbin/ifconfig To: Alan Somers Cc: Ngie Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 19:34:27 -0000 On Wed, May 3, 2017 at 1:32 PM, Alan Somers wrote: > On Wed, May 3, 2017 at 12:16 PM, Ngie Cooper wrote: >> >>> On May 3, 2017, at 10:21, Alan Somers wrote: >>> >>> Author: asomers >>> Date: Wed May 3 17:21:01 2017 >>> New Revision: 317755 >>> URL: https://svnweb.freebsd.org/changeset/base/317755 >>> >>> Log: >>> Various Coverity fixes in ifconfig(8) >> >> ... >> >>> * Mark usage() as _Noreturn (1305806, 1305750) >> >> ... >> >>> -static void usage(void); >>> +static void usage(void) _Noreturn; >> >> Hi Alan, >> Please use __dead2 instead to be consistent with legacy use of similar gcc attributes. >> Thanks, >> -Ngie > > Why not use _Noreturn? It's standardized by C11, so tools understand > it better than __dead2. Tools that can't understand #define __dead2 _Noreturn aren't worth supporting. Warner From owner-svn-src-head@freebsd.org Wed May 3 19:38:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C3F2D58491; Wed, 3 May 2017 19:38:41 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-yw0-x229.google.com (mail-yw0-x229.google.com [IPv6:2607:f8b0:4002:c05::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 265E5181C; Wed, 3 May 2017 19:38:41 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-yw0-x229.google.com with SMTP id 203so90354306ywe.0; Wed, 03 May 2017 12:38:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=0lmgdPs5X5Pdx6T89X27rCqmdL1D0AnOA+V5H5iz2ug=; b=p8Gb3wSFLr3GCeAlQG8D7DYIRqPH+I0RUBqQJwnz4P92EQhkMyExlUYDg+TuO5HKvZ ehK3jTL9IjXYU0crq9V4oMbT6+CWqa0FIP9QEjVIuB7YKCbPJnqw+6ycNbhJxCX6gqz4 TzipXKYX2R1G8YQ78bvCkpUR3u5Fv4MtJ5H0NvW1Jh3UoxsSLlY7q/+dxgjvPK9jUvSl mnGjPTFrudHAC9MDMHYo7ScWl2Yt8iro4JWJ/bfBPRg/+XCQGnBNGLB/bSOb6WoaZkJb kB2MX3ouk9m8WMg3Z4CcuF8fQ+YIlcZme3kDbbF7Q3MtC3vyDvWbCltofKGkvahr5Q43 2f/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=0lmgdPs5X5Pdx6T89X27rCqmdL1D0AnOA+V5H5iz2ug=; b=kl63MjM2rsGuClBrGcnFBa7Fe79SLjSbDUiCnnTkmvgU3QrlmNAQp2jaQ+stZwhKpd m/n++FEhoPodtDDOOKHTAqI1SbhqWXbBBDDMl8zgUF573sVHnNIOdrzsa8mn0WZfyBCk gSoofkrSldpmvNp5C5eQtj9+JniezwCwiw0G//3Vq4OgBE0a9ekcqjEFp2zerTGYf1Oi 5ksbyRPQ2WnUR/433uR2vWtXH/3FeWcrRsFFCDEDfUiS73/Z5Y1jDNG3wZzhDcxzrNP0 QBFwGzE4llsA2wgFDA/Y3cXZrac8D4RlbRb4oMYYWVQ0C2dYpahpjAJtgerSLW71OFtR UP+Q== X-Gm-Message-State: AN3rC/6JStEiVqe7bIP98ftlOe8gRKSmXQEraqvADJf8A4fFRxpJd8Nr mkQ0uvXQpXwdOAppkJcGteIj4s3c2g== X-Received: by 10.129.4.151 with SMTP id 145mr30509388ywe.222.1493840320241; Wed, 03 May 2017 12:38:40 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.129.20.214 with HTTP; Wed, 3 May 2017 12:38:39 -0700 (PDT) In-Reply-To: References: <201705031721.v43HL2vS071819@repo.freebsd.org> <8EA7A2E9-A429-4DC2-85CE-1B5AAEDF86FD@gmail.com> From: Alan Somers Date: Wed, 3 May 2017 13:38:39 -0600 X-Google-Sender-Auth: 5kPF3Ujp1rvIo_Qw6CFdSmieowE Message-ID: Subject: Re: svn commit: r317755 - head/sbin/ifconfig To: Warner Losh Cc: Ngie Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 19:38:41 -0000 On Wed, May 3, 2017 at 1:34 PM, Warner Losh wrote: > On Wed, May 3, 2017 at 1:32 PM, Alan Somers wrote: >> On Wed, May 3, 2017 at 12:16 PM, Ngie Cooper wrote: >>> >>>> On May 3, 2017, at 10:21, Alan Somers wrote: >>>> >>>> Author: asomers >>>> Date: Wed May 3 17:21:01 2017 >>>> New Revision: 317755 >>>> URL: https://svnweb.freebsd.org/changeset/base/317755 >>>> >>>> Log: >>>> Various Coverity fixes in ifconfig(8) >>> >>> ... >>> >>>> * Mark usage() as _Noreturn (1305806, 1305750) >>> >>> ... >>> >>>> -static void usage(void); >>>> +static void usage(void) _Noreturn; >>> >>> Hi Alan, >>> Please use __dead2 instead to be consistent with legacy use of similar gcc attributes. >>> Thanks, >>> -Ngie >> >> Why not use _Noreturn? It's standardized by C11, so tools understand >> it better than __dead2. > > Tools that can't understand #define __dead2 _Noreturn aren't worth supporting. > > Warner Some tools don't expand preprocessor macros. Like my editor, for example, which highlights _Noreturn as a keyword but not __dead2. -Alan From owner-svn-src-head@freebsd.org Wed May 3 19:48:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6588DD5871E; Wed, 3 May 2017 19:48:55 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id 4C7A61DA6; Wed, 3 May 2017 19:48:55 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 597455646C; Wed, 3 May 2017 14:48:54 -0500 (CDT) Subject: Re: svn commit: r317755 - head/sbin/ifconfig To: Alan Somers , Warner Losh Cc: Ngie Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" References: <201705031721.v43HL2vS071819@repo.freebsd.org> <8EA7A2E9-A429-4DC2-85CE-1B5AAEDF86FD@gmail.com> From: Eric van Gyzen Message-ID: Date: Wed, 3 May 2017 14:48:51 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 19:48:55 -0000 On 05/03/2017 14:38, Alan Somers wrote: > On Wed, May 3, 2017 at 1:34 PM, Warner Losh wrote: >> On Wed, May 3, 2017 at 1:32 PM, Alan Somers wrote: >>> On Wed, May 3, 2017 at 12:16 PM, Ngie Cooper wrote: >>>> >>>>> On May 3, 2017, at 10:21, Alan Somers wrote: >>>>> >>>>> Author: asomers >>>>> Date: Wed May 3 17:21:01 2017 >>>>> New Revision: 317755 >>>>> URL: https://svnweb.freebsd.org/changeset/base/317755 >>>>> >>>>> Log: >>>>> Various Coverity fixes in ifconfig(8) >>>> >>>> ... >>>> >>>>> * Mark usage() as _Noreturn (1305806, 1305750) >>>> >>>> ... >>>> >>>>> -static void usage(void); >>>>> +static void usage(void) _Noreturn; >>>> >>>> Hi Alan, >>>> Please use __dead2 instead to be consistent with legacy use of similar gcc attributes. >>>> Thanks, >>>> -Ngie >>> >>> Why not use _Noreturn? It's standardized by C11, so tools understand >>> it better than __dead2. >> >> Tools that can't understand #define __dead2 _Noreturn aren't worth supporting. >> >> Warner > > Some tools don't expand preprocessor macros. Like my editor, for > example, which highlights _Noreturn as a keyword but not __dead2. Please use _Noreturn, because it's standard. sys/cdefs.h already defines it appropriately for C < C11. Eric From owner-svn-src-head@freebsd.org Wed May 3 19:53:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74E9FD58A6F; Wed, 3 May 2017 19:53:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46DD8279; Wed, 3 May 2017 19:53:02 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43Jr1Rm035870; Wed, 3 May 2017 19:53:01 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43Jr1SM035869; Wed, 3 May 2017 19:53:01 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201705031953.v43Jr1SM035869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 3 May 2017 19:53:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317758 - head/sbin/ifconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 19:53:02 -0000 Author: asomers Date: Wed May 3 19:53:01 2017 New Revision: 317758 URL: https://svnweb.freebsd.org/changeset/base/317758 Log: Unbreak ifconfig for mlx4en(4) after r317755 ifconfig doesn't correctly infer mlx interfaces' module names, so it will attempt to load the mlx(4) module even when not necessary. Reported by: rstone MFC after: 3 weeks X-MFC-With: 317755 Sponsored by: Spectra Logic Corp Modified: head/sbin/ifconfig/ifconfig.c Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Wed May 3 18:46:33 2017 (r317757) +++ head/sbin/ifconfig/ifconfig.c Wed May 3 19:53:01 2017 (r317758) @@ -1374,9 +1374,11 @@ ifmaybeload(const char *name) } } - /* not present, we should try to load it */ - if (kldload(ifkind) < 0) - err(1, "kldload(%s)", ifkind); + /* + * Try to load the module. But ignore failures, because ifconfig can't + * infer the names of all drivers (eg mlx4en(4)). + */ + (void) kldload(ifkind); } static struct cmd basic_cmds[] = { From owner-svn-src-head@freebsd.org Wed May 3 19:56:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24239D58CC8; Wed, 3 May 2017 19:56:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D09FE75B; Wed, 3 May 2017 19:56:56 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43JutvP036064; Wed, 3 May 2017 19:56:55 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43JutGn036063; Wed, 3 May 2017 19:56:55 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201705031956.v43JutGn036063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 3 May 2017 19:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317759 - head/sbin/camcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 19:56:57 -0000 Author: asomers Date: Wed May 3 19:56:55 2017 New Revision: 317759 URL: https://svnweb.freebsd.org/changeset/base/317759 Log: Fix memory leaks in camcontrol Reported by: Coverity CID: 1331674, 1331675 Reviewed by: ken MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D10588 Modified: head/sbin/camcontrol/fwdownload.c Modified: head/sbin/camcontrol/fwdownload.c ============================================================================== --- head/sbin/camcontrol/fwdownload.c Wed May 3 19:53:01 2017 (r317758) +++ head/sbin/camcontrol/fwdownload.c Wed May 3 19:56:55 2017 (r317759) @@ -550,8 +550,7 @@ fw_validate_ibm(struct cam_device *dev, fprintf(stdout, "Firmware file is valid for this drive.\n"); retval = 0; bailout: - if (ccb != NULL) - cam_freeccb(ccb); + cam_freeccb(ccb); return (retval); } @@ -753,8 +752,8 @@ fw_check_device_ready(struct cam_device goto bailout; } bailout: - if (ccb != NULL) - cam_freeccb(ccb); + free(ptr); + cam_freeccb(ccb); return (retval); } @@ -913,8 +912,7 @@ fw_download_img(struct cam_device *cam_d bailout: if (quiet == 0) progress_complete(&progress, size - img_size); - if (ccb != NULL) - cam_freeccb(ccb); + cam_freeccb(ccb); return (retval); } @@ -923,6 +921,7 @@ fwdownload(struct cam_device *device, in char *combinedopt, int printerrors, int task_attr, int retry_count, int timeout) { + union ccb *ccb = NULL; struct fw_vendor *vp; char *fw_img_path = NULL; struct ata_params *ident_buf = NULL; @@ -965,8 +964,6 @@ fwdownload(struct cam_device *device, in if ((devtype == CC_DT_ATA) || (devtype == CC_DT_ATA_BEHIND_SCSI)) { - union ccb *ccb; - ccb = cam_getccb(device); if (ccb == NULL) { warnx("couldn't allocate CCB"); @@ -976,7 +973,6 @@ fwdownload(struct cam_device *device, in if (ata_do_identify(device, retry_count, timeout, ccb, &ident_buf) != 0) { - cam_freeccb(ccb); retval = 1; goto bailout; } @@ -1048,6 +1044,7 @@ fwdownload(struct cam_device *device, in fprintf(stdout, "Firmware download successful\n"); bailout: + cam_freeccb(ccb); free(buf); return (retval); } From owner-svn-src-head@freebsd.org Wed May 3 20:31:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2D42D5CBAD for ; Wed, 3 May 2017 20:31:46 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A8634EBD for ; Wed, 3 May 2017 20:31:46 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x233.google.com with SMTP id e65so772579ita.1 for ; Wed, 03 May 2017 13:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=pmcEeKj1c4PRTXGiXe3qEaGINRBM29e6qdkc8TZME7E=; b=pdlfm/oagej9rjQryQkJqffmzpS6PktFsNXx+q2Z62yIwaByXT5WOuyaC59cZCg6Tg raBi+Tw8JY342t+jX6QMcTXonaQgYXsqx/sl0QCeeWsKh1HaIjogP4jXFtwekIdatPvD fKgd4zAVoIncedzB/mAtbQjutXMvDlF3QIOhMrQ0aNBWWD3/eWQYqzrfc1d0v3rzKjoi YW/ymLbebQXJVbmRUWtR2mr2WaJ63axvCuS3wffXc7Fpzawb+xmTF+375PRt7UX2wLG9 /GYgbdLSc5RdCqOyODNGHMZSi8ZafuKrkl5AeXTcTKnIGmvSGHi5729PG616hGSp3MgQ DW8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=pmcEeKj1c4PRTXGiXe3qEaGINRBM29e6qdkc8TZME7E=; b=HAdkxUMlCa8C0thIAvkEFEB0EkVUidb+y/2jiZpIoeLgh63DzyelSHOjfynEf5AaOk mz90Vhkn5vzLabBY3FmDOLQfdRPlFfq/0HdAgo/BaSpjKo60lWlKzLZR2k+I3tGlyw8M KB0ZNAeqaAcFv/E/3Gc2shUxDkdNfaUkIcSlUJVPy3S438UXX7/58NRgNZ0xfO309P85 q2KVV1Y8rtk7TZt0LlEmu6K8zj84kUjeSpB9PXG2ykTBysxjpBCJPrjcxw0Y099bRDz9 DTZ+AzoTpVt5rJSmbzhEDqaj4tHb1RPRux2mfg1D17WL1tfUNfpTtTuHERPukYTL3Xn6 NtkA== X-Gm-Message-State: AN3rC/7LcuFfPY1gZ+15RRzulGtajrYhyIHI7cfJPO8xYarZZRiEILEc TCIrtw5gKKhMGu3/nfKdo/fSlIlG9w== X-Received: by 10.36.181.1 with SMTP id v1mr10744143ite.103.1493843505726; Wed, 03 May 2017 13:31:45 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.126.6 with HTTP; Wed, 3 May 2017 13:31:45 -0700 (PDT) X-Originating-IP: [2607:fb10:7021:1::44a] In-Reply-To: References: <201705031721.v43HL2vS071819@repo.freebsd.org> <8EA7A2E9-A429-4DC2-85CE-1B5AAEDF86FD@gmail.com> From: Warner Losh Date: Wed, 3 May 2017 14:31:45 -0600 X-Google-Sender-Auth: AoYcJAWAzhBmDpbODgfisK1Mi0I Message-ID: Subject: Re: svn commit: r317755 - head/sbin/ifconfig To: Alan Somers Cc: Ngie Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 20:31:47 -0000 On Wed, May 3, 2017 at 1:38 PM, Alan Somers wrote: > On Wed, May 3, 2017 at 1:34 PM, Warner Losh wrote: >> On Wed, May 3, 2017 at 1:32 PM, Alan Somers wrote: >>> On Wed, May 3, 2017 at 12:16 PM, Ngie Cooper wrote: >>>> >>>>> On May 3, 2017, at 10:21, Alan Somers wrote: >>>>> >>>>> Author: asomers >>>>> Date: Wed May 3 17:21:01 2017 >>>>> New Revision: 317755 >>>>> URL: https://svnweb.freebsd.org/changeset/base/317755 >>>>> >>>>> Log: >>>>> Various Coverity fixes in ifconfig(8) >>>> >>>> ... >>>> >>>>> * Mark usage() as _Noreturn (1305806, 1305750) >>>> >>>> ... >>>> >>>>> -static void usage(void); >>>>> +static void usage(void) _Noreturn; >>>> >>>> Hi Alan, >>>> Please use __dead2 instead to be consistent with legacy use of similar gcc attributes. >>>> Thanks, >>>> -Ngie >>> >>> Why not use _Noreturn? It's standardized by C11, so tools understand >>> it better than __dead2. >> >> Tools that can't understand #define __dead2 _Noreturn aren't worth supporting. >> >> Warner > > Some tools don't expand preprocessor macros. Like my editor, for > example, which highlights _Noreturn as a keyword but not __dead2. "My editor is lame" isn't a good reason. However, % grep _Noreturn /usr/include/sys/cdefs.h #define _Noreturn __dead2 "Because it works, does the right thing and is standardized" is a much better reason. I hadn't checked to make sure that this was the case, but since it is, I think you did the right thing. Warner From owner-svn-src-head@freebsd.org Wed May 3 20:41:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DB4DD5CFEC; Wed, 3 May 2017 20:41:28 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E1B28F3; Wed, 3 May 2017 20:41:28 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43KfRet055708; Wed, 3 May 2017 20:41:27 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43KfR5q055707; Wed, 3 May 2017 20:41:27 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201705032041.v43KfR5q055707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Wed, 3 May 2017 20:41:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317771 - head/usr.sbin/pkg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 20:41:28 -0000 Author: phk Date: Wed May 3 20:41:26 2017 New Revision: 317771 URL: https://svnweb.freebsd.org/changeset/base/317771 Log: Flush stdout before yes/no confirmations, to force question through pipes/tee(1)/whatever Modified: head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Wed May 3 20:26:59 2017 (r317770) +++ head/usr.sbin/pkg/pkg.c Wed May 3 20:41:26 2017 (r317771) @@ -946,6 +946,7 @@ pkg_query_yes_no(void) { int ret, c; + fflush(stdout); c = getchar(); if (c == 'y' || c == 'Y') From owner-svn-src-head@freebsd.org Wed May 3 20:51:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DF5ED5C5C4; Wed, 3 May 2017 20:51:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 2237889F; Wed, 3 May 2017 20:51:32 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 859B31A5727; Thu, 4 May 2017 06:51:23 +1000 (AEST) Date: Thu, 4 May 2017 06:51:20 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Eric van Gyzen cc: Alan Somers , Warner Losh , Ngie Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317755 - head/sbin/ifconfig In-Reply-To: Message-ID: <20170504062448.U1383@besplex.bde.org> References: <201705031721.v43HL2vS071819@repo.freebsd.org> <8EA7A2E9-A429-4DC2-85CE-1B5AAEDF86FD@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=AYLBJzfG c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=7Qk2ozbKAAAA:8 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8 a=I-FlVkIS5AL8CeXa67wA:9 a=CjuIK1q_8ugA:10 a=1lyxoWkJIXJV6VJUPhuM:22 a=IjZwj45LgO3ly-622nXo:22 a=6kGIvZw6iX1k4Y-7sg4_:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 20:51:33 -0000 On Wed, 3 May 2017, Eric van Gyzen wrote: > On 05/03/2017 14:38, Alan Somers wrote: >> On Wed, May 3, 2017 at 1:34 PM, Warner Losh wrote: >>> On Wed, May 3, 2017 at 1:32 PM, Alan Somers wrote: >>>> On Wed, May 3, 2017 at 12:16 PM, Ngie Cooper wrote: >>>>> >>>>>> On May 3, 2017, at 10:21, Alan Somers wrote: >>>>>> >>>>>> Author: asomers >>>>>> Date: Wed May 3 17:21:01 2017 >>>>>> New Revision: 317755 >>>>>> URL: https://svnweb.freebsd.org/changeset/base/317755 >>>>>> >>>>>> Log: >>>>>> Various Coverity fixes in ifconfig(8) >>>>> >>>>> ... >>>>> >>>>>> * Mark usage() as _Noreturn (1305806, 1305750) >>>>> >>>>> ... >>>>> >>>>>> -static void usage(void); >>>>>> +static void usage(void) _Noreturn; >>>>> >>>>> Hi Alan, >>>>> Please use __dead2 instead to be consistent with legacy use of similar gcc attributes. >>>>> Thanks, >>>>> -Ngie >>>> >>>> Why not use _Noreturn? It's standardized by C11, so tools understand >>>> it better than __dead2. >>> >>> Tools that can't understand #define __dead2 _Noreturn aren't worth supporting. >> Some tools don't expand preprocessor macros. Like my editor, for >> example, which highlights _Noreturn as a keyword but not __dead2. > > Please use _Noreturn, because it's standard. sys/cdefs.h already > defines it appropriately for C < C11. _Noreturn is far too hard to use. The above use of it is a syntax error: pts/12:bde@freefall:~/u3> cat z.c void foo(void) _Noreturn; _Noreturn void foo(void); pts/12:bde@freefall:~/u3> cc -std=c11 z.c z.c:1:16: error: '_Noreturn' keyword must precede function declarator void foo(void) _Noreturn; ^~~~~~~~~ _Noreturn 1 error generated. sys/cdefs.h defines might define it appropropriately for C < C11, but it defines it as __dead2 for all C, so prevents the C11 _Noreturn keyword being used. This normally breaks detection of the syntax error. Normally is included first, so you __dead2 obfuscated by spelling it _Noreturn instead of C11 _Noreturn. Defining _Noreturn as __dead2 is wrong because it gives the opposite syntax error. __dead2 can now be placed anywhere, but everything in sys/cdefs.h is supposed to be portable back to gcc-1. __dead2 must be placed after the function for gcc-2.0, since __attribute__(()) had more restrictions then. So if you write: #include _Noreturn void foo(void); to satisfy the C11 syntax, then you get a syntax error for old gcc (> 1). This is just the start of the complications for soft-coded C11'isms. C11 also has noreturn. You have to include to get that. But you actiually get the _Noreturn macro which expands to __dead2. There are further complications for C++11. sys/cdefs.h does have a correct-looking ifdef for C+11. This gives the [[noreturn]] keyward instead of __dead2. C11 doesn't have . I think its keyword must be spelled [[noreturn]]. This spelling is completely incompatibly with C. Bruce From owner-svn-src-head@freebsd.org Wed May 3 20:56:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4BAAD5C7CB; Wed, 3 May 2017 20:56:35 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 952811005; Wed, 3 May 2017 20:56:35 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43KuYBr061978; Wed, 3 May 2017 20:56:34 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43KuYPC061977; Wed, 3 May 2017 20:56:34 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201705032056.v43KuYPC061977@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Wed, 3 May 2017 20:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317772 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 20:56:35 -0000 Author: wulf Date: Wed May 3 20:56:34 2017 New Revision: 317772 URL: https://svnweb.freebsd.org/changeset/base/317772 Log: Add myself (wulf) as a src committer with gonzo and bapt as my mentors. Approved by: gonzo (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Wed May 3 20:41:26 2017 (r317771) +++ head/share/misc/committers-src.dot Wed May 3 20:56:34 2017 (r317772) @@ -334,6 +334,7 @@ wkoszek [label="Wojciech A. Koszek\nwkos wma [label="Wojciech Macek\nwma@FreeBSD.org\n2016/01/18"] wollman [label="Garrett Wollman\nwollman@FreeBSD.org\n????/??/??"] wsalamon [label="Wayne Salamon\nwsalamon@FreeBSD.org\n2005/06/25"] +wulf [label="Vladimir Kondratyev\nwulf@FreeBSD.org\n2017/04/27"] yongari [label="Pyun YongHyeon\nyongari@FreeBSD.org\n2004/08/01"] zbb [label="Zbigniew Bodek\nzbb@FreeBSD.org\n2013/09/02"] zec [label="Marko Zec\nzec@FreeBSD.org\n2008/06/22"] @@ -385,6 +386,7 @@ avg -> smh bapt -> allanjude bapt -> araujo bapt -> bdrewery +bapt -> wulf benno -> grehan @@ -496,6 +498,7 @@ gnn -> jtl gnn -> karels gonzo -> jmcneill +gonzo -> wulf grehan -> bryanv grehan -> rgrimes From owner-svn-src-head@freebsd.org Wed May 3 20:56:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1DA0D5C82F; Wed, 3 May 2017 20:56:55 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FADB11FC; Wed, 3 May 2017 20:56:55 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43Kushc062032; Wed, 3 May 2017 20:56:54 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43Kusd4062031; Wed, 3 May 2017 20:56:54 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201705032056.v43Kusd4062031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 3 May 2017 20:56:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317773 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 20:56:55 -0000 Author: kp Date: Wed May 3 20:56:54 2017 New Revision: 317773 URL: https://svnweb.freebsd.org/changeset/base/317773 Log: pf: Fix panic on unload vnet_pf_uninit() is called through vnet_deregister_sysuninit() and linker_file_unload() when the pf module is unloaded. This is executed after pf_unload() so we end up trying to take locks which have been destroyed already. Move pf_unload() to a separate SYSUNINIT() to ensure it's called after all the vnet_pf_uninit() calls. Differential Revision: https://reviews.freebsd.org/D10025 Modified: head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- head/sys/netpfil/pf/pf_ioctl.c Wed May 3 20:56:34 2017 (r317772) +++ head/sys/netpfil/pf/pf_ioctl.c Wed May 3 20:56:54 2017 (r317773) @@ -178,7 +178,7 @@ static int hook_pf(void); static int dehook_pf(void); static int shutdown_pf(void); static int pf_load(void); -static int pf_unload(void); +static void pf_unload(void); static struct cdevsw pf_cdevsw = { .d_ioctl = pfioctl, @@ -3789,10 +3789,9 @@ pf_unload_vnet(void) pf_mtag_cleanup(); } -static int +static void pf_unload(void) { - int error = 0; sx_xlock(&pf_end_lock); pf_end_threads = 1; @@ -3810,8 +3809,6 @@ pf_unload(void) rw_destroy(&pf_rules_lock); sx_destroy(&pf_ioctl_lock); sx_destroy(&pf_end_lock); - - return (error); } static void @@ -3829,6 +3826,7 @@ vnet_pf_uninit(const void *unused __unus pf_unload_vnet(); } +SYSUNINIT(pf_unload, SI_SUB_PROTO_FIREWALL, SI_ORDER_SECOND, pf_unload, NULL); VNET_SYSUNINIT(vnet_pf_uninit, SI_SUB_PROTO_FIREWALL, SI_ORDER_THIRD, vnet_pf_uninit, NULL); @@ -3849,7 +3847,8 @@ pf_modevent(module_t mod, int type, void error = EBUSY; break; case MOD_UNLOAD: - error = pf_unload(); + /* Handled in SYSUNINIT(pf_unload) to ensure it's done after + * the vnet_pf_uninit()s */ break; default: error = EINVAL; From owner-svn-src-head@freebsd.org Wed May 3 20:57:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4A5FD5C8C1; Wed, 3 May 2017 20:57:53 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C15C71458; Wed, 3 May 2017 20:57:53 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43KvqWC062135; Wed, 3 May 2017 20:57:52 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43Kvq7c062133; Wed, 3 May 2017 20:57:52 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705032057.v43Kvq7c062133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 3 May 2017 20:57:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317774 - head/sbin/camcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 20:57:54 -0000 Author: ken Date: Wed May 3 20:57:52 2017 New Revision: 317774 URL: https://svnweb.freebsd.org/changeset/base/317774 Log: Add the ability to rescan or reset devices specified by peripheral name and unit number in camcontrol(8). Previously camcontrol(8) only supported rescanning or resetting devices specified by bus:target:lun. This is because for rescanning at least, you don't have a peripheral name and unit number (e.g. da4) for devices that don't exist yet. That is still the case after this change, but in other cases, when the device does exist in the CAM EDT (Existing Device Table), we do a careful lookup of the bus/target/lun if the user supplies a peripheral name and unit number to find the bus:target:lun and then issue the requested reset or rescan. The lookup is done without actually opening the device in question, since a rescan is often done to make a device go away after it has been pulled. (This is especially true for busses/controllers, like parallel SCSI controllers, that don't automatically detect changes in topology.) Opening a device that is no longer there to determine the bus/target/lun might result in error recovery actions when the user really just wanted to make the device go away. sbin/camcontrol/camcontrol.c: In dorescan_or_reset(), if the use hasn't specified a numeric argument, assume he has specified a device. Lookup the pass(4) instance for that device using the transport layer CAMGETPASSTHRU ioctl. If that is successful, we can use the returned bus:target:lun to rescan or reset the device. Under the hood, resetting a device using XPT_RESET_DEV is actually sent via the pass(4) device anyway. But this provides a way for the user to specify devices in a more convenient way, and can work on device rescans when the device is going away, assuming it still exists in the EDT. sbin/camcontrol/camcontrol.8: Update the man page for the rescan and reset subcommands to reflect that you can now use a device name and unit number with them. Sponsored by: Spectra Logic MFC after: 3 days Modified: head/sbin/camcontrol/camcontrol.8 head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.8 ============================================================================== --- head/sbin/camcontrol/camcontrol.8 Wed May 3 20:56:54 2017 (r317773) +++ head/sbin/camcontrol/camcontrol.8 Wed May 3 20:57:52 2017 (r317774) @@ -102,10 +102,10 @@ .Op device id .Nm .Ic rescan -.Aq all | bus Ns Op :target:lun +.Aq all | device id | bus Ns Op :target:lun .Nm .Ic reset -.Aq all | bus Ns Op :target:lun +.Aq all | device id | bus Ns Op :target:lun .Nm .Ic defects .Op device id @@ -578,12 +578,20 @@ start bit cleared and the load/eject bit .It Ic rescan Tell the kernel to scan all buses in the system (with the .Ar all -argument), the given bus (XPT_SCAN_BUS), or bus:target:lun +argument), the given bus (XPT_SCAN_BUS), bus:target:lun or device (XPT_SCAN_LUN) for new devices or devices that have gone away. The user may specify a scan of all buses, a single bus, or a lun. Scanning all luns on a target is not supported. +.Pp +If a device is specified by peripheral name and unit number, for instance +da4, it may only be rescanned if that device currently exists in the CAM EDT +(Existing Device Table). +If the device is no longer there (see +.Nm +devlist ), +you must use the bus:target:lun form to rescan it. .It Ic reprobe Tell the kernel to refresh the information about the device and notify the upper layer, @@ -593,8 +601,8 @@ the disk size visible to the rest of the .It Ic reset Tell the kernel to reset all buses in the system (with the .Ar all -argument) or the given bus (XPT_RESET_BUS) by issuing a SCSI bus -reset for that bus, or to reset the given bus:target:lun +argument), the given bus (XPT_RESET_BUS) by issuing a SCSI bus +reset for that bus, or to reset the given bus:target:lun or device (XPT_RESET_DEV), typically by issuing a BUS DEVICE RESET message after connecting to that device. Note that this can have a destructive impact Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Wed May 3 20:56:54 2017 (r317773) +++ head/sbin/camcontrol/camcontrol.c Wed May 3 20:57:52 2017 (r317774) @@ -3131,12 +3131,107 @@ dorescan_or_reset(int argc, char **argv, tstr++; if (strncasecmp(tstr, "all", strlen("all")) == 0) arglist |= CAM_ARG_BUS; - else { + else if (isdigit(*tstr)) { rv = parse_btl(argv[optind], &bus, &target, &lun, &arglist); if (rv != 1 && rv != 3) { warnx(must, rescan? "rescan" : "reset"); return(1); } + } else { + char name[30]; + int unit; + int fd = -1; + union ccb ccb; + + /* + * Note that resetting or rescanning a device used to + * require a bus or bus:target:lun. This is because the + * device in question may not exist and you're trying to + * get the controller to rescan to find it. It may also be + * because the device is hung / unresponsive, and opening + * an unresponsive device is not desireable. + * + * It can be more convenient to reference a device by + * peripheral name and unit number, though, and it is + * possible to get the bus:target:lun for devices that + * currently exist in the EDT. So this can work for + * devices that we want to reset, or devices that exist + * that we want to rescan, but not devices that do not + * exist yet. + * + * So, we are careful here to look up the bus/target/lun + * for the device the user wants to operate on, specified + * by peripheral instance (e.g. da0, pass32) without + * actually opening that device. The process is similar to + * what cam_lookup_pass() does, except that we don't + * actually open the passthrough driver instance in the end. + */ + + if (cam_get_device(tstr, name, sizeof(name), &unit) == -1) { + warnx("%s", cam_errbuf); + error = 1; + goto bailout; + } + + if ((fd = open(XPT_DEVICE, O_RDWR)) == -1) { + warn("Unable to open %s", XPT_DEVICE); + error = 1; + goto bailout; + } + + bzero(&ccb, sizeof(ccb)); + + /* + * The function code isn't strictly necessary for the + * GETPASSTHRU ioctl. + */ + ccb.ccb_h.func_code = XPT_GDEVLIST; + + /* + * These two are necessary for the GETPASSTHRU ioctl to + * work. + */ + strlcpy(ccb.cgdl.periph_name, name, + sizeof(ccb.cgdl.periph_name)); + ccb.cgdl.unit_number = unit; + + /* + * Attempt to get the passthrough device. This ioctl will + * fail if the device name is null, if the device doesn't + * exist, or if the passthrough driver isn't in the kernel. + */ + if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) { + warn("Unable to find bus:target:lun for device %s%d", + name, unit); + error = 1; + close(fd); + goto bailout; + } + if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + const struct cam_status_entry *entry; + + entry = cam_fetch_status_entry(ccb.ccb_h.status); + warnx("Unable to find bus:target_lun for device %s%d, " + "CAM status: %s (%#x)", name, unit, + entry ? entry->status_text : "Unknown", + ccb.ccb_h.status); + error = 1; + close(fd); + goto bailout; + } + + /* + * The kernel fills in the bus/target/lun. We don't + * need the passthrough device name and unit number since + * we aren't going to open it. + */ + bus = ccb.ccb_h.path_id; + target = ccb.ccb_h.target_id; + lun = ccb.ccb_h.target_lun; + + arglist |= CAM_ARG_BUS | CAM_ARG_TARGET | CAM_ARG_LUN; + + close(fd); } if ((arglist & CAM_ARG_BUS) @@ -3146,6 +3241,8 @@ dorescan_or_reset(int argc, char **argv, else error = rescan_or_reset_bus(bus, rescan); +bailout: + return(error); } @@ -8916,8 +9013,8 @@ usage(int printlong) " camcontrol eject [dev_id][generic args]\n" " camcontrol reprobe [dev_id][generic args]\n" #endif /* MINIMALISTIC */ -" camcontrol rescan \n" -" camcontrol reset \n" +" camcontrol rescan \n" +" camcontrol reset \n" #ifndef MINIMALISTIC " camcontrol defects [dev_id][generic args] <-f format> [-P][-G]\n" " [-q][-s][-S offset][-X]\n" @@ -8996,8 +9093,8 @@ usage(int printlong) "load send a Start Unit command to the device with the load bit set\n" "eject send a Stop Unit command to the device with the eject bit set\n" "reprobe update capacity information of the given device\n" -"rescan rescan all buses, the given bus, or bus:target:lun\n" -"reset reset all buses, the given bus, or bus:target:lun\n" +"rescan rescan all buses, the given bus, bus:target:lun or device\n" +"reset reset all buses, the given bus, bus:target:lun or device\n" "defects read the defect list of the specified device\n" "modepage display or edit (-e) the given mode page\n" "cmd send the given SCSI command, may need -i or -o as well\n" From owner-svn-src-head@freebsd.org Wed May 3 20:59:48 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85E25D5C97E; Wed, 3 May 2017 20:59:48 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 606F31676; Wed, 3 May 2017 20:59:48 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43KxlBN062252; Wed, 3 May 2017 20:59:47 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43KxldV062250; Wed, 3 May 2017 20:59:47 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705032059.v43KxldV062250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 3 May 2017 20:59:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317775 - in head: share/man/man4 sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 20:59:48 -0000 Author: ken Date: Wed May 3 20:59:47 2017 New Revision: 317775 URL: https://svnweb.freebsd.org/changeset/base/317775 Log: Fix error recovery behavior in the pass(4) driver. After FreeBSD SVN revision 236814, the pass(4) driver changed from only doing error recovery when the CAM_PASS_ERR_RECOVER flag was set on a CCB to sometimes doing error recovery if the passed in retry count was non-zero. Error recovery would happen if two conditions were met: 1. The error recovery action was simply a retry. (Which is most cases.) 2. The retry_count is non-zero. (Which happened a lot because of cut-and-pasted code.) This explains a bug I noticed in with camcontrol: # camcontrol tur da34 -v Unit is ready # camcontrol reset da34 Reset of 1:172:0 was successful At this point, there should be a Unit Attention: # camcontrol tur da34 -v Unit is ready No Unit Attention. Try it again: # camcontrol reset da34 Reset of 1:172:0 was successful Now set the retry_count to 0 for the TUR: # camcontrol tur da34 -v -C 0 Unit is not ready (pass42:mps1:0:172:0): TEST UNIT READY. CDB: 00 00 00 00 00 00 (pass42:mps1:0:172:0): CAM status: SCSI Status Error (pass42:mps1:0:172:0): SCSI status: Check Condition (pass42:mps1:0:172:0): SCSI sense: UNIT ATTENTION asc:29,2 (SCSI bus reset occurred) (pass42:mps1:0:172:0): Field Replaceable Unit: 2 There is the unit attention. camcontrol(8) has a default retry_count of 1, in case someone sets the -E flag without setting -C. The CAM_PASS_ERR_RECOVER behavior was only broken with the CAMIOCOMMAND ioctl, which is the synchronous pass(4) API. It has worked as intended (error recovery is only done when the flag is set) in the asynchronous API (CAMIOQUEUE ioctl). sys/cam/scsi/scsi_pass.c: In passsendccb(), when calling cam_periph_runccb(), only specify the error routine when CAM_PASS_ERR_RECOVER is set. share/man/man4/pass.4: Document that CAM_PASS_ERR_RECOVER is needed to enable error recovery. Reported by: Terry Kennedy PR: kern/218572 MFC after: 1 week Sponsored by: Spectra Logic Modified: head/share/man/man4/pass.4 head/sys/cam/scsi/scsi_pass.c Modified: head/share/man/man4/pass.4 ============================================================================== --- head/share/man/man4/pass.4 Wed May 3 20:57:52 2017 (r317774) +++ head/share/man/man4/pass.4 Wed May 3 20:59:47 2017 (r317775) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 17, 2015 +.Dd May 3, 2017 .Dt PASS 4 .Os .Sh NAME @@ -85,6 +85,11 @@ Some examples of xpt-only CCBs are XPT_S XPT_DEV_MATCH, XPT_RESET_BUS, XPT_SCAN_LUN, XPT_ENG_INQ, and XPT_ENG_EXEC. These CCB types have various attributes that make it illogical or impossible to service them through the passthrough interface. +.Pp +If the user would like the kernel to do error recovery, the +.Dv CAM_PASS_ERR_RECOVER +flag must be set on the CCB, and the retry_count field set to the number +of retries. .It CAMGETPASSTHRU union ccb * This ioctl takes an XPT_GDEVLIST CCB, and returns the passthrough device corresponding to the device in question. @@ -160,6 +165,11 @@ available for userland use with the and .Dv CAMIOGET ioctls and will be preserved across calls. +.Pp +If the user would like the kernel to do error recovery, the +.Dv CAM_PASS_ERR_RECOVER +flag must be set on the CCB, and the retry_count field set to the number +of retries. .It CAMIOGET union ccb * Retrieve completed CAM CCBs queued via the .Dv CAMIOQUEUE Modified: head/sys/cam/scsi/scsi_pass.c ============================================================================== --- head/sys/cam/scsi/scsi_pass.c Wed May 3 20:57:52 2017 (r317774) +++ head/sys/cam/scsi/scsi_pass.c Wed May 3 20:59:47 2017 (r317775) @@ -2229,9 +2229,9 @@ passsendccb(struct cam_periph *periph, u * that request. Otherwise, it's up to the user to perform any * error recovery. */ - cam_periph_runccb(ccb, passerror, /* cam_flags */ CAM_RETRY_SELTO, - /* sense_flags */ ((ccb->ccb_h.flags & CAM_PASS_ERR_RECOVER) ? - SF_RETRY_UA : SF_NO_RECOVERY) | SF_NO_PRINT, + cam_periph_runccb(ccb, (ccb->ccb_h.flags & CAM_PASS_ERR_RECOVER) ? + passerror : NULL, /* cam_flags */ CAM_RETRY_SELTO, + /* sense_flags */ SF_RETRY_UA | SF_NO_PRINT, softc->device_stats); cam_periph_unmapmem(ccb, &mapinfo); From owner-svn-src-head@freebsd.org Wed May 3 21:04:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85BA9D5CC70; Wed, 3 May 2017 21:04:33 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57EB11CA9; Wed, 3 May 2017 21:04:33 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43L4Wkv066650; Wed, 3 May 2017 21:04:32 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43L4Wht066649; Wed, 3 May 2017 21:04:32 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705032104.v43L4Wht066649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Wed, 3 May 2017 21:04:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317776 - head/sbin/camcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 21:04:33 -0000 Author: ken Date: Wed May 3 21:04:32 2017 New Revision: 317776 URL: https://svnweb.freebsd.org/changeset/base/317776 Log: Bump the camcontrol(8) man page date. MFC after: 3 days X-MFC-with: r317774 Sponsored by: Spectra Logic Modified: head/sbin/camcontrol/camcontrol.8 Modified: head/sbin/camcontrol/camcontrol.8 ============================================================================== --- head/sbin/camcontrol/camcontrol.8 Wed May 3 20:59:47 2017 (r317775) +++ head/sbin/camcontrol/camcontrol.8 Wed May 3 21:04:32 2017 (r317776) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 1, 2017 +.Dd May 3, 2017 .Dt CAMCONTROL 8 .Os .Sh NAME From owner-svn-src-head@freebsd.org Wed May 3 21:05:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 117D3D5CCF3; Wed, 3 May 2017 21:05:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFCF71E20; Wed, 3 May 2017 21:05:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 95B7B10A82D; Wed, 3 May 2017 17:05:14 -0400 (EDT) From: John Baldwin To: Ian Lepore Cc: Ryan Stone , Alan Somers , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317755 - head/sbin/ifconfig Date: Wed, 03 May 2017 14:00:33 -0700 Message-ID: <2536795.sxmMB4gFZB@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <1493838199.80042.14.camel@freebsd.org> References: <201705031721.v43HL2vS071819@repo.freebsd.org> <1493838199.80042.14.camel@freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 03 May 2017 17:05:14 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 21:05:16 -0000 On Wednesday, May 03, 2017 01:03:19 PM Ian Lepore wrote: > On Wed, 2017-05-03 at 14:07 -0400, Ryan Stone wrote: > > On Wed, May 3, 2017 at 1:39 PM, Ryan Stone wrote: > > > > > > > > > > > > > > On Wed, May 3, 2017 at 1:21 PM, Alan Somers wrote: > > > > > > > > > > > Author: asomers > > > > Date: Wed May 3 17:21:01 2017 > > > > New Revision: 317755 > > > > URL: https://svnweb.freebsd.org/changeset/base/317755 > > > > > > > > Log: > > > > Various Coverity fixes in ifconfig(8) > > > > > > > > * Exit early if kldload(2) fails (1011259). This is the only change that > > > > affects ifconfig's behavior. > > > > > > > > > > > Please revert this ASAP. kldload is expected to fail for a number of > > > benign reasons and this change is likely to prevent any network > > > configuration from being applied to systems, breaking remote access. > > > > > > > > It's been pointed out to me off-list that the situation is not quite as > > dire as I had originally believed. The ifconfig code in question already > > searches to check if the module in question is loaded before calling > > kldload. However, there is at least one driver (mlx4_en) that does not > > follow the "if_" kld module naming convention that this code depends > > on, so this change will make it impossible to apply configuration to > > mlx4_en interfaces. Additionally, it is possible that other drivers use > > the naming convention for their kld file but not for the module declared in > > the C code, in which case this change would also break configuration of > > those interfaces. > > > > jhb@ suggests that ifconfig should only attempt to load a module if the > > interface doesn't already exist, by calling if_nametoindex to check for the > > existence of the interface. That seems to be a reasonable fix for me, but > > in the interest of not breaking users' networking configuration > > (potentially making it impossible to fix a remote machine), I'd recommend > > that the part of the change that checks the return code from kldload() be > > reverted while a fix for this issue is worked on. > > It should be noted that the existing code uses if_nametoindex() > immediately after ifmaybeload() returns, and handles errors > accordingly. I.e., there wasn't really anything wrong with the code as > originally written/structured. Except it's really klunky. The loop searching the module list is a lot more code than ignoring EEXIST errors from kldload. I would structure the code like this: ifindex = if_nametoindex(ifname); if (ifindex == 0) { ifmaybeload(ifname); ifindex = if_nametoindex(ifname); } if (ifindex == 0) { /* existing code */ } Further, I would probably simplify ifmaybeload() to be something like this: static void ifmaybeload(const char *name) { if (noload) return; /* existing code to generate 'ifkind' */ if (kldload(ifkind) == -1) { if (errno != EEXIST) err(...); } } One could argue for ignoring ENOENT errors as well, but Alan's specific use case is one that wanted an explicit kldload error for ENOENT. -- John Baldwin From owner-svn-src-head@freebsd.org Wed May 3 21:05:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69214D5CCF8; Wed, 3 May 2017 21:05:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29BB61E21; Wed, 3 May 2017 21:05:16 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id 4AD4710A7DB; Wed, 3 May 2017 17:05:13 -0400 (EDT) From: John Baldwin To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317756 - in head/sys: kern sys Date: Wed, 03 May 2017 14:05:09 -0700 Message-ID: <3289384.Hk57GyGBQs@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201705031841.v43If85k002993@repo.freebsd.org> References: <201705031841.v43If85k002993@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Wed, 03 May 2017 17:05:13 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 21:05:16 -0000 On Wednesday, May 03, 2017 06:41:08 PM Conrad Meyer wrote: > Author: cem > Date: Wed May 3 18:41:08 2017 > New Revision: 317756 > URL: https://svnweb.freebsd.org/changeset/base/317756 > > Log: > Extend cpuset_get/setaffinity() APIs > > Add IRQ placement-only and ithread-only API variants. intr_event_bind > has been extended with sibling methods, as it has many more callsites in > existing code. > > Reviewed by: kib@, adrian@ (earlier version) > Sponsored by: Dell EMC Isilon > Differential Revision: https://reviews.freebsd.org/D10586 > > Modified: head/sys/kern/kern_intr.c > ============================================================================== > --- head/sys/kern/kern_intr.c Wed May 3 17:21:01 2017 (r317755) > +++ head/sys/kern/kern_intr.c Wed May 3 18:41:08 2017 (r317756) > @@ -287,13 +287,11 @@ intr_event_create(struct intr_event **ev > /* > * Bind an interrupt event to the specified CPU. Note that not all > * platforms support binding an interrupt to a CPU. For those > - * platforms this request will fail. For supported platforms, any > - * associated ithreads as well as the primary interrupt context will > - * be bound to the specificed CPU. Using a cpu id of NOCPU unbinds > + * platforms this request will fail. Using a cpu id of NOCPU unbinds > * the interrupt event. > */ > -int > -intr_event_bind(struct intr_event *ie, int cpu) > +static int > +_intr_event_bind(struct intr_event *ie, int cpu, bool bindirq, bool bindithread) > { > lwpid_t id; > int error; > @@ -313,35 +311,75 @@ intr_event_bind(struct intr_event *ie, i > * If we have any ithreads try to set their mask first to verify > * permissions, etc. > */ > - mtx_lock(&ie->ie_lock); > - if (ie->ie_thread != NULL) { > - id = ie->ie_thread->it_thread->td_tid; > - mtx_unlock(&ie->ie_lock); > - error = cpuset_setithread(id, cpu); > - if (error) > - return (error); > - } else > - mtx_unlock(&ie->ie_lock); > - error = ie->ie_assign_cpu(ie->ie_source, cpu); > - if (error) { > + if (bindithread) { > mtx_lock(&ie->ie_lock); > if (ie->ie_thread != NULL) { > - cpu = ie->ie_cpu; > id = ie->ie_thread->it_thread->td_tid; > mtx_unlock(&ie->ie_lock); > - (void)cpuset_setithread(id, cpu); > + error = cpuset_setithread(id, cpu); > + if (error) > + return (error); > } else > mtx_unlock(&ie->ie_lock); > + } > + if (bindirq) > + error = ie->ie_assign_cpu(ie->ie_source, cpu); > + if (error) { > + if (bindithread) { This error block should probably be under 'if (bindirq)' as it only used to "undo" an ithread binding if an irq binding failed. > + mtx_lock(&ie->ie_lock); > + if (ie->ie_thread != NULL) { > + cpu = ie->ie_cpu; > + id = ie->ie_thread->it_thread->td_tid; > + mtx_unlock(&ie->ie_lock); > + (void)cpuset_setithread(id, cpu); > + } else > + mtx_unlock(&ie->ie_lock); > + } > return (error); > } > > - mtx_lock(&ie->ie_lock); > - ie->ie_cpu = cpu; > - mtx_unlock(&ie->ie_lock); > + if (bindirq) { > + mtx_lock(&ie->ie_lock); > + ie->ie_cpu = cpu; > + mtx_unlock(&ie->ie_lock); > + } This would then be in the else. That is, the code structure would be something like: if (bindithread) { /* new code to bind ithread */ } if (bindirq) { error = ie_assign_cpu(); if (error) { /* undo bind ithread */ } else { /* set ie_cpu */ } } > > return (error); > } > > +/* > + * Bind an interrupt event to the specified CPU. For supported platforms, any > + * associated ithreads as well as the primary interrupt context will be bound > + * to the specificed CPU. > + */ > +int > +intr_event_bind(struct intr_event *ie, int cpu) > +{ > + > + return (_intr_event_bind(ie, cpu, true, true)); > +} This is used by new-bus so the wrapper needs to stay. > + > +/* > + * Bind an interrupt event to the specified CPU, but do not bind associated > + * ithreads. > + */ > +int > +intr_event_bind_irqonly(struct intr_event *ie, int cpu) > +{ > + > + return (_intr_event_bind(ie, cpu, true, false)); > +} > + > +/* > + * Bind an interrupt event's ithread to the specified CPU. > + */ > +int > +intr_event_bind_ithread(struct intr_event *ie, int cpu) > +{ > + > + return (_intr_event_bind(ie, cpu, false, true)); > +} These aren't otherwise used? Perhaps rather than having these wrappers, the switch in intr_setaffinity() could just call _intr_event_bind() directly with the right set of booleans? The compiler will probably simplify it to the equivalent of: _intr_event_bind(ie, cpu, which != CPU_WHICH_ITHREAD, which != CPU_WHICH_INTRHANDLER); -- John Baldwin From owner-svn-src-head@freebsd.org Wed May 3 21:07:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 911FED5CE3E; Wed, 3 May 2017 21:07:45 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-yw0-x231.google.com (mail-yw0-x231.google.com [IPv6:2607:f8b0:4002:c05::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 465855F6; Wed, 3 May 2017 21:07:45 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-yw0-x231.google.com with SMTP id u70so912327ywe.2; Wed, 03 May 2017 14:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=c+Mkcjh45jU5LrWLz7z30RkF5MMYyZTIUCs1Z/IKAME=; b=iwBO9h3XbxYC2dM5cGBBt04pn68taBqjkfugDV4SmVWjmhdtAJPrxsU+4AquSvD+kg 8KZJZ1oYaXRVh6ervKdIvh3awnLAzH1WSiP1ZSXTTHFZkU9yELVlZ6sGcVt7PNf6H0po tzkARfQYd+1MrUpjXY6HkXFM73uAY0cZjTxDvMI56FPvFvaX3O4NAFBTKe9BKnuleK2q LpvD+2tLzIlavcJXkj5PP/tSw5xWp3+hoEp4jEve6J5dchs+MQdVHTp4gTEg0TJHhvHH 82kXDZ81VOajkrqfwRUQaD5egoJIay2dtSQXmewx13nFbRlByNr3eWmC3oZsUznAXXdl 3P9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=c+Mkcjh45jU5LrWLz7z30RkF5MMYyZTIUCs1Z/IKAME=; b=RcB2TQ2oKY7cWS0CO+j7ebbmNewvexqeaCTjUaFTG/K79FeVNFyXO58ZIYF/j1hmfa 8HzHqwMDQriBBk9FVlu/hLFHyNfUi2PrRVa9u+6XYb/csI0J9wOHMMLJjMoOzsB3JgBo IBUvKizpD6g8Wqyz//nklcy9PpppqYDeTjn0KJ3Pe/A1ev0ziii9ZW/WaGihXkYZXlH0 cooaguUvjYg93QGb9NfbjN3XA5A4KdmH8t9R8KdIBlsyBlf20W+INr+4E6KbpkacjlXD l5gMGIkRbzsTTQhqYaytae0mf68u4JO+k4bj4ZEAoUFH3I2HcOhyC19SUQJdguFqRLqa uy3Q== X-Gm-Message-State: AN3rC/50nbdBkVlvRn7iWjqn2slcEob7ftkY/IktFDgkNPJQ8XecE7Z0 IHlp03xp9BuakPiH5dTiUsP4y3xcHhSi X-Received: by 10.129.89.215 with SMTP id n206mr31126720ywb.94.1493845664335; Wed, 03 May 2017 14:07:44 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.129.20.214 with HTTP; Wed, 3 May 2017 14:07:43 -0700 (PDT) In-Reply-To: <20170504062448.U1383@besplex.bde.org> References: <201705031721.v43HL2vS071819@repo.freebsd.org> <8EA7A2E9-A429-4DC2-85CE-1B5AAEDF86FD@gmail.com> <20170504062448.U1383@besplex.bde.org> From: Alan Somers Date: Wed, 3 May 2017 15:07:43 -0600 X-Google-Sender-Auth: 52EODXP_BhWRvfa_40m_Qa9cPPU Message-ID: Subject: Re: svn commit: r317755 - head/sbin/ifconfig To: Bruce Evans Cc: Eric van Gyzen , Warner Losh , Ngie Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 21:07:45 -0000 On Wed, May 3, 2017 at 2:51 PM, Bruce Evans wrote: > On Wed, 3 May 2017, Eric van Gyzen wrote: > >> On 05/03/2017 14:38, Alan Somers wrote: >>> >>> On Wed, May 3, 2017 at 1:34 PM, Warner Losh wrote: >>>> >>>> On Wed, May 3, 2017 at 1:32 PM, Alan Somers wrote: >>>>> >>>>> On Wed, May 3, 2017 at 12:16 PM, Ngie Cooper >>>>> wrote: >>>>>> >>>>>> >>>>>>> On May 3, 2017, at 10:21, Alan Somers wrote: >>>>>>> >>>>>>> Author: asomers >>>>>>> Date: Wed May 3 17:21:01 2017 >>>>>>> New Revision: 317755 >>>>>>> URL: https://svnweb.freebsd.org/changeset/base/317755 >>>>>>> >>>>>>> Log: >>>>>>> Various Coverity fixes in ifconfig(8) >>>>>> >>>>>> >>>>>> ... >>>>>> >>>>>>> * Mark usage() as _Noreturn (1305806, 1305750) >>>>>> >>>>>> >>>>>> ... >>>>>> >>>>>>> -static void usage(void); >>>>>>> +static void usage(void) _Noreturn; >>>>>> >>>>>> >>>>>> Hi Alan, >>>>>> Please use __dead2 instead to be consistent with legacy use of >>>>>> similar gcc attributes. >>>>>> Thanks, >>>>>> -Ngie >>>>> >>>>> >>>>> Why not use _Noreturn? It's standardized by C11, so tools understand >>>>> it better than __dead2. >>>> >>>> >>>> Tools that can't understand #define __dead2 _Noreturn aren't worth >>>> supporting. >>> >>> Some tools don't expand preprocessor macros. Like my editor, for >>> example, which highlights _Noreturn as a keyword but not __dead2. >> >> >> Please use _Noreturn, because it's standard. sys/cdefs.h already >> defines it appropriately for C < C11. > > > _Noreturn is far too hard to use. The above use of it is a syntax error: > > pts/12:bde@freefall:~/u3> cat z.c > void foo(void) _Noreturn; > _Noreturn void foo(void); > pts/12:bde@freefall:~/u3> cc -std=c11 z.c > z.c:1:16: error: '_Noreturn' keyword must precede function declarator > void foo(void) _Noreturn; > ^~~~~~~~~ > _Noreturn > 1 error generated. > > sys/cdefs.h defines might define it appropropriately for C < C11, but > it defines it as __dead2 for all C, so prevents the C11 _Noreturn > keyword being used. This normally breaks detection of the syntax error. > Normally is included first, so you __dead2 obfuscated by > spelling it _Noreturn instead of C11 _Noreturn. > > Defining _Noreturn as __dead2 is wrong because it gives the opposite > syntax error. __dead2 can now be placed anywhere, but everything in > sys/cdefs.h is supposed to be portable back to gcc-1. __dead2 must > be placed after the function for gcc-2.0, since __attribute__(()) had > more restrictions then. So if you write: > > #include > _Noreturn void foo(void); > > to satisfy the C11 syntax, then you get a syntax error for old gcc (> 1). > > This is just the start of the complications for soft-coded C11'isms. > C11 also has noreturn. You have to include to get that. > But you actiually get the _Noreturn macro which expands to __dead2. > > There are further complications for C++11. sys/cdefs.h does have a > correct-looking ifdef for C+11. This gives the [[noreturn]] keyward > instead of __dead2. C11 doesn't have . I think its > keyword must be spelled [[noreturn]]. This spelling is completely > incompatibly with C. > > Bruce Why do you say that cdefs.h should be compatible with gcc-1? gcc-2 was released more than 25 years ago. gcc-1 isn't the default compiler for any architecture and isn't available in ports. If anybody can find a copy of gcc-1, I doubt that much of our codebase would compile. It sounds to me that the best practice would be to place both __dead2 and _Noreturn before the function name. -Alan From owner-svn-src-head@freebsd.org Wed May 3 21:35:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8840FD5B673; Wed, 3 May 2017 21:35:07 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 3640E1893; Wed, 3 May 2017 21:35:07 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 180121047791; Thu, 4 May 2017 07:34:59 +1000 (AEST) Date: Thu, 4 May 2017 07:34:58 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alan Somers cc: Bruce Evans , Eric van Gyzen , Warner Losh , Ngie Cooper , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317755 - head/sbin/ifconfig In-Reply-To: Message-ID: <20170504071824.H1678@besplex.bde.org> References: <201705031721.v43HL2vS071819@repo.freebsd.org> <8EA7A2E9-A429-4DC2-85CE-1B5AAEDF86FD@gmail.com> <20170504062448.U1383@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=AYLBJzfG c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=7Qk2ozbKAAAA:8 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8 a=GA-xqR6bnEjevdNG3BwA:9 a=CjuIK1q_8ugA:10 a=1lyxoWkJIXJV6VJUPhuM:22 a=IjZwj45LgO3ly-622nXo:22 a=6kGIvZw6iX1k4Y-7sg4_:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 21:35:07 -0000 On Wed, 3 May 2017, Alan Somers wrote: > On Wed, May 3, 2017 at 2:51 PM, Bruce Evans wrote: >> On Wed, 3 May 2017, Eric van Gyzen wrote: >> >>> On 05/03/2017 14:38, Alan Somers wrote: >>>> >>>> On Wed, May 3, 2017 at 1:34 PM, Warner Losh wrote: >>>>> >>>>> On Wed, May 3, 2017 at 1:32 PM, Alan Somers wrote: >>>>>> >>>>>> On Wed, May 3, 2017 at 12:16 PM, Ngie Cooper >>>>>> wrote: >>>>>>> >>>>>>> >>>>>>>> On May 3, 2017, at 10:21, Alan Somers wrote: >>>>>>>> >>>>>>>> Author: asomers >>>>>>>> Date: Wed May 3 17:21:01 2017 >>>>>>>> New Revision: 317755 >>>>>>>> URL: https://svnweb.freebsd.org/changeset/base/317755 >>>>>>>> >>>>>>>> Log: >>>>>>>> Various Coverity fixes in ifconfig(8) >>>>>>> >>>>>>> >>>>>>> ... >>>>>>> >>>>>>>> * Mark usage() as _Noreturn (1305806, 1305750) >>>>>>> >>>>>>> >>>>>>> ... >>>>>>> >>>>>>>> -static void usage(void); >>>>>>>> +static void usage(void) _Noreturn; >>>>>>> >>>>>>> >>>>>>> Hi Alan, >>>>>>> Please use __dead2 instead to be consistent with legacy use of >>>>>>> similar gcc attributes. >>>>>>> Thanks, >>>>>>> -Ngie >>>>>> >>>>>> >>>>>> Why not use _Noreturn? It's standardized by C11, so tools understand >>>>>> it better than __dead2. >>>>> >>>>> >>>>> Tools that can't understand #define __dead2 _Noreturn aren't worth >>>>> supporting. >>>> >>>> Some tools don't expand preprocessor macros. Like my editor, for >>>> example, which highlights _Noreturn as a keyword but not __dead2. >>> >>> >>> Please use _Noreturn, because it's standard. sys/cdefs.h already >>> defines it appropriately for C < C11. >> >> >> _Noreturn is far too hard to use. The above use of it is a syntax error: >> >> pts/12:bde@freefall:~/u3> cat z.c >> void foo(void) _Noreturn; >> _Noreturn void foo(void); >> pts/12:bde@freefall:~/u3> cc -std=c11 z.c >> z.c:1:16: error: '_Noreturn' keyword must precede function declarator >> void foo(void) _Noreturn; >> ^~~~~~~~~ >> _Noreturn >> 1 error generated. >> >> sys/cdefs.h defines might define it appropropriately for C < C11, but >> it defines it as __dead2 for all C, so prevents the C11 _Noreturn >> keyword being used. This normally breaks detection of the syntax error. >> Normally is included first, so you __dead2 obfuscated by >> spelling it _Noreturn instead of C11 _Noreturn. >> >> Defining _Noreturn as __dead2 is wrong because it gives the opposite >> syntax error. __dead2 can now be placed anywhere, but everything in >> sys/cdefs.h is supposed to be portable back to gcc-1. __dead2 must >> be placed after the function for gcc-2.0, since __attribute__(()) had >> more restrictions then. So if you write: >> >> #include >> _Noreturn void foo(void); >> >> to satisfy the C11 syntax, then you get a syntax error for old gcc (> 1). >> >> This is just the start of the complications for soft-coded C11'isms. >> C11 also has noreturn. You have to include to get that. >> But you actiually get the _Noreturn macro which expands to __dead2. >> >> There are further complications for C++11. sys/cdefs.h does have a >> correct-looking ifdef for C+11. This gives the [[noreturn]] keyward >> instead of __dead2. C11 doesn't have . I think its >> keyword must be spelled [[noreturn]]. This spelling is completely >> incompatibly with C. > > Why do you say that cdefs.h should be compatible with gcc-1? gcc-2 Because that is what it is for. It should be compatible with any C compiler, not just gcc or Standard C ones, but since it grew up with gcc it doesn't have much support for others. It still pretends to supports gcc-1 with pre-Standard C (__P(()), etc.) and even compilers that don't have pre-Standard volatile (pure K&R1 for that and not K&R with gcc-1 extensions), and lint. Some of this still works. > was released more than 25 years ago. gcc-1 isn't the default compiler > for any architecture and isn't available in ports. If anybody can > find a copy of gcc-1, I doubt that much of our codebase would compile. > It sounds to me that the best practice would be to place both __dead2 > and _Noreturn before the function name. Unportable code can do that. Of course, it is unportable to include at all. Usign __dead2 gives undefined behaviour in general. Even if you include , it might not be the FreeBSD one. Using _Noreturn gives undefined behaviour before C11. Bruce From owner-svn-src-head@freebsd.org Wed May 3 21:44:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 191B4D5BC23; Wed, 3 May 2017 21:44:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFFE6DD; Wed, 3 May 2017 21:44:05 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43Li4l5083508; Wed, 3 May 2017 21:44:04 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43Li4ns083507; Wed, 3 May 2017 21:44:04 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201705032144.v43Li4ns083507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 3 May 2017 21:44:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317777 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 21:44:06 -0000 Author: glebius Date: Wed May 3 21:44:04 2017 New Revision: 317777 URL: https://svnweb.freebsd.org/changeset/base/317777 Log: Improve documentation of fbuf device. Submitted by: novel Reviewed by: grehan, bcr Differential Revision: https://reviews.freebsd.org/D10014 Modified: head/usr.sbin/bhyve/bhyve.8 Modified: head/usr.sbin/bhyve/bhyve.8 ============================================================================== --- head/usr.sbin/bhyve/bhyve.8 Wed May 3 21:04:32 2017 (r317776) +++ head/usr.sbin/bhyve/bhyve.8 Wed May 3 21:44:04 2017 (r317777) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 27, 2017 +.Dd May 3, 2017 .Dt BHYVE 8 .Os .Sh NAME @@ -49,10 +49,13 @@ virtual machine. Parameters such as the number of virtual CPUs, amount of guest memory, and I/O connectivity can be specified with command-line parameters. .Pp -The guest operating system must be loaded with +If not using a boot ROM, the guest operating system must be loaded with .Xr bhyveload 8 or a similar boot loader before running -.Nm . +.Nm , +otherwise, it is enough to run +.Nm +with a boot ROM of choice. .Pp .Nm runs until the guest operating system reboots or an unhandled hypervisor @@ -191,7 +194,7 @@ The LPC bridge emulation can only be con .It Li fbuf Raw framebuffer device attached to VNC server. .It Li xhci -XHCI USB controller. +eXtensible Host Controller Interface (xHCI) USB controller. .El .It Op Ar conf This optional parameter describes the backend for device emulations. @@ -304,38 +307,75 @@ Emergency write is advertised, but no-op .El .El .Pp -Raw framebuffer device: +Framebuffer devices: +.Bl -tag -width 10n +.It Oo rfb= Ns Oo Ar IP: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= Ns Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc +.Bl -tag -width 8n +.It Ar IP:port +An +.Ar IP +address and a +.Ar port +VNC should listen on. +The default is to listen on localhost IPv4 address and default VNC port 5900. +Listening on an IPv6 address is not supported. +.It Ar width No and Ar height +A display resolution, width and height, respectively. +If not specified, a default resolution of 1024x768 pixels will be used. +Minimal supported resolution is 640x480 pixels, +and maximum is 1920x1200 pixels. +.It Ar vgaconf +Possible values for this option are +.Dq io +(default), +.Dq on +, and +.Dq off . +PCI graphics cards have a dual personality in that they are +standard PCI devices with BAR addressing, but may also +implicitly decode legacy VGA I/O space +.Pq Ad 0x3c0-3df +and memory space +.Pq 64KB at Ad 0xA0000 . +The default +.Dq io +option should be used for guests that attempt to issue BIOS +calls which result in I/O port queries, and fail to boot if I/O decode is disabled. +.Pp +The +.Dq on +option should be used along with the CSM BIOS capability in UEFI +to boot traditional BIOS guests that require the legacy VGA I/O and +memory regions to be available. +.Pp +The +.Dq off +option should be used for the UEFI guests that assume that +VGA adapter is present if they detect the I/O ports. +An example of such a guest is +.Ox +in UEFI mode. .Pp -.Oo wait Oc Ns Oo ,vga= Ns Ar Oc Oo ,rfb= Ns Oo Ar IP: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar w Oc Ns Oo ,h= Ns Ar h Oc -.Bl -tag -width [vga=on|io|off] +Please refer to the +.Nm +.Fx +wiki page +.Pq Lk https://wiki.freebsd.org/bhyve +for configuration notes of particular guests. .It wait -Wait for a VNC client connection before booting the virtual machine. -The default is not to wait. -.It vga= Ns Ar on|io|off -Enable VGA emulation. -The default is -.Va io -mode: VGA is enabled, but only I/O ports are available, -no VGA memory is provided. -.It rfb= Ns Oo Ar IP: Oc Ns Ar port -Set the VNC server to listen at -.Va IP:port . -The default is to listen on localhost IPv4 address and default VNC port 5900. -Listening on a IPv6 address is not supported. -.It w= Ns Ar width -Set framebuffer width to -.Ar width . -The default width is 1920. -.It h= Ns Ar height -Set framebuffer height to -.Ar height . -The default height is 1080. +Instruct +.Nm +to only boot upon the initiation of a VNC connection, simplifying the installation +of operating systems that require immediate keyboard input. +This can be removed for post-installation use. +.El .El .Pp -XHCI USB controller device: -.Bl -tag -.It Ar tablet -Emulate USB tablet mouse. +xHCI USB devices: +.Bl -tag -width 10n +.It Li tablet +A USB tablet device which provides precise cursor synchronization +when using VNC. .El .El .It Fl S @@ -385,11 +425,12 @@ halted triple fault .El .Sh EXAMPLES -The guest operating system must have been loaded with +If not using a boot ROM, the guest operating system must have been loaded with .Xr bhyveload 8 or a similar boot loader before .Xr bhyve 4 can be run. +Otherwise, the boot loader is not needed. .Pp To run a virtual machine with 1GB of memory, two virtual CPUs, a virtio block device backed by the @@ -427,6 +468,21 @@ cd:/images/install.iso \\ -l com1,/dev/nmdm0A \\ -A -H -P -m 8G .Ed +.Pp +Run a UEFI virtual machine with a display resolution of 800 by 600 pixels +that can be accessed via VNC at: 0.0.0.0:5900. +.Bd -literal -offset indent +bhyve -c 2 -m 4G -w -H \\ + -s 0,hostbridge \\ + -s 3,ahci-cd,/path/to/uefi-OS-install.iso \\ + -s 4,ahci-hd,disk.img \\ + -s 5,virtio-net,tap0 \\ + -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \\ + -s 30,xhci,tablet \\ + -s 31,lpc -l com1,stdio \\ + -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\ + uefivm +.Ed .Sh SEE ALSO .Xr bhyve 4 , .Xr nmdm 4 , From owner-svn-src-head@freebsd.org Wed May 3 22:35:42 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC704D55B6D; Wed, 3 May 2017 22:35:42 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADE6BC01; Wed, 3 May 2017 22:35:42 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43MZfGL006003; Wed, 3 May 2017 22:35:41 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43MZf1n006000; Wed, 3 May 2017 22:35:41 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201705032235.v43MZf1n006000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 3 May 2017 22:35:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317779 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 22:35:43 -0000 Author: pfg Date: Wed May 3 22:35:41 2017 New Revision: 317779 URL: https://svnweb.freebsd.org/changeset/base/317779 Log: ext2fs: add read-write support for Extended Attributes. Extended attributes and their particular implementation in linux are different from FreeBSD so in this case we have started diverging from the UFS EA implementation, which would be the natural reference. Depending on future progress implementing ACLs this approach may change but for now bring to the tree an implementation that is consistent and can be tested. Submitted by: Fedor Uporov Differential Revision: https://reviews.freebsd.org/D10460 Modified: head/sys/fs/ext2fs/ext2_alloc.c head/sys/fs/ext2fs/ext2_extattr.c head/sys/fs/ext2fs/ext2_extattr.h head/sys/fs/ext2fs/ext2_extern.h head/sys/fs/ext2fs/ext2_inode.c head/sys/fs/ext2fs/ext2_inode_cnv.c head/sys/fs/ext2fs/ext2_vnops.c Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Wed May 3 21:54:55 2017 (r317778) +++ head/sys/fs/ext2fs/ext2_alloc.c Wed May 3 22:35:41 2017 (r317779) @@ -132,6 +132,25 @@ nospace: } /* + * Allocate EA's block for inode. + */ +daddr_t +ext2_allocfacl(struct inode *ip) +{ + struct m_ext2fs *fs; + daddr_t facl; + + fs = ip->i_e2fs; + + EXT2_LOCK(ip->i_ump); + facl = ext2_alloccg(ip, ino_to_cg(fs, ip->i_number), 0, fs->e2fs_bsize); + if (0 == facl) + EXT2_UNLOCK(ip->i_ump); + + return (facl); +} + +/* * Reallocate a sequence of blocks into a contiguous sequence of blocks. * * The vnode and an array of buffer pointers for a range of sequential Modified: head/sys/fs/ext2fs/ext2_extattr.c ============================================================================== --- head/sys/fs/ext2fs/ext2_extattr.c Wed May 3 21:54:55 2017 (r317778) +++ head/sys/fs/ext2fs/ext2_extattr.c Wed May 3 22:35:41 2017 (r317779) @@ -44,21 +44,66 @@ #include #include #include +#include static int ext2_extattr_index_to_bsd(int index) { switch (index) { + case EXT4_XATTR_INDEX_SYSTEM: + return (EXTATTR_NAMESPACE_SYSTEM); + case EXT4_XATTR_INDEX_USER: - return EXTATTR_NAMESPACE_USER; + return (EXTATTR_NAMESPACE_USER); + } - case EXT4_XATTR_INDEX_SYSTEM: - return EXTATTR_NAMESPACE_SYSTEM; + return (EXTATTR_NAMESPACE_EMPTY); +} + +static int +ext2_extattr_index_to_linux(int index) +{ + switch (index) { + case EXTATTR_NAMESPACE_SYSTEM: + return (EXT4_XATTR_INDEX_SYSTEM); + + case EXTATTR_NAMESPACE_USER: + return (EXT4_XATTR_INDEX_USER); + } + + return (-1); +} + +int +ext2_extattr_valid_attrname(int attrnamespace, const char *attrname) +{ + if (attrnamespace == EXTATTR_NAMESPACE_EMPTY) + return (EINVAL); + + if (strlen(attrname) == 0) + return (EINVAL); + + if (strlen(attrname) + 1 > EXT2_EXTATTR_NAMELEN_MAX) + return (ENAMETOOLONG); + + return (0); +} + +static int +ext2_extattr_check(struct ext2fs_extattr_entry *entry, char *end) +{ + struct ext2fs_extattr_entry *next; + + while (!EXT2_IS_LAST_ENTRY(entry)) { + next = EXT2_EXTATTR_NEXT(entry); + if ((char *)next >= end) + return (EIO); - default: - return EXTATTR_NAMESPACE_EMPTY; + entry = next; } + + return (0); } int @@ -69,8 +114,6 @@ ext2_extattr_inode_list(struct inode *ip struct buf *bp; struct ext2fs_extattr_dinode_header *header; struct ext2fs_extattr_entry *entry; - struct ext2fs_extattr_entry *next; - char *end; int error; fs = ip->i_e2fs; @@ -95,21 +138,15 @@ ext2_extattr_inode_list(struct inode *ip return (0); } - /* Check attributes integrity */ - entry = EXT2_IFIRST(header); - end = (char *)dinode + EXT2_INODE_SIZE(fs); - while (!EXT2_IS_LAST_ENTRY(entry)) { - next = EXT2_EXTATTR_NEXT(entry); - if ((char *)next >= end) { - brelse(bp); - return (EIO); - } - - entry = next; + error = ext2_extattr_check(EXT2_IFIRST(header), + (char *)dinode + EXT2_INODE_SIZE(fs)); + if (error) { + brelse(bp); + return (error); } for (entry = EXT2_IFIRST(header); !EXT2_IS_LAST_ENTRY(entry); - entry = EXT2_EXTATTR_NEXT(entry)) { + entry = EXT2_EXTATTR_NEXT(entry)) { if (ext2_extattr_index_to_bsd(entry->e_name_index) != attrnamespace) continue; @@ -121,12 +158,14 @@ ext2_extattr_inode_list(struct inode *ip memcpy(&attr_name[1], entry->e_name, entry->e_name_len); error = uiomove(attr_name, entry->e_name_len + 1, uio); free(attr_name, M_TEMP); + if (error) + break; } } brelse(bp); - return (0); + return (error); } int @@ -137,8 +176,6 @@ ext2_extattr_block_list(struct inode *ip struct buf *bp; struct ext2fs_extattr_header *header; struct ext2fs_extattr_entry *entry; - struct ext2fs_extattr_entry *next; - char *end; int error; fs = ip->i_e2fs; @@ -157,17 +194,10 @@ ext2_extattr_block_list(struct inode *ip return (EINVAL); } - /* Check attributes integrity */ - end = bp->b_data + bp->b_bufsize; - entry = EXT2_FIRST_ENTRY(bp); - while (!EXT2_IS_LAST_ENTRY(entry)) { - next = EXT2_EXTATTR_NEXT(entry); - if ((char *)next >= end) { - brelse(bp); - return (EIO); - } - - entry = next; + error = ext2_extattr_check(EXT2_FIRST_ENTRY(bp), bp->b_data + bp->b_bufsize); + if (error) { + brelse(bp); + return (error); } for (entry = EXT2_FIRST_ENTRY(bp); !EXT2_IS_LAST_ENTRY(entry); @@ -183,12 +213,14 @@ ext2_extattr_block_list(struct inode *ip memcpy(&attr_name[1], entry->e_name, entry->e_name_len); error = uiomove(attr_name, entry->e_name_len + 1, uio); free(attr_name, M_TEMP); + if (error) + break; } } brelse(bp); - return (0); + return (error); } int @@ -199,8 +231,6 @@ ext2_extattr_inode_get(struct inode *ip, struct buf *bp; struct ext2fs_extattr_dinode_header *header; struct ext2fs_extattr_entry *entry; - struct ext2fs_extattr_entry *next; - char *end; int error; fs = ip->i_e2fs; @@ -222,20 +252,14 @@ ext2_extattr_inode_get(struct inode *ip, if (header->h_magic != EXTATTR_MAGIC) { brelse(bp); - return (0); + return (ENOATTR); } - /* Check attributes integrity */ - entry = EXT2_IFIRST(header); - end = (char *)dinode + EXT2_INODE_SIZE(fs); - while (!EXT2_IS_LAST_ENTRY(entry)) { - next = EXT2_EXTATTR_NEXT(entry); - if ((char *)next >= end) { - brelse(bp); - return (EIO); - } - - entry = next; + error = ext2_extattr_check(EXT2_IFIRST(header), + (char *)dinode + EXT2_INODE_SIZE(fs)); + if (error) { + brelse(bp); + return (error); } for (entry = EXT2_IFIRST(header); !EXT2_IS_LAST_ENTRY(entry); @@ -248,19 +272,18 @@ ext2_extattr_inode_get(struct inode *ip, if (uio == NULL) *size += entry->e_value_size; else { - error = uiomove(((char *)EXT2_IFIRST(header)) + entry->e_value_offs, - entry->e_value_size, uio); - if (error) { - brelse(bp); - return (error); - } + error = uiomove(((char *)EXT2_IFIRST(header)) + + entry->e_value_offs, entry->e_value_size, uio); } + + brelse(bp); + return (error); } } brelse(bp); - return (0); + return (ENOATTR); } int @@ -271,8 +294,6 @@ ext2_extattr_block_get(struct inode *ip, struct buf *bp; struct ext2fs_extattr_header *header; struct ext2fs_extattr_entry *entry; - struct ext2fs_extattr_entry *next; - char *end; int error; fs = ip->i_e2fs; @@ -291,17 +312,10 @@ ext2_extattr_block_get(struct inode *ip, return (EINVAL); } - /* Check attributes integrity */ - end = bp->b_data + bp->b_bufsize; - entry = EXT2_FIRST_ENTRY(bp); - while (!EXT2_IS_LAST_ENTRY(entry)) { - next = EXT2_EXTATTR_NEXT(entry); - if ((char *)next >= end) { - brelse(bp); - return (EIO); - } - - entry = next; + error = ext2_extattr_check(EXT2_FIRST_ENTRY(bp), bp->b_data + bp->b_bufsize); + if (error) { + brelse(bp); + return (error); } for (entry = EXT2_FIRST_ENTRY(bp); !EXT2_IS_LAST_ENTRY(entry); @@ -316,15 +330,725 @@ ext2_extattr_block_get(struct inode *ip, else { error = uiomove(bp->b_data + entry->e_value_offs, entry->e_value_size, uio); - if (error) { - brelse(bp); - return (error); - } } + + brelse(bp); + return (error); } } brelse(bp); + return (ENOATTR); +} + +static uint16_t +ext2_extattr_delete_value(char *off, + struct ext2fs_extattr_entry *first_entry, + struct ext2fs_extattr_entry *entry, char *end) +{ + uint16_t min_offs; + struct ext2fs_extattr_entry *next; + + min_offs = end - off; + next = first_entry; + while (!EXT2_IS_LAST_ENTRY(next)) { + if (min_offs > next->e_value_offs && next->e_value_offs > 0) + min_offs = next->e_value_offs; + + next = EXT2_EXTATTR_NEXT(next); + } + + if (entry->e_value_size == 0) + return (min_offs); + + memmove(off + min_offs + EXT2_EXTATTR_SIZE(entry->e_value_size), + off + min_offs, entry->e_value_offs - min_offs); + + /* Adjust all value offsets */ + next = first_entry; + while (!EXT2_IS_LAST_ENTRY(next)) + { + if (next->e_value_offs > 0 && + next->e_value_offs < entry->e_value_offs) + next->e_value_offs += + EXT2_EXTATTR_SIZE(entry->e_value_size); + + next = EXT2_EXTATTR_NEXT(next); + } + + min_offs += EXT2_EXTATTR_SIZE(entry->e_value_size); + + return (min_offs); +} + +static void +ext2_extattr_delete_entry(char *off, + struct ext2fs_extattr_entry *first_entry, + struct ext2fs_extattr_entry *entry, char *end) +{ + char *pad; + struct ext2fs_extattr_entry *next; + + /* Clean entry value */ + ext2_extattr_delete_value(off, first_entry, entry, end); + + /* Clean the entry */ + next = first_entry; + while (!EXT2_IS_LAST_ENTRY(next)) + next = EXT2_EXTATTR_NEXT(next); + + pad = (char*)next + sizeof(uint32_t); + + memmove(entry, (char *)entry + EXT2_EXTATTR_LEN(entry->e_name_len), + pad - ((char *)entry + EXT2_EXTATTR_LEN(entry->e_name_len))); +} + +int +ext2_extattr_inode_delete(struct inode *ip, int attrnamespace, const char *name) +{ + struct m_ext2fs *fs; + struct buf *bp; + struct ext2fs_extattr_dinode_header *header; + struct ext2fs_extattr_entry *entry; + int error; + + fs = ip->i_e2fs; + + if ((error = bread(ip->i_devvp, + fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), + (int)fs->e2fs_bsize, NOCRED, &bp)) != 0) { + brelse(bp); + return (error); + } + + struct ext2fs_dinode *dinode = (struct ext2fs_dinode *) + ((char *)bp->b_data + + EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)); + + /* Check attributes magic value */ + header = (struct ext2fs_extattr_dinode_header *)((char *)dinode + + E2FS_REV0_INODE_SIZE + dinode->e2di_extra_isize); + + if (header->h_magic != EXTATTR_MAGIC) { + brelse(bp); + return (ENOATTR); + } + + error = ext2_extattr_check(EXT2_IFIRST(header), + (char *)dinode + EXT2_INODE_SIZE(fs)); + if (error) { + brelse(bp); + return (error); + } + + /* If I am last entry, just make magic zero */ + entry = EXT2_IFIRST(header); + if (EXT2_IS_LAST_ENTRY(EXT2_EXTATTR_NEXT(entry))) { + if (strlen(name) == entry->e_name_len && + 0 == strncmp(entry->e_name, name, entry->e_name_len)) { + memset(header, 0, sizeof(struct ext2fs_extattr_dinode_header)); + + return (bwrite(bp)); + } + } + + for (entry = EXT2_IFIRST(header); !EXT2_IS_LAST_ENTRY(entry); + entry = EXT2_EXTATTR_NEXT(entry)) { + if (ext2_extattr_index_to_bsd(entry->e_name_index) != attrnamespace) + continue; + + if (strlen(name) == entry->e_name_len && + 0 == strncmp(entry->e_name, name, entry->e_name_len)) { + ext2_extattr_delete_entry((char *)EXT2_IFIRST(header), + EXT2_IFIRST(header), entry, + (char *)dinode + EXT2_INODE_SIZE(fs)); + + return (bwrite(bp)); + } + } + + brelse(bp); + + return (ENOATTR); +} + +static int +ext2_extattr_block_clone(struct inode *ip, struct buf **bpp) +{ + struct m_ext2fs *fs; + struct buf *sbp; + struct buf *cbp; + struct ext2fs_extattr_header *header; + uint64_t facl; + + fs = ip->i_e2fs; + sbp = *bpp; + + header = EXT2_HDR(sbp); + if (header->h_magic != EXTATTR_MAGIC || header->h_refcount == 1) + return (EINVAL); + + facl = ext2_allocfacl(ip); + if (!facl) + return (ENOSPC); + + cbp = getblk(ip->i_devvp, fsbtodb(fs, facl), fs->e2fs_bsize, 0, 0, 0); + if (!cbp) { + ext2_blkfree(ip, facl, fs->e2fs_bsize); + return (EIO); + } + + memcpy(cbp->b_data, sbp->b_data, fs->e2fs_bsize); + header->h_refcount--; + bwrite(sbp); + + ip->i_facl = facl; + ext2_update(ip->i_vnode, 1); + + header = EXT2_HDR(cbp); + header->h_refcount = 1; + + *bpp = cbp; + + return (0); +} + +int +ext2_extattr_block_delete(struct inode *ip, int attrnamespace, const char *name) +{ + struct m_ext2fs *fs; + struct buf *bp; + struct ext2fs_extattr_header *header; + struct ext2fs_extattr_entry *entry; + int error; + + fs = ip->i_e2fs; + + error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl), + fs->e2fs_bsize, NOCRED, &bp); + if (error) { + brelse(bp); + return (error); + } + + /* Check attributes magic value */ + header = EXT2_HDR(bp); + if (header->h_magic != EXTATTR_MAGIC || header->h_blocks != 1) { + brelse(bp); + return (EINVAL); + } + + error = ext2_extattr_check(EXT2_FIRST_ENTRY(bp), bp->b_data + bp->b_bufsize); + if (error) { + brelse(bp); + return (error); + } + + if (header->h_refcount > 1) { + error = ext2_extattr_block_clone(ip, &bp); + if (error) { + brelse(bp); + return (error); + } + } + + /* If I am last entry, clean me and free the block */ + entry = EXT2_FIRST_ENTRY(bp); + if (EXT2_IS_LAST_ENTRY(EXT2_EXTATTR_NEXT(entry))) { + if (strlen(name) == entry->e_name_len && + 0 == strncmp(entry->e_name, name, entry->e_name_len)) { + ip->i_blocks -= btodb(fs->e2fs_bsize); + ext2_blkfree(ip, ip->i_facl, fs->e2fs_bsize); + ip->i_facl = 0; + error = ext2_update(ip->i_vnode, 1); + + brelse(bp); + return (error); + } + } + + for (entry = EXT2_FIRST_ENTRY(bp); !EXT2_IS_LAST_ENTRY(entry); + entry = EXT2_EXTATTR_NEXT(entry)) { + if (ext2_extattr_index_to_bsd(entry->e_name_index) != attrnamespace) + continue; + + if (strlen(name) == entry->e_name_len && + 0 == strncmp(entry->e_name, name, entry->e_name_len)) { + ext2_extattr_delete_entry(bp->b_data, + EXT2_FIRST_ENTRY(bp), entry, + bp->b_data + bp->b_bufsize); + + return (bwrite(bp)); + } + } + + brelse(bp); + + return (ENOATTR); +} + +static struct ext2fs_extattr_entry * +allocate_entry(const char *name, int attrnamespace, uint16_t offs, + uint32_t size, uint32_t hash) +{ + size_t name_len; + struct ext2fs_extattr_entry *entry; + + name_len = strlen(name); + entry = malloc(sizeof(struct ext2fs_extattr_entry) + name_len, + M_TEMP, M_WAITOK); + + entry->e_name_len = name_len; + entry->e_name_index = ext2_extattr_index_to_linux(attrnamespace); + entry->e_value_offs = offs; + entry->e_value_block = 0; + entry->e_value_size = size; + entry->e_hash = hash; + memcpy(entry->e_name, name, name_len); + + return (entry); +} + +static void +free_entry(struct ext2fs_extattr_entry *entry) +{ + + free(entry, M_TEMP); +} + +static int +ext2_extattr_get_size(struct ext2fs_extattr_entry *first_entry, + struct ext2fs_extattr_entry *exist_entry, int header_size, + int name_len, int new_size) +{ + struct ext2fs_extattr_entry *entry; + int size; + + size = header_size; + size += sizeof(uint32_t); + + if (NULL == exist_entry) { + size += EXT2_EXTATTR_LEN(name_len); + size += EXT2_EXTATTR_SIZE(new_size); + } + + if (first_entry) + for (entry = first_entry; !EXT2_IS_LAST_ENTRY(entry); + entry = EXT2_EXTATTR_NEXT(entry)) { + if (entry != exist_entry) + size += EXT2_EXTATTR_LEN(entry->e_name_len) + + EXT2_EXTATTR_SIZE(entry->e_value_size); + else + size += EXT2_EXTATTR_LEN(entry->e_name_len) + + EXT2_EXTATTR_SIZE(new_size); + } + + return (size); +} + +static void +ext2_extattr_set_exist_entry(char *off, + struct ext2fs_extattr_entry *first_entry, + struct ext2fs_extattr_entry *entry, + char *end, struct uio *uio) +{ + uint16_t min_offs; + + min_offs = ext2_extattr_delete_value(off, first_entry, entry, end); + + entry->e_value_size = uio->uio_resid; + if (entry->e_value_size) + entry->e_value_offs = min_offs - + EXT2_EXTATTR_SIZE(uio->uio_resid); + else + entry->e_value_offs = 0; + + uiomove(off + entry->e_value_offs, entry->e_value_size, uio); +} + +static struct ext2fs_extattr_entry * +ext2_extattr_set_new_entry(char *off, struct ext2fs_extattr_entry *first_entry, + const char *name, int attrnamespace, char *end, struct uio *uio) +{ + int name_len; + char *pad; + uint16_t min_offs; + struct ext2fs_extattr_entry *entry; + struct ext2fs_extattr_entry *new_entry; + + /* Find pad's */ + min_offs = end - off; + entry = first_entry; + while (!EXT2_IS_LAST_ENTRY(entry)) { + if (min_offs > entry->e_value_offs && entry->e_value_offs > 0) + min_offs = entry->e_value_offs; + + entry = EXT2_EXTATTR_NEXT(entry); + } + + pad = (char*)entry + sizeof(uint32_t); + + /* Find entry insert position */ + name_len = strlen(name); + entry = first_entry; + while (!EXT2_IS_LAST_ENTRY(entry)) { + if (!(attrnamespace - entry->e_name_index) && + !(name_len - entry->e_name_len)) + if (memcmp(name, entry->e_name, name_len) <= 0) + break; + + entry = EXT2_EXTATTR_NEXT(entry); + } + + /* Create new entry and insert it */ + new_entry = allocate_entry(name, attrnamespace, 0, uio->uio_resid, 0); + memmove((char *)entry + EXT2_EXTATTR_LEN(new_entry->e_name_len), entry, + pad - (char*)entry); + + memcpy(entry, new_entry, EXT2_EXTATTR_LEN(new_entry->e_name_len)); + free_entry(new_entry); + + new_entry = entry; + if (new_entry->e_value_size > 0) + new_entry->e_value_offs = min_offs - + EXT2_EXTATTR_SIZE(new_entry->e_value_size); + + uiomove(off + new_entry->e_value_offs, new_entry->e_value_size, uio); + + return (new_entry); +} + +int +ext2_extattr_inode_set(struct inode *ip, int attrnamespace, + const char *name, struct uio *uio) +{ + struct m_ext2fs *fs; + struct buf *bp; + struct ext2fs_extattr_dinode_header *header; + struct ext2fs_extattr_entry *entry; + size_t size = 0, max_size; + int error; + + fs = ip->i_e2fs; + + if ((error = bread(ip->i_devvp, + fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), + (int)fs->e2fs_bsize, NOCRED, &bp)) != 0) { + brelse(bp); + return (error); + } + + struct ext2fs_dinode *dinode = (struct ext2fs_dinode *) + ((char *)bp->b_data + + EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)); + + /* Check attributes magic value */ + header = (struct ext2fs_extattr_dinode_header *)((char *)dinode + + E2FS_REV0_INODE_SIZE + dinode->e2di_extra_isize); + + if (header->h_magic != EXTATTR_MAGIC) { + brelse(bp); + return (ENOSPC); + } + + error = ext2_extattr_check(EXT2_IFIRST(header), (char *)dinode + + EXT2_INODE_SIZE(fs)); + if (error) { + brelse(bp); + return (error); + } + + /* Find if entry exist */ + for (entry = EXT2_IFIRST(header); !EXT2_IS_LAST_ENTRY(entry); + entry = EXT2_EXTATTR_NEXT(entry)) { + if (ext2_extattr_index_to_bsd(entry->e_name_index) != attrnamespace) + continue; + + if (strlen(name) == entry->e_name_len && + 0 == strncmp(entry->e_name, name, entry->e_name_len)) + break; + } + + max_size = EXT2_INODE_SIZE(fs) - E2FS_REV0_INODE_SIZE - + dinode->e2di_extra_isize; + + if (!EXT2_IS_LAST_ENTRY(entry)) { + size = ext2_extattr_get_size(EXT2_IFIRST(header), entry, + sizeof(struct ext2fs_extattr_dinode_header), + entry->e_name_len, uio->uio_resid); + if (size > max_size) { + brelse(bp); + return (ENOSPC); + } + + ext2_extattr_set_exist_entry((char *)EXT2_IFIRST(header), + EXT2_IFIRST(header), entry, (char *)header + max_size, uio); + } else { + /* Ensure that the same entry does not exist in the block */ + if (ip->i_facl) { + error = ext2_extattr_block_get(ip, attrnamespace, name, + NULL, &size); + if (error != ENOATTR || size > 0) { + brelse(bp); + if (size > 0) + error = ENOSPC; + + return (error); + } + } + + size = ext2_extattr_get_size(EXT2_IFIRST(header), NULL, + sizeof(struct ext2fs_extattr_dinode_header), + entry->e_name_len, uio->uio_resid); + if (size > max_size) { + brelse(bp); + return (ENOSPC); + } + + ext2_extattr_set_new_entry((char *)EXT2_IFIRST(header), + EXT2_IFIRST(header), name, attrnamespace, + (char *)header + max_size, uio); + } + + return (bwrite(bp)); +} + +static void +ext2_extattr_hash_entry(struct ext2fs_extattr_header *header, + struct ext2fs_extattr_entry *entry) +{ + uint32_t hash = 0; + char *name = entry->e_name; + int n; + + for (n=0; n < entry->e_name_len; n++) { + hash = (hash << EXT2_EXTATTR_NAME_HASH_SHIFT) ^ + (hash >> (8*sizeof(hash) - EXT2_EXTATTR_NAME_HASH_SHIFT)) ^ + (*name++); + } + + if (entry->e_value_block == 0 && entry->e_value_size != 0) { + uint32_t *value = (uint32_t *)((char *)header + entry->e_value_offs); + for (n = (entry->e_value_size + + EXT2_EXTATTR_ROUND) >> EXT2_EXTATTR_PAD_BITS; n; n--) { + hash = (hash << EXT2_EXTATTR_VALUE_HASH_SHIFT) ^ + (hash >> (8*sizeof(hash) - EXT2_EXTATTR_VALUE_HASH_SHIFT)) ^ + (*value++); + } + } + + entry->e_hash = hash; +} + +static void +ext2_extattr_rehash(struct ext2fs_extattr_header *header, + struct ext2fs_extattr_entry *entry) +{ + struct ext2fs_extattr_entry *here; + uint32_t hash = 0; + + ext2_extattr_hash_entry(header, entry); + + here = EXT2_ENTRY(header+1); + while (!EXT2_IS_LAST_ENTRY(here)) { + if (!here->e_hash) { + /* Block is not shared if an entry's hash value == 0 */ + hash = 0; + break; + } + + hash = (hash << EXT2_EXTATTR_BLOCK_HASH_SHIFT) ^ + (hash >> (8*sizeof(hash) - EXT2_EXTATTR_BLOCK_HASH_SHIFT)) ^ + here->e_hash; + + here = EXT2_EXTATTR_NEXT(here); + } + + header->h_hash = hash; +} + +int +ext2_extattr_block_set(struct inode *ip, int attrnamespace, + const char *name, struct uio *uio) +{ + struct m_ext2fs *fs; + struct buf *bp; + struct ext2fs_extattr_header *header; + struct ext2fs_extattr_entry *entry; + size_t size; + int error; + + fs = ip->i_e2fs; + + if (ip->i_facl) { + error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl), + fs->e2fs_bsize, NOCRED, &bp); + if (error) { + brelse(bp); + return (error); + } + + /* Check attributes magic value */ + header = EXT2_HDR(bp); + if (header->h_magic != EXTATTR_MAGIC || header->h_blocks != 1) { + brelse(bp); + return (EINVAL); + } + + error = ext2_extattr_check(EXT2_FIRST_ENTRY(bp), + bp->b_data + bp->b_bufsize); + if (error) { + brelse(bp); + return (error); + } + + if (header->h_refcount > 1) { + error = ext2_extattr_block_clone(ip, &bp); + if (error) { + brelse(bp); + return (error); + } + + header = EXT2_HDR(bp); + } + + /* Find if entry exist */ + for (entry = EXT2_FIRST_ENTRY(bp); !EXT2_IS_LAST_ENTRY(entry); + entry = EXT2_EXTATTR_NEXT(entry)) { + if (ext2_extattr_index_to_bsd(entry->e_name_index) != attrnamespace) + continue; + + if (strlen(name) == entry->e_name_len && + 0 == strncmp(entry->e_name, name, entry->e_name_len)) + break; + } + + if (!EXT2_IS_LAST_ENTRY(entry)) { + size = ext2_extattr_get_size(EXT2_FIRST_ENTRY(bp), entry, + sizeof(struct ext2fs_extattr_header), + entry->e_name_len, uio->uio_resid); + if (size > bp->b_bufsize) { + brelse(bp); + return (ENOSPC); + } + + ext2_extattr_set_exist_entry(bp->b_data, EXT2_FIRST_ENTRY(bp), + entry, bp->b_data + bp->b_bufsize, uio); + } else { + size = ext2_extattr_get_size(EXT2_FIRST_ENTRY(bp), NULL, + sizeof(struct ext2fs_extattr_header), + strlen(name), uio->uio_resid); + if (size > bp->b_bufsize) { + brelse(bp); + return (ENOSPC); + } + + entry = ext2_extattr_set_new_entry(bp->b_data, EXT2_FIRST_ENTRY(bp), + name, attrnamespace, bp->b_data + bp->b_bufsize, uio); + + /* Clean the same entry in the inode */ + error = ext2_extattr_inode_delete(ip, attrnamespace, name); + if (error && error != ENOATTR) { + brelse(bp); + return (error); + } + } + + ext2_extattr_rehash(header, entry); + + return (bwrite(bp)); + } + + size = ext2_extattr_get_size(NULL, NULL, + sizeof(struct ext2fs_extattr_header), strlen(name), uio->uio_resid); + if (size > fs->e2fs_bsize) + return (ENOSPC); + + /* Allocate block, fill EA header and insert entry */ + ip->i_facl = ext2_allocfacl(ip); + if (0 == ip->i_facl) + return (ENOSPC); + + ip->i_blocks += btodb(fs->e2fs_bsize); + ext2_update(ip->i_vnode, 1); + + bp = getblk(ip->i_devvp, fsbtodb(fs, ip->i_facl), fs->e2fs_bsize, 0, 0, 0); + if (!bp) { + ext2_blkfree(ip, ip->i_facl, fs->e2fs_bsize); + ip->i_blocks -= btodb(fs->e2fs_bsize); + ip->i_facl = 0; + ext2_update(ip->i_vnode, 1); + return (EIO); + } + + header = EXT2_HDR(bp); + header->h_magic = EXTATTR_MAGIC; + header->h_refcount = 1; + header->h_blocks = 1; + header->h_hash = 0; + memset(header->h_reserved, 0, sizeof(header->h_reserved)); + memcpy(bp->b_data, header, sizeof(struct ext2fs_extattr_header)); + memset(EXT2_FIRST_ENTRY(bp), 0, sizeof(uint32_t)); + + entry = ext2_extattr_set_new_entry(bp->b_data, EXT2_FIRST_ENTRY(bp), + name, attrnamespace, bp->b_data + bp->b_bufsize, uio); + + /* Clean the same entry in the inode */ + error = ext2_extattr_inode_delete(ip, attrnamespace, name); + if (error && error != ENOATTR) { + brelse(bp); + return (error); + } + + ext2_extattr_rehash(header, entry); + + return (bwrite(bp)); +} + +int ext2_extattr_free(struct inode *ip) +{ + struct m_ext2fs *fs; + struct buf *bp; + struct ext2fs_extattr_header *header; + int error; + + fs = ip->i_e2fs; + + if (!ip->i_facl) + return (0); + + error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl), + fs->e2fs_bsize, NOCRED, &bp); + if (error) { + brelse(bp); + return (error); + } + + /* Check attributes magic value */ + header = EXT2_HDR(bp); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed May 3 22:52:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4CF7D5638E; Wed, 3 May 2017 22:52:04 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward5o.cmail.yandex.net (forward5o.cmail.yandex.net [IPv6:2a02:6b8:0:1a72::28a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 292F0A3C; Wed, 3 May 2017 22:52:04 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::25]) by forward5o.cmail.yandex.net (Yandex) with ESMTP id 08FE820BE7; Thu, 4 May 2017 01:52:01 +0300 (MSK) Received: from smtp1o.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp1o.mail.yandex.net (Yandex) with ESMTP id 1A0F6130042E; Thu, 4 May 2017 01:51:57 +0300 (MSK) Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id CpnZc3H0sl-pu8S9KGH; Thu, 04 May 2017 01:51:56 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1493851916; bh=7pccYpV4sLvmDKfqvuMT8BM4pnNDCo2uzaPRtwBPmU8=; h=Subject:To:Cc:References:From:Message-ID:Date:In-Reply-To; b=UKgBG1nJ6fln28xAT9BkkCluOky37OMoylnZ3Mn9K9s81ZAr6XQWOvHMopZjrTnjb dIPf8fMi+bNY3wDWG87yODkBKZ5Q2oOTe5ICzbQ4modDAApZm5nZ+dJGowkxaBjn6c PHPJEdwpdOE7qxPKH1t6rXVyofVEhZafcgO/BXQ4= Authentication-Results: smtp1o.mail.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-Suid-Status: 1 0,1 0,1 0,1 0,1 0,1 0 Subject: Re: svn commit: r317755 - head/sbin/ifconfig To: Alan Somers , Ian Lepore Cc: Ryan Stone , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" References: <201705031721.v43HL2vS071819@repo.freebsd.org> <1493838199.80042.14.camel@freebsd.org> From: "Andrey V. Elsukov" Openpgp: id=E6591E1B41DA1516F0C9BC0001C5EA0410C8A17A Message-ID: Date: Thu, 4 May 2017 01:50:46 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GrqsEu1TadqscE9equ0tV1tKhcHQrHfKA" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 22:52:04 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GrqsEu1TadqscE9equ0tV1tKhcHQrHfKA Content-Type: multipart/mixed; boundary="UjLdEKRNmjNoV45EpGsFdu10uceaFQja6"; protected-headers="v1" From: "Andrey V. Elsukov" To: Alan Somers , Ian Lepore Cc: Ryan Stone , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-ID: Subject: Re: svn commit: r317755 - head/sbin/ifconfig References: <201705031721.v43HL2vS071819@repo.freebsd.org> <1493838199.80042.14.camel@freebsd.org> In-Reply-To: --UjLdEKRNmjNoV45EpGsFdu10uceaFQja6 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 03.05.2017 22:22, Alan Somers wrote: > The problem with the original code is that module load errors would be > caught too late, and as a result the error printed would be less > useful. For example, if you forgot to put "kld_list=3Dif_igb" in > /etc/rc.conf and run "ifconfig igb0", it would print "ifconfig: > interface igb7 does not exist" instead of the more useful "ifconfig: > kldload(if_igb): Operation not permitted". But I didn't know that > there were drivers like mlx4en where ifconfig can't load the correct > module. So I'll take Ryan's suggestion and revert that part for now. I want to note, that there is if_enc(4) kernel module, that is failed to be loaded by ifconfig(8) due to presence in the kernel enc(4) driver (from sys/cam). --=20 WBR, Andrey V. Elsukov --UjLdEKRNmjNoV45EpGsFdu10uceaFQja6-- --GrqsEu1TadqscE9equ0tV1tKhcHQrHfKA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAlkKXscACgkQAcXqBBDI oXqUqwgAwDXtxNzdSsjII+aFKwMHPT8z4H7BW1Cobbths9LArpLfEbiMhSPkdKHz VCeRXAhK8nB0SIdJd11q8bVMbX/7QutnLK7p/D7i2ys8ExYF9opPGP4YposWVEil 1mTvnzDT+g9AZGJrbebJp5iZUxmW24VqYDJKs8mTi7+S8lbOTP6xHH6+0VxYVGHJ +WxfhNgttzbwkwyGUuHccqjfiJfuZi5p2GqBDAoPD4fh629sxXy6qY/pc2MVyW7C f6uzo4X8OWo47nTFX9vXlHFhTxjFgF3RhSDjIEI96fCSDZa/MSNtBbn1983ECo0a Ge6/aB4AT61KijTv1pS0PCnbMufd4A== =Zrdy -----END PGP SIGNATURE----- --GrqsEu1TadqscE9equ0tV1tKhcHQrHfKA-- From owner-svn-src-head@freebsd.org Wed May 3 23:05:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6CEAD565F5 for ; Wed, 3 May 2017 23:05:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x241.google.com (mail-it0-x241.google.com [IPv6:2607:f8b0:4001:c0b::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E26CFE3 for ; Wed, 3 May 2017 23:05:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x241.google.com with SMTP id x188so517894itb.3 for ; Wed, 03 May 2017 16:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=l2FRTF69E6+CpunT3F3aJ5WgFB9YdsqmjKMH0twjoWE=; b=jst2hYOdqebEFW41OH/U74gZVoyBGkAIF9qyihdv6grJuACBoY/1IPdsQAtv/1BklI ItI8KJy1fWlUBepRCXpiv6m50glueYfgHTnav8hZ9b6/2j6oWHA+zFZBFuaaLuw5EHLZ gOsGhSS0E9uBYXBVk8mfEV7K+FW88O7Ro/68FY2BlDh9Co3QYS1auZSPR94MD0kmypGt CiPJC2Al6zDpbFAvmFb+6fb4yKepBUOMK4XkmftwcSvM7UwfUF2UvyaDde/3DT/zlGLb 1dGROWe8BcHQCRkHjguTlPvVJ6hC3/f/QFELcum8afsThDVscwoxY5OEoLSqIKtR5D+W YFRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=l2FRTF69E6+CpunT3F3aJ5WgFB9YdsqmjKMH0twjoWE=; b=dYTFriv2jc6Mrix4q98hrn7zVC1u16R6xw3foF8DOxosUW7Kxicx3cXpj5ZNAjiBpw iJuzgj1vlVMHNHD4Tl45ahK6hCdfozc/0BqO6zunaRW3ioWxshYDgRjcmacXLB4xOz5/ ru5thuJBzd74O9PX/w2z/7R5ADhrlORntJB7VDZmtTU9F7UE4+PAKEDlrOI0D4Z6I5Xp GaIBBbFt35XamgsmbCB1drDoFaVsalwiLmEzoqVOY3AnntbfB8ZmV3wCK3vUB38EvWEC I81TglCVUZcgYAo60hYkraNAMrCno29W8uiXHWrg/n90NzDsMc3dnTrKLKDeyRdxJJqM B0Uw== X-Gm-Message-State: AN3rC/6/jP4OxtW/SDa6guLAMc/5hZd1QV+nGCL68abweebrhplwYqL1 J+ajrOdBVTOjpJSCuScZSiE6cqrFlg== X-Received: by 10.36.6.142 with SMTP id 136mr3567541itv.0.1493852711736; Wed, 03 May 2017 16:05:11 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.126.6 with HTTP; Wed, 3 May 2017 16:04:13 -0700 (PDT) X-Originating-IP: [2607:fb10:7021:1::44a] In-Reply-To: References: <201705031721.v43HL2vS071819@repo.freebsd.org> <1493838199.80042.14.camel@freebsd.org> From: Warner Losh Date: Wed, 3 May 2017 17:04:13 -0600 X-Google-Sender-Auth: FCCJEYip6O-18m2jbs_Tnte2Bxo Message-ID: Subject: Re: svn commit: r317755 - head/sbin/ifconfig To: "Andrey V. Elsukov" Cc: Alan Somers , Ian Lepore , Ryan Stone , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 23:05:12 -0000 On Wed, May 3, 2017 at 4:50 PM, Andrey V. Elsukov wrote: > On 03.05.2017 22:22, Alan Somers wrote: >> The problem with the original code is that module load errors would be >> caught too late, and as a result the error printed would be less >> useful. For example, if you forgot to put "kld_list=if_igb" in >> /etc/rc.conf and run "ifconfig igb0", it would print "ifconfig: >> interface igb7 does not exist" instead of the more useful "ifconfig: >> kldload(if_igb): Operation not permitted". But I didn't know that >> there were drivers like mlx4en where ifconfig can't load the correct >> module. So I'll take Ryan's suggestion and revert that part for now. > > I want to note, that there is if_enc(4) kernel module, that is failed to > be loaded by ifconfig(8) due to presence in the kernel enc(4) driver > (from sys/cam). There shouldn't be two drivers with the same name. That's a bug, but it's been like this for 4 years... Warner From owner-svn-src-head@freebsd.org Wed May 3 23:20:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92B4DD569A9; Wed, 3 May 2017 23:20:34 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x230.google.com (mail-qk0-x230.google.com [IPv6:2607:f8b0:400d:c09::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FB291865; Wed, 3 May 2017 23:20:34 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x230.google.com with SMTP id k74so3837532qke.1; Wed, 03 May 2017 16:20:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=jMgcTLVay/6K4xYNg6UqZfnx+s+UZbmt5EW2heYsOeM=; b=DjyJP5YoGeKN2S/tKVJ4m4e1kOvlz+afcK1Y5sZfNBfgJVQ0gGk8xE97SbDBgbUdrd Bu/92LG1iLOyjxEBCk59ZbO6TVJgVwH47Rq5v+VRsON8f9lYs/FO6JkjCdZIEptRvJQz 1FU9iE252gWXSl+8FUEXDD7MSLoqXxdD4igWEF/9WuCcOKb/LTAyRi8X9Pk9L5qms/Vd oanuGD2If52mGFaMKeyVzTISuKRCjWlcaJv8VgHZvVCF0Mr3uJGbhvROPGajHWG/X9Aq GigdW+109FCVyCW9ijqTHv/edRecUp6WUMi/oXC5zYS/LD3HglEdZeZEwVImY9y8yAvm 58oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=jMgcTLVay/6K4xYNg6UqZfnx+s+UZbmt5EW2heYsOeM=; b=uBm4VuCc2ohKtbfyr35KCiHEkxnzsrJUru5Jkgzb9zRa9j2xX9NHw6HRYDu3BfcL1k siMHytWaTUOb8/rQ/m8pLi/kemwf7FVLArHb2pLwerYWlj1Yi8YWUETkBKsb3zxI7xn3 G5EWNDSHVLT7eAbqFO6h6X7LsAJtiwCrjRSLpgQE+M8HHBHUln4q9P4BmArMMswo0KIz drUEEeDyFn6KudksdRurnkNqBZVImrjeXc+tlnp8Lwmkhaz9IlkjAqpYT3kwGWtonZJn RBtKOsuWRrT3kJeRl2bNbfPk3TQTgByVKgbKFLnfZ54ClbBOgh3pCOImwfYaQr+7BTcA NIVw== X-Gm-Message-State: AODbwcBPLck8l6ry9puFFfhTF5599RE1MMSZ57aCuvCxzT6FvGGmJDRC 07VYtSgAlZ67RACcFafvFj33WCintZbm X-Received: by 10.55.143.129 with SMTP id r123mr5580895qkd.98.1493853633116; Wed, 03 May 2017 16:20:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.93.83 with HTTP; Wed, 3 May 2017 16:20:32 -0700 (PDT) In-Reply-To: <201705032235.v43MZf1n006000@repo.freebsd.org> References: <201705032235.v43MZf1n006000@repo.freebsd.org> From: Ngie Cooper Date: Wed, 3 May 2017 16:20:32 -0700 Message-ID: Subject: Re: svn commit: r317779 - head/sys/fs/ext2fs To: "Pedro F. Giffuni" Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 23:20:34 -0000 On Wed, May 3, 2017 at 3:35 PM, Pedro F. Giffuni wrote: > Author: pfg > Date: Wed May 3 22:35:41 2017 > New Revision: 317779 > URL: https://svnweb.freebsd.org/changeset/base/317779 > > Log: > ext2fs: add read-write support for Extended Attributes. > > Extended attributes and their particular implementation in linux are > different from FreeBSD so in this case we have started diverging from > the UFS EA implementation, which would be the natural reference. > > Depending on future progress implementing ACLs this approach may change > but for now bring to the tree an implementation that is consistent and > can be tested. > > Submitted by: Fedor Uporov > > Differential Revision: https://reviews.freebsd.org/D10460 Hi Pedro! It might be a good idea to consolidate variations of extended attributes / [NFSv4] ACLs -- I know that Isilon has an implementation that doesn't exactly match what's present in FreeBSD. Thanks! -Ngie From owner-svn-src-head@freebsd.org Thu May 4 00:04:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4BFB3D5C97A; Thu, 4 May 2017 00:04:21 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11DEEBE4; Thu, 4 May 2017 00:04:21 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4404Kvn044294; Thu, 4 May 2017 00:04:20 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4404Hru044263; Thu, 4 May 2017 00:04:17 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201705040004.v4404Hru044263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Thu, 4 May 2017 00:04:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317782 - in head: contrib/libarchive/cpio contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/test_utils lib/libarchive/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 00:04:21 -0000 Author: mm Date: Thu May 4 00:04:17 2017 New Revision: 317782 URL: https://svnweb.freebsd.org/changeset/base/317782 Log: MFV r317781: Sync libarchive with vendor Vendor changes (FreeBSD-related): PR 897: add test for ZIP archives with invalid EOCD headers PR 901: fix invalid renaming of sparse files OSS-Fuzz issue 497: remove fallback tree in LZX decoder OSS-Fuzz issue 527: rewrite expressions in lz4 filter OSS-Fuzz issue 577: fix integer overflow in cpio reader OSS-Fuzz issue 862: fix numerc parsing in mtree reader OSS-Fuzz issue 1097: fix undefined shift in rar reader cpio: various optimizations and memory leak fixes MFC after: 1 week Added: head/contrib/libarchive/libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.c - copied unchanged from r317781, vendor/libarchive/dist/libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.c head/contrib/libarchive/libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.zip.uu - copied unchanged from r317781, vendor/libarchive/dist/libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.zip.uu Modified: head/contrib/libarchive/cpio/cpio.c head/contrib/libarchive/cpio/test/test_option_Z_upper.c head/contrib/libarchive/cpio/test/test_option_a.c head/contrib/libarchive/cpio/test/test_option_b64encode.c head/contrib/libarchive/cpio/test/test_option_grzip.c head/contrib/libarchive/cpio/test/test_option_lrzip.c head/contrib/libarchive/cpio/test/test_option_lz4.c head/contrib/libarchive/cpio/test/test_option_lzma.c head/contrib/libarchive/cpio/test/test_option_lzop.c head/contrib/libarchive/cpio/test/test_option_uuencode.c head/contrib/libarchive/cpio/test/test_option_xz.c head/contrib/libarchive/cpio/test/test_option_y.c head/contrib/libarchive/cpio/test/test_option_z.c head/contrib/libarchive/libarchive/archive_entry_sparse.c head/contrib/libarchive/libarchive/archive_getdate.c head/contrib/libarchive/libarchive/archive_openssl_hmac_private.h head/contrib/libarchive/libarchive/archive_read.c head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c head/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c head/contrib/libarchive/libarchive/archive_read_support_format_cab.c head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c head/contrib/libarchive/libarchive/archive_read_support_format_rar.c head/contrib/libarchive/libarchive/archive_string.c head/contrib/libarchive/libarchive/archive_write_set_format_pax.c head/contrib/libarchive/libarchive/libarchive_changes.3 head/contrib/libarchive/libarchive/test/test_read_format_mtree.c head/contrib/libarchive/libarchive/test/test_write_format_pax.c head/contrib/libarchive/libarchive/test/test_write_format_zip_compression_store.c head/contrib/libarchive/libarchive/test/test_write_format_zip_large.c head/contrib/libarchive/libarchive/xxhash.c head/contrib/libarchive/test_utils/test_main.c head/lib/libarchive/tests/Makefile Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/cpio/cpio.c ============================================================================== --- head/contrib/libarchive/cpio/cpio.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/cpio/cpio.c Thu May 4 00:04:17 2017 (r317782) @@ -628,6 +628,7 @@ mode_out(struct cpio *cpio) blocks == 1 ? "block" : "blocks"); } archive_write_free(cpio->archive); + archive_entry_linkresolver_free(cpio->linkresolver); } static const char * @@ -1194,12 +1195,15 @@ mode_pass(struct cpio *cpio, const char struct lafe_line_reader *lr; const char *p; int r; + size_t destdir_len; /* Ensure target dir has a trailing '/' to simplify path surgery. */ - cpio->destdir = malloc(strlen(destdir) + 8); - strcpy(cpio->destdir, destdir); - if (destdir[strlen(destdir) - 1] != '/') - strcat(cpio->destdir, "/"); + destdir_len = strlen(destdir); + cpio->destdir = malloc(destdir_len + 8); + memcpy(cpio->destdir, destdir, destdir_len); + if (destdir_len == 0 || destdir[destdir_len - 1] != '/') + cpio->destdir[destdir_len++] = '/'; + cpio->destdir[destdir_len++] = '\0'; cpio->archive = archive_write_disk_new(); if (cpio->archive == NULL) @@ -1240,6 +1244,7 @@ mode_pass(struct cpio *cpio, const char } archive_write_free(cpio->archive); + free(cpio->pass_destpath); } /* Modified: head/contrib/libarchive/cpio/test/test_option_Z_upper.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_Z_upper.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/cpio/test/test_option_Z_upper.c Thu May 4 00:04:17 2017 (r317782) @@ -43,17 +43,18 @@ DEFINE_TEST(test_option_Z_upper) if (strstr(p, "compression not available") != NULL) { skipping("This version of bsdcpio was compiled " "without compress support"); + free(p); return; } failure("-Z option is broken"); assertEqualInt(r, 0); - goto done; + free(p); + return; } free(p); /* Check that the archive file has a compress signature. */ p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "\x1f\x9d", 2); -done: free(p); } Modified: head/contrib/libarchive/cpio/test/test_option_a.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_a.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/cpio/test/test_option_a.c Thu May 4 00:04:17 2017 (r317782) @@ -96,7 +96,8 @@ DEFINE_TEST(test_option_a) test_create(); /* Sanity check; verify that atimes really do get modified. */ - assert((p = slurpfile(NULL, "f0")) != NULL); + p = slurpfile(NULL, "f0"); + assert(p != NULL); free(p); assertEqualInt(0, stat("f0", &st)); if (st.st_atime == files[0].atime_sec) { Modified: head/contrib/libarchive/cpio/test/test_option_b64encode.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_b64encode.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/cpio/test/test_option_b64encode.c Thu May 4 00:04:17 2017 (r317782) @@ -42,6 +42,7 @@ DEFINE_TEST(test_option_b64encode) p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "begin-base64 644", 16); + free(p); /* Archive it with uuencode only. */ assertEqualInt(0, @@ -51,4 +52,5 @@ DEFINE_TEST(test_option_b64encode) p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "begin-base64 644", 16); + free(p); } Modified: head/contrib/libarchive/cpio/test/test_option_grzip.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_grzip.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/cpio/test/test_option_grzip.c Thu May 4 00:04:17 2017 (r317782) @@ -44,9 +44,10 @@ DEFINE_TEST(test_option_grzip) systemf("echo f | %s -o --grzip >archive.out 2>archive.err", testprog)); p = slurpfile(&s, "archive.err"); - p[s] = '\0'; + free(p); /* Check that the archive file has an grzip signature. */ p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "GRZipII\x00\x02\x04:)", 12); + free(p); } Modified: head/contrib/libarchive/cpio/test/test_option_lrzip.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_lrzip.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/cpio/test/test_option_lrzip.c Thu May 4 00:04:17 2017 (r317782) @@ -44,9 +44,10 @@ DEFINE_TEST(test_option_lrzip) systemf("echo f | %s -o --lrzip >archive.out 2>archive.err", testprog)); p = slurpfile(&s, "archive.err"); - p[s] = '\0'; + free(p); /* Check that the archive file has an lzma signature. */ p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "LRZI\x00", 5); + free(p); } Modified: head/contrib/libarchive/cpio/test/test_option_lz4.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_lz4.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/cpio/test/test_option_lz4.c Thu May 4 00:04:17 2017 (r317782) @@ -43,6 +43,7 @@ DEFINE_TEST(test_option_lz4) if (strstr(p, "compression not available") != NULL) { skipping("This version of bsdcpio was compiled " "without lz4 support"); + free(p); return; } /* POSIX permits different handling of the spawnp @@ -52,6 +53,7 @@ DEFINE_TEST(test_option_lz4) if (strstr(p, "Can't launch") != NULL && !canLz4()) { skipping("This version of bsdcpio uses an external lz4 program " "but no such program is available on this system."); + free(p); return; } /* Some systems successfully spawn the new process, @@ -61,6 +63,7 @@ DEFINE_TEST(test_option_lz4) if (strstr(p, "Can't write") != NULL && !canLz4()) { skipping("This version of bsdcpio uses an external lz4 program " "but no such program is available on this system."); + free(p); return; } /* On some systems the error won't be detected until closing @@ -68,14 +71,18 @@ DEFINE_TEST(test_option_lz4) if (strstr(p, "Error closing") != NULL && !canLz4()) { skipping("This version of bsdcpio uses an external lz4 program " "but no such program is available on this system."); + free(p); return; } + free(p); failure("--lz4 option is broken: %s", p); assertEqualInt(r, 0); return; } + free(p); /* Check that the archive file has an lz4 signature. */ p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "\x04\x22\x4d\x18", 4); + free(p); } Modified: head/contrib/libarchive/cpio/test/test_option_lzma.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_lzma.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/cpio/test/test_option_lzma.c Thu May 4 00:04:17 2017 (r317782) @@ -43,14 +43,18 @@ DEFINE_TEST(test_option_lzma) if (strstr(p, "compression not available") != NULL) { skipping("This version of bsdcpio was compiled " "without lzma support"); + free(p); return; } failure("--lzma option is broken"); assertEqualInt(r, 0); + free(p); return; } + free(p); /* Check that the archive file has an lzma signature. */ p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "\x5d\00\00", 3); + free(p); } Modified: head/contrib/libarchive/cpio/test/test_option_lzop.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_lzop.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/cpio/test/test_option_lzop.c Thu May 4 00:04:17 2017 (r317782) @@ -39,7 +39,7 @@ DEFINE_TEST(test_option_lzop) r = systemf("echo f | %s -o --lzop >archive.out 2>archive.err", testprog); p = slurpfile(&s, "archive.err"); - p[s] = '\0'; + free(p); if (r != 0) { if (!canLzop()) { skipping("lzop is not supported on this platform"); @@ -53,4 +53,5 @@ DEFINE_TEST(test_option_lzop) p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a", 9); + free(p); } Modified: head/contrib/libarchive/cpio/test/test_option_uuencode.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_uuencode.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/cpio/test/test_option_uuencode.c Thu May 4 00:04:17 2017 (r317782) @@ -42,6 +42,7 @@ DEFINE_TEST(test_option_uuencode) p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "begin 644", 9); + free(p); /* Archive it with uuencode only. */ assertEqualInt(0, @@ -51,4 +52,5 @@ DEFINE_TEST(test_option_uuencode) p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "begin 644", 9); + free(p); } Modified: head/contrib/libarchive/cpio/test/test_option_xz.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_xz.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/cpio/test/test_option_xz.c Thu May 4 00:04:17 2017 (r317782) @@ -44,14 +44,18 @@ DEFINE_TEST(test_option_xz) if (strstr(p, "compression not available") != NULL) { skipping("This version of bsdcpio was compiled " "without xz support"); + free(p); return; } + free(p); failure("--xz option is broken"); assertEqualInt(r, 0); return; } + free(p); /* Check that the archive file has an xz signature. */ p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "\xFD\x37\x7A\x58\x5A\x00", 6); + free(p); } Modified: head/contrib/libarchive/cpio/test/test_option_y.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_y.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/cpio/test/test_option_y.c Thu May 4 00:04:17 2017 (r317782) @@ -38,7 +38,7 @@ DEFINE_TEST(test_option_y) r = systemf("echo f | %s -oy >archive.out 2>archive.err", testprog); p = slurpfile(&s, "archive.err"); - p[s] = '\0'; + free(p); if (r != 0) { if (!canBzip2()) { skipping("bzip2 is not supported on this platform"); @@ -46,14 +46,12 @@ DEFINE_TEST(test_option_y) } failure("-y option is broken"); assertEqualInt(r, 0); - goto done; + return; } assertTextFileContents("1 block\n", "archive.err"); /* Check that the archive file has a bzip2 signature. */ - free(p); p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "BZh9", 4); -done: free(p); } Modified: head/contrib/libarchive/cpio/test/test_option_z.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_z.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/cpio/test/test_option_z.c Thu May 4 00:04:17 2017 (r317782) @@ -38,7 +38,7 @@ DEFINE_TEST(test_option_z) r = systemf("echo f | %s -oz >archive.out 2>archive.err", testprog); p = slurpfile(&s, "archive.err"); - p[s] = '\0'; + free(p); if (r != 0) { if (!canGzip()) { skipping("gzip is not supported on this platform"); @@ -52,4 +52,5 @@ DEFINE_TEST(test_option_z) p = slurpfile(&s, "archive.out"); assert(s > 4); assertEqualMem(p, "\x1f\x8b\x08\x00", 4); + free(p); } Modified: head/contrib/libarchive/libarchive/archive_entry_sparse.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_sparse.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/archive_entry_sparse.c Thu May 4 00:04:17 2017 (r317782) @@ -51,7 +51,7 @@ archive_entry_sparse_clear(struct archiv void archive_entry_sparse_add_entry(struct archive_entry *entry, - int64_t offset, int64_t length) + la_int64_t offset, la_int64_t length) { struct ae_sparse *sp; @@ -135,7 +135,7 @@ archive_entry_sparse_reset(struct archiv int archive_entry_sparse_next(struct archive_entry * entry, - int64_t *offset, int64_t *length) + la_int64_t *offset, la_int64_t *length) { if (entry->sparse_p) { *offset = entry->sparse_p->offset; Modified: head/contrib/libarchive/libarchive/archive_getdate.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_getdate.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/archive_getdate.c Thu May 4 00:04:17 2017 (r317782) @@ -691,7 +691,7 @@ Convert(time_t Month, time_t Day, time_t time_t Hours, time_t Minutes, time_t Seconds, time_t Timezone, enum DSTMODE DSTmode) { - int DaysInMonth[12] = { + signed char DaysInMonth[12] = { 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; time_t Julian; Modified: head/contrib/libarchive/libarchive/archive_openssl_hmac_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_openssl_hmac_private.h Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/archive_openssl_hmac_private.h Thu May 4 00:04:17 2017 (r317782) @@ -28,7 +28,7 @@ #include #include -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) #include /* malloc, free */ #include /* memset */ static inline HMAC_CTX *HMAC_CTX_new(void) Modified: head/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/archive_read.c Thu May 4 00:04:17 2017 (r317782) @@ -881,7 +881,8 @@ archive_read_data(struct archive *_a, vo len = a->read_data_remaining; if (len > s) len = s; - memcpy(dest, a->read_data_block, len); + if (len) + memcpy(dest, a->read_data_block, len); s -= len; a->read_data_block += len; a->read_data_remaining -= len; Modified: head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Thu May 4 00:04:17 2017 (r317782) @@ -928,11 +928,10 @@ setup_sparse(struct archive_read_disk *a return (ARCHIVE_OK); /* Does filesystem support the reporting of hole ? */ - if (*fd < 0) { + if (*fd < 0) path = archive_read_disk_entry_setup_path(a, entry, fd); - if (path == NULL) - return (ARCHIVE_FAILED); - } + else + path = NULL; if (*fd >= 0) { #ifdef _PC_MIN_HOLE_SIZE @@ -943,6 +942,8 @@ setup_sparse(struct archive_read_disk *a if (initial_off != 0) lseek(*fd, 0, SEEK_SET); } else { + if (path == NULL) + return (ARCHIVE_FAILED); #ifdef _PC_MIN_HOLE_SIZE if (pathconf(path, _PC_MIN_HOLE_SIZE) <= 0) return (ARCHIVE_OK); Modified: head/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c Thu May 4 00:04:17 2017 (r317782) @@ -494,7 +494,7 @@ lz4_filter_read_data_block(struct archiv if (read_buf == NULL) goto truncated_error; compressed_size = archive_le32dec(read_buf); - if ((compressed_size & ~(1 << 31)) > state->flags.block_maximum_size) + if ((compressed_size & 0x7fffffff) > state->flags.block_maximum_size) goto malformed_error; /* A compressed size == 0 means the end of stream blocks. */ if (compressed_size == 0) { @@ -504,8 +504,8 @@ lz4_filter_read_data_block(struct archiv checksum_size = state->flags.block_checksum; /* Check if the block is uncompressed. */ - if (compressed_size & (1 << 31)) { - compressed_size &= ~(1 << 31); + if (compressed_size & 0x80000000U) { + compressed_size &= 0x7fffffff; uncompressed_size = compressed_size; } else uncompressed_size = 0;/* Unknown yet. */ Modified: head/contrib/libarchive/libarchive/archive_read_support_format_cab.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_cab.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/archive_read_support_format_cab.c Thu May 4 00:04:17 2017 (r317782) @@ -116,19 +116,11 @@ struct lzx_dec { * coding tree, which is a binary tree. But a use of a large * index table causes L1 cache read miss many times. */ -#define HTBL_BITS 10 int max_bits; - int shift_bits; int tbl_bits; int tree_used; - int tree_avail; /* Direct access table. */ uint16_t *tbl; - /* Binary tree table for extra bits over the direct access. */ - struct htree_t { - uint16_t left; - uint16_t right; - } *tree; } at, lt, mt, pt; int loop; @@ -352,7 +344,6 @@ static int lzx_huffman_init(struct huffm static void lzx_huffman_free(struct huffman *); static int lzx_make_huffman_table(struct huffman *); static inline int lzx_decode_huffman(struct huffman *, unsigned); -static int lzx_decode_huffman_tree(struct huffman *, unsigned, int); int @@ -3127,7 +3118,6 @@ getdata: static int lzx_huffman_init(struct huffman *hf, size_t len_size, int tbl_bits) { - int bits; if (hf->bitlen == NULL || hf->len_size != (int)len_size) { free(hf->bitlen); @@ -3138,21 +3128,11 @@ lzx_huffman_init(struct huffman *hf, siz } else memset(hf->bitlen, 0, len_size * sizeof(hf->bitlen[0])); if (hf->tbl == NULL) { - if (tbl_bits < HTBL_BITS) - bits = tbl_bits; - else - bits = HTBL_BITS; - hf->tbl = malloc(((size_t)1 << bits) * sizeof(hf->tbl[0])); + hf->tbl = malloc(((size_t)1 << tbl_bits) * sizeof(hf->tbl[0])); if (hf->tbl == NULL) return (ARCHIVE_FATAL); hf->tbl_bits = tbl_bits; } - if (hf->tree == NULL && tbl_bits > HTBL_BITS) { - hf->tree_avail = 1 << (tbl_bits - HTBL_BITS + 4); - hf->tree = malloc(hf->tree_avail * sizeof(hf->tree[0])); - if (hf->tree == NULL) - return (ARCHIVE_FATAL); - } return (ARCHIVE_OK); } @@ -3161,7 +3141,6 @@ lzx_huffman_free(struct huffman *hf) { free(hf->bitlen); free(hf->tbl); - free(hf->tree); } /* @@ -3174,7 +3153,7 @@ lzx_make_huffman_table(struct huffman *h const unsigned char *bitlen; int bitptn[17], weight[17]; int i, maxbits = 0, ptn, tbl_size, w; - int diffbits, len_avail; + int len_avail; /* * Initialize bit patterns. @@ -3205,28 +3184,11 @@ lzx_make_huffman_table(struct huffman *h weight[i] >>= ebits; } } - if (maxbits > HTBL_BITS) { - int htbl_max; - uint16_t *p; - - diffbits = maxbits - HTBL_BITS; - for (i = 1; i <= HTBL_BITS; i++) { - bitptn[i] >>= diffbits; - weight[i] >>= diffbits; - } - htbl_max = bitptn[HTBL_BITS] + - weight[HTBL_BITS] * hf->freq[HTBL_BITS]; - p = &(hf->tbl[htbl_max]); - while (p < &hf->tbl[1U<shift_bits = diffbits; /* * Make the table. */ - tbl_size = 1 << HTBL_BITS; + tbl_size = 1 << hf->tbl_bits; tbl = hf->tbl; bitlen = hf->bitlen; len_avail = hf->len_size; @@ -3234,120 +3196,32 @@ lzx_make_huffman_table(struct huffman *h for (i = 0; i < len_avail; i++) { uint16_t *p; int len, cnt; - uint16_t bit; - int extlen; - struct htree_t *ht; if (bitlen[i] == 0) continue; /* Get a bit pattern */ len = bitlen[i]; + if (len > tbl_size) + return (0); ptn = bitptn[len]; cnt = weight[len]; - if (len <= HTBL_BITS) { - /* Calculate next bit pattern */ - if ((bitptn[len] = ptn + cnt) > tbl_size) - return (0);/* Invalid */ - /* Update the table */ - p = &(tbl[ptn]); - while (--cnt >= 0) - p[cnt] = (uint16_t)i; - continue; - } - - /* - * A bit length is too big to be housed to a direct table, - * so we use a tree model for its extra bits. - */ - bitptn[len] = ptn + cnt; - bit = 1U << (diffbits -1); - extlen = len - HTBL_BITS; - - p = &(tbl[ptn >> diffbits]); - if (*p == 0) { - *p = len_avail + hf->tree_used; - ht = &(hf->tree[hf->tree_used++]); - if (hf->tree_used > hf->tree_avail) - return (0);/* Invalid */ - ht->left = 0; - ht->right = 0; - } else { - if (*p < len_avail || - *p >= (len_avail + hf->tree_used)) - return (0);/* Invalid */ - ht = &(hf->tree[*p - len_avail]); - } - while (--extlen > 0) { - if (ptn & bit) { - if (ht->left < len_avail) { - ht->left = len_avail + hf->tree_used; - ht = &(hf->tree[hf->tree_used++]); - if (hf->tree_used > hf->tree_avail) - return (0);/* Invalid */ - ht->left = 0; - ht->right = 0; - } else { - ht = &(hf->tree[ht->left - len_avail]); - } - } else { - if (ht->right < len_avail) { - ht->right = len_avail + hf->tree_used; - ht = &(hf->tree[hf->tree_used++]); - if (hf->tree_used > hf->tree_avail) - return (0);/* Invalid */ - ht->left = 0; - ht->right = 0; - } else { - ht = &(hf->tree[ht->right - len_avail]); - } - } - bit >>= 1; - } - if (ptn & bit) { - if (ht->left != 0) - return (0);/* Invalid */ - ht->left = (uint16_t)i; - } else { - if (ht->right != 0) - return (0);/* Invalid */ - ht->right = (uint16_t)i; - } + /* Calculate next bit pattern */ + if ((bitptn[len] = ptn + cnt) > tbl_size) + return (0);/* Invalid */ + /* Update the table */ + p = &(tbl[ptn]); + while (--cnt >= 0) + p[cnt] = (uint16_t)i; } return (1); } -static int -lzx_decode_huffman_tree(struct huffman *hf, unsigned rbits, int c) -{ - struct htree_t *ht; - int extlen; - - ht = hf->tree; - extlen = hf->shift_bits; - while (c >= hf->len_size) { - c -= hf->len_size; - if (extlen-- <= 0 || c >= hf->tree_used) - return (0); - if (rbits & (1U << extlen)) - c = ht[c].left; - else - c = ht[c].right; - } - return (c); -} - static inline int lzx_decode_huffman(struct huffman *hf, unsigned rbits) { int c; - /* - * At first search an index table for a bit pattern. - * If it fails, search a huffman tree for. - */ - c = hf->tbl[rbits >> hf->shift_bits]; + c = hf->tbl[rbits]; if (c < hf->len_size) return (c); - /* This bit pattern needs to be found out at a huffman tree. */ - return (lzx_decode_huffman_tree(hf, rbits, c)); + return (0); } - Modified: head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Thu May 4 00:04:17 2017 (r317782) @@ -165,7 +165,7 @@ __FBSDID("$FreeBSD$"); struct links_entry { struct links_entry *next; struct links_entry *previous; - int links; + unsigned int links; dev_t dev; int64_t ino; char *name; Modified: head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c Thu May 4 00:04:17 2017 (r317782) @@ -3021,8 +3021,9 @@ heap_add_entry(struct archive_read *a, s ENOMEM, "Out of memory"); return (ARCHIVE_FATAL); } - memcpy(new_pending_files, heap->files, - heap->allocated * sizeof(new_pending_files[0])); + if (heap->allocated) + memcpy(new_pending_files, heap->files, + heap->allocated * sizeof(new_pending_files[0])); if (heap->files != NULL) free(heap->files); heap->files = new_pending_files; Modified: head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Thu May 4 00:04:17 2017 (r317782) @@ -130,9 +130,7 @@ static ssize_t readline(struct archive_r static int skip(struct archive_read *a); static int read_header(struct archive_read *, struct archive_entry *); -static int64_t mtree_atol10(char **); -static int64_t mtree_atol8(char **); -static int64_t mtree_atol(char **); +static int64_t mtree_atol(char **, int base); /* * There's no standard for TIME_T_MAX/TIME_T_MIN. So we compute them @@ -1418,7 +1416,7 @@ parse_device(dev_t *pdev, struct archive "Too many arguments"); return ARCHIVE_WARN; } - numbers[argc++] = (unsigned long)mtree_atol(&p); + numbers[argc++] = (unsigned long)mtree_atol(&p, 0); } if (argc < 2) { archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, @@ -1433,7 +1431,7 @@ parse_device(dev_t *pdev, struct archive } } else { /* file system raw value. */ - result = (dev_t)mtree_atol(&val); + result = (dev_t)mtree_atol(&val, 0); } *pdev = result; return ARCHIVE_OK; @@ -1513,7 +1511,7 @@ parse_keyword(struct archive_read *a, st case 'g': if (strcmp(key, "gid") == 0) { *parsed_kws |= MTREE_HAS_GID; - archive_entry_set_gid(entry, mtree_atol10(&val)); + archive_entry_set_gid(entry, mtree_atol(&val, 10)); break; } if (strcmp(key, "gname") == 0) { @@ -1523,7 +1521,7 @@ parse_keyword(struct archive_read *a, st } case 'i': if (strcmp(key, "inode") == 0) { - archive_entry_set_ino(entry, mtree_atol10(&val)); + archive_entry_set_ino(entry, mtree_atol(&val, 10)); break; } case 'l': @@ -1535,14 +1533,14 @@ parse_keyword(struct archive_read *a, st if (strcmp(key, "md5") == 0 || strcmp(key, "md5digest") == 0) break; if (strcmp(key, "mode") == 0) { - if (val[0] >= '0' && val[0] <= '9') { + if (val[0] >= '0' && val[0] <= '7') { *parsed_kws |= MTREE_HAS_PERM; archive_entry_set_perm(entry, - (mode_t)mtree_atol8(&val)); + (mode_t)mtree_atol(&val, 8)); } else { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Symbolic mode \"%s\" unsupported", val); + "Symbolic or non-octal mode \"%s\" unsupported", val); return ARCHIVE_WARN; } break; @@ -1551,7 +1549,7 @@ parse_keyword(struct archive_read *a, st if (strcmp(key, "nlink") == 0) { *parsed_kws |= MTREE_HAS_NLINK; archive_entry_set_nlink(entry, - (unsigned int)mtree_atol10(&val)); + (unsigned int)mtree_atol(&val, 10)); break; } case 'r': @@ -1582,7 +1580,7 @@ parse_keyword(struct archive_read *a, st strcmp(key, "sha512digest") == 0) break; if (strcmp(key, "size") == 0) { - archive_entry_set_size(entry, mtree_atol10(&val)); + archive_entry_set_size(entry, mtree_atol(&val, 10)); break; } case 't': @@ -1601,13 +1599,13 @@ parse_keyword(struct archive_read *a, st long ns = 0; *parsed_kws |= MTREE_HAS_MTIME; - m = mtree_atol10(&val); + m = mtree_atol(&val, 10); /* Replicate an old mtree bug: * 123456789.1 represents 123456789 * seconds and 1 nanosecond. */ if (*val == '.') { ++val; - ns = (long)mtree_atol10(&val); + ns = (long)mtree_atol(&val, 10); if (ns < 0) ns = 0; else if (ns > 999999999) @@ -1670,7 +1668,7 @@ parse_keyword(struct archive_read *a, st case 'u': if (strcmp(key, "uid") == 0) { *parsed_kws |= MTREE_HAS_UID; - archive_entry_set_uid(entry, mtree_atol10(&val)); + archive_entry_set_uid(entry, mtree_atol(&val, 10)); break; } if (strcmp(key, "uname") == 0) { @@ -1825,77 +1823,9 @@ parse_escapes(char *src, struct mtree_en *dest = '\0'; } -/* - * Note that this implementation does not (and should not!) obey - * locale settings; you cannot simply substitute strtol here, since - * it does obey locale. - */ -static int64_t -mtree_atol8(char **p) -{ - int64_t l, limit, last_digit_limit; - int digit, base; - - base = 8; - limit = INT64_MAX / base; - last_digit_limit = INT64_MAX % base; - - l = 0; - digit = **p - '0'; - while (digit >= 0 && digit < base) { - if (l>limit || (l == limit && digit > last_digit_limit)) { - l = INT64_MAX; /* Truncate on overflow. */ - break; - } - l = (l * base) + digit; - digit = *++(*p) - '0'; - } - return (l); -} - -/* - * Note that this implementation does not (and should not!) obey - * locale settings; you cannot simply substitute strtol here, since - * it does obey locale. - * - * Convert the number pointed to by 'p' into a 64-bit signed integer. - * On return, 'p' points to the first non-digit following the number. - * On overflow, the function returns INT64_MIN or INT64_MAX. - */ -static int64_t -mtree_atol10(char **p) -{ - const int base = 10; - const int64_t limit = INT64_MAX / base; - const int64_t last_digit_limit = INT64_MAX % base; - int64_t l; - int sign; - - if (**p == '-') { - sign = -1; - ++(*p); - } else { - sign = 1; - } - - l = 0; - while (**p >= '0' && **p < '0' + base) { - int digit = **p - '0'; - if (l > limit || (l == limit && digit > last_digit_limit)) { - while (**p >= '0' && **p < '0' + base) { - ++(*p); - } - return (sign < 0) ? INT64_MIN : INT64_MAX; - } - l = (l * base) + digit; - ++(*p); - } - return (sign < 0) ? -l : l; -} - /* Parse a hex digit. */ static int -parsehex(char c) +parsedigit(char c) { if (c >= '0' && c <= '9') return c - '0'; @@ -1913,45 +1843,50 @@ parsehex(char c) * it does obey locale. */ static int64_t -mtree_atol16(char **p) +mtree_atol(char **p, int base) { - int64_t l, limit, last_digit_limit; - int base, digit, sign; + int64_t l, limit; + int digit, last_digit_limit; - base = 16; + if (base == 0) { + if (**p != '0') + base = 10; + else if ((*p)[1] == 'x' || (*p)[1] == 'X') { + *p += 2; + base = 16; + } else { + base = 8; + } + } if (**p == '-') { - sign = -1; - limit = ((uint64_t)(INT64_MAX) + 1) / base; - last_digit_limit = ((uint64_t)(INT64_MAX) + 1) % base; + limit = INT64_MIN / base; + last_digit_limit = INT64_MIN % base; ++(*p); + + l = 0; + digit = parsedigit(**p); + while (digit >= 0 && digit < base) { + if (l < limit || (l == limit && digit > last_digit_limit)) + return INT64_MIN; + l = (l * base) - digit; + digit = parsedigit(*++(*p)); + } + return l; } else { - sign = 1; limit = INT64_MAX / base; last_digit_limit = INT64_MAX % base; - } - l = 0; - digit = parsehex(**p); - while (digit >= 0 && digit < base) { - if (l > limit || (l == limit && digit > last_digit_limit)) - return (sign < 0) ? INT64_MIN : INT64_MAX; - l = (l * base) + digit; - digit = parsehex(*++(*p)); - } - return (sign < 0) ? -l : l; -} - -static int64_t -mtree_atol(char **p) -{ - if (**p != '0') - return mtree_atol10(p); - if ((*p)[1] == 'x' || (*p)[1] == 'X') { - *p += 2; - return mtree_atol16(p); + l = 0; + digit = parsedigit(**p); + while (digit >= 0 && digit < base) { + if (l > limit || (l == limit && digit > last_digit_limit)) + return INT64_MAX; + l = (l * base) + digit; + digit = parsedigit(*++(*p)); + } + return l; } - return mtree_atol8(p); } /* Modified: head/contrib/libarchive/libarchive/archive_read_support_format_rar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_rar.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/archive_read_support_format_rar.c Thu May 4 00:04:17 2017 (r317782) @@ -1750,7 +1750,7 @@ read_exttime(const char *p, struct rar * return (-1); for (j = 0; j < count; j++) { - rem = ((*p) << 16) | (rem >> 8); + rem = (((unsigned)(unsigned char)*p) << 16) | (rem >> 8); p++; } tm = localtime(&t); Modified: head/contrib/libarchive/libarchive/archive_string.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_string.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/archive_string.c Thu May 4 00:04:17 2017 (r317782) @@ -202,7 +202,8 @@ archive_string_append(struct archive_str { if (archive_string_ensure(as, as->length + s + 1) == NULL) return (NULL); - memmove(as->s + as->length, p, s); + if (s) + memmove(as->s + as->length, p, s); as->length += s; as->s[as->length] = 0; return (as); Modified: head/contrib/libarchive/libarchive/archive_write_set_format_pax.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_write_set_format_pax.c Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/archive_write_set_format_pax.c Thu May 4 00:04:17 2017 (r317782) @@ -1196,8 +1196,12 @@ archive_write_pax_header(struct archive_ "GNU.sparse.major", 1); add_pax_attr_int(&(pax->pax_header), "GNU.sparse.minor", 0); + /* + * Make sure to store the original path, since + * truncation to ustar limit happened already. + */ add_pax_attr(&(pax->pax_header), - "GNU.sparse.name", entry_name.s); + "GNU.sparse.name", path); add_pax_attr_int(&(pax->pax_header), "GNU.sparse.realsize", archive_entry_size(entry_main)); @@ -1650,13 +1654,14 @@ build_pax_attribute_name(char *dest, con * GNU PAX Format 1.0 requires the special name, which pattern is: * /GNUSparseFile./ * + * Since reproducable archives are more important, use 0 as pid. + * * This function is used for only Sparse file, a file type of which * is regular file. */ static char * build_gnu_sparse_name(char *dest, const char *src) { - char buff[64]; const char *p; /* Handle the null filename case. */ @@ -1682,15 +1687,9 @@ build_gnu_sparse_name(char *dest, const break; } -#if HAVE_GETPID && 0 /* Disable this as pax attribute name. */ - sprintf(buff, "GNUSparseFile.%d", getpid()); -#else - /* If the platform can't fetch the pid, don't include it. */ - strcpy(buff, "GNUSparseFile"); -#endif /* General case: build a ustar-compatible name adding * "/GNUSparseFile/". */ - build_ustar_entry_name(dest, src, p - src, buff); + build_ustar_entry_name(dest, src, p - src, "GNUSparseFile.0"); return (dest); } Modified: head/contrib/libarchive/libarchive/libarchive_changes.3 ============================================================================== --- head/contrib/libarchive/libarchive/libarchive_changes.3 Wed May 3 23:55:12 2017 (r317781) +++ head/contrib/libarchive/libarchive/libarchive_changes.3 Thu May 4 00:04:17 2017 (r317782) @@ -28,6 +28,7 @@ .Dt LIBARCHIVE_CHANGES 3 .Os .Sh NAME +.Nm libarchive_changes .Nd changes in libarchive interface .\" .Sh CHANGES IN LIBARCHIVE 3 Modified: head/contrib/libarchive/libarchive/test/test_read_format_mtree.c ============================================================================== --- head/contrib/libarchive/libarchive/test/test_read_format_mtree.c Wed May 3 23:55:12 2017 (r317781) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu May 4 01:46:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20A02D5A0A8; Thu, 4 May 2017 01:46:06 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6D9F12CF; Thu, 4 May 2017 01:46:05 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v441k4vg085407; Thu, 4 May 2017 01:46:04 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v441k4PN085406; Thu, 4 May 2017 01:46:04 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201705040146.v441k4PN085406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 4 May 2017 01:46:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317783 - head/contrib/hyperv/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 01:46:06 -0000 Author: sephe Date: Thu May 4 01:46:04 2017 New Revision: 317783 URL: https://svnweb.freebsd.org/changeset/base/317783 Log: hyperv/kvp: Fix pool direcrory and file permission PR: 209385 MFC after: 2 weeks Sponsored by: Microsoft Modified: head/contrib/hyperv/tools/hv_kvp_daemon.c Modified: head/contrib/hyperv/tools/hv_kvp_daemon.c ============================================================================== --- head/contrib/hyperv/tools/hv_kvp_daemon.c Thu May 4 00:04:17 2017 (r317782) +++ head/contrib/hyperv/tools/hv_kvp_daemon.c Thu May 4 01:46:04 2017 (r317783) @@ -61,6 +61,10 @@ typedef uint16_t __u16; typedef uint32_t __u32; typedef uint64_t __u64; +#define POOL_FILE_MODE (S_IRUSR | S_IWUSR) +#define POOL_DIR_MODE (POOL_FILE_MODE | S_IXUSR) +#define POOL_DIR "/var/db/hyperv/pool" + /* * ENUM Data */ @@ -285,11 +289,12 @@ kvp_file_init(void) int i; int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK; - if (mkdir("/var/db/hyperv/pool", S_IRUSR | S_IWUSR | S_IROTH) < 0 && + if (mkdir(POOL_DIR, POOL_DIR_MODE) < 0 && (errno != EEXIST && errno != EISDIR)) { KVP_LOG(LOG_ERR, " Failed to create /var/db/hyperv/pool\n"); exit(EXIT_FAILURE); } + chmod(POOL_DIR, POOL_DIR_MODE); /* fix old mistake */ for (i = 0; i < HV_KVP_POOL_COUNT; i++) { @@ -297,11 +302,12 @@ kvp_file_init(void) records_read = 0; num_blocks = 1; snprintf(fname, MAX_FILE_NAME, "/var/db/hyperv/pool/.kvp_pool_%d", i); - fd = open(fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IROTH); + fd = open(fname, O_RDWR | O_CREAT, POOL_FILE_MODE); if (fd == -1) { return (1); } + fchmod(fd, POOL_FILE_MODE); /* fix old mistake */ filep = fopen(fname, "r"); From owner-svn-src-head@freebsd.org Thu May 4 03:12:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1A2AD5C423; Thu, 4 May 2017 03:12:00 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C40841599; Thu, 4 May 2017 03:12:00 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v443BxNw022201; Thu, 4 May 2017 03:11:59 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v443Bxqn022200; Thu, 4 May 2017 03:11:59 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201705040311.v443Bxqn022200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 4 May 2017 03:11:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317784 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 03:12:01 -0000 Author: mjg Date: Thu May 4 03:11:59 2017 New Revision: 317784 URL: https://svnweb.freebsd.org/changeset/base/317784 Log: cache: stop holding the ncneg_hot lock across purging Only non-hot entries are purged so the lock is not needed in the first place. This saves one lock/unlock pair. MFC after: 1 week Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Thu May 4 01:46:04 2017 (r317783) +++ head/sys/kern/vfs_cache.c Thu May 4 03:11:59 2017 (r317784) @@ -735,13 +735,12 @@ cache_negative_remove(struct namecache * list_locked = true; mtx_lock(&neglist->nl_lock); } - } else { - mtx_assert(&neglist->nl_lock, MA_OWNED); - mtx_assert(&ncneg_hot.nl_lock, MA_OWNED); } if (ncp->nc_flag & NCF_HOTNEGATIVE) { + mtx_assert(&ncneg_hot.nl_lock, MA_OWNED); TAILQ_REMOVE(&ncneg_hot.nl_list, ncp, nc_dst); } else { + mtx_assert(&neglist->nl_lock, MA_OWNED); TAILQ_REMOVE(&neglist->nl_list, ncp, nc_dst); } if (list_locked) @@ -816,7 +815,6 @@ cache_negative_zap_one(void) mtx_unlock(&ncneg_hot.nl_lock); mtx_lock(dvlp); rw_wlock(blp); - mtx_lock(&ncneg_hot.nl_lock); mtx_lock(&neglist->nl_lock); ncp2 = TAILQ_FIRST(&neglist->nl_list); if (ncp != ncp2 || dvlp != VP2VNODELOCK(ncp2->nc_dvp) || @@ -830,7 +828,6 @@ cache_negative_zap_one(void) cache_zap_locked(ncp, true); out_unlock_all: mtx_unlock(&neglist->nl_lock); - mtx_unlock(&ncneg_hot.nl_lock); rw_wunlock(blp); mtx_unlock(dvlp); out: From owner-svn-src-head@freebsd.org Thu May 4 04:58:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A133AD5D673 for ; Thu, 4 May 2017 04:58:57 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-63.reflexion.net [208.70.210.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5394C12AC for ; Thu, 4 May 2017 04:58:56 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 7983 invoked from network); 4 May 2017 04:59:59 -0000 Received: from unknown (HELO mail-cs-02.app.dca.reflexion.local) (10.81.19.2) by 0 (rfx-qmail) with SMTP; 4 May 2017 04:59:59 -0000 Received: by mail-cs-02.app.dca.reflexion.local (Reflexion email security v8.40.0) with SMTP; Thu, 04 May 2017 00:58:50 -0400 (EDT) Received: (qmail 8901 invoked from network); 4 May 2017 04:58:50 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 4 May 2017 04:58:50 -0000 Received: from [192.168.1.106] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id 8562EEC91E3; Wed, 3 May 2017 21:58:49 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r317659 - head/sys/dev/uart [head -r317729 for armv6/7: ns8250_drain : error: implicit declaration of function 'ns8250_drain' is invalid in C99] From: Mark Millard In-Reply-To: Date: Wed, 3 May 2017 21:58:48 -0700 Cc: svn-src-head@freebsd.org, freebsd-arm , FreeBSD Current Content-Transfer-Encoding: quoted-printable Message-Id: <8F563A38-A8E1-4008-9BFA-D71103E9223F@dsl-only.net> References: To: mav@FreeBSD.org X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 04:58:57 -0000 On 2017-May-3, at 4:47 AM, Mark Millard wrote: >> Author: mav >> Date: Mon May 1 19:47:10 2017 >> New Revision: 317659 >> URL:=20 >> https://svnweb.freebsd.org/changeset/base/317659 >>=20 >>=20 >> Log: >> Make some UART consoles to not spin wait for data to be sent. >>=20 >> At least with Tx FIFO enabled it shows me ~10% reduction of verbose = boot >> time with serial console at 115200 baud. >>=20 >> Reviewed by: marcel >> MFC after: 2 weeks >>=20 >> Modified: >> head/sys/dev/uart/uart_dev_lpc.c >> head/sys/dev/uart/uart_dev_ns8250.c >=20 >=20 > After building head -r317729 for amd64 and aarch64, > when I tried armv6 I instead got the following failure: >=20 > --- uart_dev_lpc.o --- > /usr/src/sys/dev/uart/uart_dev_lpc.c:892:4: error: implicit = declaration of function 'ns8250_drain' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] > ns8250_drain(bas, UART_DRAIN_TRANSMITTER); > ^ > /usr/src/sys/dev/uart/uart_dev_lpc.c:892:4: note: did you mean = 'lpc_ns8250_drain'? > /usr/src/sys/dev/uart/uart_dev_lpc.c:140:1: note: 'lpc_ns8250_drain' = declared here > lpc_ns8250_drain(struct uart_bas *bas, int what) > ^ > /usr/src/sys/dev/uart/uart_dev_lpc.c:892:4: error: this function = declaration is not a prototype [-Werror,-Wstrict-prototypes] > ns8250_drain(bas, UART_DRAIN_TRANSMITTER); > ^ > 2 errors generated. head -r317752 appears to have fixed this: a rebuild based on -r317784 completed for armv6. Thanks. =3D=3D=3D Mark Millard markmi at dsl-only.net From owner-svn-src-head@freebsd.org Thu May 4 05:26:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B205D5D164; Thu, 4 May 2017 05:26:38 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37E51CE0; Thu, 4 May 2017 05:26:38 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v445Qb2Z077238; Thu, 4 May 2017 05:26:37 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v445QbfU077237; Thu, 4 May 2017 05:26:37 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201705040526.v445QbfU077237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 4 May 2017 05:26:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317785 - head/sys/boot/i386/zfsboot X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 05:26:38 -0000 Author: tsoome Date: Thu May 4 05:26:37 2017 New Revision: 317785 URL: https://svnweb.freebsd.org/changeset/base/317785 Log: zfsboot: drvsize() may be unusable on some systems From user report, the errors are seen: error 1 error 1 gptzfsboot: error 1 lba 4294967288 gptzfsboot: error 1 lba 1 gptzfsboot: no ZFS pools located, can't boot The first two errors above are from issuing INT13 EAX=0x4800, meaning we need to check if EDD is available and use EAX=0x800 if not. For an workaround I'm using the similar idea as in biosdisk.c - first probe ah=8h, then check if we have EDD. Note we would like to see the correct disk size info, but we *may* get away with anything >64MB, so we could at least test 2 zfs pool labels on whole disk setup and not to freak out the INT13 interface. If we get away with initial disk probing, then we have partition sizes from the partition table and we should be able to complete the disk probing. Note: this update does not provide full fix to all errors, but we get the drvsize() errors removed. Reported by: Michael W. Lucas Reviewed by: julian Differential Revision: https://reviews.freebsd.org/D10591 Modified: head/sys/boot/i386/zfsboot/zfsboot.c Modified: head/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- head/sys/boot/i386/zfsboot/zfsboot.c Thu May 4 03:11:59 2017 (r317784) +++ head/sys/boot/i386/zfsboot/zfsboot.c Thu May 4 05:26:37 2017 (r317785) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "lib.h" #include "rbx.h" #include "drv.h" +#include "edd.h" #include "util.h" #include "cons.h" #include "bootargs.h" @@ -125,6 +126,7 @@ static int parse_cmd(void); static void bios_getmem(void); void *malloc(size_t n); void free(void *ptr); +int main(void); void * malloc(size_t n) @@ -469,6 +471,56 @@ copy_dsk(struct dsk *dsk) } /* + * Get disk size from eax=0x800 and 0x4800. We need to probe both + * because 0x4800 may not be available and we would like to get more + * or less correct disk size - if it is possible at all. + * Note we do not really want to touch drv.c because that code is shared + * with boot2 and we can not afford to grow that code. + */ +static uint64_t +drvsize_ext(struct dsk *dskp) +{ + uint64_t size, tmp; + int cyl, hds, sec; + + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0x800; + v86.edx = dskp->drive; + v86int(); + + /* Don't error out if we get bad sector number, try EDD as well */ + if (V86_CY(v86.efl) || /* carry set */ + (v86.edx & 0xff) <= (unsigned)(dskp->drive & 0x7f)) /* unit # bad */ + return (0); + + cyl = ((v86.ecx & 0xc0) << 2) + ((v86.ecx & 0xff00) >> 8) + 1; + /* Convert max head # -> # of heads */ + hds = ((v86.edx & 0xff00) >> 8) + 1; + sec = v86.ecx & 0x3f; + + size = (uint64_t)cyl * hds * sec; + + /* Determine if we can use EDD with this device. */ + v86.ctl = V86_FLAGS; + v86.addr = 0x13; + v86.eax = 0x4100; + v86.edx = dskp->drive; + v86.ebx = 0x55aa; + v86int(); + if (V86_CY(v86.efl) || /* carry set */ + (v86.ebx & 0xffff) != 0xaa55 || /* signature */ + (v86.ecx & EDD_INTERFACE_FIXED_DISK) == 0) + return (size); + + tmp = drvsize(dskp); + if (tmp > size) + size = tmp; + + return (size); +} + +/* * The "layered" ioctl to read disk/partition size. Unfortunately * the zfsboot case is hardest, because we do not have full software * stack available, so we need to do some manual work here. @@ -480,7 +532,7 @@ ldi_get_size(void *priv) uint64_t size = dskp->size; if (dskp->start == 0) - size = drvsize(dskp); + size = drvsize_ext(dskp); return (size * DEV_BSIZE); } @@ -515,7 +567,7 @@ probe_drive(struct dsk *dsk) * out the partition table and probe each slice/partition * in turn for a vdev or GELI encrypted vdev. */ - elba = drvsize(dsk); + elba = drvsize_ext(dsk); if (elba > 0) { elba--; } From owner-svn-src-head@freebsd.org Thu May 4 05:28:48 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5209CD5D277; Thu, 4 May 2017 05:28:48 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 226381098; Thu, 4 May 2017 05:28:48 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v445SlVS077580; Thu, 4 May 2017 05:28:47 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v445SlaX077579; Thu, 4 May 2017 05:28:47 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201705040528.v445SlaX077579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 4 May 2017 05:28:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317786 - head/sys/amd64/pci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 05:28:48 -0000 Author: sephe Date: Thu May 4 05:28:46 2017 New Revision: 317786 URL: https://svnweb.freebsd.org/changeset/base/317786 Log: pcicfg: Fix direct calls of pci_cfg{read,write} on systems w/o PCI host bridge. Reported by: dexuan@ Reviewed by: jhb@ MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D10564 Modified: head/sys/amd64/pci/pci_cfgreg.c Modified: head/sys/amd64/pci/pci_cfgreg.c ============================================================================== --- head/sys/amd64/pci/pci_cfgreg.c Thu May 4 05:26:37 2017 (r317785) +++ head/sys/amd64/pci/pci_cfgreg.c Thu May 4 05:28:46 2017 (r317786) @@ -64,6 +64,7 @@ static vm_offset_t pcie_base; static int pcie_minbus, pcie_maxbus; static uint32_t pcie_badslots; static struct mtx pcicfg_mtx; +MTX_SYSINIT(pcicfg_mtx, &pcicfg_mtx, "pcicfg_mtx", MTX_SPIN); static int mcfg_enable = 1; SYSCTL_INT(_hw_pci, OID_AUTO, mcfg, CTLFLAG_RDTUN, &mcfg_enable, 0, "Enable support for PCI-e memory mapped config access"); @@ -74,15 +75,9 @@ SYSCTL_INT(_hw_pci, OID_AUTO, mcfg, CTLF int pci_cfgregopen(void) { - static int once = 0; uint64_t pciebar; uint16_t did, vid; - if (!once) { - mtx_init(&pcicfg_mtx, "pcicfg", NULL, MTX_SPIN); - once = 1; - } - if (cfgmech != CFGMECH_NONE) return (1); cfgmech = CFGMECH_1; @@ -138,6 +133,9 @@ pci_cfgregread(int bus, int slot, int fu { uint32_t line; + if (cfgmech == CFGMECH_NONE) + return (0xffffffff); + /* * Some BIOS writers seem to want to ignore the spec and put * 0 in the intline rather than 255 to indicate none. Some use @@ -162,6 +160,9 @@ void pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes) { + if (cfgmech == CFGMECH_NONE) + return; + if (cfgmech == CFGMECH_PCIE && (bus >= pcie_minbus && bus <= pcie_maxbus) && (bus != 0 || !(1 << slot & pcie_badslots))) From owner-svn-src-head@freebsd.org Thu May 4 07:44:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23E64D5CBF4; Thu, 4 May 2017 07:44:09 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0A901AEB; Thu, 4 May 2017 07:44:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v447i7ep034325; Thu, 4 May 2017 07:44:07 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v447i7S8034323; Thu, 4 May 2017 07:44:07 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201705040744.v447i7S8034323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 4 May 2017 07:44:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317789 - head/lib/libsysdecode X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 07:44:09 -0000 Author: tuexen Date: Thu May 4 07:44:07 2017 New Revision: 317789 URL: https://svnweb.freebsd.org/changeset/base/317789 Log: Add support for socket option names related to the level IPPROTO_UDPLITE. Modified: head/lib/libsysdecode/flags.c head/lib/libsysdecode/mktables Modified: head/lib/libsysdecode/flags.c ============================================================================== --- head/lib/libsysdecode/flags.c Thu May 4 06:45:43 2017 (r317788) +++ head/lib/libsysdecode/flags.c Thu May 4 07:44:07 2017 (r317789) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -759,6 +760,8 @@ sysdecode_sockopt_name(int level, int op return (lookup_value(sockopttcp, optname)); if (level == IPPROTO_UDP) return (lookup_value(sockoptudp, optname)); + if (level == IPPROTO_UDPLITE) + return (lookup_value(sockoptudplite, optname)); return (NULL); } Modified: head/lib/libsysdecode/mktables ============================================================================== --- head/lib/libsysdecode/mktables Thu May 4 06:45:43 2017 (r317788) +++ head/lib/libsysdecode/mktables Thu May 4 07:44:07 2017 (r317789) @@ -134,6 +134,7 @@ gen_table "sockoptipv6" "IPV6_[[:aln gen_table "sockoptsctp" "SCTP_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/sctp.h" gen_table "sockopttcp" "TCP_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/tcp.h" "TCP_MIN|TCP_MAX[^S]|TCP_MSS|TCP_[[:alnum:]_]+_MAX" gen_table "sockoptudp" "UDP_[[:alnum:]]+[[:space:]]+[0-9]+" "netinet/udp.h" "UDP_ENCAP_" +gen_table "sockoptudplite" "UDPLITE_[[:alnum:]_]+[[:space:]]+[0-9]+" "netinet/udplite.h" gen_table "socktype" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h" gen_table "thrcreateflags" "THR_[A-Z]+[[:space:]]+0x[0-9]+" "sys/thr.h" gen_table "umtxop" "UMTX_OP_[[:alnum:]_]+[[:space:]]+[0-9]+" "sys/umtx.h" From owner-svn-src-head@freebsd.org Thu May 4 11:57:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D14F9D5D7A4; Thu, 4 May 2017 11:57:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8996C12E5; Thu, 4 May 2017 11:57:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44BvqKr037220; Thu, 4 May 2017 11:57:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44BvqjD037219; Thu, 4 May 2017 11:57:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201705041157.v44BvqjD037219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 4 May 2017 11:57:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317790 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 11:57:53 -0000 Author: kib Date: Thu May 4 11:57:52 2017 New Revision: 317790 URL: https://svnweb.freebsd.org/changeset/base/317790 Log: Avoid wrapping of the machine-dependent type sizes table, by removing non-informational sizeof() expressions. Add some explanatory and summary sentences. Noted by: bde Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Thu May 4 07:44:07 2017 (r317789) +++ head/share/man/man7/arch.7 Thu May 4 11:57:52 2017 (r317790) @@ -36,8 +36,9 @@ Differences between CPU architectures and platforms supported by .Fx . .Pp +If not explicitly mentioned, sizes are in bytes. .Ss Type sizes -On all supported architectures, +On all supported architectures: .Bl -column -offset -indent "long long" "Size" .It Sy Type Ta Sy Size .It short Ta 2 @@ -47,8 +48,10 @@ On all supported architectures, .It float Ta 4 .It double Ta 8 .El -.Bl -column -offset indent "Sy Architecture" "Sy sizeof(void *)" "Sy sizeof(long double)" "Sy sizeof(time_t)" -.It Sy Architecture Ta Sy sizeof(void *) Ta Sy sizeof(long double) Ta Sy sizeof(time_t) +.Pp +Machine-dependent type sizes: +.Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t" +.It Sy Architecture Ta Sy void * Ta Sy long double Ta Sy time_t .It amd64 Ta 8 Ta 16 Ta 8 .It arm Ta 4 Ta 8 Ta 8 .It armeb Ta 4 Ta 8 Ta 8 @@ -71,6 +74,10 @@ On all supported architectures, .It riscv64sf Ta 8 Ta 16 Ta 8 .It sparc64 Ta 8 Ta 16 Ta 8 .El +.Pp +.Sy time_t +is 8 bytes on all supported architectures except i386 and 32-bit +variants of powerpc. .Ss Endianness and Char Signedness .Bl -column -offset indent "Sy Architecture" "Sy Endianness" "Sy char Signedness" .It Sy Architecture Ta Sy Endianness Ta Sy char Signedness From owner-svn-src-head@freebsd.org Thu May 4 13:44:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C38AD5C326 for ; Thu, 4 May 2017 13:44:52 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yw0-x231.google.com (mail-yw0-x231.google.com [IPv6:2607:f8b0:4002:c05::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 55F46FC for ; Thu, 4 May 2017 13:44:52 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yw0-x231.google.com with SMTP id l135so6556202ywb.2 for ; Thu, 04 May 2017 06:44:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pqPtgkltH9+jv39AtRAytNmsU/kUnT27JYSNqhaQYFc=; b=CdHrH9GxgkT1M8Iy8hBJrfcC1LL08tMjIUNxJOvoZHCZfevpL4gDBOJGRP/2qUmsyR 6UANHCkU6O9mma7sQVjtF/EuHKfv3ljPPHySRtXXCR2bAi846eHG7cppGf6LJ059zXs/ hKdioRPdX81yjek5DNo1C/V6vJS1K6/SgPKzUuk7aMdDtzYiL8yH4lH1ZojeycHCD/W0 V9CuRVj9sPM4lxCWuRHr9NSuq84i1GkR4jKyF/pYzcwAKTPINF/8WLOdQO54BfS4VYnW BVpDK/U7BSgAHk8mdp3dlcRBnkemv/+g1jbR7VCMGds4x88IE15KOawGzye8EWzWGwXZ Eptg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pqPtgkltH9+jv39AtRAytNmsU/kUnT27JYSNqhaQYFc=; b=Xd207j/3SGovilkZE8D1SKJHUBLn0gyrSnRq47QiWstuUr4I2pIc1HQY6EVPnDFBXW CdbGCRp6PzR2MP/Kf8BP9qGbiccmamQh1IXfnN84zNfq7tBzFtrlH5SmFAWeG1tn4fQX fofhLZOgmnEA8buG4xBChjzSRoAVcbSWKJkBUrikbz+pctiMihMB5/6rs0GgulnoLAOP 5OxufSLbuOWM+MdsrYbsFtBKmSY/1wZ8sOsn8Wz0PZ9DvWoGqeCfI/CZOCm3Jh1FA7OK AHkLJikqvtJcq2s8ZYE6OG0o47Yzed/dnhTTz5XET2Ykxzx+5QYGrTRetkpMHPwXIzo9 uM/A== X-Gm-Message-State: AN3rC/4o5DTA+P5AYt3pIfQtwAi204yLx1/FIdw/djEtF+kI2o5PzM9R gg5LojVlkywodr/Q+YdGFBRuEseMWQ== X-Received: by 10.13.234.16 with SMTP id t16mr2069528ywe.150.1493905491353; Thu, 04 May 2017 06:44:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.114.85 with HTTP; Thu, 4 May 2017 06:44:20 -0700 (PDT) In-Reply-To: <201607191746.u6JHk9ov092270@repo.freebsd.org> References: <201607191746.u6JHk9ov092270@repo.freebsd.org> From: Ed Schouten Date: Thu, 4 May 2017 15:44:20 +0200 Message-ID: Subject: Re: svn commit: r303033 - head/share/man/man7 To: Ed Maste Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 13:44:52 -0000 Hi Ed, 2016-07-19 19:46 GMT+02:00 Ed Maste : > +.It arm Ta soft Ta soft, double precision ... > +.It mips Ta soft Ta identical to double I was wondering, what's the difference between two ways of phrasing it? If long double is double precision, it's identical to double, right? > +.It Dv BYTE_ORDER Ta Either Dv BIG_ENDIAN or Dv LITTLE_ENDIAN . > +.Dv PDP11_ENDIAN is not used on FreeBSD. Would it make more sense to describe GCC/Clang's officially documented endianness macros here? __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ __ORDER_BIG_ENDIAN__ __ORDER_PDP_ENDIAN__ -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-head@freebsd.org Thu May 4 14:25:14 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6CEBD5D46B for ; Thu, 4 May 2017 14:25:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B53C31EDE for ; Thu, 4 May 2017 14:25:14 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22e.google.com with SMTP id p80so23951618iop.3 for ; Thu, 04 May 2017 07:25:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=q4yYIqANMvWxtzlWsYbRq9mawr7kmxEoypeB8m4LGDM=; b=ltBUYm93zT+tmRUaoH4cE1dFOtTYQemaZvrHrp4GkeB+y3IoKAODtSz3moanWShq3I dWKEKtrNM6HjxE5bHQHEL/Gxqc4gA8e90qh4WtnNZf+NDSmWU+t8q5oKsANnMOaaGEka 7+otwHA+hrYXpHwlD2n5KqvTX9ECN6XBIuF5Pf6cS8SyVPnB1pf4QU2vMHs4HV5WC+T/ +hQ3ULTEI7qtEc+qhV8UYY/1V9ggw6b7rZsfkqYdn26CIRiSz/xZdTuxOX/rX8xKB6Xj LNnF0QTHiOjUfXsMrLo2QPYQ0oQD9kvE/X8VZpJSvWuXCwCToUkOjbFkI+HeZnOgGX0D UwIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=q4yYIqANMvWxtzlWsYbRq9mawr7kmxEoypeB8m4LGDM=; b=ML3Xn0cy8teC2vy0c483qrAMXPVjptqwzJTaUoFS4Fuk15UPjzTLC9zdajKBulc+H7 zjGh89B3+rDCXS8XTCBQOqop9JvFZUgoGs7C2kscoVj/Yvc5Q5gmtqtLm3yYiits2HBi CSCFRApp00vF1VfEsKvH5kQs5cRUy64NXLGPxdrFw4u2rx9jcBKgkJY+NGGkP08KqBIN /I9kiAmxjsz7E9eP6DUhJv7WKUyedVz64z1EGunQGy2ioXjzU1LDLysYq5/EGLISrh4O IXqgg901B/0r0VJt020NsjyB3hJ0zy+sEuEAyRiZbAfUL3xVDnq1UCQry3Nc+Qv9WRsK Upmw== X-Gm-Message-State: AN3rC/5yVQdBi/aXOLTK7wJzTKcgfzNEwL9PHY2e0D4uWOk6dt3MEIEd dvYhMRAwf1cTho162S96rl+mFR/iCw== X-Received: by 10.107.36.3 with SMTP id k3mr2059721iok.134.1493907913733; Thu, 04 May 2017 07:25:13 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.126.6 with HTTP; Thu, 4 May 2017 07:25:13 -0700 (PDT) X-Originating-IP: [2607:fb10:7021:1::a2b] In-Reply-To: References: <201607191746.u6JHk9ov092270@repo.freebsd.org> From: Warner Losh Date: Thu, 4 May 2017 08:25:13 -0600 X-Google-Sender-Auth: XNU3ZBKFtH6dowg0ddBKxt-pR3A Message-ID: Subject: Re: svn commit: r303033 - head/share/man/man7 To: Ed Schouten Cc: Ed Maste , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 14:25:15 -0000 On Thu, May 4, 2017 at 7:44 AM, Ed Schouten wrote: > Hi Ed, > > 2016-07-19 19:46 GMT+02:00 Ed Maste : >> +.It arm Ta soft Ta soft, double precision > ... >> +.It mips Ta soft Ta identical to double > > I was wondering, what's the difference between two ways of phrasing > it? If long double is double precision, it's identical to double, > right? > >> +.It Dv BYTE_ORDER Ta Either Dv BIG_ENDIAN or Dv LITTLE_ENDIAN . >> +.Dv PDP11_ENDIAN is not used on FreeBSD. > > Would it make more sense to describe GCC/Clang's officially documented > endianness macros here? > > __BYTE_ORDER__ > __ORDER_LITTLE_ENDIAN__ > __ORDER_BIG_ENDIAN__ > __ORDER_PDP_ENDIAN__ I don't think so. We don't use them in the source tree (except to implement these macros). These are not standardized, so we use our macros as a standard. We want everybody to use them always, except in code we get from upstream. Warner From owner-svn-src-head@freebsd.org Thu May 4 14:54:17 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E702D5DEA7; Thu, 4 May 2017 14:54:17 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x22a.google.com (mail-io0-x22a.google.com [IPv6:2607:f8b0:4001:c06::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D2DF6139E; Thu, 4 May 2017 14:54:16 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io0-x22a.google.com with SMTP id p80so24925979iop.3; Thu, 04 May 2017 07:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=moKb6McwesA1vnPKXUxQR5M2icH4/PLv5LTf8lixVh8=; b=M+AM4pSCpWju9rUjE6vAzkzGV9h1qi6AomPZbiJJuaIM8/KYbNQunb8+RCki/EPzK9 A0ctoTe0f6UN9/CZyljBZCjOhM9JacaDuba/wNdfICngKzZCs8fNlHVFMZ7y//xxzKin tXgoe9esZGDJySHSeXpbV9LF5gR4RI2Xu+rR5OvD661rnKv5LDqxCWEKypX9pcIbO+/q /qs2EnRR0G/Bcy+f+wxcTzLZaD77LPAj48b6/gchXbjN48WLS+U0oQB6+IRMyn/DY+bL YS+4w1v5q0mG71Vr88SNx/wfgkrAK+DLsFR6mRBVNQL6hHVGlrqI6MSl50sCbFifHNT8 CIxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=moKb6McwesA1vnPKXUxQR5M2icH4/PLv5LTf8lixVh8=; b=GabBkx0eMNfX+/7nVB3aa1gvnp6AV6dHAiVmJvohyyln5tiMlYtBODs9LYrB7f8PkU pbBzDKUHwsNNVSzqZkJV4dKF5Qn5AUsjCdaodGjM8AUfce+aJDsZeAYKSm3w8IHfc63d FC+4RjGw/w97tcJGX7vtwhDsSLAz/T7CNhcLvE02Ipjcx8sTKpRbfGQumyQIQE8syAlc pFk6gwlc6B6x+1V1lF/P4LbEtjsb0OPVyCqgLB0tk7UT2YZS6c1w4ATRquhxsz48hWh+ Ccp24BQeR6mHYm5uzyn8XlwSr3o9CAL6zoFROljK30Jl4rRoYxBSlu9uK3DT78j3pzpk 6/yA== X-Gm-Message-State: AN3rC/5HmWBEqu9w/Ttaj9Pq3vu5z/JM4nxA27H8wl2Pj2zl6TMnIWiV donao/sDWMINbdz1gEdADq1g07BNKw== X-Received: by 10.157.14.14 with SMTP id c14mr14664194otc.90.1493909656106; Thu, 04 May 2017 07:54:16 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.202.173.20 with HTTP; Thu, 4 May 2017 07:53:55 -0700 (PDT) In-Reply-To: References: <201607191746.u6JHk9ov092270@repo.freebsd.org> From: Ed Maste Date: Thu, 4 May 2017 10:53:55 -0400 X-Google-Sender-Auth: EtVyX3AQHgsHHC2n01W4f3rJzak Message-ID: Subject: Re: svn commit: r303033 - head/share/man/man7 To: Ed Schouten Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 14:54:17 -0000 On 4 May 2017 at 09:44, Ed Schouten wrote: > Hi Ed, > > 2016-07-19 19:46 GMT+02:00 Ed Maste : >> +.It arm Ta soft Ta soft, double precision > ... >> +.It mips Ta soft Ta identical to double > > I was wondering, what's the difference between two ways of phrasing > it? If long double is double precision, it's identical to double, > right? Yes, good point. I copied the text that was on the wiki page and missed making it consistent here. Probably the style used by the arm entry is the one we want. From owner-svn-src-head@freebsd.org Thu May 4 14:58:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 664E0D5E08A; Thu, 4 May 2017 14:58:39 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 068E618E4; Thu, 4 May 2017 14:58:38 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-wm0-f52.google.com with SMTP id w64so21435483wma.0; Thu, 04 May 2017 07:58:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=gM/6gG+3/KVpa173penmy0fd6VGlSAqhufHqexCcLZs=; b=BoDHMw1sLKIdJeX+TOrZ7gogrnJpa10bUqxvKkaLCDJwnyEAGY+DQbhX7ujUAyf2Z0 dNoZ3AChcu09IAL58pIyPR49ODY04nErV56NbPBwkSFpCin5mH2uhUo3ZRV0+P/pQYZt RDkc/FH96VNNBc9s/DmbnSAYm17ICjwqaqbPmLVwyatcsHGYGDR31b0MDjOn4S5cTgO5 Lb+Yyhm4IwDq3zexhcmZdoR+BrNkTSn27z1oBfPxOH74tNP7Nm0Gf/2DfwEUyakLOfvL VImNyZAwm86QLL+Yg4ZyVo4MYVQ2tkyK21tbmZ2d8PDXdRws5pwc9KkP8H7MPgjwTC6C PCxg== X-Gm-Message-State: AN3rC/5EVYH85eX3Qc92mDH+3HLyHVwB5RWWZPdwHPr4RhMLUYDwyLq5 mVYAu+raMevWcqUBqbk= X-Received: by 10.28.15.75 with SMTP id 72mr2239533wmp.48.1493909910347; Thu, 04 May 2017 07:58:30 -0700 (PDT) Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com. [74.125.82.44]) by smtp.gmail.com with ESMTPSA id r29sm1543565wra.18.2017.05.04.07.58.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 May 2017 07:58:30 -0700 (PDT) Received: by mail-wm0-f44.google.com with SMTP id u65so3045757wmu.1; Thu, 04 May 2017 07:58:30 -0700 (PDT) X-Received: by 10.80.186.199 with SMTP id x65mr30743297ede.46.1493909910029; Thu, 04 May 2017 07:58:30 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.80.169.4 with HTTP; Thu, 4 May 2017 07:58:29 -0700 (PDT) In-Reply-To: <201704300208.v3U28lZo093446@repo.freebsd.org> References: <201704300208.v3U28lZo093446@repo.freebsd.org> From: Conrad Meyer Date: Thu, 4 May 2017 07:58:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r317600 - in head/sys: amd64/vmm/amd modules/vmm To: Anish Gupta Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 14:58:39 -0000 Hi Anish, On Sat, Apr 29, 2017 at 7:08 PM, Anish Gupta wrote: > Author: anish > Date: Sun Apr 30 02:08:46 2017 > New Revision: 317600 > URL: https://svnweb.freebsd.org/changeset/base/317600 > > Log: > Add AMD IOMMU/AMD-Vi support in bhyve for passthrough/direct assignment to VMs. To enable AMD-Vi, set hw.vmm.amdvi.enable=1. > > Reviewed by:bcr > Approved by:grehan > Tested by:rgrimes > Differential Revision:https://reviews.freebsd.org/D10049 > ... > > Added: head/sys/amd64/vmm/amd/amdvi_hw.c > ... > +/* See section 2.5.4 of AMD IOMMU spec ver 2.62.*/ > +static inline void > +amdvi_decode_evt_flag_type(uint8_t type) > +{ > + > + switch (AMDVI_EVENT_FLAG_TYPE(type)) { > + case 0: > + printf("RSVD\n"); > + break; > + case 1: > + printf("Master Abort\n"); > + break; > + case 2: > + printf("Target Abort\n"); > + break; > + case 3: > + printf("Data Err\n"); > + break; > + default: > + break; > + } > +} Coverity warns that the result of AMDVI_EVENT_FLAG_TYPE() in this function will always be zero. This makes sense, as the macro is defined as: #define AMDVI_EVENT_FLAG_TYPE(x) (((x) >> 9) & 0x3) And "type" is a uint8_t. Right-shifting it by 9 will always zero it. Perhaps the function's parameter should be a wider type? FYI, this is Coverity CID 1374742. Best, Conrad From owner-svn-src-head@freebsd.org Thu May 4 15:10:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0901CD5E4E2; Thu, 4 May 2017 15:10:06 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC76F308; Thu, 4 May 2017 15:10:05 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-wm0-f52.google.com with SMTP id m123so19174061wma.0; Thu, 04 May 2017 08:10:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=B6BVvJovAcuEIliUVg2ndDeHdLk460Ia74RNaCQ24l8=; b=s1v2fuqGQ745OCvNyuzjAsogVLrU2Ox+4euBQ/W7bxmI7ZT2ful92k+jrI++Vd1BWe KuFEiuF/Gj9wfePkknPjVRV4sqLEW4o6MfJTU7FFy69GLmj25fppk9NdTNABNqZYfWkN z5D5BUJ1dKJgbC7uIhPXFROEI7/l7epCSI7Etec+z3RVusHyK/LjAN4V2jrdFRNNiL1w 57AQ8bhJa0dAuBqb8YuK4Xm07J6YxiBcg9ihQh8VuX6c1GY6l7CCPsm6Tywwe97UPa05 QPTTMtLLC6zhHMwdm9q233ekP+UZDS3oi4MPPm3hCsWsReWaj4PXPP5JrjMfWa3PB473 qu/g== X-Gm-Message-State: AODbwcAich5ct/CQVxwulIdQX28BVwpRb4KZZmQN5yfHCQOgLntRc3W7 s1ZIcmVHJc0MwyaOEb4= X-Received: by 10.28.55.3 with SMTP id e3mr2313636wma.7.1493910603437; Thu, 04 May 2017 08:10:03 -0700 (PDT) Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com. [74.125.82.48]) by smtp.gmail.com with ESMTPSA id u4sm1735622wmu.0.2017.05.04.08.10.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 May 2017 08:10:03 -0700 (PDT) Received: by mail-wm0-f48.google.com with SMTP id 142so14671094wma.1; Thu, 04 May 2017 08:10:03 -0700 (PDT) X-Received: by 10.80.135.214 with SMTP id 22mr2227783edz.124.1493910603185; Thu, 04 May 2017 08:10:03 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.80.169.4 with HTTP; Thu, 4 May 2017 08:10:02 -0700 (PDT) In-Reply-To: References: <201704300208.v3U28lZo093446@repo.freebsd.org> From: Conrad Meyer Date: Thu, 4 May 2017 08:10:02 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r317600 - in head/sys: amd64/vmm/amd modules/vmm To: Anish Gupta Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 15:10:06 -0000 On Thu, May 4, 2017 at 7:58 AM, Conrad Meyer wrote: > On Sat, Apr 29, 2017 at 7:08 PM, Anish Gupta wrote: >> Author: anish >> Date: Sun Apr 30 02:08:46 2017 >> New Revision: 317600 >> URL: https://svnweb.freebsd.org/changeset/base/317600 >> >> Log: >> Add AMD IOMMU/AMD-Vi support in bhyve for passthrough/direct assignment to VMs. To enable AMD-Vi, set hw.vmm.amdvi.enable=1. >> >> Reviewed by:bcr >> Approved by:grehan >> Tested by:rgrimes >> Differential Revision:https://reviews.freebsd.org/D10049 >> ... Hi Anish, One more Coverity warning that came in with this commit: In ivrs_drv.c: ivrs_hdr_iterate_tbl(), there is a check for 'ivrs_hdr->Length < 0'. However, Length has an unsigned type and cannot be negative, so the check can never be true. (CID: 1374746.) Best, Conrad From owner-svn-src-head@freebsd.org Thu May 4 15:26:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86B0CD5E98E; Thu, 4 May 2017 15:26:29 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 543AD102B; Thu, 4 May 2017 15:26:29 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44FQSvs024208; Thu, 4 May 2017 15:26:28 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44FQS0W024207; Thu, 4 May 2017 15:26:28 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201705041526.v44FQS0W024207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 4 May 2017 15:26:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317798 - head/sys/dev/bnxt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 15:26:29 -0000 Author: sbruno Date: Thu May 4 15:26:28 2017 New Revision: 317798 URL: https://svnweb.freebsd.org/changeset/base/317798 Log: bnxt: Add support for new Broadcom 100Gb adapter BCM57454 Submitted by: bhargava.marreddy@broadcom.com Reviewed by: venkatkumar.duvvuru@broadcom.com Differential Revision: https://reviews.freebsd.org/D10595 Modified: head/sys/dev/bnxt/bnxt.h head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/bnxt.h ============================================================================== --- head/sys/dev/bnxt/bnxt.h Thu May 4 15:00:09 2017 (r317797) +++ head/sys/dev/bnxt/bnxt.h Thu May 4 15:26:28 2017 (r317798) @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #define BCM57417_NPAR1 0x16c0 #define BCM57417_NPAR2 0x16cc #define BCM57417_SFP 0x16e2 +#define BCM57454 0x1614 #define BCM58700 0x16cd #define NETXTREME_C_VF1 0x16cb #define NETXTREME_C_VF2 0x16e1 Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Thu May 4 15:00:09 2017 (r317797) +++ head/sys/dev/bnxt/if_bnxt.c Thu May 4 15:26:28 2017 (r317798) @@ -127,6 +127,8 @@ static pci_vendor_info_t bnxt_vendor_inf "Broadcom BCM57417 NetXtreme-E Ethernet Partition"), PVID(BROADCOM_VENDOR_ID, BCM57417_SFP, "Broadcom BCM57417 NetXtreme-E 10Gb/25Gb Ethernet"), + PVID(BROADCOM_VENDOR_ID, BCM57454, + "Broadcom BCM57454 NetXtreme-E 10Gb/25Gb/40Gb/50Gb/100Gb Ethernet"), PVID(BROADCOM_VENDOR_ID, BCM58700, "Broadcom BCM58700 Nitro 1Gb/2.5Gb/10Gb Ethernet"), PVID(BROADCOM_VENDOR_ID, NETXTREME_C_VF1, From owner-svn-src-head@freebsd.org Thu May 4 15:52:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DCF9D5EF79; Thu, 4 May 2017 15:52:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id DA4351F3D; Thu, 4 May 2017 15:52:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 80C54D68881; Fri, 5 May 2017 01:52:08 +1000 (AEST) Date: Fri, 5 May 2017 01:52:04 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Maste cc: Ed Schouten , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r303033 - head/share/man/man7 In-Reply-To: Message-ID: <20170505013607.S2434@besplex.bde.org> References: <201607191746.u6JHk9ov092270@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=aWfTGR9bug90NLbdHB4A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 15:52:12 -0000 On Thu, 4 May 2017, Ed Maste wrote: > On 4 May 2017 at 09:44, Ed Schouten wrote: >> Hi Ed, >> >> 2016-07-19 19:46 GMT+02:00 Ed Maste : >>> +.It arm Ta soft Ta soft, double precision >> ... >>> +.It mips Ta soft Ta identical to double >> >> I was wondering, what's the difference between two ways of phrasing >> it? If long double is double precision, it's identical to double, >> right? Wrong. long double is a different type with a different rank to double. It cannot be identical. "identical" is a fuzzy way of saying that the representation is identical and all operations are the same at the level of the represention. > Yes, good point. I copied the text that was on the wiki page and > missed making it consistent here. Probably the style used by the arm > entry is the one we want. The arm entry is not technically incorrect, but is less useful. It would be satisfied by long doubles with twice the number of bits (half padding) in a different order. These tables probably shouldn't attempt to give any details except the size and the padding. Padding and representation are not mentioned for integers at all, because everying knows that integers are 2's complement with no padding. Long doubles have padding on supported arches iff they are longer than double but shorter than quad, but the tables don't give enough details to determine this, and this is just one of the complications for long doubles. also doesn't give enough details. It has to be augmented by _fpmath.h to see the details of the representation. Bruce From owner-svn-src-head@freebsd.org Thu May 4 17:23:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75750D5EAEC; Thu, 4 May 2017 17:23:40 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 443371AA0; Thu, 4 May 2017 17:23:40 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44HNda7072442; Thu, 4 May 2017 17:23:39 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44HNdhY072441; Thu, 4 May 2017 17:23:39 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705041723.v44HNdhY072441@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 4 May 2017 17:23:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317799 - head/sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 17:23:40 -0000 Author: ken Date: Thu May 4 17:23:39 2017 New Revision: 317799 URL: https://svnweb.freebsd.org/changeset/base/317799 Log: Add the SCSI Solid State Media Log page (0x11) definition. sys/cam/scsi/scsi_all.h: Add the SCSI Solid State Media log page (0x11) structure definition. This gives the percentage used (in terms of lifetime flash wear) of an SSD. MFC after: 3 days Sponsored by: Spectra Logic Modified: head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Thu May 4 15:26:28 2017 (r317798) +++ head/sys/cam/scsi/scsi_all.h Thu May 4 17:23:39 2017 (r317799) @@ -565,6 +565,7 @@ struct scsi_log_sense #define SLS_ERROR_LASTN_PAGE 0x07 #define SLS_LOGICAL_BLOCK_PROVISIONING 0x0c #define SLS_SELF_TEST_PAGE 0x10 +#define SLS_SOLID_STATE_MEDIA 0x11 #define SLS_STAT_AND_PERF 0x19 #define SLS_IE_PAGE 0x2f #define SLS_PAGE_CTRL_MASK 0xC0 @@ -624,6 +625,13 @@ struct scsi_log_param_header { u_int8_t param_len; }; +struct scsi_log_media_pct_used { + struct scsi_log_param_header hdr; +#define SLP_SS_MEDIA_PCT_USED 0x0001 + uint8_t reserved[3]; + uint8_t pct_used; +}; + struct scsi_log_stat_and_perf { struct scsi_log_param_header hdr; #define SLP_SAP 0x0001 From owner-svn-src-head@freebsd.org Thu May 4 18:56:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4AE9D5B1A9; Thu, 4 May 2017 18:56:12 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B2FD25D; Thu, 4 May 2017 18:56:12 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44IuB2c011299; Thu, 4 May 2017 18:56:11 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44IuBOG011298; Thu, 4 May 2017 18:56:11 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201705041856.v44IuBOG011298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Thu, 4 May 2017 18:56:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317800 - head/sys/dev/sdhci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 18:56:12 -0000 Author: loos Date: Thu May 4 18:56:11 2017 New Revision: 317800 URL: https://svnweb.freebsd.org/changeset/base/317800 Log: Add support for the no-1-8-v and wp-inverted properties in generic SDHCI FDT glue. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/dev/sdhci/sdhci_fdt.c Modified: head/sys/dev/sdhci/sdhci_fdt.c ============================================================================== --- head/sys/dev/sdhci/sdhci_fdt.c Thu May 4 17:23:39 2017 (r317799) +++ head/sys/dev/sdhci/sdhci_fdt.c Thu May 4 18:56:11 2017 (r317800) @@ -70,6 +70,9 @@ struct sdhci_fdt_softc { int num_slots; /* Number of slots on this controller*/ struct sdhci_slot slots[MAX_SLOTS]; struct resource *mem_res[MAX_SLOTS]; /* Memory resource */ + + bool wp_inverted; /* WP pin is inverted */ + bool no_18v; /* No 1.8V support */ }; static uint8_t @@ -110,8 +113,13 @@ static uint32_t sdhci_fdt_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off) { struct sdhci_fdt_softc *sc = device_get_softc(dev); + uint32_t val32; + + val32 = bus_read_4(sc->mem_res[slot->num], off); + if (off == SDHCI_CAPABILITIES && sc->no_18v) + val32 &= ~SDHCI_CAN_VDD_180; - return (bus_read_4(sc->mem_res[slot->num], off)); + return (val32); } static void @@ -152,6 +160,14 @@ sdhci_fdt_intr(void *arg) } static int +sdhci_fdt_get_ro(device_t bus, device_t dev) +{ + struct sdhci_fdt_softc *sc = device_get_softc(bus); + + return (sdhci_generic_get_ro(bus, dev) ^ sc->wp_inverted); +} + +static int sdhci_fdt_probe(device_t dev) { struct sdhci_fdt_softc *sc = device_get_softc(dev); @@ -182,6 +198,10 @@ sdhci_fdt_probe(device_t dev) sc->num_slots = cid; if ((OF_getencprop(node, "max-frequency", &cid, sizeof(cid))) > 0) sc->max_clk = cid; + if (OF_hasprop(node, "no-1-8-v")) + sc->no_18v = true; + if (OF_hasprop(node, "wp-inverted")) + sc->wp_inverted = true; return (0); } @@ -279,7 +299,7 @@ static device_method_t sdhci_fdt_methods /* mmcbr_if */ DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios), DEVMETHOD(mmcbr_request, sdhci_generic_request), - DEVMETHOD(mmcbr_get_ro, sdhci_generic_get_ro), + DEVMETHOD(mmcbr_get_ro, sdhci_fdt_get_ro), DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host), DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host), From owner-svn-src-head@freebsd.org Thu May 4 19:01:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5E114D5B38B; Thu, 4 May 2017 19:01:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 20DA58EE; Thu, 4 May 2017 19:01:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44J1ILZ011705; Thu, 4 May 2017 19:01:18 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44J1IfY011704; Thu, 4 May 2017 19:01:18 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201705041901.v44J1IfY011704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 4 May 2017 19:01:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317801 - head/libexec/getty X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 19:01:19 -0000 Author: trasz Date: Thu May 4 19:01:17 2017 New Revision: 317801 URL: https://svnweb.freebsd.org/changeset/base/317801 Log: Fix markup in gettytab(5). Reviewed by: bapt MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D10476 Modified: head/libexec/getty/gettytab.5 Modified: head/libexec/getty/gettytab.5 ============================================================================== --- head/libexec/getty/gettytab.5 Thu May 4 18:56:11 2017 (r317800) +++ head/libexec/getty/gettytab.5 Thu May 4 19:01:17 2017 (r317801) @@ -81,8 +81,8 @@ table. .It "c2 num unused tty control flags to leave terminal as" .It "ce bool false use crt erase algorithm" .It "ck bool false use crt kill algorithm" -.It "cl str" Ta Dv NULL Ta -.No "screen clear sequence" +.It "cl str" Ta Dv NULL +.Ta No "screen clear sequence" .It "co bool false console - add" .Ql \en after login prompt @@ -94,31 +94,31 @@ scripts .It "dc num 0 chat debug bitmask" .It "de num 0 delay secs and flush input before writing first prompt" .It "df str %+ the" Xr strftime 3 "format used for \&%d in the banner message" -.It "ds str" Ta So Li ^Y Sc Ta -.No "delayed suspend character" +.It "ds str" Ta So Li ^Y +.Sc Ta No "delayed suspend character" .It "dx bool false set" .Dv DECCTLQ .It "ec bool false leave echo" .Em OFF .It "ep bool false terminal uses even parity" -.It "er str" Ta So Li ^? Sc Ta -.No "erase character" -.It "et str" Ta So Li ^D Sc Ta -.No "end of text" +.It "er str" Ta So Li ^? +.Sc Ta No "erase character" +.It "et str" Ta So Li ^D +.Sc Ta No "end of text" .Pq Dv EOF character -.It "ev str" Ta Dv NULL Ta -.No "initial environment" +.It "ev str" Ta Dv NULL +.Ta No "initial environment" .It "f0 num unused tty mode flags to write messages" .It "f1 num unused tty mode flags to read login name" .It "f2 num unused tty mode flags to leave terminal as" -.It "fl str" Ta So Li ^O Sc Ta -.No "output flush character" +.It "fl str" Ta So Li ^O +.Sc Ta No "output flush character" .It "hc bool false do" .Em NOT hangup line on last close -.It "he str" Ta Dv NULL Ta -.No "hostname editing regular expression" +.It "he str" Ta Dv NULL +.Ta No "hostname editing regular expression" .It "hn str hostname hostname" .It "ht bool false terminal has real tabs" .It "hw bool false do cts/rts hardware flow control" @@ -128,21 +128,21 @@ hangup line on last close .It "ic str unused expect-send chat script for modem initialization" .It "if str unused display named file before prompt, like /etc/issue" .It "ig bool false ignore garbage characters in login name" -.It "im str" Ta Dv NULL Ta -.No "initial (banner) message" -.It "in str" Ta So Li ^C Sc Ta -.No "interrupt character" +.It "im str" Ta Dv NULL +.Ta No "initial (banner) message" +.It "in str" Ta So Li ^C +.Sc Ta No "interrupt character" .It "is num unused input speed" -.It "kl str" Ta So Li ^U Sc Ta -.No "kill character" +.It "kl str" Ta So Li ^U +.Sc Ta No "kill character" .It "l0 num unused tty local flags to write messages" .It "l1 num unused tty local flags to read login name" .It "l2 num unused tty local flags to leave terminal as" .It "lm str login: login prompt" -.It "ln str" Ta So Li ^V Sc Ta -.No "``literal next'' character" -.It "lo str" Ta Pa /usr/bin/login Ta -.No "program to exec when name obtained" +.It "ln str" Ta So Li ^V +.Sc Ta No "``literal next'' character" +.It "lo str" Ta Pa /usr/bin/login +.Ta No "program to exec when name obtained" .It "mb bool false do flow control based on carrier" .It "nc bool false terminal does not supply carrier (set clocal)" .It "nl bool false terminal has (or might have) a newline character" @@ -153,8 +153,8 @@ hangup line on last close .It "o2 num unused tty output flags to leave terminal as" .It "op bool false terminal uses odd parity" .It "os num unused output speed" -.It "pc str" Ta So Li \e0 Sc Ta -.No "pad character" +.It "pc str" Ta So Li \e0 +.Sc Ta No "pad character" .It "pe bool false use printer (hard copy) erase algorithm" .It "pf num 0 delay" between first prompt and following flush (seconds) @@ -165,25 +165,25 @@ is specified .It "ps bool false line connected to a" .Tn MICOM port selector -.It "qu str" Ta So Li \&^\e Sc Ta -.No "quit character" -.It "rp str" Ta So Li ^R Sc Ta -.No "line retype character" +.It "qu str" Ta So Li \&^\e +.Sc Ta No "quit character" +.It "rp str" Ta So Li ^R +.Sc Ta No "line retype character" .It "rt num unused ring timeout when using" .Va \&ac .It "rw bool false do" .Em NOT use raw for input, use cbreak .It "sp num unused line speed (input and output)" -.It "su str" Ta So Li ^Z Sc Ta -.No "suspend character" +.It "su str" Ta So Li ^Z +.Sc Ta No "suspend character" .It "tc str none table continuation" .It "to num 0 timeout (seconds)" -.It "tt str" Ta Dv NULL Ta -.No "terminal type (for environment)" +.It "tt str" Ta Dv NULL +.Ta No "terminal type (for environment)" .It "ub bool false do unbuffered output (of prompts etc)" -.It "we str" Ta So Li ^W Sc Ta -.No "word erase character" +.It "we str" Ta So Li ^W +.Sc Ta No "word erase character" .It "xc bool false do" .Em NOT echo control chars as From owner-svn-src-head@freebsd.org Thu May 4 19:07:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DC72D5B70C; Thu, 4 May 2017 19:07:39 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70688E47; Thu, 4 May 2017 19:07:39 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44J7c1S015685; Thu, 4 May 2017 19:07:38 GMT (envelope-from lidl@FreeBSD.org) Received: (from lidl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44J7bxj015673; Thu, 4 May 2017 19:07:37 GMT (envelope-from lidl@FreeBSD.org) Message-Id: <201705041907.v44J7bxj015673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lidl set sender to lidl@FreeBSD.org using -f From: Kurt Lidl Date: Thu, 4 May 2017 19:07:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317802 - in head/contrib/blacklist: . bin etc/rc.d lib libexec port X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 19:07:39 -0000 Author: lidl Date: Thu May 4 19:07:37 2017 New Revision: 317802 URL: https://svnweb.freebsd.org/changeset/base/317802 Log: Merge latest version of blacklist sources from NetBSD (@ 20170503) MFC after: 3 days Sponsored by: The FreeBSD Foundation Replaced: head/contrib/blacklist/port/config.h (contents, props changed) Modified: head/contrib/blacklist/README head/contrib/blacklist/bin/blacklistctl.8 head/contrib/blacklist/bin/blacklistctl.c head/contrib/blacklist/bin/blacklistd.c head/contrib/blacklist/bin/blacklistd.conf.5 head/contrib/blacklist/etc/rc.d/blacklistd head/contrib/blacklist/lib/bl.c head/contrib/blacklist/lib/libblacklist.3 head/contrib/blacklist/libexec/blacklistd-helper head/contrib/blacklist/port/Makefile.am head/contrib/blacklist/port/sockaddr_snprintf.c Directory Properties: head/contrib/blacklist/ (props changed) Modified: head/contrib/blacklist/README ============================================================================== --- head/contrib/blacklist/README Thu May 4 19:01:17 2017 (r317801) +++ head/contrib/blacklist/README Thu May 4 19:07:37 2017 (r317802) @@ -1,4 +1,4 @@ -# $NetBSD: README,v 1.7 2015/01/26 00:34:50 christos Exp $ +# $NetBSD: README,v 1.8 2017/04/13 17:59:34 christos Exp $ This package contains library that can be used by network daemons to communicate with a packet filter via a daemon to enforce opening and @@ -98,6 +98,16 @@ group "internal" on $int_if { ... } +You can use 'blacklistctl dump -a' to list all the current entries +in the database; the ones that have nfail / where urrent +>= otal, should have an id assosiated with them; this means that +there is a packet filter rule added for that entry. For npf, you +can examine the packet filter dynamic rule entries using 'npfctl +rule list'. The number of current entries can exceed +the total. This happens because entering packet filter rules is +asynchronous; there could be other connection before the rule +becomes activated. + Enjoy, christos Modified: head/contrib/blacklist/bin/blacklistctl.8 ============================================================================== --- head/contrib/blacklist/bin/blacklistctl.8 Thu May 4 19:01:17 2017 (r317801) +++ head/contrib/blacklist/bin/blacklistctl.8 Thu May 4 19:07:37 2017 (r317802) @@ -1,4 +1,4 @@ -.\" $NetBSD: blacklistctl.8,v 1.7 2015/04/30 06:20:43 riz Exp $ +.\" $NetBSD: blacklistctl.8,v 1.9 2016/06/08 12:48:37 wiz Exp $ .\" .\" Copyright (c) 2015 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -77,7 +77,8 @@ it to make sure that there is only one r .Nm first appeared in .Nx 7 . -.Fx support for +.Fx +support for .Nm was implemented in .Fx 11 . Modified: head/contrib/blacklist/bin/blacklistctl.c ============================================================================== --- head/contrib/blacklist/bin/blacklistctl.c Thu May 4 19:01:17 2017 (r317801) +++ head/contrib/blacklist/bin/blacklistctl.c Thu May 4 19:07:37 2017 (r317802) @@ -1,4 +1,4 @@ -/* $NetBSD: blacklistctl.c,v 1.20 2016/04/04 15:52:56 christos Exp $ */ +/* $NetBSD: blacklistctl.c,v 1.21 2016/11/02 03:15:07 jnemeth Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #endif #include -__RCSID("$NetBSD: blacklistctl.c,v 1.20 2016/04/04 15:52:56 christos Exp $"); +__RCSID("$NetBSD: blacklistctl.c,v 1.21 2016/11/02 03:15:07 jnemeth Exp $"); #include #include Modified: head/contrib/blacklist/bin/blacklistd.c ============================================================================== --- head/contrib/blacklist/bin/blacklistd.c Thu May 4 19:01:17 2017 (r317801) +++ head/contrib/blacklist/bin/blacklistd.c Thu May 4 19:07:37 2017 (r317802) @@ -1,4 +1,4 @@ -/* $NetBSD: blacklistd.c,v 1.35 2016/09/26 19:43:43 christos Exp $ */ +/* $NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 christos Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "config.h" #endif #include -__RCSID("$NetBSD: blacklistd.c,v 1.35 2016/09/26 19:43:43 christos Exp $"); +__RCSID("$NetBSD: blacklistd.c,v 1.37 2017/02/18 00:26:16 christos Exp $"); #include #include @@ -403,12 +403,14 @@ int main(int argc, char *argv[]) { int c, tout, flags, flush, restore, ret; - const char *spath, *blsock; + const char *spath, **blsock; + size_t nblsock, maxblsock; setprogname(argv[0]); spath = NULL; - blsock = _PATH_BLSOCK; + blsock = NULL; + maxblsock = nblsock = 0; flush = 0; restore = 0; tout = 0; @@ -440,7 +442,17 @@ main(int argc, char *argv[]) restore++; break; case 's': - blsock = optarg; + if (nblsock >= maxblsock) { + maxblsock += 10; + void *p = realloc(blsock, + sizeof(*blsock) * maxblsock); + if (p == NULL) + err(EXIT_FAILURE, + "Can't allocate memory for %zu sockets", + maxblsock); + blsock = p; + } + blsock[nblsock++] = optarg; break; case 't': tout = atoi(optarg) * 1000; @@ -487,9 +499,11 @@ main(int argc, char *argv[]) size_t nfd = 0; size_t maxfd = 0; - if (spath == NULL) - addfd(&pfd, &bl, &nfd, &maxfd, blsock); - else { + for (size_t i = 0; i < nblsock; i++) + addfd(&pfd, &bl, &nfd, &maxfd, blsock[i]); + free(blsock); + + if (spath) { FILE *fp = fopen(spath, "r"); char *line; if (fp == NULL) @@ -499,6 +513,8 @@ main(int argc, char *argv[]) addfd(&pfd, &bl, &nfd, &maxfd, line); fclose(fp); } + if (nfd == 0) + addfd(&pfd, &bl, &nfd, &maxfd, _PATH_BLSOCK); state = state_open(dbfile, flags, 0600); if (state == NULL) Modified: head/contrib/blacklist/bin/blacklistd.conf.5 ============================================================================== --- head/contrib/blacklist/bin/blacklistd.conf.5 Thu May 4 19:01:17 2017 (r317801) +++ head/contrib/blacklist/bin/blacklistd.conf.5 Thu May 4 19:07:37 2017 (r317802) @@ -1,4 +1,4 @@ -.\" $NetBSD: blacklistd.conf.5,v 1.3 2015/04/30 06:20:43 riz Exp $ +.\" $NetBSD: blacklistd.conf.5,v 1.5 2016/06/08 12:48:37 wiz Exp $ .\" .\" Copyright (c) 2015 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -218,7 +218,8 @@ bnx0:ssh * * * * 3 6h .Nm first appeared in .Nx 7 . -.Fx support for +.Fx +support for .Nm was implemented in .Fx 11 . Modified: head/contrib/blacklist/etc/rc.d/blacklistd ============================================================================== --- head/contrib/blacklist/etc/rc.d/blacklistd Thu May 4 19:01:17 2017 (r317801) +++ head/contrib/blacklist/etc/rc.d/blacklistd Thu May 4 19:07:37 2017 (r317802) @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: blacklistd,v 1.1 2015/01/22 17:49:41 christos Exp $ +# $NetBSD: blacklistd,v 1.2 2016/10/17 22:47:16 christos Exp $ # # PROVIDE: blacklistd @@ -18,7 +18,7 @@ start_precmd="${name}_precmd" extra_commands="reload" _sockfile="/var/run/${name}.sockets" -_sockname="blsock" +_sockname="blacklistd.sock" blacklistd_precmd() { Modified: head/contrib/blacklist/lib/bl.c ============================================================================== --- head/contrib/blacklist/lib/bl.c Thu May 4 19:01:17 2017 (r317801) +++ head/contrib/blacklist/lib/bl.c Thu May 4 19:07:37 2017 (r317802) @@ -1,4 +1,4 @@ -/* $NetBSD: bl.c,v 1.27 2015/12/30 16:42:48 christos Exp $ */ +/* $NetBSD: bl.c,v 1.28 2016/07/29 17:13:09 christos Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #endif #include -__RCSID("$NetBSD: bl.c,v 1.27 2015/12/30 16:42:48 christos Exp $"); +__RCSID("$NetBSD: bl.c,v 1.28 2016/07/29 17:13:09 christos Exp $"); #include #include Modified: head/contrib/blacklist/lib/libblacklist.3 ============================================================================== --- head/contrib/blacklist/lib/libblacklist.3 Thu May 4 19:01:17 2017 (r317801) +++ head/contrib/blacklist/lib/libblacklist.3 Thu May 4 19:07:37 2017 (r317802) @@ -1,4 +1,4 @@ -.\" $NetBSD: libblacklist.3,v 1.3 2015/01/25 23:09:28 wiz Exp $ +.\" $NetBSD: libblacklist.3,v 1.7 2017/02/04 23:33:56 wiz Exp $ .\" .\" Copyright (c) 2015 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -36,7 +36,7 @@ .Nm blacklist_r , .Nm blacklist , .Nm blacklist_sa -.Nm blacklist_sa_r , +.Nm blacklist_sa_r .Nd Blacklistd notification library .Sh LIBRARY .Lb libblacklist @@ -62,7 +62,7 @@ block or release port access to prevent .Pp The function .Fn blacklist_open -creates a the necessary state to communicate with +creates the necessary state to communicate with .Xr blacklistd 8 and returns a pointer to it, or .Dv NULL @@ -106,18 +106,25 @@ All functions log errors to .Xr syslogd 8 . .Sh RETURN VALUES The function -.Fn bl_open +.Fn blacklist_open returns a cookie on success and .Dv NULL -on failure setting errno to an appropriate value. -.Pp -The -.Fn bl_send -function returns +on failure setting +.Dv errno +to an appropriate value. +.Pp +The functions +.Fn blacklist , +.Fn blacklist_sa , +and +.Fn blacklist_sa_r +return .Dv 0 on success and -.Dv -1 -on failure setting errno to an appropriate value. +.Dv \-1 +on failure setting +.Dv errno +to an appropriate value. .Sh SEE ALSO .Xr blacklistd.conf 5 , .Xr blacklistd 8 Modified: head/contrib/blacklist/libexec/blacklistd-helper ============================================================================== --- head/contrib/blacklist/libexec/blacklistd-helper Thu May 4 19:01:17 2017 (r317801) +++ head/contrib/blacklist/libexec/blacklistd-helper Thu May 4 19:07:37 2017 (r317802) @@ -19,8 +19,8 @@ fi if [ -z "$pf" ]; then for f in npf pf ipf; do if [ -f "/etc/$f.conf" ]; then - pf="$f" - break + pf="$f" + break fi done fi Modified: head/contrib/blacklist/port/Makefile.am ============================================================================== --- head/contrib/blacklist/port/Makefile.am Thu May 4 19:01:17 2017 (r317801) +++ head/contrib/blacklist/port/Makefile.am Thu May 4 19:07:37 2017 (r317802) @@ -1,11 +1,11 @@ # ACLOCAL_AMFLAGS = -I m4 lib_LTLIBRARIES = libblacklist.la -include_HEADERS = blacklist.h +include_HEADERS = ../include/blacklist.h bin_PROGRAMS = blacklistd blacklistctl srvtest cltest -VPATH = ../bin:../lib:../test +VPATH = ../bin:../lib:../test:../include AM_CPPFLAGS = -I../include -DDOT="." AM_CFLAGS = @WARNINGS@ Added: head/contrib/blacklist/port/config.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/blacklist/port/config.h Thu May 4 19:07:37 2017 (r317802) @@ -0,0 +1,3 @@ +#if defined(__FreeBSD__) +#include "port.h" +#endif Modified: head/contrib/blacklist/port/sockaddr_snprintf.c ============================================================================== --- head/contrib/blacklist/port/sockaddr_snprintf.c Thu May 4 19:01:17 2017 (r317801) +++ head/contrib/blacklist/port/sockaddr_snprintf.c Thu May 4 19:07:37 2017 (r317802) @@ -1,4 +1,4 @@ -/* $NetBSD: sockaddr_snprintf.c,v 1.10 2016/04/05 12:28:57 christos Exp $ */ +/* $NetBSD: sockaddr_snprintf.c,v 1.11 2016/06/01 22:57:51 christos Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: sockaddr_snprintf.c,v 1.10 2016/04/05 12:28:57 christos Exp $"); +__RCSID("$NetBSD: sockaddr_snprintf.c,v 1.11 2016/06/01 22:57:51 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #include @@ -219,7 +219,7 @@ sockaddr_snprintf(char * const sbuf, con case AF_LINK: sdl = ((const struct sockaddr_dl *)(const void *)sa); (void)strlcpy(addr = abuf, link_ntoa(sdl), sizeof(abuf)); - if ((w = strchr(addr, ':')) != 0) { + if ((w = strchr(addr, ':')) != NULL) { *w++ = '\0'; addr = w; } From owner-svn-src-head@freebsd.org Thu May 4 19:16:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 596FDD5B926; Thu, 4 May 2017 19:16:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E9EE14E9; Thu, 4 May 2017 19:16:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44JGbnQ019702; Thu, 4 May 2017 19:16:37 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44JGbEw019701; Thu, 4 May 2017 19:16:37 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201705041916.v44JGbEw019701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 4 May 2017 19:16:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317803 - head/etc/autofs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 19:16:38 -0000 Author: trasz Date: Thu May 4 19:16:36 2017 New Revision: 317803 URL: https://svnweb.freebsd.org/changeset/base/317803 Log: Enable automounting of exFAT media. With fstyp(8) being updated to detect exfat in base r312003, it seems like a good time to add support for auto-mounting SDXC cards -- which use exfat by default. The user will need to locally compile and install sysutils/fusefs-exfat for this to succeed; logs a message to that effect when not installed. PR: 218743 Submitted by: eborisch+FreeBSD@gmail.com MFC after: 2 weeks Modified: head/etc/autofs/special_media Modified: head/etc/autofs/special_media ============================================================================== --- head/etc/autofs/special_media Thu May 4 19:07:37 2017 (r317802) +++ head/etc/autofs/special_media Thu May 4 19:16:36 2017 (r317803) @@ -39,6 +39,15 @@ print_map_entry() { _p="$2" case "${_fstype}" in + "exfat") + if [ -f "/usr/local/sbin/mount.exfat" ]; then + echo "-mountprog=/usr/local/sbin/mount.exfat,fstype=${_fstype},nosuid :/dev/${_p}" + else + /usr/bin/logger -p info -t "special_media[$$]" \ + "Cannot mount ${_fstype} formatted device /dev/${_p}: Install sysutils/fusefs-exfat first" + exit 1 + fi + ;; "ntfs") if [ -f "/usr/local/bin/ntfs-3g" ]; then echo "-mountprog=/usr/local/bin/ntfs-3g,fstype=${_fstype},nosuid :/dev/${_p}" From owner-svn-src-head@freebsd.org Thu May 4 19:41:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70775D5D0FC; Thu, 4 May 2017 19:41:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D59339C; Thu, 4 May 2017 19:41:21 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44JfKEG031144; Thu, 4 May 2017 19:41:20 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44JfKwI031139; Thu, 4 May 2017 19:41:20 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201705041941.v44JfKwI031139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 4 May 2017 19:41:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317804 - head/usr.sbin/autofs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 19:41:21 -0000 Author: trasz Date: Thu May 4 19:41:19 2017 New Revision: 317804 URL: https://svnweb.freebsd.org/changeset/base/317804 Log: Make automount(8) error out when the map name is missing. MFC after: 2 weeks Modified: head/usr.sbin/autofs/common.c Modified: head/usr.sbin/autofs/common.c ============================================================================== --- head/usr.sbin/autofs/common.c Thu May 4 19:16:36 2017 (r317803) +++ head/usr.sbin/autofs/common.c Thu May 4 19:41:19 2017 (r317804) @@ -224,6 +224,7 @@ node_new_map(struct node *parent, char * n->n_options = options; else n->n_options = strdup(""); + assert(map != NULL); n->n_map = map; assert(config_file != NULL); n->n_config_file = config_file; @@ -1122,6 +1123,10 @@ parse_master_yyin(struct node *root, con ret = yylex(); if (ret == 0 || ret == NEWLINE) { if (mountpoint != NULL) { + if (map == NULL) { + log_errx(1, "missing map name " + "at %s, line %d", master, lineno); + } //log_debugx("adding map for %s", mountpoint); node_new_map(root, mountpoint, options, map, master, lineno); From owner-svn-src-head@freebsd.org Thu May 4 19:55:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 102E0D5D9E5; Thu, 4 May 2017 19:55:34 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4808FCF; Thu, 4 May 2017 19:55:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44JtWAf036010; Thu, 4 May 2017 19:55:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44JtWXx036009; Thu, 4 May 2017 19:55:32 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201705041955.v44JtWXx036009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 4 May 2017 19:55:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317805 - head/usr.sbin/autofs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 19:55:34 -0000 Author: trasz Date: Thu May 4 19:55:32 2017 New Revision: 317805 URL: https://svnweb.freebsd.org/changeset/base/317805 Log: Revert r317804; apparently I forgot the auto_master syntax. MFC after: 2 weeks Modified: head/usr.sbin/autofs/common.c Modified: head/usr.sbin/autofs/common.c ============================================================================== --- head/usr.sbin/autofs/common.c Thu May 4 19:41:19 2017 (r317804) +++ head/usr.sbin/autofs/common.c Thu May 4 19:55:32 2017 (r317805) @@ -224,7 +224,6 @@ node_new_map(struct node *parent, char * n->n_options = options; else n->n_options = strdup(""); - assert(map != NULL); n->n_map = map; assert(config_file != NULL); n->n_config_file = config_file; @@ -1123,10 +1122,6 @@ parse_master_yyin(struct node *root, con ret = yylex(); if (ret == 0 || ret == NEWLINE) { if (mountpoint != NULL) { - if (map == NULL) { - log_errx(1, "missing map name " - "at %s, line %d", master, lineno); - } //log_debugx("adding map for %s", mountpoint); node_new_map(root, mountpoint, options, map, master, lineno); From owner-svn-src-head@freebsd.org Thu May 4 20:42:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C668D5E675; Thu, 4 May 2017 20:42:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED14B1BEB; Thu, 4 May 2017 20:42:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44KgVxh056210; Thu, 4 May 2017 20:42:31 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44KgV0u056209; Thu, 4 May 2017 20:42:31 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201705042042.v44KgV0u056209@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 4 May 2017 20:42:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317806 - head/sys/dev/nand X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 20:42:33 -0000 Author: glebius Date: Thu May 4 20:42:31 2017 New Revision: 317806 URL: https://svnweb.freebsd.org/changeset/base/317806 Log: The nandsim(4) simulator driver doesn't have any protection against races at least in its ioctl handler, and at the same time it creates device entry with 0666 permissions. To plug possible issues in it: - Mark it as needing Giant. - Switch device mode to 0600. Submitted by: C Turt Reviewed by: imp MFC after: 1 week Security: Possible double free in ioctl handler Modified: head/sys/dev/nand/nandsim.c Modified: head/sys/dev/nand/nandsim.c ============================================================================== --- head/sys/dev/nand/nandsim.c Thu May 4 19:55:32 2017 (r317805) +++ head/sys/dev/nand/nandsim.c Thu May 4 20:42:31 2017 (r317806) @@ -71,6 +71,7 @@ static struct nandsim_chip *get_nandsim_ static struct cdevsw nandsim_cdevsw = { .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = nandsim_ioctl, .d_name = "nandsim", }; @@ -639,7 +640,7 @@ nandsim_modevent(module_t mod __unused, switch (type) { case MOD_LOAD: nandsim_dev = make_dev(&nandsim_cdevsw, 0, - UID_ROOT, GID_WHEEL, 0666, "nandsim.ioctl"); + UID_ROOT, GID_WHEEL, 0600, "nandsim.ioctl"); break; case MOD_UNLOAD: for (i = 0; i < MAX_SIM_DEV; i++) { From owner-svn-src-head@freebsd.org Thu May 4 21:31:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DADAFD5E1CC; Thu, 4 May 2017 21:31:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6167DC5; Thu, 4 May 2017 21:31:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44LVoah076952; Thu, 4 May 2017 21:31:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44LVokb076951; Thu, 4 May 2017 21:31:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201705042131.v44LVokb076951@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 4 May 2017 21:31:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317809 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 21:31:52 -0000 Author: kib Date: Thu May 4 21:31:50 2017 New Revision: 317809 URL: https://svnweb.freebsd.org/changeset/base/317809 Log: Provide introduction for the arch(7) manpage. Start with some words about linear address space and its layout, then explain pointers models and ABIs, providing explanation to the structure of the tables. Reviewed by: emaste, imp 'Future-proof' cheri wording by: brooks Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D10596 Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Thu May 4 21:30:26 2017 (r317808) +++ head/share/man/man7/arch.7 Thu May 4 21:31:50 2017 (r317809) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 3, 2017 +.Dd May 4, 2017 .Dt ARCH 7 .Os .Sh NAME @@ -35,9 +35,92 @@ .Sh DESCRIPTION Differences between CPU architectures and platforms supported by .Fx . -.Pp +.Ss Introduction If not explicitly mentioned, sizes are in bytes. +.Pp +FreeBSD uses flat address space for program execution, where +pointers have the same binary representation as +.Vt unsigned long +variables, and +.Vt uintptr_t +and +.Vt size_t +types are synonyms for +.Vt unsigned long . +.Pp +In order to maximize compatibility with future pointer integrity mechanisms, +manipulations of pointers as integers should be performed via +.Vt uintptr_t +or +.Vt intptr_t +and no other types. +In particular, +.Vt long +and +.Vt ptrdiff_t +should be avoided. +.Pp +On some architectures, e.g. +.Dv sparc64 , +.Dv powerpc +and AIM variants of +.Dv powerpc64 , +the kernel uses a separate address space. +On other architectures, kernel and a user mode process share a +single address space. +The kernel is located at the highest addresses. +.Pp +On each architecture, the main user mode thread's stack starts near +the highest user address and grows down. .Ss Type sizes +All FreeBSD architectures use some variant of the ELF (see +.Xr elf 5 ) +.Sy Application Binary Interface +(ABI) for the machine processor. +All supported ABIs can be divided into two groups: +.Bl -tag -width "Dv ILP32" +.It Dv ILP32 +.Vt int , +.Vt long , +.Vt void * +types machine representations all have 4-byte size. +.It Dv LP64 +.Vt int +type machine representation uses 4 bytes, +while +.Vt long +and +.Vt void * +are 8 bytes. +.El +Compilers define +.Dv _LP64 +symbol when compiling for an +.Dv LP64 +ABI. +.Pp +Some machines support more that one FreeBSD ABI. +Typically these are 64-bit machines, where the +.Dq native +.Dv LP64 +execution environment is accompanied by the +.Dq legacy +.Dv ILP32 +environment, which was historical 32-bit predecessor for 64-bit evolution. +Examples are: +.Bl -column -offset indent "powerpc64" "Sy ILP32 counterpart" +.It Sy LP64 Ta Sy ILP32 counterpart +.It Dv amd64 Ta Dv i386 +.It Dv powerpc64 Ta Dv powerpc +.It Dv mips64* Ta Dv mips* +.El +.Dv arm64 +currently does not support execution of +.Dv armv6 +binaries, even if the CPU implements +.Dv AArch32 +execution state. +.Pp On all supported architectures: .Bl -column -offset -indent "long long" "Size" .It Sy Type Ta Sy Size @@ -48,6 +131,9 @@ On all supported architectures: .It float Ta 4 .It double Ta 8 .El +Integers are represented as two-complement. +Alignment of integer and pointer types is natural, that is, +the address of the variable must be congruent to zero modulo type size. .Pp Machine-dependent type sizes: .Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t" From owner-svn-src-head@freebsd.org Thu May 4 21:40:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E64BD5E3D0; Thu, 4 May 2017 21:40:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10970125; Thu, 4 May 2017 21:40:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44LeHJm077371; Thu, 4 May 2017 21:40:17 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44LeHrU077370; Thu, 4 May 2017 21:40:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201705042140.v44LeHrU077370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 4 May 2017 21:40:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317810 - head/contrib/llvm/lib/Target/PowerPC X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 21:40:18 -0000 Author: dim Date: Thu May 4 21:40:16 2017 New Revision: 317810 URL: https://svnweb.freebsd.org/changeset/base/317810 Log: Pull in r302183 from upstream llvm trunk (by Krzysztof Parzyszek): [PPC] When restoring R30 (PIC base pointer), mark it as This happened on the PPC32/SVR4 path and was discovered when building FreeBSD on PPC32. It was a typo-class error in the frame lowering code. This fixes PR26519. Reported by: Mark Millard PR: 206990 MFC after: 3 days Modified: head/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp Modified: head/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp Thu May 4 21:31:50 2017 (r317809) +++ head/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp Thu May 4 21:40:16 2017 (r317810) @@ -1467,8 +1467,7 @@ void PPCFrameLowering::emitEpilogue(Mach } if (FI->usesPICBase()) - BuildMI(MBB, MBBI, dl, LoadInst) - .addReg(PPC::R30) + BuildMI(MBB, MBBI, dl, LoadInst, PPC::R30) .addImm(PBPOffset) .addReg(RBReg); From owner-svn-src-head@freebsd.org Thu May 4 22:47:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A23BED5E67D; Thu, 4 May 2017 22:47:19 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63773D90; Thu, 4 May 2017 22:47:19 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44MlI95006041; Thu, 4 May 2017 22:47:18 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44MlI8H006040; Thu, 4 May 2017 22:47:18 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201705042247.v44MlI8H006040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Thu, 4 May 2017 22:47:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317811 - head/sys/dev/atkbdc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 22:47:19 -0000 Author: wulf Date: Thu May 4 22:47:18 2017 New Revision: 317811 URL: https://svnweb.freebsd.org/changeset/base/317811 Log: Fix triple-finger taps reported as double-finger for Elan hw v.4 touchpads Wait for all advertised head packets after status packet have been received. This fixes rare but quite annoying issue in Elan hw v.4 touchpads support when triple-finger taps are reported as double-finger taps under several circumstances. Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10266 Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Thu May 4 21:40:16 2017 (r317810) +++ head/sys/dev/atkbdc/psm.c Thu May 4 22:47:18 2017 (r317811) @@ -366,6 +366,7 @@ enum { typedef struct elantechaction { finger_t fingers[ELANTECH_MAX_FINGERS]; int mask; + int mask_v4wait; } elantechaction_t; /* driver control block */ @@ -3879,9 +3880,15 @@ proc_elantech(struct psm_softc *sc, pack mask = pb->ipacket[1] & 0x1f; nfingers = bitcount(mask); + if (sc->elanaction.mask_v4wait != 0) + VLOG(3, (LOG_DEBUG, "elantech: HW v4 status packet" + " when not all previous head packets received\n")); + + /* Bitmap of fingers to receive before gesture processing */ + sc->elanaction.mask_v4wait = mask & ~sc->elanaction.mask; + /* Skip "new finger is on touchpad" packets */ - if ((sc->elanaction.mask & mask) == sc->elanaction.mask && - (mask & ~sc->elanaction.mask)) { + if (sc->elanaction.mask_v4wait) { sc->elanaction.mask = mask; return (0); } @@ -3906,11 +3913,33 @@ proc_elantech(struct psm_softc *sc, pack mask = sc->elanaction.mask; nfingers = bitcount(mask); id = ((pb->ipacket[3] & 0xe0) >> 5) - 1; + fn = ELANTECH_FINGER_SET_XYP(pb); + fn.w =(pb->ipacket[0] & 0xf0) >> 4; - if (id >= 0 && id < ELANTECH_MAX_FINGERS) { - f[id] = ELANTECH_FINGER_SET_XYP(pb); - f[id].w = (pb->ipacket[0] & 0xf0) >> 4; + if (id < 0) + return (0); + + /* Packet is finger position update. Report it */ + if (sc->elanaction.mask_v4wait == 0) { + if (id < ELANTECH_MAX_FINGERS) + f[id] = fn; + break; } + + /* Remove finger from waiting bitmap and store into context */ + sc->elanaction.mask_v4wait &= ~(1 << id); + if (id < ELANTECH_MAX_FINGERS) + sc->elanaction.fingers[id] = fn; + + /* Wait for other fingers if needed */ + if (sc->elanaction.mask_v4wait != 0) + return (0); + + /* All new fingers are received. Report them from context */ + for (id = 0; id < ELANTECH_MAX_FINGERS; id++) + if (sc->elanaction.mask & (1 << id)) + f[id] = sc->elanaction.fingers[id]; + break; case ELANTECH_PKT_V4_MOTION: /* HW Version 4. Motion packet */ From owner-svn-src-head@freebsd.org Thu May 4 22:51:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1812D5E913; Thu, 4 May 2017 22:51:23 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91D2310F5; Thu, 4 May 2017 22:51:23 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44MpM7o006375; Thu, 4 May 2017 22:51:22 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44MpMsH006374; Thu, 4 May 2017 22:51:22 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201705042251.v44MpMsH006374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Thu, 4 May 2017 22:51:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317812 - head/sys/dev/atkbdc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 22:51:23 -0000 Author: wulf Date: Thu May 4 22:51:22 2017 New Revision: 317812 URL: https://svnweb.freebsd.org/changeset/base/317812 Log: Reduce default tap_min_queue size for Elan touchpads Elan hw v.4 touchpads often sends touchpad release packet right after touchpad touch one. Most probably this happens due to PS/2 limited bandwith. Reducing of tap_min_queue size to 1 makes multifinger tap detection more reliable in this case. Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10266 Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Thu May 4 22:47:18 2017 (r317811) +++ head/sys/dev/atkbdc/psm.c Thu May 4 22:51:22 2017 (r317812) @@ -6218,6 +6218,9 @@ elantech_init_synaptics(struct psm_softc /* Disable finger detection pressure threshold */ sc->syninfo.min_pressure = 1; + /* Elans often report double & triple taps as single event */ + sc->syninfo.tap_min_queue = 1; + /* Use full area of touchpad */ sc->syninfo.margin_top = 0; sc->syninfo.margin_right = 0; From owner-svn-src-head@freebsd.org Thu May 4 22:53:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5D28D5E98D; Thu, 4 May 2017 22:53:46 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F83D150C; Thu, 4 May 2017 22:53:46 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44MrjVD010099; Thu, 4 May 2017 22:53:45 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44Mrjr3010098; Thu, 4 May 2017 22:53:45 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201705042253.v44Mrjr3010098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Thu, 4 May 2017 22:53:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317813 - head/sys/dev/atkbdc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 22:53:46 -0000 Author: wulf Date: Thu May 4 22:53:45 2017 New Revision: 317813 URL: https://svnweb.freebsd.org/changeset/base/317813 Log: Adjust Elantech palm width threshold to nearly match synaptics defaults Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10266 Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Thu May 4 22:51:22 2017 (r317812) +++ head/sys/dev/atkbdc/psm.c Thu May 4 22:53:45 2017 (r317813) @@ -6218,6 +6218,9 @@ elantech_init_synaptics(struct psm_softc /* Disable finger detection pressure threshold */ sc->syninfo.min_pressure = 1; + /* Adjust palm width to nearly match synaptics w=10 */ + sc->syninfo.max_width = 7; + /* Elans often report double & triple taps as single event */ sc->syninfo.tap_min_queue = 1; From owner-svn-src-head@freebsd.org Thu May 4 23:02:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85609D5EB97; Thu, 4 May 2017 23:02:35 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D8101AC9; Thu, 4 May 2017 23:02:35 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44N2Yjf014016; Thu, 4 May 2017 23:02:34 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44N2Y06014015; Thu, 4 May 2017 23:02:34 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201705042302.v44N2Y06014015@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Thu, 4 May 2017 23:02:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317814 - head/sys/dev/atkbdc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 23:02:35 -0000 Author: wulf Date: Thu May 4 23:02:34 2017 New Revision: 317814 URL: https://svnweb.freebsd.org/changeset/base/317814 Log: psm(4): reduce cursor jumping on palm detection This is done with discarding pointer movements rather then mouse packets Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10266 Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Thu May 4 22:53:45 2017 (r317813) +++ head/sys/dev/atkbdc/psm.c Thu May 4 23:02:34 2017 (r317814) @@ -3017,13 +3017,15 @@ proc_synaptics(struct psm_softc *sc, pac ms->button = touchpad_buttons; + psmgestures(sc, &f[0], nfingers, ms); + for (id = 0; id < PSM_FINGERS; id++) + psmsmoother(sc, &f[id], id, ms, x, y); + /* Palm detection doesn't terminate the current action. */ - if (!psmpalmdetect(sc, &f[0], nfingers)) { - psmgestures(sc, &f[0], nfingers, ms); - for (id = 0; id < PSM_FINGERS; id++) - psmsmoother(sc, &f[id], id, ms, x, y); - } else { - VLOG(2, (LOG_DEBUG, "synaptics: palm detected! (%d)\n", f[0].w)); + if (psmpalmdetect(sc, &f[0], nfingers)) { + *x = *y = *z = 0; + ms->button = ms->obutton; + return (0); } ms->button |= extended_buttons | guest_buttons; @@ -3077,6 +3079,7 @@ psmpalmdetect(struct psm_softc *sc, fing * [min_pressure; max_pressure] * - pen aren't supported but PSM_FINGER_IS_PEN is set */ + VLOG(2, (LOG_DEBUG, "synaptics: palm detected! (%d)\n", f->w)); return (1); } return (0); @@ -4035,20 +4038,14 @@ proc_elantech(struct psm_softc *sc, pack ms->button = touchpad_button | trackpoint_button; - /* Palm detection doesn't terminate the current action. */ - if (!psmpalmdetect(sc, &f[0], nfingers)) { - /* Send finger 1 position to gesture processor */ - if (PSM_FINGER_IS_SET(f[0]) || PSM_FINGER_IS_SET(f[1]) || - nfingers == 0) - psmgestures(sc, &f[0], imin(nfingers, 3), ms); - /* Send fingers positions to movement smoothers */ - for (id = 0; id < PSM_FINGERS; id++) - if (PSM_FINGER_IS_SET(f[id]) || !(mask & (1 << id))) - psmsmoother(sc, &f[id], id, ms, x, y); - } else { - VLOG(2, (LOG_DEBUG, "elantech: palm detected! (%d)\n", - f[0].w)); - } + /* Send finger 1 position to gesture processor */ + if (PSM_FINGER_IS_SET(f[0]) || PSM_FINGER_IS_SET(f[1]) || + nfingers == 0) + psmgestures(sc, &f[0], imin(nfingers, 3), ms); + /* Send fingers positions to movement smoothers */ + for (id = 0; id < PSM_FINGERS; id++) + if (PSM_FINGER_IS_SET(f[id]) || !(mask & (1 << id))) + psmsmoother(sc, &f[id], id, ms, x, y); /* Store current finger positions in action context */ for (id = 0; id < ELANTECH_MAX_FINGERS; id++) { @@ -4059,6 +4056,13 @@ proc_elantech(struct psm_softc *sc, pack } sc->elanaction.mask = mask; + /* Palm detection doesn't terminate the current action. */ + if (psmpalmdetect(sc, &f[0], nfingers)) { + *x = *y = *z = 0; + ms->button = ms->obutton; + return (0); + } + /* Use the extra buttons as a scrollwheel */ if (ms->button & MOUSE_BUTTON4DOWN) *z = -1; From owner-svn-src-head@freebsd.org Thu May 4 23:04:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BD9ED5EDB0; Thu, 4 May 2017 23:04:53 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C2621E20; Thu, 4 May 2017 23:04:53 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44N4qGm014144; Thu, 4 May 2017 23:04:52 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44N4qHT014143; Thu, 4 May 2017 23:04:52 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201705042304.v44N4qHT014143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Thu, 4 May 2017 23:04:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317815 - head/sys/dev/atkbdc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 23:04:53 -0000 Author: wulf Date: Thu May 4 23:04:52 2017 New Revision: 317815 URL: https://svnweb.freebsd.org/changeset/base/317815 Log: Enable palm detection on two finger touches for multitouch trackpads. Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10266 Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Thu May 4 23:02:34 2017 (r317814) +++ head/sys/dev/atkbdc/psm.c Thu May 4 23:04:52 2017 (r317815) @@ -3065,8 +3065,9 @@ static int psmpalmdetect(struct psm_softc *sc, finger_t *f, int nfingers) { if (!( - ((sc->synhw.capMultiFinger || - sc->synhw.capAdvancedGestures) && nfingers > 1) || + ((sc->synhw.capMultiFinger || sc->synhw.capAdvancedGestures) && + !sc->synhw.capReportsV && nfingers > 1) || + (sc->synhw.capReportsV && nfingers > 2) || (sc->synhw.capPalmDetect && f->w <= sc->syninfo.max_width) || (!sc->synhw.capPalmDetect && f->p <= sc->syninfo.max_pressure) || (sc->synhw.capPen && f->flags & PSM_FINGER_IS_PEN))) { @@ -6188,7 +6189,10 @@ elantech_init_synaptics(struct psm_softc sc->synhw.capPassthrough = sc->elanhw.hastrackpoint; sc->synhw.capClickPad = sc->elanhw.isclickpad; sc->synhw.capMultiFinger = 1; - sc->synhw.capAdvancedGestures = 1; + if (sc->elanhw.issemimt) + sc->synhw.capAdvancedGestures = 1; + else + sc->synhw.capReportsV = 1; sc->synhw.capPalmDetect = 1; sc->synhw.capPen = 0; sc->synhw.capReportsMax = 1; From owner-svn-src-head@freebsd.org Thu May 4 23:08:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC3E1D5EEAA; Thu, 4 May 2017 23:08:56 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A02FD14B; Thu, 4 May 2017 23:08:56 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44N8tVH014533; Thu, 4 May 2017 23:08:55 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44N8tZn014532; Thu, 4 May 2017 23:08:55 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201705042308.v44N8tZn014532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Thu, 4 May 2017 23:08:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317816 - head/sys/dev/atkbdc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 23:08:57 -0000 Author: wulf Date: Thu May 4 23:08:55 2017 New Revision: 317816 URL: https://svnweb.freebsd.org/changeset/base/317816 Log: Report 3-rd and 4-th fingers as first finger for Elan hw v.2 and v.3 as Linux does. It should not affect gesture processing in current state as it ignores finger coords on 3-finger tap detection but it should make evdev reports looking more Linux-alike. Reviewed by: gonzo Approved by: gonzo MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10266 Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Thu May 4 23:04:52 2017 (r317815) +++ head/sys/dev/atkbdc/psm.c Thu May 4 23:08:55 2017 (r317816) @@ -3772,27 +3772,30 @@ proc_elantech(struct psm_softc *sc, pack nfingers = (pb->ipacket[0] & 0xc0) >> 6; if (nfingers == 3 && (pb->ipacket[3] & 0x80)) nfingers = 4; - mask = (1 << nfingers) - 1; - fn = ELANTECH_FINGER_SET_XYP(pb); + if (nfingers == 0) { + mask = (1 << nfingers) - 1; /* = 0x00 */ + break; + } + + /* Map 3-rd and 4-th fingers to first finger */ + mask = (1 << 1) - 1; /* = 0x01 */ + f[0] = ELANTECH_FINGER_SET_XYP(pb); if (sc->elanhw.haspressure) { - fn.w = ((pb->ipacket[0] & 0x30) >> 2) | + f[0].w = ((pb->ipacket[0] & 0x30) >> 2) | ((pb->ipacket[3] & 0x30) >> 4); } else { - fn.p = PSM_FINGER_DEFAULT_P; - fn.w = PSM_FINGER_DEFAULT_W; + f[0].p = PSM_FINGER_DEFAULT_P; + f[0].w = PSM_FINGER_DEFAULT_W; } /* * HW v2 dont report exact finger positions when 3 or more - * fingers are on touchpad. Use reported value as fingers - * position as it is required for tap detection + * fingers are on touchpad. */ if (nfingers > 2) - fn.flags = PSM_FINGER_FUZZY; + f[0].flags = PSM_FINGER_FUZZY; - for (id = 0; id < imin(nfingers, ELANTECH_MAX_FINGERS); id++) - f[id] = fn; break; case ELANTECH_PKT_V2_2FINGER: /*HW V2. Two finger touch */ @@ -3838,8 +3841,12 @@ proc_elantech(struct psm_softc *sc, pack * ------------------------------------------- */ nfingers = (pb->ipacket[0] & 0xc0) >> 6; - mask = (1 << nfingers) - 1; - id = nfingers - 1; + /* Map 3-rd finger to first finger */ + id = nfingers > 2 ? 0 : nfingers - 1; + mask = (1 << (id + 1)) - 1; + + if (nfingers == 0) + break; fn = ELANTECH_FINGER_SET_XYP(pb); fn.w = ((pb->ipacket[0] & 0x30) >> 2) | @@ -3847,15 +3854,11 @@ proc_elantech(struct psm_softc *sc, pack /* * HW v3 dont report exact finger positions when 3 or more - * fingers are on touchpad. Use reported value as fingers - * position as it is required for tap detection + * fingers are on touchpad. */ if (nfingers > 1) fn.flags = PSM_FINGER_FUZZY; - for (id = 0; id < imin(nfingers, ELANTECH_MAX_FINGERS); id++) - f[id] = fn; - if (nfingers == 2) { if (ELANTECH_PKT_IS_V3_HEAD(pb, sc->elanhw.hascrc)) { sc->elanaction.fingers[0] = fn; @@ -3863,6 +3866,7 @@ proc_elantech(struct psm_softc *sc, pack } else f[0] = sc->elanaction.fingers[0]; } + f[id] = fn; break; case ELANTECH_PKT_V4_STATUS: /* HW Version 4. Status packet */ From owner-svn-src-head@freebsd.org Thu May 4 23:12:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CF27D5E058; Thu, 4 May 2017 23:12:47 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE04587C; Thu, 4 May 2017 23:12:46 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44NCjg4018646; Thu, 4 May 2017 23:12:45 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44NCj6c018645; Thu, 4 May 2017 23:12:45 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201705042312.v44NCj6c018645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Thu, 4 May 2017 23:12:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317817 - head/sys/dev/atkbdc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 23:12:47 -0000 Author: wulf Date: Thu May 4 23:12:45 2017 New Revision: 317817 URL: https://svnweb.freebsd.org/changeset/base/317817 Log: Set predefined logical touchpad sizes for several ancient Elan hw v.2 models. This change is based on Linux driver. Determine logical trace size. It used for calculation of touch sizes in surface units for MT-protocol type B evdev reports. Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10266 Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Thu May 4 23:08:55 2017 (r317816) +++ head/sys/dev/atkbdc/psm.c Thu May 4 23:12:45 2017 (r317817) @@ -300,6 +300,8 @@ typedef struct elantechhw { int dpmmy; int ntracesx; int ntracesy; + int dptracex; + int dptracey; int issemimt; int isclickpad; int hascrc; @@ -6280,8 +6282,17 @@ enable_elantech(struct psm_softc *sc, en static const int ic2hw[] = /*IC: 0 1 2 3 4 5 6 7 8 9 a b c d e f */ { 0, 0, 2, 0, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0 }; + static const int fw_sizes[][3] = { + /* FW.vers MaxX MaxY */ + { 0x020030, 1152, 768 }, + { 0x020800, 1152, 768 }, + { 0x020b00, 1152, 768 }, + { 0x040215, 900, 500 }, + { 0x040216, 819, 405 }, + { 0x040219, 900, 500 }, + }; elantechhw_t elanhw; - int icversion, hwversion, dptracex, dptracey, id, resp[3], dpix, dpiy; + int icversion, hwversion, xtr, i, id, resp[3], dpix, dpiy; KBDC kbdc = sc->kbdc; VLOG(3, (LOG_DEBUG, "elantech: BEGIN init\n")); @@ -6332,8 +6343,8 @@ enable_elantech(struct psm_softc *sc, en return (FALSE); } - elanhw.ntracesx = resp[1] - 1; - elanhw.ntracesy = resp[2] - 1; + elanhw.ntracesx = imax(resp[1], 3); + elanhw.ntracesy = imax(resp[2], 3); elanhw.hastrackpoint = (resp[0] & 0x80) != 0; /* Get the touchpad resolution */ @@ -6367,24 +6378,35 @@ enable_elantech(struct psm_softc *sc, en * On HW v.3 touchpads it should be done after switching hardware * to real resolution mode (by setting bit 3 of reg10) */ + elanhw.dptracex = elanhw.dptracey = 64; + for (i = 0; i < nitems(fw_sizes); i++) { + if (elanhw.fwversion == fw_sizes[i][0]) { + elanhw.sizex = fw_sizes[i][1]; + elanhw.sizey = fw_sizes[i][2]; + goto found; + } + } if (elantech_cmd(kbdc, hwversion, ELANTECH_FW_ID, resp) != 0) { printf(" Failed to read touchpad size\n"); elanhw.sizex = 10000; /* Arbitrary high values to */ elanhw.sizey = 10000; /* prevent clipping in smoother */ } else if (hwversion == 2) { - dptracex = dptracey = 64; if ((elanhw.fwversion >> 16) == 0x14 && (resp[1] & 0x10) && !elantech_cmd(kbdc, hwversion, ELANTECH_SAMPLE, resp)) { - dptracex = resp[1] / 2; - dptracey = resp[2] / 2; + elanhw.dptracex = resp[1] / 2; + elanhw.dptracey = resp[2] / 2; } - elanhw.sizex = (elanhw.ntracesx - 1) * dptracex; - elanhw.sizey = (elanhw.ntracesy - 1) * dptracey; + xtr = ((elanhw.fwversion >> 8) == 0x0208) ? 1 : 2; + elanhw.sizex = (elanhw.ntracesx - xtr) * elanhw.dptracex; + elanhw.sizey = (elanhw.ntracesy - xtr) * elanhw.dptracey; } else { elanhw.sizex = (resp[0] & 0x0f) << 8 | resp[1]; elanhw.sizey = (resp[0] & 0xf0) << 4 | resp[2]; + xtr = (elanhw.sizex % (elanhw.ntracesx - 2) == 0) ? 2 : 1; + elanhw.dptracex = elanhw.sizex / (elanhw.ntracesx - xtr); + elanhw.dptracey = elanhw.sizey / (elanhw.ntracesy - xtr); } - +found: if (verbose >= 2) { printf(" Model information:\n"); printf(" MaxX: %d\n", elanhw.sizex); @@ -6393,6 +6415,8 @@ enable_elantech(struct psm_softc *sc, en printf(" DpmmY: %d\n", elanhw.dpmmy); printf(" TracesX: %d\n", elanhw.ntracesx); printf(" TracesY: %d\n", elanhw.ntracesy); + printf(" DptraceX: %d\n", elanhw.dptracex); + printf(" DptraceY: %d\n", elanhw.dptracey); printf(" SemiMT: %d\n", elanhw.issemimt); printf(" Clickpad: %d\n", elanhw.isclickpad); printf(" Trackpoint: %d\n", elanhw.hastrackpoint); From owner-svn-src-head@freebsd.org Thu May 4 23:17:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49425D5E0E6; Thu, 4 May 2017 23:17:23 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EE50A6E; Thu, 4 May 2017 23:17:22 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44NHMb0018878; Thu, 4 May 2017 23:17:22 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44NHMCD018877; Thu, 4 May 2017 23:17:22 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201705042317.v44NHMCD018877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Thu, 4 May 2017 23:17:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317818 - head/sys/dev/atkbdc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 23:17:23 -0000 Author: wulf Date: Thu May 4 23:17:21 2017 New Revision: 317818 URL: https://svnweb.freebsd.org/changeset/base/317818 Log: psm(4): Remove sys/libkern.h header inclusion It is already included via sys/systm.h Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10266 Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Thu May 4 23:12:45 2017 (r317817) +++ head/sys/dev/atkbdc/psm.c Thu May 4 23:17:21 2017 (r317818) @@ -81,7 +81,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include From owner-svn-src-head@freebsd.org Thu May 4 23:19:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C535D5E18E; Thu, 4 May 2017 23:19:29 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFCF3C1C; Thu, 4 May 2017 23:19:28 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v44NJRnv018998; Thu, 4 May 2017 23:19:27 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v44NJRWV018997; Thu, 4 May 2017 23:19:27 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201705042319.v44NJRWV018997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Thu, 4 May 2017 23:19:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317819 - head/sys/dev/atkbdc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 23:19:29 -0000 Author: wulf Date: Thu May 4 23:19:27 2017 New Revision: 317819 URL: https://svnweb.freebsd.org/changeset/base/317819 Log: Reduce synaptics touch sensitivity Increase hw.psm.synaptics.min_pressure default value from 16 to 32 to nearly match Linux driver (30-35 hysteresis loop). This makes libinput tap detection more reliable. Reviewed by: gonzo Approved by: gonzo (mentor) MFC after: 2 weeks Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Thu May 4 23:17:21 2017 (r317818) +++ head/sys/dev/atkbdc/psm.c Thu May 4 23:19:27 2017 (r317819) @@ -5093,7 +5093,7 @@ synaptics_sysctl_create_tree(struct psm_ "Enable two finger scrolling"); /* hw.psm.synaptics.min_pressure. */ - sc->syninfo.min_pressure = 16; + sc->syninfo.min_pressure = 32; SYSCTL_ADD_PROC(&sc->syninfo.sysctl_ctx, SYSCTL_CHILDREN(sc->syninfo.sysctl_tree), OID_AUTO, "min_pressure", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY, From owner-svn-src-head@freebsd.org Fri May 5 00:54:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A757D5EC92; Fri, 5 May 2017 00:54:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12E121CBE; Fri, 5 May 2017 00:54:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v450sOkG061739; Fri, 5 May 2017 00:54:24 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v450sNZ1061737; Fri, 5 May 2017 00:54:23 GMT (envelope-from np@FreeBSD.org) Message-Id: <201705050054.v450sNZ1061737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 5 May 2017 00:54:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317820 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 00:54:25 -0000 Author: np Date: Fri May 5 00:54:23 2017 New Revision: 317820 URL: https://svnweb.freebsd.org/changeset/base/317820 Log: cxgbe(4): Update the list of PCIe devices claimed by the driver. At this point any board with a T6 should just work. Obtained from: Chelsio Communications MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_iov.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_iov.c ============================================================================== --- head/sys/dev/cxgbe/t4_iov.c Thu May 4 23:19:27 2017 (r317819) +++ head/sys/dev/cxgbe/t4_iov.c Fri May 5 00:54:23 2017 (r317820) @@ -92,11 +92,25 @@ struct { {0x5013, "Chelsio T580-CHR"}, #endif }, t6iov_pciids[] = { + {0x6000, "Chelsio T6-DBG-25"}, /* 2 x 10/25G, debug */ {0x6001, "Chelsio T6225-CR"}, /* 2 x 10/25G */ {0x6002, "Chelsio T6225-SO-CR"}, /* 2 x 10/25G, nomem */ + {0x6003, "Chelsio T6425-CR"}, /* 4 x 10/25G */ + {0x6004, "Chelsio T6425-CR"}, /* 4 x 10/25G, nomem */ + {0x6005, "Chelsio T6225-OCP-SO"}, /* 2 x 10/25G, nomem */ + {0x6006, "Chelsio T62100-OCP-SO"}, /* 2 x 40/50/100G, nomem */ {0x6007, "Chelsio T62100-LP-CR"}, /* 2 x 40/50/100G */ {0x6008, "Chelsio T62100-SO-CR"}, /* 2 x 40/50/100G, nomem */ + {0x6009, "Chelsio T6210-BT"}, /* 2 x 10GBASE-T */ {0x600d, "Chelsio T62100-CR"}, /* 2 x 40/50/100G */ + {0x6010, "Chelsio T6-DBG-100"}, /* 2 x 40/50/100G, debug */ + {0x6011, "Chelsio T6225-LL-CR"}, /* 2 x 10/25G */ + {0x6014, "Chelsio T61100-OCP-SO"}, /* 1 x 40/50/100G, nomem */ + {0x6015, "Chelsio T6201-BT"}, /* 2 x 1000BASE-T */ + + /* Custom */ + {0x6080, "Chelsio T6225 80"}, + {0x6081, "Chelsio T62100 81"}, }; static int t4iov_attach_child(device_t dev); Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu May 4 23:19:27 2017 (r317819) +++ head/sys/dev/cxgbe/t4_main.c Fri May 5 00:54:23 2017 (r317820) @@ -623,13 +623,25 @@ struct { #endif }, t6_pciids[] = { {0xc006, "Chelsio Terminator 6 FPGA"}, /* T6 PE10K6 FPGA (PF0) */ - {0x6400, "Chelsio T6225-DBG"}, /* 2 x 10/25G, debug */ + {0x6400, "Chelsio T6-DBG-25"}, /* 2 x 10/25G, debug */ {0x6401, "Chelsio T6225-CR"}, /* 2 x 10/25G */ {0x6402, "Chelsio T6225-SO-CR"}, /* 2 x 10/25G, nomem */ + {0x6403, "Chelsio T6425-CR"}, /* 4 x 10/25G */ + {0x6404, "Chelsio T6425-SO-CR"}, /* 4 x 10/25G, nomem */ + {0x6405, "Chelsio T6225-OCP-SO"}, /* 2 x 10/25G, nomem */ + {0x6406, "Chelsio T62100-OCP-SO"}, /* 2 x 40/50/100G, nomem */ {0x6407, "Chelsio T62100-LP-CR"}, /* 2 x 40/50/100G */ {0x6408, "Chelsio T62100-SO-CR"}, /* 2 x 40/50/100G, nomem */ + {0x6409, "Chelsio T6210-BT"}, /* 2 x 10GBASE-T */ {0x640d, "Chelsio T62100-CR"}, /* 2 x 40/50/100G */ - {0x6410, "Chelsio T62100-DBG"}, /* 2 x 40/50/100G, debug */ + {0x6410, "Chelsio T6-DBG-100"}, /* 2 x 40/50/100G, debug */ + {0x6411, "Chelsio T6225-LL-CR"}, /* 2 x 10/25G */ + {0x6414, "Chelsio T61100-OCP-SO"}, /* 1 x 40/50/100G, nomem */ + {0x6415, "Chelsio T6201-BT"}, /* 2 x 1000BASE-T */ + + /* Custom */ + {0x6480, "Chelsio T6225 80"}, + {0x6481, "Chelsio T62100 81"}, }; #ifdef TCP_OFFLOAD From owner-svn-src-head@freebsd.org Fri May 5 03:08:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 103DCD5E78A; Fri, 5 May 2017 03:08:44 +0000 (UTC) (envelope-from bogorodskiy@gmail.com) Received: from mail-lf0-x231.google.com (mail-lf0-x231.google.com [IPv6:2a00:1450:4010:c07::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 806DD1EA1; Fri, 5 May 2017 03:08:43 +0000 (UTC) (envelope-from bogorodskiy@gmail.com) Received: by mail-lf0-x231.google.com with SMTP id r17so17914529lfg.0; Thu, 04 May 2017 20:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=AUI3Xri376GQRJIXjTwyY/1Sm70zIAoOI4QBBxwBqRk=; b=A0HkJqvwPPQxS/nEDh4PVZq/+spQO7WRWmpRO/P1OyexM1KsTsisU53hhcJVu3JTn8 /DyziLOZDs0KOQ16E1KBZDBg4Cca8+DLdhJs68Ef/0M1NDOiOe+NNzct6jDEVnQbBoA4 Agb7JHYV/EHocFnz4k5TGM2oIt4tiGcIQOHza1Biq5OBuAGvfqEKN5PyRGv6WEsGYhbk C+I3PuI1633klmljvTZ/3npr7BkgYmo39Z0IkJH0zmfhu2Z1H+Hnu06z+/o+nxq1LHQ8 +9DNmD2w0dzbMSBLoXV41c/45G013Tvxv9ASC+NgJWRYIHgTRPtyPrXFv0wltlmwvdoc 94ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=AUI3Xri376GQRJIXjTwyY/1Sm70zIAoOI4QBBxwBqRk=; b=BtJM6dZblKcZauhajpUfy1tKaJoadgWR+EKbNSXnYQPqzQED/GPWPzvY/o+9zfSivc uNcNhQ92Zzz3NtoWeeHR1OXFbjvRfBcPKMEVBNg8gcquH/Oa4fieJDIjbhgjee+KV8nr Gz2TfHOSXnOKfJl1dykpsgWArJ4cuQROOdGqz8AiXkgdrcOAnZ4MSFkDK+xqZC16WDp1 YRT9x7Jqjg5lpg+xo5dbMaQezRWPqY0J/dZs2hfrY/UfwnkaMG0zyMUIihf7l0VxJLSu 77m5xUUZXWtlty/5UvqyzRJCTBMS9g3U7CsxjH/jclFg67+tw83kUPPUPSdwY8yJCHzo FSJQ== X-Gm-Message-State: AN3rC/5JsiVQQaw6o7gU61tmSDATz6g4eDs2lupTHcoKhhJT+ROiKwbv j6GC8t7vDbjdBnYs X-Received: by 10.25.67.84 with SMTP id m20mr15824118lfj.124.1493953720723; Thu, 04 May 2017 20:08:40 -0700 (PDT) Received: from dev.san.ru ([88.147.129.60]) by smtp.gmail.com with ESMTPSA id t26sm770160lja.25.2017.05.04.20.08.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 May 2017 20:08:39 -0700 (PDT) Date: Fri, 5 May 2017 07:08:34 +0400 From: Roman Bogorodskiy To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317777 - head/usr.sbin/bhyve Message-ID: <20170505030832.GA23004@dev.san.ru> References: <201705032144.v43Li4ns083507@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="2fHTh5uZTiUOsy+g" Content-Disposition: inline In-Reply-To: <201705032144.v43Li4ns083507@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 03:08:44 -0000 --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Gleb Smirnoff wrote: > Author: glebius > Date: Wed May 3 21:44:04 2017 > New Revision: 317777 > URL: https://svnweb.freebsd.org/changeset/base/317777 >=20 > Log: > Improve documentation of fbuf device. > =20 > Submitted by: novel > Reviewed by: grehan, bcr > Differential Revision: https://reviews.freebsd.org/D10014 >=20 > Modified: > head/usr.sbin/bhyve/bhyve.8 Thanks! Roman Bogorodskiy --2fHTh5uZTiUOsy+g Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJZC+ywAAoJEMltX/4IwiJqeioH/3Zr8xF3drz+jera1DHD7SOU +Jh2SykGkHahnr6wsINkPLcYDNv+XISKiamIh1081nXup0n45xdvtfUVLLsWNAaq J6J6jCptGp/GmR8gtkEaFTw5hMPDmqXmUhrlUOpoA+RlcOteNKjDS8mEVbqm1p7U cvE2yuV2csabVPGg6TqWt6msANmVijXpTxZKh0n5pQQFEAoPONbT7C6x1GYALnqC QvPRPQQf+FYqwIVb7RLEINXKgl9EveLk75Zc4rmTUbJEkLa4Uavwi6/dAmWbUzP5 VDVlCtZsMiOAc5epbKzmtgm7ZtEIlSZOJOCyQ+IA/4iArMVZGVEr+YnchxnODGU= =YS0n -----END PGP SIGNATURE----- --2fHTh5uZTiUOsy+g-- From owner-svn-src-head@freebsd.org Fri May 5 03:28:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EF45D5EE77; Fri, 5 May 2017 03:28:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30CF21208; Fri, 5 May 2017 03:28:31 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v453SUeO024792; Fri, 5 May 2017 03:28:30 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v453SULY024791; Fri, 5 May 2017 03:28:30 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201705050328.v453SULY024791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 5 May 2017 03:28:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317821 - head/sys/dev/hyperv/input X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 03:28:31 -0000 Author: sephe Date: Fri May 5 03:28:30 2017 New Revision: 317821 URL: https://svnweb.freebsd.org/changeset/base/317821 Log: hyperv/kbd: Channel read expects non-NULL channel argument. MFC after: now Sponsored by: Microsoft Modified: head/sys/dev/hyperv/input/hv_kbd.c Modified: head/sys/dev/hyperv/input/hv_kbd.c ============================================================================== --- head/sys/dev/hyperv/input/hv_kbd.c Fri May 5 00:54:23 2017 (r317820) +++ head/sys/dev/hyperv/input/hv_kbd.c Fri May 5 03:28:30 2017 (r317821) @@ -198,7 +198,7 @@ static void hvkbd_do_poll(hv_kbd_sc *sc, uint8_t wait) { while (!hv_kbd_prod_is_ready(sc)) { - hv_kbd_read_channel(NULL, sc); + hv_kbd_read_channel(sc->hs_chan, sc); if (!wait) break; } From owner-svn-src-head@freebsd.org Fri May 5 09:13:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A71DD5DAE9; Fri, 5 May 2017 09:13:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id ED4C06B1; Fri, 5 May 2017 09:13:25 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 003D0D4B252; Fri, 5 May 2017 19:13:09 +1000 (AEST) Date: Fri, 5 May 2017 19:13:04 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317809 - head/share/man/man7 In-Reply-To: <201705042131.v44LVokb076951@repo.freebsd.org> Message-ID: <20170505174957.B875@besplex.bde.org> References: <201705042131.v44LVokb076951@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=P2agC6XIiqhhGWV22zcA:9 a=f0uecB84bJpCj3_S:21 a=us6KGHLnjG7JW4LV:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 09:13:26 -0000 On Thu, 4 May 2017, Konstantin Belousov wrote: > Log: > Provide introduction for the arch(7) manpage. > > Start with some words about linear address space and its layout, then > explain pointers models and ABIs, providing explanation to the > structure of the tables. > > Reviewed by: emaste, imp > 'Future-proof' cheri wording by: brooks > > Modified: head/share/man/man7/arch.7 > ============================================================================== > --- head/share/man/man7/arch.7 Thu May 4 21:30:26 2017 (r317808) > +++ head/share/man/man7/arch.7 Thu May 4 21:31:50 2017 (r317809) > ... > @@ -35,9 +35,92 @@ > .Sh DESCRIPTION > Differences between CPU architectures and platforms supported by > .Fx . > -.Pp > +.Ss Introduction > If not explicitly mentioned, sizes are in bytes. > +.Pp > +FreeBSD uses flat address space for program execution, where > +pointers have the same binary representation as Minor grammar problems. "binary" is redundant. > +.Vt unsigned long > +variables, and > +.Vt uintptr_t > +and > +.Vt size_t > +types are synonyms for > +.Vt unsigned long . uintptr_t and size_t are are not synonyms for unsigned long on all arches. They only have the same respresentation on 32-bit arches. On 32-bit arches, they are synonyms for unsigned int, and thus have a lower rank than unsigned long. This mainly causes problems printing them, but might cause sign extension/overblow problems. For example, (size_t)0 + (long)-1 is unsigned and large positive on 64-bit arches, but signed and small negative on 32-bit arches. > +.Pp > +In order to maximize compatibility with future pointer integrity mechanisms, "pointer integrity mechanisms" sounds like management/marketingspeak. "integrity" isn't a relevant property of integer types. "mechanism" might mean the details of the representation (more than the size), but I think you just mean the size. Most manipulations of pointers as integers assume the same representation. You stated that the representation is the same [in future] above, and didn't use the usual caveat "on all supported arches". I don't like this, but lots of code depends on it. Translation of the above: "... compatibility with changes in the size of pointers in future implementations". > +manipulations of pointers as integers should be performed via > +.Vt uintptr_t > +or > +.Vt intptr_t > +and no other types. Except in the kernel, vm_offset_t should normally be used. In fact, it is wrong to use [u]intptr_t for anything except what is guaranteed by the C standard. The only guarantee is that you get back the same value (not necessarily the same bits) if you start with a pointer of type void * (possibly also qualified void *) and convert it to [u]intptr_t and back. You can also look at the bits in the integer representation, but don't expect these to be useful. Errors generally start in the cast. To convert a struct pointer to an integer back (with the same value), it is necessary to first convert to void *, then to [u]intptr_t, then back to void *, and finally back to the struct pointer. Use vm_offset_t for unportable uses. For flat address spaces, it is assumed that addition of offsets in the integer corresponds to addition of byte offsets in the pointer, as if the pointer is a pointer to unsigned char. Most other properties follow from that. There is a problem converting to vm_offset_t. We should guarantee that vm_offset_t has all the properties of uintptr_t and much more -- that it is not restricted to conversions between void * and back. The second guarantee requires compiler support in general, by we assume a flat address space so it just requires the compiler to not be perverse. Obviously, if [u]intptr_t exists, then the compiler can add the intermediate casts to and from void * to handle other pointer types. > +In particular, > +.Vt long > +and > +.Vt ptrdiff_t > +should be avoided. prtdiff_t should never be used in portable code. Neither should pointer subtraction. Only pointer differences of up to PTRDIFF_MIN/MAX. Otherwise, pointer subtraction is undefined. PTRDIFF_MIN/MAX can be as low as +-65535. Perverse and portability-testing implementations implement the handy type int17_t to use it perversely for ptrdiff_t, with size_t perhaps also perversely small (it can be uint15_t), but usually much larger than this ptrdiff_t. Pointer subtraction is thus undefined in general even within the same array if the array has 65536 eleemnts. There is a minor practical problem with non-perverse ptrdiff_t and a corresponding problem for vm_offset_t. 32-bit vm_offset_t has a range of 4G, but can't handle negative offsets, so you have to be careful not to subtract a larger pointer from a smaller one, or handle the wrap from this. 32-bit ptrdiff_t has a range of +-2G, so it can't hande pointers differing by half of the address space. > +Compilers define > +.Dv _LP64 > +symbol when compiling for an > +.Dv LP64 > +ABI. Further minor grammar problems here and elsewhere: - missing "the" before _LP64 - "an" is confusing. First, "a" might be correct depending on how you pronounce LP64. I pronounce it as "el ...", so "an" is better than "a". But there is only 1 LP64, so "the" is more correct. "the LP64 ABI" is confusing too. LP64 isn't an ABI or a collection of ABIs. The collection is of arches, many using a single LP64 sub-ABI with variations in other parts of their ABI. > ... > +Examples are: > +.Bl -column -offset indent "powerpc64" "Sy ILP32 counterpart" > +.It Sy LP64 Ta Sy ILP32 counterpart This has the "Sy" sizing bug in only 1 field in the header. > @@ -48,6 +131,9 @@ On all supported architectures: > .It float Ta 4 > .It double Ta 8 > .El > +Integers are represented as two-complement. > +Alignment of integer and pointer types is natural, that is, > +the address of the variable must be congruent to zero modulo type size. Missing "the" after "modulo". Is it natural for arm? arm has unnatural struct padding, at least at the end of structs. Bruce From owner-svn-src-head@freebsd.org Fri May 5 09:46:08 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C643D5E4CC; Fri, 5 May 2017 09:46:08 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 126831751; Fri, 5 May 2017 09:46:07 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v459k1Jx098585 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 5 May 2017 12:46:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v459k1Jx098585 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v459k1ki098584; Fri, 5 May 2017 12:46:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 5 May 2017 12:46:01 +0300 From: Konstantin Belousov To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317809 - head/share/man/man7 Message-ID: <20170505094601.GW1622@kib.kiev.ua> References: <201705042131.v44LVokb076951@repo.freebsd.org> <20170505174957.B875@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170505174957.B875@besplex.bde.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 09:46:08 -0000 On Fri, May 05, 2017 at 07:13:04PM +1000, Bruce Evans wrote: > On Thu, 4 May 2017, Konstantin Belousov wrote: > uintptr_t and size_t are are not synonyms for unsigned long on all arches. > They only have the same respresentation on 32-bit arches. On 32-bit arches, > they are synonyms for unsigned int, and thus have a lower rank than > unsigned long. This mainly causes problems printing them, but might cause > sign extension/overblow problems. For example, (size_t)0 + (long)-1 is > unsigned and large positive on 64-bit arches, but signed and small negative > on 32-bit arches. Ok. For now, for the commit of articles fixes, I changed this to note that uintptr_t has same size as ulong. I might revisit this part of text after the trivial fixes are done. > > > +.Pp > > +In order to maximize compatibility with future pointer integrity mechanisms, > > "pointer integrity mechanisms" sounds like management/marketingspeak. > "integrity" isn't a relevant property of integer types. "mechanism" might > mean the details of the representation (more than the size), but I think > you just mean the size. Most manipulations of pointers as integers > assume the same representation. You stated that the representation is > the same [in future] above, and didn't use the usual caveat "on all > supported arches". I don't like this, but lots of code depends on it. AFAIU, cheri is somewhat like Intel MPX, but more. I do not know fine details. For MPX, pointers are no longer plain pointers, there is a data behind the raw value, providing e.g. the range of bytes which are valid to dereference through the authentic value of the pointer and arithmetic manipulations of it. So the phrase is correct, and the below reformulation really removes the content. > > Translation of the above: "... compatibility with changes in the size of > pointers in future implementations". > > > +Compilers define > > +.Dv _LP64 > > +symbol when compiling for an > > +.Dv LP64 > > +ABI. > > Further minor grammar problems here and elsewhere: > - missing "the" before _LP64 > - "an" is confusing. First, "a" might be correct depending on how you > pronounce LP64. I pronounce it as "el ...", so "an" is better than > "a". But there is only 1 LP64, so "the" is more correct. "the LP64 > ABI" is confusing too. LP64 isn't an ABI or a collection of ABIs. > The collection is of arches, many using a single LP64 sub-ABI with > variations in other parts of their ABI. Of course there are architectures which have more that one LP64 ABI, eg. PowerPC ELF v1 and v2. Even i386, de facto, have two incompatible ABIs now: one older SysVR4 ABI where stack is 4-bytes aligned, and modern Linux ABI which claims that stack must be 16-bytes aligned, as enforced by modern gcc. The variation is not minor, it causes reliable user pain when mixed in. > > +Integers are represented as two-complement. > > +Alignment of integer and pointer types is natural, that is, > > +the address of the variable must be congruent to zero modulo type size. > > Missing "the" after "modulo". > > Is it natural for arm? arm has unnatural struct padding, at least at > the end of structs. I am not sure what exactly you mean about unnatural struct padding, AFAIR ARM has the same rule of structure having the alignment requirement of the most aligned member. ARMv7 has a requirement of uint64_t having 8-bytes alignment (unlike other 32bit platforms). Might be, indeed, this should be more accurate, but in fact ARM is correct for this sentence. Below are the small corrections. diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 index 2add6ea3d3e..1c056849861 100644 --- a/share/man/man7/arch.7 +++ b/share/man/man7/arch.7 @@ -39,13 +39,13 @@ Differences between CPU architectures and platforms supported by If not explicitly mentioned, sizes are in bytes. .Pp FreeBSD uses flat address space for program execution, where -pointers have the same binary representation as +pointers have the same representation as .Vt unsigned long variables, and .Vt uintptr_t and .Vt size_t -types are synonyms for +types have same size as .Vt unsigned long . .Pp In order to maximize compatibility with future pointer integrity mechanisms, @@ -93,7 +93,7 @@ and .Vt void * are 8 bytes. .El -Compilers define +Compilers define the .Dv _LP64 symbol when compiling for an .Dv LP64 @@ -108,7 +108,7 @@ execution environment is accompanied by the .Dv ILP32 environment, which was historical 32-bit predecessor for 64-bit evolution. Examples are: -.Bl -column -offset indent "powerpc64" "Sy ILP32 counterpart" +.Bl -column -offset indent "Dv powerpc64" "Sy ILP32 counterpart" .It Sy LP64 Ta Sy ILP32 counterpart .It Dv amd64 Ta Dv i386 .It Dv powerpc64 Ta Dv powerpc @@ -133,7 +133,7 @@ On all supported architectures: .El Integers are represented as two-complement. Alignment of integer and pointer types is natural, that is, -the address of the variable must be congruent to zero modulo type size. +the address of the variable must be congruent to zero modulo the type size. .Pp Machine-dependent type sizes: .Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t" From owner-svn-src-head@freebsd.org Fri May 5 10:01:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12B63D5E8C8; Fri, 5 May 2017 10:01:29 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6A031E6F; Fri, 5 May 2017 10:01:28 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45A1Rvg083049; Fri, 5 May 2017 10:01:27 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45A1Rle083048; Fri, 5 May 2017 10:01:27 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201705051001.v45A1Rle083048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 5 May 2017 10:01:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317824 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 10:01:29 -0000 Author: andrew Date: Fri May 5 10:01:27 2017 New Revision: 317824 URL: https://svnweb.freebsd.org/changeset/base/317824 Log: Add reclaim_pv_chunk on arm64. This is based on the amd64 code so should operate similarly, other than not needing the delayed invalidation. It has been tested with artificial injection of vm_page_alloc failures while running 'sort /dev/zero'. Reviewed by: alc, kib MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D10574 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Fri May 5 06:00:32 2017 (r317823) +++ head/sys/arm64/arm64/pmap.c Fri May 5 10:01:27 2017 (r317824) @@ -1849,8 +1849,129 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_ static vm_page_t reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp) { + struct pch new_tail; + struct pv_chunk *pc; + struct md_page *pvh; + pd_entry_t *pde; + pmap_t pmap; + pt_entry_t *pte, tpte; + pv_entry_t pv; + vm_offset_t va; + vm_page_t m, m_pc; + struct spglist free; + uint64_t inuse; + int bit, field, freed, lvl; - panic("ARM64TODO: reclaim_pv_chunk"); + PMAP_LOCK_ASSERT(locked_pmap, MA_OWNED); + KASSERT(lockp != NULL, ("reclaim_pv_chunk: lockp is NULL")); + pmap = NULL; + m_pc = NULL; + SLIST_INIT(&free); + TAILQ_INIT(&new_tail); + mtx_lock(&pv_chunks_mutex); + while ((pc = TAILQ_FIRST(&pv_chunks)) != NULL && SLIST_EMPTY(&free)) { + TAILQ_REMOVE(&pv_chunks, pc, pc_lru); + mtx_unlock(&pv_chunks_mutex); + if (pmap != pc->pc_pmap) { + if (pmap != NULL && pmap != locked_pmap) + PMAP_UNLOCK(pmap); + pmap = pc->pc_pmap; + /* Avoid deadlock and lock recursion. */ + if (pmap > locked_pmap) { + RELEASE_PV_LIST_LOCK(lockp); + PMAP_LOCK(pmap); + } else if (pmap != locked_pmap && + !PMAP_TRYLOCK(pmap)) { + pmap = NULL; + TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru); + mtx_lock(&pv_chunks_mutex); + continue; + } + } + + /* + * Destroy every non-wired, 4 KB page mapping in the chunk. + */ + freed = 0; + for (field = 0; field < _NPCM; field++) { + for (inuse = ~pc->pc_map[field] & pc_freemask[field]; + inuse != 0; inuse &= ~(1UL << bit)) { + bit = ffsl(inuse) - 1; + pv = &pc->pc_pventry[field * 64 + bit]; + va = pv->pv_va; + pde = pmap_pde(pmap, va, &lvl); + if (lvl != 2) + continue; + pte = pmap_l2_to_l3(pde, va); + tpte = pmap_load(pte); + if ((tpte & ATTR_SW_WIRED) != 0) + continue; + tpte = pmap_load_clear(pte); + PTE_SYNC(pte); + pmap_invalidate_page(pmap, va); + m = PHYS_TO_VM_PAGE(tpte & ~ATTR_MASK); + if (pmap_page_dirty(tpte)) + vm_page_dirty(m); + if ((tpte & ATTR_AF) != 0) + vm_page_aflag_set(m, PGA_REFERENCED); + CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lockp, m); + TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); + m->md.pv_gen++; + if (TAILQ_EMPTY(&m->md.pv_list) && + (m->flags & PG_FICTITIOUS) == 0) { + pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); + if (TAILQ_EMPTY(&pvh->pv_list)) { + vm_page_aflag_clear(m, + PGA_WRITEABLE); + } + } + pc->pc_map[field] |= 1UL << bit; + pmap_unuse_l3(pmap, va, pmap_load(pde), &free); + freed++; + } + } + if (freed == 0) { + TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru); + mtx_lock(&pv_chunks_mutex); + continue; + } + /* Every freed mapping is for a 4 KB page. */ + pmap_resident_count_dec(pmap, freed); + PV_STAT(atomic_add_long(&pv_entry_frees, freed)); + PV_STAT(atomic_add_int(&pv_entry_spare, freed)); + PV_STAT(atomic_subtract_long(&pv_entry_count, freed)); + TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); + if (pc->pc_map[0] == PC_FREE0 && pc->pc_map[1] == PC_FREE1 && + pc->pc_map[2] == PC_FREE2) { + PV_STAT(atomic_subtract_int(&pv_entry_spare, _NPCPV)); + PV_STAT(atomic_subtract_int(&pc_chunk_count, 1)); + PV_STAT(atomic_add_int(&pc_chunk_frees, 1)); + /* Entire chunk is free; return it. */ + m_pc = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); + dump_drop_page(m_pc->phys_addr); + mtx_lock(&pv_chunks_mutex); + break; + } + TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); + TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru); + mtx_lock(&pv_chunks_mutex); + /* One freed pv entry in locked_pmap is sufficient. */ + if (pmap == locked_pmap) + break; + } + TAILQ_CONCAT(&pv_chunks, &new_tail, pc_lru); + mtx_unlock(&pv_chunks_mutex); + if (pmap != NULL && pmap != locked_pmap) + PMAP_UNLOCK(pmap); + if (m_pc == NULL && !SLIST_EMPTY(&free)) { + m_pc = SLIST_FIRST(&free); + SLIST_REMOVE_HEAD(&free, plinks.s.ss); + /* Recycle a freed page table page. */ + m_pc->wire_count = 1; + atomic_add_int(&vm_cnt.v_wire_count, 1); + } + pmap_free_zero_pages(&free); + return (m_pc); } /* From owner-svn-src-head@freebsd.org Fri May 5 13:31:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B6AFD54433; Fri, 5 May 2017 13:31:33 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC7F62CE; Fri, 5 May 2017 13:31:32 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45DVV8e068776; Fri, 5 May 2017 13:31:31 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45DVPjb066620; Fri, 5 May 2017 13:31:25 GMT (envelope-from des@FreeBSD.org) Message-Id: <201705051331.v45DVPjb066620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Fri, 5 May 2017 13:31:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317827 - in head/contrib/openpam: . bin bin/openpam_dump_policy bin/pamtest bin/su doc doc/man include include/security lib lib/libpam misc modules modules/pam_deny modules/pam_permit ... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 13:31:33 -0000 Author: des Date: Fri May 5 13:31:25 2017 New Revision: 317827 URL: https://svnweb.freebsd.org/changeset/base/317827 Log: Upgrade to OpenPAM Resedacea. MFC after: 3 weeks Modified: head/contrib/openpam/HISTORY head/contrib/openpam/Makefile.am head/contrib/openpam/Makefile.in head/contrib/openpam/RELNOTES head/contrib/openpam/autogen.sh head/contrib/openpam/bin/Makefile.am head/contrib/openpam/bin/Makefile.in head/contrib/openpam/bin/openpam_dump_policy/Makefile.am head/contrib/openpam/bin/openpam_dump_policy/Makefile.in head/contrib/openpam/bin/openpam_dump_policy/openpam_dump_policy.c head/contrib/openpam/bin/pamtest/Makefile.am head/contrib/openpam/bin/pamtest/Makefile.in head/contrib/openpam/bin/pamtest/pamtest.1 head/contrib/openpam/bin/pamtest/pamtest.c head/contrib/openpam/bin/su/Makefile.am head/contrib/openpam/bin/su/Makefile.in head/contrib/openpam/bin/su/su.1 head/contrib/openpam/bin/su/su.c head/contrib/openpam/configure head/contrib/openpam/configure.ac head/contrib/openpam/doc/Makefile.am head/contrib/openpam/doc/Makefile.in head/contrib/openpam/doc/man/Makefile.am head/contrib/openpam/doc/man/Makefile.in head/contrib/openpam/doc/man/openpam.3 head/contrib/openpam/doc/man/openpam.man head/contrib/openpam/doc/man/openpam_borrow_cred.3 head/contrib/openpam/doc/man/openpam_free_data.3 head/contrib/openpam/doc/man/openpam_free_envlist.3 head/contrib/openpam/doc/man/openpam_get_feature.3 head/contrib/openpam/doc/man/openpam_get_option.3 head/contrib/openpam/doc/man/openpam_log.3 head/contrib/openpam/doc/man/openpam_nullconv.3 head/contrib/openpam/doc/man/openpam_readline.3 head/contrib/openpam/doc/man/openpam_readlinev.3 head/contrib/openpam/doc/man/openpam_readword.3 head/contrib/openpam/doc/man/openpam_restore_cred.3 head/contrib/openpam/doc/man/openpam_set_feature.3 head/contrib/openpam/doc/man/openpam_set_option.3 head/contrib/openpam/doc/man/openpam_straddch.3 head/contrib/openpam/doc/man/openpam_subst.3 head/contrib/openpam/doc/man/openpam_ttyconv.3 head/contrib/openpam/doc/man/pam.3 head/contrib/openpam/doc/man/pam.conf.5 head/contrib/openpam/doc/man/pam.man head/contrib/openpam/doc/man/pam_acct_mgmt.3 head/contrib/openpam/doc/man/pam_authenticate.3 head/contrib/openpam/doc/man/pam_chauthtok.3 head/contrib/openpam/doc/man/pam_close_session.3 head/contrib/openpam/doc/man/pam_conv.3 head/contrib/openpam/doc/man/pam_end.3 head/contrib/openpam/doc/man/pam_error.3 head/contrib/openpam/doc/man/pam_get_authtok.3 head/contrib/openpam/doc/man/pam_get_data.3 head/contrib/openpam/doc/man/pam_get_item.3 head/contrib/openpam/doc/man/pam_get_user.3 head/contrib/openpam/doc/man/pam_getenv.3 head/contrib/openpam/doc/man/pam_getenvlist.3 head/contrib/openpam/doc/man/pam_info.3 head/contrib/openpam/doc/man/pam_open_session.3 head/contrib/openpam/doc/man/pam_prompt.3 head/contrib/openpam/doc/man/pam_putenv.3 head/contrib/openpam/doc/man/pam_set_data.3 head/contrib/openpam/doc/man/pam_set_item.3 head/contrib/openpam/doc/man/pam_setcred.3 head/contrib/openpam/doc/man/pam_setenv.3 head/contrib/openpam/doc/man/pam_sm_acct_mgmt.3 head/contrib/openpam/doc/man/pam_sm_authenticate.3 head/contrib/openpam/doc/man/pam_sm_chauthtok.3 head/contrib/openpam/doc/man/pam_sm_close_session.3 head/contrib/openpam/doc/man/pam_sm_open_session.3 head/contrib/openpam/doc/man/pam_sm_setcred.3 head/contrib/openpam/doc/man/pam_start.3 head/contrib/openpam/doc/man/pam_strerror.3 head/contrib/openpam/doc/man/pam_verror.3 head/contrib/openpam/doc/man/pam_vinfo.3 head/contrib/openpam/doc/man/pam_vprompt.3 head/contrib/openpam/include/Makefile.am head/contrib/openpam/include/Makefile.in head/contrib/openpam/include/security/Makefile.am head/contrib/openpam/include/security/Makefile.in head/contrib/openpam/include/security/openpam.h head/contrib/openpam/include/security/openpam_attr.h head/contrib/openpam/include/security/openpam_version.h head/contrib/openpam/include/security/pam_appl.h head/contrib/openpam/include/security/pam_constants.h head/contrib/openpam/include/security/pam_modules.h head/contrib/openpam/include/security/pam_types.h head/contrib/openpam/lib/Makefile.am head/contrib/openpam/lib/Makefile.in head/contrib/openpam/lib/libpam/Makefile.am head/contrib/openpam/lib/libpam/Makefile.in head/contrib/openpam/lib/libpam/openpam_asprintf.c head/contrib/openpam/lib/libpam/openpam_asprintf.h head/contrib/openpam/lib/libpam/openpam_borrow_cred.c head/contrib/openpam/lib/libpam/openpam_check_owner_perms.c head/contrib/openpam/lib/libpam/openpam_configure.c head/contrib/openpam/lib/libpam/openpam_constants.c head/contrib/openpam/lib/libpam/openpam_constants.h head/contrib/openpam/lib/libpam/openpam_cred.h head/contrib/openpam/lib/libpam/openpam_ctype.h head/contrib/openpam/lib/libpam/openpam_debug.h head/contrib/openpam/lib/libpam/openpam_dispatch.c head/contrib/openpam/lib/libpam/openpam_dlfunc.h head/contrib/openpam/lib/libpam/openpam_dynamic.c head/contrib/openpam/lib/libpam/openpam_features.c head/contrib/openpam/lib/libpam/openpam_features.h head/contrib/openpam/lib/libpam/openpam_findenv.c head/contrib/openpam/lib/libpam/openpam_free_data.c head/contrib/openpam/lib/libpam/openpam_free_envlist.c head/contrib/openpam/lib/libpam/openpam_get_feature.c head/contrib/openpam/lib/libpam/openpam_get_option.c head/contrib/openpam/lib/libpam/openpam_impl.h head/contrib/openpam/lib/libpam/openpam_load.c head/contrib/openpam/lib/libpam/openpam_log.c head/contrib/openpam/lib/libpam/openpam_nullconv.c head/contrib/openpam/lib/libpam/openpam_readline.c head/contrib/openpam/lib/libpam/openpam_readlinev.c head/contrib/openpam/lib/libpam/openpam_readword.c head/contrib/openpam/lib/libpam/openpam_restore_cred.c head/contrib/openpam/lib/libpam/openpam_set_feature.c head/contrib/openpam/lib/libpam/openpam_set_option.c head/contrib/openpam/lib/libpam/openpam_static.c head/contrib/openpam/lib/libpam/openpam_straddch.c head/contrib/openpam/lib/libpam/openpam_strlcat.c head/contrib/openpam/lib/libpam/openpam_strlcat.h head/contrib/openpam/lib/libpam/openpam_strlcmp.h head/contrib/openpam/lib/libpam/openpam_strlcpy.c head/contrib/openpam/lib/libpam/openpam_strlcpy.h head/contrib/openpam/lib/libpam/openpam_strlset.c head/contrib/openpam/lib/libpam/openpam_strlset.h head/contrib/openpam/lib/libpam/openpam_subst.c head/contrib/openpam/lib/libpam/openpam_ttyconv.c head/contrib/openpam/lib/libpam/openpam_vasprintf.c head/contrib/openpam/lib/libpam/openpam_vasprintf.h head/contrib/openpam/lib/libpam/pam_acct_mgmt.c head/contrib/openpam/lib/libpam/pam_authenticate.c head/contrib/openpam/lib/libpam/pam_authenticate_secondary.c head/contrib/openpam/lib/libpam/pam_chauthtok.c head/contrib/openpam/lib/libpam/pam_close_session.c head/contrib/openpam/lib/libpam/pam_end.c head/contrib/openpam/lib/libpam/pam_error.c head/contrib/openpam/lib/libpam/pam_get_authtok.c head/contrib/openpam/lib/libpam/pam_get_data.c head/contrib/openpam/lib/libpam/pam_get_item.c head/contrib/openpam/lib/libpam/pam_get_mapped_authtok.c head/contrib/openpam/lib/libpam/pam_get_mapped_username.c head/contrib/openpam/lib/libpam/pam_get_user.c head/contrib/openpam/lib/libpam/pam_getenv.c head/contrib/openpam/lib/libpam/pam_getenvlist.c head/contrib/openpam/lib/libpam/pam_info.c head/contrib/openpam/lib/libpam/pam_open_session.c head/contrib/openpam/lib/libpam/pam_prompt.c head/contrib/openpam/lib/libpam/pam_putenv.c head/contrib/openpam/lib/libpam/pam_set_data.c head/contrib/openpam/lib/libpam/pam_set_item.c head/contrib/openpam/lib/libpam/pam_set_mapped_authtok.c head/contrib/openpam/lib/libpam/pam_set_mapped_username.c head/contrib/openpam/lib/libpam/pam_setcred.c head/contrib/openpam/lib/libpam/pam_setenv.c head/contrib/openpam/lib/libpam/pam_sm_acct_mgmt.c head/contrib/openpam/lib/libpam/pam_sm_authenticate.c head/contrib/openpam/lib/libpam/pam_sm_authenticate_secondary.c head/contrib/openpam/lib/libpam/pam_sm_chauthtok.c head/contrib/openpam/lib/libpam/pam_sm_close_session.c head/contrib/openpam/lib/libpam/pam_sm_get_mapped_authtok.c head/contrib/openpam/lib/libpam/pam_sm_get_mapped_username.c head/contrib/openpam/lib/libpam/pam_sm_open_session.c head/contrib/openpam/lib/libpam/pam_sm_set_mapped_authtok.c head/contrib/openpam/lib/libpam/pam_sm_set_mapped_username.c head/contrib/openpam/lib/libpam/pam_sm_setcred.c head/contrib/openpam/lib/libpam/pam_start.c head/contrib/openpam/lib/libpam/pam_strerror.c head/contrib/openpam/lib/libpam/pam_verror.c head/contrib/openpam/lib/libpam/pam_vinfo.c head/contrib/openpam/lib/libpam/pam_vprompt.c head/contrib/openpam/misc/gendoc.pl head/contrib/openpam/mkpkgng.in head/contrib/openpam/modules/Makefile.am head/contrib/openpam/modules/Makefile.in head/contrib/openpam/modules/pam_deny/Makefile.am head/contrib/openpam/modules/pam_deny/Makefile.in head/contrib/openpam/modules/pam_deny/pam_deny.c head/contrib/openpam/modules/pam_permit/Makefile.am head/contrib/openpam/modules/pam_permit/Makefile.in head/contrib/openpam/modules/pam_permit/pam_permit.c head/contrib/openpam/modules/pam_return/Makefile.am head/contrib/openpam/modules/pam_return/Makefile.in head/contrib/openpam/modules/pam_return/pam_return.c head/contrib/openpam/modules/pam_unix/Makefile.am head/contrib/openpam/modules/pam_unix/Makefile.in head/contrib/openpam/modules/pam_unix/pam_unix.c head/contrib/openpam/t/Makefile.am head/contrib/openpam/t/Makefile.in head/contrib/openpam/t/t_openpam_ctype.c head/contrib/openpam/t/t_openpam_dispatch.c head/contrib/openpam/t/t_openpam_readlinev.c head/contrib/openpam/t/t_openpam_readword.c head/contrib/openpam/t/t_pam_conv.c head/contrib/openpam/t/t_pam_conv.h Directory Properties: head/contrib/openpam/ (props changed) Modified: head/contrib/openpam/HISTORY ============================================================================== --- head/contrib/openpam/HISTORY Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/HISTORY Fri May 5 13:31:25 2017 (r317827) @@ -1,3 +1,23 @@ +OpenPAM Resedacea 2017-04-30 + + - BUGFIX: Reinstore the NULL check in pam_end(3) which was removed in + OpenPAM Radula, as it breaks common error-handling constructs. + + - BUGFIX: Return PAM_SYMBOL_ERR instead of PAM_SYSTEM_ERR from the + dispatcher when the required service function could not be found. + + - ENHANCE: Introduce the PAM_BAD_HANDLE error code for when pamh is + NULL in API functions that have a NULL check. + + - ENHANCE: Introduce the PAM_BAD_ITEM, PAM_BAD_FEATURE and + PAM_BAD_CONSTANT error codes for situations where we previously + incorrectly used PAM_SYMBOL_ERR to denote that an invalid constant + had been passed to an API function. + + - ENHANCE: Improve the RETURN VALUES section in API man pages, + especially for functions that cannot fail, which were incorrectly + documented as returning -1 on failure. +============================================================================ OpenPAM Radula 2017-02-19 - BUGFIX: Fix an inverted test which prevented pam_get_authtok(3) and Modified: head/contrib/openpam/Makefile.am ============================================================================== --- head/contrib/openpam/Makefile.am Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/Makefile.am Fri May 5 13:31:25 2017 (r317827) @@ -1,4 +1,4 @@ -# $Id: Makefile.am 917 2017-02-18 14:45:27Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ ACLOCAL_AMFLAGS = -I m4 Modified: head/contrib/openpam/Makefile.in ============================================================================== --- head/contrib/openpam/Makefile.in Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/Makefile.in Fri May 5 13:31:25 2017 (r317827) @@ -14,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.am 917 2017-02-18 14:45:27Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ @@ -165,7 +165,7 @@ CSCOPE = cscope DIST_SUBDIRS = misc include lib bin modules doc t am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/mkpkgng.in INSTALL README TODO compile config.guess \ - config.sub depcomp install-sh ltmain.sh missing + config.sub install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) Modified: head/contrib/openpam/RELNOTES ============================================================================== --- head/contrib/openpam/RELNOTES Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/RELNOTES Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ - Release notes for OpenPAM Radula - ================================ + Release notes for OpenPAM Resedacea + =================================== OpenPAM is developed primarily on FreeBSD, but is expected to work on almost any POSIX-like platform that has GNU autotools, GNU make and Modified: head/contrib/openpam/autogen.sh ============================================================================== --- head/contrib/openpam/autogen.sh Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/autogen.sh Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: autogen.sh 814 2014-09-12 07:46:46Z des $ +# $OpenPAM: autogen.sh 938 2017-04-30 21:34:42Z des $ # libtoolize --copy --force Modified: head/contrib/openpam/bin/Makefile.am ============================================================================== --- head/contrib/openpam/bin/Makefile.am Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/bin/Makefile.am Fri May 5 13:31:25 2017 (r317827) @@ -1,4 +1,4 @@ -# $Id: Makefile.am 907 2017-01-18 09:39:01Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ SUBDIRS = openpam_dump_policy Modified: head/contrib/openpam/bin/Makefile.in ============================================================================== --- head/contrib/openpam/bin/Makefile.in Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/bin/Makefile.in Fri May 5 13:31:25 2017 (r317827) @@ -14,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.am 907 2017-01-18 09:39:01Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ Modified: head/contrib/openpam/bin/openpam_dump_policy/Makefile.am ============================================================================== --- head/contrib/openpam/bin/openpam_dump_policy/Makefile.am Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/bin/openpam_dump_policy/Makefile.am Fri May 5 13:31:25 2017 (r317827) @@ -1,4 +1,4 @@ -# $Id: Makefile.am 834 2014-10-28 10:25:58Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/lib/libpam Modified: head/contrib/openpam/bin/openpam_dump_policy/Makefile.in ============================================================================== --- head/contrib/openpam/bin/openpam_dump_policy/Makefile.in Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/bin/openpam_dump_policy/Makefile.in Fri May 5 13:31:25 2017 (r317827) @@ -14,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.am 834 2014-10-28 10:25:58Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ VPATH = @srcdir@ am__is_gnu_make = { \ Modified: head/contrib/openpam/bin/openpam_dump_policy/openpam_dump_policy.c ============================================================================== --- head/contrib/openpam/bin/openpam_dump_policy/openpam_dump_policy.c Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/bin/openpam_dump_policy/openpam_dump_policy.c Fri May 5 13:31:25 2017 (r317827) @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: openpam_dump_policy.c 890 2016-01-11 16:22:09Z des $ + * $OpenPAM: openpam_dump_policy.c 938 2017-04-30 21:34:42Z des $ */ #ifdef HAVE_CONFIG_H Modified: head/contrib/openpam/bin/pamtest/Makefile.am ============================================================================== --- head/contrib/openpam/bin/pamtest/Makefile.am Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/bin/pamtest/Makefile.am Fri May 5 13:31:25 2017 (r317827) @@ -1,4 +1,4 @@ -# $Id: Makefile.am 834 2014-10-28 10:25:58Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ AM_CPPFLAGS = -I$(top_srcdir)/include Modified: head/contrib/openpam/bin/pamtest/Makefile.in ============================================================================== --- head/contrib/openpam/bin/pamtest/Makefile.in Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/bin/pamtest/Makefile.in Fri May 5 13:31:25 2017 (r317827) @@ -14,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.am 834 2014-10-28 10:25:58Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ VPATH = @srcdir@ am__is_gnu_make = { \ Modified: head/contrib/openpam/bin/pamtest/pamtest.1 ============================================================================== --- head/contrib/openpam/bin/pamtest/pamtest.1 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/bin/pamtest/pamtest.1 Fri May 5 13:31:25 2017 (r317827) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2011 Dag-Erling Smørgrav +.\" Copyright (c) 2011-2017 Dag-Erling Smørgrav .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -26,9 +26,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: pamtest.1 924 2017-02-19 20:52:28Z des $ +.\" $OpenPAM: pamtest.1 939 2017-04-30 21:36:50Z des $ .\" -.Dd February 19, 2017 +.Dd April 30, 2017 .Dt PAMTEST 1 .Os .Sh NAME Modified: head/contrib/openpam/bin/pamtest/pamtest.c ============================================================================== --- head/contrib/openpam/bin/pamtest/pamtest.c Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/bin/pamtest/pamtest.c Fri May 5 13:31:25 2017 (r317827) @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pamtest.c 685 2013-07-11 16:33:34Z des $ + * $OpenPAM: pamtest.c 938 2017-04-30 21:34:42Z des $ */ #ifdef HAVE_CONFIG_H Modified: head/contrib/openpam/bin/su/Makefile.am ============================================================================== --- head/contrib/openpam/bin/su/Makefile.am Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/bin/su/Makefile.am Fri May 5 13:31:25 2017 (r317827) @@ -1,4 +1,4 @@ -# $Id: Makefile.am 834 2014-10-28 10:25:58Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ AM_CPPFLAGS = -I$(top_srcdir)/include Modified: head/contrib/openpam/bin/su/Makefile.in ============================================================================== --- head/contrib/openpam/bin/su/Makefile.in Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/bin/su/Makefile.in Fri May 5 13:31:25 2017 (r317827) @@ -14,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.am 834 2014-10-28 10:25:58Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ VPATH = @srcdir@ am__is_gnu_make = { \ Modified: head/contrib/openpam/bin/su/su.1 ============================================================================== --- head/contrib/openpam/bin/su/su.1 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/bin/su/su.1 Fri May 5 13:31:25 2017 (r317827) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2011 Dag-Erling Smørgrav +.\" Copyright (c) 2011-2017 Dag-Erling Smørgrav .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -26,9 +26,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: su.1 924 2017-02-19 20:52:28Z des $ +.\" $OpenPAM: su.1 939 2017-04-30 21:36:50Z des $ .\" -.Dd February 19, 2017 +.Dd April 30, 2017 .Dt SU 1 .Os .Sh NAME Modified: head/contrib/openpam/bin/su/su.c ============================================================================== --- head/contrib/openpam/bin/su/su.c Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/bin/su/su.c Fri May 5 13:31:25 2017 (r317827) @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: su.c 648 2013-03-05 17:54:27Z des $ + * $OpenPAM: su.c 938 2017-04-30 21:34:42Z des $ */ #ifdef HAVE_CONFIG_H Modified: head/contrib/openpam/configure ============================================================================== --- head/contrib/openpam/configure Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/configure Fri May 5 13:31:25 2017 (r317827) @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.ac Id: configure.ac 924 2017-02-19 20:52:28Z des . +# From configure.ac OpenPAM: configure.ac 939 2017-04-30 21:36:50Z des . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for OpenPAM 20170219. +# Generated by GNU Autoconf 2.69 for OpenPAM 20170430. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='OpenPAM' PACKAGE_TARNAME='openpam' -PACKAGE_VERSION='20170219' -PACKAGE_STRING='OpenPAM 20170219' +PACKAGE_VERSION='20170430' +PACKAGE_STRING='OpenPAM 20170430' PACKAGE_BUGREPORT='des@des.no' PACKAGE_URL='http://www.openpam.org/' @@ -1345,7 +1345,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures OpenPAM 20170219 to adapt to many kinds of systems. +\`configure' configures OpenPAM 20170430 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1415,7 +1415,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of OpenPAM 20170219:";; + short | recursive ) echo "Configuration of OpenPAM 20170430:";; esac cat <<\_ACEOF @@ -1540,7 +1540,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -OpenPAM configure 20170219 +OpenPAM configure 20170430 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1909,7 +1909,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by OpenPAM $as_me 20170219, which was +It was created by OpenPAM $as_me 20170430, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2774,7 +2774,7 @@ fi # Define the identity of the package. PACKAGE='openpam' - VERSION='20170219' + VERSION='20170430' cat >>confdefs.h <<_ACEOF @@ -13577,7 +13577,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by OpenPAM $as_me 20170219, which was +This file was extended by OpenPAM $as_me 20170430, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13644,7 +13644,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -OpenPAM config.status 20170219 +OpenPAM config.status 20170430 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: head/contrib/openpam/configure.ac ============================================================================== --- head/contrib/openpam/configure.ac Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/configure.ac Fri May 5 13:31:25 2017 (r317827) @@ -1,8 +1,8 @@ -dnl $Id: configure.ac 924 2017-02-19 20:52:28Z des $ +dnl $OpenPAM: configure.ac 939 2017-04-30 21:36:50Z des $ AC_PREREQ([2.62]) -AC_REVISION([$Id: configure.ac 924 2017-02-19 20:52:28Z des $]) -AC_INIT([OpenPAM], [20170219], [des@des.no], [openpam], [http://www.openpam.org/]) +AC_REVISION([$OpenPAM: configure.ac 939 2017-04-30 21:36:50Z des $]) +AC_INIT([OpenPAM], [20170430], [des@des.no], [openpam], [http://www.openpam.org/]) AC_CONFIG_SRCDIR([lib/libpam/pam_start.c]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign]) Modified: head/contrib/openpam/doc/Makefile.am ============================================================================== --- head/contrib/openpam/doc/Makefile.am Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/Makefile.am Fri May 5 13:31:25 2017 (r317827) @@ -1,3 +1,3 @@ -# $Id: Makefile.am 648 2013-03-05 17:54:27Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ SUBDIRS = man Modified: head/contrib/openpam/doc/Makefile.in ============================================================================== --- head/contrib/openpam/doc/Makefile.in Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/Makefile.in Fri May 5 13:31:25 2017 (r317827) @@ -14,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.am 648 2013-03-05 17:54:27Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ Modified: head/contrib/openpam/doc/man/Makefile.am ============================================================================== --- head/contrib/openpam/doc/man/Makefile.am Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/Makefile.am Fri May 5 13:31:25 2017 (r317827) @@ -1,4 +1,4 @@ -# $Id: Makefile.am 907 2017-01-18 09:39:01Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ NULL = Modified: head/contrib/openpam/doc/man/Makefile.in ============================================================================== --- head/contrib/openpam/doc/man/Makefile.in Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/Makefile.in Fri May 5 13:31:25 2017 (r317827) @@ -14,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.am 907 2017-01-18 09:39:01Z des $ +# $OpenPAM: Makefile.am 938 2017-04-30 21:34:42Z des $ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ Modified: head/contrib/openpam/doc/man/openpam.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,5 +1,5 @@ .\" Generated by gendoc.pl -.Dd February 19, 2017 +.Dd April 30, 2017 .Dt OPENPAM 3 .Os .Sh NAME @@ -81,7 +81,7 @@ .Ft "int" .Fn pam_vprompt "const pam_handle_t *pamh" "int style" "char **resp" "const char *fmt" "va_list ap" .\" -.\" $Id: openpam.man 648 2013-03-05 17:54:27Z des $ +.\" $OpenPAM: openpam.man 938 2017-04-30 21:34:42Z des $ .\" .Sh DESCRIPTION These functions are OpenPAM extensions to the PAM API. Modified: head/contrib/openpam/doc/man/openpam.man ============================================================================== --- head/contrib/openpam/doc/man/openpam.man Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam.man Fri May 5 13:31:25 2017 (r317827) @@ -1,5 +1,5 @@ .\" -.\" $Id: openpam.man 648 2013-03-05 17:54:27Z des $ +.\" $OpenPAM: openpam.man 938 2017-04-30 21:34:42Z des $ .\" .Sh DESCRIPTION These functions are OpenPAM extensions to the PAM API. Modified: head/contrib/openpam/doc/man/openpam_borrow_cred.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_borrow_cred.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_borrow_cred.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_borrow_cred.c by gendoc.pl -.\" $Id: openpam_borrow_cred.c 649 2013-03-05 17:58:33Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_borrow_cred.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_BORROW_CRED 3 .Os .Sh NAME @@ -29,6 +29,8 @@ The .Fn openpam_borrow_cred function returns one of the following values: .Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. .It Bq Er PAM_BUF_ERR Memory buffer error. .It Bq Er PAM_PERM_DENIED Modified: head/contrib/openpam/doc/man/openpam_free_data.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_free_data.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_free_data.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_free_data.c by gendoc.pl -.\" $Id: openpam_free_data.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_free_data.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_FREE_DATA 3 .Os .Sh NAME Modified: head/contrib/openpam/doc/man/openpam_free_envlist.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_free_envlist.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_free_envlist.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_free_envlist.c by gendoc.pl -.\" $Id: openpam_free_envlist.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_free_envlist.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_FREE_ENVLIST 3 .Os .Sh NAME Modified: head/contrib/openpam/doc/man/openpam_get_feature.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_get_feature.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_get_feature.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_get_feature.c by gendoc.pl -.\" $Id: openpam_get_feature.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_get_feature.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_GET_FEATURE 3 .Os .Sh NAME @@ -50,8 +50,10 @@ The .Fn openpam_get_feature function returns one of the following values: .Bl -tag -width 18n -.It Bq Er PAM_SYMBOL_ERR -Invalid symbol. +.It Bq Er PAM_SUCCESS +Success. +.It Bq Er PAM_BAD_FEATURE +Unrecognized or restricted feature. .El .Sh SEE ALSO .Xr openpam_set_feature 3 , Modified: head/contrib/openpam/doc/man/openpam_get_option.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_get_option.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_get_option.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_get_option.c by gendoc.pl -.\" $Id: openpam_get_option.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_get_option.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_GET_OPTION 3 .Os .Sh NAME Modified: head/contrib/openpam/doc/man/openpam_log.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_log.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_log.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_log.c by gendoc.pl -.\" $Id: openpam_log.c 686 2013-07-11 16:36:02Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_log.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_LOG 3 .Os .Sh NAME Modified: head/contrib/openpam/doc/man/openpam_nullconv.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_nullconv.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_nullconv.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_nullconv.c by gendoc.pl -.\" $Id: openpam_nullconv.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_nullconv.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_NULLCONV 3 .Os .Sh NAME @@ -38,6 +38,8 @@ The .Fn openpam_nullconv function returns one of the following values: .Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. .It Bq Er PAM_CONV_ERR Conversation failure. .El Modified: head/contrib/openpam/doc/man/openpam_readline.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_readline.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_readline.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_readline.c by gendoc.pl -.\" $Id: openpam_readline.c 703 2013-08-16 11:57:54Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_readline.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_READLINE 3 .Os .Sh NAME Modified: head/contrib/openpam/doc/man/openpam_readlinev.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_readlinev.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_readlinev.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_readlinev.c by gendoc.pl -.\" $Id: openpam_readlinev.c 890 2016-01-11 16:22:09Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_readlinev.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_READLINEV 3 .Os .Sh NAME Modified: head/contrib/openpam/doc/man/openpam_readword.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_readword.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_readword.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_readword.c by gendoc.pl -.\" $Id: openpam_readword.c 916 2017-02-07 12:25:58Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_readword.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_READWORD 3 .Os .Sh NAME Modified: head/contrib/openpam/doc/man/openpam_restore_cred.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_restore_cred.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_restore_cred.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_restore_cred.c by gendoc.pl -.\" $Id: openpam_restore_cred.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_restore_cred.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_RESTORE_CRED 3 .Os .Sh NAME @@ -23,6 +23,8 @@ The .Fn openpam_restore_cred function returns one of the following values: .Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. .It Bq Er PAM_NO_MODULE_DATA Module data not found. .It Bq Er PAM_SYSTEM_ERR Modified: head/contrib/openpam/doc/man/openpam_set_feature.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_set_feature.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_set_feature.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_set_feature.c by gendoc.pl -.\" $Id: openpam_set_feature.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_set_feature.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_SET_FEATURE 3 .Os .Sh NAME @@ -32,8 +32,10 @@ The .Fn openpam_set_feature function returns one of the following values: .Bl -tag -width 18n -.It Bq Er PAM_SYMBOL_ERR -Invalid symbol. +.It Bq Er PAM_SUCCESS +Success. +.It Bq Er PAM_BAD_FEATURE +Unrecognized or restricted feature. .El .Sh SEE ALSO .Xr openpam_get_feature 3 , Modified: head/contrib/openpam/doc/man/openpam_set_option.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_set_option.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_set_option.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_set_option.c by gendoc.pl -.\" $Id: openpam_set_option.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_set_option.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_SET_OPTION 3 .Os .Sh NAME @@ -23,6 +23,8 @@ The .Fn openpam_set_option function returns one of the following values: .Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. .It Bq Er PAM_BUF_ERR Memory buffer error. .It Bq Er PAM_SYSTEM_ERR Modified: head/contrib/openpam/doc/man/openpam_straddch.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_straddch.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_straddch.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_straddch.c by gendoc.pl -.\" $Id: openpam_straddch.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_straddch.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_STRADDCH 3 .Os .Sh NAME Modified: head/contrib/openpam/doc/man/openpam_subst.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_subst.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_subst.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_subst.c by gendoc.pl -.\" $Id: openpam_subst.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_subst.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_SUBST 3 .Os .Sh NAME @@ -81,6 +81,10 @@ The .Fn openpam_subst function returns one of the following values: .Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. +.It Bq Er PAM_BAD_ITEM +Unrecognized or restricted item. .It Bq Er PAM_TRY_AGAIN Try again. .El Modified: head/contrib/openpam/doc/man/openpam_ttyconv.3 ============================================================================== --- head/contrib/openpam/doc/man/openpam_ttyconv.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/openpam_ttyconv.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from openpam_ttyconv.c by gendoc.pl -.\" $Id: openpam_ttyconv.c 890 2016-01-11 16:22:09Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: openpam_ttyconv.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt OPENPAM_TTYCONV 3 .Os .Sh NAME @@ -32,6 +32,8 @@ The .Fn openpam_ttyconv function returns one of the following values: .Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. .It Bq Er PAM_BUF_ERR Memory buffer error. .It Bq Er PAM_CONV_ERR Modified: head/contrib/openpam/doc/man/pam.3 ============================================================================== --- head/contrib/openpam/doc/man/pam.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,5 +1,5 @@ .\" Generated by gendoc.pl -.Dd February 19, 2017 +.Dd April 30, 2017 .Dt PAM 3 .Os .Sh NAME @@ -60,7 +60,7 @@ .Ft "const char *" .Fn pam_strerror "const pam_handle_t *pamh" "int error_number" .\" -.\" $Id: pam.man 648 2013-03-05 17:54:27Z des $ +.\" $OpenPAM: pam.man 938 2017-04-30 21:34:42Z des $ .\" .Sh DESCRIPTION The Pluggable Authentication Modules (PAM) library abstracts a number @@ -180,6 +180,14 @@ Authentication token lock busy. Failed to recover old authentication token. .It Bq Er PAM_AUTH_ERR Authentication error. +.It Bq Er PAM_BAD_CONSTANT +Bad constant. +.It Bq Er PAM_BAD_FEATURE +Unrecognized or restricted feature. +.It Bq Er PAM_BAD_HANDLE +Invalid PAM handle. +.It Bq Er PAM_BAD_ITEM +Unrecognized or restricted item. .It Bq Er PAM_BUF_ERR Memory buffer error. .It Bq Er PAM_CONV_ERR Modified: head/contrib/openpam/doc/man/pam.conf.5 ============================================================================== --- head/contrib/openpam/doc/man/pam.conf.5 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam.conf.5 Fri May 5 13:31:25 2017 (r317827) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2005-2011 Dag-Erling Smørgrav +.\" Copyright (c) 2005-2017 Dag-Erling Smørgrav .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -26,9 +26,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: pam.conf.5 924 2017-02-19 20:52:28Z des $ +.\" $OpenPAM: pam.conf.5 939 2017-04-30 21:36:50Z des $ .\" -.Dd February 19, 2017 +.Dd April 30, 2017 .Dt PAM.CONF 5 .Os .Sh NAME Modified: head/contrib/openpam/doc/man/pam.man ============================================================================== --- head/contrib/openpam/doc/man/pam.man Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam.man Fri May 5 13:31:25 2017 (r317827) @@ -1,5 +1,5 @@ .\" -.\" $Id: pam.man 648 2013-03-05 17:54:27Z des $ +.\" $OpenPAM: pam.man 938 2017-04-30 21:34:42Z des $ .\" .Sh DESCRIPTION The Pluggable Authentication Modules (PAM) library abstracts a number Modified: head/contrib/openpam/doc/man/pam_acct_mgmt.3 ============================================================================== --- head/contrib/openpam/doc/man/pam_acct_mgmt.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam_acct_mgmt.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from pam_acct_mgmt.c by gendoc.pl -.\" $Id: pam_acct_mgmt.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: pam_acct_mgmt.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt PAM_ACCT_MGMT 3 .Os .Sh NAME @@ -37,6 +37,8 @@ The .Fn pam_acct_mgmt function returns one of the following values: .Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. .It Bq Er PAM_ABORT General failure. .It Bq Er PAM_ACCT_EXPIRED Modified: head/contrib/openpam/doc/man/pam_authenticate.3 ============================================================================== --- head/contrib/openpam/doc/man/pam_authenticate.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam_authenticate.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from pam_authenticate.c by gendoc.pl -.\" $Id: pam_authenticate.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: pam_authenticate.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt PAM_AUTHENTICATE 3 .Os .Sh NAME @@ -41,18 +41,22 @@ Fail if the user's authentication token If any other bits are set, .Fn pam_authenticate will return -.Dv PAM_SYMBOL_ERR . +.Dv PAM_BAD_CONSTANT . .Sh RETURN VALUES The .Fn pam_authenticate function returns one of the following values: .Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. .It Bq Er PAM_ABORT General failure. .It Bq Er PAM_AUTHINFO_UNAVAIL Authentication information is unavailable. .It Bq Er PAM_AUTH_ERR Authentication error. +.It Bq Er PAM_BAD_CONSTANT +Bad constant. .It Bq Er PAM_BUF_ERR Memory buffer error. .It Bq Er PAM_CONV_ERR @@ -65,8 +69,6 @@ Maximum number of tries exceeded. Permission denied. .It Bq Er PAM_SERVICE_ERR Error in service module. -.It Bq Er PAM_SYMBOL_ERR -Invalid symbol. .It Bq Er PAM_SYSTEM_ERR System error. .It Bq Er PAM_USER_UNKNOWN Modified: head/contrib/openpam/doc/man/pam_chauthtok.3 ============================================================================== --- head/contrib/openpam/doc/man/pam_chauthtok.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam_chauthtok.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from pam_chauthtok.c by gendoc.pl -.\" $Id: pam_chauthtok.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: pam_chauthtok.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt PAM_CHAUTHTOK 3 .Os .Sh NAME @@ -33,12 +33,14 @@ Change only those authentication tokens If any other bits are set, .Fn pam_chauthtok will return -.Dv PAM_SYMBOL_ERR . +.Dv PAM_BAD_CONSTANT . .Sh RETURN VALUES The .Fn pam_chauthtok function returns one of the following values: .Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. .It Bq Er PAM_ABORT General failure. .It Bq Er PAM_AUTHTOK_DISABLE_AGING @@ -49,6 +51,8 @@ Authentication token failure. Authentication token lock busy. .It Bq Er PAM_AUTHTOK_RECOVERY_ERR Failed to recover old authentication token. +.It Bq Er PAM_BAD_CONSTANT +Bad constant. .It Bq Er PAM_BUF_ERR Memory buffer error. .It Bq Er PAM_CONV_ERR @@ -57,8 +61,6 @@ Conversation failure. Permission denied. .It Bq Er PAM_SERVICE_ERR Error in service module. -.It Bq Er PAM_SYMBOL_ERR -Invalid symbol. .It Bq Er PAM_SYSTEM_ERR System error. .It Bq Er PAM_TRY_AGAIN Modified: head/contrib/openpam/doc/man/pam_close_session.3 ============================================================================== --- head/contrib/openpam/doc/man/pam_close_session.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam_close_session.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from pam_close_session.c by gendoc.pl -.\" $Id: pam_close_session.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: pam_close_session.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt PAM_CLOSE_SESSION 3 .Os .Sh NAME @@ -30,14 +30,18 @@ Do not emit any messages. If any other bits are set, .Fn pam_close_session will return -.Dv PAM_SYMBOL_ERR . +.Dv PAM_BAD_CONSTANT . .Sh RETURN VALUES The .Fn pam_close_session function returns one of the following values: .Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. .It Bq Er PAM_ABORT General failure. +.It Bq Er PAM_BAD_CONSTANT +Bad constant. .It Bq Er PAM_BUF_ERR Memory buffer error. .It Bq Er PAM_CONV_ERR @@ -48,8 +52,6 @@ Permission denied. Error in service module. .It Bq Er PAM_SESSION_ERR Session failure. -.It Bq Er PAM_SYMBOL_ERR -Invalid symbol. .It Bq Er PAM_SYSTEM_ERR System error. .El Modified: head/contrib/openpam/doc/man/pam_conv.3 ============================================================================== --- head/contrib/openpam/doc/man/pam_conv.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam_conv.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\"- .\" Copyright (c) 2002-2003 Networks Associates Technology, Inc. -.\" Copyright (c) 2004-2014 Dag-Erling Smørgrav +.\" Copyright (c) 2004-2017 Dag-Erling Smørgrav .\" All rights reserved. .\" .\" This software was developed for the FreeBSD Project by ThinkSec AS and @@ -32,9 +32,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: pam_conv.3 924 2017-02-19 20:52:28Z des $ +.\" $OpenPAM: pam_conv.3 939 2017-04-30 21:36:50Z des $ .\" -.Dd February 19, 2017 +.Dd April 30, 2017 .Dt PAM_CONV 3 .Os .Sh NAME Modified: head/contrib/openpam/doc/man/pam_end.3 ============================================================================== --- head/contrib/openpam/doc/man/pam_end.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam_end.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from pam_end.c by gendoc.pl -.\" $Id: pam_end.c 913 2017-01-21 15:11:12Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: pam_end.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt PAM_END 3 .Os .Sh NAME @@ -25,7 +25,13 @@ last API call before the call to .Sh RETURN VALUES The .Fn pam_end -function returns 0 on success and -1 on failure. +function returns one of the following values: +.Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. +.It Bq Er PAM_BAD_HANDLE +Invalid PAM handle. +.El .Sh SEE ALSO .Xr pam 3 , .Xr pam_strerror 3 Modified: head/contrib/openpam/doc/man/pam_error.3 ============================================================================== --- head/contrib/openpam/doc/man/pam_error.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam_error.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from pam_error.c by gendoc.pl -.\" $Id: pam_error.c 648 2013-03-05 17:54:27Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: pam_error.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt PAM_ERROR 3 .Os .Sh NAME @@ -22,6 +22,8 @@ The .Fn pam_error function returns one of the following values: .Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. .It Bq Er PAM_BUF_ERR Memory buffer error. .It Bq Er PAM_CONV_ERR Modified: head/contrib/openpam/doc/man/pam_get_authtok.3 ============================================================================== --- head/contrib/openpam/doc/man/pam_get_authtok.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam_get_authtok.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from pam_get_authtok.c by gendoc.pl -.\" $Id: pam_get_authtok.c 913 2017-01-21 15:11:12Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: pam_get_authtok.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt PAM_GET_AUTHTOK 3 .Os .Sh NAME @@ -121,6 +121,12 @@ The .Fn pam_get_authtok function returns one of the following values: .Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. +.It Bq Er PAM_BAD_CONSTANT +Bad constant. +.It Bq Er PAM_BAD_ITEM +Unrecognized or restricted item. .It Bq Er PAM_BUF_ERR Memory buffer error. .It Bq Er PAM_CONV_ERR Modified: head/contrib/openpam/doc/man/pam_get_data.3 ============================================================================== --- head/contrib/openpam/doc/man/pam_get_data.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam_get_data.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from pam_get_data.c by gendoc.pl -.\" $Id: pam_get_data.c 913 2017-01-21 15:11:12Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: pam_get_data.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt PAM_GET_DATA 3 .Os .Sh NAME @@ -39,6 +39,8 @@ The .Fn pam_get_data function returns one of the following values: .Bl -tag -width 18n +.It Bq Er PAM_SUCCESS +Success. .It Bq Er PAM_NO_MODULE_DATA Module data not found. .El Modified: head/contrib/openpam/doc/man/pam_get_item.3 ============================================================================== --- head/contrib/openpam/doc/man/pam_get_item.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam_get_item.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from pam_get_item.c by gendoc.pl -.\" $Id: pam_get_item.c 913 2017-01-21 15:11:12Z des $ -.Dd February 19, 2017 +.\" $OpenPAM: pam_get_item.c 938 2017-04-30 21:34:42Z des $ +.Dd April 30, 2017 .Dt PAM_GET_ITEM 3 .Os .Sh NAME @@ -74,8 +74,10 @@ The .Fn pam_get_item function returns one of the following values: .Bl -tag -width 18n -.It Bq Er PAM_SYMBOL_ERR -Invalid symbol. +.It Bq Er PAM_SUCCESS +Success. +.It Bq Er PAM_BAD_ITEM +Unrecognized or restricted item. .El .Sh SEE ALSO .Xr pam 3 , Modified: head/contrib/openpam/doc/man/pam_get_user.3 ============================================================================== --- head/contrib/openpam/doc/man/pam_get_user.3 Fri May 5 13:23:23 2017 (r317826) +++ head/contrib/openpam/doc/man/pam_get_user.3 Fri May 5 13:31:25 2017 (r317827) @@ -1,6 +1,6 @@ .\" Generated from pam_get_user.c by gendoc.pl *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri May 5 13:39:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 365B6D54842; Fri, 5 May 2017 13:39:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id D8F3A955; Fri, 5 May 2017 13:39:28 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 80254D4B942; Fri, 5 May 2017 23:39:26 +1000 (AEST) Date: Fri, 5 May 2017 23:39:23 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317809 - head/share/man/man7 In-Reply-To: <20170505094601.GW1622@kib.kiev.ua> Message-ID: <20170505222702.Y1875@besplex.bde.org> References: <201705042131.v44LVokb076951@repo.freebsd.org> <20170505174957.B875@besplex.bde.org> <20170505094601.GW1622@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=V-qVY9ac0Ef0Wjqo2ccA:9 a=tuZyeQHKW20P4Jau:21 a=YWQufMc4izO5o4Wp:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 13:39:29 -0000 On Fri, 5 May 2017, Konstantin Belousov wrote: > On Fri, May 05, 2017 at 07:13:04PM +1000, Bruce Evans wrote: >> On Thu, 4 May 2017, Konstantin Belousov wrote: >> uintptr_t and size_t are are not synonyms for unsigned long on all arches. >> They only have the same respresentation on 32-bit arches. On 32-bit arches, >> they are synonyms for unsigned int, and thus have a lower rank than >> unsigned long. This mainly causes problems printing them, but might cause >> sign extension/overblow problems. For example, (size_t)0 + (long)-1 is >> unsigned and large positive on 64-bit arches, but signed and small negative >> on 32-bit arches. > Ok. > > For now, for the commit of articles fixes, I changed this to note that > uintptr_t has same size as ulong. I might revisit this part of text after > the trivial fixes are done. Yes, it is worth saying that the sizes (and representation) are the same now, but don't say that they will always be the same. Longs have the wrong size on all arches except the unsupported i386-with- 64-bit longs. They should be twice as long as a machine register. There are related problems with __int128_t existing. This breaks intptr_t being able to represent all integers. Expanding intptr_t to fix this gives much the same problems as expanding long on 32-bit systems to avoid the long long abomination, but more. >>> +.Pp >>> +In order to maximize compatibility with future pointer integrity mechanisms, >> >> "pointer integrity mechanisms" sounds like management/marketingspeak. >> "integrity" isn't a relevant property of integer types. "mechanism" might >> mean the details of the representation (more than the size), but I think >> you just mean the size. Most manipulations of pointers as integers >> assume the same representation. You stated that the representation is >> the same [in future] above, and didn't use the usual caveat "on all >> supported arches". I don't like this, but lots of code depends on it. > AFAIU, cheri is somewhat like Intel MPX, but more. I do not know fine > details. > > For MPX, pointers are no longer plain pointers, there is a data behind > the raw value, providing e.g. the range of bytes which are valid to > dereference through the authentic value of the pointer and arithmetic > manipulations of it. So the address space isn't exactly flat. Better de-emphasize that. I believe ia64 has fat function pointers, and uses handles so that some things appear to work normally. But comparison of function pointer (handle) addresses is almost meaningless. It isn't clear how gprof can work. It would needs something like mapping function addresses to handled addresses linearly. Similarly for conversion to uintptr_t. > So the phrase is correct, and the below reformulation really removes the > content. "integrity" isn't correct since it has nothing to do with integers. "mechanisms" doesn't make much sens either. Use the standard term "representation". >> Translation of the above: "... compatibility with changes in the size of >> pointers in future implementations". Change "size" to "representation" if you want to allow for more than the size changing. >>> +Compilers define >>> +.Dv _LP64 >>> +symbol when compiling for an >>> +.Dv LP64 >>> +ABI. >> >> Further minor grammar problems here and elsewhere: >> - missing "the" before _LP64 >> - "an" is confusing. First, "a" might be correct depending on how you >> pronounce LP64. I pronounce it as "el ...", so "an" is better than >> "a". But there is only 1 LP64, so "the" is more correct. "the LP64 >> ABI" is confusing too. LP64 isn't an ABI or a collection of ABIs. >> The collection is of arches, many using a single LP64 sub-ABI with >> variations in other parts of their ABI. > Of course there are architectures which have more that one LP64 ABI, > eg. PowerPC ELF v1 and v2. No, there is only 1 LP64 by definition. It is not really an ABI, and only gives the sizes. > Even i386, de facto, have two incompatible ABIs now: one older SysVR4 ABI > where stack is 4-bytes aligned, and modern Linux ABI which claims that > stack must be 16-bytes aligned, as enforced by modern gcc. The variation > is not minor, it causes reliable user pain when mixed in. That is just a bug in Linux. More differently, at least mips have little-endian and big-endian variants. The details seem to be undocumented. __MIPSEB__ gives big endian in , but the arch names have different spellings with e's. LP64 only tells you the sizes, so is very far from giving an ABI. >>> +Integers are represented as two-complement. >>> +Alignment of integer and pointer types is natural, that is, >>> +the address of the variable must be congruent to zero modulo type size. >> >> Missing "the" after "modulo". >> >> Is it natural for arm? arm has unnatural struct padding, at least at >> the end of structs. > > I am not sure what exactly you mean about unnatural struct padding, > AFAIR ARM has the same rule of structure having the alignment requirement > of the most aligned member. arm unnaturally pads structs to 4-byte boundaries IIRC. This is useless except for alignment. This affects the ABI just as much as alignment, since it affects the sizes of nested structs and arrays of structs. > ARMv7 has a requirement of uint64_t having > 8-bytes alignment (unlike other 32bit platforms). Might be, indeed, this > should be more accurate, but in fact ARM is correct for this sentence. arm has _ALIGNBYTES = (sizeof(int) - 1) for __ARM_ARCH >= 6, else _ALIGNBYTES = (sizeof(long long) - 1). This is backwards if ARMv7 really needs 8. There are bugs in the comment too. mips has _ALIGNBYTES = 7. This is spelled without obfuscations or abominations. The comment has less detail but no bugs. x86 has the necessary obfuscations of using __register_t and __uintptr_t to parametrize the difference between i386 and amd64. However, the comment has worse bugs than arm -- its claim that the type is unsigned int is just wrong on amd64. _ALIGNBYTES only gives the smallest alignment that works for all types (not even that for SSE accesses on x86). It is pessimal for doubles and long doubles on i386, and not best for int64_t either. Does the Linux ABI "fix" this? The natural ABI is not easy to see. > Below are the small corrections. > > diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 > index 2add6ea3d3e..1c056849861 100644 > --- a/share/man/man7/arch.7 > +++ b/share/man/man7/arch.7 > @@ -39,13 +39,13 @@ Differences between CPU architectures and platforms supported by > If not explicitly mentioned, sizes are in bytes. > .Pp > FreeBSD uses flat address space for program execution, where > -pointers have the same binary representation as > +pointers have the same representation as > .Vt unsigned long > variables, and > .Vt uintptr_t > and > .Vt size_t > -types are synonyms for > +types have same size as > .Vt unsigned long . Say that they have the same representation. We also assume/implement that everything is 2's complement with full range (the minimum negative value -2**-N is not left out), with the same natural 2's complement representation except for the size, and that sizes are powers of 2, and that all natural intN_t exist and are smallest and fast, so that it is just unportable to hard-code uses of intN_t and never use int_leastN_t or int_fastN_t. OK except for "integrity mechanisms". Change this to something simpler although not quite correct. If you want to allow for fat pointers then the earlier parts about flat address spaces would need adjustments too. Bruce From owner-svn-src-head@freebsd.org Fri May 5 14:09:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EEB5D5E43E; Fri, 5 May 2017 14:09:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43B6967D; Fri, 5 May 2017 14:09:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45E9il0084111; Fri, 5 May 2017 14:09:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45E9i2w084110; Fri, 5 May 2017 14:09:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201705051409.v45E9i2w084110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 5 May 2017 14:09:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317828 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 14:09:45 -0000 Author: hselasky Date: Fri May 5 14:09:44 2017 New Revision: 317828 URL: https://svnweb.freebsd.org/changeset/base/317828 Log: Fix for use after free in the LinuxKPI. Background: The same VM object might be shared by multiple processes and the mm_struct is usually freed when a process exits. Grab a reference on the mm_struct while the vmap is in the linux_vma_head list in case the first process which inserted a VM object has exited. Tested by: kwm @ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Fri May 5 13:31:25 2017 (r317827) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Fri May 5 14:09:44 2017 (r317828) @@ -485,6 +485,16 @@ linux_cdev_handle_insert(void *handle, s return (NULL); } } + /* + * The same VM object might be shared by multiple processes + * and the mm_struct is usually freed when a process exits. + * + * The atomic reference below makes sure the mm_struct is + * available as long as the vmap is in the linux_vma_head. + */ + if (atomic_inc_not_zero(&vmap->vm_mm->mm_users) == 0) + panic("linuxkpi: mm_users is zero\n"); + TAILQ_INSERT_TAIL(&linux_vma_head, vmap, vm_entry); rw_wunlock(&linux_vma_lock); return (vmap); @@ -499,6 +509,9 @@ linux_cdev_handle_remove(struct vm_area_ rw_wlock(&linux_vma_lock); TAILQ_REMOVE(&linux_vma_head, vmap, vm_entry); rw_wunlock(&linux_vma_lock); + + /* Drop reference on mm_struct */ + mmput(vmap->vm_mm); kfree(vmap); } From owner-svn-src-head@freebsd.org Fri May 5 14:24:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F956D5E903; Fri, 5 May 2017 14:24:40 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-it0-x22d.google.com (mail-it0-x22d.google.com [IPv6:2607:f8b0:4001:c0b::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 59E3FF64; Fri, 5 May 2017 14:24:40 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: by mail-it0-x22d.google.com with SMTP id x188so6240211itb.0; Fri, 05 May 2017 07:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=cpl0l6dhFmVRaviIwU0tfNzDF4hGm28t9onp81Ky7tc=; b=p1nfIj2epChexLPUMcTG1gh044vtcxjaiOfGOIR9eKpwDrm6q/bHIZFM56LePVIYhr /ygQnOHQeeeI3asGvzjHra/XzVZlM4+fUhW93OXHNibT10nA0wqrC8ztU27TDg/jVgad TTJqMTbQhqnmZJmlXT+GrRljILZq1qvOJKAYTDbsX/kwvxfvcFBpOLclFJAhXPeBqZbh 5bAuLPpU4d3xm22nshiymLJLa55FHOCVWWYuz+PZnMDhQ+NgnuokohSjb2SF11A08n8X pE5cSH8rTHdY5UbXiz/7fBhbGijKu8xGS+OA1y1wiPxMhNdkjQWTw50Sg8lhxsXSYVCy dQXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=cpl0l6dhFmVRaviIwU0tfNzDF4hGm28t9onp81Ky7tc=; b=oQcj4D27siRFl+kI+16VRc8XTZ0zdyJSLLuphi502XlbYvid5wfeIIlEJalVlAhmE1 576MeNGSOgRyfjeeabp0XW71MqjEHUCAN7zTJmGZjTyAnvd3rbr6/CSK2XHKekXTV+6K znrqeWJwLYTRtXKiMcMYOttW8GQwM+ZAS8LiQMyN1ZSyJBK1cfIw0/LKrzPufkeowccZ Beo+0iOiylt6L6e+PYYk33hXIhmsr/OT6Cp02FMfybpG23YAfh5OeyC3X+bs4sBZriGS azdEx/HG81oLc0o6Y2539qYDAO8hoj62i5Wq2UhjUl6WoiHlamh5Occx2btfNuvo1s8Y RF0g== X-Gm-Message-State: AN3rC/5Oi19eV2O5XFzw6LFoMR+r0aJiFBlNbFLUkJ2KwcHnAJo+K0I2 HfO9MB53C9Lj4WzKn2DuGiFwVRv9eg== X-Received: by 10.157.28.135 with SMTP id l7mr15671810ota.87.1493994279084; Fri, 05 May 2017 07:24:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.50.133 with HTTP; Fri, 5 May 2017 07:24:38 -0700 (PDT) In-Reply-To: <20170505222702.Y1875@besplex.bde.org> References: <201705042131.v44LVokb076951@repo.freebsd.org> <20170505174957.B875@besplex.bde.org> <20170505094601.GW1622@kib.kiev.ua> <20170505222702.Y1875@besplex.bde.org> From: Benjamin Kaduk Date: Fri, 5 May 2017 09:24:38 -0500 Message-ID: Subject: Re: svn commit: r317809 - head/share/man/man7 To: Bruce Evans Cc: Konstantin Belousov , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 14:24:40 -0000 On Fri, May 5, 2017 at 8:39 AM, Bruce Evans wrote: > On Fri, 5 May 2017, Konstantin Belousov wrote: > > >> So the phrase is correct, and the below reformulation really removes the >> content. >> > > "integrity" isn't correct since it has nothing to do with integers. > "mechanisms" doesn't make much sens either. Use the standard term > "representation". No, "integrity" is correct; CHERI provides integrity protection for pointers to ensure that they do not get modified in unpermitted ways. Nothing to do with representation as integers, linguistically. -Ben From owner-svn-src-head@freebsd.org Fri May 5 14:31:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2ED41D5EC71; Fri, 5 May 2017 14:31:56 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ABAE71676; Fri, 5 May 2017 14:31:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v45EVlxO061272 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 5 May 2017 17:31:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v45EVlxO061272 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v45EVlqX061270; Fri, 5 May 2017 17:31:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 5 May 2017 17:31:47 +0300 From: Konstantin Belousov To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317809 - head/share/man/man7 Message-ID: <20170505143147.GX1622@kib.kiev.ua> References: <201705042131.v44LVokb076951@repo.freebsd.org> <20170505174957.B875@besplex.bde.org> <20170505094601.GW1622@kib.kiev.ua> <20170505222702.Y1875@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170505222702.Y1875@besplex.bde.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 14:31:56 -0000 On Fri, May 05, 2017 at 11:39:23PM +1000, Bruce Evans wrote: > On Fri, 5 May 2017, Konstantin Belousov wrote: > > > On Fri, May 05, 2017 at 07:13:04PM +1000, Bruce Evans wrote: > > AFAIU, cheri is somewhat like Intel MPX, but more. I do not know fine > > details. > > > > For MPX, pointers are no longer plain pointers, there is a data behind > > the raw value, providing e.g. the range of bytes which are valid to > > dereference through the authentic value of the pointer and arithmetic > > manipulations of it. > > So the address space isn't exactly flat. Better de-emphasize that. It is still flat. Example of not flat AS would be type-tagged or segmented machines. MPX does not change address representation. > > I believe ia64 has fat function pointers, and uses handles so that some > things appear to work normally. But comparison of function pointer > (handle) addresses is almost meaningless. It isn't clear how gprof > can work. It would needs something like mapping function addresses > to handled addresses linearly. Similarly for conversion to uintptr_t. Both ia64 and powerpc64 use function descriptors, and function pointers point to the descriptors. Function pointers are not fat, but require a level of indirection to find the call target instructions address. > > > So the phrase is correct, and the below reformulation really removes the > > content. > > "integrity" isn't correct since it has nothing to do with integers. > "mechanisms" doesn't make much sens either. Use the standard term > "representation". > > >> Translation of the above: "... compatibility with changes in the size of > >> pointers in future implementations". > > Change "size" to "representation" if you want to allow for more than the > size changing. I suggest you to negotiate a formulation with brooks@, who provided the existing note. > > >>> +Compilers define > >>> +.Dv _LP64 > >>> +symbol when compiling for an > >>> +.Dv LP64 > >>> +ABI. > >> > >> Further minor grammar problems here and elsewhere: > >> - missing "the" before _LP64 > >> - "an" is confusing. First, "a" might be correct depending on how you > >> pronounce LP64. I pronounce it as "el ...", so "an" is better than > >> "a". But there is only 1 LP64, so "the" is more correct. "the LP64 > >> ABI" is confusing too. LP64 isn't an ABI or a collection of ABIs. > >> The collection is of arches, many using a single LP64 sub-ABI with > >> variations in other parts of their ABI. > > Of course there are architectures which have more that one LP64 ABI, > > eg. PowerPC ELF v1 and v2. > > No, there is only 1 LP64 by definition. It is not really an ABI, and only > gives the sizes. No, LP64 is the property of an ABI. So if several ABIs have this property, it is reasonable to say that there is more than one LP64 ABI. > > > Even i386, de facto, have two incompatible ABIs now: one older SysVR4 ABI > > where stack is 4-bytes aligned, and modern Linux ABI which claims that > > stack must be 16-bytes aligned, as enforced by modern gcc. The variation > > is not minor, it causes reliable user pain when mixed in. > > That is just a bug in Linux. > > More differently, at least mips have little-endian and big-endian variants. > The details seem to be undocumented. __MIPSEB__ gives big endian in > , but the arch names have different spellings with e's. > LP64 only tells you the sizes, so is very far from giving an ABI. Yes, mips has many ILP32 and LP64 ABIs, some of them are 64bit execution pretending to be 32bit enviroment, they also differs in the in the soft/hard float etc. So ? The man page does not try to provide the information from two dozens of SysV ABI processor-specific supplements. Its goal is to provide easily available essential references. Unless the text grows to 300+ pages, there will be omissions or inaccuracies. > > >>> +Integers are represented as two-complement. > >>> +Alignment of integer and pointer types is natural, that is, > >>> +the address of the variable must be congruent to zero modulo type size. > >> > >> Missing "the" after "modulo". > >> > >> Is it natural for arm? arm has unnatural struct padding, at least at > >> the end of structs. > > > > I am not sure what exactly you mean about unnatural struct padding, > > AFAIR ARM has the same rule of structure having the alignment requirement > > of the most aligned member. > > arm unnaturally pads structs to 4-byte boundaries IIRC. This is useless > except for alignment. This affects the ABI just as much as alignment, > since it affects the sizes of nested structs and arrays of structs. See above. There is no mention of structures in the text. > > > ARMv7 has a requirement of uint64_t having > > 8-bytes alignment (unlike other 32bit platforms). Might be, indeed, this > > should be more accurate, but in fact ARM is correct for this sentence. > > arm has _ALIGNBYTES = (sizeof(int) - 1) for __ARM_ARCH >= 6, else > _ALIGNBYTES = (sizeof(long long) - 1). This is backwards if ARMv7 > really needs 8. There are bugs in the comment too. > > mips has _ALIGNBYTES = 7. This is spelled without obfuscations or > abominations. The comment has less detail but no bugs. > > x86 has the necessary obfuscations of using __register_t and __uintptr_t > to parametrize the difference between i386 and amd64. However, the > comment has worse bugs than arm -- its claim that the type is unsigned > int is just wrong on amd64. > > _ALIGNBYTES only gives the smallest alignment that works for all types > (not even that for SSE accesses on x86). It is pessimal for doubles > and long doubles on i386, and not best for int64_t either. Does the > Linux ABI "fix" this? The natural ABI is not easy to see. I do not quite understand the question. What is Linux ABI ? > > > Below are the small corrections. > > > > diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 > > index 2add6ea3d3e..1c056849861 100644 > > --- a/share/man/man7/arch.7 > > +++ b/share/man/man7/arch.7 > > @@ -39,13 +39,13 @@ Differences between CPU architectures and platforms supported by > > If not explicitly mentioned, sizes are in bytes. > > .Pp > > FreeBSD uses flat address space for program execution, where > > -pointers have the same binary representation as > > +pointers have the same representation as > > .Vt unsigned long > > variables, and > > .Vt uintptr_t > > and > > .Vt size_t > > -types are synonyms for > > +types have same size as > > .Vt unsigned long . > > Say that they have the same representation. Ok. > > We also assume/implement that everything is 2's complement with full > range (the minimum negative value -2**-N is not left out), with the > same natural 2's complement representation except for the size, and > that sizes are powers of 2, and that all natural intN_t exist and are > smallest and fast, so that it is just unportable to hard-code uses of > intN_t and never use int_leastN_t or int_fastN_t. See above about intent. > > OK except for "integrity mechanisms". Change this to something > simpler although not quite correct. If you want to allow for fat > pointers then the earlier parts about flat address spaces would > need adjustments too. As I said, this is brooks@ text. diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 index 2add6ea3d3e..dfc3527e01c 100644 --- a/share/man/man7/arch.7 +++ b/share/man/man7/arch.7 @@ -38,15 +38,13 @@ Differences between CPU architectures and platforms supported by .Ss Introduction If not explicitly mentioned, sizes are in bytes. .Pp -FreeBSD uses flat address space for program execution, where -pointers have the same binary representation as -.Vt unsigned long -variables, and -.Vt uintptr_t +FreeBSD uses flat address space for program execution, +where variables of types +.Vt unsigned long , +.Vt uintptr_t , and .Vt size_t -types are synonyms for -.Vt unsigned long . +and the pointers all have the same representation. .Pp In order to maximize compatibility with future pointer integrity mechanisms, manipulations of pointers as integers should be performed via @@ -93,7 +91,7 @@ and .Vt void * are 8 bytes. .El -Compilers define +Compilers define the .Dv _LP64 symbol when compiling for an .Dv LP64 @@ -108,7 +106,7 @@ execution environment is accompanied by the .Dv ILP32 environment, which was historical 32-bit predecessor for 64-bit evolution. Examples are: -.Bl -column -offset indent "powerpc64" "Sy ILP32 counterpart" +.Bl -column -offset indent "Dv powerpc64" "Sy ILP32 counterpart" .It Sy LP64 Ta Sy ILP32 counterpart .It Dv amd64 Ta Dv i386 .It Dv powerpc64 Ta Dv powerpc @@ -133,7 +131,7 @@ On all supported architectures: .El Integers are represented as two-complement. Alignment of integer and pointer types is natural, that is, -the address of the variable must be congruent to zero modulo type size. +the address of the variable must be congruent to zero modulo the type size. .Pp Machine-dependent type sizes: .Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t" From owner-svn-src-head@freebsd.org Fri May 5 14:33:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84B98D5EDEF; Fri, 5 May 2017 14:33:41 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 541A11919; Fri, 5 May 2017 14:33:41 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45EXeEE096032; Fri, 5 May 2017 14:33:40 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45EXdqG096022; Fri, 5 May 2017 14:33:39 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201705051433.v45EXdqG096022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 5 May 2017 14:33:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317829 - in head: contrib/less usr.bin/less X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 14:33:41 -0000 Author: delphij Date: Fri May 5 14:33:39 2017 New Revision: 317829 URL: https://svnweb.freebsd.org/changeset/base/317829 Log: MFV r317581: less v491. MFC after: 1 month Modified: head/contrib/less/LICENSE head/contrib/less/NEWS head/contrib/less/README head/contrib/less/brac.c head/contrib/less/ch.c head/contrib/less/charset.c head/contrib/less/charset.h head/contrib/less/cmd.h head/contrib/less/cmdbuf.c head/contrib/less/command.c head/contrib/less/compose.uni head/contrib/less/cvt.c head/contrib/less/decode.c head/contrib/less/edit.c head/contrib/less/filename.c head/contrib/less/forwback.c head/contrib/less/funcs.h head/contrib/less/help.c head/contrib/less/ifile.c head/contrib/less/input.c head/contrib/less/jump.c head/contrib/less/less.h head/contrib/less/less.hlp head/contrib/less/less.nro head/contrib/less/lessecho.c head/contrib/less/lessecho.nro head/contrib/less/lesskey.c head/contrib/less/lesskey.h head/contrib/less/lesskey.nro head/contrib/less/lglob.h head/contrib/less/line.c head/contrib/less/linenum.c head/contrib/less/lsystem.c head/contrib/less/main.c head/contrib/less/mark.c head/contrib/less/mkhelp.c head/contrib/less/mkutable head/contrib/less/optfunc.c head/contrib/less/option.c head/contrib/less/option.h head/contrib/less/opttbl.c head/contrib/less/os.c head/contrib/less/output.c head/contrib/less/pattern.c head/contrib/less/pattern.h head/contrib/less/pckeys.h head/contrib/less/position.c head/contrib/less/position.h head/contrib/less/prompt.c head/contrib/less/regexp.c head/contrib/less/screen.c head/contrib/less/scrsize.c head/contrib/less/search.c head/contrib/less/signal.c head/contrib/less/tags.c head/contrib/less/ttyin.c head/contrib/less/ubin.uni head/contrib/less/version.c head/contrib/less/wide.uni head/usr.bin/less/defines.h Directory Properties: head/contrib/less/ (props changed) Modified: head/contrib/less/LICENSE ============================================================================== --- head/contrib/less/LICENSE Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/LICENSE Fri May 5 14:33:39 2017 (r317829) @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2015 Mark Nudelman +Copyright (C) 1984-2016 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: head/contrib/less/NEWS ============================================================================== --- head/contrib/less/NEWS Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/NEWS Fri May 5 14:33:39 2017 (r317829) @@ -11,6 +11,40 @@ ====================================================================== + Major changes between "less" versions 487 and 491 + +* Don't output terminal init sequence if using -F and file fits on one screen. + +* Use ANSI prototypes in funcs.h declarations. + +* Fix some const mismatches. + +* Remove "register" in variable declarations. + +* Fix some memory leaks. + +====================================================================== + + Major changes between "less" versions 481 and 487 + +* New commands ESC-{ and ESC-} to shift to start/end of displayed lines. + +* Make search highlights work correctly when changing caselessness with -i. + +* New option -Da in Windows version to enable SGR mode. + +* Fix "nothing to search" error when top or bottom line on screen is empty. + +* Fix bug when terminal has no "cm" termcap entry. + +* Fix incorrect display when entering double-width chars in search string. + +* Fix bug in Unicode handling that missed some double width characters. + +* Update Unicode database to 9.0.0. + +====================================================================== + Major changes between "less" versions 458 and 481 * Don't overwrite history file; just append to it. Modified: head/contrib/less/README ============================================================================== --- head/contrib/less/README Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/README Fri May 5 14:33:39 2017 (r317829) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 481 + Less, version 491 - This is the distribution of less, version 481, released 31 Aug 2015. + This is the distribution of less, version 491, released 07 Apr 2017. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or Modified: head/contrib/less/brac.c ============================================================================== --- head/contrib/less/brac.c Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/brac.c Fri May 5 14:33:39 2017 (r317829) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -24,14 +24,18 @@ * "close bracket" are given. */ public void -match_brac(int obrac, int cbrac, int forwdir, int n) +match_brac(obrac, cbrac, forwdir, n) + int obrac; + int cbrac; + int forwdir; + int n; { int c; int nest; POSITION pos; - int (*chget)(void); + int (*chget)(); - extern int ch_forw_get(void), ch_back_get(void); + extern int ch_forw_get(), ch_back_get(); /* * Seek to the line containing the open bracket. Modified: head/contrib/less/ch.c ============================================================================== --- head/contrib/less/ch.c Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/ch.c Fri May 5 14:33:39 2017 (r317829) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -144,7 +144,7 @@ static int ch_addbuf(); * Get the character pointed to by the read pointer. */ int -ch_get(void) +ch_get() { struct buf *bp; struct bufnode *bn; @@ -378,7 +378,8 @@ ch_get(void) * a single char onto an input file descriptor. */ public void -ch_ungetchar(int c) +ch_ungetchar(c) + int c; { if (c != -1 && ch_ungotchar != -1) error("ch_ungetchar overrun", NULL_PARG); @@ -391,7 +392,7 @@ ch_ungetchar(int c) * If we haven't read all of standard input into it, do that now. */ public void -end_logfile(void) +end_logfile() { static int tried = FALSE; @@ -416,7 +417,7 @@ end_logfile(void) * Write all the existing buffered data to the log file. */ public void -sync_logfile(void) +sync_logfile() { struct buf *bp; struct bufnode *bn; @@ -453,7 +454,8 @@ sync_logfile(void) * Determine if a specific block is currently in one of the buffers. */ static int -buffered(BLOCKNUM block) +buffered(block) + BLOCKNUM block; { struct buf *bp; struct bufnode *bn; @@ -474,7 +476,8 @@ buffered(BLOCKNUM block) * Return 0 if successful, non-zero if can't seek there. */ public int -ch_seek(POSITION pos) +ch_seek(pos) + POSITION pos; { BLOCKNUM new_block; POSITION len; @@ -512,7 +515,7 @@ ch_seek(POSITION pos) * Seek to the end of the file. */ public int -ch_end_seek(void) +ch_end_seek() { POSITION len; @@ -539,7 +542,7 @@ ch_end_seek(void) * Seek to the last position in the file that is currently buffered. */ public int -ch_end_buffer_seek(void) +ch_end_buffer_seek() { struct buf *bp; struct bufnode *bn; @@ -567,7 +570,7 @@ ch_end_buffer_seek(void) * beginning of the pipe is no longer buffered. */ public int -ch_beg_seek(void) +ch_beg_seek() { struct bufnode *bn; struct bufnode *firstbn; @@ -599,7 +602,7 @@ ch_beg_seek(void) * Return the length of the file, if known. */ public POSITION -ch_length(void) +ch_length() { if (thisfile == NULL) return (NULL_POSITION); @@ -616,7 +619,7 @@ ch_length(void) * Return the current position in the file. */ public POSITION -ch_tell(void) +ch_tell() { if (thisfile == NULL) return (NULL_POSITION); @@ -627,7 +630,7 @@ ch_tell(void) * Get the current char and post-increment the read pointer. */ public int -ch_forw_get(void) +ch_forw_get() { int c; @@ -650,7 +653,7 @@ ch_forw_get(void) * Pre-decrement the read pointer and get the new current char. */ public int -ch_back_get(void) +ch_back_get() { if (thisfile == NULL) return (EOI); @@ -673,7 +676,8 @@ ch_back_get(void) * bufspace is in units of 1024 bytes. -1 mean no limit. */ public void -ch_setbufspace(int bufspace) +ch_setbufspace(bufspace) + int bufspace; { if (bufspace < 0) maxbufs = -1; @@ -689,7 +693,7 @@ ch_setbufspace(int bufspace) * Flush (discard) any saved file state, including buffer contents. */ public void -ch_flush(void) +ch_flush() { struct bufnode *bn; @@ -756,7 +760,7 @@ ch_flush(void) * The buffer is added to the tail of the buffer chain. */ static int -ch_addbuf(void) +ch_addbuf() { struct buf *bp; struct bufnode *bn; @@ -781,7 +785,7 @@ ch_addbuf(void) * */ static void -init_hashtbl(void) +init_hashtbl() { int h; @@ -796,7 +800,7 @@ init_hashtbl(void) * Delete all buffers for this file. */ static void -ch_delbufs(void) +ch_delbufs() { struct bufnode *bn; @@ -814,7 +818,8 @@ ch_delbufs(void) * Is it possible to seek on a file descriptor? */ public int -seekable(int f) +seekable(f) + int f; { #if MSDOS_COMPILER extern int fd0; @@ -835,7 +840,7 @@ seekable(int f) * This is used after an ignore_eof read, during which the EOF may change. */ public void -ch_set_eof(void) +ch_set_eof() { ch_fsize = ch_fpos; } @@ -845,7 +850,9 @@ ch_set_eof(void) * Initialize file state for a new file. */ public void -ch_init(int f, int flags) +ch_init(f, flags) + int f; + int flags; { /* * See if we already have a filestate for this file. @@ -884,7 +891,7 @@ ch_init(int f, int flags) * Close a filestate. */ public void -ch_close(void) +ch_close() { int keepstate = FALSE; @@ -927,7 +934,7 @@ ch_close(void) * Return ch_flags for the current file. */ public int -ch_getflags(void) +ch_getflags() { if (thisfile == NULL) return (0); Modified: head/contrib/less/charset.c ============================================================================== --- head/contrib/less/charset.c Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/charset.c Fri May 5 14:33:39 2017 (r317829) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -64,6 +64,8 @@ struct cs_alias { char *oname; } cs_aliases[] = { { "UTF-8", "utf-8" }, + { "utf8", "utf-8" }, + { "UTF8", "utf-8" }, { "ANSI_X3.4-1968", "ascii" }, { "US-ASCII", "ascii" }, { "latin1", "iso8859" }, @@ -130,7 +132,8 @@ public int binattr = AT_STANDOUT; * c control character */ static void -ichardef(char *s) +ichardef(s) + char *s; { char *cp; int n; @@ -186,7 +189,9 @@ ichardef(char *s) * The valid charset names are listed in the "charsets" array. */ static int -icharset(char *name, int no_error) +icharset(name, no_error) + char *name; + int no_error; { struct charset *p; struct cs_alias *a; @@ -227,7 +232,7 @@ icharset(char *name, int no_error) * Define a charset, given a locale name. */ static void -ilocale(void) +ilocale() { int c; @@ -247,7 +252,10 @@ ilocale(void) * Define the printing format for control (or binary utf) chars. */ static void -setbinfmt(char *s, char **fmtvarptr, char *default_fmt) +setbinfmt(s, fmtvarptr, default_fmt) + char *s; + char **fmtvarptr; + char *default_fmt; { if (s && utf_mode) { @@ -293,7 +301,7 @@ setbinfmt(char *s, char **fmtvarptr, cha * */ static void -set_charset(void) +set_charset() { char *s; @@ -364,7 +372,7 @@ set_charset(void) * Initialize charset data structures. */ public void -init_charset(void) +init_charset() { char *s; @@ -385,7 +393,8 @@ init_charset(void) * Is a given character a "binary" character? */ public int -binary_char(LWCHAR c) +binary_char(c) + LWCHAR c; { if (utf_mode) return (is_ubin_char(c)); @@ -397,7 +406,8 @@ binary_char(LWCHAR c) * Is a given character a "control" character? */ public int -control_char(LWCHAR c) +control_char(c) + LWCHAR c; { c &= 0377; return (chardef[c] & IS_CONTROL_CHAR); @@ -408,7 +418,8 @@ control_char(LWCHAR c) * For example, in the "ascii" charset '\3' is printed as "^C". */ public char * -prchar(LWCHAR c) +prchar(c) + LWCHAR c; { /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */ static char buf[32]; @@ -443,7 +454,8 @@ prchar(LWCHAR c) * Return the printable form of a UTF-8 character. */ public char * -prutfchar(LWCHAR ch) +prutfchar(ch) + LWCHAR ch; { static char buf[32]; @@ -473,7 +485,8 @@ prutfchar(LWCHAR ch) * Get the length of a UTF-8 character in bytes. */ public int -utf_len(char ch) +utf_len(ch) + unsigned char ch; { if ((ch & 0x80) == 0) return 1; @@ -495,15 +508,18 @@ utf_len(char ch) * Does the parameter point to the lead byte of a well-formed UTF-8 character? */ public int -is_utf8_well_formed(unsigned char *s, int slen) +is_utf8_well_formed(ss, slen) + char *ss; + int slen; { int i; int len; + unsigned char *s = (unsigned char *) ss; if (IS_UTF8_INVALID(s[0])) return (0); - len = utf_len((char) s[0]); + len = utf_len(s[0]); if (len > slen) return (0); if (len == 1) @@ -530,14 +546,16 @@ is_utf8_well_formed(unsigned char *s, in * Return number of invalid UTF-8 sequences found in a buffer. */ public int -utf_bin_count(unsigned char *data, int len) +utf_bin_count(data, len) + char *data; + int len; { int bin_count = 0; while (len > 0) { if (is_utf8_well_formed(data, len)) { - int clen = utf_len(*data); + int clen = utf_len(*data & 0377); data += clen; len -= clen; } else @@ -547,7 +565,7 @@ utf_bin_count(unsigned char *data, int l do { ++data; --len; - } while (len > 0 && !IS_UTF8_LEAD(*data)); + } while (len > 0 && !IS_UTF8_LEAD(*data & 0377)); } } return (bin_count); @@ -557,7 +575,8 @@ utf_bin_count(unsigned char *data, int l * Get the value of a UTF-8 character. */ public LWCHAR -get_wchar(constant char *p) +get_wchar(p) + constant char *p; { switch (utf_len(p[0])) { @@ -608,7 +627,9 @@ get_wchar(constant char *p) * Store a character into a UTF-8 string. */ public void -put_wchar(char **pp, LWCHAR ch) +put_wchar(pp, ch) + char **pp; + LWCHAR ch; { if (!utf_mode || ch < 0x80) { @@ -656,11 +677,14 @@ put_wchar(char **pp, LWCHAR ch) * Step forward or backward one character in a string. */ public LWCHAR -step_char(constant char **pp, signed int dir, constant char *limit) +step_char(pp, dir, limit) + char **pp; + signed int dir; + constant char *limit; { LWCHAR ch; int len; - constant char *p = *pp; + char *p = *pp; if (!utf_mode) { @@ -675,7 +699,7 @@ step_char(constant char **pp, signed int if (p + len > limit) { ch = 0; - p = limit; + p = (char *) limit; } else { ch = get_wchar(p); @@ -723,7 +747,9 @@ static struct wchar_range comb_table[] = static int -is_in_table(LWCHAR ch, struct wchar_range_table *table) +is_in_table(ch, table) + LWCHAR ch; + struct wchar_range_table *table; { int hi; int lo; @@ -751,7 +777,8 @@ is_in_table(LWCHAR ch, struct wchar_rang * If a composing character follows any char, the two combine into one glyph. */ public int -is_composing_char(LWCHAR ch) +is_composing_char(ch) + LWCHAR ch; { return is_in_table(ch, &compose_table); } @@ -760,7 +787,8 @@ is_composing_char(LWCHAR ch) * Should this UTF-8 character be treated as binary? */ public int -is_ubin_char(LWCHAR ch) +is_ubin_char(ch) + LWCHAR ch; { return is_in_table(ch, &ubin_table); } @@ -769,7 +797,8 @@ is_ubin_char(LWCHAR ch) * Is this a double width UTF-8 character? */ public int -is_wide_char(LWCHAR ch) +is_wide_char(ch) + LWCHAR ch; { return is_in_table(ch, &wide_table); } @@ -780,7 +809,9 @@ is_wide_char(LWCHAR ch) * a specific char (not any char), the two combine into one glyph. */ public int -is_combining_char(LWCHAR ch1, LWCHAR ch2) +is_combining_char(ch1, ch2) + LWCHAR ch1; + LWCHAR ch2; { /* The table is small; use linear search. */ int i; Modified: head/contrib/less/charset.h ============================================================================== --- head/contrib/less/charset.h Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/charset.h Fri May 5 14:33:39 2017 (r317829) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: head/contrib/less/cmd.h ============================================================================== --- head/contrib/less/cmd.h Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/cmd.h Fri May 5 14:33:39 2017 (r317829) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -67,6 +67,8 @@ #define A_FILTER 55 #define A_F_UNTIL_HILITE 56 #define A_GOEND_BUF 57 +#define A_LLSHIFT 58 +#define A_RRSHIFT 59 #define A_INVALID 100 #define A_NOACTION 101 Modified: head/contrib/less/cmdbuf.c ============================================================================== --- head/contrib/less/cmdbuf.c Fri May 5 14:09:44 2017 (r317828) +++ head/contrib/less/cmdbuf.c Fri May 5 14:33:39 2017 (r317829) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2017 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -32,7 +32,7 @@ static int literal; /* Next input char static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME -static int cmd_complete(int action); +static int cmd_complete(); /* * These variables are statics used by cmd_complete. */ @@ -76,25 +76,25 @@ struct mlist */ struct mlist mlist_search = { &mlist_search, &mlist_search, &mlist_search, NULL, 0 }; -public void * constant ml_search = (void *) &mlist_search; +public void *ml_search = (void *) &mlist_search; struct mlist mlist_examine = { &mlist_examine, &mlist_examine, &mlist_examine, NULL, 0 }; -public void * constant ml_examine = (void *) &mlist_examine; +public void *ml_examine = (void *) &mlist_examine; #if SHELL_ESCAPE || PIPEC struct mlist mlist_shell = { &mlist_shell, &mlist_shell, &mlist_shell, NULL, 0 }; -public void * constant ml_shell = (void *) &mlist_shell; +public void *ml_shell = (void *) &mlist_shell; #endif #else /* CMD_HISTORY */ /* If CMD_HISTORY is off, these are just flags. */ -public void * constant ml_search = (void *)1; -public void * constant ml_examine = (void *)2; +public void *ml_search = (void *)1; +public void *ml_examine = (void *)2; #if SHELL_ESCAPE || PIPEC -public void * constant ml_shell = (void *)3; +public void *ml_shell = (void *)3; #endif #endif /* CMD_HISTORY */ @@ -114,7 +114,7 @@ static int cmd_mbc_buf_index; * Reset command buffer (to empty). */ public void -cmd_reset(void) +cmd_reset() { cp = cmdbuf; *cp = '\0'; @@ -129,7 +129,7 @@ cmd_reset(void) * Clear command line. */ public void -clear_cmd(void) +clear_cmd() { cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; @@ -140,28 +140,27 @@ clear_cmd(void) * Display a string, usually as a prompt for input into the command buffer. */ public void -cmd_putstr(constant char *s) +cmd_putstr(s) + constant char *s; { LWCHAR prev_ch = 0; LWCHAR ch; constant char *endline = s + strlen(s); while (*s != '\0') { - constant char *ns = s; + char *ns = (char *) s; + int width; ch = step_char(&ns, +1, endline); while (s < ns) putchr(*s++); if (!utf_mode) - { - cmd_col++; - prompt_col++; - } else if (!is_composing_char(ch) && - !is_combining_char(prev_ch, ch)) - { - int width = is_wide_char(ch) ? 2 : 1; - cmd_col += width; - prompt_col += width; - } + width = 1; + else if (is_composing_char(ch) || is_combining_char(prev_ch, ch)) + width = 0; + else + width = is_wide_char(ch) ? 2 : 1; + cmd_col += width; + prompt_col += width; prev_ch = ch; } } @@ -170,10 +169,10 @@ cmd_putstr(constant char *s) * How many characters are in the command buffer? */ public int -len_cmdbuf(void) +len_cmdbuf() { - constant char *s = cmdbuf; - constant char *endline = s + strlen(s); + char *s = cmdbuf; + char *endline = s + strlen(s); int len = 0; while (*s != '\0') @@ -186,63 +185,44 @@ len_cmdbuf(void) /* * Common part of cmd_step_right() and cmd_step_left(). + * {{ Returning pwidth and bswidth separately is a historical artifact + * since they're always the same. Maybe clean this up someday. }} */ static char * -cmd_step_common(constant char *p, LWCHAR ch, int len, int *pwidth, int *bswidth) +cmd_step_common(p, ch, len, pwidth, bswidth) + char *p; + LWCHAR ch; + int len; + int *pwidth; + int *bswidth; { char *pr; + int width; if (len == 1) { pr = prchar((int) ch); - if (pwidth != NULL || bswidth != NULL) - { - int len = (int) strlen(pr); - if (pwidth != NULL) - *pwidth = len; - if (bswidth != NULL) - *bswidth = len; - } + width = (int) strlen(pr); } else { pr = prutfchar(ch); - if (pwidth != NULL || bswidth != NULL) + if (is_composing_char(ch)) + width = 0; + else if (is_ubin_char(ch)) + width = (int) strlen(pr); + else { - if (is_composing_char(ch)) - { - if (pwidth != NULL) - *pwidth = 0; - if (bswidth != NULL) - *bswidth = 0; - } else if (is_ubin_char(ch)) - { - int len = (int) strlen(pr); - if (pwidth != NULL) - *pwidth = len; - if (bswidth != NULL) - *bswidth = len; - } else - { - LWCHAR prev_ch = step_char(&p, -1, cmdbuf); - if (is_combining_char(prev_ch, ch)) - { - if (pwidth != NULL) - *pwidth = 0; - if (bswidth != NULL) - *bswidth = 0; - } else - { - if (pwidth != NULL) - *pwidth = is_wide_char(ch) - ? 2 - : 1; - if (bswidth != NULL) - *bswidth = 1; - } - } + LWCHAR prev_ch = step_char(&p, -1, cmdbuf); + if (is_combining_char(prev_ch, ch)) + width = 0; + else + width = is_wide_char(ch) ? 2 : 1; } } - + if (pwidth != NULL) + *pwidth = width; + if (bswidth != NULL) + *bswidth = width; return (pr); } @@ -250,10 +230,13 @@ cmd_step_common(constant char *p, LWCHAR * Step a pointer one character right in the command buffer. */ static char * -cmd_step_right(char **pp, int *pwidth, int *bswidth) +cmd_step_right(pp, pwidth, bswidth) + char **pp; + int *pwidth; + int *bswidth; { char *p = *pp; - LWCHAR ch = step_char((constant char **)pp, +1, p + strlen(p)); + LWCHAR ch = step_char(pp, +1, p + strlen(p)); return cmd_step_common(p, ch, *pp - p, pwidth, bswidth); } @@ -262,10 +245,13 @@ cmd_step_right(char **pp, int *pwidth, i * Step a pointer one character left in the command buffer. */ static char * -cmd_step_left(char **pp, int *pwidth, int *bswidth) +cmd_step_left(pp, pwidth, bswidth) + char **pp; + int *pwidth; + int *bswidth; { char *p = *pp; - LWCHAR ch = step_char((constant char **)pp, -1, cmdbuf); + LWCHAR ch = step_char(pp, -1, cmdbuf); return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth); } @@ -275,7 +261,8 @@ cmd_step_left(char **pp, int *pwidth, in * Then position the cursor just after the char old_cp (a pointer into cmdbuf). */ static void -cmd_repaint(char *old_cp) +cmd_repaint(old_cp) + constant char *old_cp; { /* * Repaint the line from the current position. @@ -285,7 +272,7 @@ cmd_repaint(char *old_cp) { char *np = cp; int width; - constant char *pr = cmd_step_right(&np, &width, NULL); + char *pr = cmd_step_right(&np, &width, NULL); if (cmd_col + width >= sc_width) break; cp = np; @@ -315,7 +302,7 @@ cmd_repaint(char *old_cp) * and set cp to the corresponding char in cmdbuf. */ static void -cmd_home(void) +cmd_home() { while (cmd_col > prompt_col) { @@ -334,7 +321,7 @@ cmd_home(void) * Shift the cmdbuf display left a half-screen. */ static void -cmd_lshift(void) +cmd_lshift() { char *s; char *save_cp; @@ -372,7 +359,7 @@ cmd_lshift(void) * Shift the cmdbuf display right a half-screen. */ static void -cmd_rshift(void) +cmd_rshift() { char *s; char *save_cp; @@ -402,7 +389,7 @@ cmd_rshift(void) * Move cursor right one character. */ static int -cmd_right(void) +cmd_right() { char *pr; char *ncp; @@ -437,7 +424,7 @@ cmd_right(void) * Move cursor left one character. */ static int -cmd_left(void) +cmd_left() { char *ncp; int width, bswidth; @@ -467,7 +454,9 @@ cmd_left(void) * Insert a char into the command buffer, at the current position. */ static int -cmd_ichar(char *cs, int clen) +cmd_ichar(cs, clen) + char *cs; + int clen; { char *s; @@ -502,7 +491,7 @@ cmd_ichar(char *cs, int clen) * Delete the char to the left of the cursor. */ static int -cmd_erase(void) +cmd_erase() { char *s; int clen; @@ -551,7 +540,7 @@ cmd_erase(void) * Delete the char under the cursor. */ static int -cmd_delete(void) +cmd_delete() { if (*cp == '\0') { @@ -570,7 +559,7 @@ cmd_delete(void) * Delete the "word" to the left of the cursor. */ static int -cmd_werase(void) +cmd_werase() { if (cp > cmdbuf && cp[-1] == ' ') { @@ -596,7 +585,7 @@ cmd_werase(void) * Delete the "word" under the cursor. */ static int -cmd_wdelete(void) +cmd_wdelete() { if (*cp == ' ') { @@ -622,7 +611,7 @@ cmd_wdelete(void) * Delete all chars in the command buffer. */ static int -cmd_kill(void) +cmd_kill() { if (cmdbuf[0] == '\0') { @@ -648,7 +637,9 @@ cmd_kill(void) * Select an mlist structure to be the current command history. */ public void -set_mlist(constant void *mlist, int cmdflags) +set_mlist(mlist, cmdflags) + void *mlist; + int cmdflags; { #if CMD_HISTORY curr_mlist = (struct mlist *) mlist; @@ -667,9 +658,10 @@ set_mlist(constant void *mlist, int cmdf * cmdbuf's corresponding chars. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri May 5 14:34:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B32D7D5EE92; Fri, 5 May 2017 14:34:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 857E41A85; Fri, 5 May 2017 14:34:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45EY9Jl096101; Fri, 5 May 2017 14:34:09 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45EY9OA096100; Fri, 5 May 2017 14:34:09 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201705051434.v45EY9OA096100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 5 May 2017 14:34:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317830 - head/contrib/ipfilter/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 14:34:10 -0000 Author: cy Date: Fri May 5 14:34:09 2017 New Revision: 317830 URL: https://svnweb.freebsd.org/changeset/base/317830 Log: Ifdef out a redundant if statement when INET6 is disabled. MFC after: 1 week Modified: head/contrib/ipfilter/tools/ippool.c Modified: head/contrib/ipfilter/tools/ippool.c ============================================================================== --- head/contrib/ipfilter/tools/ippool.c Fri May 5 14:33:39 2017 (r317829) +++ head/contrib/ipfilter/tools/ippool.c Fri May 5 14:34:09 2017 (r317830) @@ -1047,7 +1047,9 @@ setnodeaddr(int type, int role, void *pt if (type == IPLT_POOL) { ip_pool_node_t *node = ptr; +#ifdef USE_INET6 if (node->ipn_addr.adf_family == AF_INET) +#endif node->ipn_addr.adf_len = offsetof(addrfamily_t, adf_addr) + sizeof(struct in_addr); From owner-svn-src-head@freebsd.org Fri May 5 14:42:14 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C303BD5F24C; Fri, 5 May 2017 14:42:14 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B4741A9; Fri, 5 May 2017 14:42:14 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x236.google.com with SMTP id c15so26369830ith.0; Fri, 05 May 2017 07:42:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=wEjRYuLd8mdzZ5wNoAIRXsFb0cYn4F8ZLr+SoSVhLzs=; b=pBTYnRRpqGXvO5hjJwpaZOMHWZSy6WNGgtdXDJ2t/4wYpv7RxpgyOEd2lDbG8kcCTl /dzeyfkOzeEhVbBY8vCGqlGcVJf+/6Yf6MVrKumpvPGTjfheyCPBPAy7bnK4Lg0fKzxs 7dKRRER4CLxoP7hI1jRpfEJoWBrQphlOw2rSNLeLO5T4ggWD/XBKLMdi/YhG8oSxS5oJ Ft7Omd7rfmBLLpsKwSuRL3Se8UGkKHs5ibglqpLPhsqqUoq5zoT7gey0sHyKCxvi0EWR 0ntsGlrsiPOmDKDtWEBN+keel7Im25nc2mWCl4PjcQxGy/DyZZOYhB9zZQAjLht0zrV0 AWiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=wEjRYuLd8mdzZ5wNoAIRXsFb0cYn4F8ZLr+SoSVhLzs=; b=j1eX8Kpf+qt6ZFNiIHp6pFp3C3ioQzaOdsGz6sx4uzSPwe1Vb/zghiUYqumPeRK/C5 erDzp1uU6Ho9KrNCQd0oSIDq91IQcMlOQ45uDDxDFMW4ZiVXoYFn2cFszqnQE1625nZ9 Jnj0Ia8msFMqU6c64GAsEpGelzZG0ercQ04Qegco/YRb44KQkLIFsLtKVpRX0GVl5t+6 UUcndqdiNdmGwvX4MFUO99MBEjvdN7AGBtAuHxEp916EmgF68e8Gmpz8bpEUJvU6CXgF b84G6AF87S637oXZq85TOVAaLtaAOdrVP/1UH4upewg/O9itR4qxQar22vkUeZnh0A33 +Kzw== X-Gm-Message-State: AN3rC/7Wx+tH/QBTag358nT6yhAcd09e87kjGV/4WrKr/daPnR6rN1td JUHaBOsXldzI7STrqSFPQBEyFUakdA== X-Received: by 10.36.227.206 with SMTP id d197mr9242904ith.19.1493995333969; Fri, 05 May 2017 07:42:13 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.30.136 with HTTP; Fri, 5 May 2017 07:41:53 -0700 (PDT) In-Reply-To: <20170505143147.GX1622@kib.kiev.ua> References: <201705042131.v44LVokb076951@repo.freebsd.org> <20170505174957.B875@besplex.bde.org> <20170505094601.GW1622@kib.kiev.ua> <20170505222702.Y1875@besplex.bde.org> <20170505143147.GX1622@kib.kiev.ua> From: Ed Maste Date: Fri, 5 May 2017 10:41:53 -0400 X-Google-Sender-Auth: rHZf1ke7Bw5AOs1fnOlka5UZtfQ Message-ID: Subject: Re: svn commit: r317809 - head/share/man/man7 To: Konstantin Belousov Cc: Bruce Evans , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 14:42:14 -0000 On 5 May 2017 at 10:31, Konstantin Belousov wrote: > On Fri, May 05, 2017 at 11:39:23PM +1000, Bruce Evans wrote: >> >> Change "size" to "representation" if you want to allow for more than the >> size changing. > I suggest you to negotiate a formulation with brooks@, who provided the > existing note. If it's really undesirable to mention pointer integrity here, I think the main point can still be made with a phrase like Bruce proposed (but I think it's fine as it exists now). What about "In order to maximize compatibility with future changes in pointer size or representation, manipulation..."? Very briefly (to give some context), in CheriBSD and the CHERI CPU pointers are 128 or 256 bits wide, and have a base address, length, permissions, and other fields. Thus the size differs from existing standard integer types, and a pointer's representation and even the essence of what a pointer is differs from pointers in existing FreeBSD architectures. From owner-svn-src-head@freebsd.org Fri May 5 15:26:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09F72D5F44C; Fri, 5 May 2017 15:26:57 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D04F4CB2; Fri, 5 May 2017 15:26:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45FQttP016562; Fri, 5 May 2017 15:26:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45FQt3U016561; Fri, 5 May 2017 15:26:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705051526.v45FQt3U016561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 5 May 2017 15:26:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317832 - head/sys/ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 15:26:57 -0000 Author: emaste Date: Fri May 5 15:26:55 2017 New Revision: 317832 URL: https://svnweb.freebsd.org/changeset/base/317832 Log: UFS fs.h: clear warning from use in makefs(1) makefs(1) has a number of signedness warnings (when built with higher WARNS), most of which can be addressed by careful application of casts in makefs itself. There is one case where a signedness warning arises from the blksize macro, so must be addressed in the macro itself. Reviewed by: kib, mckusick MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D10589 Modified: head/sys/ufs/ffs/fs.h Modified: head/sys/ufs/ffs/fs.h ============================================================================== --- head/sys/ufs/ffs/fs.h Fri May 5 15:15:41 2017 (r317831) +++ head/sys/ufs/ffs/fs.h Fri May 5 15:26:55 2017 (r317832) @@ -608,7 +608,8 @@ struct cg { * Determining the size of a file block in the filesystem. */ #define blksize(fs, ip, lbn) \ - (((lbn) >= UFS_NDADDR || (ip)->i_size >= smalllblktosize(fs, (lbn) + 1)) \ + (((lbn) >= UFS_NDADDR || (ip)->i_size >= \ + (uint64_t)smalllblktosize(fs, (lbn) + 1)) \ ? (fs)->fs_bsize \ : (fragroundup(fs, blkoff(fs, (ip)->i_size)))) #define sblksize(fs, size, lbn) \ From owner-svn-src-head@freebsd.org Fri May 5 16:32:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9980D5FC0B; Fri, 5 May 2017 16:32:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 8F3D51135; Fri, 5 May 2017 16:32:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 8E4E21A73DB; Sat, 6 May 2017 02:32:25 +1000 (AEST) Date: Sat, 6 May 2017 02:32:22 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Maste cc: Konstantin Belousov , Bruce Evans , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317809 - head/share/man/man7 In-Reply-To: Message-ID: <20170506020904.P2496@besplex.bde.org> References: <201705042131.v44LVokb076951@repo.freebsd.org> <20170505174957.B875@besplex.bde.org> <20170505094601.GW1622@kib.kiev.ua> <20170505222702.Y1875@besplex.bde.org> <20170505143147.GX1622@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VbSHBBh9 c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=OpMgnD7Atq4i_23W64QA:9 a=G7YTQpE6ddUxrw_3:21 a=GkVXHrhHzGPYDDt4:21 a=CjuIK1q_8ugA:10 a=6kGIvZw6iX1k4Y-7sg4_:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 16:32:35 -0000 On Fri, 5 May 2017, Ed Maste wrote: > On 5 May 2017 at 10:31, Konstantin Belousov wrote: >> On Fri, May 05, 2017 at 11:39:23PM +1000, Bruce Evans wrote: >>> >>> Change "size" to "representation" if you want to allow for more than the >>> size changing. >> I suggest you to negotiate a formulation with brooks@, who provided the >> existing note. > > If it's really undesirable to mention pointer integrity here, I think > the main point can still be made with a phrase like Bruce proposed > (but I think it's fine as it exists now). No one except Cheri developers would know the Cheri meaning of "integrity mechanism". "Representation" is a general term that is fuzzy enough to work here. The representation can be almost anything, so using this term reduces the statement to a warning that it should not be assumed that pointers have the same [binary] representation as unsigned long, although the previous paragraph says that they [currently] do. > What about "In order to maximize compatibility with future changes in > pointer size or representation, manipulation..."? Or just remove the statement that pointers have the same representation as unsigned long, so that FreeBSD gurantees nothing more than the C standard for pointers, or emphasize this. > Very briefly (to give some context), in CheriBSD and the CHERI CPU > pointers are 128 or 256 bits wide, and have a base address, length, > permissions, and other fields. Thus the size differs from existing > standard integer types, and a pointer's representation and even the > essence of what a pointer is differs from pointers in existing FreeBSD > architectures. How does it restore the extra information when converting back from intptr_t? Bruce From owner-svn-src-head@freebsd.org Fri May 5 16:40:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 331B2D5FDBE; Fri, 5 May 2017 16:40:47 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E733F182F; Fri, 5 May 2017 16:40:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45GejBf049042; Fri, 5 May 2017 16:40:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45Gej6c049041; Fri, 5 May 2017 16:40:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705051640.v45Gej6c049041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 5 May 2017 16:40:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317835 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 16:40:47 -0000 Author: emaste Date: Fri May 5 16:40:45 2017 New Revision: 317835 URL: https://svnweb.freebsd.org/changeset/base/317835 Log: arch(7): add a table of per-arch initial/final FreeBSD version Reviewed by: kib, wblock Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D10573 Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Fri May 5 16:24:35 2017 (r317834) +++ head/share/man/man7/arch.7 Fri May 5 16:40:45 2017 (r317835) @@ -37,6 +37,9 @@ Differences between CPU architectures an .Fx . .Ss Introduction If not explicitly mentioned, sizes are in bytes. +The architecture details in this document apply to +.Fx 10.0 +and later, unless otherwise noted. .Pp FreeBSD uses flat address space for program execution, where pointers have the same binary representation as @@ -72,6 +75,42 @@ The kernel is located at the highest add .Pp On each architecture, the main user mode thread's stack starts near the highest user address and grows down. +.Pp +.Fx +architecture support varies by release. +This table shows the first +.Fx +release to support each architecture, and, for discontinued +architectures, the final release. +.Pp +.Bl -column -offset indent "Sy Architecture" "Sy Initial Release" "Sy Final Release" +.It Sy Architecture Ta Sy Initial Release Ta Sy Final Release +.It alpha Ta 1.0 Ta 6.4 +.It amd64 Ta 5.1 +.It arm Ta 6.0 +.It armeb Ta 8.0 +.It armv6 Ta 10.0 +.It arm64 Ta 11.0 +.It ia64 Ta 5.0 Ta 10.x +.It i386 Ta 1.0 +.It mips Ta 8.0 +.It mipsel Ta 9.0 +.It mipselhf Ta 12.0 +.It mipshf Ta 12.0 +.It mipsn32 Ta 9.0 +.It mips64 Ta 9.0 +.It mips64el Ta 9.0 +.It mips64elhf Ta 12.0 +.It mips64hf Ta 12.0 +.It pc98 Ta 5.0 Ta 11.x +.It powerpc Ta 6.0 +.It powerpcspe Ta 12.0 +.It powerpc64 Ta 6.0 +.It riscv64 Ta 12.0 +.It riscv64sf Ta 12.0 +.It sparc64 Ta 5.0 +.El + .Ss Type sizes All FreeBSD architectures use some variant of the ELF (see .Xr elf 5 ) @@ -220,7 +259,7 @@ variants of powerpc. .It amd64 Ta hard Ta hard, 80 bit .It arm Ta soft Ta soft, double precision .It armeb Ta soft Ta soft, double precision -.It armv6 Ta hard Ta hard, double precision +.It armv6 Ta hard(1) Ta hard, double precision .It arm64 Ta hard Ta soft, quad precision .It i386 Ta hard Ta hard, 80 bit .It mips Ta soft Ta identical to double @@ -239,6 +278,11 @@ variants of powerpc. .It riscv64sf Ta soft Ta soft, double precision .It sparc64 Ta hard Ta hard, quad precision .El +.Pp +(1) Prior to +.Fx 11.0 , +armv6 used the softfp ABI even though it supported only processors +with a floating point unit. .Ss Predefined Macros The compiler provides a number of predefined macros. Some of these provide architecture-specific details and are explained below. From owner-svn-src-head@freebsd.org Fri May 5 16:51:54 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5A94D5F302; Fri, 5 May 2017 16:51:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7E029A; Fri, 5 May 2017 16:51:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45GprqV053619; Fri, 5 May 2017 16:51:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45GprKd053618; Fri, 5 May 2017 16:51:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201705051651.v45GprKd053618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 5 May 2017 16:51:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317836 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 16:51:54 -0000 Author: mav Date: Fri May 5 16:51:53 2017 New Revision: 317836 URL: https://svnweb.freebsd.org/changeset/base/317836 Log: Relax r317696 locking to not drain taskqueue under the lock. MFC after: 11 days Modified: head/sys/net/if_lagg.c Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Fri May 5 16:40:45 2017 (r317835) +++ head/sys/net/if_lagg.c Fri May 5 16:51:53 2017 (r317836) @@ -553,6 +553,7 @@ lagg_clone_destroy(struct ifnet *ifp) LAGG_WLOCK(sc); lagg_proto_detach(sc); LAGG_UNLOCK_ASSERT(sc); + LAGG_XUNLOCK(sc); ifmedia_removeall(&sc->sc_media); ether_ifdetach(ifp); @@ -561,7 +562,6 @@ lagg_clone_destroy(struct ifnet *ifp) LAGG_LIST_LOCK(); SLIST_REMOVE(&V_lagg_list, sc, lagg_softc, sc_entries); LAGG_LIST_UNLOCK(); - LAGG_XUNLOCK(sc); LAGG_SX_DESTROY(sc); LAGG_LOCK_DESTROY(sc); From owner-svn-src-head@freebsd.org Fri May 5 16:52:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83E62D5F365; Fri, 5 May 2017 16:52:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3ACFE24D; Fri, 5 May 2017 16:52:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45GqQ48053681; Fri, 5 May 2017 16:52:26 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45GqQES053679; Fri, 5 May 2017 16:52:26 GMT (envelope-from np@FreeBSD.org) Message-Id: <201705051652.v45GqQES053679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 5 May 2017 16:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317837 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 16:52:27 -0000 Author: np Date: Fri May 5 16:52:25 2017 New Revision: 317837 URL: https://svnweb.freebsd.org/changeset/base/317837 Log: cxgbe(4): Update the VF device ids too. This should have been part of r317820. Reported by: jhb@ MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_iov.c head/sys/dev/cxgbe/t4_vf.c Modified: head/sys/dev/cxgbe/t4_iov.c ============================================================================== --- head/sys/dev/cxgbe/t4_iov.c Fri May 5 16:51:53 2017 (r317836) +++ head/sys/dev/cxgbe/t4_iov.c Fri May 5 16:52:25 2017 (r317837) @@ -96,7 +96,7 @@ struct { {0x6001, "Chelsio T6225-CR"}, /* 2 x 10/25G */ {0x6002, "Chelsio T6225-SO-CR"}, /* 2 x 10/25G, nomem */ {0x6003, "Chelsio T6425-CR"}, /* 4 x 10/25G */ - {0x6004, "Chelsio T6425-CR"}, /* 4 x 10/25G, nomem */ + {0x6004, "Chelsio T6425-SO-CR"}, /* 4 x 10/25G, nomem */ {0x6005, "Chelsio T6225-OCP-SO"}, /* 2 x 10/25G, nomem */ {0x6006, "Chelsio T62100-OCP-SO"}, /* 2 x 40/50/100G, nomem */ {0x6007, "Chelsio T62100-LP-CR"}, /* 2 x 40/50/100G */ Modified: head/sys/dev/cxgbe/t4_vf.c ============================================================================== --- head/sys/dev/cxgbe/t4_vf.c Fri May 5 16:51:53 2017 (r317836) +++ head/sys/dev/cxgbe/t4_vf.c Fri May 5 16:52:25 2017 (r317837) @@ -112,11 +112,25 @@ struct { {0x5813, "Chelsio T580-CHR VF"}, #endif }, t6vf_pciids[] = { + {0x6800, "Chelsio T6-DBG-25 VF"}, /* 2 x 10/25G, debug */ {0x6801, "Chelsio T6225-CR VF"}, /* 2 x 10/25G */ {0x6802, "Chelsio T6225-SO-CR VF"}, /* 2 x 10/25G, nomem */ + {0x6803, "Chelsio T6425-CR VF"}, /* 4 x 10/25G */ + {0x6804, "Chelsio T6425-SO-CR VF"}, /* 4 x 10/25G, nomem */ + {0x6805, "Chelsio T6225-OCP-SO VF"}, /* 2 x 10/25G, nomem */ + {0x6806, "Chelsio T62100-OCP-SO VF"}, /* 2 x 40/50/100G, nomem */ {0x6807, "Chelsio T62100-LP-CR VF"}, /* 2 x 40/50/100G */ {0x6808, "Chelsio T62100-SO-CR VF"}, /* 2 x 40/50/100G, nomem */ + {0x6809, "Chelsio T6210-BT VF"}, /* 2 x 10GBASE-T */ {0x680d, "Chelsio T62100-CR VF"}, /* 2 x 40/50/100G */ + {0x6810, "Chelsio T6-DBG-100 VF"}, /* 2 x 40/50/100G, debug */ + {0x6811, "Chelsio T6225-LL-CR VF"}, /* 2 x 10/25G */ + {0x6814, "Chelsio T61100-OCP-SO VF"}, /* 1 x 40/50/100G, nomem */ + {0x6815, "Chelsio T6201-BT VF"}, /* 2 x 1000BASE-T */ + + /* Custom */ + {0x6880, "Chelsio T6225 80 VF"}, + {0x6881, "Chelsio T62100 81 VF"}, }; static d_ioctl_t t4vf_ioctl; From owner-svn-src-head@freebsd.org Fri May 5 16:58:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15F0ED5F46B for ; Fri, 5 May 2017 16:58:20 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB94C8DB for ; Fri, 5 May 2017 16:58:19 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 172d97c0-31b4-11e7-bfb5-0d159cd3c324 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 172d97c0-31b4-11e7-bfb5-0d159cd3c324; Fri, 05 May 2017 16:58:41 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v45GwBw8001562; Fri, 5 May 2017 10:58:11 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1494003491.21860.9.camel@freebsd.org> Subject: Re: svn commit: r317809 - head/share/man/man7 From: Ian Lepore To: Bruce Evans , Ed Maste Cc: Konstantin Belousov , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Date: Fri, 05 May 2017 10:58:11 -0600 In-Reply-To: <20170506020904.P2496@besplex.bde.org> References: <201705042131.v44LVokb076951@repo.freebsd.org> <20170505174957.B875@besplex.bde.org> <20170505094601.GW1622@kib.kiev.ua> <20170505222702.Y1875@besplex.bde.org> <20170505143147.GX1622@kib.kiev.ua> <20170506020904.P2496@besplex.bde.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 16:58:20 -0000 On Sat, 2017-05-06 at 02:32 +1000, Bruce Evans wrote: > On Fri, 5 May 2017, Ed Maste wrote: > > > On 5 May 2017 at 10:31, Konstantin Belousov > wrote: > >> On Fri, May 05, 2017 at 11:39:23PM +1000, Bruce Evans wrote: > >>> > >>> Change "size" to "representation" if you want to allow for more > than the > >>> size changing. > >> I suggest you to negotiate a formulation with brooks@, who > provided the > >> existing note. > > > > If it's really undesirable to mention pointer integrity here, I > think > > the main point can still be made with a phrase like Bruce proposed > > (but I think it's fine as it exists now). > > No one except Cheri developers would know the Cheri meaning of > "integrity > mechanism". > I knew immediately what it meant.  Perhaps because back in 1990 I wrote a C interpreter for embedding into applications which did pretty much what Cheri does -- under the hood, pointers had an associated base address and range and other metadata, and the VM that ran the bytecode checked all pointer dereferences and pointer manipulations to ensure they didn't scribble outside the lines.  I would expect such things to become even more common going forward. -- Ian From owner-svn-src-head@freebsd.org Fri May 5 16:59:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AED9D5F4DE; Fri, 5 May 2017 16:59:25 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D997CA71; Fri, 5 May 2017 16:59:24 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x236.google.com with SMTP id o5so31255670ith.1; Fri, 05 May 2017 09:59:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=1W6a4cQ0VxfwjIuICCU3iVIYvIUHJmam1G0qXePrdvs=; b=Ii1dGf8aPHTTs6R9Yeh3MtfjMh1Ldrg163s7JRYP1FSZZeohEhSo3VmyAjVKhHEUHz vrTV/saSVLYFcv2Ff8YqkpExSThgd9wU/5KyQEbOfp4mks/qeTRsglP4F9kKDwLg0wUY YgmCQdCIMdHqoYB4SCydnkfPUrSNzsTSvZyimPqxTqZ/VWjK5GEdHv2zEufEHFzB4YNO b8JmOGVJZiEZBwShK4KYgev8Y92zyiedrwRQGudFhhpn6qcZWFoxBJ83hLjutdeIALW5 vBUbxN4IPovC1L/7lcAI1ak7MjlG6458CfluZVccJ6oZosPiyty5k2O42HzUPkPxxs5B rcpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=1W6a4cQ0VxfwjIuICCU3iVIYvIUHJmam1G0qXePrdvs=; b=X/rncyW2zO6e1z6ByGIZfxbLJc5ZhFZlO4dVfOs8l4GuEt2zuE2hs/YpT/hiJ+Q/vL 4vsXFi/13G0Z4cH4SdOIEWlqx/S6im8TQyNSuW9BLv4V87/1QSJ5iN9hNqt7rFeSQVTq klPcgs0Ekg5jy2a+ADC8Wjz6od+0lyQ8JysCfzQli8fvdM/VPymqaP2+1cXrWaT2XUex DzPE34RFZTqI4yMWUGde1ns1WpR7EeHoIfq2RkhVWGAHdgSzjK1EavJk7Xwkwra72yWw DQB+IJZ6rh4swYgHMzpxwRZgbVl+ioqi7Ct1eHhoPQN7XGb9wPODoAERip6JmZIfyk3z s/Fg== X-Gm-Message-State: AN3rC/4WtA/NlhLEQbvm7KECD87ET/PLS+EPlBwwLBlAcLIrTJoL8z2d YojH79zA4Xc+ezyO7X5/uyyYzbEB+2dG X-Received: by 10.36.117.5 with SMTP id y5mr10264080itc.19.1494003564178; Fri, 05 May 2017 09:59:24 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.30.136 with HTTP; Fri, 5 May 2017 09:59:03 -0700 (PDT) In-Reply-To: <201705051640.v45Gej6c049041@repo.freebsd.org> References: <201705051640.v45Gej6c049041@repo.freebsd.org> From: Ed Maste Date: Fri, 5 May 2017 12:59:03 -0400 X-Google-Sender-Auth: Egl_u8vd5PmboodW5a0jDZrBOn0 Message-ID: Subject: Re: svn commit: r317835 - head/share/man/man7 To: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 16:59:25 -0000 On 5 May 2017 at 12:40, Ed Maste wrote: > Author: emaste > Date: Fri May 5 16:40:45 2017 > New Revision: 317835 > URL: https://svnweb.freebsd.org/changeset/base/317835 > > +.It alpha Ta 1.0 Ta 6.4 This is incorrect, pointed out by cognet@. The only pre-4.x alpha release I see on ftp-archive is 3.4, although earlier 3.x release notes make reference to alpha. What was the release that really supported alpha? From owner-svn-src-head@freebsd.org Fri May 5 17:01:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E72C7D5F632; Fri, 5 May 2017 17:01:55 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7A25D96; Fri, 5 May 2017 17:01:55 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45H1sBw061068; Fri, 5 May 2017 17:01:54 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45H1sbM061067; Fri, 5 May 2017 17:01:54 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201705051701.v45H1sbM061067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 5 May 2017 17:01:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317838 - head/usr.sbin/mpsutil X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 17:01:56 -0000 Author: scottl Date: Fri May 5 17:01:54 2017 New Revision: 317838 URL: https://svnweb.freebsd.org/changeset/base/317838 Log: Show more fields in the IOCFact message Modified: head/usr.sbin/mpsutil/mps_show.c Modified: head/usr.sbin/mpsutil/mps_show.c ============================================================================== --- head/usr.sbin/mpsutil/mps_show.c Fri May 5 16:52:25 2017 (r317837) +++ head/usr.sbin/mpsutil/mps_show.c Fri May 5 17:01:54 2017 (r317838) @@ -217,6 +217,19 @@ show_iocfacts(int ac, char **av) return (errno); } + printf(" MsgVersion: %02d.%02d\n", + facts->MsgVersion >> 8, facts->MsgVersion & 0xff); + printf(" MsgLength: %d\n", facts->MsgLength); + printf(" Function: 0x%x\n", facts->Function); + printf(" HeaderVersion: %02d,%02d\n", + facts->HeaderVersion >> 8, facts->HeaderVersion & 0xff); + printf(" IOCNumber: %d\n", facts->IOCNumber); + printf(" MsgFlags: 0x%x\n", facts->MsgFlags); + printf(" VP_ID: %d\n", facts->VP_ID); + printf(" VF_ID: %d\n", facts->VF_ID); + printf(" IOCExceptions: %d\n", facts->IOCExceptions); + printf(" IOCStatus: %d\n", facts->IOCStatus); + printf(" IOCLogInfo: 0x%x\n", facts->IOCLogInfo); printf(" MaxChainDepth: %d\n", facts->MaxChainDepth); printf(" WhoInit: 0x%x\n", facts->WhoInit); printf(" NumberOfPorts: %d\n", facts->NumberOfPorts); From owner-svn-src-head@freebsd.org Fri May 5 17:22:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BE6FD5FB95; Fri, 5 May 2017 17:22:02 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BDF9EBF; Fri, 5 May 2017 17:22:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45HM1J6067024; Fri, 5 May 2017 17:22:01 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45HM1wg067023; Fri, 5 May 2017 17:22:01 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201705051722.v45HM1wg067023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 5 May 2017 17:22:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317839 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 17:22:02 -0000 Author: markj Date: Fri May 5 17:22:00 2017 New Revision: 317839 URL: https://svnweb.freebsd.org/changeset/base/317839 Log: Use pmap_invalidate_cache() to implement wbinvd_on_all_cpus(). Suggested by: jhb X-MFC with: r317651 Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_compat.c Fri May 5 17:01:54 2017 (r317838) +++ head/sys/compat/linuxkpi/common/src/linux_compat.c Fri May 5 17:22:00 2017 (r317839) @@ -1639,18 +1639,12 @@ linux_irq_handler(void *ent) } #if defined(__i386__) || defined(__amd64__) -static void -wbinvd_cb(void *arg __unused) -{ - - wbinvd(); -} - int linux_wbinvd_on_all_cpus(void) { - return (linux_on_each_cpu(wbinvd_cb, NULL)); + pmap_invalidate_cache(); + return (0); } #endif From owner-svn-src-head@freebsd.org Fri May 5 17:23:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1ED57D5FD39; Fri, 5 May 2017 17:23:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6283109A; Fri, 5 May 2017 17:23:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45HNvr7069411; Fri, 5 May 2017 17:23:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45HNvWD069410; Fri, 5 May 2017 17:23:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201705051723.v45HNvWD069410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 5 May 2017 17:23:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317840 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 17:23:59 -0000 Author: kib Date: Fri May 5 17:23:57 2017 New Revision: 317840 URL: https://svnweb.freebsd.org/changeset/base/317840 Log: Fix some grammar, fix some markup, bump copyright year, provide more exact claims in some cases. Discussed with: bde (most parts) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Fri May 5 17:22:00 2017 (r317839) +++ head/share/man/man7/arch.7 Fri May 5 17:23:57 2017 (r317840) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2016 The FreeBSD Foundation. All rights reserved. +.\" Copyright (c) 2016-2017 The FreeBSD Foundation. All rights reserved. .\" .\" This documentation was created by Ed Maste under sponsorship of .\" The FreeBSD Foundation. @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 4, 2017 +.Dd May 5, 2017 .Dt ARCH 7 .Os .Sh NAME @@ -41,15 +41,14 @@ The architecture details in this documen .Fx 10.0 and later, unless otherwise noted. .Pp -FreeBSD uses flat address space for program execution, where -pointers have the same binary representation as -.Vt unsigned long -variables, and -.Vt uintptr_t +.Fx +uses flat address space for program execution, +where variables of types +.Vt unsigned long , +.Vt uintptr_t , and .Vt size_t -types are synonyms for -.Vt unsigned long . +and the pointers all have the same representation. .Pp In order to maximize compatibility with future pointer integrity mechanisms, manipulations of pointers as integers should be performed via @@ -110,9 +109,10 @@ architectures, the final release. .It riscv64sf Ta 12.0 .It sparc64 Ta 5.0 .El - .Ss Type sizes -All FreeBSD architectures use some variant of the ELF (see +All +.Fx +architectures use some variant of the ELF (see .Xr elf 5 ) .Sy Application Binary Interface (ABI) for the machine processor. @@ -132,13 +132,15 @@ and .Vt void * are 8 bytes. .El -Compilers define +Compilers define the .Dv _LP64 symbol when compiling for an .Dv LP64 ABI. .Pp -Some machines support more that one FreeBSD ABI. +Some machines support more that one +.Fx +ABI. Typically these are 64-bit machines, where the .Dq native .Dv LP64 @@ -147,7 +149,7 @@ execution environment is accompanied by .Dv ILP32 environment, which was historical 32-bit predecessor for 64-bit evolution. Examples are: -.Bl -column -offset indent "powerpc64" "Sy ILP32 counterpart" +.Bl -column -offset indent "Dv powerpc64" "Sy ILP32 counterpart" .It Sy LP64 Ta Sy ILP32 counterpart .It Dv amd64 Ta Dv i386 .It Dv powerpc64 Ta Dv powerpc @@ -172,7 +174,10 @@ On all supported architectures: .El Integers are represented as two-complement. Alignment of integer and pointer types is natural, that is, -the address of the variable must be congruent to zero modulo type size. +the address of the variable must be congruent to zero modulo the type size. +Most ILP32 ABIs, except +.Dv arm , +require only 4-byte alignment for 64-bit integers. .Pp Machine-dependent type sizes: .Bl -column -offset indent "Sy Architecture" "Sy void *" "Sy long double" "Sy time_t" From owner-svn-src-head@freebsd.org Fri May 5 17:29:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B3E3D5FE88; Fri, 5 May 2017 17:29:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 25F8B1583; Fri, 5 May 2017 17:29:36 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id C30C2D4B3ED; Sat, 6 May 2017 03:29:34 +1000 (AEST) Date: Sat, 6 May 2017 03:29:31 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317809 - head/share/man/man7 In-Reply-To: <20170505143147.GX1622@kib.kiev.ua> Message-ID: <20170506023343.V2496@besplex.bde.org> References: <201705042131.v44LVokb076951@repo.freebsd.org> <20170505174957.B875@besplex.bde.org> <20170505094601.GW1622@kib.kiev.ua> <20170505222702.Y1875@besplex.bde.org> <20170505143147.GX1622@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=fYq4oGVnmcKHVLYJ-P0A:9 a=CjDqYhDyP2h-HkbO:21 a=juKgEjQQlbI1o_2U:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 17:29:37 -0000 On Fri, 5 May 2017, Konstantin Belousov wrote: > On Fri, May 05, 2017 at 11:39:23PM +1000, Bruce Evans wrote: >> On Fri, 5 May 2017, Konstantin Belousov wrote: >> >>> On Fri, May 05, 2017 at 07:13:04PM +1000, Bruce Evans wrote: >>> AFAIU, cheri is somewhat like Intel MPX, but more. I do not know fine >>> details. >>> >>> For MPX, pointers are no longer plain pointers, there is a data behind >>> the raw value, providing e.g. the range of bytes which are valid to >>> dereference through the authentic value of the pointer and arithmetic >>> manipulations of it. >> >> So the address space isn't exactly flat. Better de-emphasize that. > It is still flat. Example of not flat AS would be type-tagged or > segmented machines. MPX does not change address representation. Elsewhere, arch.7 says that on some arches the kernel uses a separate address space. So the address space isn't flat for another reasons. It is only sure to be flat (in FreeBSD) when doing local things. arch.7 doesn't say whether it is for kernel or user programming. It gives a few details that are only relevant for user programming (floating point), but is mostly about details that userland should never use and rarely does. Only the kernel and libraries have to worry about exact sizes for the purpose of preserving ABIs. >> I believe ia64 has fat function pointers, and uses handles so that some >> things appear to work normally. But comparison of function pointer >> (handle) addresses is almost meaningless. It isn't clear how gprof >> can work. It would needs something like mapping function addresses >> to handled addresses linearly. Similarly for conversion to uintptr_t. > Both ia64 and powerpc64 use function descriptors, and function pointers > point to the descriptors. Function pointers are not fat, but require > a level of indirection to find the call target instructions address. I was being fuzzy to call handles fat pointers. It is an implementation detail whether the fatness is indirect. When it is indirect, converting to/from intptr_t isn't special but following the pointer is. >>> So the phrase is correct, and the below reformulation really removes the >>> content. >> >> "integrity" isn't correct since it has nothing to do with integers. >> "mechanisms" doesn't make much sens either. Use the standard term >> "representation". >> >>>> Translation of the above: "... compatibility with changes in the size of >>>> pointers in future implementations". >> >> Change "size" to "representation" if you want to allow for more than the >> size changing. > I suggest you to negotiate a formulation with brooks@, who provided the > existing note. See another reply. >>>>> +Compilers define >>>>> +.Dv _LP64 >>>>> +symbol when compiling for an >>>>> +.Dv LP64 >>>>> +ABI. >>>> >>>> Further minor grammar problems here and elsewhere: >>>> - missing "the" before _LP64 >>>> - "an" is confusing. First, "a" might be correct depending on how you >>>> pronounce LP64. I pronounce it as "el ...", so "an" is better than >>>> "a". But there is only 1 LP64, so "the" is more correct. "the LP64 >>>> ABI" is confusing too. LP64 isn't an ABI or a collection of ABIs. >>>> The collection is of arches, many using a single LP64 sub-ABI with >>>> variations in other parts of their ABI. >>> Of course there are architectures which have more that one LP64 ABI, >>> eg. PowerPC ELF v1 and v2. >> >> No, there is only 1 LP64 by definition. It is not really an ABI, and only >> gives the sizes. > No, LP64 is the property of an ABI. That is what I was trying to say. There is 1 LP64 property, and it isn't an ABI. > So if several ABIs have this property, > it is reasonable to say that there is more than one LP64 ABI. This is hard to parse. The reader must realize that "LP64" is an adjective, which selects a class of ABIs, and that "an" applies to this class and not to LP64. >> _ALIGNBYTES only gives the smallest alignment that works for all types >> (not even that for SSE accesses on x86). It is pessimal for doubles >> and long doubles on i386, and not best for int64_t either. Does the >> Linux ABI "fix" this? The natural ABI is not easy to see. > I do not quite understand the question. > What is Linux ABI ? You said that Linux changed the i386 ABI to require 16-byte stack alignment. This is unimportant and probably a pessimization. If it changed that, then it should have changed the alignment where it actually matters -- for doubles, long doubles and possibly int64_t. > diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 > index 2add6ea3d3e..dfc3527e01c 100644 > --- a/share/man/man7/arch.7 > +++ b/share/man/man7/arch.7 > @@ -38,15 +38,13 @@ Differences between CPU architectures and platforms supported by > .Ss Introduction > If not explicitly mentioned, sizes are in bytes. > .Pp > -FreeBSD uses flat address space for program execution, where > -pointers have the same binary representation as > -.Vt unsigned long > -variables, and > -.Vt uintptr_t > +FreeBSD uses flat address space for program execution, > +where variables of types > +.Vt unsigned long , > +.Vt uintptr_t , > and > .Vt size_t > -types are synonyms for > -.Vt unsigned long . > +and the pointers all have the same representation. Now some smaller grammar fixes: - there should be an "a" before "flat" - "for program execution" is redundant. - the variable types are unrelated to the address space. Don't use "where". Just start a new sentence. - there should not be a "the" before "pointers" > @@ -133,7 +131,7 @@ On all supported architectures: > .El > Integers are represented as two-complement. - "as" should be "in" - "two" should be "two's" - the hyphen should be a space (old C99 and POSIX drafts use both, but Knuth uses a space). Bruce From owner-svn-src-head@freebsd.org Fri May 5 17:35:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A687D5F0CB; Fri, 5 May 2017 17:35:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5590F1A9E; Fri, 5 May 2017 17:35:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45HZ5Nx073407; Fri, 5 May 2017 17:35:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45HZ5W0073405; Fri, 5 May 2017 17:35:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201705051735.v45HZ5W0073405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 5 May 2017 17:35:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317842 - in head: contrib/netbsd-tests/usr.bin/grep usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 17:35:06 -0000 Author: emaste Date: Fri May 5 17:35:05 2017 New Revision: 317842 URL: https://svnweb.freebsd.org/changeset/base/317842 Log: bsdgrep: don't ouptut matches with -c, -l, -L Refactoring done in r317703 broke -c, -l, and -L flags implying suppression of match printing. Fortunately this is just a matter of not doing any printing of the resulting matches and context printing was not broken in this refactoring. Add some regression tests since this area may still see further refactoring, include different context flags as well even though they were not broken in this case. PR: 219077 Submitted by: Kyle kevans91@ksu.edu Reported by: markj Reviewed by: cem, ngie Differential Revision: https://reviews.freebsd.org/D10607 Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh head/usr.bin/grep/util.c Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh ============================================================================== --- head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Fri May 5 17:28:49 2017 (r317841) +++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Fri May 5 17:35:05 2017 (r317842) @@ -494,6 +494,34 @@ wv_combo_break_body() atf_check -s exit:1 grep -v -w "x" test1 atf_check -s exit:1 grep -v -w "x" test2 } + +atf_test_case grep_nomatch_flags +grep_nomatch_flags_head() +{ + atf_set "descr" "Check for no match (-c, -l, -L, -q) flags not producing line matches or context (PR 219077)" +} + +grep_nomatch_flags_body() +{ + printf "A\nB\nC\n" > test1 + + atf_check -o inline:"1\n" grep -c -C 1 -e "B" test1 + atf_check -o inline:"1\n" grep -c -B 1 -e "B" test1 + atf_check -o inline:"1\n" grep -c -A 1 -e "B" test1 + atf_check -o inline:"1\n" grep -c -C 1 -e "B" test1 + + atf_check -o inline:"test1\n" grep -l -e "B" test1 + atf_check -o inline:"test1\n" grep -l -B 1 -e "B" test1 + atf_check -o inline:"test1\n" grep -l -A 1 -e "B" test1 + atf_check -o inline:"test1\n" grep -l -C 1 -e "B" test1 + + atf_check -s exit:1 -o inline:"test1\n" grep -L -e "D" test1 + + atf_check -o empty grep -q -e "B" test1 + atf_check -o empty grep -q -B 1 -e "B" test1 + atf_check -o empty grep -q -A 1 -e "B" test1 + atf_check -o empty grep -q -C 1 -e "B" test1 +} # End FreeBSD atf_init_test_cases() @@ -527,5 +555,6 @@ atf_init_test_cases() atf_add_test_case fgrep_sanity atf_add_test_case egrep_sanity atf_add_test_case grep_sanity + atf_add_test_case grep_nomatch_flags # End FreeBSD } Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Fri May 5 17:28:49 2017 (r317841) +++ head/usr.bin/grep/util.c Fri May 5 17:35:05 2017 (r317842) @@ -201,7 +201,7 @@ procfile(const char *fn) struct str *ln; mode_t s; int c, last_outed, t, tail; - bool doctx, same_file; + bool doctx, printmatch, same_file; if (strcmp(fn, "-") == 0) { fn = label != NULL ? label : getstr(1); @@ -237,12 +237,14 @@ procfile(const char *fn) last_outed = 0; same_file = false; doctx = false; - if ((!pc.binary || binbehave != BINFILE_BIN) && !cflag && !qflag && - !lflag && !Lflag && (Aflag != 0 || Bflag != 0)) + printmatch = true; + if ((pc.binary && binbehave == BINFILE_BIN) || cflag || qflag || + lflag || Lflag) + printmatch = false; + if (printmatch && (Aflag != 0 || Bflag != 0)) doctx = true; mcount = mlimit; - for (c = 0; c == 0 || !(lflag || qflag); ) { /* Reset match count for every line processed */ pc.matchidx = 0; @@ -283,7 +285,7 @@ procfile(const char *fn) tail = Aflag; } /* Print the matching line, but only if not quiet/binary */ - if (t == 0 && !qflag && !pc.binary) { + if (t == 0 && printmatch) { printline(&pc, ':'); first_match = false; same_file = true; From owner-svn-src-head@freebsd.org Fri May 5 18:21:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 087CDD5F02E; Fri, 5 May 2017 18:21:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CEA1C1EEE; Fri, 5 May 2017 18:21:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45ILXPf092787; Fri, 5 May 2017 18:21:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45ILXlB092786; Fri, 5 May 2017 18:21:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201705051821.v45ILXlB092786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 5 May 2017 18:21:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317843 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 18:21:35 -0000 Author: kib Date: Fri May 5 18:21:33 2017 New Revision: 317843 URL: https://svnweb.freebsd.org/changeset/base/317843 Log: Define the scope and purpose of the page. Submitted by: emaste Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Fri May 5 17:35:05 2017 (r317842) +++ head/share/man/man7/arch.7 Fri May 5 18:21:33 2017 (r317843) @@ -36,6 +36,12 @@ Differences between CPU architectures and platforms supported by .Fx . .Ss Introduction +This document is a quick reference of key ABI details of +.Fx +architecture ports. +For full details consult the processor-specific ABI supplement +documentation. +.Pp If not explicitly mentioned, sizes are in bytes. The architecture details in this document apply to .Fx 10.0 From owner-svn-src-head@freebsd.org Fri May 5 18:36:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D344D5F465; Fri, 5 May 2017 18:36:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F38C6BBC; Fri, 5 May 2017 18:36:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45IagtN097939; Fri, 5 May 2017 18:36:42 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45Iagv7097938; Fri, 5 May 2017 18:36:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201705051836.v45Iagv7097938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 5 May 2017 18:36:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317844 - head/share/man/man7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 18:36:43 -0000 Author: kib Date: Fri May 5 18:36:41 2017 New Revision: 317844 URL: https://svnweb.freebsd.org/changeset/base/317844 Log: Grammar fixes. Noted by: bde Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Fri May 5 18:21:33 2017 (r317843) +++ head/share/man/man7/arch.7 Fri May 5 18:36:41 2017 (r317844) @@ -48,13 +48,13 @@ The architecture details in this documen and later, unless otherwise noted. .Pp .Fx -uses flat address space for program execution, -where variables of types +uses a flat address space. +Variables of types .Vt unsigned long , .Vt uintptr_t , and .Vt size_t -and the pointers all have the same representation. +and pointers all have the same representation. .Pp In order to maximize compatibility with future pointer integrity mechanisms, manipulations of pointers as integers should be performed via @@ -178,7 +178,7 @@ On all supported architectures: .It float Ta 4 .It double Ta 8 .El -Integers are represented as two-complement. +Integers are represented in two's complement. Alignment of integer and pointer types is natural, that is, the address of the variable must be congruent to zero modulo the type size. Most ILP32 ABIs, except From owner-svn-src-head@freebsd.org Fri May 5 18:49:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28FEBD5F736; Fri, 5 May 2017 18:49:41 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED8DC14AC; Fri, 5 May 2017 18:49:40 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45IndWx002724; Fri, 5 May 2017 18:49:39 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45IndZM002719; Fri, 5 May 2017 18:49:39 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201705051849.v45IndZM002719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 5 May 2017 18:49:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317845 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 18:49:41 -0000 Author: brooks Date: Fri May 5 18:49:39 2017 New Revision: 317845 URL: https://svnweb.freebsd.org/changeset/base/317845 Log: Provide a freebsd32 implementation of sigqueue() The previous misuse of sys_sigqueue() was sending random register or stack garbage to 64-bit targets. The freebsd32 implementation preserves the sival_int member of value when signaling a 64-bit process. Document the mixed ABI implementation of union sigval and the incompability of sival_ptr with pointer integrity schemes. Reviewed by: kib, wblock MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D10605 Modified: head/lib/libc/sys/sigqueue.2 head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/syscalls.master head/sys/kern/kern_sig.c head/sys/sys/syscallsubr.h Modified: head/lib/libc/sys/sigqueue.2 ============================================================================== --- head/lib/libc/sys/sigqueue.2 Fri May 5 18:36:41 2017 (r317844) +++ head/lib/libc/sys/sigqueue.2 Fri May 5 18:49:39 2017 (r317845) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2012 +.Dd May 5, 2017 .Dt SIGQUEUE 2 .Os .Sh NAME @@ -129,7 +129,6 @@ does not exist. .Xr kill 2 , .Xr sigaction 2 , .Xr sigpending 2 , -.Xr sigqueue 2 , .Xr sigsuspend 2 , .Xr sigtimedwait 2 , .Xr sigwait 2 , @@ -147,3 +146,18 @@ Support for .Tn POSIX realtime signal queue first appeared in .Fx 7.0 . +.Sh CAVEATS +When using +.Nm +to send signals to a process which might have a different ABI +(for instance, one is 32-bit and the other 64-bit), +the +.Va sival_int +member of +.Fa value +can be delivered reliably, but the +.Va sival_ptr +may be truncated in endian dependent ways and must not be relied on. +Further, many pointer integrity schemes disallow sending pointers to other +processes, and this technique should not be used in programs intended to +be portable. Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Fri May 5 18:36:41 2017 (r317844) +++ head/sys/compat/freebsd32/freebsd32_misc.c Fri May 5 18:49:39 2017 (r317845) @@ -2477,6 +2477,32 @@ siginfo_to_siginfo32(const siginfo_t *sr dst->si_overrun = src->si_overrun; } +#ifndef _FREEBSD32_SYSPROTO_H_ +struct freebsd32_sigqueue_args { + pid_t pid; + int signum; + /* union sigval32 */ int value; +}; +#endif +int +freebsd32_sigqueue(struct thread *td, struct freebsd32_sigqueue_args *uap) +{ + union sigval sv; + + /* + * On 32-bit ABIs, sival_int and sival_ptr are the same. + * On 64-bit little-endian ABIs, the low bits are the same. + * In 64-bit big-endian ABIs, sival_int overlaps with + * sival_ptr's HIGH bits. We choose to support sival_int + * rather than sival_ptr in this case as it seems to be + * more common. + */ + bzero(&sv, sizeof(sv)); + sv.sival_int = uap->value; + + return (kern_sigqueue(td, uap->pid, uap->signum, &sv)); +} + int freebsd32_sigtimedwait(struct thread *td, struct freebsd32_sigtimedwait_args *uap) { Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Fri May 5 18:36:41 2017 (r317844) +++ head/sys/compat/freebsd32/syscalls.master Fri May 5 18:49:39 2017 (r317845) @@ -819,8 +819,8 @@ 455 AUE_THR_NEW STD { int freebsd32_thr_new( \ struct thr_param32 *param, \ int param_size); } -456 AUE_NULL NOPROTO { int sigqueue(pid_t pid, int signum, \ - void *value); } +456 AUE_NULL STD { int freebsd32_sigqueue(pid_t pid, \ + int signum, int value); } 457 AUE_MQ_OPEN NOSTD { int freebsd32_kmq_open( \ const char *path, int flags, mode_t mode, \ const struct mq_attr32 *attr); } Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Fri May 5 18:36:41 2017 (r317844) +++ head/sys/kern/kern_sig.c Fri May 5 18:49:39 2017 (r317845) @@ -1844,33 +1844,43 @@ struct sigqueue_args { int sys_sigqueue(struct thread *td, struct sigqueue_args *uap) { + union sigval sv; + + sv.sival_ptr = uap->value; + + return (kern_sigqueue(td, uap->pid, uap->signum, &sv)); +} + +int +kern_sigqueue(struct thread *td, pid_t pid, int signum, union sigval *value) +{ ksiginfo_t ksi; struct proc *p; int error; - if ((u_int)uap->signum > _SIG_MAXSIG) + if ((u_int)signum > _SIG_MAXSIG) return (EINVAL); /* * Specification says sigqueue can only send signal to * single process. */ - if (uap->pid <= 0) + if (pid <= 0) return (EINVAL); - if ((p = pfind(uap->pid)) == NULL) { - if ((p = zpfind(uap->pid)) == NULL) + if ((p = pfind(pid)) == NULL) { + if ((p = zpfind(pid)) == NULL) return (ESRCH); } - error = p_cansignal(td, p, uap->signum); - if (error == 0 && uap->signum != 0) { + error = p_cansignal(td, p, signum); + if (error == 0 && signum != 0) { ksiginfo_init(&ksi); ksi.ksi_flags = KSI_SIGQ; - ksi.ksi_signo = uap->signum; + ksi.ksi_signo = signum; ksi.ksi_code = SI_QUEUE; ksi.ksi_pid = td->td_proc->p_pid; ksi.ksi_uid = td->td_ucred->cr_ruid; - ksi.ksi_value.sival_ptr = uap->value; + ksi.ksi_value = *value; error = pksignal(p, ksi.ksi_signo, &ksi); } PROC_UNLOCK(p); Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Fri May 5 18:36:41 2017 (r317844) +++ head/sys/sys/syscallsubr.h Fri May 5 18:49:39 2017 (r317845) @@ -249,6 +249,8 @@ int kern_sigprocmask(struct thread *td, int kern_sigsuspend(struct thread *td, sigset_t mask); int kern_sigtimedwait(struct thread *td, sigset_t waitset, struct ksiginfo *ksi, struct timespec *timeout); +int kern_sigqueue(struct thread *td, pid_t pid, int signum, + union sigval *value); int kern_socket(struct thread *td, int domain, int type, int protocol); int kern_statat(struct thread *td, int flag, int fd, char *path, enum uio_seg pathseg, struct stat *sbp, From owner-svn-src-head@freebsd.org Fri May 5 18:50:24 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FE74D5F7B5; Fri, 5 May 2017 18:50:24 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A6E41643; Fri, 5 May 2017 18:50:24 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45IoNti002820; Fri, 5 May 2017 18:50:23 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45IoMJb002815; Fri, 5 May 2017 18:50:22 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201705051850.v45IoMJb002815@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 5 May 2017 18:50:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317846 - head/sys/compat/freebsd32 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 18:50:24 -0000 Author: brooks Date: Fri May 5 18:50:22 2017 New Revision: 317846 URL: https://svnweb.freebsd.org/changeset/base/317846 Log: Regent post r317845. MFC after: 1 week MFC with: r317845 Sponsored by: DARPA, AFRL Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Fri May 5 18:49:39 2017 (r317845) +++ head/sys/compat/freebsd32/freebsd32_proto.h Fri May 5 18:50:22 2017 (r317846) @@ -382,6 +382,11 @@ struct freebsd32_thr_new_args { char param_l_[PADL_(struct thr_param32 *)]; struct thr_param32 * param; char param_r_[PADR_(struct thr_param32 *)]; char param_size_l_[PADL_(int)]; int param_size; char param_size_r_[PADR_(int)]; }; +struct freebsd32_sigqueue_args { + char pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)]; + char signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)]; + char value_l_[PADL_(int)]; int value; char value_r_[PADR_(int)]; +}; struct freebsd32_kmq_open_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; @@ -764,6 +769,7 @@ int freebsd32_ksem_timedwait(struct thre int freebsd32_thr_suspend(struct thread *, struct freebsd32_thr_suspend_args *); int freebsd32_umtx_op(struct thread *, struct freebsd32_umtx_op_args *); int freebsd32_thr_new(struct thread *, struct freebsd32_thr_new_args *); +int freebsd32_sigqueue(struct thread *, struct freebsd32_sigqueue_args *); int freebsd32_kmq_open(struct thread *, struct freebsd32_kmq_open_args *); int freebsd32_kmq_setattr(struct thread *, struct freebsd32_kmq_setattr_args *); int freebsd32_kmq_timedreceive(struct thread *, struct freebsd32_kmq_timedreceive_args *); @@ -1230,6 +1236,7 @@ int freebsd10_freebsd32_pipe(struct thre #define FREEBSD32_SYS_AUE_freebsd32_thr_suspend AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_umtx_op AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_thr_new AUE_THR_NEW +#define FREEBSD32_SYS_AUE_freebsd32_sigqueue AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_kmq_open AUE_MQ_OPEN #define FREEBSD32_SYS_AUE_freebsd32_kmq_setattr AUE_MQ_SETATTR #define FREEBSD32_SYS_AUE_freebsd32_kmq_timedreceive AUE_MQ_TIMEDRECEIVE Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Fri May 5 18:49:39 2017 (r317845) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Fri May 5 18:50:22 2017 (r317846) @@ -358,7 +358,7 @@ #define FREEBSD32_SYS_auditctl 453 #define FREEBSD32_SYS_freebsd32_umtx_op 454 #define FREEBSD32_SYS_freebsd32_thr_new 455 -#define FREEBSD32_SYS_sigqueue 456 +#define FREEBSD32_SYS_freebsd32_sigqueue 456 #define FREEBSD32_SYS_freebsd32_kmq_open 457 #define FREEBSD32_SYS_freebsd32_kmq_setattr 458 #define FREEBSD32_SYS_freebsd32_kmq_timedreceive 459 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Fri May 5 18:49:39 2017 (r317845) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Fri May 5 18:50:22 2017 (r317846) @@ -465,7 +465,7 @@ const char *freebsd32_syscallnames[] = { "auditctl", /* 453 = auditctl */ "freebsd32_umtx_op", /* 454 = freebsd32_umtx_op */ "freebsd32_thr_new", /* 455 = freebsd32_thr_new */ - "sigqueue", /* 456 = sigqueue */ + "freebsd32_sigqueue", /* 456 = freebsd32_sigqueue */ "freebsd32_kmq_open", /* 457 = freebsd32_kmq_open */ "freebsd32_kmq_setattr", /* 458 = freebsd32_kmq_setattr */ "freebsd32_kmq_timedreceive", /* 459 = freebsd32_kmq_timedreceive */ Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Fri May 5 18:49:39 2017 (r317845) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Fri May 5 18:50:22 2017 (r317846) @@ -508,7 +508,7 @@ struct sysent freebsd32_sysent[] = { { AS(auditctl_args), (sy_call_t *)sys_auditctl, AUE_AUDITCTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 453 = auditctl */ { AS(freebsd32_umtx_op_args), (sy_call_t *)freebsd32_umtx_op, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 454 = freebsd32_umtx_op */ { AS(freebsd32_thr_new_args), (sy_call_t *)freebsd32_thr_new, AUE_THR_NEW, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 455 = freebsd32_thr_new */ - { AS(sigqueue_args), (sy_call_t *)sys_sigqueue, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 456 = sigqueue */ + { AS(freebsd32_sigqueue_args), (sy_call_t *)freebsd32_sigqueue, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 456 = freebsd32_sigqueue */ { AS(freebsd32_kmq_open_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 457 = freebsd32_kmq_open */ { AS(freebsd32_kmq_setattr_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 458 = freebsd32_kmq_setattr */ { AS(freebsd32_kmq_timedreceive_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_ABSENT }, /* 459 = freebsd32_kmq_timedreceive */ Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Fri May 5 18:49:39 2017 (r317845) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Fri May 5 18:50:22 2017 (r317846) @@ -2355,12 +2355,12 @@ systrace_args(int sysnum, void *params, *n_args = 2; break; } - /* sigqueue */ + /* freebsd32_sigqueue */ case 456: { - struct sigqueue_args *p = params; + struct freebsd32_sigqueue_args *p = params; iarg[0] = p->pid; /* pid_t */ iarg[1] = p->signum; /* int */ - uarg[2] = (intptr_t) p->value; /* void * */ + iarg[2] = p->value; /* int */ *n_args = 3; break; } @@ -7130,7 +7130,7 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; - /* sigqueue */ + /* freebsd32_sigqueue */ case 456: switch(ndx) { case 0: @@ -7140,7 +7140,7 @@ systrace_entry_setargdesc(int sysnum, in p = "int"; break; case 2: - p = "userland void *"; + p = "int"; break; default: break; @@ -10305,7 +10305,7 @@ systrace_return_setargdesc(int sysnum, i if (ndx == 0 || ndx == 1) p = "int"; break; - /* sigqueue */ + /* freebsd32_sigqueue */ case 456: if (ndx == 0 || ndx == 1) p = "int"; From owner-svn-src-head@freebsd.org Fri May 5 19:34:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05798D5F536; Fri, 5 May 2017 19:34:07 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBDF814BB; Fri, 5 May 2017 19:34:06 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45JY5gw022774; Fri, 5 May 2017 19:34:05 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45JY5Gr022773; Fri, 5 May 2017 19:34:05 GMT (envelope-from np@FreeBSD.org) Message-Id: <201705051934.v45JY5Gr022773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 5 May 2017 19:34:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317847 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 19:34:07 -0000 Author: np Date: Fri May 5 19:34:05 2017 New Revision: 317847 URL: https://svnweb.freebsd.org/changeset/base/317847 Log: cxgbe(4): The Tx scheduler initialization either works or doesn't. It doesn't need a refresh in either case. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sched.c Modified: head/sys/dev/cxgbe/t4_sched.c ============================================================================== --- head/sys/dev/cxgbe/t4_sched.c Fri May 5 18:50:22 2017 (r317846) +++ head/sys/dev/cxgbe/t4_sched.c Fri May 5 19:34:05 2017 (r317847) @@ -357,7 +357,6 @@ t4_init_tx_sched(struct adapter *sc) n * sizeof(*tc), M_CXGBE, M_ZERO | M_WAITOK); tc = &pi->sched_params->cl_rl[0]; for (j = 0; j < n; j++, tc++) { - tc->flags = TX_CLRL_REFRESH; tc->refcount = 0; tc->ratemode = FW_SCHED_PARAMS_RATE_ABS; tc->rateunit = FW_SCHED_PARAMS_UNIT_BITRATE; @@ -365,8 +364,11 @@ t4_init_tx_sched(struct adapter *sc) tc->maxrate = init_kbps[min(j, nitems(init_kbps) - 1)]; tc->pktsize = ETHERMTU; /* XXX */ - t4_sched_params_cl_rl_kbps(sc, pi->tx_chan, j, tc->mode, - tc->maxrate, tc->pktsize, 1); + if (t4_sched_params_cl_rl_kbps(sc, pi->tx_chan, j, + tc->mode, tc->maxrate, tc->pktsize, 1) == 0) + tc->flags = 0; + else + tc->flags = TX_CLRL_ERROR; } } From owner-svn-src-head@freebsd.org Fri May 5 20:00:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33CA7D5FBC1; Fri, 5 May 2017 20:00:55 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8FD0398; Fri, 5 May 2017 20:00:54 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45K0rFq031306; Fri, 5 May 2017 20:00:53 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45K0rCI031303; Fri, 5 May 2017 20:00:53 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705052000.v45K0rCI031303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 5 May 2017 20:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317848 - in head: share/man/man4 sys/cam/scsi usr.bin/mt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 20:00:55 -0000 Author: ken Date: Fri May 5 20:00:53 2017 New Revision: 317848 URL: https://svnweb.freebsd.org/changeset/base/317848 Log: Add basic programmable early warning error injection to the sa(4) driver. This will help application developers simulate end of tape conditions. To inject an error in sa0: sysctl kern.cam.sa.0.inject_eom=1 This will return the next read or write request queued with 0 bytes written. Any subsequent writes or reads will go along as usual. This will also cause the early warning position flag to get set for the next position query. So, 'mt status' will show the BPEW (Beyond Programmable Early Warning) flag on the first query after an error injection. After that, the position flags will be as they are in the underlying tape drive. Also, update the sa(4) man page to describe tape parameters, which can be set via 'mt param'. sys/cam/scsi/scsi_sa.c: In saregister(), create the inject_eom sysctl variable. In sastart(), check to see whether inject_eom is set. If so, return the read or write with 0 bytes written to indicate EOM. Set the set_pews_status flag so that we fake PEWS status in the next position call for reads, and the next 3 calls for writes. This allows the user to see the BPEW flag one time via 'mt status'. In sagetpos(), check the set_pews_status flag and fake PEWS status and decrement the counter if it is set. share/man/man4/sa.4: Document the inject_eom sysctl variable. Document all of the parameters currently supported via 'mt param'. usr.bin/mt/mt.1: Point the user to the sa(4) man page for more details on supported parameters. MFC after: 3 days Sponsored by: Spectra Logic Modified: head/share/man/man4/sa.4 head/sys/cam/scsi/scsi_sa.c head/usr.bin/mt/mt.1 Modified: head/share/man/man4/sa.4 ============================================================================== --- head/share/man/man4/sa.4 Fri May 5 19:34:05 2017 (r317847) +++ head/share/man/man4/sa.4 Fri May 5 20:00:53 2017 (r317848) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 12, 2015 +.Dd May 5, 2017 .Dt SA 4 .Os .Sh NAME @@ -242,6 +242,87 @@ These devices include the QIC family of block devices. This has not been determined yet, and they are treated as separate behaviors by the driver at this time.) +.Sh PARAMETERS +The +.Nm +driver supports a number of parameters. +The user can query parameters using +.Dq mt param -l +(which uses the +.Dv MTIOCPARAMGET +ioctl) and the user can set parameters using +.Dq mt param -s +(which uses the +.Dv MTIOCPARAMSET +ioctl). +See +.Xr mt 1 +and +.Xr mtio 4 +for more details on the interface. +.Pp +Supported parameters: +.Bl -tag -width 5n +.It sili +The default is 0. +When set to 1, it sets the Suppress Incorrect Length Indicator (SILI) bit +on tape reads. +Tape drives normally return sense data (which contains the residual) when the +application reads a block that is not the same length as the amount of data +requested. +The SILI bit supresses that notification in most cases. +See the SSC-5 spec (available at t10.org), specifically the section on the +READ(6) command, for more information. +.It eot_warn +The default is 0. +By default, the +.Nm +driver reports entering Programmable Early Warning, Early Warning and End +of Media conditions by returning a write with 0 bytes written, and +.Dv errno +set to 0. +If +.Va eot_warn +is set to 1, the +.Nm +driver will set +.Dv errno +to +.Dv ENOSPC +when it enters any of the out of space conditions. +.It protection.protection_supported +This is a read-only parameter, and is set to 1 if the tape drive supports +protection information. +.It protection.prot_method +If protection is supported, set this to the desired protection method +supported by the tape drive. +As of SSC-5r03 (available at t10.org), the protection method values are: +.Bl -tag -width 3n +.It 0 +No protection. +.It 1 +Reed-Solomon CRC, 4 bytes in length. +.It 2 +CRC32C, 4 bytes in length. +.El +.It protection.pi_length +Length of the protection information, see above for lengths. +.It protection.lbp_w +If set to 1, enable logical block protection on writes. +The CRC must be appended to the end of the block written to the tape driver. +The tape drive will verify the CRC when it receives the block. +.It protection.lbp_r +If set to 1, enable logical block protection on reads. +The CRC will be appended to the end of the block read from the tape driver. +The application should verify the CRC when it receives the block. +.It protection.rdbp +If set to 1, enable logical block protection on the RECOVER BUFFERED DATA +command. +The +.Nm +driver does not currently use the +RECOVER BUFFERED DATA command. +.El .Sh IOCTLS The .Nm @@ -262,7 +343,26 @@ Control mode device (to examine state wh accessing the device, e.g.). .El .Sh DIAGNOSTICS -None. +The +.Nm +driver supports injecting End Of Media (EOM) notification to aid +application development and testing. +EOM is indicated to the application by returning the read or write with 0 +bytes written. +In addition, when EOM is injected, the tape position status will be updated +to temporarily show Beyond of the Programmable Early Warning (BPEW) status. +To see BPEW status, use the +.Dv MTIOCEXTGET +ioctl, which is used by the +.Dq mt status +command. +To inject an EOM notification, set the +.Pp +.Va kern.cam.sa.%d.inject_eom +.Pp +sysctl variable to 1. +One EOM notification will be sent, BPEW status will be set for one position +query, and then the driver state will be reset to normal. .Sh SEE ALSO .Xr mt 1 , .Xr cam 4 Modified: head/sys/cam/scsi/scsi_sa.c ============================================================================== --- head/sys/cam/scsi/scsi_sa.c Fri May 5 19:34:05 2017 (r317847) +++ head/sys/cam/scsi/scsi_sa.c Fri May 5 20:00:53 2017 (r317848) @@ -337,6 +337,8 @@ struct sa_softc { u_int32_t maxio; u_int32_t cpi_maxio; int allow_io_split; + int inject_eom; + int set_pews_status; u_int32_t comp_algorithm; u_int32_t saved_comp_algorithm; u_int32_t media_blksize; @@ -2323,6 +2325,9 @@ sasysctlinit(void *context, int pending) SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "cpi_maxio", CTLFLAG_RD, &softc->cpi_maxio, 0, "Maximum Controller I/O size"); + SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "inject_eom", CTLFLAG_RW, + &softc->inject_eom, 0, "Queue EOM for the next write/read"); bailout: /* @@ -2588,8 +2593,27 @@ sastart(struct cam_periph *periph, union bp = bioq_first(&softc->bio_queue); if (bp == NULL) { xpt_release_ccb(start_ccb); - } else if ((softc->flags & SA_FLAG_ERR_PENDING) != 0) { + } else if (((softc->flags & SA_FLAG_ERR_PENDING) != 0) + || (softc->inject_eom != 0)) { struct bio *done_bp; + + if (softc->inject_eom != 0) { + softc->flags |= SA_FLAG_EOM_PENDING; + softc->inject_eom = 0; + /* + * If we're injecting EOM for writes, we + * need to keep PEWS set for 3 queries + * to cover 2 position requests from the + * kernel via sagetpos(), and then allow + * for one for the user to see the BPEW + * flag (e.g. via mt status). After that, + * it will be cleared. + */ + if (bp->bio_cmd == BIO_WRITE) + softc->set_pews_status = 3; + else + softc->set_pews_status = 1; + } again: softc->queue_count--; bioq_remove(&softc->bio_queue, bp); @@ -4842,9 +4866,12 @@ sagetpos(struct cam_periph *periph) else softc->eop = 0; - if (long_pos.flags & SA_RPOS_LONG_BPEW) + if ((long_pos.flags & SA_RPOS_LONG_BPEW) + || (softc->set_pews_status != 0)) { softc->bpew = 1; - else + if (softc->set_pews_status > 0) + softc->set_pews_status--; + } else softc->bpew = 0; } else if (error == EINVAL) { /* Modified: head/usr.bin/mt/mt.1 ============================================================================== --- head/usr.bin/mt/mt.1 Fri May 5 19:34:05 2017 (r317847) +++ head/usr.bin/mt/mt.1 Fri May 5 20:00:53 2017 (r317848) @@ -29,7 +29,7 @@ .\" @(#)mt.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd May 20, 2016 +.Dd May 5, 2017 .Dt MT 1 .Os .Sh NAME @@ -284,6 +284,9 @@ One of or .Fl x must be specified to indicate which operation to perform. +See +.Xr sa 4 +for more detailed information on the parameters. .Bl -tag -width 8n .It Fl l List parameters, values and descriptions. From owner-svn-src-head@freebsd.org Fri May 5 20:06:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 731B3D5FECE; Fri, 5 May 2017 20:06:51 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FF05C8C; Fri, 5 May 2017 20:06:51 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45K6oKt035047; Fri, 5 May 2017 20:06:50 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45K6oPI035043; Fri, 5 May 2017 20:06:50 GMT (envelope-from np@FreeBSD.org) Message-Id: <201705052006.v45K6oPI035043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 5 May 2017 20:06:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317849 - in head/sys: dev/cxgbe/tom modules/cxgbe/tom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 20:06:51 -0000 Author: np Date: Fri May 5 20:06:49 2017 New Revision: 317849 URL: https://svnweb.freebsd.org/changeset/base/317849 Log: cxgbe/t4_tom: Per-connection rate limiting for TCP sockets handled by the TOE. For now this capability is always enabled in kernels with options RATELIMIT. t4_tom will check if_capenable once the base driver gets code to support rate limiting for any socket (TOE or not). This was tested with iperf3 and netperf ToT as they already support SO_MAX_PACING_RATE sockopt. There is a bug in firmwares prior to 1.16.45.0 that affects the BSD driver only and results in rate-limiting at an incorrect rate. This will resolve by itself as soon as 1.16.45.0 or later firmware shows up in the driver. Relnotes: Yes Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h head/sys/modules/cxgbe/tom/Makefile Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri May 5 20:00:53 2017 (r317848) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri May 5 20:06:49 2017 (r317849) @@ -29,6 +29,8 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" +#include "opt_inet6.h" +#include "opt_ratelimit.h" #ifdef TCP_OFFLOAD #include @@ -186,6 +188,76 @@ send_flowc_wr(struct toepcb *toep, struc t4_wrq_tx(sc, wr); } +#ifdef RATELIMIT +/* + * Input is Bytes/second (so_max_pacing-rate), chip counts in Kilobits/second. + */ +static int +update_tx_rate_limit(struct adapter *sc, struct toepcb *toep, u_int Bps) +{ + int tc_idx, rc; + const u_int kbps = (u_int) (uint64_t)Bps * 8ULL / 1000; + const int port_id = toep->vi->pi->port_id; + + CTR3(KTR_CXGBE, "%s: tid %u, rate %uKbps", __func__, toep->tid, kbps); + + if (kbps == 0) { + /* unbind */ + tc_idx = -1; + } else { + rc = t4_reserve_cl_rl_kbps(sc, port_id, kbps, &tc_idx); + if (rc != 0) + return (rc); + MPASS(tc_idx >= 0 && tc_idx < sc->chip_params->nsched_cls); + } + + if (toep->tc_idx != tc_idx) { + struct wrqe *wr; + struct fw_flowc_wr *flowc; + int nparams = 1, flowclen, flowclen16; + struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx]; + + flowclen = sizeof(*flowc) + nparams * sizeof(struct + fw_flowc_mnemval); + flowclen16 = howmany(flowclen, 16); + if (toep->tx_credits < flowclen16 || toep->txsd_avail == 0 || + (wr = alloc_wrqe(roundup2(flowclen, 16), toep->ofld_txq)) == NULL) { + if (tc_idx >= 0) + t4_release_cl_rl_kbps(sc, port_id, tc_idx); + return (ENOMEM); + } + + flowc = wrtod(wr); + memset(flowc, 0, wr->wr_len); + + flowc->op_to_nparams = htobe32(V_FW_WR_OP(FW_FLOWC_WR) | + V_FW_FLOWC_WR_NPARAMS(nparams)); + flowc->flowid_len16 = htonl(V_FW_WR_LEN16(flowclen16) | + V_FW_WR_FLOWID(toep->tid)); + + flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_SCHEDCLASS; + if (tc_idx == -1) + flowc->mnemval[0].val = htobe32(0xff); + else + flowc->mnemval[0].val = htobe32(tc_idx); + + txsd->tx_credits = flowclen16; + txsd->plen = 0; + toep->tx_credits -= txsd->tx_credits; + if (__predict_false(++toep->txsd_pidx == toep->txsd_total)) + toep->txsd_pidx = 0; + toep->txsd_avail--; + t4_wrq_tx(sc, wr); + } + + if (toep->tc_idx >= 0) + t4_release_cl_rl_kbps(sc, port_id, toep->tc_idx); + toep->tc_idx = tc_idx; + + return (0); +} +#endif + void send_reset(struct adapter *sc, struct toepcb *toep, uint32_t snd_nxt) { @@ -619,7 +691,7 @@ t4_push_frames(struct adapter *sc, struc struct socket *so = inp->inp_socket; struct sockbuf *sb = &so->so_snd; int tx_credits, shove, compl, sowwakeup; - struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx]; + struct ofld_tx_sdesc *txsd; bool aiotx_mbuf_seen; INP_WLOCK_ASSERT(inp); @@ -638,6 +710,13 @@ t4_push_frames(struct adapter *sc, struc if (__predict_false(toep->flags & TPF_ABORT_SHUTDOWN)) return; +#ifdef RATELIMIT + if (__predict_false(inp->inp_flags2 & INP_RATE_LIMIT_CHANGED) && + (update_tx_rate_limit(sc, toep, so->so_max_pacing_rate) == 0)) { + inp->inp_flags2 &= ~INP_RATE_LIMIT_CHANGED; + } +#endif + /* * This function doesn't resume by itself. Someone else must clear the * flag and call this function. @@ -648,6 +727,7 @@ t4_push_frames(struct adapter *sc, struc return; } + txsd = &toep->txsd[toep->txsd_pidx]; do { tx_credits = min(toep->tx_credits, MAX_OFLD_TX_CREDITS); max_imm = max_imm_payload(tx_credits); Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Fri May 5 20:00:53 2017 (r317848) +++ head/sys/dev/cxgbe/tom/t4_tom.c Fri May 5 20:06:49 2017 (r317849) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_ratelimit.h" #include #include @@ -156,6 +157,7 @@ alloc_toepcb(struct vi_info *vi, int txq refcount_init(&toep->refcount, 1); toep->td = sc->tom_softc; toep->vi = vi; + toep->tc_idx = -1; toep->tx_total = tx_credits; toep->tx_credits = tx_credits; toep->ofld_txq = &sc->sge.ofld_txq[txqid]; @@ -312,6 +314,10 @@ release_offload_resources(struct toepcb if (toep->ce) release_lip(td, toep->ce); +#ifdef RATELIMIT + if (toep->tc_idx != -1) + t4_release_cl_rl_kbps(sc, toep->vi->pi->port_id, toep->tc_idx); +#endif mtx_lock(&td->toep_list_lock); TAILQ_REMOVE(&td->toep_list, toep, link); mtx_unlock(&td->toep_list_lock); Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Fri May 5 20:00:53 2017 (r317848) +++ head/sys/dev/cxgbe/tom/t4_tom.h Fri May 5 20:06:49 2017 (r317849) @@ -149,6 +149,7 @@ struct toepcb { struct l2t_entry *l2te; /* L2 table entry used by this connection */ struct clip_entry *ce; /* CLIP table entry used by this tid */ int tid; /* Connection identifier */ + int tc_idx; /* traffic class that this tid is bound to */ /* tx credit handling */ u_int tx_total; /* total tx WR credits (in 16B units) */ Modified: head/sys/modules/cxgbe/tom/Makefile ============================================================================== --- head/sys/modules/cxgbe/tom/Makefile Fri May 5 20:00:53 2017 (r317848) +++ head/sys/modules/cxgbe/tom/Makefile Fri May 5 20:06:49 2017 (r317849) @@ -10,6 +10,7 @@ SRCS= bus_if.h SRCS+= device_if.h SRCS+= opt_inet.h SRCS+= opt_inet6.h +SRCS+= opt_ratelimit.h SRCS+= pci_if.h SRCS+= t4_connect.c SRCS+= t4_cpl_io.c From owner-svn-src-head@freebsd.org Fri May 5 21:29:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CEA69D5F301; Fri, 5 May 2017 21:29:29 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84E5E1EC3; Fri, 5 May 2017 21:29:29 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v45LTSZ7067890; Fri, 5 May 2017 21:29:28 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v45LTSek067889; Fri, 5 May 2017 21:29:28 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201705052129.v45LTSek067889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Fri, 5 May 2017 21:29:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317854 - head/sbin/camcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 21:29:29 -0000 Author: ken Date: Fri May 5 21:29:28 2017 New Revision: 317854 URL: https://svnweb.freebsd.org/changeset/base/317854 Log: When editing a mode page on a tape drive, do not clear the device specific parameter. Tape drives include write protect (WP), Buffered Mode and Speed settings in the device-specific parameter. Clearing this parameter on a mode select can have the effect of turning off write protect or buffered mode, or changing the speed setting of the tape drive. Disks report DPO/FUA support via the device specific parameter for MODE SENSE, but the bit is reserved for MODE SELECT. So we clear this for disks (and other non-tape devices) to avoid potential errors from the target device. sbin/camcontrol/modeedit.c: Clear the device-specific parameter in the mode page header if we're not operating on a tape drive. MFC after: 3 days Sponsored by: Spectra Logic Modified: head/sbin/camcontrol/modeedit.c Modified: head/sbin/camcontrol/modeedit.c ============================================================================== --- head/sbin/camcontrol/modeedit.c Fri May 5 20:45:55 2017 (r317853) +++ head/sbin/camcontrol/modeedit.c Fri May 5 21:29:28 2017 (r317854) @@ -629,8 +629,21 @@ editlist_save(struct cam_device *device, /* Recalculate headers & offsets. */ mh->data_length = 0; /* Reserved for MODE SELECT command. */ - mh->dev_spec = 0; /* Clear device-specific parameters. */ mh->blk_desc_len = 0; /* No block descriptors. */ + /* + * Tape drives include write protect (WP), Buffered Mode and Speed + * settings in the device-specific parameter. Clearing this + * parameter on a mode select can have the effect of turning off + * write protect or buffered mode, or changing the speed setting of + * the tape drive. + * + * Disks report DPO/FUA support via the device specific parameter + * for MODE SENSE, but the bit is reserved for MODE SELECT. So we + * clear this for disks (and other non-tape devices) to avoid + * potential errors from the target device. + */ + if (device->pd_type != T_SEQUENTIAL) + mh->dev_spec = 0; mph = MODE_PAGE_HEADER(mh); mph->page_code &= ~SMPH_PS; /* Reserved for MODE SELECT command. */ From owner-svn-src-head@freebsd.org Fri May 5 21:31:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01AB3D5F39C for ; Fri, 5 May 2017 21:31:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22c.google.com (mail-it0-x22c.google.com [IPv6:2607:f8b0:4001:c0b::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C6E4629C for ; Fri, 5 May 2017 21:31:35 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22c.google.com with SMTP id x188so16079069itb.0 for ; Fri, 05 May 2017 14:31:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=kp959gPH0rPsUGECbhiaKgGt4noyziYLHWFpn1+9Dh0=; b=Rp0HI9U/VcpfWhnbd4mNNUuAHB87PHvVpxhk2bhwNZCxvpV7eh3RBgot3TegkhwVKP 5TjNBm/TJQJLmysybLeVzEm+DDyQ02p6yfI9pIChxH+ntOPT6P3I7fHqZ+hS51sKs8QS HguDuM7ZASG/CLJhzJjfRevbB0t1MFmvcTbTXjJ1ERGW4X7GgdpiVGTF88OpRxUppeEs NcPQzKbX9J41cUQjyOTydrJWpTA+S7oa0Z5W6ZU8JeQ0bE6LMvmMYBdPgdec38cPT94y iXXeVk3e0tIGDOkO/hGE+MMSy5SnzpN+rVYy+uNZMcucofB+geCIqTU7q0Ydfzdqan6c RqIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=kp959gPH0rPsUGECbhiaKgGt4noyziYLHWFpn1+9Dh0=; b=QZlMM3mnEXr43RmZzlY9/olar9JotcD0Tgu61cpJOyC1f8BHe4PrEeYY+gz+txvAsj j+1T7zQZ3sstcn4D8cjJq8gFv+JeDoRlwy2Gufp+IJcfg5U4HMwdrx9Ka0QTDCloVBnI SlZaqcRTGZLW7oHHSbZkMEJu/6Ol1WRMFJIJ3Y7xUufxIq3zkcA9j/VzBIigR8cjPYum 57gxH63y5iDxQ8dwOBTUJGLErMN2e3DxjaQBuxXEOiWar2DubMa3/JKrVMfSUt08MYcN IBqcl8qSwkWemew6ZWOacTLb2nJsX9S6a+w+t8q3SUJ7mX5d3yhyHN7Z+4N6ywhMPWMZ S99w== X-Gm-Message-State: AN3rC/4sPpkE7gX2TpfGQjxvNSiMNhZS0iU2SRq5WWWHxYy8yQXdESxC UIUPfGcsKcmZXtp15xoE7ZfwxXBgTw== X-Received: by 10.36.181.1 with SMTP id v1mr11065282ite.103.1494019894518; Fri, 05 May 2017 14:31:34 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.126.6 with HTTP; Fri, 5 May 2017 14:31:34 -0700 (PDT) X-Originating-IP: [2607:fb10:7021:1::18fd] In-Reply-To: References: <201705051640.v45Gej6c049041@repo.freebsd.org> From: Warner Losh Date: Fri, 5 May 2017 15:31:34 -0600 X-Google-Sender-Auth: 2qxe1NssmNYNcHpaQ6U-ADC_-UI Message-ID: Subject: Re: svn commit: r317835 - head/share/man/man7 To: Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 21:31:36 -0000 On Fri, May 5, 2017 at 10:59 AM, Ed Maste wrote: > On 5 May 2017 at 12:40, Ed Maste wrote: >> Author: emaste >> Date: Fri May 5 16:40:45 2017 >> New Revision: 317835 >> URL: https://svnweb.freebsd.org/changeset/base/317835 >> >> +.It alpha Ta 1.0 Ta 6.4 > > This is incorrect, pointed out by cognet@. The only pre-4.x alpha > release I see on ftp-archive is 3.4, although earlier 3.x release > notes make reference to alpha. What was the release that really > supported alpha? Alpha came into the tree in the 3.x time line and was the reason we started moving to newbus in 4.x (which was only completed by 5.0). I'm pretty sure there was no alpha support as late as 2.2 since I was just looking there for a different reason. There's a similar issue with pc98. It has been in the tree since 2.2. The FreeBSD(98) folks did releases through the 4.x series from almost unmodified FreeBSD trees (the modifications were related to pc98's unique requirements wrt release engineering and occasionally an advance copy of a driver that hadn't been integrated into FreeBSD proper yet). You could run pc98 machines that you build from source from at least 3.2, if not earlier (that was the first release I did it with for various crazy reasons). Warner From owner-svn-src-head@freebsd.org Sat May 6 04:17:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17C15D60934; Sat, 6 May 2017 04:17:50 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C0EF717CB; Sat, 6 May 2017 04:17:49 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v464Hmjh035518; Sat, 6 May 2017 04:17:48 GMT (envelope-from lidl@FreeBSD.org) Received: (from lidl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v464HmhO035516; Sat, 6 May 2017 04:17:48 GMT (envelope-from lidl@FreeBSD.org) Message-Id: <201705060417.v464HmhO035516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lidl set sender to lidl@FreeBSD.org using -f From: Kurt Lidl Date: Sat, 6 May 2017 04:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317862 - head/libexec/ftpd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 04:17:50 -0000 Author: lidl Date: Sat May 6 04:17:48 2017 New Revision: 317862 URL: https://svnweb.freebsd.org/changeset/base/317862 Log: Improve blacklist support before upgrading libblacklist The locally declared enum of blacklistd actions needs to be hidden when the soon to be committed changes to libblacklist are brought into the tree. Fix the type of the "msg" parameter to match the library. There should be no functional changes. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/libexec/ftpd/blacklist.c head/libexec/ftpd/blacklist_client.h Modified: head/libexec/ftpd/blacklist.c ============================================================================== --- head/libexec/ftpd/blacklist.c Sat May 6 02:43:26 2017 (r317861) +++ head/libexec/ftpd/blacklist.c Sat May 6 04:17:48 2017 (r317862) @@ -33,8 +33,8 @@ #include #include -#include "blacklist_client.h" #include +#include "blacklist_client.h" static struct blacklist *blstate; extern int use_blacklist; @@ -48,7 +48,7 @@ blacklist_init(void) } void -blacklist_notify(int action, int fd, char *msg) +blacklist_notify(int action, int fd, const char *msg) { if (blstate == NULL) Modified: head/libexec/ftpd/blacklist_client.h ============================================================================== --- head/libexec/ftpd/blacklist_client.h Sat May 6 02:43:26 2017 (r317861) +++ head/libexec/ftpd/blacklist_client.h Sat May 6 04:17:48 2017 (r317862) @@ -31,14 +31,16 @@ #ifndef BLACKLIST_CLIENT_H #define BLACKLIST_CLIENT_H +#ifndef BLACKLIST_API_ENUM enum { BLACKLIST_AUTH_OK = 0, BLACKLIST_AUTH_FAIL }; +#endif #ifdef USE_BLACKLIST void blacklist_init(void); -void blacklist_notify(int, int, char *); +void blacklist_notify(int, int, const char *); #define BLACKLIST_INIT() blacklist_init() #define BLACKLIST_NOTIFY(x, y, z) blacklist_notify(x, y, z) From owner-svn-src-head@freebsd.org Sat May 6 05:37:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 678D0D60C71; Sat, 6 May 2017 05:37:38 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31C76160D; Sat, 6 May 2017 05:37:38 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v465bbpt068305; Sat, 6 May 2017 05:37:37 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v465bbvP068304; Sat, 6 May 2017 05:37:37 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201705060537.v465bbvP068304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 6 May 2017 05:37:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317863 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 05:37:38 -0000 Author: bdrewery Date: Sat May 6 05:37:36 2017 New Revision: 317863 URL: https://svnweb.freebsd.org/changeset/base/317863 Log: Fix some "don't build" optimizations from r308599 not working due to a typo. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/share/mk/bsd.init.mk Modified: head/share/mk/bsd.init.mk ============================================================================== --- head/share/mk/bsd.init.mk Sat May 6 04:17:48 2017 (r317862) +++ head/share/mk/bsd.init.mk Sat May 6 05:37:36 2017 (r317863) @@ -29,7 +29,7 @@ ____: .if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL:U1} == 0 && \ ${BUILD_AT_LEVEL0:Uyes:tl} == "no" && !make(clean*) _SKIP_BUILD= not building at level 0 -.elseif !empty(.MAKEFLAGS:M-V${_V_DO_BUILD}) || \ +.elif !empty(.MAKEFLAGS:M-V${_V_DO_BUILD}) || \ ${.TARGETS:M*install*} == ${.TARGETS} || \ make(clean*) || make(obj) || make(analyze) || make(print-dir) || \ make(destroy*) From owner-svn-src-head@freebsd.org Sat May 6 05:53:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98D37D613CA; Sat, 6 May 2017 05:53:43 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 744D3169A; Sat, 6 May 2017 05:53:43 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v465rgwM076918; Sat, 6 May 2017 05:53:42 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v465rgc0076916; Sat, 6 May 2017 05:53:42 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705060553.v465rgc0076916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 6 May 2017 05:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317866 - head/sys/dev/etherswitch/ip17x X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 05:53:43 -0000 Author: adrian Date: Sat May 6 05:53:42 2017 New Revision: 317866 URL: https://svnweb.freebsd.org/changeset/base/317866 Log: [ip17x] [etherswitch] fdt away and mii hang workaround on ip17x Add workaround mii access because of rt1310 is hang up on etherswitch mii poll. And FDT away on arm platform. Tested: * wzr2-g300n Submitted by: Hiroki Mori Reviewed by: mizhka Differential Revision: https://reviews.freebsd.org/D10295 Modified: head/sys/dev/etherswitch/ip17x/ip17x.c head/sys/dev/etherswitch/ip17x/ip17x_var.h Modified: head/sys/dev/etherswitch/ip17x/ip17x.c ============================================================================== --- head/sys/dev/etherswitch/ip17x/ip17x.c Sat May 6 05:52:01 2017 (r317865) +++ head/sys/dev/etherswitch/ip17x/ip17x.c Sat May 6 05:53:42 2017 (r317866) @@ -28,6 +28,8 @@ * $FreeBSD$ */ +#include "opt_platform.h" + #include #include #include @@ -61,6 +63,12 @@ #include #include +#ifdef FDT +#include +#include +#include +#endif + #include "mdio_if.h" #include "miibus_if.h" #include "etherswitch_if.h" @@ -72,11 +80,28 @@ static void ip17x_tick(void *); static int ip17x_ifmedia_upd(struct ifnet *); static void ip17x_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static void +ip17x_identify(driver_t *driver, device_t parent) +{ + if (device_find_child(parent, "ip17x", -1) == NULL) + BUS_ADD_CHILD(parent, 0, "ip17x", -1); +} + static int ip17x_probe(device_t dev) { struct ip17x_softc *sc; uint32_t oui, model, phy_id1, phy_id2; +#ifdef FDT + phandle_t ip17x_node; + pcell_t cell; + + ip17x_node = fdt_find_compatible(OF_finddevice("/"), + "icplus,ip17x", 0); + + if (ip17x_node == 0) + return (ENXIO); +#endif sc = device_get_softc(dev); @@ -118,6 +143,15 @@ ip17x_probe(device_t dev) sc->sc_switchtype = IP17X_SWITCH_IP178C; } + sc->miipoll = 1; +#ifdef FDT + if ((OF_getencprop(ip17x_node, "mii-poll", + &cell, sizeof(cell))) > 0) + sc->miipoll = cell ? 1 : 0; +#else + (void) resource_int_value(device_get_name(dev), device_get_unit(dev), + "mii-poll", &sc->miipoll); +#endif device_set_desc_copy(dev, "IC+ IP17x switch driver"); return (BUS_PROBE_DEFAULT); } @@ -229,9 +263,11 @@ ip17x_attach(device_t dev) if (err != 0) return (err); - callout_init(&sc->callout_tick, 0); + if (sc->miipoll) { + callout_init(&sc->callout_tick, 0); - ip17x_tick(sc); + ip17x_tick(sc); + } return (0); } @@ -243,7 +279,8 @@ ip17x_detach(device_t dev) int i, port; sc = device_get_softc(dev); - callout_drain(&sc->callout_tick); + if (sc->miipoll) + callout_drain(&sc->callout_tick); for (i=0; i < MII_NPHY; i++) { if (((1 << i) & sc->phymask) == 0) @@ -564,6 +601,7 @@ ip17x_setconf(device_t dev, etherswitch_ static device_method_t ip17x_methods[] = { /* Device interface */ + DEVMETHOD(device_identify, ip17x_identify), DEVMETHOD(device_probe, ip17x_probe), DEVMETHOD(device_attach, ip17x_attach), DEVMETHOD(device_detach, ip17x_detach), @@ -604,8 +642,13 @@ static devclass_t ip17x_devclass; DRIVER_MODULE(ip17x, mdio, ip17x_driver, ip17x_devclass, 0, 0); DRIVER_MODULE(miibus, ip17x, miibus_driver, miibus_devclass, 0, 0); -DRIVER_MODULE(mdio, ip17x, mdio_driver, mdio_devclass, 0, 0); DRIVER_MODULE(etherswitch, ip17x, etherswitch_driver, etherswitch_devclass, 0, 0); MODULE_VERSION(ip17x, 1); + +#ifdef FDT +MODULE_DEPEND(ip17x, mdio, 1, 1, 1); /* XXX which versions? */ +#else +DRIVER_MODULE(mdio, ip17x, mdio_driver, mdio_devclass, 0, 0); MODULE_DEPEND(ip17x, miibus, 1, 1, 1); /* XXX which versions? */ MODULE_DEPEND(ip17x, etherswitch, 1, 1, 1); /* XXX which versions? */ +#endif Modified: head/sys/dev/etherswitch/ip17x/ip17x_var.h ============================================================================== --- head/sys/dev/etherswitch/ip17x/ip17x_var.h Sat May 6 05:52:01 2017 (r317865) +++ head/sys/dev/etherswitch/ip17x/ip17x_var.h Sat May 6 05:53:42 2017 (r317866) @@ -53,6 +53,7 @@ struct ip17x_softc { int numports; /* number of ports */ int *portphy; device_t **miibus; + int miipoll; etherswitch_info_t info; ip17x_switch_type sc_switchtype; struct callout callout_tick; From owner-svn-src-head@freebsd.org Sat May 6 05:50:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47B85D6102B; Sat, 6 May 2017 05:50:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01525B85; Sat, 6 May 2017 05:50:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v465o8qq072683; Sat, 6 May 2017 05:50:08 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v465o8rn072682; Sat, 6 May 2017 05:50:08 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705060550.v465o8rn072682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 6 May 2017 05:50:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317864 - head/sys/dev/etherswitch/infineon X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 05:50:09 -0000 Author: adrian Date: Sat May 6 05:50:07 2017 New Revision: 317864 URL: https://svnweb.freebsd.org/changeset/base/317864 Log: [infineon] [etherswitch] no hardcode tagging port setting at amd6996fc Tagging port can set by etherswitchcfg command. Tested: * on Netgear_WGR614Cv7 Submitted by: Hiroki Mori Reviewed by: mizhka Modified: head/sys/dev/etherswitch/infineon/adm6996fc.c Modified: head/sys/dev/etherswitch/infineon/adm6996fc.c ============================================================================== --- head/sys/dev/etherswitch/infineon/adm6996fc.c Sat May 6 05:37:36 2017 (r317863) +++ head/sys/dev/etherswitch/infineon/adm6996fc.c Sat May 6 05:50:07 2017 (r317864) @@ -35,6 +35,7 @@ * This code suppose ADM6996FC SDC/SDIO connect to SOC network interface * MDC/MDIO. * This code development on Netgear WGR614Cv7. + * etherswitchcfg command port option support addtag. */ #include @@ -462,8 +463,6 @@ adm6996fc_getport(device_t dev, etherswi p->es_pvid = ADM6996FC_PVIDBYDATA(data1, data2); if (((data1 >> ADM6996FC_OPTE_SHIFT) & 0x01) == 1) p->es_flags |= ETHERSWITCH_PORT_ADDTAG; - else - p->es_flags |= ETHERSWITCH_PORT_STRIPTAG; } else { p->es_pvid = 0; } @@ -517,6 +516,10 @@ adm6996fc_setport(device_t dev, etherswi data = ADM6996FC_READREG(parent, bcaddr[p->es_port]); data &= ~(0xf << 10); data |= (p->es_pvid & 0xf) << ADM6996FC_PVID_SHIFT; + if (p->es_flags & ETHERSWITCH_PORT_ADDTAG) + data |= 1 << ADM6996FC_OPTE_SHIFT; + else + data &= ~(1 << ADM6996FC_OPTE_SHIFT); ADM6996FC_WRITEREG(parent, bcaddr[p->es_port], data); data = ADM6996FC_READREG(parent, vidaddr[p->es_port]); /* only port 4 is hi bit */ @@ -670,9 +673,6 @@ adm6996fc_setconf(device_t dev, etherswi /* Private VID set 1 */ data &= ~(0xf << 10); data |= (1 << 10); - /* Output Packet Tagging Enable */ - if (i == 5) - data |= (1 << 4); ADM6996FC_WRITEREG(parent, bcaddr[i], data); } for (i = 2;i <= 15; ++i) { From owner-svn-src-head@freebsd.org Sat May 6 05:52:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1ABC2D612E3; Sat, 6 May 2017 05:52:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6D421161; Sat, 6 May 2017 05:52:02 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v465q1F6076543; Sat, 6 May 2017 05:52:01 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v465q1l7076541; Sat, 6 May 2017 05:52:01 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705060552.v465q1l7076541@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 6 May 2017 05:52:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317865 - head/sys/dev/cfi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 05:52:03 -0000 Author: adrian Date: Sat May 6 05:52:01 2017 New Revision: 317865 URL: https://svnweb.freebsd.org/changeset/base/317865 Log: [cfi] fix CFI flash reset command for MX29LV320T/B. MX flash MX29LV320T/B datasheet say reset is 0xf0. Submitted by: Hiroki Mori Approved by: mizhka Differential Revision: https://reviews.freebsd.org/D10177 Modified: head/sys/dev/cfi/cfi_core.c head/sys/dev/cfi/cfi_reg.h Modified: head/sys/dev/cfi/cfi_core.c ============================================================================== --- head/sys/dev/cfi/cfi_core.c Sat May 6 05:50:07 2017 (r317864) +++ head/sys/dev/cfi/cfi_core.c Sat May 6 05:52:01 2017 (r317865) @@ -145,6 +145,17 @@ cfi_write(struct cfi_softc *sc, u_int of } } +/* + * This is same workaound as NetBSD sys/dev/nor/cfi.c cfi_reset_default() + */ +static void +cfi_reset_default(struct cfi_softc *sc) +{ + + cfi_write(sc, 0, CFI_BCS_READ_ARRAY2); + cfi_write(sc, 0, CFI_BCS_READ_ARRAY); +} + uint8_t cfi_read_qry(struct cfi_softc *sc, u_int ofs) { @@ -152,7 +163,7 @@ cfi_read_qry(struct cfi_softc *sc, u_int cfi_write(sc, CFI_QRY_CMD_ADDR * sc->sc_width, CFI_QRY_CMD_DATA); val = cfi_read(sc, ofs * sc->sc_width); - cfi_write(sc, 0, CFI_BCS_READ_ARRAY); + cfi_reset_default(sc); return (val); } @@ -745,7 +756,7 @@ cfi_write_block(struct cfi_softc *sc) /* error is 0. */ out: - cfi_write(sc, 0, CFI_BCS_READ_ARRAY); + cfi_reset_default(sc); /* Relock Intel flash */ switch (sc->sc_cmdset) { Modified: head/sys/dev/cfi/cfi_reg.h ============================================================================== --- head/sys/dev/cfi/cfi_reg.h Sat May 6 05:50:07 2017 (r317864) +++ head/sys/dev/cfi/cfi_reg.h Sat May 6 05:52:01 2017 (r317865) @@ -113,6 +113,7 @@ struct cfi_qry { #define CFI_BCS_CONFIRM 0xd0 #define CFI_BCS_BUF_PROG_SETUP 0xe8 #define CFI_BCS_READ_ARRAY 0xff +#define CFI_BCS_READ_ARRAY2 0xf0 /* Intel commands. */ #define CFI_INTEL_LB 0x01 /* Lock Block */ From owner-svn-src-head@freebsd.org Sat May 6 06:01:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BDC3D61DFD; Sat, 6 May 2017 06:01:19 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65757CEE; Sat, 6 May 2017 06:01:19 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4661IXq078287; Sat, 6 May 2017 06:01:18 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4661Ht3078282; Sat, 6 May 2017 06:01:17 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705060601.v4661Ht3078282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 6 May 2017 06:01:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317867 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 06:01:19 -0000 Author: adrian Date: Sat May 6 06:01:17 2017 New Revision: 317867 URL: https://svnweb.freebsd.org/changeset/base/317867 Log: [etherswitch] add manpages for etherswitch supported devices. Submitted by: Hiroki Mori Reviewed by: mizhka Differential Revision: https://reviews.freebsd.org/D10278 Added: head/share/man/man4/adm6996fc.4 (contents, props changed) head/share/man/man4/e6060sw.4 (contents, props changed) head/share/man/man4/ksz8995ma.4 (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/etherswitch.4 Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sat May 6 05:53:42 2017 (r317866) +++ head/share/man/man4/Makefile Sat May 6 06:01:17 2017 (r317867) @@ -22,6 +22,7 @@ MAN= aac.4 \ acpi_video.4 \ ${_acpi_wmi.4} \ ada.4 \ + adm6996fc.4 \ adv.4 \ adw.4 \ ae.4 \ @@ -152,6 +153,7 @@ MAN= aac.4 \ etherswitch.4 \ eventtimers.4 \ exca.4 \ + e6060sw.4 \ fd.4 \ fdc.4 \ fdt.4 \ @@ -245,6 +247,7 @@ MAN= aac.4 \ keyboard.4 \ kld.4 \ ksyms.4 \ + ksz8995ma.4 \ ktr.4 \ kue.4 \ lagg.4 \ Added: head/share/man/man4/adm6996fc.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/adm6996fc.4 Sat May 6 06:01:17 2017 (r317867) @@ -0,0 +1,68 @@ +.\"- +.\" Copyright (c) 2017 Hiroki Mori +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 5, 2017 +.Dt ADM6996FC 4 +.Os +.Sh NAME +.Nm adm6996fc +.Nd driver for Infineon ADM6996FC fast ethernet switch chip +.Sh SYNOPSIS +.Cd "device mdio" +.Cd "device etherswitch" +.Cd "device adm6996fc" +.Pp +.Cd hint.adm6996fc.0.at="mdio0" +.Sh DESCRIPTION +The +.Nm +device driver provides a management interface to Infineon ADM6996FC fast ethernet switch chip. +This driver use smi interface by ethernet interface. +.Pp +This driver support is port and dot1q vlan. +dot1q support port base tag/untag. +.Sh EXAMPLES +Configure dot1q vlan by etherswitchcfg command. +.Pp +.Dl # etherswitchcfg config vlan_mode dot1q +.Pp +Configure port 5 is tagging port. +.Pp +.Dl # etherswitchcfg port5 addtag +.Sh SEE ALSO +.Xr etherswitch 4 , +.Xr etherswitchcfg 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Hiroki Mori Added: head/share/man/man4/e6060sw.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/e6060sw.4 Sat May 6 06:01:17 2017 (r317867) @@ -0,0 +1,70 @@ +.\"- +.\" Copyright (c) 2017 Hiroki Mori +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 5, 2017 +.Dt E6060SW 4 +.Os +.Sh NAME +.Nm e6060sw +.Nd driver for Marvell 88E6060 and 88E6065 fast ethernet switch chip +.Sh SYNOPSIS +.Cd "device mdio" +.Cd "device etherswitch" +.Cd "device e6060sw" +.Pp +.Cd hint.e6060sw.0.at="mdio0" +.Sh DESCRIPTION +The +.Nm +device driver provides a management interface to Marvell 88E6060 and 88E6065 fast ethernet switch chip. +This driver use smi interface by ethernet interface. +.Pp +88E6060 support is only port vlan. +88E6065 support is port and dot1q vlan. +dot1q support group base tag/untag. +.Sh EXAMPLES +Configure dot1q vlan on 88E6065 by etherswitchcfg command. +.Pp +.Dl # etherswitchcfg config vlan_mode dot1q +.Pp +Configure vlangroup with dot1q tag on 88E6065. +This example is port0 as vlan 2. +.Pp +.Dl # etherswitchcfg vlangroup2 vlan 2 members 0,5t port0 pvid 2 +.Sh SEE ALSO +.Xr etherswitch 4 , +.Xr etherswitchcfg 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Hiroki Mori Modified: head/share/man/man4/etherswitch.4 ============================================================================== --- head/share/man/man4/etherswitch.4 Sat May 6 05:53:42 2017 (r317866) +++ head/share/man/man4/etherswitch.4 Sat May 6 06:01:17 2017 (r317867) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 5, 2015 +.Dd April 5, 2017 .Dt ETHERSWITCH 4 .Os .Sh NAME @@ -54,6 +54,9 @@ device nodes .Xr iicbus 4 , .Xr ip17x 4 , .Xr rtl8366rb 4 , +.Xr e6060sw 4 , +.Xr adm6996fc 4 , +.Xr ksz8995ma 4 , .Xr ukswitch 4 , .Xr etherswitchcfg 8 .Sh HISTORY Added: head/share/man/man4/ksz8995ma.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ksz8995ma.4 Sat May 6 06:01:17 2017 (r317867) @@ -0,0 +1,69 @@ +.\"- +.\" Copyright (c) 2017 Hiroki Mori +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 6, 2017 +.Dt KSZ8995MA 4 +.Os +.Sh NAME +.Nm ksz8995ma +.Nd driver for Micrel KSZ8995MA fast ethernet switch chip +.Sh SYNOPSIS +.Cd "device spibus" +.Cd "device etherswitch" +.Cd "device ksz8995ma" +.Pp +.Cd hint.ksz8995ma.0.at="spibus0" +.Sh DESCRIPTION +The +.Nm +device driver provides a management interface to Micrel KSZ8995MA fast ethernet switch chip. +This driver use spi interface. +KSZ8995 series have many vertion but only support MA/FQ version. +.Pp +This driver support is port and dot1q vlan. +dot1q support port base tag/untag. +.Sh EXAMPLES +Configure dot1q vlan by etherswitchcfg command. +.Pp +.Dl # etherswitchcfg config vlan_mode dot1q +.Pp +Configure port 5 is tagging port. +.Pp +.Dl # etherswitchcfg port5 addtag +.Sh SEE ALSO +.Xr etherswitch 4 , +.Xr etherswitchcfg 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Hiroki Mori From owner-svn-src-head@freebsd.org Sat May 6 06:07:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB641D60814; Sat, 6 May 2017 06:07:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAD11120; Sat, 6 May 2017 06:07:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4667ilA082852; Sat, 6 May 2017 06:07:44 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4667ics082851; Sat, 6 May 2017 06:07:44 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705060607.v4667ics082851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 6 May 2017 06:07:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317869 - head/sys/dev/etherswitch/e6000sw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 06:07:46 -0000 Author: adrian Date: Sat May 6 06:07:44 2017 New Revision: 317869 URL: https://svnweb.freebsd.org/changeset/base/317869 Log: [etherswitch] [e6000sw] fix compile issue under clang/arm Submitted by: Hiroki Mori Approved by: mizhka Differential Revision: https://reviews.freebsd.org/D10563 Modified: head/sys/dev/etherswitch/e6000sw/e6060sw.c Modified: head/sys/dev/etherswitch/e6000sw/e6060sw.c ============================================================================== --- head/sys/dev/etherswitch/e6000sw/e6060sw.c Sat May 6 06:06:11 2017 (r317868) +++ head/sys/dev/etherswitch/e6000sw/e6060sw.c Sat May 6 06:07:44 2017 (r317869) @@ -169,6 +169,7 @@ e6060sw_probe(device_t dev) sc = device_get_softc(dev); bzero(sc, sizeof(*sc)); + devid = 0; for (i = 0; i < 2; ++i) { data = MDIO_READREG(device_get_parent(dev), CORE_REGISTER + i * 0x10, SWITCH_ID); @@ -184,8 +185,6 @@ e6060sw_probe(device_t dev) break; } } - if (i == 2) - return (ENXIO); if (devid == E6060) devname = "88E6060"; @@ -193,6 +192,9 @@ e6060sw_probe(device_t dev) devname = "88E6063"; else if (devid == E6065) devname = "88E6065"; + else + return (ENXIO); + sprintf(desc, "Marvell %s MDIO switch driver at 0x%02x", devname, sc->smi_offset); device_set_desc_copy(dev, desc); From owner-svn-src-head@freebsd.org Sat May 6 06:20:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0D82D6154C; Sat, 6 May 2017 06:20:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA8C3C2F; Sat, 6 May 2017 06:20:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v466KZwE087425; Sat, 6 May 2017 06:20:35 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v466KYBR087414; Sat, 6 May 2017 06:20:34 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705060620.v466KYBR087414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 6 May 2017 06:20:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317873 - in head/sys: conf dev/rt gnu/dts/mips mips/conf mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 06:20:37 -0000 Author: adrian Date: Sat May 6 06:20:34 2017 New Revision: 317873 URL: https://svnweb.freebsd.org/changeset/base/317873 Log: [mips] [rt2880] Add oldest Ralink MIPS SOC RT2880 support code. * Target module have ic plus etherswitch ip175c. * Also add etherswitch support code on rt driver. Reviewed by: mizhka Differential Revision: https://reviews.freebsd.org/D10336 Added: head/sys/gnu/dts/mips/MZK-W04N-XX.dts (contents, props changed) head/sys/mips/conf/RT2880_FDT (contents, props changed) head/sys/mips/mediatek/std.rt2880 (contents, props changed) Modified: head/sys/conf/options.mips head/sys/dev/rt/if_rt.c head/sys/dev/rt/if_rtreg.h head/sys/gnu/dts/mips/rt2880.dtsi head/sys/mips/mediatek/mtk_machdep.c head/sys/mips/mediatek/mtk_soc.c head/sys/mips/mediatek/mtk_soc.h Modified: head/sys/conf/options.mips ============================================================================== --- head/sys/conf/options.mips Sat May 6 06:14:46 2017 (r317872) +++ head/sys/conf/options.mips Sat May 6 06:20:34 2017 (r317873) @@ -152,6 +152,7 @@ RT3050F opt_rt305x.h RT305X opt_rt305x.h RT305X_UBOOT opt_rt305x.h RT305X_USE_UART opt_rt305x.h +RT_MDIO opt_rt305x.h # # Options that affect the pmap. Modified: head/sys/dev/rt/if_rt.c ============================================================================== --- head/sys/dev/rt/if_rt.c Sat May 6 06:14:46 2017 (r317872) +++ head/sys/dev/rt/if_rt.c Sat May 6 06:20:34 2017 (r317873) @@ -70,6 +70,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef RT_MDIO +#include +#include +#include "mdio_if.h" +#endif + #if 0 #include #include @@ -91,6 +97,7 @@ __FBSDID("$FreeBSD$"); #define RT_TX_WATCHDOG_TIMEOUT 5 +#define RT_CHIPID_RT2880 0x2880 #define RT_CHIPID_RT3050 0x3050 #define RT_CHIPID_RT5350 0x5350 #define RT_CHIPID_MT7620 0x7620 @@ -99,6 +106,7 @@ __FBSDID("$FreeBSD$"); #ifdef FDT /* more specific and new models should go first */ static const struct ofw_compat_data rt_compat_data[] = { + { "ralink,rt2880-eth", RT_CHIPID_RT2880 }, { "ralink,rt3050-eth", RT_CHIPID_RT3050 }, { "ralink,rt3352-eth", RT_CHIPID_RT3050 }, { "ralink,rt3883-eth", RT_CHIPID_RT3050 }, @@ -166,6 +174,8 @@ static void rt_dma_map_addr(void *arg, b static void rt_sysctl_attach(struct rt_softc *sc); #ifdef IF_RT_PHY_SUPPORT void rt_miibus_statchg(device_t); +#endif +#if defined(IF_RT_PHY_SUPPORT) || defined(RT_MDIO) static int rt_miibus_readreg(device_t, int, int); static int rt_miibus_writereg(device_t, int, int, int); #endif @@ -351,7 +361,7 @@ rt_attach(device_t dev) sc->mem_rid = 0; sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid, - RF_ACTIVE); + RF_ACTIVE | RF_SHAREABLE); if (sc->mem == NULL) { device_printf(dev, "could not allocate memory resource\n"); error = ENXIO; @@ -467,6 +477,9 @@ rt_attach(device_t dev) GDM_DST_PORT_CPU << GDM_OFRC_P_SHIFT /* fwd Other to CPU */ )); + if (sc->rt_chipid == RT_CHIPID_RT2880) + RT_WRITE(sc, MDIO_CFG, MDIO_2880_100T_INIT); + /* allocate Tx and Rx rings */ for (i = 0; i < RT_SOFTC_TX_RING_COUNT; i++) { error = rt_alloc_tx_ring(sc, &sc->tx_ring[i], i); @@ -2733,16 +2746,20 @@ rt_sysctl_attach(struct rt_softc *sc) "Tx collision count for GDMA ports"); } -#ifdef IF_RT_PHY_SUPPORT +#if defined(IF_RT_PHY_SUPPORT) || defined(RT_MDIO) +/* This code is only work RT2880 and same chip. */ +/* TODO: make RT3052 and later support code. But nobody need it? */ static int rt_miibus_readreg(device_t dev, int phy, int reg) { struct rt_softc *sc = device_get_softc(dev); + int dat; /* * PSEUDO_PHYAD is a special value for indicate switch attached. * No one PHY use PSEUDO_PHYAD (0x1e) address. */ +#ifndef RT_MDIO if (phy == 31) { /* Fake PHY ID for bfeswitch attach */ switch (reg) { @@ -2754,13 +2771,14 @@ rt_miibus_readreg(device_t dev, int phy, return (0x6250); /* bfeswitch */ } } +#endif /* Wait prev command done if any */ while (RT_READ(sc, MDIO_ACCESS) & MDIO_CMD_ONGO); - RT_WRITE(sc, MDIO_ACCESS, - MDIO_CMD_ONGO || - ((phy << MDIO_PHY_ADDR_SHIFT) & MDIO_PHY_ADDR_MASK) || - ((reg << MDIO_PHYREG_ADDR_SHIFT) & MDIO_PHYREG_ADDR_MASK)); + dat = ((phy << MDIO_PHY_ADDR_SHIFT) & MDIO_PHY_ADDR_MASK) | + ((reg << MDIO_PHYREG_ADDR_SHIFT) & MDIO_PHYREG_ADDR_MASK); + RT_WRITE(sc, MDIO_ACCESS, dat); + RT_WRITE(sc, MDIO_ACCESS, dat | MDIO_CMD_ONGO); while (RT_READ(sc, MDIO_ACCESS) & MDIO_CMD_ONGO); return (RT_READ(sc, MDIO_ACCESS) & MDIO_PHY_DATA_MASK); @@ -2770,19 +2788,23 @@ static int rt_miibus_writereg(device_t dev, int phy, int reg, int val) { struct rt_softc *sc = device_get_softc(dev); + int dat; /* Wait prev command done if any */ while (RT_READ(sc, MDIO_ACCESS) & MDIO_CMD_ONGO); - RT_WRITE(sc, MDIO_ACCESS, - MDIO_CMD_ONGO || MDIO_CMD_WR || - ((phy << MDIO_PHY_ADDR_SHIFT) & MDIO_PHY_ADDR_MASK) || - ((reg << MDIO_PHYREG_ADDR_SHIFT) & MDIO_PHYREG_ADDR_MASK) || - (val & MDIO_PHY_DATA_MASK)); + dat = MDIO_CMD_WR | + ((phy << MDIO_PHY_ADDR_SHIFT) & MDIO_PHY_ADDR_MASK) | + ((reg << MDIO_PHYREG_ADDR_SHIFT) & MDIO_PHYREG_ADDR_MASK) | + (val & MDIO_PHY_DATA_MASK); + RT_WRITE(sc, MDIO_ACCESS, dat); + RT_WRITE(sc, MDIO_ACCESS, dat | MDIO_CMD_ONGO); while (RT_READ(sc, MDIO_ACCESS) & MDIO_CMD_ONGO); return (0); } +#endif +#ifdef IF_RT_PHY_SUPPORT void rt_miibus_statchg(device_t dev) { @@ -2842,3 +2864,85 @@ DRIVER_MODULE(rt, simplebus, rt_driver, MODULE_DEPEND(rt, ether, 1, 1, 1); MODULE_DEPEND(rt, miibus, 1, 1, 1); +#ifdef RT_MDIO +MODULE_DEPEND(rt, mdio, 1, 1, 1); + +static int rtmdio_probe(device_t); +static int rtmdio_attach(device_t); +static int rtmdio_detach(device_t); + +static struct mtx miibus_mtx; + +MTX_SYSINIT(miibus_mtx, &miibus_mtx, "rt mii lock", MTX_DEF); + +/* + * Declare an additional, separate driver for accessing the MDIO bus. + */ +static device_method_t rtmdio_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, rtmdio_probe), + DEVMETHOD(device_attach, rtmdio_attach), + DEVMETHOD(device_detach, rtmdio_detach), + + /* bus interface */ + DEVMETHOD(bus_add_child, device_add_child_ordered), + + /* MDIO access */ + DEVMETHOD(mdio_readreg, rt_miibus_readreg), + DEVMETHOD(mdio_writereg, rt_miibus_writereg), +}; + +DEFINE_CLASS_0(rtmdio, rtmdio_driver, rtmdio_methods, + sizeof(struct rt_softc)); +static devclass_t rtmdio_devclass; + +DRIVER_MODULE(miiproxy, rt, miiproxy_driver, miiproxy_devclass, 0, 0); +DRIVER_MODULE(rtmdio, simplebus, rtmdio_driver, rtmdio_devclass, 0, 0); +DRIVER_MODULE(mdio, rtmdio, mdio_driver, mdio_devclass, 0, 0); + +static int +rtmdio_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "ralink,rt2880-mdio")) + return (ENXIO); + + device_set_desc(dev, "FV built-in ethernet interface, MDIO controller"); + return(0); +} + +static int +rtmdio_attach(device_t dev) +{ + struct rt_softc *sc; + int error; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->mem_rid = 0; + sc->mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->mem_rid, RF_ACTIVE | RF_SHAREABLE); + if (sc->mem == NULL) { + device_printf(dev, "couldn't map memory\n"); + error = ENXIO; + goto fail; + } + + sc->bst = rman_get_bustag(sc->mem); + sc->bsh = rman_get_bushandle(sc->mem); + + bus_generic_probe(dev); + bus_enumerate_hinted_children(dev); + error = bus_generic_attach(dev); +fail: + return(error); +} + +static int +rtmdio_detach(device_t dev) +{ + return(0); +} +#endif Modified: head/sys/dev/rt/if_rtreg.h ============================================================================== --- head/sys/dev/rt/if_rtreg.h Sat May 6 06:14:46 2017 (r317872) +++ head/sys/dev/rt/if_rtreg.h Sat May 6 06:20:34 2017 (r317873) @@ -48,6 +48,10 @@ #define MDIO_PHY_DATA_MASK 0x0000ffff #define MDIO_PHY_DATA_SHIFT 0 +#define MDIO_CFG 0x04 +#define MDIO_2880_100T_INIT 0x1001BC01 +#define MDIO_2880_GIGA_INIT 0x1F01DC01 + #define FE_GLO_CFG 0x08 /*Frame Engine Global Configuration */ #define EXT_VLAN_TYPE_MASK 0xffff0000 #define EXT_VLAN_TYPE_SHIFT 16 Added: head/sys/gnu/dts/mips/MZK-W04N-XX.dts ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/gnu/dts/mips/MZK-W04N-XX.dts Sat May 6 06:20:34 2017 (r317873) @@ -0,0 +1,94 @@ +/dts-v1/; + +#include "rt2880.dtsi" + +/ { + compatible = "MZK-WNH", "ralink,rt2880-soc"; + model = "Planex MZK-WNH"; + +/* + memory@0 { + device_type = "memory"; + reg = <0x0 0x2000000>; + }; +*/ + + cfi@1f000000 { + compatible = "cfi-flash"; + reg = <0x1f000000 0x800000>; + bank-width = <2>; + device-width = <2>; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Bootloader"; + reg = <0x0 0x30000>; + read-only; + }; + + devdata: partition@30000 { + label = "Config"; + reg = <0x00030000 0x00010000>; + read-only; + }; + + factory: partition@40000 { + label = "Factory"; + reg = <0x00040000 0x00010000>; + read-only; + }; + kernel: partition@50000 { + label = "kernel"; + reg = <0x00050000 0x000f0000>; + read-only; + }; + rootfs: partition@160000 { + label = "rootfs"; + reg = <0x00140000 0x002c0000>; + read-only; + }; + upgrade: partition@400000 { + label = "upgrade"; + reg = <0x00050000 0x003b0000>; + read-only; + }; + + }; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "status"; + gpios = <&gpio0 12 0>; + }; + + }; + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 10 1>; + linux,code = <0x198>; + }; + + }; + + ip17x@0 { + compatible = "icplus,ip17x"; + }; + +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; Modified: head/sys/gnu/dts/mips/rt2880.dtsi ============================================================================== --- head/sys/gnu/dts/mips/rt2880.dtsi Sat May 6 06:14:46 2017 (r317872) +++ head/sys/gnu/dts/mips/rt2880.dtsi Sat May 6 06:20:34 2017 (r317873) @@ -5,7 +5,7 @@ cpus { cpu@0 { - compatible = "mips,mips24KEc"; + compatible = "mips,mips4KEc"; }; }; @@ -80,6 +80,9 @@ ralink,register-map = [ 00 04 08 0c 20 24 28 2c 30 34 ]; + + interrupt-parent = <&intc>; + interrupts = <7>; }; gpio1: gpio@638 { @@ -182,13 +185,13 @@ compatible = "ralink,rt2880-port", "mediatek,eth-port"; reg = <0>; }; + }; - mdio-bus { - #address-cells = <1>; - #size-cells = <0>; - - status = "disabled"; - }; + mdio-bus { + compatible = "ralink,rt2880-mdio"; + reg = <0x00400000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; }; wmac: wmac@480000 { Added: head/sys/mips/conf/RT2880_FDT ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/conf/RT2880_FDT Sat May 6 06:20:34 2017 (r317873) @@ -0,0 +1,77 @@ +# +# RT2880_FDT -- Kernel configuration file for FreeBSD/MIPS RT2880 SoC +# +# This includes all the configurable parts of the kernel. +# +# $FreeBSD$ +# + +#NO_UNIVERSE + +# +# FDT_DTS_FILE should be modified to suit the target board type. +# +#makeoptions FDT_DTS_FILE=MZK-W04N-XX.dts + +# Start with a base configuration +include "../mediatek/std.rt2880" + +ident RT2880 +cpu CPU_MIPS4KC + +# Don't build any modules by default +makeoptions MODULES_OVERRIDE="" + +# Default rootfs device configuration, should be changed to suit target board +options ROOTDEVNAME=\""ufs:md0.uzip\" + +# Support geom_uzip(4) compressed disk images +device geom_map +options GEOM_UZIP + +# Support md(4) and md-based rootfs +device md +options MD_ROOT + +# Interrupt controller support +device mtk_intr_v1 + +# UART device support +nodevice uart_ns8250 +device uart_dev_mtk + +# SPI and SPI flash support +device mtk_spi_v1 +device spibus +device mx25l + +# CFI support +device cfi +device cfid + +# GPIO and gpioled support +device mtk_gpio_v1 +device gpio +device gpioled + +# USB (dwcotg) support +device usb +device mtk_usb_phy +device dwcotg + +# USB umass(4) storage and da(4) support +device umass +device da + +# CAM support, required if umass(4) is enabled above +device pass +device scbus + +# Ethernet, BPF and bridge support +device rt +device bpf +device if_bridge + +# Extres +options EXT_RESOURCES +device clk Modified: head/sys/mips/mediatek/mtk_machdep.c ============================================================================== --- head/sys/mips/mediatek/mtk_machdep.c Sat May 6 06:14:46 2017 (r317872) +++ head/sys/mips/mediatek/mtk_machdep.c Sat May 6 06:20:34 2017 (r317873) @@ -146,7 +146,11 @@ mips_init(void) ctob(physmem) / (1024 * 1024)); } - if (ctob(physmem) < (448 * 1024 * 1024)) { + if (mtk_soc_get_socid() == MTK_SOC_RT2880) { + /* RT2880 memory start is 88000000 */ + dump_avail[1] = phys_avail[1] = ctob(physmem) + + 0x08000000; + } else if (ctob(physmem) < (448 * 1024 * 1024)) { /* * Anything up to 448MB is assumed to be directly * mappable as low memory... Modified: head/sys/mips/mediatek/mtk_soc.c ============================================================================== --- head/sys/mips/mediatek/mtk_soc.c Sat May 6 06:14:46 2017 (r317872) +++ head/sys/mips/mediatek/mtk_soc.c Sat May 6 06:20:34 2017 (r317873) @@ -53,6 +53,7 @@ static uint32_t mtk_soc_cpuclk = MTK_CPU static uint32_t mtk_soc_timerclk = MTK_CPU_CLK_880MHZ / 2; static const struct ofw_compat_data compat_data[] = { + { "ralink,rt2880-soc", MTK_SOC_RT2880 }, { "ralink,rt3050-soc", MTK_SOC_RT3050 }, { "ralink,rt3052-soc", MTK_SOC_RT3052 }, { "ralink,rt3350-soc", MTK_SOC_RT3350 }, @@ -77,6 +78,30 @@ static const struct ofw_compat_data comp }; static uint32_t +mtk_detect_cpuclk_rt2880(bus_space_tag_t bst, bus_space_handle_t bsh) +{ + uint32_t val; + + val = bus_space_read_4(bst, bsh, SYSCTL_SYSCFG); + val >>= RT2880_CPU_CLKSEL_OFF; + val &= RT2880_CPU_CLKSEL_MSK; + + switch (val) { + case 0: + return (MTK_CPU_CLK_250MHZ); + case 1: + return (MTK_CPU_CLK_266MHZ); + case 2: + return (MTK_CPU_CLK_280MHZ); + case 3: + return (MTK_CPU_CLK_300MHZ); + } + + /* Never reached */ + return (0); +} + +static uint32_t mtk_detect_cpuclk_rt305x(bus_space_tag_t bst, bus_space_handle_t bsh) { uint32_t val; @@ -260,7 +285,9 @@ mtk_soc_try_early_detect(void) } bst = fdtbus_bs_tag; - if (mtk_soc_socid == MTK_SOC_MT7621) + if (mtk_soc_socid == MTK_SOC_RT2880) + base = MTK_RT2880_BASE; + else if (mtk_soc_socid == MTK_SOC_MT7621) base = MTK_MT7621_BASE; else base = MTK_DEFAULT_BASE; @@ -270,6 +297,9 @@ mtk_soc_try_early_detect(void) /* First, figure out the CPU clock */ switch (mtk_soc_socid) { + case MTK_SOC_RT2880: + mtk_soc_cpuclk = mtk_detect_cpuclk_rt2880(bst, bsh); + break; case MTK_SOC_RT3050: /* fallthrough */ case MTK_SOC_RT3052: case MTK_SOC_RT3350: @@ -327,6 +357,9 @@ mtk_soc_try_early_detect(void) } switch (mtk_soc_socid) { + case MTK_SOC_RT2880: + mtk_soc_uartclk = mtk_soc_cpuclk / MTK_UARTDIV_2; + break; case MTK_SOC_RT3350: /* fallthrough */ case MTK_SOC_RT3050: /* fallthrough */ case MTK_SOC_RT3052: Modified: head/sys/mips/mediatek/mtk_soc.h ============================================================================== --- head/sys/mips/mediatek/mtk_soc.h Sat May 6 06:14:46 2017 (r317872) +++ head/sys/mips/mediatek/mtk_soc.h Sat May 6 06:20:34 2017 (r317873) @@ -32,6 +32,7 @@ enum mtk_soc_id { MTK_SOC_UNKNOWN, + MTK_SOC_RT2880, MTK_SOC_RT3050, MTK_SOC_RT3052, MTK_SOC_RT3350, @@ -47,6 +48,8 @@ enum mtk_soc_id { MTK_SOC_MAX }; +#define RT2880_CPU_CLKSEL_OFF 20 +#define RT2880_CPU_CLKSEL_MSK 0x3 #define RT305X_CPU_CLKSEL_OFF 18 #define RT305X_CPU_CLKSEL_MSK 0x1 #define RT3352_CPU_CLKSEL_OFF 8 @@ -91,7 +94,10 @@ enum mtk_soc_id { #define MTK_MHZ(x) ((x) * 1000 * 1000) #define MTK_CPU_CLK_UNKNOWN 0 +#define MTK_CPU_CLK_233MHZ 233333333 #define MTK_CPU_CLK_250MHZ 250000000 +#define MTK_CPU_CLK_266MHZ 266666666 +#define MTK_CPU_CLK_280MHZ 280000000 #define MTK_CPU_CLK_300MHZ 300000000 #define MTK_CPU_CLK_320MHZ 320000000 #define MTK_CPU_CLK_360MHZ 360000000 @@ -111,6 +117,7 @@ enum mtk_soc_id { #define MTK_UARTDIV_3 3 #define MTK_DEFAULT_BASE 0x10000000 +#define MTK_RT2880_BASE 0x00300000 #define MTK_MT7621_BASE 0x1e000000 #define MTK_DEFAULT_SIZE 0x6000 Added: head/sys/mips/mediatek/std.rt2880 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mediatek/std.rt2880 Sat May 6 06:20:34 2017 (r317873) @@ -0,0 +1,89 @@ +# +# std.rt2880 -- Base kernel configuration file for FreeBSD/MIPS RT2800 SoC +# +# This includes all the required drivers for the SoCs. +# +# $FreeBSD$ +# + +# Include the standard file list for Mediatek SoCs. +files "../mediatek/files.mediatek" + +# Building a mips/mipsel kernel +machine mips mipsel + +# Little-endian machine +makeoptions MIPS_LITTLE_ENDIAN=defined + +# Default kernel load address +makeoptions KERNLOADADDR=0x88001000 + +# Mediatek/Ralink SoC support depends on FDT (with static DTB for the moment) +options FDT +options FDT_DTB_STATIC + +# We rely on INTRNG code +options INTRNG +options MIPS_NIRQ=256 + +# We rely on NEW_PCIB code +options NEW_PCIB + +# Build kernel with gdb(1) debug symbols +makeoptions DEBUG=-g + +# Support for DDB and KDB +options DDB +options KDB + +# Debugging for use in -current +options INVARIANTS +options INVARIANT_SUPPORT +options WITNESS +options WITNESS_SKIPSPIN +options DEBUG_REDZONE +options DEBUG_MEMGUARD + +# For small memory footprints +options VM_KMEM_SIZE_SCALE=1 + +# General options, including scheduler, etc. +options SCHED_ULE # ULE scheduler +options INET # InterNETworking +#options INET6 # IPv6 +options PSEUDOFS # Pseude-filesystem framework +options FFS # Berkeley Fast Filesystem +#options SOFTUPDATES # Enable FFS soft updates support +#options UFS_ACL # Support for access control lists +#options UFS_DIRHASH # Improve big directory performance +#options MSDOSFS # Enable support for MSDOS filesystems +options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time ext. + +# +# Standard drivers section +# +# The drivers in the following section are required in order to successfully +# compile the kernel. +# + +# FDT clock and pinctrl framework +device fdt_clock +device fdt_pinctrl + +# UART support +device uart + +# random support +device random + +# loop device support +device loop + +# ether device support +device ether + +# ether switch support +#device etherswitch +#device miibus +#device ip17x +#device mdio From owner-svn-src-head@freebsd.org Sat May 6 06:14:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C061DD61005; Sat, 6 May 2017 06:14:47 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 918021A25; Sat, 6 May 2017 06:14:47 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v466Ek8R087122; Sat, 6 May 2017 06:14:46 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v466Ekn4087118; Sat, 6 May 2017 06:14:46 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705060614.v466Ekn4087118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 6 May 2017 06:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317872 - in head/sys: arm/conf arm/ralink boot/fdt/dts/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 06:14:47 -0000 Author: adrian Date: Sat May 6 06:14:46 2017 New Revision: 317872 URL: https://svnweb.freebsd.org/changeset/base/317872 Log: [arm] [rt1310] add initial RT1310 SoC code. This code base on lpc code. Ralink RT1310 is oem from 5V Technologies. RT1310 is ARM926EJS(arm5t). Tested: * Buffalo WZR2-G300N Submitted by: Hiroki Mori Reviewed by: mizhka Differential Revision: https://reviews.freebsd.org/D7238 Added: head/sys/arm/conf/RT1310 (contents, props changed) head/sys/arm/ralink/ head/sys/arm/ralink/files.ralink (contents, props changed) head/sys/arm/ralink/if_fv.c (contents, props changed) head/sys/arm/ralink/if_fvreg.h (contents, props changed) head/sys/arm/ralink/rt1310_gpio.c (contents, props changed) head/sys/arm/ralink/rt1310_intc.c (contents, props changed) head/sys/arm/ralink/rt1310_machdep.c (contents, props changed) head/sys/arm/ralink/rt1310_timer.c (contents, props changed) head/sys/arm/ralink/rt1310reg.h (contents, props changed) head/sys/arm/ralink/rt1310var.h (contents, props changed) head/sys/boot/fdt/dts/arm/rt1310a.dtsi (contents, props changed) head/sys/boot/fdt/dts/arm/wzr2-g300n.dts (contents, props changed) Added: head/sys/arm/conf/RT1310 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/RT1310 Sat May 6 06:14:46 2017 (r317872) @@ -0,0 +1,80 @@ +# +# Custom kernel for RT1310 boards. +# +# $FreeBSD$ +# + +ident RT1310 +include "std.arm" +hints "RT1310.hints" + +# Flattened Device Tree +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=wzr2-g300n.dts + +makeoptions MODULES_OVERRIDE="" + +#makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +makeoptions WERROR="-Werror" + +options SCHED_4BSD # 4BSD scheduler +options INET # InterNETworking +options FFS # Berkeley Fast Filesystem +options TMPFS # Efficient memory filesystem +options MSDOSFS + +options ROOTDEVNAME=\"cd9660:/dev/cfid0s.rootfs.uzip\" + +options SYSVSHM # SYSV-style shared memory +options SYSVMSG # SYSV-style message queues +options SYSVSEM # SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions +options MUTEX_NOINLINE +options RWLOCK_NOINLINE +options NO_FFS_SNAPSHOT +options NO_SWAPPING + +# Debugging +options ALT_BREAK_TO_DEBUGGER +options DDB +#options DEADLKRES # Enable the deadlock resolver +#options DIAGNOSTIC +#options INVARIANTS # Enable calls of extra sanity checking +#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +options KDB +options WITNESS # Enable checks to detect deadlocks and cycles +options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed +#options WITNESS_KDB + +# Pseudo devices +device loop +device md +device pty +device random + +# Serial ports +device uart +device uart_ns8250 + +# Flash +device cfi +device cfid + +# Networking +device ether +device mii +device bpf +device fv + +# etherswitch +device mdio +device etherswitch +device miiproxy +device ip17x + +# GPIO +device gpio +device gpioled +device rt1310gpio + Added: head/sys/arm/ralink/files.ralink ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/ralink/files.ralink Sat May 6 06:14:46 2017 (r317872) @@ -0,0 +1,9 @@ +# $FreeBSD$ +arm/ralink/rt1310_machdep.c standard +arm/ralink/rt1310_intc.c standard +arm/ralink/rt1310_gpio.c optional rt1310gpio +arm/ralink/rt1310_timer.c standard +arm/ralink/if_fv.c optional fv + +kern/kern_clocksource.c standard + Added: head/sys/arm/ralink/if_fv.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/ralink/if_fv.c Sat May 6 06:14:46 2017 (r317872) @@ -0,0 +1,1873 @@ +/*- + * Copyright (c) 2016 Hiroki Mori. All rights reserved. + * Copyright (C) 2007 + * Oleksandr Tymoshenko . All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWFV IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE FV DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWFV, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * $Id: $ + * + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * FV Ethernet interface driver + * copy from mips/idt/if_kr.c and netbsd code + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +/* Todo: move to options.arm */ +/*#define FV_MDIO*/ + +#ifdef FV_MDIO +#include +#include +#include "mdio_if.h" +#endif + +MODULE_DEPEND(are, ether, 1, 1, 1); +MODULE_DEPEND(are, miibus, 1, 1, 1); +#ifdef FV_MDIO +MODULE_DEPEND(are, mdio, 1, 1, 1); +#endif + +#include "miibus_if.h" + +#include + +#ifdef FV_DEBUG +void dump_txdesc(struct fv_softc *, int); +void dump_status_reg(struct fv_softc *); +#endif + +static int fv_attach(device_t); +static int fv_detach(device_t); +static int fv_ifmedia_upd(struct ifnet *); +static void fv_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static int fv_ioctl(struct ifnet *, u_long, caddr_t); +static void fv_init(void *); +static void fv_init_locked(struct fv_softc *); +static void fv_link_task(void *, int); +static int fv_miibus_readreg(device_t, int, int); +static void fv_miibus_statchg(device_t); +static int fv_miibus_writereg(device_t, int, int, int); +static int fv_probe(device_t); +static void fv_reset(struct fv_softc *); +static int fv_resume(device_t); +static int fv_rx_ring_init(struct fv_softc *); +static int fv_tx_ring_init(struct fv_softc *); +static int fv_shutdown(device_t); +static void fv_start(struct ifnet *); +static void fv_start_locked(struct ifnet *); +static void fv_stop(struct fv_softc *); +static int fv_suspend(device_t); + +static void fv_rx(struct fv_softc *); +static void fv_tx(struct fv_softc *); +static void fv_intr(void *); +static void fv_tick(void *); + +static void fv_dmamap_cb(void *, bus_dma_segment_t *, int, int); +static int fv_dma_alloc(struct fv_softc *); +static void fv_dma_free(struct fv_softc *); +static int fv_newbuf(struct fv_softc *, int); +static __inline void fv_fixup_rx(struct mbuf *); + +static void fv_hinted_child(device_t bus, const char *dname, int dunit); + +static void fv_setfilt(struct fv_softc *sc); + +static device_method_t fv_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, fv_probe), + DEVMETHOD(device_attach, fv_attach), + DEVMETHOD(device_detach, fv_detach), + DEVMETHOD(device_suspend, fv_suspend), + DEVMETHOD(device_resume, fv_resume), + DEVMETHOD(device_shutdown, fv_shutdown), + + /* MII interface */ + DEVMETHOD(miibus_readreg, fv_miibus_readreg), + DEVMETHOD(miibus_writereg, fv_miibus_writereg), +#if !defined(FV_MDIO) + DEVMETHOD(miibus_statchg, fv_miibus_statchg), +#endif + + /* bus interface */ + DEVMETHOD(bus_add_child, device_add_child_ordered), + DEVMETHOD(bus_hinted_child, fv_hinted_child), + + DEVMETHOD_END +}; + +static driver_t fv_driver = { + "fv", + fv_methods, + sizeof(struct fv_softc) +}; + +static devclass_t fv_devclass; + +DRIVER_MODULE(fv, simplebus, fv_driver, fv_devclass, 0, 0); +#ifdef MII +DRIVER_MODULE(miibus, fv, miibus_driver, miibus_devclass, 0, 0); +#endif + +static struct mtx miibus_mtx; +MTX_SYSINIT(miibus_mtx, &miibus_mtx, "are mii lock", MTX_DEF); + +#ifdef FV_MDIO +static int fvmdio_probe(device_t); +static int fvmdio_attach(device_t); +static int fvmdio_detach(device_t); + +/* + * Declare an additional, separate driver for accessing the MDIO bus. + */ +static device_method_t fvmdio_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, fvmdio_probe), + DEVMETHOD(device_attach, fvmdio_attach), + DEVMETHOD(device_detach, fvmdio_detach), + + /* bus interface */ + DEVMETHOD(bus_add_child, device_add_child_ordered), + + /* MDIO access */ + DEVMETHOD(mdio_readreg, fv_miibus_readreg), + DEVMETHOD(mdio_writereg, fv_miibus_writereg), +}; + +DEFINE_CLASS_0(fvmdio, fvmdio_driver, fvmdio_methods, + sizeof(struct fv_softc)); +static devclass_t fvmdio_devclass; + +DRIVER_MODULE(miiproxy, fv, miiproxy_driver, miiproxy_devclass, 0, 0); +DRIVER_MODULE(fvmdio, simplebus, fvmdio_driver, fvmdio_devclass, 0, 0); +DRIVER_MODULE(mdio, fvmdio, mdio_driver, mdio_devclass, 0, 0); +#endif + +/* setup frame code refer dc code */ + +static void +fv_setfilt(struct fv_softc *sc) +{ + uint16_t eaddr[(ETHER_ADDR_LEN+1)/2]; + struct fv_desc *sframe; + int i; + struct ifnet *ifp; + struct ifmultiaddr *ifma; + uint16_t *sp; + uint8_t *ma; + + ifp = sc->fv_ifp; + + i = sc->fv_cdata.fv_tx_prod; + FV_INC(sc->fv_cdata.fv_tx_prod, FV_TX_RING_CNT); + sc->fv_cdata.fv_tx_cnt++; + sframe = &sc->fv_rdata.fv_tx_ring[i]; + sp = (uint16_t *)sc->fv_cdata.fv_sf_buff; + memset(sp, 0xff, FV_SFRAME_LEN); + + sframe->fv_addr = sc->fv_rdata.fv_sf_paddr; + sframe->fv_devcs = ADCTL_Tx_SETUP | FV_DMASIZE(FV_SFRAME_LEN); + + i = 0; + if_maddr_rlock(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); + sp[i] = sp[i+1] = (ma[1] << 8 | ma[0]); + i += 2; + sp[i] = sp[i+1] = (ma[3] << 8 | ma[2]); + i += 2; + sp[i] = sp[i+1] = (ma[5] << 8 | ma[4]); + i += 2; + } + if_maddr_runlock(ifp); + + bcopy(IF_LLADDR(sc->fv_ifp), eaddr, ETHER_ADDR_LEN); + sp[90] = sp[91] = eaddr[0]; + sp[92] = sp[93] = eaddr[1]; + sp[94] = sp[95] = eaddr[2]; + + sframe->fv_stat = ADSTAT_OWN; + bus_dmamap_sync(sc->fv_cdata.fv_tx_ring_tag, + sc->fv_cdata.fv_tx_ring_map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->fv_cdata.fv_sf_tag, + sc->fv_cdata.fv_sf_buff_map, BUS_DMASYNC_PREWRITE); + CSR_WRITE_4(sc, CSR_TXPOLL, 0xFFFFFFFF); + DELAY(10000); +} + +static int +fv_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "fv,ethernet")) + return (ENXIO); + + device_set_desc(dev, "FV Ethernet interface"); + return (BUS_PROBE_DEFAULT); +} + +static int +fv_attach(device_t dev) +{ + struct ifnet *ifp; + struct fv_softc *sc; + int error = 0, rid; + int unit; + int i; + + sc = device_get_softc(dev); + unit = device_get_unit(dev); + sc->fv_dev = dev; + sc->fv_ofw = ofw_bus_get_node(dev); + + i = OF_getprop(sc->fv_ofw, "local-mac-address", (void *)&sc->fv_eaddr, 6); + if (i != 6) { + /* hardcode macaddress */ + sc->fv_eaddr[0] = 0x00; + sc->fv_eaddr[1] = 0x0C; + sc->fv_eaddr[2] = 0x42; + sc->fv_eaddr[3] = 0x09; + sc->fv_eaddr[4] = 0x5E; + sc->fv_eaddr[5] = 0x6B; + } + + mtx_init(&sc->fv_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + callout_init_mtx(&sc->fv_stat_callout, &sc->fv_mtx, 0); + TASK_INIT(&sc->fv_link_task, 0, fv_link_task, sc); + + /* Map control/status registers. */ + sc->fv_rid = 0; + sc->fv_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->fv_rid, + RF_ACTIVE | RF_SHAREABLE); + + if (sc->fv_res == NULL) { + device_printf(dev, "couldn't map memory\n"); + error = ENXIO; + goto fail; + } + + sc->fv_btag = rman_get_bustag(sc->fv_res); + sc->fv_bhandle = rman_get_bushandle(sc->fv_res); + + /* Allocate interrupts */ + rid = 0; + sc->fv_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + + if (sc->fv_irq == NULL) { + device_printf(dev, "couldn't map interrupt\n"); + error = ENXIO; + goto fail; + } + + /* Allocate ifnet structure. */ + ifp = sc->fv_ifp = if_alloc(IFT_ETHER); + + if (ifp == NULL) { + device_printf(dev, "couldn't allocate ifnet structure\n"); + error = ENOSPC; + goto fail; + } + ifp->if_softc = sc; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = fv_ioctl; + ifp->if_start = fv_start; + ifp->if_init = fv_init; + + /* ifqmaxlen is sysctl value in net/if.c */ + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + ifp->if_capenable = ifp->if_capabilities; + + if (fv_dma_alloc(sc) != 0) { + error = ENXIO; + goto fail; + } + + /* TODO: calculate prescale */ +/* + CSR_WRITE_4(sc, FV_ETHMCP, (165000000 / (1250000 + 1)) & ~1); + + CSR_WRITE_4(sc, FV_MIIMCFG, FV_MIIMCFG_R); + DELAY(1000); + CSR_WRITE_4(sc, FV_MIIMCFG, 0); +*/ + CSR_WRITE_4(sc, CSR_BUSMODE, BUSMODE_SWR); + DELAY(1000); + +#ifdef FV_MDIO + sc->fv_miiproxy = mii_attach_proxy(sc->fv_dev); +#endif + +#ifdef MII + /* Do MII setup. */ + error = mii_attach(dev, &sc->fv_miibus, ifp, fv_ifmedia_upd, + fv_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); + goto fail; + } +#else + ifmedia_init(&sc->fv_ifmedia, 0, fv_ifmedia_upd, fv_ifmedia_sts); + + ifmedia_add(&sc->fv_ifmedia, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->fv_ifmedia, IFM_ETHER | IFM_AUTO); +#endif + + /* Call MI attach routine. */ + ether_ifattach(ifp, sc->fv_eaddr); + + /* Hook interrupt last to avoid having to lock softc */ + error = bus_setup_intr(dev, sc->fv_irq, INTR_TYPE_NET | INTR_MPSAFE, + NULL, fv_intr, sc, &sc->fv_intrhand); + + if (error) { + device_printf(dev, "couldn't set up irq\n"); + ether_ifdetach(ifp); + goto fail; + } + +fail: + if (error) + fv_detach(dev); + + return (error); +} + +static int +fv_detach(device_t dev) +{ + struct fv_softc *sc = device_get_softc(dev); + struct ifnet *ifp = sc->fv_ifp; + + KASSERT(mtx_initialized(&sc->fv_mtx), ("vr mutex not initialized")); + + /* These should only be active if attach succeeded */ + if (device_is_attached(dev)) { + FV_LOCK(sc); + sc->fv_detach = 1; + fv_stop(sc); + FV_UNLOCK(sc); + taskqueue_drain(taskqueue_swi, &sc->fv_link_task); + ether_ifdetach(ifp); + } +#ifdef MII + if (sc->fv_miibus) + device_delete_child(dev, sc->fv_miibus); +#endif + bus_generic_detach(dev); + + if (sc->fv_intrhand) + bus_teardown_intr(dev, sc->fv_irq, sc->fv_intrhand); + if (sc->fv_irq) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->fv_irq); + + if (sc->fv_res) + bus_release_resource(dev, SYS_RES_MEMORY, sc->fv_rid, + sc->fv_res); + + if (ifp) + if_free(ifp); + + fv_dma_free(sc); + + mtx_destroy(&sc->fv_mtx); + + return (0); + +} + +static int +fv_suspend(device_t dev) +{ + + panic("%s", __func__); + return 0; +} + +static int +fv_resume(device_t dev) +{ + + panic("%s", __func__); + return 0; +} + +static int +fv_shutdown(device_t dev) +{ + struct fv_softc *sc; + + sc = device_get_softc(dev); + + FV_LOCK(sc); + fv_stop(sc); + FV_UNLOCK(sc); + + return (0); +} + +static int +fv_miibus_readbits(struct fv_softc *sc, int count) +{ + int result; + + result = 0; + while(count--) { + result <<= 1; + CSR_WRITE_4(sc, CSR_MIIMNG, MII_RD); + DELAY(10); + CSR_WRITE_4(sc, CSR_MIIMNG, MII_RD | MII_CLK); + DELAY(10); + if (CSR_READ_4(sc, CSR_MIIMNG) & MII_DIN) + result |= 1; + } + + return (result); +} + +static int +fv_miibus_writebits(struct fv_softc *sc, int data, int count) +{ + int bit; + + while(count--) { + bit = ((data) >> count) & 0x1 ? MII_DOUT : 0; + CSR_WRITE_4(sc, CSR_MIIMNG, bit | MII_WR); + DELAY(10); + CSR_WRITE_4(sc, CSR_MIIMNG, bit | MII_WR | MII_CLK); + DELAY(10); + } + + return (0); +} + +static void +fv_miibus_turnaround(struct fv_softc *sc, int cmd) +{ + if (cmd == MII_WRCMD) { + fv_miibus_writebits(sc, 0x02, 2); + } else { + fv_miibus_readbits(sc, 1); + } +} + +static int +fv_miibus_readreg(device_t dev, int phy, int reg) +{ + struct fv_softc * sc = device_get_softc(dev); + int result; + + mtx_lock(&miibus_mtx); + fv_miibus_writebits(sc, MII_PREAMBLE, 32); + fv_miibus_writebits(sc, MII_RDCMD, 4); + fv_miibus_writebits(sc, phy, 5); + fv_miibus_writebits(sc, reg, 5); + fv_miibus_turnaround(sc, MII_RDCMD); + result = fv_miibus_readbits(sc, 16); + fv_miibus_turnaround(sc, MII_RDCMD); + mtx_unlock(&miibus_mtx); + + return (result); +} + +static int +fv_miibus_writereg(device_t dev, int phy, int reg, int data) +{ + struct fv_softc * sc = device_get_softc(dev); + + mtx_lock(&miibus_mtx); + fv_miibus_writebits(sc, MII_PREAMBLE, 32); + fv_miibus_writebits(sc, MII_WRCMD, 4); + fv_miibus_writebits(sc, phy, 5); + fv_miibus_writebits(sc, reg, 5); + fv_miibus_turnaround(sc, MII_WRCMD); + fv_miibus_writebits(sc, data, 16); + mtx_unlock(&miibus_mtx); + + return (0); +} + +#if !defined(FV_MDIO) +static void +fv_miibus_statchg(device_t dev) +{ + struct fv_softc *sc; + + sc = device_get_softc(dev); + taskqueue_enqueue(taskqueue_swi, &sc->fv_link_task); +} +#endif + +static void +fv_link_task(void *arg, int pending) +{ +#ifdef MII + struct fv_softc *sc; + struct mii_data *mii; + struct ifnet *ifp; + /* int lfdx, mfdx; */ + + sc = (struct fv_softc *)arg; + + FV_LOCK(sc); + mii = device_get_softc(sc->fv_miibus); + ifp = sc->fv_ifp; + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + FV_UNLOCK(sc); + return; + } + + if (mii->mii_media_status & IFM_ACTIVE) { + if (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) + sc->fv_link_status = 1; + } else + sc->fv_link_status = 0; + + FV_UNLOCK(sc); +#endif +} + +static void +fv_reset(struct fv_softc *sc) +{ + int i; + + CSR_WRITE_4(sc, CSR_BUSMODE, BUSMODE_SWR); + + /* + * The chip doesn't take itself out of reset automatically. + * We need to do so after 2us. + */ + DELAY(1000); + CSR_WRITE_4(sc, CSR_BUSMODE, 0); + + for (i = 0; i < 1000; i++) { + /* + * Wait a bit for the reset to complete before peeking + * at the chip again. + */ + DELAY(1000); + if ((CSR_READ_4(sc, CSR_BUSMODE) & BUSMODE_SWR) == 0) + break; + } + + if (CSR_READ_4(sc, CSR_BUSMODE) & BUSMODE_SWR) + device_printf(sc->fv_dev, "reset time out\n"); + + DELAY(1000); +} + +static void +fv_init(void *xsc) +{ + struct fv_softc *sc = xsc; + + FV_LOCK(sc); + fv_init_locked(sc); + FV_UNLOCK(sc); +} + +static void +fv_init_locked(struct fv_softc *sc) +{ + struct ifnet *ifp = sc->fv_ifp; +#ifdef MII + struct mii_data *mii; +#endif + + FV_LOCK_ASSERT(sc); + +#ifdef MII + mii = device_get_softc(sc->fv_miibus); +#endif + + fv_stop(sc); + fv_reset(sc); + + /* Init circular RX list. */ + if (fv_rx_ring_init(sc) != 0) { + device_printf(sc->fv_dev, + "initialization failed: no memory for rx buffers\n"); + fv_stop(sc); + return; + } + + /* Init tx descriptors. */ + fv_tx_ring_init(sc); + + /* + * Initialize the BUSMODE register. + */ + CSR_WRITE_4(sc, CSR_BUSMODE, + /* XXX: not sure if this is a good thing or not... */ + BUSMODE_BAR | BUSMODE_PBL_32LW); + + /* + * Initialize the interrupt mask and enable interrupts. + */ + /* normal interrupts */ + sc->sc_inten = STATUS_TI | STATUS_TU | STATUS_RI | STATUS_NIS; + + /* abnormal interrupts */ + sc->sc_inten |= STATUS_TPS | STATUS_TJT | STATUS_UNF | + STATUS_RU | STATUS_RPS | STATUS_SE | STATUS_AIS; + + sc->sc_rxint_mask = STATUS_RI|STATUS_RU; + sc->sc_txint_mask = STATUS_TI|STATUS_UNF|STATUS_TJT; + + sc->sc_rxint_mask &= sc->sc_inten; + sc->sc_txint_mask &= sc->sc_inten; + + CSR_WRITE_4(sc, CSR_INTEN, sc->sc_inten); + CSR_WRITE_4(sc, CSR_STATUS, 0xffffffff); + + /* + * Give the transmit and receive rings to the chip. + */ + CSR_WRITE_4(sc, CSR_TXLIST, FV_TX_RING_ADDR(sc, 0)); + CSR_WRITE_4(sc, CSR_RXLIST, FV_RX_RING_ADDR(sc, 0)); + + /* + * Set the station address. + */ + fv_setfilt(sc); + + + /* + * Write out the opmode. + */ + CSR_WRITE_4(sc, CSR_OPMODE, OPMODE_SR | OPMODE_ST | + OPMODE_TR_128 | OPMODE_FDX | OPMODE_SPEED); + /* + * Start the receive process. + */ + CSR_WRITE_4(sc, CSR_RXPOLL, RXPOLL_RPD); + + sc->fv_link_status = 1; +#ifdef MII + mii_mediachg(mii); +#endif + + ifp->if_drv_flags |= IFF_DRV_RUNNING; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + + callout_reset(&sc->fv_stat_callout, hz, fv_tick, sc); +} + +static void +fv_start(struct ifnet *ifp) +{ + struct fv_softc *sc; + + sc = ifp->if_softc; + + FV_LOCK(sc); + fv_start_locked(ifp); + FV_UNLOCK(sc); +} + +/* + * Encapsulate an mbuf chain in a descriptor by coupling the mbuf data + * pointers to the fragment pointers. + * Use Implicit Chain implementation. + */ +static int +fv_encap(struct fv_softc *sc, struct mbuf **m_head) +{ + struct fv_txdesc *txd; + struct fv_desc *desc; + struct mbuf *m; + bus_dma_segment_t txsegs[FV_MAXFRAGS]; + int error, i, nsegs, prod, si; + int padlen; + int txstat; + + FV_LOCK_ASSERT(sc); + + /* + * Some VIA Rhine wants packet buffers to be longword + * aligned, but very often our mbufs aren't. Rather than + * waste time trying to decide when to copy and when not + * to copy, just do it all the time. + */ + m = m_defrag(*m_head, M_NOWAIT); + if (m == NULL) { + device_printf(sc->fv_dev, "fv_encap m_defrag error\n"); + m_freem(*m_head); + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; + + /* + * The Rhine chip doesn't auto-pad, so we have to make + * sure to pad short frames out to the minimum frame length + * ourselves. + */ + if ((*m_head)->m_pkthdr.len < FV_MIN_FRAMELEN) { + m = *m_head; + padlen = FV_MIN_FRAMELEN - m->m_pkthdr.len; + if (M_WRITABLE(m) == 0) { + /* Get a writable copy. */ + m = m_dup(*m_head, M_NOWAIT); + m_freem(*m_head); + if (m == NULL) { + device_printf(sc->fv_dev, "fv_encap m_dup error\n"); + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; + } + if (m->m_next != NULL || M_TRAILINGSPACE(m) < padlen) { + m = m_defrag(m, M_NOWAIT); + if (m == NULL) { + device_printf(sc->fv_dev, "fv_encap m_defrag error\n"); + m_freem(*m_head); + *m_head = NULL; + return (ENOBUFS); + } + } + /* + * Manually pad short frames, and zero the pad space + * to avoid leaking data. + */ + bzero(mtod(m, char *) + m->m_pkthdr.len, padlen); + m->m_pkthdr.len += padlen; + m->m_len = m->m_pkthdr.len; + *m_head = m; + } + + prod = sc->fv_cdata.fv_tx_prod; + txd = &sc->fv_cdata.fv_txdesc[prod]; + error = bus_dmamap_load_mbuf_sg(sc->fv_cdata.fv_tx_tag, txd->tx_dmamap, + *m_head, txsegs, &nsegs, BUS_DMA_NOWAIT); + if (error == EFBIG) { + device_printf(sc->fv_dev, "fv_encap EFBIG error\n"); + m = m_defrag(*m_head, M_NOWAIT); + if (m == NULL) { + m_freem(*m_head); + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; + error = bus_dmamap_load_mbuf_sg(sc->fv_cdata.fv_tx_tag, + txd->tx_dmamap, *m_head, txsegs, &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + m_freem(*m_head); + *m_head = NULL; + return (error); + } + + } else if (error != 0) + return (error); + if (nsegs == 0) { + m_freem(*m_head); + *m_head = NULL; + return (EIO); + } + + /* Check number of available descriptors. */ + if (sc->fv_cdata.fv_tx_cnt + nsegs >= (FV_TX_RING_CNT - 1)) { + bus_dmamap_unload(sc->fv_cdata.fv_tx_tag, txd->tx_dmamap); + return (ENOBUFS); + } + + txd->tx_m = *m_head; + bus_dmamap_sync(sc->fv_cdata.fv_tx_tag, txd->tx_dmamap, + BUS_DMASYNC_PREWRITE); + + si = prod; + + /* + * Make a list of descriptors for this packet. + */ + desc = NULL; + for (i = 0; i < nsegs; i++) { + desc = &sc->fv_rdata.fv_tx_ring[prod]; + desc->fv_stat = ADSTAT_OWN; + desc->fv_devcs = txsegs[i].ds_len; + /* end of descriptor */ + if (prod == FV_TX_RING_CNT - 1) + desc->fv_devcs |= ADCTL_ER; + desc->fv_addr = txsegs[i].ds_addr; + + ++sc->fv_cdata.fv_tx_cnt; + FV_INC(prod, FV_TX_RING_CNT); + } + + /* + * Set mark last fragment with Last/Intr flag + */ + if (desc) { + desc->fv_devcs |= ADCTL_Tx_IC; + desc->fv_devcs |= ADCTL_Tx_LS; + } + + /* Update producer index. */ + sc->fv_cdata.fv_tx_prod = prod; + + /* Sync descriptors. */ + bus_dmamap_sync(sc->fv_cdata.fv_tx_ring_tag, + sc->fv_cdata.fv_tx_ring_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + txstat = (CSR_READ_4(sc, CSR_STATUS) >> 20) & 7; + if (txstat == 0 || txstat == 6) { + /* Transmit Process Stat is stop or suspended */ + desc = &sc->fv_rdata.fv_tx_ring[si]; + desc->fv_devcs |= ADCTL_Tx_FS; + } + else { + /* Get previous descriptor */ + si = (si + FV_TX_RING_CNT - 1) % FV_TX_RING_CNT; + desc = &sc->fv_rdata.fv_tx_ring[si]; + /* join remain data and flugs */ + desc->fv_devcs &= ~ADCTL_Tx_IC; + desc->fv_devcs &= ~ADCTL_Tx_LS; + } + + + return (0); +} + +static void +fv_start_locked(struct ifnet *ifp) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat May 6 06:06:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40D44D606AD; Sat, 6 May 2017 06:06:13 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C0AC1C5A; Sat, 6 May 2017 06:06:13 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4666ClL082571; Sat, 6 May 2017 06:06:12 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4666COs082569; Sat, 6 May 2017 06:06:12 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705060606.v4666COs082569@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 6 May 2017 06:06:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317868 - head/sys/mips/atheros/ar531x X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 06:06:13 -0000 Author: adrian Date: Sat May 6 06:06:11 2017 New Revision: 317868 URL: https://svnweb.freebsd.org/changeset/base/317868 Log: [ar531x] [if_are] Fix if_are behaviour under high load traffic * use ifqmaxlen * handle (inefficiently for now) meeting padding and alignment requirements for transmit mbufs. * change how TX ring handling is done Submitted by: Hiroki Mori Differential Revision: https://reviews.freebsd.org/D10557 Modified: head/sys/mips/atheros/ar531x/if_are.c head/sys/mips/atheros/ar531x/if_arereg.h Modified: head/sys/mips/atheros/ar531x/if_are.c ============================================================================== --- head/sys/mips/atheros/ar531x/if_are.c Sat May 6 06:01:17 2017 (r317867) +++ head/sys/mips/atheros/ar531x/if_are.c Sat May 6 06:06:11 2017 (r317868) @@ -302,9 +302,9 @@ are_attach(device_t dev) ifp->if_init = are_init; sc->are_if_flags = ifp->if_flags; - /* XXX: add real size */ - IFQ_SET_MAXLEN(&ifp->if_snd, 9); - ifp->if_snd.ifq_maxlen = 9; + /* ifqmaxlen is sysctl value in net/if.c */ + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_maxlen = ifqmaxlen; IFQ_SET_READY(&ifp->if_snd); /* Tell the upper layer(s) we support long frames. */ @@ -686,19 +686,92 @@ are_encap(struct are_softc *sc, struct m { struct are_txdesc *txd; struct are_desc *desc, *prev_desc; + struct mbuf *m; bus_dma_segment_t txsegs[ARE_MAXFRAGS]; uint32_t link_addr; int error, i, nsegs, prod, si, prev_prod; int txstat; + int startcount; + int padlen; + + startcount = sc->are_cdata.are_tx_cnt; ARE_LOCK_ASSERT(sc); + /* + * Some VIA Rhine wants packet buffers to be longword + * aligned, but very often our mbufs aren't. Rather than + * waste time trying to decide when to copy and when not + * to copy, just do it all the time. + */ + m = m_defrag(*m_head, M_NOWAIT); + if (m == NULL) { + device_printf(sc->are_dev, "are_encap m_defrag error\n"); + m_freem(*m_head); + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; + + /* + * The Rhine chip doesn't auto-pad, so we have to make + * sure to pad short frames out to the minimum frame length + * ourselves. + */ + if ((*m_head)->m_pkthdr.len < ARE_MIN_FRAMELEN) { + m = *m_head; + padlen = ARE_MIN_FRAMELEN - m->m_pkthdr.len; + if (M_WRITABLE(m) == 0) { + /* Get a writable copy. */ + m = m_dup(*m_head, M_NOWAIT); + m_freem(*m_head); + if (m == NULL) { + device_printf(sc->are_dev, "are_encap m_dup error\n"); + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; + } + if (m->m_next != NULL || M_TRAILINGSPACE(m) < padlen) { + m = m_defrag(m, M_NOWAIT); + if (m == NULL) { + device_printf(sc->are_dev, "are_encap m_defrag error\n"); + m_freem(*m_head); + *m_head = NULL; + return (ENOBUFS); + } + } + /* + * Manually pad short frames, and zero the pad space + * to avoid leaking data. + */ + bzero(mtod(m, char *) + m->m_pkthdr.len, padlen); + m->m_pkthdr.len += padlen; + m->m_len = m->m_pkthdr.len; + *m_head = m; + } + prod = sc->are_cdata.are_tx_prod; txd = &sc->are_cdata.are_txdesc[prod]; - error = bus_dmamap_load_mbuf_sg(sc->are_cdata.are_tx_tag, txd->tx_dmamap, - *m_head, txsegs, &nsegs, BUS_DMA_NOWAIT); + error = bus_dmamap_load_mbuf_sg(sc->are_cdata.are_tx_tag, + txd->tx_dmamap, *m_head, txsegs, &nsegs, BUS_DMA_NOWAIT); if (error == EFBIG) { - panic("EFBIG"); + device_printf(sc->are_dev, "are_encap EFBIG error\n"); + m = m_defrag(*m_head, M_NOWAIT); + if (m == NULL) { + m_freem(*m_head); + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; + error = bus_dmamap_load_mbuf_sg(sc->are_cdata.are_tx_tag, + txd->tx_dmamap, *m_head, txsegs, &nsegs, BUS_DMA_NOWAIT); + if (error != 0) { + m_freem(*m_head); + *m_head = NULL; + return (error); + } + } else if (error != 0) return (error); if (nsegs == 0) { @@ -729,13 +802,12 @@ are_encap(struct are_softc *sc, struct m for (i = 0; i < nsegs; i++) { desc = &sc->are_rdata.are_tx_ring[prod]; desc->are_stat = ADSTAT_OWN; - desc->are_devcs = ARE_DMASIZE(txsegs[i].ds_len) | ADCTL_CH; - if (i == 0) - desc->are_devcs |= ADCTL_Tx_FS; + desc->are_devcs = ARE_DMASIZE(txsegs[i].ds_len); desc->are_addr = txsegs[i].ds_addr; /* link with previous descriptor */ - if (prev_desc) - prev_desc->are_link = ARE_TX_RING_ADDR(sc, prod); + /* end of descriptor */ + if (prod == ARE_TX_RING_CNT - 1) + desc->are_devcs |= ADCTL_ER; sc->are_cdata.are_tx_cnt++; prev_desc = desc; @@ -761,16 +833,16 @@ are_encap(struct are_softc *sc, struct m /* Start transmitting */ /* Check if new list is queued in NDPTR */ txstat = (CSR_READ_4(sc, CSR_STATUS) >> 20) & 7; - if (txstat == 0 || txstat == 6) { - /* Transmit Process Stat is stop or suspended */ - CSR_WRITE_4(sc, CSR_TXPOLL, TXPOLL_TPD); + if (startcount == 0 && (txstat == 0 || txstat == 6)) { + desc = &sc->are_rdata.are_tx_ring[si]; + desc->are_devcs |= ADCTL_Tx_FS; } else { link_addr = ARE_TX_RING_ADDR(sc, si); /* Get previous descriptor */ si = (si + ARE_TX_RING_CNT - 1) % ARE_TX_RING_CNT; desc = &sc->are_rdata.are_tx_ring[si]; - desc->are_link = link_addr; + desc->are_devcs &= ~(ADCTL_Tx_IC | ADCTL_Tx_LS); } return (0); @@ -782,6 +854,7 @@ are_start_locked(struct ifnet *ifp) struct are_softc *sc; struct mbuf *m_head; int enq; + int txstat; sc = ifp->if_softc; @@ -816,6 +889,14 @@ are_start_locked(struct ifnet *ifp) */ ETHER_BPF_MTAP(ifp, m_head); } + + if (enq > 0) { + txstat = (CSR_READ_4(sc, CSR_STATUS) >> 20) & 7; + if (txstat == 0 || txstat == 6) { + /* Transmit Process Stat is stop or suspended */ + CSR_WRITE_4(sc, CSR_TXPOLL, TXPOLL_TPD); + } + } } static void Modified: head/sys/mips/atheros/ar531x/if_arereg.h ============================================================================== --- head/sys/mips/atheros/ar531x/if_arereg.h Sat May 6 06:01:17 2017 (r317867) +++ head/sys/mips/atheros/ar531x/if_arereg.h Sat May 6 06:06:11 2017 (r317868) @@ -44,6 +44,8 @@ struct are_desc { #define ARE_TX_RING_CNT 128 #define ARE_TX_RING_SIZE sizeof(struct are_desc) * ARE_TX_RING_CNT #define ARE_RX_RING_SIZE sizeof(struct are_desc) * ARE_RX_RING_CNT + +#define ARE_MIN_FRAMELEN 60 #define ARE_RING_ALIGN sizeof(struct are_desc) #define ARE_RX_ALIGN sizeof(uint32_t) #define ARE_MAXFRAGS 8 From owner-svn-src-head@freebsd.org Sat May 6 06:22:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 914A1D6181C; Sat, 6 May 2017 06:22:15 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 535111391; Sat, 6 May 2017 06:22:15 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v466ME4O091042; Sat, 6 May 2017 06:22:14 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v466MECl091041; Sat, 6 May 2017 06:22:14 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705060622.v466MECl091041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 6 May 2017 06:22:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317874 - head/sys/mips/mediatek X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 06:22:15 -0000 Author: adrian Date: Sat May 6 06:22:14 2017 New Revision: 317874 URL: https://svnweb.freebsd.org/changeset/base/317874 Log: [mediatek] [gpio] add PPS / interrupt support. Submitted by: Hiroki Mori Reviewed by: mizhka Differential Revision: https://reviews.freebsd.org/D9784 Modified: head/sys/mips/mediatek/mtk_gpio_v1.c Modified: head/sys/mips/mediatek/mtk_gpio_v1.c ============================================================================== --- head/sys/mips/mediatek/mtk_gpio_v1.c Sat May 6 06:20:34 2017 (r317873) +++ head/sys/mips/mediatek/mtk_gpio_v1.c Sat May 6 06:22:14 2017 (r317874) @@ -292,7 +292,8 @@ mtk_gpio_attach(device_t dev) for (i = 0; i < sc->num_pins; i++) { sc->pins[i].pin_caps |= GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | - GPIO_PIN_INVIN | GPIO_PIN_INVOUT; + GPIO_PIN_INVIN | GPIO_PIN_INVOUT | + GPIO_INTR_EDGE_RISING | GPIO_INTR_EDGE_FALLING; sc->pins[i].intr_polarity = INTR_POLARITY_HIGH; sc->pins[i].intr_trigger = INTR_TRIGGER_EDGE; @@ -500,22 +501,78 @@ out: } static int +mtk_gpio_pic_map_fdt(struct mtk_gpio_softc *sc, + struct intr_map_data_fdt *daf, u_int *irqp, uint32_t *modep) +{ + u_int irq; + + if (daf->ncells != 1) { + device_printf(sc->dev, "Invalid #interrupt-cells\n"); + return (EINVAL); + } + + irq = daf->cells[0]; + + if (irq >= sc->num_pins) { + device_printf(sc->dev, "Invalid interrupt number %u\n", irq); + return (EINVAL); + } + + *irqp = irq; + if (modep != NULL) + *modep = GPIO_INTR_EDGE_BOTH; + + return (0); +} + +static int +mtk_gpio_pic_map_gpio(struct mtk_gpio_softc *sc, + struct intr_map_data_gpio *dag, u_int *irqp, uint32_t *modep) +{ + u_int irq; + + irq = dag->gpio_pin_num; + if (irq >= sc->num_pins) { + device_printf(sc->dev, "Invalid interrupt number %u\n", irq); + return (EINVAL); + } + + *irqp = irq; + if (modep != NULL) + *modep = dag->gpio_intr_mode; + + return (0); +} + +static int mtk_gpio_pic_map_intr(device_t dev, struct intr_map_data *data, struct intr_irqsrc **isrcp) { - struct intr_map_data_fdt *daf; + int error; + u_int irq; struct mtk_gpio_softc *sc; - if (data->type != INTR_MAP_DATA_FDT) - return (ENOTSUP); - sc = device_get_softc(dev); - daf = (struct intr_map_data_fdt *)data; + switch (data->type) { + case INTR_MAP_DATA_FDT: + error = (mtk_gpio_pic_map_fdt(sc, + (struct intr_map_data_fdt *)data, &irq, NULL)); + break; + case INTR_MAP_DATA_GPIO: + error = (mtk_gpio_pic_map_gpio(sc, + (struct intr_map_data_gpio *)data, &irq, NULL)); + break; + default: + error = EINVAL; + break; + } - if (daf->ncells != 1 || daf->cells[0] >= sc->num_pins) - return (EINVAL); + if (error != 0) { + device_printf(dev, "Invalid map type\n"); + return (error); + } - *isrcp = PIC_INTR_ISRC(sc, daf->cells[0]); + *isrcp = PIC_INTR_ISRC(sc, irq); return (0); } @@ -600,6 +657,51 @@ mtk_gpio_pic_post_filter(device_t dev, s } static int +mtk_gpio_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct mtk_gpio_softc *sc; + uint32_t val; + int error; + uint32_t mode; + u_int irq; + + if (data == NULL) + return (ENOTSUP); + + sc = device_get_softc(dev); + + switch (data->type) { + case INTR_MAP_DATA_FDT: + error = mtk_gpio_pic_map_fdt(sc, + (struct intr_map_data_fdt *)data, &irq, &mode); + break; + case INTR_MAP_DATA_GPIO: + error = mtk_gpio_pic_map_gpio(sc, + (struct intr_map_data_gpio *)data, &irq, &mode); + break; + default: + error = ENOTSUP; + break; + } + + if (error != 0) + return (error); + + MTK_GPIO_LOCK(sc); + if (mode == GPIO_INTR_EDGE_BOTH || mode == GPIO_INTR_EDGE_RISING) { + val = MTK_READ_4(sc, GPIO_PIORENA) | (1u << irq); + MTK_WRITE_4(sc, GPIO_PIORENA, val); + } + if (mode == GPIO_INTR_EDGE_BOTH || mode == GPIO_INTR_EDGE_FALLING) { + val = MTK_READ_4(sc, GPIO_PIOFENA) | (1u << irq); + MTK_WRITE_4(sc, GPIO_PIOFENA, val); + } + MTK_GPIO_UNLOCK(sc); + return (0); +} + +static int mtk_gpio_intr(void *arg) { struct mtk_gpio_softc *sc; @@ -607,6 +709,7 @@ mtk_gpio_intr(void *arg) sc = arg; interrupts = MTK_READ_4(sc, GPIO_PIOINT); + MTK_WRITE_4(sc, GPIO_PIOINT, interrupts); for (i = 0; interrupts != 0; i++, interrupts >>= 1) { if ((interrupts & 0x1) == 0) @@ -649,6 +752,7 @@ static device_method_t mtk_gpio_methods[ DEVMETHOD(pic_disable_intr, mtk_gpio_pic_disable_intr), DEVMETHOD(pic_enable_intr, mtk_gpio_pic_enable_intr), DEVMETHOD(pic_map_intr, mtk_gpio_pic_map_intr), + DEVMETHOD(pic_setup_intr, mtk_gpio_pic_setup_intr), DEVMETHOD(pic_post_filter, mtk_gpio_pic_post_filter), DEVMETHOD(pic_post_ithread, mtk_gpio_pic_post_ithread), DEVMETHOD(pic_pre_ithread, mtk_gpio_pic_pre_ithread), From owner-svn-src-head@freebsd.org Sat May 6 06:08:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63765D6093B; Sat, 6 May 2017 06:08:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 32AB56C2; Sat, 6 May 2017 06:08:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4668i2d083099; Sat, 6 May 2017 06:08:44 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4668iaM083098; Sat, 6 May 2017 06:08:44 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705060608.v4668iaM083098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 6 May 2017 06:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317870 - head/sys/dev/flash X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 06:08:45 -0000 Author: adrian Date: Sat May 6 06:08:44 2017 New Revision: 317870 URL: https://svnweb.freebsd.org/changeset/base/317870 Log: [mx25l] add new device ids. Submitted by: Hiroki Mori Differential Revision: https://reviews.freebsd.org/D10621 Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sat May 6 06:07:44 2017 (r317869) +++ head/sys/dev/flash/mx25l.c Sat May 6 06:08:44 2017 (r317870) @@ -110,7 +110,9 @@ struct mx25l_flash_ident flash_devices[] { "en25f32", 0x1c, 0x3116, 64 * 1024, 64, FL_NONE }, { "en25p32", 0x1c, 0x2016, 64 * 1024, 64, FL_NONE }, { "en25p64", 0x1c, 0x2017, 64 * 1024, 128, FL_NONE }, + { "en25q32", 0x1c, 0x3016, 64 * 1024, 64, FL_NONE }, { "en25q64", 0x1c, 0x3017, 64 * 1024, 128, FL_ERASE_4K }, + { "m25p32", 0x20, 0x2016, 64 * 1024, 64, FL_NONE }, { "m25p64", 0x20, 0x2017, 64 * 1024, 128, FL_NONE }, { "mx25ll32", 0xc2, 0x2016, 64 * 1024, 64, FL_NONE }, { "mx25ll64", 0xc2, 0x2017, 64 * 1024, 128, FL_NONE }, From owner-svn-src-head@freebsd.org Sat May 6 06:09:52 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F216D60A13; Sat, 6 May 2017 06:09:52 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE975A30; Sat, 6 May 2017 06:09:51 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4669oxq083180; Sat, 6 May 2017 06:09:50 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4669o70083179; Sat, 6 May 2017 06:09:50 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201705060609.v4669o70083179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 6 May 2017 06:09:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317871 - head/sys/mips/atheros X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 06:09:52 -0000 Author: adrian Date: Sat May 6 06:09:50 2017 New Revision: 317871 URL: https://svnweb.freebsd.org/changeset/base/317871 Log: [ar934x] do an ethernet analog reset; apparently some boards don't. Tested: * on IOData WN-G300R. may be same as Sitecom WLR-2100. Submitted by: Hiroki Mori Differential Revision: https://reviews.freebsd.org/D10621 Modified: head/sys/mips/atheros/ar934x_chip.c Modified: head/sys/mips/atheros/ar934x_chip.c ============================================================================== --- head/sys/mips/atheros/ar934x_chip.c Sat May 6 06:08:44 2017 (r317870) +++ head/sys/mips/atheros/ar934x_chip.c Sat May 6 06:09:50 2017 (r317871) @@ -315,6 +315,10 @@ ar934x_chip_reset_ethernet_switch(void) DELAY(100); ar71xx_device_start(AR934X_RESET_ETH_SWITCH); DELAY(100); + ar71xx_device_stop(AR934X_RESET_ETH_SWITCH_ANALOG); + DELAY(100); + ar71xx_device_start(AR934X_RESET_ETH_SWITCH_ANALOG); + DELAY(100); } static void From owner-svn-src-head@freebsd.org Sat May 6 10:26:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05C2AD5E543; Sat, 6 May 2017 10:26:43 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9960A198F; Sat, 6 May 2017 10:26:42 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v46AQfU1089972; Sat, 6 May 2017 10:26:41 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v46AQesA089962; Sat, 6 May 2017 10:26:40 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201705061026.v46AQesA089962@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 6 May 2017 10:26:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317877 - in head: contrib/zstd contrib/zstd/contrib contrib/zstd/contrib/pzstd contrib/zstd/contrib/pzstd/utils/test contrib/zstd/doc contrib/zstd/doc/educational_decoder contrib/zstd/... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 10:26:43 -0000 Author: bapt Date: Sat May 6 10:26:40 2017 New Revision: 317877 URL: https://svnweb.freebsd.org/changeset/base/317877 Log: Import Zstandard 1.2.0 Among new things it is now threaded by default, use zstd -T# to chose the number of threads not that -T0 will automatically determine the number of threads based on the number of CPU online. Added: head/contrib/zstd/contrib/cleanTabs - copied unchanged from r317876, vendor/zstd/dist/contrib/cleanTabs head/contrib/zstd/programs/zstd.1.md - copied unchanged from r317876, vendor/zstd/dist/programs/zstd.1.md Deleted: head/contrib/zstd/.gitignore head/contrib/zstd/.travis.yml Modified: head/contrib/zstd/Makefile head/contrib/zstd/NEWS head/contrib/zstd/README.md head/contrib/zstd/appveyor.yml head/contrib/zstd/circle.yml head/contrib/zstd/contrib/pzstd/Options.cpp head/contrib/zstd/contrib/pzstd/utils/test/ThreadPoolTest.cpp head/contrib/zstd/contrib/pzstd/utils/test/WorkQueueTest.cpp head/contrib/zstd/doc/educational_decoder/zstd_decompress.c head/contrib/zstd/doc/images/Cspeed4.png head/contrib/zstd/doc/images/Dspeed4.png head/contrib/zstd/doc/images/dict-cr.png head/contrib/zstd/doc/images/dict-cs.png head/contrib/zstd/doc/images/dict-ds.png head/contrib/zstd/doc/zstd_compression_format.md head/contrib/zstd/doc/zstd_manual.html head/contrib/zstd/examples/simple_compression.c head/contrib/zstd/examples/streaming_compression.c head/contrib/zstd/examples/streaming_decompression.c head/contrib/zstd/lib/Makefile head/contrib/zstd/lib/README.md head/contrib/zstd/lib/common/bitstream.h head/contrib/zstd/lib/common/error_private.c head/contrib/zstd/lib/common/fse.h head/contrib/zstd/lib/common/huf.h head/contrib/zstd/lib/common/mem.h head/contrib/zstd/lib/common/zstd_errors.h head/contrib/zstd/lib/common/zstd_internal.h head/contrib/zstd/lib/compress/fse_compress.c head/contrib/zstd/lib/compress/zstd_compress.c head/contrib/zstd/lib/compress/zstd_opt.h head/contrib/zstd/lib/compress/zstdmt_compress.c head/contrib/zstd/lib/decompress/zstd_decompress.c head/contrib/zstd/lib/dictBuilder/cover.c head/contrib/zstd/lib/dictBuilder/zdict.c head/contrib/zstd/lib/dictBuilder/zdict.h head/contrib/zstd/lib/legacy/zstd_v01.c head/contrib/zstd/lib/legacy/zstd_v02.c head/contrib/zstd/lib/legacy/zstd_v03.c head/contrib/zstd/lib/legacy/zstd_v04.c head/contrib/zstd/lib/legacy/zstd_v05.c head/contrib/zstd/lib/legacy/zstd_v06.c head/contrib/zstd/lib/zstd.h head/contrib/zstd/programs/Makefile head/contrib/zstd/programs/README.md head/contrib/zstd/programs/bench.c head/contrib/zstd/programs/dibio.c head/contrib/zstd/programs/fileio.c head/contrib/zstd/programs/fileio.h head/contrib/zstd/programs/platform.h head/contrib/zstd/programs/util.h head/contrib/zstd/programs/zstd.1 head/contrib/zstd/programs/zstdcli.c head/contrib/zstd/tests/Makefile head/contrib/zstd/tests/decodecorpus.c head/contrib/zstd/tests/fullbench.c head/contrib/zstd/tests/fuzzer.c head/contrib/zstd/tests/paramgrill.c head/contrib/zstd/tests/playTests.sh head/contrib/zstd/tests/test-zstd-speed.py head/contrib/zstd/tests/zbufftest.c head/contrib/zstd/tests/zstreamtest.c head/contrib/zstd/zlibWrapper/examples/zwrapbench.c head/usr.bin/zstd/Makefile Directory Properties: head/contrib/zstd/ (props changed) Modified: head/contrib/zstd/Makefile ============================================================================== --- head/contrib/zstd/Makefile Sat May 6 10:18:45 2017 (r317876) +++ head/contrib/zstd/Makefile Sat May 6 10:26:40 2017 (r317877) @@ -90,6 +90,10 @@ examples: manual: $(MAKE) -C contrib/gen_html $@ +.PHONY: cleanTabs +cleanTabs: + cd contrib; ./cleanTabs + .PHONY: clean clean: @$(MAKE) -C $(ZSTDDIR) $@ > $(VOID) @@ -105,9 +109,15 @@ clean: # make install is validated only for Linux, OSX, Hurd and some BSD targets #------------------------------------------------------------------------------ ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD DragonFly NetBSD)) + HOST_OS = POSIX -.PHONY: install uninstall travis-install clangtest gpptest armtest usan asan uasan +CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON +.PHONY: list +list: + @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs + +.PHONY: install uninstall travis-install clangtest gpptest armtest usan asan uasan install: @$(MAKE) -C $(ZSTDDIR) $@ @$(MAKE) -C $(PRGDIR) $@ @@ -152,16 +162,16 @@ ppc64build: clean CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) allarch armfuzz: clean - CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static MOREFLAGS="-static" $(MAKE) -C $(TESTDIR) fuzztest + CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest aarch64fuzz: clean - CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static MOREFLAGS="-static" $(MAKE) -C $(TESTDIR) fuzztest + CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest ppcfuzz: clean - CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static MOREFLAGS="-static" $(MAKE) -C $(TESTDIR) fuzztest + CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest ppc64fuzz: clean - CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS="-m64 -static" $(MAKE) -C $(TESTDIR) fuzztest + CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest gpptest: clean CC=g++ $(MAKE) -C $(PRGDIR) all CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" @@ -180,19 +190,19 @@ clangtest: clean armtest: clean $(MAKE) -C $(TESTDIR) datagen # use native, faster - $(MAKE) -C $(TESTDIR) test CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static" + $(MAKE) -C $(TESTDIR) test CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests aarch64test: $(MAKE) -C $(TESTDIR) datagen # use native, faster - $(MAKE) -C $(TESTDIR) test CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static" + $(MAKE) -C $(TESTDIR) test CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests ppctest: clean $(MAKE) -C $(TESTDIR) datagen # use native, faster - $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static" + $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static" FUZZER_FLAGS=--no-big-tests ppc64test: clean $(MAKE) -C $(TESTDIR) datagen # use native, faster - $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static" + $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests arm-ppc-compilation: $(MAKE) -C $(PRGDIR) clean zstd CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static" @@ -263,7 +273,7 @@ endif ifneq (,$(filter MSYS%,$(shell uname))) HOST_OS = MSYS -CMAKE_PARAMS = -G"MSYS Makefiles" +CMAKE_PARAMS = -G"MSYS Makefiles" -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON endif @@ -275,7 +285,7 @@ cmakebuild: cmake --version $(RM) -r $(BUILDIR)/cmake/build mkdir $(BUILDIR)/cmake/build - cd $(BUILDIR)/cmake/build ; cmake -DPREFIX:STRING=~/install_test_dir $(CMAKE_PARAMS) .. ; $(MAKE) install ; $(MAKE) uninstall + cd $(BUILDIR)/cmake/build ; cmake -DCMAKE_INSTALL_PREFIX:PATH=~/install_test_dir $(CMAKE_PARAMS) .. ; $(MAKE) install ; $(MAKE) uninstall c90build: clean gcc -v Modified: head/contrib/zstd/NEWS ============================================================================== --- head/contrib/zstd/NEWS Sat May 6 10:18:45 2017 (r317876) +++ head/contrib/zstd/NEWS Sat May 6 10:26:40 2017 (r317877) @@ -1,3 +1,25 @@ +v1.2.0 +cli : changed : Multithreading enabled by default (use target zstd-nomt or HAVE_THREAD=0 to disable) +cli : new : command -T0 means "detect and use nb of cores", by Sean Purcell +cli : new : zstdmt symlink hardwired to `zstd -T0` +cli : new : command --threads=# (#671) +cli : changed : cover dictionary builder by default, for improved quality, by Nick Terrell +cli : new : commands --train-cover and --train-legacy, to select dictionary algorithm and parameters +cli : experimental targets `zstd4` and `xzstd4`, with support for lz4 format, by Sean Purcell +cli : fix : does not output compressed data on console +cli : fix : ignore symbolic links unless --force specified, +API : breaking change : ZSTD_createCDict_advanced(), only use compressionParameters as argument +API : added : prototypes ZSTD_*_usingCDict_advanced(), for direct control over frameParameters. +API : improved: ZSTDMT_compressCCtx() reduced memory usage +API : fix : ZSTDMT_compressCCtx() now provides srcSize in header (#634) +API : fix : src size stored in frame header is controlled at end of frame +API : fix : enforced consistent rules for pledgedSrcSize==0 (#641) +API : fix : error code "GENERIC" replaced by "dstSizeTooSmall" when appropriate +build: improved cmake script, by @Majlen +build: enabled Multi-threading support for *BSD, by Baptiste Daroussin +tools: updated Paramgrill. Command -O# provides best parameters for sample and speed target. +new : contrib/linux-kernel version, by Nick Terrell + v1.1.4 cli : new : can compress in *.gz format, using --format=gzip command, by Przemyslaw Skibinski cli : new : advanced benchmark command --priority=rt @@ -5,13 +27,13 @@ cli : fix : write on sparse-enabled file cli : fix : --rm remains silent when input is stdin cli : experimental : xzstd, with support for xz/lzma decoding, by Przemyslaw Skibinski speed : improved decompression speed in streaming mode for single shot scenarios (+5%) -memory : DDict (decompression dictionary) memory usage down from 150 KB to 20 KB -arch : 32-bits variant able to generate and decode very long matches (>32 MB), by Sean Purcell +memory: DDict (decompression dictionary) memory usage down from 150 KB to 20 KB +arch: 32-bits variant able to generate and decode very long matches (>32 MB), by Sean Purcell API : new : ZSTD_findFrameCompressedSize(), ZSTD_getFrameContentSize(), ZSTD_findDecompressedSize() API : changed : dropped support of legacy versions <= v0.3 (can be changed by modifying ZSTD_LEGACY_SUPPORT value) -build: new: meson build system in contrib/meson, by Dima Krasner -build: improved cmake script, by @Majlen -build: added -Wformat-security flag, as recommended by Padraig Brady +build : new: meson build system in contrib/meson, by Dima Krasner +build : improved cmake script, by @Majlen +build : added -Wformat-security flag, as recommended by Padraig Brady doc : new : educational decoder, by Sean Purcell v1.1.3 Modified: head/contrib/zstd/README.md ============================================================================== --- head/contrib/zstd/README.md Sat May 6 10:18:45 2017 (r317876) +++ head/contrib/zstd/README.md Sat May 6 10:26:40 2017 (r317877) @@ -12,13 +12,13 @@ you can consult a list of known ports on |dev | [![Build Status](https://travis-ci.org/facebook/zstd.svg?branch=dev)](https://travis-ci.org/facebook/zstd) | As a reference, several fast compression algorithms were tested and compared -on a server running Linux Mint Debian Edition (`Linux version 4.8.0-1-amd64`), +on a server running Linux Debian (`Linux version 4.8.0-1-amd64`), with a Core i7-6700K CPU @ 4.0GHz, -using [lzbench v1.6], an open-source in-memory benchmark by @inikep +using [lzbench], an open-source in-memory benchmark by @inikep compiled with GCC 6.3.0, on the [Silesia compression corpus]. -[lzbench v1.6]: https://github.com/inikep/lzbench +[lzbench]: https://github.com/inikep/lzbench [Silesia compression corpus]: http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia | Compressor name | Ratio | Compression| Decompress.| @@ -38,7 +38,12 @@ on the [Silesia compression corpus]. Zstd can also offer stronger compression ratios at the cost of compression speed. Speed vs Compression trade-off is configurable by small increments. Decompression speed is preserved and remains roughly the same at all settings, a property shared by most LZ compression algorithms, such as [zlib] or lzma. -The following tests were run on a Core i7-3930K CPU @ 4.5GHz, using [lzbench], an open-source in-memory benchmark by @inikep compiled with GCC 5.2.1, on the [Silesia compression corpus]. +The following tests were run +on a server running Linux Debian (`Linux version 4.8.0-1-amd64`) +with a Core i7-6700K CPU @ 4.0GHz, +using [lzbench], an open-source in-memory benchmark by @inikep +compiled with GCC 6.3.0, +on the [Silesia compression corpus]. Compression Speed vs Ratio | Decompression Speed ---------------------------|-------------------- Modified: head/contrib/zstd/appveyor.yml ============================================================================== --- head/contrib/zstd/appveyor.yml Sat May 6 10:18:45 2017 (r317876) +++ head/contrib/zstd/appveyor.yml Sat May 6 10:26:40 2017 (r317877) @@ -1,66 +1,103 @@ -version: 1.0.{build} -environment: - matrix: - - COMPILER: "gcc" - PLATFORM: "mingw64" - MAKE_PARAMS: '"make test && make lib && make -C tests test-symbols fullbench-dll fullbench-lib"' - - COMPILER: "gcc" - PLATFORM: "mingw32" - MAKE_PARAMS: '"make -C tests test-zstd test-fullbench test-fuzzer test-invalidDictionaries"' - - COMPILER: "gcc" - PLATFORM: "clang" - MAKE_PARAMS: '"make -C tests zstd fullbench fuzzer paramgrill datagen CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion""' - - COMPILER: "visual" - CONFIGURATION: "Debug" - PLATFORM: "x64" - - COMPILER: "visual" - CONFIGURATION: "Debug" - PLATFORM: "Win32" - - COMPILER: "visual" - CONFIGURATION: "Release" - PLATFORM: "x64" - - COMPILER: "visual" - CONFIGURATION: "Release" - PLATFORM: "Win32" +- + version: 1.0.{build} + branches: + only: + - dev + - master + environment: + matrix: + - COMPILER: "gcc" + HOST: "mingw" + PLATFORM: "x64" + SCRIPT: "make allarch && make -C tests test-symbols fullbench-dll fullbench-lib" + ARTIFACT: "true" + BUILD: "true" + - COMPILER: "gcc" + HOST: "mingw" + PLATFORM: "x86" + SCRIPT: "make allarch" + ARTIFACT: "true" + BUILD: "true" + - COMPILER: "clang" + HOST: "mingw" + PLATFORM: "x64" + SCRIPT: "MOREFLAGS='--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion' make allarch" + BUILD: "true" + + - COMPILER: "gcc" + HOST: "mingw" + PLATFORM: "x64" + SCRIPT: "" + TEST: "cmake" + + - COMPILER: "gcc" + HOST: "mingw" + PLATFORM: "x64" + SCRIPT: "" + TEST: "pzstd" + + - COMPILER: "visual" + HOST: "visual" + PLATFORM: "x64" + CONFIGURATION: "Debug" + - COMPILER: "visual" + HOST: "visual" + PLATFORM: "Win32" + CONFIGURATION: "Debug" + - COMPILER: "visual" + HOST: "visual" + PLATFORM: "x64" + CONFIGURATION: "Release" + - COMPILER: "visual" + HOST: "visual" + PLATFORM: "Win32" + CONFIGURATION: "Release" -install: + install: - ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION% - - MKDIR bin - - if [%COMPILER%]==[gcc] SET PATH_ORIGINAL=%PATH% - - if [%COMPILER%]==[gcc] ( - SET "PATH_MINGW32=c:\MinGW\bin;c:\MinGW\usr\bin" && - SET "PATH_MINGW64=c:\msys64\mingw64\bin;c:\msys64\usr\bin" && - COPY C:\msys64\usr\bin\make.exe C:\MinGW\bin\make.exe && - COPY C:\MinGW\bin\gcc.exe C:\MinGW\bin\cc.exe - ) else ( - IF [%PLATFORM%]==[x64] (SET ADDITIONALPARAM=/p:LibraryPath="C:\Program Files\Microsoft SDKs\Windows\v7.1\lib\x64;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\lib\amd64;") + - SET PATH_ORIGINAL=%PATH% + - if [%HOST%]==[mingw] ( + SET "PATH_MINGW32=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin" && + SET "PATH_MINGW64=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin" && + COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\make.exe && + COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin\make.exe + ) + - IF [%HOST%]==[visual] IF [%PLATFORM%]==[x64] ( + SET ADDITIONALPARAM=/p:LibraryPath="C:\Program Files\Microsoft SDKs\Windows\v7.1\lib\x64;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\lib\amd64;" + ) + + build_script: + - if [%HOST%]==[mingw] ( + ( if [%PLATFORM%]==[x64] ( + SET "PATH=%PATH_MINGW64%;%PATH_ORIGINAL%" + ) else if [%PLATFORM%]==[x86] ( + SET "PATH=%PATH_MINGW32%;%PATH_ORIGINAL%" + ) ) ) - -build_script: - - ECHO Building %COMPILER% %PLATFORM% %CONFIGURATION% - - if [%PLATFORM%]==[mingw32] SET PATH=%PATH_MINGW32%;%PATH_ORIGINAL% - - if [%PLATFORM%]==[mingw64] SET PATH=%PATH_MINGW64%;%PATH_ORIGINAL% - - if [%PLATFORM%]==[clang] SET PATH=%PATH_MINGW64%;%PATH_ORIGINAL% - - if [%COMPILER%]==[gcc] ( - ECHO *** && - ECHO *** Building %PLATFORM% && - ECHO *** && + - if [%HOST%]==[mingw] if [%BUILD%]==[true] ( make -v && - cc -v && - ECHO %MAKE_PARAMS% && - sh -c %MAKE_PARAMS% - ) - - if [%PLATFORM%]==[clang] COPY tests\fuzzer.exe tests\fuzzer_clang.exe - - if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw64] ( - COPY programs\zstd.exe bin\zstd.exe && - appveyor PushArtifact bin\zstd.exe - ) - - if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw32] ( - COPY programs\zstd.exe bin\zstd32.exe && - appveyor PushArtifact bin\zstd32.exe + sh -c "%COMPILER% -v" && + ECHO Building zlib to static link && + SET "CC=%COMPILER%" && + sh -c "cd .. && git clone --depth 1 --branch v1.2.11 https://github.com/madler/zlib" && + sh -c "cd ../zlib && make -f win32/Makefile.gcc libz.a" + ECHO Building zstd && + SET "CPPFLAGS=-I../../zlib" && + SET "LDFLAGS=../../zlib/libz.a" && + sh -c "%SCRIPT%" && + ( if [%COMPILER%]==[gcc] if [%ARTIFACT%]==[true] + lib\dll\example\build_package.bat && + make -C programs DEBUGFLAGS= clean zstd && + cp programs\zstd.exe zstd_%PLATFORM%.exe && + appveyor PushArtifact zstd_%PLATFORM%.exe && + cp programs\zstd.exe bin\zstd.exe && + make -C programs DEBUGFLAGS= clean zstdmt && + cp programs\zstd.exe bin\zstdmt.exe && + cd bin\ && 7z a -tzip zstd-win-release-%PLATFORM%.zip * && + appveyor PushArtifact zstd-win-release-%PLATFORM%.zip + ) ) - - if [%COMPILER%]==[gcc] make clean - - if [%COMPILER%]==[visual] ( + - if [%HOST%]==[visual] ( ECHO *** && ECHO *** Building Visual Studio 2008 %PLATFORM%\%CONFIGURATION% in %APPVEYOR_BUILD_FOLDER% && ECHO *** && @@ -111,29 +148,26 @@ build_script: COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe tests\ ) -test_script: + test_script: - ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION% - - SET FUZZERTEST=-T1mn - - if [%COMPILER%]==[gcc] if [%PLATFORM%]==[clang] ( - tests\fuzzer_clang.exe %FUZZERTEST% && - ECHO *** && - ECHO *** Building cmake for %PLATFORM% && - ECHO *** && + - SET "CC=gcc" + - SET "CXX=g++" + - if [%TEST%]==[cmake] ( mkdir build\cmake\build && cd build\cmake\build && cmake -G "Visual Studio 14 2015 Win64" .. && cd ..\..\.. && - make clean && - ECHO *** && - ECHO *** Building pzstd for %PLATFORM% && - ECHO *** && + make clean + ) + - if [%TEST%]==[pzstd] ( make -C contrib\pzstd googletest-mingw64 && make -C contrib\pzstd pzstd.exe && make -C contrib\pzstd tests && make -C contrib\pzstd check && make -C contrib\pzstd clean ) - - if [%COMPILER%]==[visual] if [%CONFIGURATION%]==[Release] ( + - SET "FUZZERTEST=-T30s" + - if [%HOST%]==[visual] if [%CONFIGURATION%]==[Release] ( CD tests && SET ZSTD=./zstd.exe && sh -e playTests.sh --test-large-data && @@ -146,33 +180,76 @@ test_script: fuzzer_VS2015_%PLATFORM%_Release.exe %FUZZERTEST% ) -branches: - only: - - dev - - master - -artifacts: - - path: bin\zstd.exe - - path: bin\zstd32.exe - -deploy: -- provider: GitHub - auth_token: - secure: LgJo8emYc3sFnlNWkGl4/VYK3nk/8+RagcsqDlAi3xeqNGNutnKjcftjg84uJoT4 - artifact: bin\zstd.exe - force_update: true - on: - branch: autobuild - COMPILER: gcc - PLATFORM: "mingw64" - appveyor_repo_tag: true -- provider: GitHub - auth_token: - secure: LgJo8emYc3sFnlNWkGl4/VYK3nk/8+RagcsqDlAi3xeqNGNutnKjcftjg84uJoT4 - artifact: bin\zstd32.exe - force_update: true - on: - branch: autobuild - COMPILER: gcc - PLATFORM: "mingw32" - appveyor_repo_tag: true +- + version: 1.0.{build} + environment: + matrix: + - COMPILER: "gcc" + HOST: "mingw" + PLATFORM: "x64" + SCRIPT: "make allarch" + - COMPILER: "gcc" + HOST: "mingw" + PLATFORM: "x86" + SCRIPT: "make allarch" + - COMPILER: "clang" + HOST: "mingw" + PLATFORM: "x64" + SCRIPT: "MOREFLAGS='--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion' make allarch" + + - COMPILER: "visual" + HOST: "visual" + PLATFORM: "x64" + CONFIGURATION: "Debug" + - COMPILER: "visual" + HOST: "visual" + PLATFORM: "Win32" + CONFIGURATION: "Debug" + - COMPILER: "visual" + HOST: "visual" + PLATFORM: "x64" + CONFIGURATION: "Release" + - COMPILER: "visual" + HOST: "visual" + PLATFORM: "Win32" + CONFIGURATION: "Release" + + install: + - ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION% + - SET PATH_ORIGINAL=%PATH% + - if [%HOST%]==[mingw] ( + SET "PATH_MINGW32=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin" && + SET "PATH_MINGW64=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin" && + COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\make.exe && + COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin\make.exe + ) + - IF [%HOST%]==[visual] IF [%PLATFORM%]==[x64] ( + SET ADDITIONALPARAM=/p:LibraryPath="C:\Program Files\Microsoft SDKs\Windows\v7.1\lib\x64;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\lib\amd64;" + ) + + build_script: + - ECHO Building %COMPILER% %PLATFORM% %CONFIGURATION% + - if [%HOST%]==[mingw] ( + ( if [%PLATFORM%]==[x64] ( + SET "PATH=%PATH_MINGW64%;%PATH_ORIGINAL%" + ) else if [%PLATFORM%]==[x86] ( + SET "PATH=%PATH_MINGW32%;%PATH_ORIGINAL%" + ) ) && + make -v && + sh -c "%COMPILER% -v" && + set "CC=%COMPILER%" && + sh -c "%SCRIPT%" + ) + - if [%HOST%]==[visual] ( + ECHO *** && + ECHO *** Building Visual Studio 2015 %PLATFORM%\%CONFIGURATION% && + ECHO *** && + msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v140 /p:ForceImportBeforeCppTargets=%APPVEYOR_BUILD_FOLDER%\build\VS2010\CompileAsCpp.props /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && + DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe && + MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && + msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v140 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" && + DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe && + MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe && + COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2015_%PLATFORM%_%CONFIGURATION%.exe && + COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe tests\ + ) Modified: head/contrib/zstd/circle.yml ============================================================================== --- head/contrib/zstd/circle.yml Sat May 6 10:18:45 2017 (r317876) +++ head/contrib/zstd/circle.yml Sat May 6 10:26:40 2017 (r317877) @@ -3,7 +3,7 @@ dependencies: - sudo dpkg --add-architecture i386 - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; sudo apt-get -y -qq update - sudo apt-get -y install gcc-powerpc-linux-gnu gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross - - sudo apt-get -y install libstdc++-6-dev clang gcc g++ gcc-5 gcc-6 + - sudo apt-get -y install libstdc++-6-dev clang gcc g++ gcc-5 gcc-6 zlib1g-dev liblzma-dev - sudo apt-get -y install linux-libc-dev:i386 libc6-dev-i386 test: Copied: head/contrib/zstd/contrib/cleanTabs (from r317876, vendor/zstd/dist/contrib/cleanTabs) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/zstd/contrib/cleanTabs Sat May 6 10:26:40 2017 (r317877, copy of r317876, vendor/zstd/dist/contrib/cleanTabs) @@ -0,0 +1,2 @@ +#!/bin/sh +sed -i '' $'s/\t/ /g' ../lib/**/*.{h,c} ../programs/*.{h,c} ../tests/*.c ./**/*.{h,cpp} ../examples/*.c ../zlibWrapper/*.{h,c} Modified: head/contrib/zstd/contrib/pzstd/Options.cpp ============================================================================== --- head/contrib/zstd/contrib/pzstd/Options.cpp Sat May 6 10:18:45 2017 (r317876) +++ head/contrib/zstd/contrib/pzstd/Options.cpp Sat May 6 10:26:40 2017 (r317877) @@ -91,7 +91,7 @@ void usage() { std::fprintf(stderr, " -# : # compression level (1-%d, default:%d)\n", kMaxNonUltraCompressionLevel, kDefaultCompressionLevel); std::fprintf(stderr, " -d, --decompress : decompression\n"); std::fprintf(stderr, " -o file : result stored into `file` (only if 1 input file)\n"); - std::fprintf(stderr, " -f, --force : overwrite output without prompting\n"); + std::fprintf(stderr, " -f, --force : overwrite output without prompting, (de)compress links\n"); std::fprintf(stderr, " --rm : remove source file(s) after successful (de)compression\n"); std::fprintf(stderr, " -k, --keep : preserve source file(s) (default)\n"); std::fprintf(stderr, " -h, --help : display help and exit\n"); @@ -121,6 +121,7 @@ Options::Status Options::parse(int argc, bool recursive = false; bool ultra = false; bool forceStdout = false; + bool followLinks = false; // Local copy of input files, which are pointers into argv. std::vector localInputFiles; for (int i = 1; i < argc; ++i) { @@ -255,6 +256,7 @@ Options::Status Options::parse(int argc, case 'f': overwrite = true; forceStdout = true; + followLinks = true; break; case 't': test = true; @@ -328,13 +330,29 @@ Options::Status Options::parse(int argc, } } + g_utilDisplayLevel = verbosity; + // Remove local input files that are symbolic links + if (!followLinks) { + std::remove_if(localInputFiles.begin(), localInputFiles.end(), + [&](const char *path) { + bool isLink = UTIL_isLink(path); + if (isLink && verbosity >= 2) { + std::fprintf( + stderr, + "Warning : %s is symbolic link, ignoring\n", + path); + } + return isLink; + }); + } + // Translate input files/directories into files to (de)compress if (recursive) { char *scratchBuffer = nullptr; unsigned numFiles = 0; const char **files = UTIL_createFileList(localInputFiles.data(), localInputFiles.size(), - &scratchBuffer, &numFiles); + &scratchBuffer, &numFiles, followLinks); if (files == nullptr) { std::fprintf(stderr, "Error traversing directories\n"); return Status::Failure; Modified: head/contrib/zstd/contrib/pzstd/utils/test/ThreadPoolTest.cpp ============================================================================== --- head/contrib/zstd/contrib/pzstd/utils/test/ThreadPoolTest.cpp Sat May 6 10:18:45 2017 (r317876) +++ head/contrib/zstd/contrib/pzstd/utils/test/ThreadPoolTest.cpp Sat May 6 10:26:40 2017 (r317877) @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -34,16 +35,19 @@ TEST(ThreadPool, AllJobsFinished) { std::atomic numFinished{0}; std::atomic start{false}; { + std::cerr << "Creating executor" << std::endl; ThreadPool executor(5); for (int i = 0; i < 10; ++i) { executor.add([ &numFinished, &start ] { while (!start.load()) { - // spin + std::this_thread::yield(); } ++numFinished; }); } + std::cerr << "Starting" << std::endl; start.store(true); + std::cerr << "Finishing" << std::endl; } EXPECT_EQ(10, numFinished.load()); } Modified: head/contrib/zstd/contrib/pzstd/utils/test/WorkQueueTest.cpp ============================================================================== --- head/contrib/zstd/contrib/pzstd/utils/test/WorkQueueTest.cpp Sat May 6 10:18:45 2017 (r317876) +++ head/contrib/zstd/contrib/pzstd/utils/test/WorkQueueTest.cpp Sat May 6 10:26:40 2017 (r317877) @@ -10,6 +10,7 @@ #include "utils/WorkQueue.h" #include +#include #include #include #include @@ -201,11 +202,13 @@ TEST(WorkQueue, BoundedSizeMPMC) { WorkQueue queue(10); std::vector results(200, -1); std::mutex mutex; + std::cerr << "Creating popperThreads" << std::endl; std::vector popperThreads; for (int i = 0; i < 4; ++i) { popperThreads.emplace_back(Popper{&queue, results.data(), &mutex}); } + std::cerr << "Creating pusherThreads" << std::endl; std::vector pusherThreads; for (int i = 0; i < 2; ++i) { auto min = i * 100; @@ -218,15 +221,19 @@ TEST(WorkQueue, BoundedSizeMPMC) { }); } + std::cerr << "Joining pusherThreads" << std::endl; for (auto& thread : pusherThreads) { thread.join(); } + std::cerr << "Finishing queue" << std::endl; queue.finish(); + std::cerr << "Joining popperThreads" << std::endl; for (auto& thread : popperThreads) { thread.join(); } + std::cerr << "Inspecting results" << std::endl; for (int i = 0; i < 200; ++i) { EXPECT_EQ(i, results[i]); } Modified: head/contrib/zstd/doc/educational_decoder/zstd_decompress.c ============================================================================== --- head/contrib/zstd/doc/educational_decoder/zstd_decompress.c Sat May 6 10:18:45 2017 (r317876) +++ head/contrib/zstd/doc/educational_decoder/zstd_decompress.c Sat May 6 10:26:40 2017 (r317877) @@ -27,16 +27,19 @@ size_t ZSTD_decompress_with_dict(void *c /// Get the decompressed size of an input stream so memory can be allocated in /// advance +/// Returns -1 if the size can't be determined size_t ZSTD_get_decompressed_size(const void *const src, const size_t src_len); /******* UTILITY MACROS AND TYPES *********************************************/ -// Max block size decompressed size is 128 KB and literal blocks must be smaller -// than that +// Max block size decompressed size is 128 KB and literal blocks can't be +// larger than their block #define MAX_LITERALS_SIZE ((size_t)128 * 1024) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) +/// This decoder calls exit(1) when it encounters an error, however a production +/// library should propagate error codes #define ERROR(s) \ do { \ fprintf(stderr, "Error: %s\n", s); \ @@ -67,29 +70,31 @@ typedef int64_t i64; /// decompression functions. /*** IO STREAM OPERATIONS *************/ -/// These structs are the interface for IO, and do bounds checking on all -/// operations. They should be used opaquely to ensure safety. -/// Output is always done byte-by-byte +/// ostream_t/istream_t are used to wrap the pointers/length data passed into +/// ZSTD_decompress, so that all IO operations are safely bounds checked +/// They are written/read forward, and reads are treated as little-endian +/// They should be used opaquely to ensure safety typedef struct { u8 *ptr; size_t len; } ostream_t; -/// Input often reads a few bits at a time, so maintain an internal offset typedef struct { const u8 *ptr; - int bit_offset; size_t len; + + // Input often reads a few bits at a time, so maintain an internal offset + int bit_offset; } istream_t; /// The following two functions are the only ones that allow the istream to be /// non-byte aligned /// Reads `num` bits from a bitstream, and updates the internal offset -static inline u64 IO_read_bits(istream_t *const in, const int num); -/// Rewinds the stream by `num` bits -static inline void IO_rewind_bits(istream_t *const in, const int num); +static inline u64 IO_read_bits(istream_t *const in, const int num_bits); +/// Backs-up the stream by `num` bits so they can be read again +static inline void IO_rewind_bits(istream_t *const in, const int num_bits); /// If the remaining bits in a byte will be unused, advance to the end of the /// byte static inline void IO_align_stream(istream_t *const in); @@ -101,30 +106,31 @@ static inline void IO_write_byte(ostream /// be byte aligned. static inline size_t IO_istream_len(const istream_t *const in); -/// Returns a pointer where `len` bytes can be read, and advances the internal -/// state. The stream must be byte aligned. +/// Advances the stream by `len` bytes, and returns a pointer to the chunk that +/// was skipped. The stream must be byte aligned. static inline const u8 *IO_read_bytes(istream_t *const in, size_t len); -/// Returns a pointer where `len` bytes can be written, and advances the internal -/// state. The stream must be byte aligned. +/// Advances the stream by `len` bytes, and returns a pointer to the chunk that +/// was skipped so it can be written to. static inline u8 *IO_write_bytes(ostream_t *const out, size_t len); /// Advance the inner state by `len` bytes. The stream must be byte aligned. static inline void IO_advance_input(istream_t *const in, size_t len); -/// Returns an `ostream_t` constructed from the given pointer and length +/// Returns an `ostream_t` constructed from the given pointer and length. static inline ostream_t IO_make_ostream(u8 *out, size_t len); -/// Returns an `istream_t` constructed from the given pointer and length +/// Returns an `istream_t` constructed from the given pointer and length. static inline istream_t IO_make_istream(const u8 *in, size_t len); -/// Returns an `istream_t` with the same base as `in`, and length `len` -/// Then, advance `in` to account for the consumed bytes -/// `in` must be byte aligned +/// Returns an `istream_t` with the same base as `in`, and length `len`. +/// Then, advance `in` to account for the consumed bytes. +/// `in` must be byte aligned. static inline istream_t IO_make_sub_istream(istream_t *const in, size_t len); /*** END IO STREAM OPERATIONS *********/ /*** BITSTREAM OPERATIONS *************/ -/// Read `num` bits (up to 64) from `src + offset`, where `offset` is in bits -static inline u64 read_bits_LE(const u8 *src, const int num, +/// Read `num` bits (up to 64) from `src + offset`, where `offset` is in bits, +/// and return them interpreted as a little-endian unsigned integer. +static inline u64 read_bits_LE(const u8 *src, const int num_bits, const size_t offset); /// Read bits from the end of a HUF or FSE bitstream. `offset` is in bits, so @@ -136,9 +142,8 @@ static inline u64 STREAM_read_bits(const /*** END BITSTREAM OPERATIONS *********/ /*** BIT COUNTING OPERATIONS **********/ -/// Returns `x`, where `2^x` is the largest power of 2 less than or equal to -/// `num`, or `-1` if `num == 0`. -static inline int log2inf(const u64 num); +/// Returns the index of the highest set bit in `num`, or `-1` if `num == 0` +static inline int highest_set_bit(const u64 num); /*** END BIT COUNTING OPERATIONS ******/ /*** HUFFMAN PRIMITIVES ***************/ @@ -384,8 +389,8 @@ size_t ZSTD_decompress_with_dict(void *c parse_dictionary(&parsed_dict, (const u8 *)dict, dict_len); } - istream_t in = {(const u8 *)src, 0, src_len}; - ostream_t out = {(u8 *)dst, dst_len}; + istream_t in = IO_make_istream(src, src_len); + ostream_t out = IO_make_ostream(dst, dst_len); // "A content compressed by Zstandard is transformed into a Zstandard frame. // Multiple frames can be appended into a single file or stream. A frame is @@ -633,6 +638,7 @@ static void frame_context_apply_dict(fra FSE_copy_dtable(&ctx->of_dtable, &dict->of_dtable); FSE_copy_dtable(&ctx->ml_dtable, &dict->ml_dtable); + // Copy the repeated offsets memcpy(ctx->previous_offsets, dict->previous_offsets, sizeof(ctx->previous_offsets)); } @@ -668,7 +674,7 @@ static void decompress_data(frame_contex // number of bytes to read and copy." const u8 *const read_ptr = IO_read_bytes(in, block_len); u8 *const write_ptr = IO_write_bytes(out, block_len); - // + // Copy the raw data into the output memcpy(write_ptr, read_ptr, block_len); @@ -682,7 +688,7 @@ static void decompress_data(frame_contex const u8 *const read_ptr = IO_read_bytes(in, 1); u8 *const write_ptr = IO_write_bytes(out, block_len); - // Copy `block_len` copies of `streams->src[0]` to the output + // Copy `block_len` copies of `read_ptr[0]` to the output memset(write_ptr, read_ptr[0], block_len); ctx->current_total_output += block_len; @@ -751,7 +757,7 @@ static size_t decode_literals_compressed u8 **const literals, const int block_type, const int size_format); -static void decode_huf_table(istream_t *const in, HUF_dtable *const dtable); +static void decode_huf_table(HUF_dtable *const dtable, istream_t *const in); static void fse_decode_hufweights(ostream_t *weights, istream_t *const in, int *const num_symbs); @@ -894,12 +900,12 @@ static size_t decode_literals_compressed istream_t huf_stream = IO_make_sub_istream(in, compressed_size); if (block_type == 2) { - // Decode provided Huffman table + // Decode the provided Huffman table // "This section is only present when Literals_Block_Type type is // Compressed_Literals_Block (2)." HUF_free_dtable(&ctx->literals_dtable); - decode_huf_table(&huf_stream, &ctx->literals_dtable); + decode_huf_table(&ctx->literals_dtable, &huf_stream); } else { // If the previous Huffman table is being repeated, ensure it exists if (!ctx->literals_dtable.symbols) { @@ -922,13 +928,13 @@ static size_t decode_literals_compressed } // Decode the Huffman table description -static void decode_huf_table(istream_t *const in, HUF_dtable *const dtable) { - const u8 header = IO_read_bits(in, 8); - +static void decode_huf_table(HUF_dtable *const dtable, istream_t *const in) { // "All literal values from zero (included) to last present one (excluded) // are represented by Weight with values from 0 to Max_Number_of_Bits." // "This is a single byte value (0-255), which describes how to decode the list of weights." + const u8 header = IO_read_bits(in, 8); + u8 weights[HUF_MAX_SYMBS]; memset(weights, 0, sizeof(weights)); @@ -997,7 +1003,7 @@ typedef struct { u16 ll_state; u16 of_state; u16 ml_state; -} sequence_state_t; +} sequence_states_t; /// Different modes to signal to decode_seq_tables what to do typedef enum { @@ -1052,10 +1058,10 @@ static void decompress_sequences(frame_c istream_t *const in, sequence_command_t *const sequences, const size_t num_sequences); -static sequence_command_t decode_sequence(sequence_state_t *const state, +static sequence_command_t decode_sequence(sequence_states_t *const state, const u8 *const src, i64 *const offset); -static void decode_seq_table(istream_t *const in, FSE_dtable *const table, +static void decode_seq_table(FSE_dtable *const table, istream_t *const in, const seq_part_t type, const seq_mode_t mode); static size_t decode_sequences(frame_context_t *const ctx, istream_t *in, @@ -1131,34 +1137,33 @@ static void decompress_sequences(frame_c // Offsets // Match Lengths" // Update the tables we have stored in the context - decode_seq_table(in, &ctx->ll_dtable, seq_literal_length, + decode_seq_table(&ctx->ll_dtable, in, seq_literal_length, (compression_modes >> 6) & 3); - decode_seq_table(in, &ctx->of_dtable, seq_offset, + decode_seq_table(&ctx->of_dtable, in, seq_offset, (compression_modes >> 4) & 3); - decode_seq_table(in, &ctx->ml_dtable, seq_match_length, + decode_seq_table(&ctx->ml_dtable, in, seq_match_length, (compression_modes >> 2) & 3); - // Check to make sure none of the tables are uninitialized - if (!ctx->ll_dtable.symbols || !ctx->of_dtable.symbols || - !ctx->ml_dtable.symbols) { - CORRUPTION(); - } - sequence_state_t state; - // Copy the context's tables into the local state - memcpy(&state.ll_table, &ctx->ll_dtable, sizeof(FSE_dtable)); - memcpy(&state.of_table, &ctx->of_dtable, sizeof(FSE_dtable)); - memcpy(&state.ml_table, &ctx->ml_dtable, sizeof(FSE_dtable)); + sequence_states_t states; + + // Initialize the decoding tables + { + states.ll_table = ctx->ll_dtable; + states.of_table = ctx->of_dtable; + states.ml_table = ctx->ml_dtable; + } - size_t len = IO_istream_len(in); + const size_t len = IO_istream_len(in); const u8 *const src = IO_read_bytes(in, len); // "After writing the last bit containing information, the compressor writes // a single 1-bit and then fills the byte with 0-7 0 bits of padding." - const int padding = 8 - log2inf(src[len - 1]); - i64 offset = len * 8 - padding; + const int padding = 8 - highest_set_bit(src[len - 1]); + // The offset starts at the end because FSE streams are read backwards + i64 bit_offset = len * 8 - padding; // "The bitstream starts with initial state values, each using the required // number of bits in their respective accuracy, decoded previously from @@ -1166,24 +1171,22 @@ static void decompress_sequences(frame_c // // It starts by Literals_Length_State, followed by Offset_State, and finally // Match_Length_State." - FSE_init_state(&state.ll_table, &state.ll_state, src, &offset); - FSE_init_state(&state.of_table, &state.of_state, src, &offset); - FSE_init_state(&state.ml_table, &state.ml_state, src, &offset); + FSE_init_state(&states.ll_table, &states.ll_state, src, &bit_offset); + FSE_init_state(&states.of_table, &states.of_state, src, &bit_offset); + FSE_init_state(&states.ml_table, &states.ml_state, src, &bit_offset); for (size_t i = 0; i < num_sequences; i++) { // Decode sequences one by one - sequences[i] = decode_sequence(&state, src, &offset); + sequences[i] = decode_sequence(&states, src, &bit_offset); } - if (offset != 0) { + if (bit_offset != 0) { CORRUPTION(); } - - // Don't free tables so they can be used in the next block } // Decode a single sequence and update the state -static sequence_command_t decode_sequence(sequence_state_t *const state, +static sequence_command_t decode_sequence(sequence_states_t *const states, const u8 *const src, i64 *const offset) { // "Each symbol is a code in its own context, which specifies Baseline and @@ -1191,9 +1194,9 @@ static sequence_command_t decode_sequenc // additional bits in the same bitstream." // Decode symbols, but don't update states - const u8 of_code = FSE_peek_symbol(&state->of_table, state->of_state); - const u8 ll_code = FSE_peek_symbol(&state->ll_table, state->ll_state); - const u8 ml_code = FSE_peek_symbol(&state->ml_table, state->ml_state); + const u8 of_code = FSE_peek_symbol(&states->of_table, states->of_state); + const u8 ll_code = FSE_peek_symbol(&states->ll_table, states->ll_state); + const u8 ml_code = FSE_peek_symbol(&states->ml_table, states->ml_state); // Offset doesn't need a max value as it's not decoded using a table if (ll_code > SEQ_MAX_CODES[seq_literal_length] || @@ -1221,17 +1224,18 @@ static sequence_command_t decode_sequenc // then Offset_State." // If the stream is complete don't read bits to update state if (*offset != 0) { - FSE_update_state(&state->ll_table, &state->ll_state, src, offset); - FSE_update_state(&state->ml_table, &state->ml_state, src, offset); - FSE_update_state(&state->of_table, &state->of_state, src, offset); + FSE_update_state(&states->ll_table, &states->ll_state, src, offset); + FSE_update_state(&states->ml_table, &states->ml_state, src, offset); + FSE_update_state(&states->of_table, &states->of_state, src, offset); } return seq; } /// Given a sequence part and table mode, decode the FSE distribution -static void decode_seq_table(istream_t *const in, FSE_dtable *const table, - const seq_part_t type, const seq_mode_t mode) { +/// Errors if the mode is `seq_repeat` without a pre-existing table in `table` +static void decode_seq_table(FSE_dtable *const table, istream_t *const in, + const seq_part_t type, const seq_mode_t mode) { // Constant arrays indexed by seq_part_t const i16 *const default_distributions[] = {SEQ_LITERAL_LENGTH_DEFAULT_DIST, SEQ_OFFSET_DEFAULT_DIST, @@ -1272,12 +1276,17 @@ static void decode_seq_table(istream_t * // "Repeat_Mode : re-use distribution table from previous compressed // block." // Nothing to do here, table will be unchanged + if (!table->symbols) { + // This mode is invalid if we don't already have a table + CORRUPTION(); + } break; default: // Impossible, as mode is from 0-3 IMPOSSIBLE(); break; } + } /******* END SEQUENCE DECODING ************************************************/ @@ -1296,6 +1305,8 @@ static void execute_sequences(frame_cont const sequence_command_t seq = sequences[i]; { + // If the sequence asks for more literals than are left, the + // sequence must be corrupted if (seq.literal_length > IO_istream_len(&litstream)) { CORRUPTION(); } @@ -1336,7 +1347,8 @@ static void execute_sequences(frame_cont // as per the exception listed above offset = idx < 3 ? offset_hist[idx] : offset_hist[0] - 1; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat May 6 10:28:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7930D5E5DF; Sat, 6 May 2017 10:28:59 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 330A71E3; Sat, 6 May 2017 10:28:58 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v46ASvAF090084; Sat, 6 May 2017 10:28:57 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v46ASv8b090083; Sat, 6 May 2017 10:28:57 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201705061028.v46ASv8b090083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 6 May 2017 10:28:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317878 - head/usr.bin/zstd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 10:29:00 -0000 Author: bapt Date: Sat May 6 10:28:57 2017 New Revision: 317878 URL: https://svnweb.freebsd.org/changeset/base/317878 Log: Add a zstdmt which is equivalent as running zstd -T0 Modified: head/usr.bin/zstd/Makefile Modified: head/usr.bin/zstd/Makefile ============================================================================== --- head/usr.bin/zstd/Makefile Sat May 6 10:26:40 2017 (r317877) +++ head/usr.bin/zstd/Makefile Sat May 6 10:28:57 2017 (r317878) @@ -16,9 +16,11 @@ CFLAGS+= -I${SRCTOP}/contrib/zstd/progra -DHAVE_THREAD=1 SCRIPTS= zstdgrep LINKS= ${BINDIR}/zstd ${BINDIR}/unzstd \ - ${BINDIR}/zstd ${BINDIR}/zstdcat + ${BINDIR}/zstd ${BINDIR}/zstdcat \ + ${BINDIR}/zstd ${BINDIR}/zstdmt MLINKS= zstd.1 unzstd.1 \ - zstd.1 zstdcat.1 + zstd.1 zstdcat.1 \ + zstd.1 zstdmt.1 WARNS= 2 LIBADD= zstd From owner-svn-src-head@freebsd.org Sat May 6 10:59:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AF89D5EEAA; Sat, 6 May 2017 10:59:12 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 074421B2C; Sat, 6 May 2017 10:59:11 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v46AxBOl002087; Sat, 6 May 2017 10:59:11 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v46AxAMw002082; Sat, 6 May 2017 10:59:10 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201705061059.v46AxAMw002082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 6 May 2017 10:59:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317879 - in head: lib/libzstd share/mk usr.bin/zstd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 10:59:12 -0000 Author: bapt Date: Sat May 6 10:59:10 2017 New Revision: 317879 URL: https://svnweb.freebsd.org/changeset/base/317879 Log: Build zstandard with threading enabled Modified: head/lib/libzstd/Makefile head/share/mk/src.libnames.mk head/usr.bin/zstd/Makefile Modified: head/lib/libzstd/Makefile ============================================================================== --- head/lib/libzstd/Makefile Sat May 6 10:28:57 2017 (r317878) +++ head/lib/libzstd/Makefile Sat May 6 10:59:10 2017 (r317879) @@ -22,7 +22,9 @@ SRCS= entropy_common.c \ zdict.c WARNS= 2 INCS= zstd.h -CFLAGS+= -I${ZSTDDIR}/lib -I${ZSTDDIR}/lib/common -DXXH_NAMESPACE=ZSTD_ +CFLAGS+= -I${ZSTDDIR}/lib -I${ZSTDDIR}/lib/common -DXXH_NAMESPACE=ZSTD_ \ + -DZSTD_MULTITHREAD=1 +LIBADD= pthread PRIVATELIB= yes Modified: head/share/mk/src.libnames.mk ============================================================================== --- head/share/mk/src.libnames.mk Sat May 6 10:28:57 2017 (r317878) +++ head/share/mk/src.libnames.mk Sat May 6 10:59:10 2017 (r317879) @@ -209,6 +209,7 @@ _LIBRARIES+= \ # 2nd+ order consumers. Auto-generating this would be better. _DP_80211= sbuf bsdxml _DP_archive= z bz2 lzma bsdxml +_DP_zstd= pthread .if ${MK_BLACKLIST} != "no" _DP_blacklist+= pthread .endif Modified: head/usr.bin/zstd/Makefile ============================================================================== --- head/usr.bin/zstd/Makefile Sat May 6 10:28:57 2017 (r317878) +++ head/usr.bin/zstd/Makefile Sat May 6 10:59:10 2017 (r317879) @@ -13,7 +13,8 @@ CFLAGS+= -I${SRCTOP}/contrib/zstd/progra -I${SRCTOP}/contrib/zstd/lib/dictBuilder \ -I${SRCTOP}/contrib/zstd/lib \ -DXXH_NAMESPACE=ZSTD_ \ - -DHAVE_THREAD=1 + -DHAVE_THREAD=1 \ + -DZSTD_MULTITHREAD=1 SCRIPTS= zstdgrep LINKS= ${BINDIR}/zstd ${BINDIR}/unzstd \ ${BINDIR}/zstd ${BINDIR}/zstdcat \ From owner-svn-src-head@freebsd.org Sat May 6 13:28:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E544ED61F13; Sat, 6 May 2017 13:28:43 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4F531AA; Sat, 6 May 2017 13:28:43 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v46DSguM064103; Sat, 6 May 2017 13:28:42 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v46DSgjY064098; Sat, 6 May 2017 13:28:42 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201705061328.v46DSgjY064098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 6 May 2017 13:28:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317882 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 13:28:44 -0000 Author: jilles Date: Sat May 6 13:28:42 2017 New Revision: 317882 URL: https://svnweb.freebsd.org/changeset/base/317882 Log: sh: Update TOUR and comments for some code changes, some of them old. Also, improve some terminology in TOUR and comments. Modified: head/bin/sh/TOUR head/bin/sh/eval.c head/bin/sh/exec.c head/bin/sh/expand.c head/bin/sh/options.c Modified: head/bin/sh/TOUR ============================================================================== --- head/bin/sh/TOUR Sat May 6 11:18:36 2017 (r317881) +++ head/bin/sh/TOUR Sat May 6 13:28:42 2017 (r317882) @@ -24,7 +24,7 @@ programs is: program input files generates ------- ----------- --------- - mkbuiltins builtins builtins.h builtins.c + mkbuiltins builtins.def builtins.h builtins.c mknodes nodetypes nodes.h nodes.c mksyntax - syntax.h syntax.c mktokens - token.h @@ -108,10 +108,12 @@ The text field of a NARG structure point word. The text consists of ordinary characters and a number of special codes defined in parser.h. The special codes are: - CTLVAR Variable substitution - CTLENDVAR End of variable substitution + CTLVAR Parameter expansion + CTLENDVAR End of parameter expansion CTLBACKQ Command substitution CTLBACKQ|CTLQUOTE Command substitution inside double quotes + CTLARI Arithmetic expansion + CTLENDARI End of arithmetic expansion CTLESC Escape next character A variable substitution contains the following elements: @@ -130,18 +132,31 @@ stitution. The possible types are: VSQUESTION|VSNUL ${var:?text} VSASSIGN ${var=text} VSASSIGN|VSNUL ${var:=text} + VSTRIMLEFT ${var#text} + VSTRIMLEFTMAX ${var##text} + VSTRIMRIGHT ${var%text} + VSTRIMRIGHTMAX ${var%%text} + VSLENGTH ${#var} + VSERROR delayed error In addition, the type field will have the VSQUOTE flag set if the -variable is enclosed in double quotes. The name of the variable -comes next, terminated by an equals sign. If the type is not -VSNORMAL, then the text field in the substitution follows, ter- -minated by a CTLENDVAR byte. +variable is enclosed in double quotes and the VSLINENO flag if +LINENO is being expanded (the parameter name is the decimal line +number). The parameter's name comes next, terminated by an equals +sign. If the type is not VSNORMAL (including when it is VSLENGTH), +then the text field in the substitution follows, terminated by a +CTLENDVAR byte. + +The type VSERROR is used to allow parsing bad substitutions like +${var[7]} and generate an error when they are expanded. Commands in back quotes are parsed and stored in a linked list. The locations of these commands in the string are indicated by CTLBACKQ and CTLBACKQ+CTLQUOTE characters, depending upon whether the back quotes were enclosed in double quotes. +Arithmetic expansion starts with CTLARI and ends with CTLENDARI. + The character CTLESC escapes the next character, so that in case any of the CTL characters mentioned above appear in the input, they can be passed through transparently. CTLESC is also used to @@ -153,11 +168,11 @@ right. In the case of here documents wh variable and command substitution, the parser doesn't insert any CTLESC characters to begin with (so the contents of the text field can be written without any processing). Other here docu- -ments, and words which are not subject to splitting and file name -generation, have the CTLESC characters removed during the vari- -able and command substitution phase. Words which are subject to -splitting and file name generation have the CTLESC characters re- -moved as part of the file name phase. +ments, and words which are not subject to file name generation, +have the CTLESC characters removed during the variable and command +substitution phase. Words which are subject to file name +generation have the CTLESC characters removed as part of the file +name phase. EXECUTION: Command execution is handled by the following files: eval.c The top level routines. @@ -199,10 +214,10 @@ later.) The routine shellexec is the interface to the exec system call. -EXPAND.C: Arguments are processed in three passes. The first -(performed by the routine argstr) performs variable and command -substitution. The second (ifsbreakup) performs word splitting -and the third (expandmeta) performs file name generation. +EXPAND.C: As the routine argstr generates words by parameter +expansion, command substitution and arithmetic expansion, it +performs word splitting on the result. As each word is output, +the routine expandmeta performs file name generation (if enabled). VAR.C: Variables are stored in a hash table. Probably we should switch to extensible hashing. The variable name is stored in the @@ -221,8 +236,8 @@ BUILTIN COMMANDS: The procedures for ha tered throughout the code, depending on which location appears most appropriate. They can be recognized because their names al- ways end in "cmd". The mapping from names to procedures is -specified in the file builtins, which is processed by the mkbuilt- -ins command. +specified in the file builtins.def, which is processed by the +mkbuiltins command. A builtin command is invoked with argc and argv set up like a normal program. A builtin command is allowed to overwrite its @@ -230,22 +245,20 @@ arguments. Builtin routines can call ne ing. This is kind of like getopt, but you don't pass argc and argv to it. Builtin routines can also call error. This routine normally terminates the shell (or returns to the main command -loop if the shell is interactive), but when called from a builtin -command it causes the builtin command to terminate with an exit -status of 2. +loop if the shell is interactive), but when called from a non- +special builtin command it causes the builtin command to +terminate with an exit status of 2. The directory bltins contains commands which can be compiled in- dependently but can also be built into the shell for efficiency -reasons. The makefile in this directory compiles these programs -in the normal fashion (so that they can be run regardless of -whether the invoker is ash), but also creates a library named -bltinlib.a which can be linked with ash. The header file bltin.h -takes care of most of the differences between the ash and the -stand-alone environment. The user should call the main routine -"main", and #define main to be the name of the routine to use -when the program is linked into ash. This #define should appear -before bltin.h is included; bltin.h will #undef main if the pro- -gram is to be compiled stand-alone. +reasons. The header file bltin.h takes care of most of the +differences between the ash and the stand-alone environment. +The user should call the main routine "main", and #define main to +be the name of the routine to use when the program is linked into +ash. This #define should appear before bltin.h is included; +bltin.h will #undef main if the program is to be compiled +stand-alone. A similar approach is used for a few utilities from +bin and usr.bin. CD.C: This file defines the cd and pwd builtins. @@ -258,7 +271,7 @@ is called at appropriate points to actua When an interrupt is caught and no trap has been set for that signal, the routine "onint" in error.c is called. -OUTPUT: Ash uses it's own output routines. There are three out- +OUTPUT: Ash uses its own output routines. There are three out- put structures allocated. "Output" represents the standard out- put, "errout" the standard error, and "memout" contains output which is to be stored in memory. This last is used when a buil- Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sat May 6 11:18:36 2017 (r317881) +++ head/bin/sh/eval.c Sat May 6 13:28:42 2017 (r317882) @@ -1222,7 +1222,7 @@ bltincmd(int argc, char **argv) return 127; } /* - * Preserve exitstatus of a previous possible redirection + * Preserve exitstatus of a previous possible command substitution * as POSIX mandates */ return exitstatus; Modified: head/bin/sh/exec.c ============================================================================== --- head/bin/sh/exec.c Sat May 6 11:18:36 2017 (r317881) +++ head/bin/sh/exec.c Sat May 6 13:28:42 2017 (r317882) @@ -338,7 +338,7 @@ find_command(const char *name, struct cm cd = 0; - /* If name is in the table, and not invalidated by cd, we're done */ + /* If name is in the table, we're done */ if ((cmdp = cmdlookup(name, 0)) != NULL) { if (cmdp->cmdtype == CMDFUNCTION && act & DO_NOFUNC) cmdp = NULL; @@ -485,8 +485,7 @@ changepath(const char *newval __unused) /* - * Clear out command entries. The argument specifies the first entry in - * PATH which has changed. + * Clear out cached utility locations. */ void Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Sat May 6 11:18:36 2017 (r317881) +++ head/bin/sh/expand.c Sat May 6 13:28:42 2017 (r317882) @@ -222,9 +222,9 @@ stputs_split(const char *data, const cha * The result is left in the stack string. * When arglist is NULL, perform here document expansion. * - * Caution: this function uses global state and is not reentrant. - * However, a new invocation after an interrupted invocation is safe - * and will reset the global state for the new call. + * When doing something that may cause this to be re-entered, make sure + * the stack string is empty via grabstackstr() and do not assume expdest + * remains valid. */ void expandarg(union node *arg, struct arglist *arglist, int flag) @@ -476,7 +476,7 @@ expbackq(union node *cmd, int quoted, in ifs = ifsset() ? ifsval() : " \t\n"; else ifs = ""; - /* Don't copy trailing newlines */ + /* Remove trailing newlines */ for (;;) { if (--in.nleft < 0) { if (in.fd < 0) @@ -821,7 +821,7 @@ evalvar(const char *p, struct nodelist * /* - * Test whether a specialized variable is set. + * Test whether a special or positional parameter is set. */ static int @@ -918,7 +918,7 @@ reprocess(int startloc, int flag, int su } /* - * Add the value of a specialized variable to the stack string. + * Add the value of a special or positional parameter to the stack string. */ static void Modified: head/bin/sh/options.c ============================================================================== --- head/bin/sh/options.c Sat May 6 11:18:36 2017 (r317881) +++ head/bin/sh/options.c Sat May 6 13:28:42 2017 (r317882) @@ -141,6 +141,8 @@ optschanged(void) /* * Process shell options. The global variable argptr contains a pointer * to the argument list; we advance it past the options. + * If cmdline is true, process the shell's argv; otherwise, process arguments + * to the set special builtin. */ static void @@ -392,7 +394,7 @@ shiftcmd(int argc, char **argv) /* - * The set command builtin. + * The set builtin command. */ int @@ -558,7 +560,7 @@ out: /* * Standard option processing (a la getopt) for builtin routines. The * only argument that is passed to nextopt is the option string; the - * other arguments are unnecessary. It return the character, or '\0' on + * other arguments are unnecessary. It returns the option, or '\0' on * end of input. */ From owner-svn-src-head@freebsd.org Sat May 6 17:37:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53221D61D2D; Sat, 6 May 2017 17:37:03 +0000 (UTC) (envelope-from mmokhi@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A40231A34; Sat, 6 May 2017 17:37:02 +0000 (UTC) (envelope-from mmokhi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v46Hb12l067179; Sat, 6 May 2017 17:37:01 GMT (envelope-from mmokhi@FreeBSD.org) Received: (from mmokhi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v46Hb1Aq067178; Sat, 6 May 2017 17:37:01 GMT (envelope-from mmokhi@FreeBSD.org) Message-Id: <201705061737.v46Hb1Aq067178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmokhi set sender to mmokhi@FreeBSD.org using -f From: Mahdi Mokhtari Date: Sat, 6 May 2017 17:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317884 - head/sys/compat/linprocfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 17:37:03 -0000 Author: mmokhi (ports committer) Date: Sat May 6 17:37:01 2017 New Revision: 317884 URL: https://svnweb.freebsd.org/changeset/base/317884 Log: Fix linprocfs_docpuinfo() output regarding to what newer Linux apps expect Reviewed by: trasz Approved by: trasz MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10274 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Sat May 6 16:06:33 2017 (r317883) +++ head/sys/compat/linprocfs/linprocfs.c Sat May 6 17:37:01 2017 (r317884) @@ -202,8 +202,9 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) char model[128]; uint64_t freq; size_t size; + u_int cache_size[4]; int fqmhz, fqkhz; - int i; + int i, j; /* * We default the flags to include all non-conflicting flags, @@ -219,27 +220,20 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) "3dnowext", "3dnow" }; + static char *power_flags[] = { + "ts", "fid", "vid", + "ttp", "tm", "stc", + "100mhzsteps", "hwpstate", "", + "cpb", "eff_freq_ro", "proc_feedback", + "acc_power", + }; + hw_model[0] = CTL_HW; hw_model[1] = HW_MODEL; model[0] = '\0'; size = sizeof(model); if (kernel_sysctl(td, hw_model, 2, &model, &size, 0, 0, 0, 0) != 0) strcpy(model, "unknown"); - for (i = 0; i < mp_ncpus; ++i) { - sbuf_printf(sb, - "processor\t: %d\n" - "vendor_id\t: %.20s\n" - "cpu family\t: %u\n" - "model\t\t: %u\n" - "model name\t: %s\n" - "stepping\t: %u\n\n", - i, cpu_vendor, CPUID_TO_FAMILY(cpu_id), - CPUID_TO_MODEL(cpu_id), model, cpu_id & CPUID_STEPPING); - /* XXX per-cpu vendor / class / model / id? */ - } - - sbuf_cat(sb, "flags\t\t:"); - #ifdef __i386__ switch (cpu_vendor_id) { case CPU_VENDOR_AMD: @@ -251,20 +245,70 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) break; } #endif - - for (i = 0; i < 32; i++) - if (cpu_feature & (1 << i)) - sbuf_printf(sb, " %s", flags[i]); - sbuf_cat(sb, "\n"); - freq = atomic_load_acq_64(&tsc_freq); - if (freq != 0) { - fqmhz = (freq + 4999) / 1000000; - fqkhz = ((freq + 4999) / 10000) % 100; + do_cpuid(0x80000006, cache_size); + for (i = 0; i < mp_ncpus; ++i) { + fqmhz = 0; + fqkhz = 0; + freq = atomic_load_acq_64(&tsc_freq); + if (freq != 0) { + fqmhz = (freq + 4999) / 1000000; + fqkhz = ((freq + 4999) / 10000) % 100; + } sbuf_printf(sb, + "processor\t: %d\n" + "vendor_id\t: %.20s\n" + "cpu family\t: %u\n" + "model\t\t: %u\n" + "model name\t: %s\n" + "stepping\t: %u\n" "cpu MHz\t\t: %d.%02d\n" - "bogomips\t: %d.%02d\n", - fqmhz, fqkhz, fqmhz, fqkhz); + "cache size\t: %d KB\n" + "physical id\t: %d\n" + "siblings\t: %d\n" + "core id\t\t: %d\n" + "cpu cores\t: %d\n" + "apicid\t\t: %d\n" + "initial apicid\t: %d\n" + "fpu\t\t: %s\n" + "fpu_exception\t: %s\n" + "cpuid level\t: %d\n" + "wp\t\t: %s\n", + i, cpu_vendor, CPUID_TO_FAMILY(cpu_id), + CPUID_TO_MODEL(cpu_id), model, cpu_id & CPUID_STEPPING, + fqmhz, fqkhz, + (cache_size[2] >> 16), 0, mp_ncpus, i, mp_ncpus, + i, i, /*cpu_id & CPUID_LOCAL_APIC_ID ??*/ + (cpu_feature & CPUID_FPU) ? "yes" : "no", "yes", + CPUID_TO_FAMILY(cpu_id), "yes"); + sbuf_cat(sb, "flags\t\t:"); + for (j = 0; j < nitems(flags); j++) + if (cpu_feature & (1 << j)) + sbuf_printf(sb, " %s", flags[j]); + sbuf_cat(sb, "\n"); + sbuf_printf(sb, + "bugs\t\t: %s\n" + "bogomips\t: %d.%02d\n" + "clflush size\t: %d\n" + "cache_alignment\t: %d\n" + "address sizes\t: %d bits physical, %d bits virtual\n", +#if defined(I586_CPU) && !defined(NO_F00F_HACK) + (has_f00f_bug) ? "Intel F00F" : "", +#else + "", +#endif + fqmhz, fqkhz, + cpu_clflush_line_size, cpu_clflush_line_size, + cpu_maxphyaddr, + (cpu_maxphyaddr > 32) ? 48 : 0); + sbuf_cat(sb, "power management: "); + for (j = 0; j < nitems(power_flags); j++) + if (amd_pminfo & (1 << j)) + sbuf_printf(sb, " %s", power_flags[j]); + sbuf_cat(sb, "\n\n"); + + /* XXX per-cpu vendor / class / model / id? */ } + sbuf_cat(sb, "\n"); return (0); } From owner-svn-src-head@freebsd.org Sat May 6 17:55:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4F2DD612CA; Sat, 6 May 2017 17:55:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B091DAB; Sat, 6 May 2017 17:55:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v46HtSuh023987 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 6 May 2017 20:55:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v46HtSuh023987 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v46HtSrI023985; Sat, 6 May 2017 20:55:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 6 May 2017 20:55:28 +0300 From: Konstantin Belousov To: Mahdi Mokhtari Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317884 - head/sys/compat/linprocfs Message-ID: <20170506175528.GZ1622@kib.kiev.ua> References: <201705061737.v46Hb1Aq067178@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201705061737.v46Hb1Aq067178@repo.freebsd.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 17:55:38 -0000 On Sat, May 06, 2017 at 05:37:01PM +0000, Mahdi Mokhtari wrote: > + do_cpuid(0x80000006, cache_size); Executing CPUID instruction on i386 without checking for CPUID support panics the kernel. Also, it is worth ensuring that the requested leaf is supported, otherwise nonsensical data would be printed. From owner-svn-src-head@freebsd.org Sat May 6 18:21:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F99DD61CD3; Sat, 6 May 2017 18:21:55 +0000 (UTC) (envelope-from mmokhi.fbsd@gmail.com) Received: from mail-ua0-f177.google.com (mail-ua0-f177.google.com [209.85.217.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0F640F84; Sat, 6 May 2017 18:21:54 +0000 (UTC) (envelope-from mmokhi.fbsd@gmail.com) Received: by mail-ua0-f177.google.com with SMTP id g49so23225012uaa.1; Sat, 06 May 2017 11:21:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=QPQdqU4ctV93WLVmrjdBAm5391kC0Y/LjQ/J42Pv/gM=; b=gn0rXjFMasNkjE89sQFWuMu5QhjRCC2MuO0FZha/J1R7CQ28AALdUCYYdNoEgx+zzo /9RiFJdxefllI9GRI6KIBFdE5W2x+TkTVOJ4mKLt8isC6YtEiYzFPsemSrA39OKOdVEI 1HlOdYFQEaAWM1hJGS+pJy3xfNY5eeemXOBOdlJ6ADT0Abzn0lBJZHRTLdvtNudZ6v5Y d5SlunE2Y0jiiMn7OKPS+/LNG6gU3KIfeVt9I/5UGhP9QgGimXL+AympDL9JQu3lGCBo uhAWI4yJcHK8Y5eZx+/0ShsCei3mLs/Xqd2+ROnvim7oiMNU8jsiHXFSOwuKf9JIlX+R PkPg== X-Gm-Message-State: AODbwcCkUmvaPpYq2qjKaoMbeiHETtmGqlPWO7koTfJH1CM4sQStgafJ j3mqrQ8q5tFUzA== X-Received: by 10.159.49.21 with SMTP id m21mr142287uab.64.1494094451438; Sat, 06 May 2017 11:14:11 -0700 (PDT) Received: from mail-ua0-f177.google.com (mail-ua0-f177.google.com. [209.85.217.177]) by smtp.gmail.com with ESMTPSA id p136sm3450337vke.9.2017.05.06.11.14.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 May 2017 11:14:11 -0700 (PDT) Received: by mail-ua0-f177.google.com with SMTP id g49so23177557uaa.1; Sat, 06 May 2017 11:14:11 -0700 (PDT) X-Received: by 10.176.91.20 with SMTP id u20mr11272498uae.138.1494094450926; Sat, 06 May 2017 11:14:10 -0700 (PDT) MIME-Version: 1.0 Reply-To: mmokhi@freebsd.org Received: by 10.103.3.130 with HTTP; Sat, 6 May 2017 11:14:10 -0700 (PDT) In-Reply-To: <20170506175528.GZ1622@kib.kiev.ua> References: <201705061737.v46Hb1Aq067178@repo.freebsd.org> <20170506175528.GZ1622@kib.kiev.ua> From: Mahdi Mokhtari Date: Sat, 6 May 2017 22:44:10 +0430 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r317884 - head/sys/compat/linprocfs To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 18:21:55 -0000 > Executing CPUID instruction on i386 without checking for CPUID support > panics the kernel. Thanks for hint. you mean I should first check if this platform supports 0x80000006 CPUID command or not? -- Best regards, MMokhi. From owner-svn-src-head@freebsd.org Sat May 6 18:35:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 967D7D61F95; Sat, 6 May 2017 18:35:02 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C4BB8A5; Sat, 6 May 2017 18:35:02 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v46IZ1I0091384; Sat, 6 May 2017 18:35:01 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v46IZ1uA091383; Sat, 6 May 2017 18:35:01 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201705061835.v46IZ1uA091383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 6 May 2017 18:35:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317885 - head/rescue/rescue X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 18:35:02 -0000 Author: bapt Date: Sat May 6 18:35:01 2017 New Revision: 317885 URL: https://svnweb.freebsd.org/changeset/base/317885 Log: Add zstd to the rescue binary Having zstd might be useful in rescue to be able to access to log files compressed by zstandard Suggested by: ian Modified: head/rescue/rescue/Makefile Modified: head/rescue/rescue/Makefile ============================================================================== --- head/rescue/rescue/Makefile Sat May 6 17:37:01 2017 (r317884) +++ head/rescue/rescue/Makefile Sat May 6 18:35:01 2017 (r317885) @@ -194,6 +194,10 @@ CRUNCH_ALIAS_less= more CRUNCH_PROGS_usr.bin+= xz CRUNCH_ALIAS_xz= unxz lzma unlzma xzcat lzcat +CRUNCH_PROGS_usr.bin+= zstd +CRUNCH_ALIAS_zstd= unzstd zstdcat zstdmt +CRUNCH_LIBS+= -lprivatezstd + CRUNCH_PROGS_usr.bin+= tar CRUNCH_LIBS+= -larchive .if ${MK_OPENSSL} != "no" From owner-svn-src-head@freebsd.org Sat May 6 19:24:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A349D61D35; Sat, 6 May 2017 19:24:00 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 469621862; Sat, 6 May 2017 19:24:00 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v46JNxZf011574; Sat, 6 May 2017 19:23:59 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v46JNwvG011568; Sat, 6 May 2017 19:23:58 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201705061923.v46JNwvG011568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 6 May 2017 19:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317886 - in head: lib/libstand sys/boot/common sys/boot/i386/libi386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 19:24:00 -0000 Author: bapt Date: Sat May 6 19:23:58 2017 New Revision: 317886 URL: https://svnweb.freebsd.org/changeset/base/317886 Log: distinguish NFS versus TFTP boot by rootpath Don't use DHCP 150 option to decide which protocol use to netboot. When root-path includes ip address - go thru NFS, if ip address not exists in root-path - go thru TFTP from server which ip address is in next-server. But there is one limitation - only one tftp server in network to provide loader and everything else. Does enybody use more than only one? Submitted by: kczekirda Sponsored by: Oktawave MFC after: 3 weeks Relnote: Yes Differential Revision: https://reviews.freebsd.org/D8740 Modified: head/lib/libstand/bootp.c head/lib/libstand/bootp.h head/lib/libstand/globals.c head/lib/libstand/net.h head/sys/boot/common/dev_net.c head/sys/boot/i386/libi386/pxe.c Modified: head/lib/libstand/bootp.c ============================================================================== --- head/lib/libstand/bootp.c Sat May 6 18:35:01 2017 (r317885) +++ head/lib/libstand/bootp.c Sat May 6 19:23:58 2017 (r317886) @@ -148,16 +148,15 @@ bootp(sock, flag) bp->bp_vend[8] = 9; bcopy("PXEClient", &bp->bp_vend[9], 9); bp->bp_vend[18] = TAG_PARAM_REQ; - bp->bp_vend[19] = 8; + bp->bp_vend[19] = 7; bp->bp_vend[20] = TAG_ROOTPATH; - bp->bp_vend[21] = TAG_TFTP_SERVER; - bp->bp_vend[22] = TAG_HOSTNAME; - bp->bp_vend[23] = TAG_SWAPSERVER; - bp->bp_vend[24] = TAG_GATEWAY; - bp->bp_vend[25] = TAG_SUBNET_MASK; - bp->bp_vend[26] = TAG_INTF_MTU; - bp->bp_vend[27] = TAG_SERVERID; - bp->bp_vend[28] = TAG_END; + bp->bp_vend[21] = TAG_HOSTNAME; + bp->bp_vend[22] = TAG_SWAPSERVER; + bp->bp_vend[23] = TAG_GATEWAY; + bp->bp_vend[24] = TAG_SUBNET_MASK; + bp->bp_vend[25] = TAG_INTF_MTU; + bp->bp_vend[26] = TAG_SERVERID; + bp->bp_vend[27] = TAG_END; } else bp->bp_vend[7] = TAG_END; #else @@ -438,10 +437,6 @@ vend_rfc1048(cp, len) bcopy(cp, &dhcp_serverip.s_addr, sizeof(dhcp_serverip.s_addr)); } - if (tag == TAG_TFTP_SERVER) { - bcopy(cp, &tftpip.s_addr, - sizeof(tftpip.s_addr)); - } #endif cp += size; } Modified: head/lib/libstand/bootp.h ============================================================================== --- head/lib/libstand/bootp.h Sat May 6 18:35:01 2017 (r317885) +++ head/lib/libstand/bootp.h Sat May 6 19:23:58 2017 (r317886) @@ -108,7 +108,6 @@ struct bootp { #define TAG_T2 ((unsigned char) 59) #define TAG_CLASSID ((unsigned char) 60) #define TAG_CLIENTID ((unsigned char) 61) -#define TAG_TFTP_SERVER ((unsigned char) 150) #endif #define TAG_END ((unsigned char) 255) Modified: head/lib/libstand/globals.c ============================================================================== --- head/lib/libstand/globals.c Sat May 6 18:35:01 2017 (r317885) +++ head/lib/libstand/globals.c Sat May 6 19:23:58 2017 (r317886) @@ -32,7 +32,6 @@ struct in_addr nameip; /* DNS server i struct in_addr rootip; /* root ip address */ struct in_addr swapip; /* swap ip address */ struct in_addr gateip; /* gateway ip address */ -struct in_addr tftpip; /* TFTP ip address */ n_long netmask = 0xffffff00; /* subnet or net mask */ u_int intf_mtu; /* interface mtu from bootp/dhcp */ int errno; /* our old friend */ Modified: head/lib/libstand/net.h ============================================================================== --- head/lib/libstand/net.h Sat May 6 18:35:01 2017 (r317885) +++ head/lib/libstand/net.h Sat May 6 19:23:58 2017 (r317886) @@ -91,7 +91,6 @@ extern struct in_addr rootip; extern struct in_addr swapip; extern struct in_addr gateip; extern struct in_addr nameip; -extern struct in_addr tftpip; extern n_long netmask; extern u_int intf_mtu; Modified: head/sys/boot/common/dev_net.c ============================================================================== --- head/sys/boot/common/dev_net.c Sat May 6 18:35:01 2017 (r317885) +++ head/sys/boot/common/dev_net.c Sat May 6 19:23:58 2017 (r317886) @@ -312,8 +312,11 @@ net_getparams(int sock) return (EIO); } exit: - if ((rootaddr = net_parse_rootpath()) != INADDR_NONE) + netproto = NET_TFTP; + if ((rootaddr = net_parse_rootpath()) != INADDR_NONE) { + netproto = NET_NFS; rootip.s_addr = rootaddr; + } #ifdef NETIF_DEBUG if (debug) { @@ -365,13 +368,6 @@ net_parse_rootpath() int i; n_long addr = INADDR_NONE; - netproto = NET_NFS; - - if (tftpip.s_addr != 0) { - netproto = NET_TFTP; - addr = tftpip.s_addr; - } - for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) if (rootpath[i] == ':') break; Modified: head/sys/boot/i386/libi386/pxe.c ============================================================================== --- head/sys/boot/i386/libi386/pxe.c Sat May 6 18:35:01 2017 (r317885) +++ head/sys/boot/i386/libi386/pxe.c Sat May 6 19:23:58 2017 (r317886) @@ -309,13 +309,9 @@ pxe_open(struct open_file *f, ...) if (servip.s_addr == 0) servip = rootip; - netproto = NET_NFS; - if (tftpip.s_addr != 0) { - netproto = NET_TFTP; - rootip.s_addr = tftpip.s_addr; - } + netproto = NET_TFTP; - if (netproto == NET_NFS && !rootpath[0]) + if (!rootpath[0]) strcpy(rootpath, PXENFSROOTPATH); for (i = 0; rootpath[i] != '\0' && i < FNAME_SIZE; i++) @@ -323,8 +319,10 @@ pxe_open(struct open_file *f, ...) break; if (i && i != FNAME_SIZE && rootpath[i] == ':') { rootpath[i++] = '\0'; - if (inet_addr(&rootpath[0]) != INADDR_NONE) + if (inet_addr(&rootpath[0]) != INADDR_NONE) { + netproto = NET_NFS; rootip.s_addr = inet_addr(&rootpath[0]); + } bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i]) + 1); bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i]) + 1); } From owner-svn-src-head@freebsd.org Sat May 6 19:26:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE02ED61DC3; Sat, 6 May 2017 19:26:50 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B49F5336; Sat, 6 May 2017 19:26:50 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by freefall.freebsd.org (Postfix, from userid 1235) id D052A7844; Sat, 6 May 2017 19:26:39 +0000 (UTC) Date: Sat, 6 May 2017 21:26:39 +0200 From: Baptiste Daroussin To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317886 - in head: lib/libstand sys/boot/common sys/boot/i386/libi386 Message-ID: <20170506192639.fgnk3icvlseucjdt@ivaldir.net> References: <201705061923.v46JNwvG011568@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qu4vzv4jzzbsmmw6" Content-Disposition: inline In-Reply-To: <201705061923.v46JNwvG011568@repo.freebsd.org> User-Agent: NeoMutt/20170421 (1.8.2) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 19:26:51 -0000 --qu4vzv4jzzbsmmw6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 06, 2017 at 07:23:58PM +0000, Baptiste Daroussin wrote: > Author: bapt > Date: Sat May 6 19:23:58 2017 > New Revision: 317886 > URL: https://svnweb.freebsd.org/changeset/base/317886 >=20 > Log: > distinguish NFS versus TFTP boot by rootpath > =20 > Don't use DHCP 150 option to decide which protocol use to netboot. When > root-path includes ip address - go thru NFS, if ip address not exists in > root-path - go thru TFTP from server which ip address is in next-server= =2E But > there is one limitation - only one tftp server in network to provide lo= ader and > everything else. Does enybody use more than only one? > =20 > Submitted by: kczekirda > Sponsored by: Oktawave > MFC after: 3 weeks > Relnote: Yes > Differential Revision: https://reviews.freebsd.org/D8740 Sorry I meant: https://reviews.freebsd.org/D10603 Best regards, Bapt --qu4vzv4jzzbsmmw6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAlkOI2AACgkQY4mL3PG3 Plo3ORAA1BcegBekdkJXrCRuiX3/dniaXXyV8lvxJS/MWe1ki6gilrhm0+TnQrHY L/wgxr7BVsssiNlKNerD1bO/uxJbEf3BcTEoqhhLZxf30Gs2KH0xJ18z3jhkeMwb 5mIuH+fQa4Twbkc9tH7EMq/SpYWjqqlYfqQ2GzPf54Hfcms+nat+OybFPeQqEhcv Waqp8C5bbmwb14DpRXzw5wWJnalV1X6NoeZihpQBIvh8r4GMFoKd5Dc+qQYSWoDu i7ttQY7kXXIUt+1su6ersSzTYqMSBDV5WG0szHFRfEH5Ve5x7VMTvIZ5WBiziq0F xoBYkaTQc6FK4CCEYT7D5BsMQJR+J800f1hzAvAdrZgNXoDiiaBX6MsqbDYXo5k/ Rw1lcBzPz7j0LOXgLStETPDoIWHkmvCQmqzpzLefJWqSwM8tKVLVI8S9fevi6vl/ r5t4Y6MVteYeBFp/ml/Vlydipy/lZFr0lBEcsgeqSy+WwtNqyt2wa2FhiHFB89B/ eBPca4NtghVGZJw4Fdgdn3+1khgPcMSp6SER1xGuML/Eg1uXnn/Ic/1h4tz0qxIM wJHzN7NjPlQbAT91yuzRbE41mV0EXKDxfTaEyTdzoyCXT+Htx/anODUKbMiwpfuQ L72oRUVwMUOADuAtt9Ar3on8qyvRcJRjQWW45lF4bCa8CBzBcgw= =XkSs -----END PGP SIGNATURE----- --qu4vzv4jzzbsmmw6-- From owner-svn-src-head@freebsd.org Sat May 6 19:27:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D060D61ED4; Sat, 6 May 2017 19:27:44 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E10EDA86; Sat, 6 May 2017 19:27:43 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by freefall.freebsd.org (Postfix, from userid 1235) id 7F4D37D71; Sat, 6 May 2017 19:27:40 +0000 (UTC) Date: Sat, 6 May 2017 21:27:40 +0200 From: Baptiste Daroussin To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317886 - in head: lib/libstand sys/boot/common sys/boot/i386/libi386 Message-ID: <20170506192740.5kekwxivdljccd57@ivaldir.net> References: <201705061923.v46JNwvG011568@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="n6boxshr7qtk7gsy" Content-Disposition: inline In-Reply-To: <201705061923.v46JNwvG011568@repo.freebsd.org> User-Agent: NeoMutt/20170421 (1.8.2) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 19:27:44 -0000 --n6boxshr7qtk7gsy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 06, 2017 at 07:23:58PM +0000, Baptiste Daroussin wrote: > Author: bapt > Date: Sat May 6 19:23:58 2017 > New Revision: 317886 > URL: https://svnweb.freebsd.org/changeset/base/317886 >=20 > Log: > distinguish NFS versus TFTP boot by rootpath > =20 > Don't use DHCP 150 option to decide which protocol use to netboot. When > root-path includes ip address - go thru NFS, if ip address not exists in > root-path - go thru TFTP from server which ip address is in next-server= =2E But > there is one limitation - only one tftp server in network to provide lo= ader and > everything else. Does enybody use more than only one? > =20 > Submitted by: kczekirda > Sponsored by: Oktawave > MFC after: 3 weeks > Relnote: Yes > Differential Revision: https://reviews.freebsd.org/D8740 Also reviewed and approved by: tsoome and bapt Best regards, Bapt --n6boxshr7qtk7gsy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAlkOI6wACgkQY4mL3PG3 PlqYkg/+I6C/lqkFU3qWxkiMpiGYejX5z6y1ecSYeZDME+CMvuH09c1L+oOyqWGl ykboOYBNNeHle0YI/J/1/qEdFNUxuP/fm7fpiEmPEKvLChJ5DCXO5Deb1D+qkEKB gPwJhv2G7RwaINuuoyTnYCjin39zkd/d1OikY3D8DAusgu3xBsY9Qc42xaNQ9UjH R90+w0a+OhkVLt4yX1xZbt9NQoOoqy92yl5kFojZ7f5p22xTaYbjcR+nZpUAnscf yqwpGMM69nF0iaix2LWiM2of44+ZnjmkxMFrPJ+Z8wDIKWZPLudsBThR1kNs4g3b epEBOADmsOZ33lcwMcdelR7ul9TPAAwEljdXi8WYDESrn+Z6Ukm+zu6AEUGGej/2 cy+WffYvkwP3pT5rW85LzX0hVXMaorzQjugkoCTs3AGvW+aWOQFGV0VCDHPBQKw5 l0Tl/V33ZUhqbhYqWBttkGuZmKcKT7LJrlfUuNd5bkk68H1UyYFUBYHfWHvKaXlD jkdsOAQABL/jm/r5nmTwsQ577KySusILcVZ9uH/aPo7pGAtDB+NkxCTsQCu3MlU1 /MAwAJfjYZXA+ZASMLVUfD7KDWj5sIx8CxeKpugvjHMWqG6pChbNQPqnjWKrUPkS BZSAJuBKDQLfx0B2A0UbwgEhxOsD3OW/PS7cUf1ZKqa5WuOKmdI= =9w8X -----END PGP SIGNATURE----- --n6boxshr7qtk7gsy-- From owner-svn-src-head@freebsd.org Sat May 6 19:43:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D115DD613F6; Sat, 6 May 2017 19:43:15 +0000 (UTC) (envelope-from mmokhi.fbsd@gmail.com) Received: from mail-vk0-f52.google.com (mail-vk0-f52.google.com [209.85.213.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54CE4E8C; Sat, 6 May 2017 19:43:15 +0000 (UTC) (envelope-from mmokhi.fbsd@gmail.com) Received: by mail-vk0-f52.google.com with SMTP id y190so13331289vkc.1; Sat, 06 May 2017 12:43:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=z97pLmULrZhdrAeGepoRonEnG336nLbVYncMg4D5mAs=; b=JXsQnBSV3UjoApYGuFuTZOF8B5UfqybOXMOmfvRTr5dhdwVR6+NBDQPQs1WbHXicRO CrM+O0B19VI5wzbyWV52AM80n6kP9fIk8y1dB46yzTMojKgPT7p040fDlITKDRdR16A/ v5HgdakNxl87ot7Z7qIbQfrt5BfHuFDxeyHLXDXB2XCzU+BXM69rWmUrawz/EIXudrCU oPHIu8WWbIlkUJOl1GmWPSrErMAt0fmVa1C0p5fN9EOUQJAdSuH3FsIpbc1bR1jNpNBs n0Ahu0ZXehxPSK80BvMt5bbx+fB9FGohn4ygAJL0y3tTDWzzkC3ymtOGe1NDMt8929fh lCBA== X-Gm-Message-State: AODbwcCvJiXsVcf5PmZLq+UTFAS31Uq7x5dAcjI23y/Icu92zM3C/Eg7 YpgB986Nns9ALfhUcsk= X-Received: by 10.31.206.198 with SMTP id e189mr3383403vkg.41.1494096203975; Sat, 06 May 2017 11:43:23 -0700 (PDT) Received: from mail-ua0-f181.google.com (mail-ua0-f181.google.com. [209.85.217.181]) by smtp.gmail.com with ESMTPSA id d33sm2771651uad.16.2017.05.06.11.43.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 06 May 2017 11:43:23 -0700 (PDT) Received: by mail-ua0-f181.google.com with SMTP id g49so23350331uaa.1; Sat, 06 May 2017 11:43:23 -0700 (PDT) X-Received: by 10.176.91.20 with SMTP id u20mr11318920uae.138.1494096203487; Sat, 06 May 2017 11:43:23 -0700 (PDT) MIME-Version: 1.0 Reply-To: mmokhi@freebsd.org Received: by 10.103.3.130 with HTTP; Sat, 6 May 2017 11:43:23 -0700 (PDT) In-Reply-To: References: <201705061737.v46Hb1Aq067178@repo.freebsd.org> <20170506175528.GZ1622@kib.kiev.ua> From: Mahdi Mokhtari Date: Sat, 6 May 2017 23:13:23 +0430 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r317884 - head/sys/compat/linprocfs To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 19:43:16 -0000 Also I think it worths saying, I've tested this running on a X86. It was not panic'd and printed data as expected. So you mean it's possible to panic on "some" cases because of CPUID support? -- Best regards, MMokhi. From owner-svn-src-head@freebsd.org Sat May 6 20:32:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B64AAD614C8; Sat, 6 May 2017 20:32:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 463C677A; Sat, 6 May 2017 20:32:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v46KWSfd040341; Sat, 6 May 2017 20:32:28 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v46KWRlF040330; Sat, 6 May 2017 20:32:27 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201705062032.v46KWRlF040330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 6 May 2017 20:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317887 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libi386 sys/boot/i386/loader sys/boot/ofw/libofw sys/boot/uboot/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 20:32:29 -0000 Author: tsoome Date: Sat May 6 20:32:27 2017 New Revision: 317887 URL: https://svnweb.freebsd.org/changeset/base/317887 Log: loader: network read rework The current read from network is working from up to down - we have some protocol needing the data from the network, so we build the buffer space for that protocol, add the extra space for headers and pass this buffer down to be filled by nif get call in hope, we have guessed the incoming packet size right. Amazingly enough this approach mostly does work, but not always... So, this update does work from down to up - we allocate buffer (based on MTU or frame size info), fill it up, and pass on for upper layers. The obvious problem is that when we should free the buffer - if at all. In the current implementation the upper layer will free the packet on error or when the packet is no longer needed. While working on the issue, the additional issue did pop up - the bios implementation does not have generic get/put interface but is using pxe udpsend/udpreceive instead. So the udp calls are gone and undi interface is implemented instead. Which in turn means slight other changes as we do not need to have duplicated pxe implementation and can just use dev_net. To align packet content, the actual read from nic is using shifted buffer by ETHER_ALIGN (2). Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D10232 Modified: head/lib/libstand/arp.c head/lib/libstand/bootp.c head/lib/libstand/bootp.h head/lib/libstand/bootparam.c head/lib/libstand/ether.c head/lib/libstand/net.c head/lib/libstand/net.h head/lib/libstand/netif.c head/lib/libstand/netif.h head/lib/libstand/nfs.c head/lib/libstand/rarp.c head/lib/libstand/rpc.c head/lib/libstand/rpc.h head/lib/libstand/tftp.c head/lib/libstand/udp.c head/sys/boot/common/dev_net.c head/sys/boot/efi/libefi/efinet.c head/sys/boot/efi/libefi/time.c head/sys/boot/efi/loader/Makefile head/sys/boot/i386/libi386/pxe.c head/sys/boot/i386/libi386/pxe.h head/sys/boot/i386/loader/Makefile head/sys/boot/ofw/libofw/ofw_net.c head/sys/boot/uboot/lib/net.c Modified: head/lib/libstand/arp.c ============================================================================== --- head/lib/libstand/arp.c Sat May 6 19:23:58 2017 (r317886) +++ head/lib/libstand/arp.c Sat May 6 20:32:27 2017 (r317887) @@ -65,17 +65,16 @@ int arp_num = 1; /* Local forwards */ static ssize_t arpsend(struct iodesc *, void *, size_t); -static ssize_t arprecv(struct iodesc *, void *, size_t, time_t); +static ssize_t arprecv(struct iodesc *, void **, void **, time_t); /* Broadcast an ARP packet, asking who has addr on interface d */ u_char * -arpwhohas(d, addr) - struct iodesc *d; - struct in_addr addr; +arpwhohas(struct iodesc *d, struct in_addr addr) { int i; struct ether_arp *ah; struct arp_list *al; + void *pkt; struct { struct ether_header eh; struct { @@ -83,13 +82,6 @@ arpwhohas(d, addr) u_char pad[18]; /* 60 - sizeof(...) */ } data; } wbuf; - struct { - struct ether_header eh; - struct { - struct ether_arp arp; - u_char pad[24]; /* extra space */ - } data; - } rbuf; /* Try for cached answer first */ for (i = 0, al = arp_list; i < arp_num; ++i, ++al) @@ -122,20 +114,24 @@ arpwhohas(d, addr) /* Store ip address in cache (incomplete entry). */ al->addr = addr; + pkt = NULL; + ah = NULL; i = sendrecv(d, arpsend, &wbuf.data, sizeof(wbuf.data), - arprecv, &rbuf.data, sizeof(rbuf.data)); + arprecv, &pkt, (void **)&ah); if (i == -1) { panic("arp: no response for %s\n", inet_ntoa(addr)); } /* Store ethernet address in cache */ - ah = &rbuf.data.arp; #ifdef ARP_DEBUG if (debug) { + struct ether_header *eh; + + eh = (struct ether_header *)((uintptr_t)pkt + ETHER_ALIGN); printf("arp: response from %s\n", - ether_sprintf(rbuf.eh.ether_shost)); + ether_sprintf(eh->ether_shost)); printf("arp: cacheing %s --> %s\n", inet_ntoa(addr), ether_sprintf(ah->arp_sha)); } @@ -143,14 +139,12 @@ arpwhohas(d, addr) MACPY(ah->arp_sha, al->ea); ++arp_num; + free(pkt); return (al->ea); } static ssize_t -arpsend(d, pkt, len) - struct iodesc *d; - void *pkt; - size_t len; +arpsend(struct iodesc *d, void *pkt, size_t len) { #ifdef ARP_DEBUG @@ -166,28 +160,27 @@ arpsend(d, pkt, len) * else -1 (and errno == 0) */ static ssize_t -arprecv(d, pkt, len, tleft) - struct iodesc *d; - void *pkt; - size_t len; - time_t tleft; +arprecv(struct iodesc *d, void **pkt, void **payload, time_t tleft) { ssize_t n; struct ether_arp *ah; u_int16_t etype; /* host order */ + void *ptr; #ifdef ARP_DEBUG if (debug) printf("arprecv: "); #endif - n = readether(d, pkt, len, tleft, &etype); + ptr = NULL; + n = readether(d, &ptr, (void **)&ah, tleft, &etype); errno = 0; /* XXX */ if (n == -1 || n < sizeof(struct ether_arp)) { #ifdef ARP_DEBUG if (debug) printf("bad len=%d\n", n); #endif + free(ptr); return (-1); } @@ -196,12 +189,11 @@ arprecv(d, pkt, len, tleft) if (debug) printf("not arp type=%d\n", etype); #endif + free(ptr); return (-1); } /* Ethernet address now checked in readether() */ - - ah = (struct ether_arp *)pkt; if (ah->arp_hrd != htons(ARPHRD_ETHER) || ah->arp_pro != htons(ETHERTYPE_IP) || ah->arp_hln != sizeof(ah->arp_sha) || @@ -211,6 +203,7 @@ arprecv(d, pkt, len, tleft) if (debug) printf("bad hrd/pro/hln/pln\n"); #endif + free(ptr); return (-1); } @@ -220,6 +213,7 @@ arprecv(d, pkt, len, tleft) printf("is request\n"); #endif arp_reply(d, ah); + free(ptr); return (-1); } @@ -228,6 +222,7 @@ arprecv(d, pkt, len, tleft) if (debug) printf("not ARP reply\n"); #endif + free(ptr); return (-1); } @@ -239,6 +234,7 @@ arprecv(d, pkt, len, tleft) if (debug) printf("unwanted address\n"); #endif + free(ptr); return (-1); } /* We don't care who the reply was sent to. */ @@ -248,6 +244,8 @@ arprecv(d, pkt, len, tleft) if (debug) printf("got it\n"); #endif + *pkt = ptr; + *payload = ah; return (n); } @@ -256,9 +254,7 @@ arprecv(d, pkt, len, tleft) * Notes: Re-uses buffer. Pad to length = 46. */ void -arp_reply(d, pkt) - struct iodesc *d; - void *pkt; /* the request */ +arp_reply(struct iodesc *d, void *pkt) { struct ether_arp *arp = pkt; Modified: head/lib/libstand/bootp.c ============================================================================== --- head/lib/libstand/bootp.c Sat May 6 19:23:58 2017 (r317886) +++ head/lib/libstand/bootp.c Sat May 6 20:32:27 2017 (r317887) @@ -38,6 +38,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -72,7 +73,7 @@ static char vm_cmu[4] = VM_CMU; /* Local forwards */ static ssize_t bootpsend(struct iodesc *, void *, size_t); -static ssize_t bootprecv(struct iodesc *, void *, size_t, time_t); +static ssize_t bootprecv(struct iodesc *, void **, void **, time_t); static int vend_rfc1048(u_char *, u_int); #ifdef BOOTP_VEND_CMU static void vend_cmu(u_char *); @@ -89,23 +90,21 @@ static void setenv_(u_char *cp, u_char static char expected_dhcpmsgtype = -1, dhcp_ok; struct in_addr dhcp_serverip; #endif +struct bootp *bootp_response; +size_t bootp_response_size; /* Fetch required bootp infomation */ void -bootp(sock, flag) - int sock; - int flag; +bootp(int sock, int flag) { + void *pkt; struct iodesc *d; struct bootp *bp; struct { u_char header[HEADER_SIZE]; struct bootp wbootp; } wbuf; - struct { - u_char header[HEADER_SIZE]; - struct bootp rbootp; - } rbuf; + struct bootp *rbootp; #ifdef BOOTP_DEBUG if (debug) @@ -175,8 +174,7 @@ bootp(sock, flag) if(sendrecv(d, bootpsend, bp, sizeof(*bp), - bootprecv, &rbuf.rbootp, sizeof(rbuf.rbootp)) - == -1) { + bootprecv, &pkt, (void **)&rbootp) == -1) { printf("bootp: no reply\n"); return; } @@ -187,7 +185,7 @@ bootp(sock, flag) bp->bp_vend[6] = DHCPREQUEST; bp->bp_vend[7] = TAG_REQ_ADDR; bp->bp_vend[8] = 4; - bcopy(&rbuf.rbootp.bp_yiaddr, &bp->bp_vend[9], 4); + bcopy(&rbootp->bp_yiaddr, &bp->bp_vend[9], 4); bp->bp_vend[13] = TAG_SERVERID; bp->bp_vend[14] = 4; bcopy(&dhcp_serverip.s_addr, &bp->bp_vend[15], 4); @@ -205,20 +203,21 @@ bootp(sock, flag) expected_dhcpmsgtype = DHCPACK; + free(pkt); if(sendrecv(d, bootpsend, bp, sizeof(*bp), - bootprecv, &rbuf.rbootp, sizeof(rbuf.rbootp)) - == -1) { + bootprecv, &pkt, (void **)&rbootp) == -1) { printf("DHCPREQUEST failed\n"); return; } } #endif - myip = d->myip = rbuf.rbootp.bp_yiaddr; - servip = rbuf.rbootp.bp_siaddr; - if(rootip.s_addr == INADDR_ANY) rootip = servip; - bcopy(rbuf.rbootp.bp_file, bootfile, sizeof(bootfile)); + myip = d->myip = rbootp->bp_yiaddr; + servip = rbootp->bp_siaddr; + if (rootip.s_addr == INADDR_ANY) + rootip = servip; + bcopy(rbootp->bp_file, bootfile, sizeof(bootfile)); bootfile[sizeof(bootfile) - 1] = '\0'; if (!netmask) { @@ -258,14 +257,12 @@ bootp(sock, flag) /* Bump xid so next request will be unique. */ ++d->xid; + free(pkt); } /* Transmit a bootp request */ static ssize_t -bootpsend(d, pkt, len) - struct iodesc *d; - void *pkt; - size_t len; +bootpsend(struct iodesc *d, void *pkt, size_t len) { struct bootp *bp; @@ -286,30 +283,25 @@ bootpsend(d, pkt, len) } static ssize_t -bootprecv(d, pkt, len, tleft) -struct iodesc *d; -void *pkt; -size_t len; -time_t tleft; +bootprecv(struct iodesc *d, void **pkt, void **payload, time_t tleft) { ssize_t n; struct bootp *bp; + void *ptr; -#ifdef BOOTP_DEBUGx +#ifdef BOOTP_DEBUG if (debug) printf("bootp_recvoffer: called\n"); #endif - n = readudp(d, pkt, len, tleft); + ptr = NULL; + n = readudp(d, &ptr, (void **)&bp, tleft); if (n == -1 || n < sizeof(struct bootp) - BOOTP_VENDSIZE) goto bad; - bp = (struct bootp *)pkt; - #ifdef BOOTP_DEBUG if (debug) - printf("bootprecv: checked. bp = 0x%lx, n = %d\n", - (long)bp, (int)n); + printf("bootprecv: checked. bp = %p, n = %zd\n", bp, n); #endif if (bp->bp_xid != htonl(d->xid)) { #ifdef BOOTP_DEBUG @@ -328,8 +320,21 @@ time_t tleft; /* Suck out vendor info */ if (bcmp(vm_rfc1048, bp->bp_vend, sizeof(vm_rfc1048)) == 0) { - if(vend_rfc1048(bp->bp_vend, sizeof(bp->bp_vend)) != 0) + int vsize = n - offsetof(struct bootp, bp_vend); + if (vend_rfc1048(bp->bp_vend, vsize) != 0) goto bad; + + /* Save copy of bootp reply or DHCP ACK message */ + if (bp->bp_op == BOOTREPLY && + ((dhcp_ok == 1 && expected_dhcpmsgtype == DHCPACK) || + dhcp_ok == 0)) { + free(bootp_response); + bootp_response = malloc(n); + if (bootp_response != NULL) { + bootp_response_size = n; + bcopy(bp, bootp_response, bootp_response_size); + } + } } #ifdef BOOTP_VEND_CMU else if (bcmp(vm_cmu, bp->bp_vend, sizeof(vm_cmu)) == 0) @@ -338,8 +343,11 @@ time_t tleft; else printf("bootprecv: unknown vendor 0x%lx\n", (long)bp->bp_vend); - return(n); + *pkt = ptr; + *payload = bp; + return (n); bad: + free(ptr); errno = 0; return (-1); } @@ -356,9 +364,7 @@ dhcp_try_rfc1048(u_char *cp, u_int len) } static int -vend_rfc1048(cp, len) - u_char *cp; - u_int len; +vend_rfc1048(u_char *cp, u_int len) { u_char *ep; int size; @@ -445,8 +451,7 @@ vend_rfc1048(cp, len) #ifdef BOOTP_VEND_CMU static void -vend_cmu(cp) - u_char *cp; +vend_cmu(u_char *cp) { struct cmu_vend *vp; Modified: head/lib/libstand/bootp.h ============================================================================== --- head/lib/libstand/bootp.h Sat May 6 19:23:58 2017 (r317886) +++ head/lib/libstand/bootp.h Sat May 6 20:32:27 2017 (r317887) @@ -147,6 +147,10 @@ struct cmu_vend { /* v_flags values */ #define VF_SMASK 1 /* Subnet mask field contains valid data */ +/* cached bootp response/dhcp ack */ +extern struct bootp *bootp_response; +extern size_t bootp_response_size; + int dhcp_try_rfc1048(u_char *cp, u_int len); #endif /* _BOOTP_H_ */ Modified: head/lib/libstand/bootparam.c ============================================================================== --- head/lib/libstand/bootparam.c Sat May 6 19:23:58 2017 (r317886) +++ head/lib/libstand/bootparam.c Sat May 6 20:32:27 2017 (r317887) @@ -104,8 +104,7 @@ int xdr_string_decode(char **p, char *st * know about us (don't want to broadcast a getport call). */ int -bp_whoami(sockfd) - int sockfd; +bp_whoami(int sockfd) { /* RPC structures for PMAPPROC_CALLIT */ struct args { @@ -126,22 +125,19 @@ bp_whoami(sockfd) n_long h[RPC_HEADER_WORDS]; struct args d; } sdata; - struct { - n_long h[RPC_HEADER_WORDS]; - struct repl d; - } rdata; char *send_tail, *recv_head; struct iodesc *d; - int len, x; + void *pkt; + int len, x, rc; RPC_PRINTF(("bp_whoami: myip=%s\n", inet_ntoa(myip))); + rc = -1; if (!(d = socktodesc(sockfd))) { RPC_PRINTF(("bp_whoami: bad socket. %d\n", sockfd)); - return (-1); + return (rc); } args = &sdata.d; - repl = &rdata.d; /* * Build request args for PMAPPROC_CALLIT. @@ -156,19 +152,19 @@ bp_whoami(sockfd) * append encapsulated data (client IP address) */ if (xdr_inaddr_encode(&send_tail, myip)) - return (-1); + return (rc); /* RPC: portmap/callit */ d->myport = htons(--rpc_port); d->destip.s_addr = INADDR_BROADCAST; /* XXX: subnet bcast? */ /* rpc_call will set d->destport */ + pkt = NULL; len = rpc_call(d, PMAPPROG, PMAPVERS, PMAPPROC_CALLIT, - args, send_tail - (char*)args, - repl, sizeof(*repl)); + args, send_tail - (char*)args, (void **)&repl, &pkt); if (len < 8) { printf("bootparamd: 'whoami' call failed\n"); - return (-1); + goto done; } /* Save bootparam server address (from IP header). */ @@ -196,7 +192,7 @@ bp_whoami(sockfd) x = ntohl(repl->encap_len); if (len < x) { printf("bp_whoami: short reply, %d < %d\n", len, x); - return (-1); + goto done; } recv_head = (char*) repl->capsule; @@ -204,24 +200,27 @@ bp_whoami(sockfd) hostnamelen = MAXHOSTNAMELEN-1; if (xdr_string_decode(&recv_head, hostname, &hostnamelen)) { RPC_PRINTF(("bp_whoami: bad hostname\n")); - return (-1); + goto done; } /* domain name */ domainnamelen = MAXHOSTNAMELEN-1; if (xdr_string_decode(&recv_head, domainname, &domainnamelen)) { RPC_PRINTF(("bp_whoami: bad domainname\n")); - return (-1); + goto done; } /* gateway address */ if (xdr_inaddr_decode(&recv_head, &gateip)) { RPC_PRINTF(("bp_whoami: bad gateway\n")); - return (-1); + goto done; } /* success */ - return(0); + rc = 0; +done: + free(pkt); + return (rc); } @@ -233,25 +232,18 @@ bp_whoami(sockfd) * server pathname */ int -bp_getfile(sockfd, key, serv_addr, pathname) - int sockfd; - char *key; - char *pathname; - struct in_addr *serv_addr; +bp_getfile(int sockfd, char *key, struct in_addr *serv_addr, char *pathname) { struct { n_long h[RPC_HEADER_WORDS]; n_long d[64]; } sdata; - struct { - n_long h[RPC_HEADER_WORDS]; - n_long d[128]; - } rdata; + void *pkt; char serv_name[FNAME_SIZE]; - char *send_tail, *recv_head; + char *rdata, *send_tail; /* misc... */ struct iodesc *d; - int sn_len, path_len, rlen; + int rc = -1, sn_len, path_len, rlen; if (!(d = socktodesc(sockfd))) { RPC_PRINTF(("bp_getfile: bad socket. %d\n", sockfd)); @@ -259,7 +251,6 @@ bp_getfile(sockfd, key, serv_addr, pathn } send_tail = (char*) sdata.d; - recv_head = (char*) rdata.d; /* * Build request message. @@ -281,17 +272,16 @@ bp_getfile(sockfd, key, serv_addr, pathn d->myport = htons(--rpc_port); d->destip = bp_server_addr; /* rpc_call will set d->destport */ - + pkt = NULL; rlen = rpc_call(d, BOOTPARAM_PROG, BOOTPARAM_VERS, BOOTPARAM_GETFILE, sdata.d, send_tail - (char*)sdata.d, - rdata.d, sizeof(rdata.d)); + (void **)&rdata, &pkt); if (rlen < 4) { RPC_PRINTF(("bp_getfile: short reply\n")); errno = EBADRPC; - return (-1); + goto done; } - recv_head = (char*) rdata.d; /* * Parse result message. @@ -299,26 +289,29 @@ bp_getfile(sockfd, key, serv_addr, pathn /* server name */ sn_len = FNAME_SIZE-1; - if (xdr_string_decode(&recv_head, serv_name, &sn_len)) { + if (xdr_string_decode(&rdata, serv_name, &sn_len)) { RPC_PRINTF(("bp_getfile: bad server name\n")); - return (-1); + goto done; } /* server IP address (mountd/NFS) */ - if (xdr_inaddr_decode(&recv_head, serv_addr)) { + if (xdr_inaddr_decode(&rdata, serv_addr)) { RPC_PRINTF(("bp_getfile: bad server addr\n")); - return (-1); + goto done; } /* server pathname */ path_len = MAXPATHLEN-1; - if (xdr_string_decode(&recv_head, pathname, &path_len)) { + if (xdr_string_decode(&rdata, pathname, &path_len)) { RPC_PRINTF(("bp_getfile: bad server path\n")); - return (-1); + goto done; } /* success */ - return(0); + rc = 0; +done: + free(pkt); + return (rc); } @@ -329,17 +322,14 @@ bp_getfile(sockfd, key, serv_addr, pathn int -xdr_string_encode(pkt, str, len) - char **pkt; - char *str; - int len; +xdr_string_encode(char **pkt, char *str, int len) { - u_int32_t *lenp; + uint32_t *lenp; char *datap; int padlen = (len + 3) & ~3; /* padded length */ /* The data will be int aligned. */ - lenp = (u_int32_t*) *pkt; + lenp = (uint32_t *) *pkt; *pkt += sizeof(*lenp); *lenp = htonl(len); @@ -351,18 +341,15 @@ xdr_string_encode(pkt, str, len) } int -xdr_string_decode(pkt, str, len_p) - char **pkt; - char *str; - int *len_p; /* bufsize - 1 */ +xdr_string_decode(char **pkt, char *str, int *len_p) { - u_int32_t *lenp; + uint32_t *lenp; char *datap; int slen; /* string length */ int plen; /* padded length */ /* The data will be int aligned. */ - lenp = (u_int32_t*) *pkt; + lenp = (uint32_t *) *pkt; *pkt += sizeof(*lenp); slen = ntohl(*lenp); plen = (slen + 3) & ~3; @@ -381,9 +368,7 @@ xdr_string_decode(pkt, str, len_p) int -xdr_inaddr_encode(pkt, ia) - char **pkt; - struct in_addr ia; /* network order */ +xdr_inaddr_encode(char **pkt, struct in_addr ia) { struct xdr_inaddr *xi; u_char *cp; @@ -414,9 +399,7 @@ xdr_inaddr_encode(pkt, ia) } int -xdr_inaddr_decode(pkt, ia) - char **pkt; - struct in_addr *ia; /* network order */ +xdr_inaddr_decode(char **pkt, struct in_addr *ia) { struct xdr_inaddr *xi; u_char *cp; Modified: head/lib/libstand/ether.c ============================================================================== --- head/lib/libstand/ether.c Sat May 6 19:23:58 2017 (r317886) +++ head/lib/libstand/ether.c Sat May 6 20:32:27 2017 (r317887) @@ -54,12 +54,7 @@ __FBSDID("$FreeBSD$"); /* Caller must leave room for ethernet header in front!! */ ssize_t -sendether(d, pkt, len, dea, etype) - struct iodesc *d; - void *pkt; - size_t len; - u_char *dea; - int etype; +sendether(struct iodesc *d, void *pkt, size_t len, uint8_t *dea, int etype) { ssize_t n; struct ether_header *eh; @@ -86,32 +81,31 @@ sendether(d, pkt, len, dea, etype) /* * Get a packet of any Ethernet type, with our address or - * the broadcast address. Save the Ether type in arg 5. - * NOTE: Caller must leave room for the Ether header. + * the broadcast address. Save the Ether type in etype. + * Unless there is an error, we pass the whole packet and the unencapsulated + * data. */ ssize_t -readether(d, pkt, len, tleft, etype) - struct iodesc *d; - void *pkt; - size_t len; - time_t tleft; - u_int16_t *etype; +readether(struct iodesc *d, void **pkt, void **payload, time_t tleft, + uint16_t *etype) { ssize_t n; struct ether_header *eh; + void *ptr; #ifdef ETHER_DEBUG if (debug) printf("readether: called\n"); #endif - eh = (struct ether_header *)pkt - 1; - len += sizeof(*eh); - - n = netif_get(d, eh, len, tleft); - if (n == -1 || n < sizeof(*eh)) + ptr = NULL; + n = netif_get(d, &ptr, tleft); + if (n == -1 || n < sizeof(*eh)) { + free(ptr); return (-1); + } + eh = (struct ether_header *)((uintptr_t)ptr + ETHER_ALIGN); /* Validate Ethernet address. */ if (bcmp(d->myea, eh->ether_dhost, 6) != 0 && bcmp(bcea, eh->ether_dhost, 6) != 0) { @@ -120,8 +114,12 @@ readether(d, pkt, len, tleft, etype) printf("readether: not ours (ea=%s)\n", ether_sprintf(eh->ether_dhost)); #endif + free(ptr); return (-1); } + + *pkt = ptr; + *payload = (void *)((uintptr_t)eh + sizeof(*eh)); *etype = ntohs(eh->ether_type); n -= sizeof(*eh); @@ -133,8 +131,7 @@ readether(d, pkt, len, tleft, etype) */ static char digits[] = "0123456789abcdef"; char * -ether_sprintf(ap) - u_char *ap; +ether_sprintf(u_char *ap) { int i; static char etherbuf[18]; Modified: head/lib/libstand/net.c ============================================================================== --- head/lib/libstand/net.c Sat May 6 19:23:58 2017 (r317886) +++ head/lib/libstand/net.c Sat May 6 20:32:27 2017 (r317887) @@ -70,10 +70,10 @@ __FBSDID("$FreeBSD$"); */ ssize_t sendrecv(struct iodesc *d, - ssize_t (*sproc)(struct iodesc *, void *, size_t), - void *sbuf, size_t ssize, - ssize_t (*rproc)(struct iodesc *, void *, size_t, time_t), - void *rbuf, size_t rsize) + ssize_t (*sproc)(struct iodesc *, void *, size_t), + void *sbuf, size_t ssize, + ssize_t (*rproc)(struct iodesc *, void **, void **, time_t), + void **pkt, void **payload) { ssize_t cc; time_t t, tmo, tlast; @@ -116,7 +116,7 @@ sendrecv(struct iodesc *d, } /* Try to get a packet and process it. */ - cc = (*rproc)(d, rbuf, rsize, tleft); + cc = (*rproc)(d, pkt, payload, tleft); /* Return on data, EOF or real error. */ if (cc != -1 || errno != 0) return (cc); Modified: head/lib/libstand/net.h ============================================================================== --- head/lib/libstand/net.h Sat May 6 19:23:58 2017 (r317886) +++ head/lib/libstand/net.h Sat May 6 20:32:27 2017 (r317887) @@ -106,16 +106,15 @@ int rarp_getipaddress(int); /* Link functions: */ ssize_t sendether(struct iodesc *d, void *pkt, size_t len, u_char *dea, int etype); -ssize_t readether(struct iodesc *d, void *pkt, size_t len, - time_t tleft, u_int16_t *etype); +ssize_t readether(struct iodesc *, void **, void **, time_t, uint16_t *); ssize_t sendudp(struct iodesc *, void *, size_t); -ssize_t readudp(struct iodesc *, void *, size_t, time_t); +ssize_t readudp(struct iodesc *, void **, void **, time_t); ssize_t sendrecv(struct iodesc *, - ssize_t (*)(struct iodesc *, void *, size_t), + ssize_t (*)(struct iodesc *, void *, size_t), void *, size_t, - ssize_t (*)(struct iodesc *, void *, size_t, time_t), - void *, size_t); + ssize_t (*)(struct iodesc *, void **, void **, time_t), + void **, void **); /* bootp/DHCP */ void bootp(int, int); Modified: head/lib/libstand/netif.c ============================================================================== --- head/lib/libstand/netif.c Sat May 6 19:23:58 2017 (r317886) +++ head/lib/libstand/netif.c Sat May 6 20:32:27 2017 (r317887) @@ -59,7 +59,7 @@ int netif_debug = 0; */ void -netif_init() +netif_init(void) { struct netif_driver *drv; int d, i; @@ -76,13 +76,11 @@ netif_init() } int -netif_match(nif, machdep_hint) - struct netif *nif; - void *machdep_hint; +netif_match(struct netif *nif, void *machdep_hint) { struct netif_driver *drv = nif->nif_driver; -#if 0 +#if NETIF_DEBUG if (netif_debug) printf("%s%d: netif_match (%d)\n", drv->netif_bname, nif->nif_unit, nif->nif_sel); @@ -91,8 +89,7 @@ netif_match(nif, machdep_hint) } struct netif * -netif_select(machdep_hint) - void *machdep_hint; +netif_select(void *machdep_hint) { int d, u, unit_done, s; struct netif_driver *drv; @@ -162,9 +159,7 @@ netif_select(machdep_hint) } int -netif_probe(nif, machdep_hint) - struct netif *nif; - void *machdep_hint; +netif_probe(struct netif *nif, void *machdep_hint) { struct netif_driver *drv = nif->nif_driver; @@ -176,10 +171,7 @@ netif_probe(nif, machdep_hint) } void -netif_attach(nif, desc, machdep_hint) - struct netif *nif; - struct iodesc *desc; - void *machdep_hint; +netif_attach(struct netif *nif, struct iodesc *desc, void *machdep_hint) { struct netif_driver *drv = nif->nif_driver; @@ -199,8 +191,7 @@ netif_attach(nif, desc, machdep_hint) } void -netif_detach(nif) - struct netif *nif; +netif_detach(struct netif *nif) { struct netif_driver *drv = nif->nif_driver; @@ -217,11 +208,7 @@ netif_detach(nif) } ssize_t -netif_get(desc, pkt, len, timo) - struct iodesc *desc; - void *pkt; - size_t len; - time_t timo; +netif_get(struct iodesc *desc, void **pkt, time_t timo) { #ifdef NETIF_DEBUG struct netif *nif = desc->io_netif; @@ -238,20 +225,17 @@ netif_get(desc, pkt, len, timo) panic("%s%d: no netif_get support\n", drv->netif_bname, nif->nif_unit); #endif - rv = drv->netif_get(desc, pkt, len, timo); + rv = drv->netif_get(desc, pkt, timo); #ifdef NETIF_DEBUG if (netif_debug) printf("%s%d: netif_get returning %d\n", drv->netif_bname, nif->nif_unit, (int)rv); #endif - return rv; + return (rv); } ssize_t -netif_put(desc, pkt, len) - struct iodesc *desc; - void *pkt; - size_t len; +netif_put(struct iodesc *desc, void *pkt, size_t len) { #ifdef NETIF_DEBUG struct netif *nif = desc->io_netif; @@ -274,12 +258,11 @@ netif_put(desc, pkt, len) printf("%s%d: netif_put returning %d\n", drv->netif_bname, nif->nif_unit, (int)rv); #endif - return rv; + return (rv); } struct iodesc * -socktodesc(sock) - int sock; +socktodesc(int sock) { if (sock >= SOPEN_MAX) { errno = EBADF; @@ -289,8 +272,7 @@ socktodesc(sock) } int -netif_open(machdep_hint) - void *machdep_hint; +netif_open(void *machdep_hint) { int fd; struct iodesc *s; @@ -313,23 +295,22 @@ fnd: printf("netboot: couldn't probe %s%d\n", nif->nif_driver->netif_bname, nif->nif_unit); errno = EINVAL; - return(-1); + return (-1); } netif_attach(nif, s, machdep_hint); - return(fd); + return (fd); } int -netif_close(sock) - int sock; +netif_close(int sock) { if (sock >= SOPEN_MAX) { errno = EBADF; - return(-1); + return (-1); } netif_detach(sockets[sock].io_netif); sockets[sock].io_netif = (struct netif *)0; - return(0); + return (0); } Modified: head/lib/libstand/netif.h ============================================================================== --- head/lib/libstand/netif.h Sat May 6 19:23:58 2017 (r317886) +++ head/lib/libstand/netif.h Sat May 6 20:32:27 2017 (r317887) @@ -6,15 +6,13 @@ #define __SYS_LIBNETBOOT_NETIF_H #include "iodesc.h" -#define NENTS(x) sizeof(x)/sizeof(x[0]) - struct netif_driver { const char *netif_bname; int (*netif_match)(struct netif *, void *); int (*netif_probe)(struct netif *, void *); void (*netif_init)(struct iodesc *, void *); - int (*netif_get)(struct iodesc *, void *, size_t, time_t); - int (*netif_put)(struct iodesc *, void *, size_t); + ssize_t (*netif_get)(struct iodesc *, void **, time_t); + ssize_t (*netif_put)(struct iodesc *, void *, size_t); void (*netif_end)(struct netif *); struct netif_dif *netif_ifs; int netif_nifs; @@ -56,7 +54,7 @@ struct netif *netif_select(void *); int netif_probe(struct netif *, void *); void netif_attach(struct netif *, struct iodesc *, void *); void netif_detach(struct netif *); -ssize_t netif_get(struct iodesc *, void *, size_t, time_t); +ssize_t netif_get(struct iodesc *, void **, time_t); ssize_t netif_put(struct iodesc *, void *, size_t); int netif_open(void *); Modified: head/lib/libstand/nfs.c ============================================================================== --- head/lib/libstand/nfs.c Sat May 6 19:23:58 2017 (r317886) +++ head/lib/libstand/nfs.c Sat May 6 20:32:27 2017 (r317887) @@ -185,6 +185,7 @@ set_nfs_read_size(void) int nfs_getrootfh(struct iodesc *d, char *path, uint32_t *fhlenp, u_char *fhp) { + void *pkt = NULL; int len; struct args { uint32_t len; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat May 6 21:43:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B51FD609D0; Sat, 6 May 2017 21:43:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5FAF18D5; Sat, 6 May 2017 21:43:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v46LhtSm068535; Sat, 6 May 2017 21:43:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v46Lhtv2068534; Sat, 6 May 2017 21:43:55 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201705062143.v46Lhtv2068534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 6 May 2017 21:43:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317888 - head/contrib/libc++/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 May 2017 21:43:57 -0000 Author: dim Date: Sat May 6 21:43:55 2017 New Revision: 317888 URL: https://svnweb.freebsd.org/changeset/base/317888 Log: Pull in r302362 from upstream libc++ trunk (by me): Ensure showbase does not overflow do_put buffers Summary: In https://bugs.freebsd.org/207918, Daniel McRobb describes how using std::showbase with ostreams can cause truncation of unsigned long long when output format is octal. In fact, this can even happen with unsigned int and unsigned long. To ensure this does not happen, add one additional character to the do_put buffers if std::showbase is on. Also add a test case. Reviewers: EricWF, mclow.lists Reviewed By: EricWF Subscribers: cfe-commits, emaste Differential Revision: https://reviews.llvm.org/D32670 PR: 207918 MFC after: 3 days Modified: head/contrib/libc++/include/locale Modified: head/contrib/libc++/include/locale ============================================================================== --- head/contrib/libc++/include/locale Sat May 6 20:32:27 2017 (r317887) +++ head/contrib/libc++/include/locale Sat May 6 21:43:55 2017 (r317888) @@ -1399,6 +1399,7 @@ num_put<_CharT, _OutputIterator>::do_put this->__format_int(__fmt+1, __len, true, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + 2; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1425,6 +1426,7 @@ num_put<_CharT, _OutputIterator>::do_put this->__format_int(__fmt+1, __len, true, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + 2; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1451,6 +1453,7 @@ num_put<_CharT, _OutputIterator>::do_put this->__format_int(__fmt+1, __len, false, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + 1; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); @@ -1477,6 +1480,7 @@ num_put<_CharT, _OutputIterator>::do_put this->__format_int(__fmt+1, __len, false, __iob.flags()); const unsigned __nbuf = (numeric_limits::digits / 3) + ((numeric_limits::digits % 3) != 0) + + ((__iob.flags() & ios_base::showbase) != 0) + 1; char __nar[__nbuf]; int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v);