From owner-svn-src-all@FreeBSD.ORG Sun May 24 00:53:45 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 61B095AE; Sun, 24 May 2015 00:53:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 4F9C8139E; Sun, 24 May 2015 00:53:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4O0rjDa013443; Sun, 24 May 2015 00:53:45 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4O0rhpe013434; Sun, 24 May 2015 00:53:43 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505240053.t4O0rhpe013434@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 24 May 2015 00:53:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283341 - in stable/10/sys: dev/usb/serial kern sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 00:53:45 -0000 Author: ian Date: Sun May 24 00:53:43 2015 New Revision: 283341 URL: https://svnweb.freebsd.org/changeset/base/283341 Log: MFC r279728, r279729, r279756, r279773, r282424, r281367: Add mutex support to the pps_ioctl() API in the kernel. Add PPS support to USB serial drivers. Use correct mode variable for PPS support. Switch polarity of USB serial PPS events. The ftdi "get latency" and "get bitmode" device commands are read operations, not writes. Implement a mechanism for making changes in the kernel<->driver PPS interface without breaking ABI or API compatibility with existing drivers. Bump version number to indicate the new PPS ABI version changes in the pps_state structure. Modified: stable/10/sys/dev/usb/serial/uftdi.c stable/10/sys/dev/usb/serial/usb_serial.c stable/10/sys/dev/usb/serial/usb_serial.h stable/10/sys/kern/kern_tc.c stable/10/sys/sys/param.h stable/10/sys/sys/timepps.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/serial/uftdi.c ============================================================================== --- stable/10/sys/dev/usb/serial/uftdi.c Sat May 23 23:35:19 2015 (r283340) +++ stable/10/sys/dev/usb/serial/uftdi.c Sun May 24 00:53:43 2015 (r283341) @@ -1703,7 +1703,7 @@ uftdi_get_bitmode(struct ucom_softc *uco struct uftdi_softc *sc = ucom->sc_parent; usb_device_request_t req; - req.bmRequestType = UT_WRITE_VENDOR_DEVICE; + req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = FTDI_SIO_GET_BITMODE; USETW(req.wIndex, sc->sc_ucom.sc_portno); @@ -1740,7 +1740,7 @@ uftdi_get_latency(struct ucom_softc *uco usb_error_t err; uint8_t buf; - req.bmRequestType = UT_WRITE_VENDOR_DEVICE; + req.bmRequestType = UT_READ_VENDOR_DEVICE; req.bRequest = FTDI_SIO_GET_LATENCY; USETW(req.wIndex, sc->sc_ucom.sc_portno); Modified: stable/10/sys/dev/usb/serial/usb_serial.c ============================================================================== --- stable/10/sys/dev/usb/serial/usb_serial.c Sat May 23 23:35:19 2015 (r283340) +++ stable/10/sys/dev/usb/serial/usb_serial.c Sun May 24 00:53:43 2015 (r283341) @@ -96,6 +96,11 @@ __FBSDID("$FreeBSD$"); static SYSCTL_NODE(_hw_usb, OID_AUTO, ucom, CTLFLAG_RW, 0, "USB ucom"); +static int ucom_pps_mode; + +SYSCTL_INT(_hw_usb_ucom, OID_AUTO, pps_mode, CTLFLAG_RWTUN, + &ucom_pps_mode, 0, "pulse capturing mode - 0/1/2 - disabled/CTS/DCD"); + #ifdef USB_DEBUG static int ucom_debug = 0; @@ -412,6 +417,11 @@ ucom_attach_tty(struct ucom_super_softc sc->sc_tty = tp; + sc->sc_pps.ppscap = PPS_CAPTUREBOTH; + sc->sc_pps.driver_abi = PPS_ABI_VERSION; + sc->sc_pps.driver_mtx = sc->sc_mtx; + pps_init_abi(&sc->sc_pps); + DPRINTF("ttycreate: %s\n", buf); /* Check if this device should be a console */ @@ -861,6 +871,8 @@ ucom_ioctl(struct tty *tp, u_long cmd, c } else { error = ENOIOCTL; } + if (error == ENOIOCTL) + error = pps_ioctl(cmd, data, &sc->sc_pps); break; } return (error); @@ -1064,7 +1076,7 @@ ucom_cfg_status_change(struct usb_proc_m struct tty *tp; uint8_t new_msr; uint8_t new_lsr; - uint8_t onoff; + uint8_t msr_delta; uint8_t lsr_delta; tp = sc->sc_tty; @@ -1088,15 +1100,42 @@ ucom_cfg_status_change(struct usb_proc_m /* TTY device closed */ return; } - onoff = ((sc->sc_msr ^ new_msr) & SER_DCD); + msr_delta = (sc->sc_msr ^ new_msr); lsr_delta = (sc->sc_lsr ^ new_lsr); sc->sc_msr = new_msr; sc->sc_lsr = new_lsr; - if (onoff) { + /* + * Time pulse counting support. Note that both CTS and DCD are + * active-low signals. The status bit is high to indicate that + * the signal on the line is low, which corresponds to a PPS + * clear event. + */ + switch(ucom_pps_mode) { + case 1: + if ((sc->sc_pps.ppsparam.mode & PPS_CAPTUREBOTH) && + (msr_delta & SER_CTS)) { + pps_capture(&sc->sc_pps); + pps_event(&sc->sc_pps, (sc->sc_msr & SER_CTS) ? + PPS_CAPTURECLEAR : PPS_CAPTUREASSERT); + } + break; + case 2: + if ((sc->sc_pps.ppsparam.mode & PPS_CAPTUREBOTH) && + (msr_delta & SER_DCD)) { + pps_capture(&sc->sc_pps); + pps_event(&sc->sc_pps, (sc->sc_msr & SER_DCD) ? + PPS_CAPTURECLEAR : PPS_CAPTUREASSERT); + } + break; + default: + break; + } + + if (msr_delta & SER_DCD) { - onoff = (sc->sc_msr & SER_DCD) ? 1 : 0; + int onoff = (sc->sc_msr & SER_DCD) ? 1 : 0; DPRINTF("DCD changed to %d\n", onoff); Modified: stable/10/sys/dev/usb/serial/usb_serial.h ============================================================================== --- stable/10/sys/dev/usb/serial/usb_serial.h Sat May 23 23:35:19 2015 (r283340) +++ stable/10/sys/dev/usb/serial/usb_serial.h Sun May 24 00:53:43 2015 (r283341) @@ -64,6 +64,7 @@ #include #include #include +#include /* Module interface related macros */ #define UCOM_MODVER 1 @@ -155,6 +156,8 @@ struct ucom_softc { struct ucom_cfg_task sc_line_state_task[2]; struct ucom_cfg_task sc_status_task[2]; struct ucom_param_task sc_param_task[2]; + /* pulse capturing support, PPS */ + struct pps_state sc_pps; /* Used to set "UCOM_FLAG_GP_DATA" flag: */ struct usb_proc_msg *sc_last_start_xfer; const struct ucom_callback *sc_callback; Modified: stable/10/sys/kern/kern_tc.c ============================================================================== --- stable/10/sys/kern/kern_tc.c Sat May 23 23:35:19 2015 (r283340) +++ stable/10/sys/kern/kern_tc.c Sun May 24 00:53:43 2015 (r283341) @@ -23,10 +23,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef FFCLOCK #include #include -#endif #include #include #include @@ -1462,6 +1460,17 @@ SYSCTL_PROC(_kern_timecounter, OID_AUTO, * RFC 2783 PPS-API implementation. */ +/* + * Return true if the driver is aware of the abi version extensions in the + * pps_state structure, and it supports at least the given abi version number. + */ +static inline int +abi_aware(struct pps_state *pps, int vers) +{ + + return ((pps->kcmode & KCMODE_ABIFLAG) && pps->driver_abi >= vers); +} + static int pps_fetch(struct pps_fetch_args *fapi, struct pps_state *pps) { @@ -1491,7 +1500,17 @@ pps_fetch(struct pps_fetch_args *fapi, s cseq = pps->ppsinfo.clear_sequence; while (aseq == pps->ppsinfo.assert_sequence && cseq == pps->ppsinfo.clear_sequence) { - err = tsleep(pps, PCATCH, "ppsfch", timo); + if (abi_aware(pps, 1) && pps->driver_mtx != NULL) { + if (pps->flags & PPSFLAG_MTX_SPIN) { + err = msleep_spin(pps, pps->driver_mtx, + "ppsfch", timo); + } else { + err = msleep(pps, pps->driver_mtx, PCATCH, + "ppsfch", timo); + } + } else { + err = tsleep(pps, PCATCH, "ppsfch", timo); + } if (err == EWOULDBLOCK && fapi->timeout.tv_sec == -1) { continue; } else if (err != 0) { @@ -1581,7 +1600,8 @@ pps_ioctl(u_long cmd, caddr_t data, stru return (EINVAL); if (kapi->edge & ~pps->ppscap) return (EINVAL); - pps->kcmode = kapi->edge; + pps->kcmode = (kapi->edge & KCMODE_EDGEMASK) | + (pps->kcmode & KCMODE_ABIFLAG); return (0); #else return (EOPNOTSUPP); @@ -1602,6 +1622,18 @@ pps_init(struct pps_state *pps) #ifdef FFCLOCK pps->ppscap |= PPS_TSCLK_MASK; #endif + pps->kcmode &= ~KCMODE_ABIFLAG; +} + +void +pps_init_abi(struct pps_state *pps) +{ + + pps_init(pps); + if (pps->driver_abi > 0) { + pps->kcmode |= KCMODE_ABIFLAG; + pps->kernel_abi = PPS_ABI_VERSION; + } } void Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Sat May 23 23:35:19 2015 (r283340) +++ stable/10/sys/sys/param.h Sun May 24 00:53:43 2015 (r283341) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1001515 /* Master, propagated to newvers */ +#define __FreeBSD_version 1001516 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: stable/10/sys/sys/timepps.h ============================================================================== --- stable/10/sys/sys/timepps.h Sat May 23 23:35:19 2015 (r283340) +++ stable/10/sys/sys/timepps.h Sun May 24 00:53:43 2015 (r283341) @@ -133,6 +133,15 @@ struct pps_kcbind_args { #ifdef _KERNEL +struct mtx; + +#define KCMODE_EDGEMASK 0x03 +#define KCMODE_ABIFLAG 0x80000000 /* Internal use: abi-aware driver. */ + +#define PPS_ABI_VERSION 1 + +#define PPSFLAG_MTX_SPIN 0x01 /* Driver mtx is MTX_SPIN type. */ + struct pps_state { /* Capture information. */ struct timehands *capth; @@ -148,11 +157,19 @@ struct pps_state { int ppscap; struct timecounter *ppstc; unsigned ppscount[3]; + /* + * The following fields are valid if the driver calls pps_init_abi(). + */ + uint16_t driver_abi; /* Driver sets before pps_init_abi(). */ + uint16_t kernel_abi; /* Kernel sets during pps_init_abi(). */ + struct mtx *driver_mtx; /* Optional, valid if non-NULL. */ + uint32_t flags; }; void pps_capture(struct pps_state *pps); void pps_event(struct pps_state *pps, int event); void pps_init(struct pps_state *pps); +void pps_init_abi(struct pps_state *pps); int pps_ioctl(unsigned long cmd, caddr_t data, struct pps_state *pps); void hardpps(struct timespec *tsp, long nsec); From owner-svn-src-all@FreeBSD.ORG Sun May 24 01:09:52 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4FCE1782; Sun, 24 May 2015 01:09:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 3E08114E5; Sun, 24 May 2015 01:09:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4O19q4M019197; Sun, 24 May 2015 01:09:52 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4O19qET019196; Sun, 24 May 2015 01:09:52 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505240109.t4O19qET019196@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 24 May 2015 01:09:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283342 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 01:09:52 -0000 Author: ian Date: Sun May 24 01:09:51 2015 New Revision: 283342 URL: https://svnweb.freebsd.org/changeset/base/283342 Log: MFC r280221: Update ucom(4) with information about the new PPS capture abilities. Modified: stable/10/share/man/man4/ucom.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/ucom.4 ============================================================================== --- stable/10/share/man/man4/ucom.4 Sun May 24 00:53:43 2015 (r283341) +++ stable/10/share/man/man4/ucom.4 Sun May 24 01:09:51 2015 (r283342) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 1, 2008 +.Dd March 11, 2015 .Dt UCOM 4 .Os .Sh NAME @@ -63,11 +63,34 @@ This means that normal programs such as or .Xr ppp 8 can be used to access the device. +.Sh Pulse Per Second (PPS) Timing Interface +The +.Nm +driver can capture PPS timing information as defined in RFC 2783. +The API, accessed via +.Xr ioctl 8 , +is available on the tty device. +To use the PPS capture feature with +.Xr ntpd 8 , +symlink the tty device to +.Va /dev/pps0. .Pp The -.Va portno -locater can be used to decide which port to use for devices that have -multiple external ports. +.Va hw.usb.ucom.pps_mode +sysctl configures the PPS capture mode. +It can be set in +.Xr loader.conf 5 +or +.Xr sysctl.conf 5 . +The following capture modes are available: +.Bl -tag -compact -offset "mmmm" -width "mmmm" +.It 0 +Capture disabled (default). +.It 1 +Capture pulses on the CTS line. +.It 2 +Capture pulses on the DCD line. +.El .Sh FILES .Bl -tag -width ".Pa /dev/cuaU?" .It Pa /dev/cuaU? From owner-svn-src-all@FreeBSD.ORG Sun May 24 01:48:34 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 50B97C85; Sun, 24 May 2015 01:48:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 321FE1897; Sun, 24 May 2015 01:48:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4O1mYFS038527; Sun, 24 May 2015 01:48:34 GMT (envelope-from pkelsey@FreeBSD.org) Received: (from pkelsey@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4O1mYVM038526; Sun, 24 May 2015 01:48:34 GMT (envelope-from pkelsey@FreeBSD.org) Message-Id: <201505240148.t4O1mYVM038526@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pkelsey set sender to pkelsey@FreeBSD.org using -f From: Patrick Kelsey Date: Sun, 24 May 2015 01:48:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283343 - stable/10/sys/dev/netmap X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 01:48:34 -0000 Author: pkelsey Date: Sun May 24 01:48:33 2015 New Revision: 283343 URL: https://svnweb.freebsd.org/changeset/base/283343 Log: MFC r282978: When a netmap process terminates without the full set of buffers it was granted via rings and ni_bufs_list_head represented in those rings and lists (e.g., via SIGKILL), those buffers are no longer available for subsequent users for the lifetime of the system. To mitigate this resource leak, reset the allocator state when the last ref to that allocator is released. Note that this only recovers leaked resources for an allocator when there are no longer any users of that allocator, so there remain circumstances in which leaked allocator resources may not ever be recovered - consider a set of multiple netmap processes that are all using the same allocator (say, the global allocator) where members of that set may be killed and restarted over time but at any given point there is one member of that set running. Modified: stable/10/sys/dev/netmap/netmap_mem2.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/netmap/netmap_mem2.c ============================================================================== --- stable/10/sys/dev/netmap/netmap_mem2.c Sun May 24 01:09:51 2015 (r283342) +++ stable/10/sys/dev/netmap/netmap_mem2.c Sun May 24 01:48:33 2015 (r283343) @@ -130,9 +130,9 @@ struct netmap_mem_d { /* the three allocators */ struct netmap_obj_pool pools[NETMAP_POOLS_NR]; - netmap_mem_config_t config; - netmap_mem_finalize_t finalize; - netmap_mem_deref_t deref; + netmap_mem_config_t config; /* called with NMA_LOCK held */ + netmap_mem_finalize_t finalize; /* called with NMA_LOCK held */ + netmap_mem_deref_t deref; /* called with NMA_LOCK held */ nm_memid_t nm_id; /* allocator identifier */ int nm_grp; /* iommu groupd id */ @@ -751,6 +751,12 @@ netmap_reset_obj_allocator(struct netmap u_int i; size_t sz = p->_clustsize; + /* + * Free each cluster allocated in + * netmap_finalize_obj_allocator(). The cluster start + * addresses are stored at multiples of p->_clusterentries + * in the lut. + */ for (i = 0; i < p->objtotal; i += p->_clustentries) { if (p->lut[i].vaddr) contigfree(p->lut[i].vaddr, sz, M_NETMAP); @@ -929,6 +935,7 @@ netmap_finalize_obj_allocator(struct net if (i % p->_clustentries == 0 && p->lut[i].vaddr) contigfree(p->lut[i].vaddr, n, M_NETMAP); + p->lut[i].vaddr = NULL; } out: p->objtotal = i; @@ -936,6 +943,17 @@ netmap_finalize_obj_allocator(struct net p->numclusters = (i + p->_clustentries - 1) / p->_clustentries; break; } + /* + * Set bitmap and lut state for all buffers in the current + * cluster. + * + * [i, lim) is the set of buffer indexes that cover the + * current cluster. + * + * 'clust' is really the address of the current buffer in + * the current cluster as we index through it with a stride + * of p->_objsize. + */ for (; i < lim; i++, clust += p->_objsize) { p->bitmap[ (i>>5) ] |= ( 1 << (i & 31) ); p->lut[i].vaddr = clust; @@ -1092,10 +1110,8 @@ static int netmap_mem_private_finalize(struct netmap_mem_d *nmd) { int err; - NMA_LOCK(nmd); nmd->refcount++; err = netmap_mem_finalize_all(nmd); - NMA_UNLOCK(nmd); return err; } @@ -1103,10 +1119,8 @@ netmap_mem_private_finalize(struct netma static void netmap_mem_private_deref(struct netmap_mem_d *nmd) { - NMA_LOCK(nmd); if (--nmd->refcount <= 0) netmap_mem_reset_all(nmd); - NMA_UNLOCK(nmd); } @@ -1242,10 +1256,7 @@ static int netmap_mem_global_finalize(struct netmap_mem_d *nmd) { int err; - - NMA_LOCK(nmd); - - + /* update configuration if changed */ if (netmap_mem_global_config(nmd)) goto out; @@ -1268,8 +1279,6 @@ out: nmd->refcount--; err = nmd->lasterr; - NMA_UNLOCK(nmd); - return err; } @@ -1518,7 +1527,6 @@ netmap_mem_if_delete(struct netmap_adapt static void netmap_mem_global_deref(struct netmap_mem_d *nmd) { - NMA_LOCK(nmd); nmd->refcount--; if (!nmd->refcount) @@ -1526,7 +1534,6 @@ netmap_mem_global_deref(struct netmap_me if (netmap_verbose) D("refcount = %d", nmd->refcount); - NMA_UNLOCK(nmd); } int @@ -1535,7 +1542,9 @@ netmap_mem_finalize(struct netmap_mem_d if (nm_mem_assign_group(nmd, na->pdev) < 0) { return ENOMEM; } else { + NMA_LOCK(nmd); nmd->finalize(nmd); + NMA_UNLOCK(nmd); } if (!nmd->lasterr && na->pdev) @@ -1549,6 +1558,48 @@ netmap_mem_deref(struct netmap_mem_d *nm { NMA_LOCK(nmd); netmap_mem_unmap(&nmd->pools[NETMAP_BUF_POOL], na); + if (nmd->refcount == 1) { + u_int i; + + /* + * Reset the allocator when it falls out of use so that any + * pool resources leaked by unclean application exits are + * reclaimed. + */ + for (i = 0; i < NETMAP_POOLS_NR; i++) { + struct netmap_obj_pool *p; + u_int j; + + p = &nmd->pools[i]; + p->objfree = p->objtotal; + /* + * Reproduce the net effect of the M_ZERO malloc() + * and marking of free entries in the bitmap that + * occur in finalize_obj_allocator() + */ + memset(p->bitmap, + '\0', + sizeof(uint32_t) * ((p->objtotal + 31) / 32)); + + /* + * Set all the bits in the bitmap that have + * corresponding buffers to 1 to indicate they are + * free. + */ + for (j = 0; j < p->objtotal; j++) { + if (p->lut[j].vaddr != NULL) { + p->bitmap[ (j>>5) ] |= ( 1 << (j & 31) ); + } + } + } + + /* + * Per netmap_mem_finalize_all(), + * buffers 0 and 1 are reserved + */ + nmd->pools[NETMAP_BUF_POOL].objfree -= 2; + nmd->pools[NETMAP_BUF_POOL].bitmap[0] = ~3; + } + nmd->deref(nmd); NMA_UNLOCK(nmd); - return nmd->deref(nmd); } From owner-svn-src-all@FreeBSD.ORG Sun May 24 01:52:23 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0CF15DD4; Sun, 24 May 2015 01:52:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 EDAE51958; Sun, 24 May 2015 01:52:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4O1qMcg042657; Sun, 24 May 2015 01:52:22 GMT (envelope-from pkelsey@FreeBSD.org) Received: (from pkelsey@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4O1qMst042656; Sun, 24 May 2015 01:52:22 GMT (envelope-from pkelsey@FreeBSD.org) Message-Id: <201505240152.t4O1qMst042656@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pkelsey set sender to pkelsey@FreeBSD.org using -f From: Patrick Kelsey Date: Sun, 24 May 2015 01:52:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283344 - stable/10/share/man/man3 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 01:52:23 -0000 Author: pkelsey Date: Sun May 24 01:52:22 2015 New Revision: 283344 URL: https://svnweb.freebsd.org/changeset/base/283344 Log: MFC r283093: Added description of POSIX-specified behavior when invoked on a key from within that key's destructor. Modified: stable/10/share/man/man3/pthread_getspecific.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man3/pthread_getspecific.3 ============================================================================== --- stable/10/share/man/man3/pthread_getspecific.3 Sun May 24 01:48:33 2015 (r283343) +++ stable/10/share/man/man3/pthread_getspecific.3 Sun May 24 01:52:22 2015 (r283344) @@ -64,6 +64,11 @@ is undefined. The .Fn pthread_getspecific function may be called from a thread-specific data destructor function. +A call to +.Fn pthread_getspecific +for the thread-specific data key being destroyed returns the value NULL, +unless the value is changed (after the destructor starts) by a call to +.Fn pthread_setspecific . .Sh RETURN VALUES The .Fn pthread_getspecific From owner-svn-src-all@FreeBSD.ORG Sun May 24 02:15:19 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 08DFF122; Sun, 24 May 2015 02:15:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 EB8721B58; Sun, 24 May 2015 02:15:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4O2FImt053298; Sun, 24 May 2015 02:15:18 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4O2FIN6053297; Sun, 24 May 2015 02:15:18 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201505240215.t4O2FIN6053297@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 24 May 2015 02:15:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283345 - stable/10/release X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 02:15:19 -0000 Author: gjb Date: Sun May 24 02:15:18 2015 New Revision: 283345 URL: https://svnweb.freebsd.org/changeset/base/283345 Log: MFC r283252: Include the TARGET in the EC2 AMI name. Without this, AWS rejects subsequent image uploads of a different architecture because the name conflicts. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/Makefile.ec2 Directory Properties: stable/10/ (props changed) Modified: stable/10/release/Makefile.ec2 ============================================================================== --- stable/10/release/Makefile.ec2 Sun May 24 01:52:22 2015 (r283344) +++ stable/10/release/Makefile.ec2 Sun May 24 02:15:18 2015 (r283345) @@ -53,7 +53,7 @@ ec2ami: cw-ec2 ${CW_EC2_PORTINSTALL} .endif /usr/local/bin/bsdec2-image-upload ${PUBLISH} \ ${.OBJDIR}/ec2.raw \ - "${TYPE} ${REVISION}-${BRANCH}${AMINAMESUFFIX}" \ - "${TYPE} ${REVISION}-${BRANCH}" \ + "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}" \ + "${TYPE} ${REVISION}-${BRANCH}-${TARGET}" \ ${AWSREGION} ${AWSBUCKET} ${AWSKEYFILE} @touch ${.TARGET} From owner-svn-src-all@FreeBSD.ORG Sun May 24 04:14:11 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3C0BA241; Sun, 24 May 2015 04:14:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 0F9DB17B9; Sun, 24 May 2015 04:14:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4O4EAYP013542; Sun, 24 May 2015 04:14:10 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4O4EATu013539; Sun, 24 May 2015 04:14:10 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201505240414.t4O4EATu013539@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 24 May 2015 04:14:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283349 - stable/10/sys/cam X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 04:14:11 -0000 Author: trasz Date: Sun May 24 04:14:09 2015 New Revision: 283349 URL: https://svnweb.freebsd.org/changeset/base/283349 Log: MFC r279554: Make periphdriver_register() take XPT lock when modifying the periph_drivers array. This fixes a panic that sometimes occured when kldloading ctl.ko. PR: 200384 Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/cam/cam_periph.c stable/10/sys/cam/cam_xpt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/cam_periph.c ============================================================================== --- stable/10/sys/cam/cam_periph.c Sun May 24 02:46:08 2015 (r283348) +++ stable/10/sys/cam/cam_periph.c Sun May 24 04:14:09 2015 (r283349) @@ -108,9 +108,19 @@ periphdriver_register(void *data) struct periph_driver **newdrivers, **old; int ndrivers; +again: ndrivers = nperiph_drivers + 2; newdrivers = malloc(sizeof(*newdrivers) * ndrivers, M_CAMPERIPH, M_WAITOK); + xpt_lock_buses(); + if (ndrivers != nperiph_drivers + 2) { + /* + * Lost race against itself; go around. + */ + xpt_unlock_buses(); + free(newdrivers, M_CAMPERIPH); + goto again; + } if (periph_drivers) bcopy(periph_drivers, newdrivers, sizeof(*newdrivers) * nperiph_drivers); @@ -118,9 +128,10 @@ periphdriver_register(void *data) newdrivers[nperiph_drivers + 1] = NULL; old = periph_drivers; periph_drivers = newdrivers; + nperiph_drivers++; + xpt_unlock_buses(); if (old) free(old, M_CAMPERIPH); - nperiph_drivers++; /* If driver marked as early or it is late now, initialize it. */ if (((drv->flags & CAM_PERIPH_DRV_EARLY) != 0 && initialized > 0) || initialized > 1) Modified: stable/10/sys/cam/cam_xpt.c ============================================================================== --- stable/10/sys/cam/cam_xpt.c Sun May 24 02:46:08 2015 (r283348) +++ stable/10/sys/cam/cam_xpt.c Sun May 24 04:14:09 2015 (r283349) @@ -149,6 +149,8 @@ typedef int xpt_pdrvfunc_t (struct perip /* Transport layer configuration information */ static struct xpt_softc xsoftc; +MTX_SYSINIT(xpt_topo_init, &xsoftc.xpt_topo_lock, "XPT topology lock", MTX_DEF); + TUNABLE_INT("kern.cam.boot_delay", &xsoftc.boot_delay); SYSCTL_INT(_kern_cam, OID_AUTO, boot_delay, CTLFLAG_RDTUN, &xsoftc.boot_delay, 0, "Bus registration wait time"); @@ -850,7 +852,6 @@ xpt_init(void *dummy) mtx_init(&xsoftc.xpt_lock, "XPT lock", NULL, MTX_DEF); mtx_init(&xsoftc.xpt_highpower_lock, "XPT highpower lock", NULL, MTX_DEF); - mtx_init(&xsoftc.xpt_topo_lock, "XPT topology lock", NULL, MTX_DEF); xsoftc.xpt_taskq = taskqueue_create("CAM XPT task", M_WAITOK, taskqueue_thread_enqueue, /*context*/&xsoftc.xpt_taskq); From owner-svn-src-all@FreeBSD.ORG Sun May 24 06:53:10 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E488E31B; Sun, 24 May 2015 06:53:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 D1B6618B5; Sun, 24 May 2015 06:53:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4O6rAEp091392; Sun, 24 May 2015 06:53:10 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4O6rAa0091391; Sun, 24 May 2015 06:53:10 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505240653.t4O6rAa0091391@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Sun, 24 May 2015 06:53:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283350 - stable/10/sys/dev/sfxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 06:53:11 -0000 Author: arybchik Date: Sun May 24 06:53:10 2015 New Revision: 283350 URL: https://svnweb.freebsd.org/changeset/base/283350 Log: MFC: r283278 sfxge: relax assertion to allow RST flag in TSO packets Kernel under stress load, mixed MC reboot and sfupdate really generates TSO packet with RST flag. It will generate many TCP packets with RST flag set. May be RST flag should be set in the last segment only, but it could be dropped. So, it is safer to keep the flag in all packets to be sure that connection is reset. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge_tx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.c Sun May 24 04:14:09 2015 (r283349) +++ stable/10/sys/dev/sfxge/sfxge_tx.c Sun May 24 06:53:10 2015 (r283350) @@ -865,8 +865,14 @@ static void tso_start(struct sfxge_tso_s tso->seqnum = ntohl(th->th_seq); /* These flags must not be duplicated */ - KASSERT(!(th->th_flags & (TH_URG | TH_SYN | TH_RST)), - ("incompatible TCP flag on TSO packet")); + /* + * RST should not be duplicated as well, but FreeBSD kernel + * generates TSO packets with RST flag. So, do not assert + * its absence. + */ + KASSERT(!(th->th_flags & (TH_URG | TH_SYN)), + ("incompatible TCP flag 0x%x on TSO packet", + th->th_flags & (TH_URG | TH_SYN))); tso->out_len = mbuf->m_pkthdr.len - tso->header_len; } From owner-svn-src-all@FreeBSD.ORG Sun May 24 07:09:17 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6E5E0785; Sun, 24 May 2015 07:09:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 5C97F19F6; Sun, 24 May 2015 07:09:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4O79HUE098964; Sun, 24 May 2015 07:09:17 GMT (envelope-from ganbold@FreeBSD.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4O79HES098963; Sun, 24 May 2015 07:09:17 GMT (envelope-from ganbold@FreeBSD.org) Message-Id: <201505240709.t4O79HES098963@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ganbold set sender to ganbold@FreeBSD.org using -f From: Ganbold Tsagaankhuu Date: Sun, 24 May 2015 07:09:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283352 - head/sys/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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 07:09:17 -0000 Author: ganbold Date: Sun May 24 07:09:16 2015 New Revision: 283352 URL: https://svnweb.freebsd.org/changeset/base/283352 Log: Enable leds for VSATV102 in dts. Differential Revision: https://reviews.freebsd.org/D2614 Submitted by: John Wehle Modified: head/sys/boot/fdt/dts/arm/vsatv102-m6.dts Modified: head/sys/boot/fdt/dts/arm/vsatv102-m6.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/vsatv102-m6.dts Sun May 24 07:00:58 2015 (r283351) +++ head/sys/boot/fdt/dts/arm/vsatv102-m6.dts Sun May 24 07:09:16 2015 (r283352) @@ -282,6 +282,17 @@ }; }; + leds { + compatible = "gpio-leds"; + + sys_led { + gpios = <&gpioao 2>; /* gpioao_2 sys_led */ + label = "sys_led"; + + default-state = "on"; + }; + }; + chosen { stdin = "uart0"; stdout = "uart0"; From owner-svn-src-all@FreeBSD.ORG Sun May 24 07:21:30 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D2956437; Sun, 24 May 2015 07:21:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 A7C131BE4; Sun, 24 May 2015 07:21:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4O7LUqR010690; Sun, 24 May 2015 07:21:30 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4O7LUDv010689; Sun, 24 May 2015 07:21:30 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201505240721.t4O7LUDv010689@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sun, 24 May 2015 07:21:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283357 - head/tools/regression/file X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 07:21:30 -0000 Author: ngie Date: Sun May 24 07:21:30 2015 New Revision: 283357 URL: https://svnweb.freebsd.org/changeset/base/283357 Log: Remove directory for test that has been integrated in under tests/sys/... X-MFC with: r282067 MFC after: 1 week Deleted: head/tools/regression/file/ From owner-svn-src-all@FreeBSD.ORG Sun May 24 07:32:05 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C1463A30; Sun, 24 May 2015 07:32:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 931831CE6; Sun, 24 May 2015 07:32:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4O7W5w8016200; Sun, 24 May 2015 07:32:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4O7W3Xj016178; Sun, 24 May 2015 07:32:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201505240732.t4O7W3Xj016178@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 24 May 2015 07:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283359 - in stable/10/sys: amd64/linux32 compat/freebsd32 compat/svr4 i386/ibcs2 i386/linux kern sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 07:32:05 -0000 Author: kib Date: Sun May 24 07:32:02 2015 New Revision: 283359 URL: https://svnweb.freebsd.org/changeset/base/283359 Log: MFC r282708: On exec, single-threading must be enforced before arguments space is allocated from exec_map. Modified: stable/10/sys/amd64/linux32/linux32_machdep.c stable/10/sys/compat/freebsd32/freebsd32_misc.c stable/10/sys/compat/svr4/svr4_misc.c stable/10/sys/i386/ibcs2/ibcs2_misc.c stable/10/sys/i386/linux/linux_machdep.c stable/10/sys/kern/kern_exec.c stable/10/sys/sys/imgact.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- stable/10/sys/amd64/linux32/linux32_machdep.c Sun May 24 07:23:16 2015 (r283358) +++ stable/10/sys/amd64/linux32/linux32_machdep.c Sun May 24 07:32:02 2015 (r283359) @@ -137,6 +137,7 @@ int linux_execve(struct thread *td, struct linux_execve_args *args) { struct image_args eargs; + struct vmspace *oldvmspace; char *path; int error; @@ -147,12 +148,17 @@ linux_execve(struct thread *td, struct l printf(ARGS(execve, "%s"), path); #endif + error = pre_execve(td, &oldvmspace); + if (error != 0) { + free(path, M_TEMP); + return (error); + } error = freebsd32_exec_copyin_args(&eargs, path, UIO_SYSSPACE, args->argp, args->envp); free(path, M_TEMP); if (error == 0) error = kern_execve(td, &eargs, NULL); - if (error == 0) + if (error == 0) { /* Linux process can execute FreeBSD one, do not attempt * to create emuldata for such process using * linux_proc_init, this leads to a panic on KASSERT @@ -160,6 +166,8 @@ linux_execve(struct thread *td, struct l */ if (SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX) error = linux_proc_init(td, 0, 0); + } + post_execve(td, error, oldvmspace); return (error); } Modified: stable/10/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/10/sys/compat/freebsd32/freebsd32_misc.c Sun May 24 07:23:16 2015 (r283358) +++ stable/10/sys/compat/freebsd32/freebsd32_misc.c Sun May 24 07:32:02 2015 (r283359) @@ -400,12 +400,17 @@ int freebsd32_execve(struct thread *td, struct freebsd32_execve_args *uap) { struct image_args eargs; + struct vmspace *oldvmspace; int error; + error = pre_execve(td, &oldvmspace); + if (error != 0) + return (error); error = freebsd32_exec_copyin_args(&eargs, uap->fname, UIO_USERSPACE, uap->argv, uap->envv); if (error == 0) error = kern_execve(td, &eargs, NULL); + post_execve(td, error, oldvmspace); return (error); } @@ -413,14 +418,19 @@ int freebsd32_fexecve(struct thread *td, struct freebsd32_fexecve_args *uap) { struct image_args eargs; + struct vmspace *oldvmspace; int error; + error = pre_execve(td, &oldvmspace); + if (error != 0) + return (error); error = freebsd32_exec_copyin_args(&eargs, NULL, UIO_SYSSPACE, uap->argv, uap->envv); if (error == 0) { eargs.fd = uap->fd; error = kern_execve(td, &eargs, NULL); } + post_execve(td, error, oldvmspace); return (error); } Modified: stable/10/sys/compat/svr4/svr4_misc.c ============================================================================== --- stable/10/sys/compat/svr4/svr4_misc.c Sun May 24 07:23:16 2015 (r283358) +++ stable/10/sys/compat/svr4/svr4_misc.c Sun May 24 07:32:02 2015 (r283359) @@ -167,15 +167,22 @@ svr4_sys_execv(td, uap) struct svr4_sys_execv_args *uap; { struct image_args eargs; + struct vmspace *oldvmspace; char *path; int error; CHECKALTEXIST(td, uap->path, &path); + error = pre_execve(td, &oldvmspace); + if (error != 0) { + free(path, M_TEMP); + return (error); + } error = exec_copyin_args(&eargs, path, UIO_SYSSPACE, uap->argp, NULL); free(path, M_TEMP); if (error == 0) error = kern_execve(td, &eargs, NULL); + post_execve(td, error, oldvmspace); return (error); } @@ -185,16 +192,23 @@ svr4_sys_execve(td, uap) struct svr4_sys_execve_args *uap; { struct image_args eargs; + struct vmspace *oldvmspace; char *path; int error; CHECKALTEXIST(td, uap->path, &path); + error = pre_execve(td, &oldvmspace); + if (error != 0) { + free(path, M_TEMP); + return (error); + } error = exec_copyin_args(&eargs, path, UIO_SYSSPACE, uap->argp, uap->envp); free(path, M_TEMP); if (error == 0) error = kern_execve(td, &eargs, NULL); + post_execve(td, error, oldvmspace); return (error); } Modified: stable/10/sys/i386/ibcs2/ibcs2_misc.c ============================================================================== --- stable/10/sys/i386/ibcs2/ibcs2_misc.c Sun May 24 07:23:16 2015 (r283358) +++ stable/10/sys/i386/ibcs2/ibcs2_misc.c Sun May 24 07:32:02 2015 (r283359) @@ -200,15 +200,22 @@ ibcs2_execv(td, uap) struct ibcs2_execv_args *uap; { struct image_args eargs; + struct vmspace *oldvmspace; char *path; int error; CHECKALTEXIST(td, uap->path, &path); + error = pre_execve(td, &oldvmspace); + if (error != 0) { + free(path, M_TEMP); + return (error); + } error = exec_copyin_args(&eargs, path, UIO_SYSSPACE, uap->argp, NULL); free(path, M_TEMP); if (error == 0) error = kern_execve(td, &eargs, NULL); + post_execve(td, error, oldvmspace); return (error); } @@ -218,16 +225,23 @@ ibcs2_execve(td, uap) struct ibcs2_execve_args *uap; { struct image_args eargs; + struct vmspace *oldvmspace; char *path; int error; CHECKALTEXIST(td, uap->path, &path); + error = pre_execve(td, &oldvmspace); + if (error != 0) { + free(path, M_TEMP); + return (error); + } error = exec_copyin_args(&eargs, path, UIO_SYSSPACE, uap->argp, uap->envp); free(path, M_TEMP); if (error == 0) error = kern_execve(td, &eargs, NULL); + post_execve(td, error, oldvmspace); return (error); } Modified: stable/10/sys/i386/linux/linux_machdep.c ============================================================================== --- stable/10/sys/i386/linux/linux_machdep.c Sun May 24 07:23:16 2015 (r283358) +++ stable/10/sys/i386/linux/linux_machdep.c Sun May 24 07:32:02 2015 (r283359) @@ -126,9 +126,10 @@ bsd_to_linux_sigaltstack(int bsa) int linux_execve(struct thread *td, struct linux_execve_args *args) { - int error; - char *newpath; struct image_args eargs; + struct vmspace *oldvmspace; + char *newpath; + int error; LCONVPATHEXIST(td, args->path, &newpath); @@ -137,12 +138,17 @@ linux_execve(struct thread *td, struct l printf(ARGS(execve, "%s"), newpath); #endif + error = pre_execve(td, &oldvmspace); + if (error != 0) { + free(newpath, M_TEMP); + return (error); + } error = exec_copyin_args(&eargs, newpath, UIO_SYSSPACE, args->argp, args->envp); free(newpath, M_TEMP); if (error == 0) error = kern_execve(td, &eargs, NULL); - if (error == 0) + if (error == 0) { /* linux process can exec fbsd one, dont attempt * to create emuldata for such process using * linux_proc_init, this leads to a panic on KASSERT @@ -150,6 +156,8 @@ linux_execve(struct thread *td, struct l */ if (SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX) error = linux_proc_init(td, 0, 0); + } + post_execve(td, error, oldvmspace); return (error); } Modified: stable/10/sys/kern/kern_exec.c ============================================================================== --- stable/10/sys/kern/kern_exec.c Sun May 24 07:23:16 2015 (r283358) +++ stable/10/sys/kern/kern_exec.c Sun May 24 07:32:02 2015 (r283359) @@ -196,21 +196,20 @@ struct execve_args { #endif int -sys_execve(td, uap) - struct thread *td; - struct execve_args /* { - char *fname; - char **argv; - char **envv; - } */ *uap; +sys_execve(struct thread *td, struct execve_args *uap) { - int error; struct image_args args; + struct vmspace *oldvmspace; + int error; + error = pre_execve(td, &oldvmspace); + if (error != 0) + return (error); error = exec_copyin_args(&args, uap->fname, UIO_USERSPACE, uap->argv, uap->envv); if (error == 0) error = kern_execve(td, &args, NULL); + post_execve(td, error, oldvmspace); return (error); } @@ -224,15 +223,20 @@ struct fexecve_args { int sys_fexecve(struct thread *td, struct fexecve_args *uap) { - int error; struct image_args args; + struct vmspace *oldvmspace; + int error; + error = pre_execve(td, &oldvmspace); + if (error != 0) + return (error); error = exec_copyin_args(&args, NULL, UIO_SYSSPACE, uap->argv, uap->envv); if (error == 0) { args.fd = uap->fd; error = kern_execve(td, &args, NULL); } + post_execve(td, error, oldvmspace); return (error); } @@ -246,65 +250,56 @@ struct __mac_execve_args { #endif int -sys___mac_execve(td, uap) - struct thread *td; - struct __mac_execve_args /* { - char *fname; - char **argv; - char **envv; - struct mac *mac_p; - } */ *uap; +sys___mac_execve(struct thread *td, struct __mac_execve_args *uap) { #ifdef MAC - int error; struct image_args args; + struct vmspace *oldvmspace; + int error; + error = pre_execve(td, &oldvmspace); + if (error != 0) + return (error); error = exec_copyin_args(&args, uap->fname, UIO_USERSPACE, uap->argv, uap->envv); if (error == 0) error = kern_execve(td, &args, uap->mac_p); + post_execve(td, error, oldvmspace); return (error); #else return (ENOSYS); #endif } -/* - * XXX: kern_execve has the astonishing property of not always returning to - * the caller. If sufficiently bad things happen during the call to - * do_execve(), it can end up calling exit1(); as a result, callers must - * avoid doing anything which they might need to undo (e.g., allocating - * memory). - */ int -kern_execve(td, args, mac_p) - struct thread *td; - struct image_args *args; - struct mac *mac_p; +pre_execve(struct thread *td, struct vmspace **oldvmspace) { - struct proc *p = td->td_proc; - struct vmspace *oldvmspace; + struct proc *p; int error; - AUDIT_ARG_ARGV(args->begin_argv, args->argc, - args->begin_envv - args->begin_argv); - AUDIT_ARG_ENVV(args->begin_envv, args->envc, - args->endp - args->begin_envv); - if (p->p_flag & P_HADTHREADS) { + KASSERT(td == curthread, ("non-current thread %p", td)); + error = 0; + p = td->td_proc; + if ((p->p_flag & P_HADTHREADS) != 0) { PROC_LOCK(p); - if (thread_single(p, SINGLE_BOUNDARY)) { - PROC_UNLOCK(p); - exec_free_args(args); - return (ERESTART); /* Try again later. */ - } + if (thread_single(p, SINGLE_BOUNDARY) != 0) + error = ERESTART; PROC_UNLOCK(p); } + KASSERT(error != 0 || (td->td_pflags & TDP_EXECVMSPC) == 0, + ("nested execve")); + *oldvmspace = p->p_vmspace; + return (error); +} - KASSERT((td->td_pflags & TDP_EXECVMSPC) == 0, ("nested execve")); - oldvmspace = td->td_proc->p_vmspace; - error = do_execve(td, args, mac_p); +void +post_execve(struct thread *td, int error, struct vmspace *oldvmspace) +{ + struct proc *p; - if (p->p_flag & P_HADTHREADS) { + KASSERT(td == curthread, ("non-current thread %p", td)); + p = td->td_proc; + if ((p->p_flag & P_HADTHREADS) != 0) { PROC_LOCK(p); /* * If success, we upgrade to SINGLE_EXIT state to @@ -317,13 +312,29 @@ kern_execve(td, args, mac_p) PROC_UNLOCK(p); } if ((td->td_pflags & TDP_EXECVMSPC) != 0) { - KASSERT(td->td_proc->p_vmspace != oldvmspace, + KASSERT(p->p_vmspace != oldvmspace, ("oldvmspace still used")); vmspace_free(oldvmspace); td->td_pflags &= ~TDP_EXECVMSPC; } +} - return (error); +/* + * XXX: kern_execve has the astonishing property of not always returning to + * the caller. If sufficiently bad things happen during the call to + * do_execve(), it can end up calling exit1(); as a result, callers must + * avoid doing anything which they might need to undo (e.g., allocating + * memory). + */ +int +kern_execve(struct thread *td, struct image_args *args, struct mac *mac_p) +{ + + AUDIT_ARG_ARGV(args->begin_argv, args->argc, + args->begin_envv - args->begin_argv); + AUDIT_ARG_ENVV(args->begin_envv, args->envc, + args->endp - args->begin_envv); + return (do_execve(td, args, mac_p)); } /* Modified: stable/10/sys/sys/imgact.h ============================================================================== --- stable/10/sys/sys/imgact.h Sun May 24 07:23:16 2015 (r283358) +++ stable/10/sys/sys/imgact.h Sun May 24 07:32:02 2015 (r283359) @@ -86,6 +86,7 @@ struct image_params { #ifdef _KERNEL struct sysentvec; struct thread; +struct vmspace; #define IMGACT_CORE_COMPRESS 0x01 @@ -98,6 +99,8 @@ void exec_setregs(struct thread *, struc int exec_shell_imgact(struct image_params *); int exec_copyin_args(struct image_args *, char *, enum uio_seg, char **, char **); +int pre_execve(struct thread *td, struct vmspace **oldvmspace); +void post_execve(struct thread *td, int error, struct vmspace *oldvmspace); #endif #endif /* !_SYS_IMGACT_H_ */ From owner-svn-src-all@FreeBSD.ORG Sun May 24 07:45:44 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 334E1C93; Sun, 24 May 2015 07:45:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 20EC61DED; Sun, 24 May 2015 07:45:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4O7jilJ021594; Sun, 24 May 2015 07:45:44 GMT (envelope-from ganbold@FreeBSD.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4O7jhXf021591; Sun, 24 May 2015 07:45:43 GMT (envelope-from ganbold@FreeBSD.org) Message-Id: <201505240745.t4O7jhXf021591@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ganbold set sender to ganbold@FreeBSD.org using -f From: Ganbold Tsagaankhuu Date: Sun, 24 May 2015 07:45:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283360 - in head/sys/dev: acpi_support gpio led X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 07:45:44 -0000 Author: ganbold Date: Sun May 24 07:45:42 2015 New Revision: 283360 URL: https://svnweb.freebsd.org/changeset/base/283360 Log: This implements default-state support as described in: https://www.kernel.org/doc/Documentation/devicetree/bindings/leds/leds-gpio.txt Without this booting the VSATV102 causes the blue "working" led to turn off when the kernel starts up. With this the led (which is turned on by the firmware) stays on since that's the default state specified in the FDT. Expanded the meaning of the led_create_state state parameter in order to implement support for "keep". The original values were: == 0 Off != 0 On The new values are: == -1 don't change / keep current setting == 0 Off != -1 && != 0 On This should have no effect on acpi_asus_attach which only calls led_create_state with state set to 1. Updated acpi_ibm_attach in order to avoid surprises. Differential Revision: https://reviews.freebsd.org/D2615 Submitted by: John Wehle Reviewed by: gonzo, loos Modified: head/sys/dev/acpi_support/acpi_ibm.c head/sys/dev/gpio/gpioled.c head/sys/dev/led/led.c Modified: head/sys/dev/acpi_support/acpi_ibm.c ============================================================================== --- head/sys/dev/acpi_support/acpi_ibm.c Sun May 24 07:32:02 2015 (r283359) +++ head/sys/dev/acpi_support/acpi_ibm.c Sun May 24 07:45:42 2015 (r283360) @@ -445,7 +445,8 @@ acpi_ibm_attach(device_t dev) /* Hook up light to led(4) */ if (sc->light_set_supported) - sc->led_dev = led_create_state(ibm_led, sc, "thinklight", sc->light_val); + sc->led_dev = led_create_state(ibm_led, sc, "thinklight", + (sc->light_val ? 1 : 0)); return (0); } Modified: head/sys/dev/gpio/gpioled.c ============================================================================== --- head/sys/dev/gpio/gpioled.c Sun May 24 07:32:02 2015 (r283359) +++ head/sys/dev/gpio/gpioled.c Sun May 24 07:45:42 2015 (r283360) @@ -166,8 +166,10 @@ static int gpioled_attach(device_t dev) { struct gpioled_softc *sc; + int state; #ifdef FDT phandle_t node; + char *default_state; char *name; #else const char *name; @@ -177,10 +179,29 @@ gpioled_attach(device_t dev) sc->sc_dev = dev; sc->sc_busdev = device_get_parent(dev); GPIOLED_LOCK_INIT(sc); + + state = 0; + #ifdef FDT - name = NULL; if ((node = ofw_bus_get_node(dev)) == -1) return (ENXIO); + + if (OF_getprop_alloc(node, "default-state", + sizeof(char), (void **)&default_state) != -1) { + if (strcasecmp(default_state, "on") == 0) + state = 1; + else if (strcasecmp(default_state, "off") == 0) + state = 0; + else if (strcasecmp(default_state, "keep") == 0) + state = -1; + else { + device_printf(dev, + "unknown value for default-state in FDT\n"); + } + free(default_state, M_OFWPROP); + } + + name = NULL; if (OF_getprop_alloc(node, "label", 1, (void **)&name) == -1) OF_getprop_alloc(node, "name", 1, (void **)&name); #else @@ -189,8 +210,8 @@ gpioled_attach(device_t dev) name = NULL; #endif - sc->sc_leddev = led_create(gpioled_control, sc, name ? name : - device_get_nameunit(dev)); + sc->sc_leddev = led_create_state(gpioled_control, sc, name ? name : + device_get_nameunit(dev), state); #ifdef FDT if (name != NULL) free(name, M_OFWPROP); Modified: head/sys/dev/led/led.c ============================================================================== --- head/sys/dev/led/led.c Sun May 24 07:32:02 2015 (r283359) +++ head/sys/dev/led/led.c Sun May 24 07:45:42 2015 (r283360) @@ -293,7 +293,8 @@ led_create_state(led_t *func, void *priv mtx_lock(&led_mtx); sc->dev->si_drv1 = sc; LIST_INSERT_HEAD(&led_list, sc, list); - sc->func(sc->private, state != 0); + if (state != -1) + sc->func(sc->private, state != 0); mtx_unlock(&led_mtx); return (sc->dev); From owner-svn-src-all@FreeBSD.ORG Sun May 24 08:45:21 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3EC4CEF5; Sun, 24 May 2015 08:45:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 1FE5D149E; Sun, 24 May 2015 08:45:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4O8jKWO052624; Sun, 24 May 2015 08:45:21 GMT (envelope-from ganbold@FreeBSD.org) Received: (from ganbold@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4O8jK1A052621; Sun, 24 May 2015 08:45:20 GMT (envelope-from ganbold@FreeBSD.org) Message-Id: <201505240845.t4O8jK1A052621@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ganbold set sender to ganbold@FreeBSD.org using -f From: Ganbold Tsagaankhuu Date: Sun, 24 May 2015 08:45:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283361 - in head/sys: arm/conf 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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 08:45:21 -0000 Author: ganbold Date: Sun May 24 08:45:19 2015 New Revision: 283361 URL: https://svnweb.freebsd.org/changeset/base/283361 Log: Add kernel config and dts files for an aml8726-m3 based device. Following u-boot commands allow FreeBSD boot on Yiyate Android TV Box (aml8726-m3): tv open 480p mmc rescan 0 fatload mmc 0 0x80100000 kernel.bin go 0x80100000 The current FreeBSD driver doesn't program the video clocks so the u-boot tv command is necessary in order for the frame buffer to be useful (otherwise it can be skipped). The SD card for the Yiyate Android TV Box doesn't need anything special beyond creating a FAT16 and a UFS filesystem. Differential Revision: https://reviews.freebsd.org/D2636 Submitted by: John Wehle Added: head/sys/arm/conf/YYHD18 (contents, props changed) head/sys/boot/fdt/dts/arm/meson3.dtsi (contents, props changed) head/sys/boot/fdt/dts/arm/yyhd18-m3.dts (contents, props changed) Added: head/sys/arm/conf/YYHD18 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/YYHD18 Sun May 24 08:45:19 2015 (r283361) @@ -0,0 +1,26 @@ +# YYHD18 -- Custom configuration for the Yiyate Android TV box +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +#NO_UNIVERSE + +include "AML8726" +ident YYHD18 + +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=yyhd18-m3.dts Added: head/sys/boot/fdt/dts/arm/meson3.dtsi ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/fdt/dts/arm/meson3.dtsi Sun May 24 08:45:19 2015 (r283361) @@ -0,0 +1,77 @@ +/*- + * Copyright (c) 2015 John Wehle + * 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$ + */ + +/* + * The basic single core aml8726 (aka meson) uses an Amlogic interrupt + * controller, however meson.dtsi specifies GIC (which is present on + * the multicore aml8726) so we need to override things here. + */ + +/include/ "meson.dtsi" + +/ { + model = "Amlogic Meson3 SoC"; + compatible = "amlogic,meson3"; + + interrupt-parent = <&pic>; + + pic: pic@c1109a40 { + device_type = "interrupt-controller"; + compatible = "amlogic,aml8726-pic"; + reg = <0xc1109a40 128>; /* cbus 0x2690 */ + + interrupt-controller; + #interrupt-cells = <3>; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@200 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + next-level-cache = <&L2>; + reg = <0x200>; + }; + }; + + clk81: clk@0 { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <0>; + }; +}; + +&gic { + status = "disabled"; +}; + +&L2 { + interrupts = <0 61 1>; +}; Added: head/sys/boot/fdt/dts/arm/yyhd18-m3.dts ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/fdt/dts/arm/yyhd18-m3.dts Sun May 24 08:45:19 2015 (r283361) @@ -0,0 +1,237 @@ +/*- + * Copyright (c) 2015 John Wehle + * 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$ + */ + +/* + * The ordering of certain devices is significant (e.g. usb depends on + * usb-phy which depends on gpio, also the timer should appear early on + * to provide a reasonably accurate DELAY implementation). + */ + +/dts-v1/; + +/memreserve/ 0x84900000 0x00600000; /* 6MB frame buffer */ + +#include "meson3.dtsi" + +/ { + /* + * My development unit is a Yiyate Android TV Box containing + * a HD18 motherboard and an aml8726-m3 SoC ... later versions + * shipped with an aml8726-m6. Printenv in uboot shows m3-oplay + * as the boardname supplied as part of mmcargs. + */ + + model = "yiyate,hd18-m3"; + compatible = "yiyate,hd18-m3", "amlogic,meson3"; + + #address-cells = <1>; + #size-cells = <1>; + + aliases { + soc = &soc; + screen = &screen; + uart0 = &uart_AO; + }; + + memory { + device_type = "memory"; + reg = <0x80000000 0x40000000>; /* 1GB RAM */ + }; + + soc: soc { + device_type = "soc"; + bus-frequency = <0>; + + ccm@c1104140 { + compatible = "amlogic,aml8726-ccm"; + reg = <0xc1104140 20>; /* cbus 0x1050 */ + + functions = "ethernet", "i2c", "rng", "sdio", + "uart-a", "uart-b", "uart-c", + "usb-a", "usb-b"; + }; + + pinctrl: pinctrl@c11080b0 { + compatible = "amlogic,aml8726-pinctrl"; + reg = <0xc11080b0 40>, /* mux */ + <0xc11080e8 24>, /* pu/pd */ + <0xc11080e8 24>, /* pull enable */ + <0xc8100014 4>, /* ao mux */ + <0xc810002c 4>, /* ao pu/pd */ + <0xc810002c 4>; /* ao pull enable */ + + /* + * Currently only pin muxing that deviates + * from the power on default of gpio is + * specified here. + */ + + pinctrl-names = "default"; + pinctrl-0 = <&pins_uartao &pins_ethernet &pins_hdmi>; + + pins_ethernet: ethernet { + amlogic,pins = "clk_out", "tx_en", + "tx_d0", "tx_d1", + "crs_dv", "rx_err", + "rx_d0", "rx_d1", + "mdc", "mdio"; + amlogic,function = "ethernet"; + }; + + pins_hdmi: hdmi { + amlogic,pins = "cec", "hpd", + "scl", "sda"; + amlogic,function = "hdmi"; + }; + + pins_sdio_b: sdio_b { + amlogic,pins = "clk", "cmd", + "d0", "d1", + "d2", "d3"; + amlogic,function = "sdio-b"; + }; + + pins_uartao: uartao { + amlogic,pins = "tx", "rx"; + amlogic,function = "uart-ao"; + }; + }; + + rtc@c8100740 { + compatible = "amlogic,aml8726-rtc"; + reg = <0xc8100740 20>; /* aobus 0x1d0 */ + interrupts = <0 72 1>; /* AM_IRQ2(8) */ + }; + + clkmsr: clkmsr@c1108758 { + compatible = "amlogic,aml8726-clkmsr"; + reg = <0xc1108758 16>; /* cbus 0x21d6 */ + + clocks = <&clk81>; + }; + + gpio5: gpio@c110806c { + compatible = "amlogic,aml8726-gpio"; + reg = <0xc110806c 4>, /* oen cbus 0x201b */ + <0xc1108070 4>, /* out */ + <0xc1108074 4>; /* in */ + + gpio-controller; + #gpio-cells = <1>; + pin-count = <32>; + }; + + mmc@c1108c20 { + compatible = "amlogic,aml8726-mmc"; + reg = <0xc1108c20 32>; /* cbus 0x2308 */ + interrupts = <0 28 1>; /* AM_IRQ0(28) */ + + clocks = <&clk81>; + + pinctrl-names = "default"; + pinctrl-0 = <&pins_sdio_b>; + + mmc-voltages = "3.3"; + + mmc-pwr-en = <&gpio5 31 0>; /* card_8 */ + ins-detect = <&gpio5 29 0>; /* card_6 */ + }; + + rng@c1108100 { + compatible = "amlogic,aml8726-rng"; + reg = <0xc1108100 8>; /* cbus 0x2040 */ + }; + + usb-phy@c1108400 { + /* usb-a and usb-b phy */ + compatible = "amlogic,aml8726-m3-usb-phy"; + reg = <0xc1108400 32>; /* cbus 0x2100 */ + }; + + usb@c9040000 { + /* usb-a */ + compatible = "synopsys,designware-hs-otg2"; + reg = <0xc9040000 0x40000>; /* ahbbus 0x40000*/ + interrupts = <0 30 4>; /* AM_IRQ0(30) */ + #address-cells = <1>; + #size-cells = <0>; + }; + + usb@c90c0000 { + /* usb-b */ + compatible = "synopsys,designware-hs-otg2"; + reg = <0xc90c0000 0x40000>; /* ahbbus 0xc0000 */ + interrupts = <0 31 4>; /* AM_IRQ0(31) */ + #address-cells = <1>; + #size-cells = <0>; + + dr_mode = "host"; + }; + + eth@c9410000 { + /* ethernet */ + compatible = "snps,dwmac"; + reg = <0xc9410000 0x2000>; /* ahbbus 0x410000 */ + interrupts = <0 8 1>; /* AM_IRQ0(8) */ + #address-cells = <1>; + #size-cells = <0>; + }; + + screen: fb@c8001324 { + device_type = "display"; + compatible = "amlogic,aml8726-fb"; + reg = <0xc8001324 12>, /* CANVAS */ + <0xc1106800 1024>, /* VIU */ + <0xc1107400 1024>; /* VPP */ + interrupts = <0 2 1>, /* AM_IRQ0(2) */ + <0 3 1>, /* AM_IRQ0(3) */ + <0 12 1>, /* AM_IRQ0(12) */ + <0 13 1>; /* AM_IRQ0(13) */ + + address = <0x84900000>; /* match memreserve */ + width = <720>; + height = <480>; + depth = <24>; + linebytes = <2160>; + }; + }; + + chosen { + stdin = "uart0"; + stdout = "uart0"; + }; +}; + +&clk81 { + clock-frequency = <0>; +}; + +&uart_AO { + status = "okay"; + current-speed = <115200>; +}; From owner-svn-src-all@FreeBSD.ORG Sun May 24 11:04:46 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 264A5B57; Sun, 24 May 2015 11:04:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 127BE123A; Sun, 24 May 2015 11:04:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OB4jr8020687; Sun, 24 May 2015 11:04:45 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OB4jg6020686; Sun, 24 May 2015 11:04:45 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201505241104.t4OB4jg6020686@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 24 May 2015 11:04:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283362 - head/sys/arm/qemu X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 11:04:46 -0000 Author: andrew Date: Sun May 24 11:04:45 2015 New Revision: 283362 URL: https://svnweb.freebsd.org/changeset/base/283362 Log: Include the ofw cpu driver. This allows us to get a list of cpus enabled by qemu, however we may not be running on them. Modified: head/sys/arm/qemu/files.qemu Modified: head/sys/arm/qemu/files.qemu ============================================================================== --- head/sys/arm/qemu/files.qemu Sun May 24 08:45:19 2015 (r283361) +++ head/sys/arm/qemu/files.qemu Sun May 24 11:04:45 2015 (r283362) @@ -13,3 +13,5 @@ kern/kern_clocksource.c standard arm/arm/generic_timer.c standard arm/qemu/virt_common.c standard arm/qemu/virt_machdep.c standard + +dev/ofw/ofw_cpu.c standard From owner-svn-src-all@FreeBSD.ORG Sun May 24 11:08:07 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EEAFBCD4; Sun, 24 May 2015 11:08:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 D0A5B1263; Sun, 24 May 2015 11:08:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OB86mW021188; Sun, 24 May 2015 11:08:06 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OB865h021187; Sun, 24 May 2015 11:08:06 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201505241108.t4OB865h021187@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 24 May 2015 11:08:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283363 - head/sys/dev/psci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 11:08:07 -0000 Author: andrew Date: Sun May 24 11:08:06 2015 New Revision: 283363 URL: https://svnweb.freebsd.org/changeset/base/283363 Log: Rework the PSCI cpu on code to allow it to work before device drivers have started. This allows this functions to be used with the regular ARM SMP initialisation sequence. Modified: head/sys/dev/psci/psci.c Modified: head/sys/dev/psci/psci.c ============================================================================== --- head/sys/dev/psci/psci.c Sun May 24 11:04:45 2015 (r283362) +++ head/sys/dev/psci/psci.c Sun May 24 11:08:06 2015 (r283363) @@ -102,6 +102,24 @@ EARLY_DRIVER_MODULE(psci, simplebus, psc EARLY_DRIVER_MODULE(psci, ofwbus, psci_driver, psci_devclass, 0, 0, BUS_PASS_CPU + BUS_PASS_ORDER_FIRST); +static psci_callfn_t +psci_get_callfn(phandle_t node) +{ + char method[16]; + + if ((OF_getprop(node, "method", method, sizeof(method))) > 0) { + if (strcmp(method, "hvc") == 0) + return (psci_hvc_despatch); + else if (strcmp(method, "smc") == 0) + return (psci_smc_despatch); + else + printf("psci: PSCI conduit \"%s\" invalid\n", method); + } else + printf("psci: PSCI conduit not supplied in the device tree\n"); + + return (NULL); +} + static int psci_probe(device_t dev) { @@ -126,7 +144,6 @@ psci_attach(device_t dev) const struct ofw_compat_data *ocd; psci_initfn_t psci_init; phandle_t node; - char method[16]; if (psci_softc != NULL) return (ENXIO); @@ -136,22 +153,9 @@ psci_attach(device_t dev) KASSERT(psci_init != NULL, ("PSCI init function cannot be NULL")); node = ofw_bus_get_node(dev); - if ((OF_getprop(node, "method", method, sizeof(method))) > 0) { - if (strcmp(method, "hvc") == 0) - sc->psci_call = psci_hvc_despatch; - else if (strcmp(method, "smc") == 0) - sc->psci_call = psci_smc_despatch; - else { - device_printf(dev, - "psci_attach: PSCI conduit \"%s\" invalid\n", - method); - return (ENXIO); - } - } else { - device_printf(dev, - "psci_attach: PSCI conduit not supplied in the DT\n"); + sc->psci_call = psci_get_callfn(node); + if (sc->psci_call == NULL) return (ENXIO); - } if (psci_init(dev)) return (ENXIO); @@ -177,10 +181,27 @@ psci_get_version(struct psci_softc *sc) int psci_cpu_on(unsigned long cpu, unsigned long entry, unsigned long context_id) { + psci_callfn_t callfn; + phandle_t node; + uint32_t fnid; + + if (psci_softc == NULL) { + node = ofw_bus_find_compatible(OF_peer(0), "arm,psci-0.2"); + if (node == 0) + /* TODO: Handle psci 0.1 */ + return (PSCI_RETVAL_INTERNAL_FAILURE); + + fnid = PSCI_FNID_CPU_ON; + callfn = psci_get_callfn(node); + if (callfn == NULL) + return (PSCI_RETVAL_INTERNAL_FAILURE); + } else { + callfn = psci_softc->psci_call; + fnid = psci_softc->psci_fnids[PSCI_FN_CPU_ON]; + } /* PSCI v0.1 and v0.2 both support cpu_on. */ - return(psci_softc->psci_call(psci_softc->psci_fnids[PSCI_FN_CPU_ON], cpu, - entry, context_id)); + return (callfn(fnid, cpu, entry, context_id)); } static void From owner-svn-src-all@FreeBSD.ORG Sun May 24 11:24:15 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AE5BFF59; Sun, 24 May 2015 11:24:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 9D0431450; Sun, 24 May 2015 11:24:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OBOFbf030453; Sun, 24 May 2015 11:24:15 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OBOFe6030452; Sun, 24 May 2015 11:24:15 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201505241124.t4OBOFe6030452@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 24 May 2015 11:24:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283364 - head/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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 11:24:15 -0000 Author: melifaro Date: Sun May 24 11:24:14 2015 New Revision: 283364 URL: https://svnweb.freebsd.org/changeset/base/283364 Log: Fix SIOCGI2C structure requirement. In reality, SIOCGI2C ioctl requires struct ifreq as many other ioctls. Doing copyin() on (significantly) larger struct ifstat sometimes triggered EFAULT. Reported by: Olivier Cochard-Labbé MFC after: 1 week Modified: head/sys/sys/sockio.h Modified: head/sys/sys/sockio.h ============================================================================== --- head/sys/sys/sockio.h Sun May 24 11:08:06 2015 (r283363) +++ head/sys/sys/sockio.h Sun May 24 11:24:14 2015 (r283364) @@ -96,7 +96,7 @@ #define SIOCGIFSTATUS _IOWR('i', 59, struct ifstat) /* get IF status */ #define SIOCSIFLLADDR _IOW('i', 60, struct ifreq) /* set linklevel addr */ -#define SIOCGI2C _IOWR('i', 61, struct ifstat) /* get I2C data */ +#define SIOCGI2C _IOWR('i', 61, struct ifreq) /* get I2C data */ #define SIOCSIFPHYADDR _IOW('i', 70, struct ifaliasreq) /* set gif addres */ #define SIOCGIFPSRCADDR _IOWR('i', 71, struct ifreq) /* get gif psrc addr */ From owner-svn-src-all@FreeBSD.ORG Sun May 24 12:12:03 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4C25686A; Sun, 24 May 2015 12:12:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 2D369198C; Sun, 24 May 2015 12:12:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OCC3es054612; Sun, 24 May 2015 12:12:03 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OCC2uU054606; Sun, 24 May 2015 12:12:02 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201505241212.t4OCC2uU054606@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 24 May 2015 12:12:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283365 - in head/sys/arm: arm include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 12:12:03 -0000 Author: andrew Date: Sun May 24 12:12:01 2015 New Revision: 283365 URL: https://svnweb.freebsd.org/changeset/base/283365 Log: Add more cp15_ functions, and use them in cpufunc.c where possible. Modified: head/sys/arm/arm/cpufunc.c head/sys/arm/include/cpu-v6.h head/sys/arm/include/sysreg.h Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Sun May 24 11:24:14 2015 (r283364) +++ head/sys/arm/arm/cpufunc.c Sun May 24 12:12:01 2015 (r283365) @@ -1116,37 +1116,20 @@ cpu_scc_setup_ccnt(void) * you want! */ #ifdef _PMC_USER_READ_WRITE_ -#if defined(CPU_ARM1176) - /* Use the Secure User and Non-secure Access Validation Control Register - * to allow userland access - */ - __asm volatile ("mcr p15, 0, %0, c15, c9, 0\n\t" - : - : "r"(0x00000001)); -#else /* Set PMUSERENR[0] to allow userland access */ - __asm volatile ("mcr p15, 0, %0, c9, c14, 0\n\t" - : - : "r"(0x00000001)); -#endif + cp15_pmuserenr_set(1); #endif #if defined(CPU_ARM1176) /* Set PMCR[2,0] to enable counters and reset CCNT */ - __asm volatile ("mcr p15, 0, %0, c15, c12, 0\n\t" - : - : "r"(0x00000005)); + cp15_pmcr_set(5); #else /* Set up the PMCCNTR register as a cyclecounter: * Set PMINTENCLR to 0xFFFFFFFF to block interrupts * Set PMCR[2,0] to enable counters and reset CCNT * Set PMCNTENSET to 0x80000000 to enable CCNT */ - __asm volatile ("mcr p15, 0, %0, c9, c14, 2\n\t" - "mcr p15, 0, %1, c9, c12, 0\n\t" - "mcr p15, 0, %2, c9, c12, 1\n\t" - : - : "r"(0xFFFFFFFF), - "r"(0x00000005), - "r"(0x80000000)); + cp15_pminten_clr(0xFFFFFFFF); + cp15_pmcr_set(5); + cp15_pmcnten_set(0x80000000); #endif } #endif @@ -1214,19 +1197,18 @@ arm11x6_setup(void) __asm volatile ("mcr\tp15, 0, %0, c7, c7, 0" : : "r"(sbz)); /* Allow detection code to find the VFP if it's fitted. */ - __asm volatile ("mcr\tp15, 0, %0, c1, c0, 2" : : "r" (0x0fffffff)); + cp15_cpacr_set(0x0fffffff); /* Set the control register */ ctrl = cpuctrl; cpu_control(~cpuctrl_wax, cpuctrl); - __asm volatile ("mrc p15, 0, %0, c1, c0, 1\n\t" - "and %1, %0, %2\n\t" - "orr %1, %1, %3\n\t" - "teq %0, %1\n\t" - "mcrne p15, 0, %1, c1, c0, 1\n\t" - : "=r"(tmp), "=r"(tmp2) : - "r"(auxctrl_wax), "r"(auxctrl)); + tmp = cp15_actlr_get(); + tmp2 = tmp; + tmp &= auxctrl_wax; + tmp |= auxctrl; + if (tmp != tmp2) + cp15_actlr_set(tmp); /* And again. */ cpu_idcache_wbinv_all(); Modified: head/sys/arm/include/cpu-v6.h ============================================================================== --- head/sys/arm/include/cpu-v6.h Sun May 24 11:24:14 2015 (r283364) +++ head/sys/arm/include/cpu-v6.h Sun May 24 12:12:01 2015 (r283365) @@ -139,6 +139,8 @@ _WF1(_CP15_ICIMVAU, CP15_ICIMVAU(%0)) / /* Various control registers */ +_RF0(cp15_cpacr_get, CP15_CPACR(%0)) +_WF1(cp15_cpacr_set, CP15_CPACR(%0)) _RF0(cp15_dfsr_get, CP15_DFSR(%0)) _RF0(cp15_ifsr_get, CP15_IFSR(%0)) _WF1(cp15_prrr_set, CP15_PRRR(%0)) @@ -149,8 +151,10 @@ _RF0(cp15_dfar_get, CP15_DFAR(%0)) _RF0(cp15_ifar_get, CP15_IFAR(%0)) _RF0(cp15_l2ctlr_get, CP15_L2CTLR(%0)) #endif -#if __ARM_ARCH >= 6 +/* ARMv6+ and XScale */ _RF0(cp15_actlr_get, CP15_ACTLR(%0)) +_WF1(cp15_actlr_set, CP15_ACTLR(%0)) +#if __ARM_ARCH >= 6 _WF1(cp15_ats1cpr_set, CP15_ATS1CPR(%0)); _RF0(cp15_par_get, CP15_PAR); _RF0(cp15_sctlr_get, CP15_SCTLR(%0)) @@ -163,7 +167,10 @@ _RF0(cp15_tcmtr_get, CP15_TCMTR(%0)) _RF0(cp15_tlbtr_get, CP15_TLBTR(%0)) _RF0(cp15_mpidr_get, CP15_MPIDR(%0)) _RF0(cp15_revidr_get, CP15_REVIDR(%0)) +_RF0(cp15_ccsidr_get, CP15_CCSIDR(%0)) +_RF0(cp15_clidr_get, CP15_CLIDR(%0)) _RF0(cp15_aidr_get, CP15_AIDR(%0)) +_WF1(cp15_csselr_set, CP15_CSSELR(%0)) _RF0(cp15_id_pfr0_get, CP15_ID_PFR0(%0)) _RF0(cp15_id_pfr1_get, CP15_ID_PFR1(%0)) _RF0(cp15_id_dfr0_get, CP15_ID_DFR0(%0)) @@ -183,6 +190,10 @@ _RF0(cp15_cbar_get, CP15_CBAR(%0)) /* Performance Monitor registers */ #if __ARM_ARCH == 6 && defined(CPU_ARM1176) +_RF0(cp15_pmuserenr_get, CP15_PMUSERENR(%0)) +_WF1(cp15_pmuserenr_set, CP15_PMUSERENR(%0)) +_RF0(cp15_pmcr_get, CP15_PMCR(%0)) +_WF1(cp15_pmcr_set, CP15_PMCR(%0)) _RF0(cp15_pmccntr_get, CP15_PMCCNTR(%0)) _WF1(cp15_pmccntr_set, CP15_PMCCNTR(%0)) #elif __ARM_ARCH > 6 Modified: head/sys/arm/include/sysreg.h ============================================================================== --- head/sys/arm/include/sysreg.h Sun May 24 11:24:14 2015 (r283364) +++ head/sys/arm/include/sysreg.h Sun May 24 12:12:01 2015 (r283365) @@ -210,6 +210,8 @@ * CP15 C9 registers */ #if __ARM_ARCH == 6 && defined(CPU_ARM1176) +#define CP15_PMUSERENR(rr) p15, 0, rr, c15, c9, 0 /* Access Validation Control Register */ +#define CP15_PMCR(rr) p15, 0, rr, c15, c12, 0 /* Performance Monitor Control Register */ #define CP15_PMCCNTR(rr) p15, 0, rr, c15, c12, 1 /* PM Cycle Count Register */ #elif __ARM_ARCH > 6 #define CP15_L2CTLR(rr) p15, 1, rr, c9, c0, 2 /* L2 Control Register */ From owner-svn-src-all@FreeBSD.ORG Sun May 24 12:20:17 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 11B749E3; Sun, 24 May 2015 12:20:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 F32E719E4; Sun, 24 May 2015 12:20:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OCKGHc058135; Sun, 24 May 2015 12:20:16 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OCKCCp058111; Sun, 24 May 2015 12:20:12 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201505241220.t4OCKCCp058111@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 24 May 2015 12:20:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283366 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 12:20:17 -0000 Author: andrew Date: Sun May 24 12:20:11 2015 New Revision: 283366 URL: https://svnweb.freebsd.org/changeset/base/283366 Log: Remove trailing whitespace from sys/arm/arm Modified: head/sys/arm/arm/bcopyinout.S head/sys/arm/arm/bcopyinout_xscale.S head/sys/arm/arm/blockio.S head/sys/arm/arm/bus_space_base.c head/sys/arm/arm/busdma_machdep-v6.c head/sys/arm/arm/busdma_machdep.c head/sys/arm/arm/copystr.S head/sys/arm/arm/cpu_asm-v6.S head/sys/arm/arm/cpufunc.c head/sys/arm/arm/cpufunc_asm_arm11x6.S head/sys/arm/arm/cpufunc_asm_arm9.S head/sys/arm/arm/cpufunc_asm_armv6.S head/sys/arm/arm/cpufunc_asm_armv7.S head/sys/arm/arm/cpufunc_asm_xscale_c3.S head/sys/arm/arm/cpuinfo.c head/sys/arm/arm/db_interface.c head/sys/arm/arm/elf_trampoline.c head/sys/arm/arm/exception.S head/sys/arm/arm/fiq.c head/sys/arm/arm/fusu.S head/sys/arm/arm/gic.c head/sys/arm/arm/intr.c head/sys/arm/arm/machdep.c head/sys/arm/arm/mp_machdep.c head/sys/arm/arm/mpcore_timer.c head/sys/arm/arm/nexus.c head/sys/arm/arm/physmem.c head/sys/arm/arm/pl190.c head/sys/arm/arm/pl310.c head/sys/arm/arm/pmap-v6-new.c head/sys/arm/arm/pmap-v6.c head/sys/arm/arm/pmap.c head/sys/arm/arm/support.S head/sys/arm/arm/swtch.S head/sys/arm/arm/trap.c head/sys/arm/arm/vfp.c head/sys/arm/arm/vm_machdep.c Modified: head/sys/arm/arm/bcopyinout.S ============================================================================== --- head/sys/arm/arm/bcopyinout.S Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/bcopyinout.S Sun May 24 12:20:11 2015 (r283366) @@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$"); #define SAVE_REGS stmfd sp!, {r4-r11} #define RESTORE_REGS ldmfd sp!, {r4-r11} - + #if defined(_ARM_ARCH_5E) #define HELLOCPP # #define PREFETCH(rx,o) pld [ rx , HELLOCPP (o) ] @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); * r4-r11 are scratch */ ENTRY(copyin) - /* Quick exit if length is zero */ + /* Quick exit if length is zero */ teq r2, #0 moveq r0, #0 RETeq @@ -326,7 +326,7 @@ END(copyin) */ ENTRY(copyout) - /* Quick exit if length is zero */ + /* Quick exit if length is zero */ teq r2, #0 moveq r0, #0 RETeq Modified: head/sys/arm/arm/bcopyinout_xscale.S ============================================================================== --- head/sys/arm/arm/bcopyinout_xscale.S Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/bcopyinout_xscale.S Sun May 24 12:20:11 2015 (r283366) @@ -85,7 +85,7 @@ ENTRY(copyin) ldmfd sp!, {r0-r2, r4, lr} moveq r0, #0 RETeq - + .Lnormal: stmfd sp!, {r10-r11, lr} @@ -527,8 +527,8 @@ ENTRY(copyout) ldmfd sp!, {r0-r2, r4, lr} moveq r0, #0 RETeq - -.Lnormale: + +.Lnormale: stmfd sp!, {r10-r11, lr} GET_PCB(r10) @@ -584,7 +584,7 @@ ENTRY(copyout) ldrne ip, [r0], #0x04 subne r2, r2, #0x04 strtne ip, [r1], #0x04 - + stmfd sp!, {r4-r9} /* Free up some registers */ mov r3, #-1 /* Signal restore r4-r9 */ Modified: head/sys/arm/arm/blockio.S ============================================================================== --- head/sys/arm/arm/blockio.S Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/blockio.S Sun May 24 12:20:11 2015 (r283366) @@ -43,7 +43,7 @@ * * Created : 08/10/94 * Modified : 22/01/99 -- R.Earnshaw - * Faster, and small tweaks for StrongARM + * Faster, and small tweaks for StrongARM */ #include @@ -251,7 +251,7 @@ ENTRY(outsw) str r3, [r0] str ip, [r0] - + /* mov ip, r3, lsl #16 * orr ip, ip, ip, lsr #16 * str ip, [r0] @@ -358,7 +358,7 @@ ENTRY(outsw16) eor r3, r3, r4, lsl #16 /* r3 = (A^B^A)(B) = (B)(B) */ str r3, [r0] str r4, [r0] - + /* mov r3, r4, lsl #16 * orr r3, r3, r3, lsr #16 * str r3, [r0] Modified: head/sys/arm/arm/bus_space_base.c ============================================================================== --- head/sys/arm/arm/bus_space_base.c Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/bus_space_base.c Sun May 24 12:20:11 2015 (r283366) @@ -116,10 +116,10 @@ static struct bus_space arm_base_bus_spa .bs_c_8 = BS_UNIMPLEMENTED, /* read stream (single) */ - .bs_r_1_s = NULL, /* Use inline code in bus.h */ - .bs_r_2_s = NULL, /* Use inline code in bus.h */ - .bs_r_4_s = NULL, /* Use inline code in bus.h */ - .bs_r_8_s = NULL, /* Use inline code in bus.h */ + .bs_r_1_s = NULL, /* Use inline code in bus.h */ + .bs_r_2_s = NULL, /* Use inline code in bus.h */ + .bs_r_4_s = NULL, /* Use inline code in bus.h */ + .bs_r_8_s = NULL, /* Use inline code in bus.h */ /* read multiple stream */ .bs_rm_1_s = generic_bs_rm_1, @@ -134,10 +134,10 @@ static struct bus_space arm_base_bus_spa .bs_rr_8_s = BS_UNIMPLEMENTED, /* write stream (single) */ - .bs_w_1_s = NULL, /* Use inline code in bus.h */ - .bs_w_2_s = NULL, /* Use inline code in bus.h */ - .bs_w_4_s = NULL, /* Use inline code in bus.h */ - .bs_w_8_s = NULL, /* Use inline code in bus.h */ + .bs_w_1_s = NULL, /* Use inline code in bus.h */ + .bs_w_2_s = NULL, /* Use inline code in bus.h */ + .bs_w_4_s = NULL, /* Use inline code in bus.h */ + .bs_w_8_s = NULL, /* Use inline code in bus.h */ /* write multiple stream */ .bs_wm_1_s = generic_bs_wm_1, Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/busdma_machdep-v6.c Sun May 24 12:20:11 2015 (r283366) @@ -160,7 +160,7 @@ SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_d "Number of active maps for bus_dmamem_alloc buffers"); SYSCTL_UINT(_hw_busdma, OID_AUTO, maps_coherent, CTLFLAG_RD, &maps_coherent, 0, "Number of active maps with BUS_DMA_COHERENT flag set"); -SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_total, CTLFLAG_RD, +SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_total, CTLFLAG_RD, &maploads_total, "Number of load operations performed"); SYSCTL_COUNTER_U64(_hw_busdma, OID_AUTO, maploads_bounced, CTLFLAG_RD, &maploads_bounced, "Number of load operations that used bounce buffers"); @@ -230,14 +230,14 @@ busdma_init(void *dummy) uma_flags = 0; /* Create a cache of buffers in standard (cacheable) memory. */ - standard_allocator = busdma_bufalloc_create("buffer", + standard_allocator = busdma_bufalloc_create("buffer", arm_dcache_align, /* minimum_alignment */ - NULL, /* uma_alloc func */ + NULL, /* uma_alloc func */ NULL, /* uma_free func */ uma_flags); /* uma_zcreate_flags */ #ifdef INVARIANTS - /* + /* * Force UMA zone to allocate service structures like * slabs using own allocator. uma_debug code performs * atomic ops on uma_slab_t fields and safety of this @@ -251,8 +251,8 @@ busdma_init(void *dummy) */ coherent_allocator = busdma_bufalloc_create("coherent", arm_dcache_align, /* minimum_alignment */ - busdma_bufalloc_alloc_uncacheable, - busdma_bufalloc_free_uncacheable, + busdma_bufalloc_alloc_uncacheable, + busdma_bufalloc_free_uncacheable, uma_flags); /* uma_zcreate_flags */ } @@ -343,7 +343,7 @@ cacheline_bounce(bus_dmamap_t map, bus_a * address spaces. */ static __inline int -might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t addr, +might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t addr, bus_size_t size) { @@ -364,7 +364,7 @@ might_bounce(bus_dma_tag_t dmat, bus_dma * the DMA needs to bounce, otherwise any DMA within the zone bounces. */ static int -must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr, +must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr, bus_size_t size) { @@ -387,11 +387,11 @@ must_bounce(bus_dma_tag_t dmat, bus_dmam */ while (dmat != NULL && exclusion_bounce(dmat)) { if ((paddr >= dmat->lowaddr && paddr <= dmat->highaddr) && - (dmat->filter == NULL || + (dmat->filter == NULL || dmat->filter(dmat->filterarg, paddr) != 0)) return (1); dmat = dmat->parent; - } + } return (0); } @@ -554,7 +554,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, * number of pages in a transfer. */ maxsize = roundup2(maxsize, PAGE_SIZE) + PAGE_SIZE; - + if ((error = alloc_bounce_zone(newtag)) != 0) { free(newtag, M_DEVBUF); return (error); @@ -630,7 +630,7 @@ static int allocate_bz_and_pages(bus_dma struct bounce_zone *bz; int maxpages; int error; - + if (dmat->bounce_zone == NULL) if ((error = alloc_bounce_zone(dmat)) != 0) return (error); @@ -651,13 +651,13 @@ static int allocate_bz_and_pages(bus_dma if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 || (bz->map_count > 0 && bz->total_bpages < maxpages)) { int pages; - + pages = atop(roundup2(dmat->maxsize, PAGE_SIZE)) + 1; pages = MIN(maxpages - bz->total_bpages, pages); pages = MAX(pages, 2); if (alloc_bounce_pages(dmat, pages) < pages) return (ENOMEM); - + if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0) dmat->flags |= BUS_DMA_MIN_ALLOC_COMP; } @@ -676,7 +676,7 @@ allocate_map(bus_dma_tag_t dmat, int mfl * variable-sized array of sync_list structures. Following that * we allocate enough extra space to hold the array of bus_dma_segments. */ - KASSERT(dmat->nsegments <= MAX_DMA_SEGMENTS, + KASSERT(dmat->nsegments <= MAX_DMA_SEGMENTS, ("cannot allocate %u dma segments (max is %u)", dmat->nsegments, MAX_DMA_SEGMENTS)); segsize = sizeof(struct bus_dma_segment) * dmat->nsegments; @@ -931,7 +931,7 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm else paddr = pmap_extract(map->pmap, vaddr); if (must_bounce(dmat, map, paddr, - min(vendaddr - vaddr, (PAGE_SIZE - ((vm_offset_t)vaddr & + min(vendaddr - vaddr, (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK)))) != 0) { map->pagesneeded++; } @@ -1267,7 +1267,7 @@ _bus_dmamap_fix_user(vm_offset_t buf, bu bus_addr_t curaddr; vm_offset_t va; - /* + /* * each synclist entry is contained within a single page. * this would be needed if BUS_DMASYNC_POSTxxxx was implemented */ @@ -1339,7 +1339,7 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus cpu_dcache_wb_range((vm_offset_t)bpage->vaddr, bpage->datacount); l2cache_wb_range((vm_offset_t)bpage->vaddr, - (vm_offset_t)bpage->busaddr, + (vm_offset_t)bpage->busaddr, bpage->datacount); bpage = STAILQ_NEXT(bpage, links); } @@ -1387,10 +1387,10 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus startv = bpage->vaddr &~ arm_dcache_align_mask; startp = bpage->busaddr &~ arm_dcache_align_mask; len = bpage->datacount; - + if (startv != bpage->vaddr) len += bpage->vaddr & arm_dcache_align_mask; - if (len & arm_dcache_align_mask) + if (len & arm_dcache_align_mask) len = (len - (len & arm_dcache_align_mask)) + arm_dcache_align; @@ -1473,7 +1473,7 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus sl->busaddr, 1); } cpu_dcache_inv_range(sl->vaddr, sl->datacount); - l2cache_inv_range(sl->vaddr, sl->busaddr, + l2cache_inv_range(sl->vaddr, sl->busaddr, sl->datacount); sl++; } @@ -1485,7 +1485,7 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus case BUS_DMASYNC_POSTREAD: case BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE: while (sl != end) { - l2cache_inv_range(sl->vaddr, sl->busaddr, + l2cache_inv_range(sl->vaddr, sl->busaddr, sl->datacount); cpu_dcache_inv_range(sl->vaddr, sl->datacount); sl++; Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/busdma_machdep.c Sun May 24 12:20:11 2015 (r283366) @@ -237,7 +237,7 @@ dmamap_ctor(void *mem, int size, void *a * This is the dtor function passed to uma_zcreate() for the pool of dma maps. * It may need platform-specific changes if this code is copied . */ -static void +static void dmamap_dtor(void *mem, int size, void *arg) { bus_dmamap_t map; @@ -256,9 +256,9 @@ busdma_init(void *dummy) dmamap_ctor, dmamap_dtor, NULL, NULL, UMA_ALIGN_PTR, 0); /* Create a cache of buffers in standard (cacheable) memory. */ - standard_allocator = busdma_bufalloc_create("buffer", + standard_allocator = busdma_bufalloc_create("buffer", arm_dcache_align, /* minimum_alignment */ - NULL, /* uma_alloc func */ + NULL, /* uma_alloc func */ NULL, /* uma_free func */ 0); /* uma_zcreate_flags */ @@ -268,8 +268,8 @@ busdma_init(void *dummy) */ coherent_allocator = busdma_bufalloc_create("coherent", arm_dcache_align, /* minimum_alignment */ - busdma_bufalloc_alloc_uncacheable, - busdma_bufalloc_free_uncacheable, + busdma_bufalloc_alloc_uncacheable, + busdma_bufalloc_free_uncacheable, 0); /* uma_zcreate_flags */ } @@ -308,7 +308,7 @@ run_filter(bus_dma_tag_t dmat, bus_addr_ || (*dmat->filter)(dmat->filterarg, paddr) != 0)) retval = 1; - dmat = dmat->parent; + dmat = dmat->parent; } while (retval == 0 && dmat != NULL); return (retval); } @@ -531,13 +531,13 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) #endif if (dmat != NULL) { - + if (dmat->map_count != 0) return (EBUSY); - + while (dmat != NULL) { bus_dma_tag_t parent; - + parent = dmat->parent; atomic_subtract_int(&dmat->ref_count, 1); if (dmat->ref_count == 0) { @@ -588,7 +588,7 @@ bus_dmamap_create(bus_dma_tag_t dmat, in * now, because we can't sleep for resources at map load time. */ if (dmat->segments == NULL) { - dmat->segments = malloc(dmat->nsegments * + dmat->segments = malloc(dmat->nsegments * sizeof(*dmat->segments), M_DEVBUF, M_NOWAIT); if (dmat->segments == NULL) { free(slist, M_DEVBUF); @@ -701,7 +701,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi * now, because we can't sleep for resources at map load time. */ if (dmat->segments == NULL) - dmat->segments = malloc(dmat->nsegments * + dmat->segments = malloc(dmat->nsegments * sizeof(*dmat->segments), M_DEVBUF, mflags); slist = malloc(sizeof(*slist) * dmat->nsegments, M_DEVBUF, M_NOWAIT); @@ -918,7 +918,7 @@ _bus_dmamap_addseg(bus_dma_tag_t dmat, b * memory address to an address in the DMA window. */ curaddr = (curaddr - dr->dr_sysbase) + dr->dr_busbase; - + } seg = *segp; @@ -1206,7 +1206,7 @@ _bus_dmamap_sync_bp(bus_dma_tag_t dmat, STAILQ_FOREACH(bpage, &map->bpages, links) { if (op & BUS_DMASYNC_PREWRITE) { if (bpage->datavaddr != 0) - bcopy((void *)bpage->datavaddr, + bcopy((void *)bpage->datavaddr, (void *)bpage->vaddr, bpage->datacount); else physcopyout(bpage->dataaddr, Modified: head/sys/arm/arm/copystr.S ============================================================================== --- head/sys/arm/arm/copystr.S Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/copystr.S Sun May 24 12:20:11 2015 (r283366) @@ -38,7 +38,6 @@ * Created : 16/05/95 */ - #include "assym.s" #include #include Modified: head/sys/arm/arm/cpu_asm-v6.S ============================================================================== --- head/sys/arm/arm/cpu_asm-v6.S Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/cpu_asm-v6.S Sun May 24 12:20:11 2015 (r283366) @@ -33,10 +33,10 @@ #include #include -/* +/* * Define cache functions used by startup code, which counts on the fact that * only r0-r3,r12 (ip) are modified and no stack space is used. These functions - * must be called with interrupts disabled. Moreover, these work only with + * must be called with interrupts disabled. Moreover, these work only with * caches integrated to CPU (accessible via CP15); systems with an external L2 * cache controller such as a PL310 need separate calls to that device driver * to affect L2 caches. This is not a factor during early kernel startup, as Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/cpufunc.c Sun May 24 12:20:11 2015 (r283366) @@ -361,7 +361,7 @@ struct cpu_functions pj4bv7_cpufuncs = { struct cpu_functions xscale_cpufuncs = { /* CPU functions */ - + cpufunc_id, /* id */ xscale_cpwait, /* cpwait */ @@ -426,7 +426,7 @@ struct cpu_functions xscale_cpufuncs = { #ifdef CPU_XSCALE_81342 struct cpu_functions xscalec3_cpufuncs = { /* CPU functions */ - + cpufunc_id, /* id */ xscale_cpwait, /* cpwait */ @@ -553,63 +553,63 @@ struct cpu_functions fa526_cpufuncs = { #if defined(CPU_ARM1176) struct cpu_functions arm1176_cpufuncs = { /* CPU functions */ - + cpufunc_id, /* id */ cpufunc_nullop, /* cpwait */ - + /* MMU functions */ - + cpufunc_control, /* control */ cpufunc_domains, /* Domain */ arm11x6_setttb, /* Setttb */ cpufunc_faultstatus, /* Faultstatus */ cpufunc_faultaddress, /* Faultaddress */ - + /* TLB functions */ - + arm11_tlb_flushID, /* tlb_flushID */ arm11_tlb_flushID_SE, /* tlb_flushID_SE */ arm11_tlb_flushI, /* tlb_flushI */ arm11_tlb_flushI_SE, /* tlb_flushI_SE */ arm11_tlb_flushD, /* tlb_flushD */ arm11_tlb_flushD_SE, /* tlb_flushD_SE */ - + /* Cache operations */ - + arm11x6_icache_sync_all, /* icache_sync_all */ arm11x6_icache_sync_range, /* icache_sync_range */ - + arm11x6_dcache_wbinv_all, /* dcache_wbinv_all */ armv6_dcache_wbinv_range, /* dcache_wbinv_range */ armv6_dcache_inv_range, /* dcache_inv_range */ armv6_dcache_wb_range, /* dcache_wb_range */ - + armv6_idcache_inv_all, /* idcache_inv_all */ arm11x6_idcache_wbinv_all, /* idcache_wbinv_all */ arm11x6_idcache_wbinv_range, /* idcache_wbinv_range */ - + (void *)cpufunc_nullop, /* l2cache_wbinv_all */ (void *)cpufunc_nullop, /* l2cache_wbinv_range */ (void *)cpufunc_nullop, /* l2cache_inv_range */ (void *)cpufunc_nullop, /* l2cache_wb_range */ (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ - + /* Other functions */ - + arm11x6_flush_prefetchbuf, /* flush_prefetchbuf */ arm11_drain_writebuf, /* drain_writebuf */ cpufunc_nullop, /* flush_brnchtgt_C */ (void *)cpufunc_nullop, /* flush_brnchtgt_E */ - + arm11x6_sleep, /* sleep */ - + /* Soft functions */ - + cpufunc_null_fixup, /* dataabt_fixup */ cpufunc_null_fixup, /* prefetchabt_fixup */ - + arm11_context_switch, /* context_switch */ - + arm11x6_setup /* cpu setup */ }; #endif /*CPU_ARM1176 */ @@ -617,46 +617,46 @@ struct cpu_functions arm1176_cpufuncs = #if defined(CPU_CORTEXA) || defined(CPU_KRAIT) struct cpu_functions cortexa_cpufuncs = { /* CPU functions */ - + cpufunc_id, /* id */ cpufunc_nullop, /* cpwait */ - + /* MMU functions */ - + cpufunc_control, /* control */ cpufunc_domains, /* Domain */ armv7_setttb, /* Setttb */ cpufunc_faultstatus, /* Faultstatus */ cpufunc_faultaddress, /* Faultaddress */ - - /* + + /* * TLB functions. ARMv7 does all TLB ops based on a unified TLB model * whether the hardware implements separate I+D or not, so we use the * same 'ID' functions for all 3 variations. */ - + armv7_tlb_flushID, /* tlb_flushID */ armv7_tlb_flushID_SE, /* tlb_flushID_SE */ armv7_tlb_flushID, /* tlb_flushI */ armv7_tlb_flushID_SE, /* tlb_flushI_SE */ armv7_tlb_flushID, /* tlb_flushD */ armv7_tlb_flushID_SE, /* tlb_flushD_SE */ - + /* Cache operations */ - + armv7_icache_sync_all, /* icache_sync_all */ armv7_icache_sync_range, /* icache_sync_range */ - + armv7_dcache_wbinv_all, /* dcache_wbinv_all */ armv7_dcache_wbinv_range, /* dcache_wbinv_range */ armv7_dcache_inv_range, /* dcache_inv_range */ armv7_dcache_wb_range, /* dcache_wb_range */ - + armv7_idcache_inv_all, /* idcache_inv_all */ armv7_idcache_wbinv_all, /* idcache_wbinv_all */ armv7_idcache_wbinv_range, /* idcache_wbinv_range */ - - /* + + /* * Note: For CPUs using the PL310 the L2 ops are filled in when the * L2 cache controller is actually enabled. */ @@ -665,23 +665,23 @@ struct cpu_functions cortexa_cpufuncs = (void *)cpufunc_nullop, /* l2cache_inv_range */ (void *)cpufunc_nullop, /* l2cache_wb_range */ (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ - + /* Other functions */ - + cpufunc_nullop, /* flush_prefetchbuf */ armv7_drain_writebuf, /* drain_writebuf */ cpufunc_nullop, /* flush_brnchtgt_C */ (void *)cpufunc_nullop, /* flush_brnchtgt_E */ - + armv7_cpu_sleep, /* sleep */ - + /* Soft functions */ - + cpufunc_null_fixup, /* dataabt_fixup */ cpufunc_null_fixup, /* prefetchabt_fixup */ - + armv7_context_switch, /* context_switch */ - + cortexa_setup /* cpu setup */ }; #endif /* CPU_CORTEXA */ @@ -758,7 +758,7 @@ get_cachetype_cp15() __asm __volatile("mrc p15, 1, %0, c0, c0, 0" : "=r" (csize)); arm_cache_type[sel] = csize; - arm_dcache_align = 1 << + arm_dcache_align = 1 << (CPUV7_CT_xSIZE_LEN(csize) + 4); arm_dcache_align_mask = arm_dcache_align - 1; } @@ -913,12 +913,12 @@ set_cpufuncs() cpufuncs = cortexa_cpufuncs; cpu_reset_needs_v4_MMU_disable = 1; /* V4 or higher */ get_cachetype_cp15(); - + pmap_pte_init_mmu_v6(); goto out; } #endif /* CPU_CORTEXA */ - + #if defined(CPU_MV_PJ4B) if (cputype == CPU_ID_MV88SV581X_V7 || cputype == CPU_ID_MV88SV584X_V7 || @@ -1165,7 +1165,7 @@ arm11x6_setup(void) (3 << 30) | /* SBZ */ (1 << 29) | /* FA */ (1 << 28) | /* TR */ - (3 << 26) | /* SBZ */ + (3 << 26) | /* SBZ */ (3 << 19) | /* SBZ */ (1 << 17); /* SBZ */ @@ -1258,39 +1258,39 @@ void cortexa_setup(void) { int cpuctrl, cpuctrlmask; - + cpuctrlmask = CPU_CONTROL_MMU_ENABLE | /* MMU enable [0] */ CPU_CONTROL_AFLT_ENABLE | /* Alignment fault [1] */ CPU_CONTROL_DC_ENABLE | /* DCache enable [2] */ CPU_CONTROL_BPRD_ENABLE | /* Branch prediction [11] */ CPU_CONTROL_IC_ENABLE | /* ICache enable [12] */ CPU_CONTROL_VECRELOC; /* Vector relocation [13] */ - + cpuctrl = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE | CPU_CONTROL_BPRD_ENABLE; - + #ifndef ARM32_DISABLE_ALIGNMENT_FAULTS cpuctrl |= CPU_CONTROL_AFLT_ENABLE; #endif - + /* Switch to big endian */ #ifdef __ARMEB__ cpuctrl |= CPU_CONTROL_BEND_ENABLE; #endif - + /* Check if the vector page is at the high address (0xffff0000) */ if (vector_page == ARM_VECTORS_HIGH) cpuctrl |= CPU_CONTROL_VECRELOC; - + /* Clear out the cache */ cpu_idcache_wbinv_all(); - + /* Set the control register */ ctrl = cpuctrl; cpu_control(cpuctrlmask, cpuctrl); - + /* And again. */ cpu_idcache_wbinv_all(); #ifdef SMP Modified: head/sys/arm/arm/cpufunc_asm_arm11x6.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_arm11x6.S Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/cpufunc_asm_arm11x6.S Sun May 24 12:20:11 2015 (r283366) @@ -73,7 +73,7 @@ __FBSDID("$FreeBSD$"); * * Erratum 411920 in ARM1136 (fixed in r1p4) * Erratum 415045 in ARM1176 (fixed in r0p5?) - * + * * - value of arg 'reg' Should Be Zero */ #define Invalidate_I_cache(Rtmp1, Rtmp2) \ @@ -150,20 +150,20 @@ ENTRY_NP(arm11x6_icache_sync_range) /* Erratum ARM1176 371367 */ mrs r2, cpsr /* save the CPSR */ cpsid ifa /* disable interrupts (irq,fiq,abort) */ - mov r3, #0 + mov r3, #0 mcr p15, 0, r3, c13, c0, 0 /* write FCSE (uTLB invalidate) */ mcr p15, 0, r3, c7, c5, 4 /* flush prefetch buffer */ - add r3, pc, #0x24 + add r3, pc, #0x24 mcr p15, 0, r3, c7, c13, 1 /* prefetch I-cache line */ mcrr p15, 0, r1, r0, c5 /* invalidate I-cache range */ msr cpsr_cx, r2 /* local_irq_restore */ - nop - nop - nop - nop - nop - nop - nop + nop + nop + nop + nop + nop + nop + nop mcrr p15, 0, r1, r0, c12 /* clean and invalidate D cache range */ /* XXXNH */ mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ @@ -177,20 +177,20 @@ ENTRY_NP(arm11x6_idcache_wbinv_range) /* Erratum ARM1176 371367 */ mrs r2, cpsr /* save the CPSR */ cpsid ifa /* disable interrupts (irq,fiq,abort) */ - mov r3, #0 + mov r3, #0 mcr p15, 0, r3, c13, c0, 0 /* write FCSE (uTLB invalidate) */ mcr p15, 0, r3, c7, c5, 4 /* flush prefetch buffer */ - add r3, pc, #0x24 + add r3, pc, #0x24 mcr p15, 0, r3, c7, c13, 1 /* prefetch I-cache line */ mcrr p15, 0, r1, r0, c5 /* invalidate I-cache range */ msr cpsr_cx, r2 /* local_irq_restore */ - nop - nop - nop - nop - nop - nop - nop + nop + nop + nop + nop + nop + nop + nop mcrr p15, 0, r1, r0, c14 /* clean and invalidate D cache range */ mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ @@ -199,7 +199,7 @@ END(arm11x6_idcache_wbinv_range) /* * Preload the cache before issuing the WFI by conditionally disabling the - * mcr intstructions the first time around the loop. Ensure the function is + * mcr intstructions the first time around the loop. Ensure the function is * cacheline aligned. */ .arch armv6 Modified: head/sys/arm/arm/cpufunc_asm_arm9.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_arm9.S Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/cpufunc_asm_arm9.S Sun May 24 12:20:11 2015 (r283366) @@ -130,7 +130,7 @@ ENTRY(arm9_dcache_wb_range) bhi .Larm9_wb_next mov pc, lr END(arm9_dcache_wb_range) - + ENTRY(arm9_dcache_wbinv_range) ldr ip, .Larm9_line_size cmp r1, #0x4000 @@ -147,7 +147,7 @@ ENTRY(arm9_dcache_wbinv_range) bhi .Larm9_wbinv_next mov pc, lr END(arm9_dcache_wbinv_range) - + /* * Note, we must not invalidate everything. If the range is too big we * must use wb-inv of the entire cache. Modified: head/sys/arm/arm/cpufunc_asm_armv6.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_armv6.S Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/cpufunc_asm_armv6.S Sun May 24 12:20:11 2015 (r283366) @@ -37,7 +37,7 @@ /* * $FreeBSD$ */ - + #include .arch armv6 @@ -69,7 +69,7 @@ ENTRY(armv6_dcache_wb_range) mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ RET END(armv6_dcache_wb_range) - + /* LINTSTUB: void armv6_dcache_wbinv_range(vaddr_t, vsize_t); */ ENTRY(armv6_dcache_wbinv_range) add r1, r1, r0 @@ -78,7 +78,7 @@ ENTRY(armv6_dcache_wbinv_range) mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ RET END(armv6_dcache_wbinv_range) - + /* * Note, we must not invalidate everything. If the range is too big we * must use wb-inv of the entire cache. Modified: head/sys/arm/arm/cpufunc_asm_armv7.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_armv7.S Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/cpufunc_asm_armv7.S Sun May 24 12:20:11 2015 (r283366) @@ -64,7 +64,7 @@ __FBSDID("$FreeBSD$"); #define PT_OUTER_WT (2 << 3) #define PT_OUTER_WB (3 << 3) #define PT_OUTER_WBWA (1 << 3) - + #ifdef SMP #define PT_ATTR (PT_S|PT_INNER_WBWA|PT_OUTER_WBWA|PT_NOS) #else Modified: head/sys/arm/arm/cpufunc_asm_xscale_c3.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_xscale_c3.S Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/cpufunc_asm_xscale_c3.S Sun May 24 12:20:11 2015 (r283366) @@ -135,7 +135,7 @@ __FBSDID("$FreeBSD$"); ldr r4, .Lblock_userspace_access ; \ ldr ip, [r4] ; \ orr r0, ip, #1 ; \ - str r0, [r4] + str r0, [r4] #define XSCALE_CACHE_CLEAN_UNBLOCK \ str ip, [r3] ; \ @@ -217,7 +217,7 @@ ENTRY(xscalec3_cache_syncI_rng) CPWAIT_AND_RETURN(r0) END(xscalec3_cache_syncI_rng) - + ENTRY(xscalec3_cache_purgeD_rng) cmp r1, #0x4000 Modified: head/sys/arm/arm/cpuinfo.c ============================================================================== --- head/sys/arm/arm/cpuinfo.c Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/cpuinfo.c Sun May 24 12:20:11 2015 (r283366) @@ -48,7 +48,7 @@ void cpuinfo_init(void) { - cpuinfo.midr = cp15_midr_get(); + cpuinfo.midr = cp15_midr_get(); /* Test old version id schemes first */ if ((cpuinfo.midr & CPU_ID_IMPLEMENTOR_MASK) == CPU_ID_ARM_LTD) { if (CPU_ID_ISOLD(cpuinfo.midr)) { @@ -74,7 +74,7 @@ cpuinfo_init(void) /* non ARM -> must be new id scheme */ cpuinfo.architecture = (cpuinfo.midr >> 16) & 0x0F; cpuinfo.revision = (cpuinfo.midr >> 20) & 0x0F; - } + } /* Parse rest of MIDR */ cpuinfo.implementer = (cpuinfo.midr >> 24) & 0xFF; cpuinfo.part_number = (cpuinfo.midr >> 4) & 0xFFF; @@ -86,11 +86,11 @@ cpuinfo_init(void) cpuinfo.tlbtr = cp15_tlbtr_get(); cpuinfo.mpidr = cp15_mpidr_get(); cpuinfo.revidr = cp15_revidr_get(); - + /* if CPU is not v7 cpu id scheme */ if (cpuinfo.architecture != 0xF) return; - + cpuinfo.id_pfr0 = cp15_id_pfr0_get(); cpuinfo.id_pfr1 = cp15_id_pfr1_get(); cpuinfo.id_dfr0 = cp15_id_dfr0_get(); Modified: head/sys/arm/arm/db_interface.c ============================================================================== --- head/sys/arm/arm/db_interface.c Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/db_interface.c Sun May 24 12:20:11 2015 (r283366) @@ -326,12 +326,9 @@ branch_taken(u_int insn, db_addr_t pc) default: break; /* XXX */ } - } return (addr + offset); - } - case 0xa: /* b ... */ case 0xb: /* bl ... */ addr = ((insn << 2) & 0x03ffffff); Modified: head/sys/arm/arm/elf_trampoline.c ============================================================================== --- head/sys/arm/arm/elf_trampoline.c Sun May 24 12:12:01 2015 (r283365) +++ head/sys/arm/arm/elf_trampoline.c Sun May 24 12:20:11 2015 (r283366) @@ -93,7 +93,7 @@ extern void sheeva_l2cache_wbinv_all(voi #define cpu_idcache_wbinv_all armv7_idcache_wbinv_all #define cpu_l2cache_wbinv_all() #else -#define cpu_l2cache_wbinv_all() +#define cpu_l2cache_wbinv_all() #endif static void armadaxp_idcache_wbinv_all(void); @@ -216,7 +216,7 @@ _startC(void) "mov sp, %1\n" "mov pc, %0\n" : : "r" (target_addr), "r" (tmp_sp)); - + } #endif #ifdef KZIP @@ -225,7 +225,7 @@ _startC(void) sp += 2 * L1_TABLE_SIZE; #endif sp += 1024 * 1024; /* Should be enough for a stack */ - + __asm __volatile("adr %0, 2f\n" "bic %0, %0, #0xff000000\n" "and %1, %1, #0xff000000\n" @@ -366,7 +366,7 @@ get_cachetype_cp15() static void arm9_setup(void) { - + get_cachetype_cp15(); arm9_dcache_sets_inc = 1U << arm_dcache_l2_linesize; arm9_dcache_sets_max = (1U << (arm_dcache_l2_linesize + @@ -490,7 +490,7 @@ load_kernel(unsigned int kstart, unsigne vm_offset_t lastaddr = 0; Elf_Addr ssym = 0; Elf_Dyn *dp; - + eh = (Elf32_Ehdr *)kstart; ssym = 0; entry_point = (void*)eh->e_entry; @@ -504,7 +504,7 @@ load_kernel(unsigned int kstart, unsigne lastaddr = phdr[i].p_vaddr - KERNVIRTADDR + curaddr + phdr[i].p_memsz; } - + /* Save the symbol tables, as there're about to be scratched. */ memcpy(shdr, (void *)(kstart + eh->e_shoff), sizeof(*shdr) * eh->e_shnum); @@ -552,12 +552,12 @@ load_kernel(unsigned int kstart, unsigne lastaddr = roundup(lastaddr, sizeof(shdr[symstrindex].sh_size)); } - + } } if (!d) return ((void *)lastaddr); - + j = eh->e_phnum; for (i = 0; i < j; i++) { volatile char c; @@ -610,7 +610,7 @@ load_kernel(unsigned int kstart, unsigne ((void(*)(void))(entry_point - KERNVIRTADDR + curaddr))(); __asm __volatile(".globl func_end\n" "func_end:"); - + /* NOTREACHED */ return NULL; } @@ -653,7 +653,7 @@ setup_pagetables(unsigned int pt_addr, v "mov r0, r0\n" "sub pc, pc, #4\n" : "=r" (tmp) : "r" (pd), "r" (domain)); - + /* * XXX: This is the most stupid workaround I've ever wrote. * For some reason, the KB9202 won't boot the kernel unless @@ -680,7 +680,7 @@ __start(void) if (*kernel == 0x1f && kernel[1] == 0x8b) { pt_addr = (((int)&_end + KERNSIZE + 0x100) & ~(L1_TABLE_SIZE - 1)) + L1_TABLE_SIZE; - + #ifdef CPU_ARM9 /* So that idcache_wbinv works; */ if ((cpufunc_id() & 0x0000f000) == 0x00009000) @@ -715,7 +715,7 @@ __start(void) dst = (void *)(((vm_offset_t)dst & ~3)); pt_addr = ((unsigned int)dst &~(L1_TABLE_SIZE - 1)) + L1_TABLE_SIZE; setup_pagetables(pt_addr, (vm_paddr_t)curaddr, - (vm_paddr_t)curaddr + 0x10000000, 0); + (vm_paddr_t)curaddr + 0x10000000, 0); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun May 24 12:33:14 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2D6C4BF4; Sun, 24 May 2015 12:33:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 1BC391B9F; Sun, 24 May 2015 12:33:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OCXDjB064562; Sun, 24 May 2015 12:33:13 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OCXDQ7064558; Sun, 24 May 2015 12:33:13 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201505241233.t4OCXDQ7064558@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 24 May 2015 12:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283367 - in head/sys/arm: conf qemu X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 12:33:14 -0000 Author: andrew Date: Sun May 24 12:33:12 2015 New Revision: 283367 URL: https://svnweb.freebsd.org/changeset/base/283367 Log: Enable SMP on the qemu virt platform. We use the device tree to find which cpus to enable, and PSCI to start them. Added: head/sys/arm/qemu/virt_mp.c (contents, props changed) Modified: head/sys/arm/conf/VIRT head/sys/arm/qemu/files.qemu Modified: head/sys/arm/conf/VIRT ============================================================================== --- head/sys/arm/conf/VIRT Sun May 24 12:20:11 2015 (r283366) +++ head/sys/arm/conf/VIRT Sun May 24 12:33:12 2015 (r283367) @@ -24,8 +24,9 @@ include "std.armv6" include "../qemu/std.virt" options HZ=100 -options SCHED_4BSD # 4BSD scheduler +options SCHED_ULE # 4BSD scheduler options PLATFORM +options SMP # Enable multiple cores # Debugging for use in -current makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols Modified: head/sys/arm/qemu/files.qemu ============================================================================== --- head/sys/arm/qemu/files.qemu Sun May 24 12:20:11 2015 (r283366) +++ head/sys/arm/qemu/files.qemu Sun May 24 12:33:12 2015 (r283367) @@ -13,5 +13,6 @@ kern/kern_clocksource.c standard arm/arm/generic_timer.c standard arm/qemu/virt_common.c standard arm/qemu/virt_machdep.c standard +arm/qemu/virt_mp.c optional smp dev/ofw/ofw_cpu.c standard Added: head/sys/arm/qemu/virt_mp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/qemu/virt_mp.c Sun May 24 12:33:12 2015 (r283367) @@ -0,0 +1,119 @@ +/*- + * Copyright (c) 2015 Andrew Turner + * 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 +#include +#include + +static int running_cpus; + +int +platform_mp_probe(void) +{ + int ncpus; + + ncpus = ofw_cpu_early_foreach(NULL, true); + if (ncpus <= 1) { + mp_ncpus = 1; + return (0); + } + + mp_ncpus = MIN(ncpus, MAXCPU); + + return (1); +} + +static boolean_t +virt_maxid(u_int id, phandle_t node, u_int addr_cells, pcell_t *reg) +{ + + if (mp_maxid < id) + mp_maxid = id; + + return (true); +} + +void +platform_mp_setmaxid(void) +{ + + mp_maxid = PCPU_GET(cpuid); + ofw_cpu_early_foreach(virt_maxid, true); +} + +static boolean_t +virt_start_ap(u_int id, phandle_t node, u_int addr_cells, pcell_t *reg) +{ + int err; + + if (running_cpus >= mp_ncpus) + return (false); + running_cpus++; + + err = psci_cpu_on(*reg, pmap_kextract((vm_offset_t)mpentry), id); + + if (err != PSCI_RETVAL_SUCCESS) + return (false); + + return (true); +} + +void +platform_mp_start_ap(void) +{ + + ofw_cpu_early_foreach(virt_start_ap, true); +} + +void +platform_mp_init_secondary(void) +{ + + arm_init_secondary_ic(); +} + +void +platform_ipi_send(cpuset_t cpus, u_int ipi) +{ + + pic_ipi_send(cpus, ipi); +} From owner-svn-src-all@FreeBSD.ORG Sun May 24 13:24:20 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E8D071BE; Sun, 24 May 2015 13:24:20 +0000 (UTC) Received: from vps.hungerhost.com (vps.hungerhost.com [216.38.53.176]) (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 BC3F01FCD; Sun, 24 May 2015 13:24:20 +0000 (UTC) Received: from [65.255.63.100] (port=49668 helo=[10.144.4.135]) by vps.hungerhost.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82) (envelope-from ) id 1YwVt5-00084v-5w; Sun, 24 May 2015 09:24:19 -0400 From: "George Neville-Neil" To: "hiren panchasara" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r282240 - in head: cddl/lib/libdtrace sys/netinet Date: Sun, 24 May 2015 09:24:16 -0400 Message-ID: <820BB330-CCB9-46DE-86CF-3D233B84F69B@freebsd.org> In-Reply-To: <20150523215927.GM95600@strugglingcoder.info> References: <201504291719.t3THJtIM020724@svn.freebsd.org> <20150523215927.GM95600@strugglingcoder.info> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=_MailMate_43C74825-FD11-470C-B167-0F1CA0DD76A0_="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Mailer: MailMate (1.9.1r5084) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.hungerhost.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - freebsd.org X-Get-Message-Sender-Via: vps.hungerhost.com: authenticated_id: gnn@neville-neil.com X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 13:24:21 -0000 This is an OpenPGP/MIME signed message (RFC 3156 and 4880). --=_MailMate_43C74825-FD11-470C-B167-0F1CA0DD76A0_= Content-Type: text/plain On 23 May 2015, at 17:59, hiren panchasara wrote: > On 04/29/15 at 05:19P, George V. Neville-Neil wrote: >> Author: gnn >> Date: Wed Apr 29 17:19:55 2015 >> New Revision: 282240 >> URL: https://svnweb.freebsd.org/changeset/base/282240 >> >> Log: >> Brief demo script showing the various values that can be read via >> the new SIFTR statically defined tracepoint (SDT). >> >> Differential Revision: https://reviews.freebsd.org/D2387 >> Reviewed by: bz, markj >> >> Modified: >> head/cddl/lib/libdtrace/tcp.d >> head/sys/netinet/in_kdtrace.c >> head/sys/netinet/in_kdtrace.h >> head/sys/netinet/siftr.c > > George, > > This seems useful. Can this be MFC'd to 10? > I think it can be. I'll mark this and do it when I'm back from holiday. Nag me if I forget :-) Best, George --=_MailMate_43C74825-FD11-470C-B167-0F1CA0DD76A0_= Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlVh0QAACgkQYdh2wUQKM9JhuACfS5Si0cnIxMk5JxOZzt+PnbZB DmAAoLJ2nE7Q4SmpZ2WmFjOhDqZsCto8 =EWLV -----END PGP SIGNATURE----- --=_MailMate_43C74825-FD11-470C-B167-0F1CA0DD76A0_=-- From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:25:08 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2276D7D5; Sun, 24 May 2015 14:25:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 1062E159C; Sun, 24 May 2015 14:25:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEP8cg018802; Sun, 24 May 2015 14:25:08 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEP3J1018776; Sun, 24 May 2015 14:25:03 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505241425.t4OEP3J1018776@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 24 May 2015 14:25:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283368 - stable/10/sys/arm/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:25:08 -0000 Author: ian Date: Sun May 24 14:25:03 2015 New Revision: 283368 URL: https://svnweb.freebsd.org/changeset/base/283368 Log: MFC r276004: Fix the indentation to simplify comparing the ARM config files. Modified: stable/10/sys/arm/conf/BEAGLEBONE stable/10/sys/arm/conf/CNS11XXNAS stable/10/sys/arm/conf/CUBIEBOARD stable/10/sys/arm/conf/CUBIEBOARD2 stable/10/sys/arm/conf/DIGI-CCWMX53 stable/10/sys/arm/conf/DOCKSTAR stable/10/sys/arm/conf/DREAMPLUG-1001 stable/10/sys/arm/conf/EFIKA_MX stable/10/sys/arm/conf/EXYNOS5.common stable/10/sys/arm/conf/HL201 stable/10/sys/arm/conf/IMX53 stable/10/sys/arm/conf/IMX53-QSB stable/10/sys/arm/conf/IMX6 stable/10/sys/arm/conf/SAM9260EK stable/10/sys/arm/conf/VERSATILEPB stable/10/sys/arm/conf/VYBRID Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/conf/BEAGLEBONE ============================================================================== --- stable/10/sys/arm/conf/BEAGLEBONE Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/BEAGLEBONE Sun May 24 14:25:03 2015 (r283368) @@ -77,7 +77,7 @@ options DDB # Enable the kernel debug #options DIAGNOSTIC # NFS server support -#options NFSD +#options NFSD # NFS root from boopt/dhcp #options BOOTP Modified: stable/10/sys/arm/conf/CNS11XXNAS ============================================================================== --- stable/10/sys/arm/conf/CNS11XXNAS Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/CNS11XXNAS Sun May 24 14:25:03 2015 (r283368) @@ -103,7 +103,7 @@ device bpf device loop device md -device random # Entropy device +device random # Entropy device device usb @@ -114,12 +114,12 @@ device umass device scbus # SCSI bus (required for ATA/SCSI) device da # Direct Access (disks) device pass -device cfi +device cfi #device udav # Davicom DM9601E USB device geom_label device geom_journal -device geom_part_bsd +device geom_part_bsd options ROOTDEVNAME=\"ufs:da0s1a\" Modified: stable/10/sys/arm/conf/CUBIEBOARD ============================================================================== --- stable/10/sys/arm/conf/CUBIEBOARD Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/CUBIEBOARD Sun May 24 14:25:03 2015 (r283368) @@ -92,7 +92,7 @@ options ROOTDEVNAME=\"ufs:/dev/da0s2\" # ATA controllers #device ahci # AHCI-compatible SATA controllers #device ata # Legacy ATA/SATA controllers -#options ATA_STATIC_ID # Static device numbering +#options ATA_STATIC_ID # Static device numbering # Console and misc device uart Modified: stable/10/sys/arm/conf/CUBIEBOARD2 ============================================================================== --- stable/10/sys/arm/conf/CUBIEBOARD2 Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/CUBIEBOARD2 Sun May 24 14:25:03 2015 (r283368) @@ -93,7 +93,7 @@ options ROOTDEVNAME=\"ufs:/dev/da0s2\" # ATA controllers #device ahci # AHCI-compatible SATA controllers #device ata # Legacy ATA/SATA controllers -#options ATA_STATIC_ID # Static device numbering +#options ATA_STATIC_ID # Static device numbering # Console and misc device uart Modified: stable/10/sys/arm/conf/DIGI-CCWMX53 ============================================================================== --- stable/10/sys/arm/conf/DIGI-CCWMX53 Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/DIGI-CCWMX53 Sun May 24 14:25:03 2015 (r283368) @@ -22,7 +22,7 @@ include "IMX53" ident DIGI-CCWMX53 -makeoptions WITHOUT_MODULES="ahc" +makeoptions WITHOUT_MODULES="ahc" # required for netbooting #options BOOTP @@ -34,5 +34,5 @@ makeoptions WITHOUT_MODULES="ahc" #options ROOTDEVNAME=\"ufs:ada0s2a\" # Flattened Device Tree -options FDT_DTB_STATIC -makeoptions FDT_DTS_FILE=digi-ccwmx53.dts +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=digi-ccwmx53.dts Modified: stable/10/sys/arm/conf/DOCKSTAR ============================================================================== --- stable/10/sys/arm/conf/DOCKSTAR Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/DOCKSTAR Sun May 24 14:25:03 2015 (r283368) @@ -58,12 +58,12 @@ device faith # IPv6-to-IPv4 relaying device firmware # firmware(9) required for USB wlan device gif # IPv6 and IPv4 tunneling device loop # Network loopback -device md # Memory/malloc disk +device md # Memory/malloc disk device pty # BSD-style compatibility pseudo ttys device random # Entropy device -device tun # Packet tunnel. +device tun # Packet tunnel. device ether # Required for all ethernet devices -device vlan # 802.1Q VLAN support +device vlan # 802.1Q VLAN support device wlan # 802.11 WLAN support # cam support for umass and ahci @@ -81,66 +81,66 @@ device e1000phy # USB options USB_HOST_ALIGN=32 # Align DMA to cacheline -#options USB_DEBUG # Compile in USB debug support -device usb # Basic usb support -device ehci # USB host controller -device umass # Mass storage -device uhid # Human-interface devices -device rum # Ralink Technology RT2501USB wireless NICs -device uath # Atheros AR5523 wireless NICs -device ural # Ralink Technology RT2500USB wireless NICs -device zyd # ZyDAS zb1211/zb1211b wireless NICs -device urtw # Realtek RTL8187B/L USB -device upgt # Conexant/Intersil PrismGT SoftMAC USB -device u3g # USB-based 3G modems (Option, Huawei, Sierra) +#options USB_DEBUG # Compile in USB debug support +device usb # Basic usb support +device ehci # USB host controller +device umass # Mass storage +device uhid # Human-interface devices +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs +device urtw # Realtek RTL8187B/L USB +device upgt # Conexant/Intersil PrismGT SoftMAC USB +device u3g # USB-based 3G modems (Option, Huawei, Sierra) # I2C (TWSI) device iic device iicbus # Sound -device sound -device snd_uaudio +device sound +device snd_uaudio #crypto -device cesa # Marvell security engine -device crypto -device cryptodev +device cesa # Marvell security engine +device crypto +device cryptodev # IPSec -device enc -options IPSEC -options IPSEC_NAT_T -options TCP_SIGNATURE # include support for RFC 2385 +device enc +options IPSEC +options IPSEC_NAT_T +options TCP_SIGNATURE # include support for RFC 2385 # IPFW -options IPFIREWALL -options IPFIREWALL_DEFAULT_TO_ACCEPT -options IPFIREWALL_VERBOSE -options IPFIREWALL_VERBOSE_LIMIT=100 -options IPFIREWALL_NAT -options LIBALIAS -options DUMMYNET -options IPDIVERT +options IPFIREWALL +options IPFIREWALL_DEFAULT_TO_ACCEPT +options IPFIREWALL_VERBOSE +options IPFIREWALL_VERBOSE_LIMIT=100 +options IPFIREWALL_NAT +options LIBALIAS +options DUMMYNET +options IPDIVERT #PF -device pf -device pflog -device pfsync +device pf +device pflog +device pfsync # ALTQ, required for PF -options ALTQ # Basic ALTQ support -options ALTQ_CBQ # Class Based Queueing -options ALTQ_RED # Random Early Detection -options ALTQ_RIO # RED In/Out -options ALTQ_HFSC # Hierarchical Packet Scheduler -options ALTQ_CDNR # Traffic conditioner -options ALTQ_PRIQ # Priority Queueing -options ALTQ_NOPCC # Required if the TSC is unusable +options ALTQ # Basic ALTQ support +options ALTQ_CBQ # Class Based Queueing +options ALTQ_RED # Random Early Detection +options ALTQ_RIO # RED In/Out +options ALTQ_HFSC # Hierarchical Packet Scheduler +options ALTQ_CDNR # Traffic conditioner +options ALTQ_PRIQ # Priority Queueing +options ALTQ_NOPCC # Required if the TSC is unusable #options ALTQ_DEBUG # Debugging -makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols options BREAK_TO_DEBUGGER options ALT_BREAK_TO_DEBUGGER options DDB Modified: stable/10/sys/arm/conf/DREAMPLUG-1001 ============================================================================== --- stable/10/sys/arm/conf/DREAMPLUG-1001 Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/DREAMPLUG-1001 Sun May 24 14:25:03 2015 (r283368) @@ -58,22 +58,22 @@ options FDT_DTB_STATIC # Misc pseudo devices device bpf # Required for DHCP device faith # IPv6-to-IPv4 relaying (translation) -device firmware # firmware(9) required for USB wlan -device gif # IPv6 and IPv4 tunneling +device firmware # firmware(9) required for USB wlan +device gif # IPv6 and IPv4 tunneling device loop # Network loopback -device md # Memory/malloc disk +device md # Memory/malloc disk device pty # BSD-style compatibility pseudo ttys device random # Entropy device -device tun # Packet tunnel. +device tun # Packet tunnel. device ether # Required for all ethernet devices -device vlan # 802.1Q VLAN support +device vlan # 802.1Q VLAN support device wlan # 802.11 WLAN support # cam support for umass and ahci device scbus device pass device da -device cd +device cd # Serial ports device uart @@ -85,18 +85,18 @@ device e1000phy # USB options USB_HOST_ALIGN=32 # Align DMA to cacheline -#options USB_DEBUG # Compile in USB debug support -device usb # Basic usb support -device ehci # USB host controller -device umass # Mass storage -device uhid # Human-interface devices -device rum # Ralink Technology RT2501USB wireless NICs -device uath # Atheros AR5523 wireless NICs -device ural # Ralink Technology RT2500USB wireless NICs -device zyd # ZyDAS zb1211/zb1211b wireless NICs -device urtw # Realtek RTL8187B/L USB -device upgt # Conexant/Intersil PrismGT SoftMAC USB -device u3g # USB-based 3G modems (Option, Huawei, Sierra) +#options USB_DEBUG # Compile in USB debug support +device usb # Basic usb support +device ehci # USB host controller +device umass # Mass storage +device uhid # Human-interface devices +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs +device urtw # Realtek RTL8187B/L USB +device upgt # Conexant/Intersil PrismGT SoftMAC USB +device u3g # USB-based 3G modems (Option, Huawei, Sierra) # I2C (TWSI) device iic @@ -107,48 +107,48 @@ device mvs device ahci # Sound -device sound -device snd_uaudio +device sound +device snd_uaudio #crypto -device cesa # Marvell security engine -device crypto -device cryptodev +device cesa # Marvell security engine +device crypto +device cryptodev # IPSec -device enc -options IPSEC -options IPSEC_NAT_T -options TCP_SIGNATURE # include support for RFC 2385 +device enc +options IPSEC +options IPSEC_NAT_T +options TCP_SIGNATURE # include support for RFC 2385 # IPFW -options IPFIREWALL -options IPFIREWALL_DEFAULT_TO_ACCEPT -options IPFIREWALL_VERBOSE -options IPFIREWALL_VERBOSE_LIMIT=100 -options IPFIREWALL_NAT -options LIBALIAS -options DUMMYNET -options IPDIVERT +options IPFIREWALL +options IPFIREWALL_DEFAULT_TO_ACCEPT +options IPFIREWALL_VERBOSE +options IPFIREWALL_VERBOSE_LIMIT=100 +options IPFIREWALL_NAT +options LIBALIAS +options DUMMYNET +options IPDIVERT #PF -device pf -device pflog -device pfsync +device pf +device pflog +device pfsync # ALTQ, required for PF -options ALTQ # Basic ALTQ support -options ALTQ_CBQ # Class Based Queueing -options ALTQ_RED # Random Early Detection -options ALTQ_RIO # RED In/Out -options ALTQ_HFSC # Hierarchical Packet Scheduler -options ALTQ_CDNR # Traffic conditioner -options ALTQ_PRIQ # Priority Queueing -options ALTQ_NOPCC # Required if the TSC is unusable +options ALTQ # Basic ALTQ support +options ALTQ_CBQ # Class Based Queueing +options ALTQ_RED # Random Early Detection +options ALTQ_RIO # RED In/Out +options ALTQ_HFSC # Hierarchical Packet Scheduler +options ALTQ_CDNR # Traffic conditioner +options ALTQ_PRIQ # Priority Queueing +options ALTQ_NOPCC # Required if the TSC is unusable #options ALTQ_DEBUG # Debugging -makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols options BREAK_TO_DEBUGGER options ALT_BREAK_TO_DEBUGGER options DDB @@ -179,7 +179,7 @@ options ROOTDEVNAME=\"ufs:/dev/da1s1a\" # create a kernel config file that looks like this: # # include DREAMPLUG-1001 -# nomakeoptions FDT_DTS_FILE +# nomakeoptions FDT_DTS_FILE # makeoptions FDT_DTS_FILE=dreamplug-1001N.dts # device nand Modified: stable/10/sys/arm/conf/EFIKA_MX ============================================================================== --- stable/10/sys/arm/conf/EFIKA_MX Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/EFIKA_MX Sun May 24 14:25:03 2015 (r283368) @@ -22,7 +22,7 @@ ident EFIKA_MX include "../freescale/imx/std.imx51" -makeoptions WITHOUT_MODULES="ahc" +makeoptions WITHOUT_MODULES="ahc" options SCHED_4BSD # 4BSD scheduler options PREEMPTION # Enable kernel thread preemption @@ -187,7 +187,7 @@ makeoptions FDT_DTS_FILE=efikamx.dts # Uncomment following lines for framebuffer/syscons support device sc device kbdmux -options SC_DFLT_FONT # compile font in -makeoptions SC_DFLT_FONT=cp437 +options SC_DFLT_FONT # compile font in +makeoptions SC_DFLT_FONT=cp437 device ukbd # Allow keyboard like HIDs to control console device ums Modified: stable/10/sys/arm/conf/EXYNOS5.common ============================================================================== --- stable/10/sys/arm/conf/EXYNOS5.common Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/EXYNOS5.common Sun May 24 14:25:03 2015 (r283368) @@ -99,8 +99,8 @@ device gpio options USB_HOST_ALIGN=64 # Align usb buffers to cache line size. device usb options USB_DEBUG -#options USB_REQ_DEBUG -#options USB_VERBOSE +#options USB_REQ_DEBUG +#options USB_VERBOSE #device musb device ehci #device ohci Modified: stable/10/sys/arm/conf/HL201 ============================================================================== --- stable/10/sys/arm/conf/HL201 Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/HL201 Sun May 24 14:25:03 2015 (r283368) @@ -133,5 +133,5 @@ device nand # NAND interface on CS3 #makeoptions FDT_DTS_FILE=hl201.dts options EARLY_PRINTF -options SOCDEV_PA=0xfc000000 +options SOCDEV_PA=0xfc000000 options SOCDEV_VA=0xdc000000 Modified: stable/10/sys/arm/conf/IMX53 ============================================================================== --- stable/10/sys/arm/conf/IMX53 Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/IMX53 Sun May 24 14:25:03 2015 (r283368) @@ -170,5 +170,5 @@ options FDT # Configure using FDT/DTB #device sc #device vt #device kbdmux -#options SC_DFLT_FONT # compile font in -#makeoptions SC_DFLT_FONT=cp437 +#options SC_DFLT_FONT # compile font in +#makeoptions SC_DFLT_FONT=cp437 Modified: stable/10/sys/arm/conf/IMX53-QSB ============================================================================== --- stable/10/sys/arm/conf/IMX53-QSB Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/IMX53-QSB Sun May 24 14:25:03 2015 (r283368) @@ -34,5 +34,5 @@ options HZ=250 # 4ms scheduling quant #options ROOTDEVNAME=\"ufs:ada0s2a\" # Flattened Device Tree -options FDT_DTB_STATIC -makeoptions FDT_DTS_FILE=imx53-qsb.dts +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=imx53-qsb.dts Modified: stable/10/sys/arm/conf/IMX6 ============================================================================== --- stable/10/sys/arm/conf/IMX6 Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/IMX6 Sun May 24 14:25:03 2015 (r283368) @@ -98,7 +98,7 @@ device miibus # Required for ethernet device bpf # Berkeley packet filter (required for DHCP) # General-purpose input/output -device gpio +device gpio # Serial (COM) ports device uart # Multi-uart driver Modified: stable/10/sys/arm/conf/SAM9260EK ============================================================================== --- stable/10/sys/arm/conf/SAM9260EK Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/SAM9260EK Sun May 24 14:25:03 2015 (r283368) @@ -181,5 +181,5 @@ device nand # NAND interface on CS3 #makeoptions FDT_DTS_FILE=sam9260ek.dts options EARLY_PRINTF -options SOCDEV_PA=0xfc000000 +options SOCDEV_PA=0xfc000000 options SOCDEV_VA=0xdc000000 Modified: stable/10/sys/arm/conf/VERSATILEPB ============================================================================== --- stable/10/sys/arm/conf/VERSATILEPB Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/VERSATILEPB Sun May 24 14:25:03 2015 (r283368) @@ -106,8 +106,8 @@ device pass # Passthrough device (dir # Comment following lines for headless setup device sc device kbdmux -options SC_DFLT_FONT # compile font in -makeoptions SC_DFLT_FONT=cp437 +options SC_DFLT_FONT # compile font in +makeoptions SC_DFLT_FONT=cp437 options KDB options DDB # Enable the kernel debugger Modified: stable/10/sys/arm/conf/VYBRID ============================================================================== --- stable/10/sys/arm/conf/VYBRID Sun May 24 12:33:12 2015 (r283367) +++ stable/10/sys/arm/conf/VYBRID Sun May 24 14:25:03 2015 (r283368) @@ -110,8 +110,8 @@ device gpio options USB_HOST_ALIGN=32 # Align usb buffers to cache line size. device usb options USB_DEBUG -#options USB_REQ_DEBUG -#options USB_VERBOSE +#options USB_REQ_DEBUG +#options USB_VERBOSE #device musb device ehci #device ohci From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:29:36 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E8B32941; Sun, 24 May 2015 14:29:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 BCC5A15BF; Sun, 24 May 2015 14:29:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OETai1019399; Sun, 24 May 2015 14:29:36 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OETaMm019397; Sun, 24 May 2015 14:29:36 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241429.t4OETaMm019397@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:29:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283369 - in head/sys: amd64/linux32 i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:29:37 -0000 Author: dchagin Date: Sun May 24 14:29:35 2015 New Revision: 283369 URL: https://svnweb.freebsd.org/changeset/base/283369 Log: In preparation for switching linuxulator to the use the native 1:1 threads print the thread id in addition to the pid in debug messages. Modified: head/sys/amd64/linux32/linux.h head/sys/i386/linux/linux.h Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Sun May 24 14:25:03 2015 (r283368) +++ head/sys/amd64/linux32/linux.h Sun May 24 14:29:35 2015 (r283369) @@ -40,8 +40,10 @@ */ extern u_char linux_debug_map[]; #define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name) -#define ARGS(nm, fmt) "linux(%ld): "#nm"("fmt")\n", (long)td->td_proc->p_pid -#define LMSG(fmt) "linux(%ld): "fmt"\n", (long)td->td_proc->p_pid +#define ARGS(nm, fmt) "linux(%ld/%ld): "#nm"("fmt")\n", \ + (long)td->td_proc->p_pid, (long)td->td_tid +#define LMSG(fmt) "linux(%ld/%ld): "fmt"\n", \ + (long)td->td_proc->p_pid, (long)td->td_tid #define LINUX_DTRACE linuxulator32 #ifdef MALLOC_DECLARE Modified: head/sys/i386/linux/linux.h ============================================================================== --- head/sys/i386/linux/linux.h Sun May 24 14:25:03 2015 (r283368) +++ head/sys/i386/linux/linux.h Sun May 24 14:29:35 2015 (r283369) @@ -40,8 +40,10 @@ */ extern u_char linux_debug_map[]; #define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name) -#define ARGS(nm, fmt) "linux(%ld): "#nm"("fmt")\n", (long)td->td_proc->p_pid -#define LMSG(fmt) "linux(%ld): "fmt"\n", (long)td->td_proc->p_pid +#define ARGS(nm, fmt) "linux(%ld/%ld): "#nm"("fmt")\n", \ + (long)td->td_proc->p_pid, (long)td->td_tid +#define LMSG(fmt) "linux(%ld/%ld): "fmt"\n", \ + (long)td->td_proc->p_pid, (long)td->td_tid #define LINUX_DTRACE linuxulator #ifdef MALLOC_DECLARE From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:33:21 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 547D0AC8; Sun, 24 May 2015 14:33:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 287D3166A; Sun, 24 May 2015 14:33:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEXLCe023629; Sun, 24 May 2015 14:33:21 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEXKIk023625; Sun, 24 May 2015 14:33:20 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241433.t4OEXKIk023625@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:33:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283370 - in head/sys: amd64/linux32 compat/linux i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:33:21 -0000 Author: dchagin Date: Sun May 24 14:33:19 2015 New Revision: 283370 URL: https://svnweb.freebsd.org/changeset/base/283370 Log: In preparation for switching linuxulator to the use the native 1:1 threads introduce linux_exit() stub instead of sys_exit() call (which terminates process). In the new linuxulator exit() system call terminates the calling thread (not a whole process). Differential Revision: https://reviews.freebsd.org/D1027 Reviewed by: trasz Modified: head/sys/amd64/linux32/syscalls.master head/sys/compat/linux/linux_fork.c head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux32/syscalls.master ============================================================================== --- head/sys/amd64/linux32/syscalls.master Sun May 24 14:29:35 2015 (r283369) +++ head/sys/amd64/linux32/syscalls.master Sun May 24 14:33:19 2015 (r283370) @@ -38,8 +38,7 @@ ; #ifdef's, etc. may be included, and are copied to the output files. 0 AUE_NULL UNIMPL setup -1 AUE_EXIT NOPROTO { void sys_exit(int rval); } exit \ - sys_exit_args void +1 AUE_EXIT STD { void linux_exit(int rval); } 2 AUE_FORK STD { int linux_fork(void); } 3 AUE_NULL NOPROTO { int read(int fd, char *buf, \ u_int nbyte); } Modified: head/sys/compat/linux/linux_fork.c ============================================================================== --- head/sys/compat/linux/linux_fork.c Sun May 24 14:29:35 2015 (r283369) +++ head/sys/compat/linux/linux_fork.c Sun May 24 14:33:19 2015 (r283370) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef COMPAT_LINUX32 #include @@ -297,3 +298,16 @@ linux_clone(struct thread *td, struct li return (0); } + +int +linux_exit(struct thread *td, struct linux_exit_args *args) +{ + +#ifdef DEBUG + if (ldebug(exit)) + printf(ARGS(exit, "%d"), args->rval); +#endif + + exit1(td, W_EXITCODE(args->rval, 0)); + /* NOTREACHED */ +} Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Sun May 24 14:29:35 2015 (r283369) +++ head/sys/i386/linux/syscalls.master Sun May 24 14:33:19 2015 (r283370) @@ -37,8 +37,7 @@ ; #ifdef's, etc. may be included, and are copied to the output files. 0 AUE_NULL UNIMPL setup -1 AUE_EXIT NOPROTO { void sys_exit(int rval); } exit \ - sys_exit_args void +1 AUE_EXIT STD { void linux_exit(int rval); } 2 AUE_FORK STD { int linux_fork(void); } 3 AUE_NULL NOPROTO { int read(int fd, char *buf, \ u_int nbyte); } From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:34:49 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B417DC2C; Sun, 24 May 2015 14:34:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 96863167A; Sun, 24 May 2015 14:34:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEYncw023878; Sun, 24 May 2015 14:34:49 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEYkr0023857; Sun, 24 May 2015 14:34:46 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241434.t4OEYkr0023857@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:34:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283371 - in head/sys: amd64/linux32 i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:34:49 -0000 Author: dchagin Date: Sun May 24 14:34:46 2015 New Revision: 283371 URL: https://svnweb.freebsd.org/changeset/base/283371 Log: Regen for r283370. Modified: head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_syscall.h head/sys/amd64/linux32/linux32_syscalls.c head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux32/linux32_proto.h ============================================================================== --- head/sys/amd64/linux32/linux32_proto.h Sun May 24 14:33:19 2015 (r283370) +++ head/sys/amd64/linux32/linux32_proto.h Sun May 24 14:34:46 2015 (r283371) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 276508 2015-01-01 18:37:03Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283370 2015-05-24 14:33:19Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -35,6 +35,9 @@ struct thread; #endif #define nosys linux_nosys +struct linux_exit_args { + char rval_l_[PADL_(int)]; int rval; char rval_r_[PADR_(int)]; +}; struct linux_fork_args { register_t dummy; }; @@ -1105,6 +1108,7 @@ struct linux_process_vm_writev_args { register_t dummy; }; #define nosys linux_nosys +int linux_exit(struct thread *, struct linux_exit_args *); int linux_fork(struct thread *, struct linux_fork_args *); int linux_open(struct thread *, struct linux_open_args *); int linux_waitpid(struct thread *, struct linux_waitpid_args *); @@ -1407,6 +1411,7 @@ int linux_process_vm_writev(struct threa #endif /* COMPAT_FREEBSD7 */ +#define LINUX_SYS_AUE_linux_exit AUE_EXIT #define LINUX_SYS_AUE_linux_fork AUE_FORK #define LINUX_SYS_AUE_linux_open AUE_OPEN_RWTC #define LINUX_SYS_AUE_linux_waitpid AUE_WAIT4 Modified: head/sys/amd64/linux32/linux32_syscall.h ============================================================================== --- head/sys/amd64/linux32/linux32_syscall.h Sun May 24 14:33:19 2015 (r283370) +++ head/sys/amd64/linux32/linux32_syscall.h Sun May 24 14:34:46 2015 (r283371) @@ -3,10 +3,10 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 276508 2015-01-01 18:37:03Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283370 2015-05-24 14:33:19Z dchagin */ -#define LINUX_SYS_exit 1 +#define LINUX_SYS_linux_exit 1 #define LINUX_SYS_linux_fork 2 #define LINUX_SYS_read 3 #define LINUX_SYS_write 4 Modified: head/sys/amd64/linux32/linux32_syscalls.c ============================================================================== --- head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 14:33:19 2015 (r283370) +++ head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 14:34:46 2015 (r283371) @@ -3,13 +3,13 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 276508 2015-01-01 18:37:03Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283370 2015-05-24 14:33:19Z dchagin */ const char *linux_syscallnames[] = { #define nosys linux_nosys "#0", /* 0 = setup */ - "exit", /* 1 = exit */ + "linux_exit", /* 1 = linux_exit */ "linux_fork", /* 2 = linux_fork */ "read", /* 3 = read */ "write", /* 4 = write */ Modified: head/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysent.c Sun May 24 14:33:19 2015 (r283370) +++ head/sys/amd64/linux32/linux32_sysent.c Sun May 24 14:34:46 2015 (r283371) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 276508 2015-01-01 18:37:03Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283370 2015-05-24 14:33:19Z dchagin */ #include "opt_compat.h" @@ -20,7 +20,7 @@ struct sysent linux_sysent[] = { #define nosys linux_nosys { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 0 = setup */ - { AS(sys_exit_args), (sy_call_t *)sys_sys_exit, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 1 = exit */ + { AS(linux_exit_args), (sy_call_t *)linux_exit, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 1 = linux_exit */ { 0, (sy_call_t *)linux_fork, AUE_FORK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 2 = linux_fork */ { AS(read_args), (sy_call_t *)sys_read, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 3 = read */ { AS(write_args), (sy_call_t *)sys_write, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 4 = write */ Modified: head/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 14:33:19 2015 (r283370) +++ head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 14:34:46 2015 (r283371) @@ -12,9 +12,9 @@ systrace_args(int sysnum, void *params, int64_t *iarg = (int64_t *) uarg; switch (sysnum) { #define nosys linux_nosys - /* sys_exit */ + /* linux_exit */ case 1: { - struct sys_exit_args *p = params; + struct linux_exit_args *p = params; iarg[0] = p->rval; /* int */ *n_args = 1; break; @@ -2287,7 +2287,7 @@ systrace_entry_setargdesc(int sysnum, in const char *p = NULL; switch (sysnum) { #define nosys linux_nosys - /* sys_exit */ + /* linux_exit */ case 1: switch(ndx) { case 0: @@ -5502,7 +5502,7 @@ systrace_return_setargdesc(int sysnum, i const char *p = NULL; switch (sysnum) { #define nosys linux_nosys - /* sys_exit */ + /* linux_exit */ case 1: if (ndx == 0 || ndx == 1) p = "void"; Modified: head/sys/i386/linux/linux_proto.h ============================================================================== --- head/sys/i386/linux/linux_proto.h Sun May 24 14:33:19 2015 (r283370) +++ head/sys/i386/linux/linux_proto.h Sun May 24 14:34:46 2015 (r283371) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 276509 2015-01-01 18:41:34Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283370 2015-05-24 14:33:19Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -35,6 +35,9 @@ struct thread; #endif #define nosys linux_nosys +struct linux_exit_args { + char rval_l_[PADL_(int)]; int rval; char rval_r_[PADR_(int)]; +}; struct linux_fork_args { register_t dummy; }; @@ -1119,6 +1122,7 @@ struct linux_process_vm_writev_args { register_t dummy; }; #define nosys linux_nosys +int linux_exit(struct thread *, struct linux_exit_args *); int linux_fork(struct thread *, struct linux_fork_args *); int linux_open(struct thread *, struct linux_open_args *); int linux_waitpid(struct thread *, struct linux_waitpid_args *); @@ -1422,6 +1426,7 @@ int linux_process_vm_writev(struct threa #endif /* COMPAT_FREEBSD7 */ +#define LINUX_SYS_AUE_linux_exit AUE_EXIT #define LINUX_SYS_AUE_linux_fork AUE_FORK #define LINUX_SYS_AUE_linux_open AUE_OPEN_RWTC #define LINUX_SYS_AUE_linux_waitpid AUE_WAIT4 Modified: head/sys/i386/linux/linux_syscall.h ============================================================================== --- head/sys/i386/linux/linux_syscall.h Sun May 24 14:33:19 2015 (r283370) +++ head/sys/i386/linux/linux_syscall.h Sun May 24 14:34:46 2015 (r283371) @@ -3,10 +3,10 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 276509 2015-01-01 18:41:34Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283370 2015-05-24 14:33:19Z dchagin */ -#define LINUX_SYS_exit 1 +#define LINUX_SYS_linux_exit 1 #define LINUX_SYS_linux_fork 2 #define LINUX_SYS_read 3 #define LINUX_SYS_write 4 Modified: head/sys/i386/linux/linux_syscalls.c ============================================================================== --- head/sys/i386/linux/linux_syscalls.c Sun May 24 14:33:19 2015 (r283370) +++ head/sys/i386/linux/linux_syscalls.c Sun May 24 14:34:46 2015 (r283371) @@ -3,13 +3,13 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 276509 2015-01-01 18:41:34Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283370 2015-05-24 14:33:19Z dchagin */ const char *linux_syscallnames[] = { #define nosys linux_nosys "#0", /* 0 = setup */ - "exit", /* 1 = exit */ + "linux_exit", /* 1 = linux_exit */ "linux_fork", /* 2 = linux_fork */ "read", /* 3 = read */ "write", /* 4 = write */ Modified: head/sys/i386/linux/linux_sysent.c ============================================================================== --- head/sys/i386/linux/linux_sysent.c Sun May 24 14:33:19 2015 (r283370) +++ head/sys/i386/linux/linux_sysent.c Sun May 24 14:34:46 2015 (r283371) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 276509 2015-01-01 18:41:34Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283370 2015-05-24 14:33:19Z dchagin */ #include @@ -19,7 +19,7 @@ struct sysent linux_sysent[] = { #define nosys linux_nosys { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 0 = setup */ - { AS(sys_exit_args), (sy_call_t *)sys_sys_exit, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 1 = exit */ + { AS(linux_exit_args), (sy_call_t *)linux_exit, AUE_EXIT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 1 = linux_exit */ { 0, (sy_call_t *)linux_fork, AUE_FORK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 2 = linux_fork */ { AS(read_args), (sy_call_t *)sys_read, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 3 = read */ { AS(write_args), (sy_call_t *)sys_write, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 4 = write */ Modified: head/sys/i386/linux/linux_systrace_args.c ============================================================================== --- head/sys/i386/linux/linux_systrace_args.c Sun May 24 14:33:19 2015 (r283370) +++ head/sys/i386/linux/linux_systrace_args.c Sun May 24 14:34:46 2015 (r283371) @@ -12,9 +12,9 @@ systrace_args(int sysnum, void *params, int64_t *iarg = (int64_t *) uarg; switch (sysnum) { #define nosys linux_nosys - /* sys_exit */ + /* linux_exit */ case 1: { - struct sys_exit_args *p = params; + struct linux_exit_args *p = params; iarg[0] = p->rval; /* int */ *n_args = 1; break; @@ -2363,7 +2363,7 @@ systrace_entry_setargdesc(int sysnum, in const char *p = NULL; switch (sysnum) { #define nosys linux_nosys - /* sys_exit */ + /* linux_exit */ case 1: switch(ndx) { case 0: @@ -5733,7 +5733,7 @@ systrace_return_setargdesc(int sysnum, i const char *p = NULL; switch (sysnum) { #define nosys linux_nosys - /* sys_exit */ + /* linux_exit */ case 1: if (ndx == 0 || ndx == 1) p = "void"; From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:36:35 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0A5AFD7D; Sun, 24 May 2015 14:36:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 D11DD1687; Sun, 24 May 2015 14:36:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEaYMH024210; Sun, 24 May 2015 14:36:34 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEaYBf024207; Sun, 24 May 2015 14:36:34 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241436.t4OEaYBf024207@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:36:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283372 - 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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:36:35 -0000 Author: dchagin Date: Sun May 24 14:36:33 2015 New Revision: 283372 URL: https://svnweb.freebsd.org/changeset/base/283372 Log: In preparation for switching linuxulator to the use the native 1:1 threads split sys_thr_exit() up into sys_thr_exit() and kern_thr_exit(). Move Where the second will be used in linux_exit() system call later. Differential Revision: https://reviews.freebsd.org/D1028 Reviewed by: trasz Modified: head/sys/kern/kern_thr.c head/sys/sys/syscallsubr.h Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Sun May 24 14:34:46 2015 (r283371) +++ head/sys/kern/kern_thr.c Sun May 24 14:36:33 2015 (r283372) @@ -307,9 +307,6 @@ int sys_thr_exit(struct thread *td, struct thr_exit_args *uap) /* long *state */ { - struct proc *p; - - p = td->td_proc; /* Signal userland that it can free the stack. */ if ((void *)uap->state != NULL) { @@ -317,8 +314,17 @@ sys_thr_exit(struct thread *td, struct t kern_umtx_wake(td, uap->state, INT_MAX, 0); } - rw_wlock(&tidhash_lock); + return (kern_thr_exit(td)); +} + +int +kern_thr_exit(struct thread *td) +{ + struct proc *p; + p = td->td_proc; + + rw_wlock(&tidhash_lock); PROC_LOCK(p); if (p->p_numthreads != 1) { Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Sun May 24 14:34:46 2015 (r283371) +++ head/sys/sys/syscallsubr.h Sun May 24 14:36:33 2015 (r283372) @@ -214,6 +214,7 @@ int kern_ktimer_settime(struct thread *t int kern_ktimer_gettime(struct thread *td, int timer_id, struct itimerspec *val); int kern_ktimer_getoverrun(struct thread *td, int timer_id); +int kern_thr_exit(struct thread *td); int kern_thr_new(struct thread *td, struct thr_param *param); int kern_thr_suspend(struct thread *td, struct timespec *tsp); int kern_truncate(struct thread *td, char *path, enum uio_seg pathseg, From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:37:46 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C4A17EE0; Sun, 24 May 2015 14:37:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 98A76169B; Sun, 24 May 2015 14:37:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEbkG0024407; Sun, 24 May 2015 14:37:46 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEbkoM024405; Sun, 24 May 2015 14:37:46 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241437.t4OEbkoM024405@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:37:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283373 - 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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:37:46 -0000 Author: dchagin Date: Sun May 24 14:37:45 2015 New Revision: 283373 URL: https://svnweb.freebsd.org/changeset/base/283373 Log: In preparation for switching linuxulator to the use the native 1:1 threads introduce kern_thr_alloc() which will be used later in the linux_clone(). Differential Revision: https://reviews.freebsd.org/D1029 Reviewed by: trasz Modified: head/sys/kern/kern_thr.c head/sys/sys/syscallsubr.h Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Sun May 24 14:36:33 2015 (r283372) +++ head/sys/kern/kern_thr.c Sun May 24 14:37:45 2015 (r283373) @@ -162,12 +162,6 @@ create_thread(struct thread *td, mcontex p = td->td_proc; - /* Have race condition but it is cheap. */ - if (p->p_numthreads >= max_threads_per_proc) { - ++max_threads_hits; - return (EPROCLIM); - } - if (rtp != NULL) { switch(rtp->type) { case RTP_PRIO_REALTIME: @@ -197,11 +191,9 @@ create_thread(struct thread *td, mcontex #endif /* Initialize our td */ - newtd = thread_alloc(0); - if (newtd == NULL) { - error = ENOMEM; + error = kern_thr_alloc(p, 0, &newtd); + if (error) goto fail; - } cpu_set_upcall(newtd, td); @@ -566,3 +558,20 @@ sys_thr_set_name(struct thread *td, stru PROC_UNLOCK(p); return (error); } + +int +kern_thr_alloc(struct proc *p, int pages, struct thread **ntd) +{ + + /* Have race condition but it is cheap. */ + if (p->p_numthreads >= max_threads_per_proc) { + ++max_threads_hits; + return (EPROCLIM); + } + + *ntd = thread_alloc(pages); + if (*ntd == NULL) + return (ENOMEM); + + return (0); +} Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Sun May 24 14:36:33 2015 (r283372) +++ head/sys/sys/syscallsubr.h Sun May 24 14:37:45 2015 (r283373) @@ -214,6 +214,7 @@ int kern_ktimer_settime(struct thread *t int kern_ktimer_gettime(struct thread *td, int timer_id, struct itimerspec *val); int kern_ktimer_getoverrun(struct thread *td, int timer_id); +int kern_thr_alloc(struct proc *, int pages, struct thread **); int kern_thr_exit(struct thread *td); int kern_thr_new(struct thread *td, struct thr_param *param); int kern_thr_suspend(struct thread *td, struct timespec *tsp); From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:39:28 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2D472101; Sun, 24 May 2015 14:39:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 1B0BB16AD; Sun, 24 May 2015 14:39:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEdRmX024684; Sun, 24 May 2015 14:39:27 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEdRGD024680; Sun, 24 May 2015 14:39:27 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241439.t4OEdRGD024680@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283374 - in head/sys: amd64/linux32 compat/linux 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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:39:28 -0000 Author: dchagin Date: Sun May 24 14:39:26 2015 New Revision: 283374 URL: https://svnweb.freebsd.org/changeset/base/283374 Log: In preparation for switching linuxulator to the use the native 1:1 threads refactor kern_sched_rr_get_interval() and sys_sched_rr_get_interval(). Add a kern_sched_rr_get_interval() counterpart which takes a targettd parameter to allow specify target thread directly by callee (new Linuxulator). Linuxulator temporarily uses first thread in proc. Move linux_sched_rr_get_interval() to the MI part. Differential Revision: https://reviews.freebsd.org/D1032 Reviewed by: trasz Modified: head/sys/amd64/linux32/linux32_machdep.c head/sys/compat/linux/linux_misc.c head/sys/kern/p1003_1b.c head/sys/sys/syscallsubr.h Modified: head/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- head/sys/amd64/linux32/linux32_machdep.c Sun May 24 14:37:45 2015 (r283373) +++ head/sys/amd64/linux32/linux32_machdep.c Sun May 24 14:39:26 2015 (r283374) @@ -925,22 +925,6 @@ linux_getrusage(struct thread *td, struc } int -linux_sched_rr_get_interval(struct thread *td, - struct linux_sched_rr_get_interval_args *uap) -{ - struct timespec ts; - struct l_timespec ts32; - int error; - - error = kern_sched_rr_get_interval(td, uap->pid, &ts); - if (error != 0) - return (error); - ts32.tv_sec = ts.tv_sec; - ts32.tv_nsec = ts.tv_nsec; - return (copyout(&ts32, uap->interval, sizeof(ts32))); -} - -int linux_set_thread_area(struct thread *td, struct linux_set_thread_area_args *args) { Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun May 24 14:37:45 2015 (r283373) +++ head/sys/compat/linux/linux_misc.c Sun May 24 14:39:26 2015 (r283374) @@ -1928,3 +1928,33 @@ linux_sched_setaffinity(struct thread *t return (sys_cpuset_setaffinity(td, &csa)); } + +int +linux_sched_rr_get_interval(struct thread *td, + struct linux_sched_rr_get_interval_args *uap) +{ + struct timespec ts; + struct l_timespec lts; + struct thread *tdt; + struct proc *p; + int error; + + if (uap->pid == 0) { + tdt = td; + p = tdt->td_proc; + PROC_LOCK(p); + } else { + p = pfind(uap->pid); + if (p == NULL) + return (ESRCH); + tdt = FIRST_THREAD_IN_PROC(p); + } + + error = kern_sched_rr_get_interval_td(td, tdt, &ts); + PROC_UNLOCK(p); + if (error != 0) + return (error); + lts.tv_sec = ts.tv_sec; + lts.tv_nsec = ts.tv_nsec; + return (copyout(<s, uap->interval, sizeof(lts))); +} Modified: head/sys/kern/p1003_1b.c ============================================================================== --- head/sys/kern/p1003_1b.c Sun May 24 14:37:45 2015 (r283373) +++ head/sys/kern/p1003_1b.c Sun May 24 14:39:26 2015 (r283374) @@ -296,13 +296,26 @@ kern_sched_rr_get_interval(struct thread targettd = FIRST_THREAD_IN_PROC(targetp); } - e = p_cansee(td, targetp); - if (e == 0) - e = ksched_rr_get_interval(ksched, targettd, ts); + e = kern_sched_rr_get_interval_td(td, targettd, ts); PROC_UNLOCK(targetp); return (e); } +int +kern_sched_rr_get_interval_td(struct thread *td, struct thread *targettd, + struct timespec *ts) +{ + struct proc *p; + int error; + + p = targettd->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); + + error = p_cansee(td, p); + if (error == 0) + error = ksched_rr_get_interval(ksched, targettd, ts); + return (error); +} #endif static void Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Sun May 24 14:37:45 2015 (r283373) +++ head/sys/sys/syscallsubr.h Sun May 24 14:39:26 2015 (r283374) @@ -171,6 +171,8 @@ int kern_rmdirat(struct thread *td, int enum uio_seg pathseg); int kern_sched_rr_get_interval(struct thread *td, pid_t pid, struct timespec *ts); +int kern_sched_rr_get_interval_td(struct thread *td, struct thread *targettd, + struct timespec *ts); int kern_semctl(struct thread *td, int semid, int semnum, int cmd, union semun *arg, register_t *rval); int kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou, From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:40:42 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B58AF260; Sun, 24 May 2015 14:40:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 A3F4416BA; Sun, 24 May 2015 14:40:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEeg6I026851; Sun, 24 May 2015 14:40:42 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEegui026850; Sun, 24 May 2015 14:40:42 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241440.t4OEegui026850@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:40:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283375 - head/sys/i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:40:42 -0000 Author: dchagin Date: Sun May 24 14:40:41 2015 New Revision: 283375 URL: https://svnweb.freebsd.org/changeset/base/283375 Log: In preparation for switching linuxulator to the use the native 1:1 threads use MI linux_sched_rr_get_interval() in i386. Differential Revision: https://reviews.freebsd.org/D1033 Reviewed by: trasz Modified: head/sys/i386/linux/syscalls.master Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Sun May 24 14:39:26 2015 (r283374) +++ head/sys/i386/linux/syscalls.master Sun May 24 14:40:41 2015 (r283375) @@ -283,8 +283,8 @@ l_int policy); } 160 AUE_SCHED_GET_PRIORITY_MIN STD { int linux_sched_get_priority_min( \ l_int policy); } -161 AUE_SCHED_RR_GET_INTERVAL NOPROTO { int sched_rr_get_interval(l_pid_t pid, \ - struct l_timespec *interval); } +161 AUE_SCHED_RR_GET_INTERVAL STD { int linux_sched_rr_get_interval( \ + l_pid_t pid, struct l_timespec *interval); } 162 AUE_NULL STD { int linux_nanosleep( \ const struct l_timespec *rqtp, \ struct l_timespec *rmtp); } From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:43:08 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4C3273E3; Sun, 24 May 2015 14:43:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 2D0471767; Sun, 24 May 2015 14:43:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEh83J028846; Sun, 24 May 2015 14:43:08 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEh6tk028836; Sun, 24 May 2015 14:43:06 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241443.t4OEh6tk028836@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:43:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283376 - head/sys/i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:43:08 -0000 Author: dchagin Date: Sun May 24 14:43:06 2015 New Revision: 283376 URL: https://svnweb.freebsd.org/changeset/base/283376 Log: Regen for r283375. Modified: head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/i386/linux/linux_proto.h ============================================================================== --- head/sys/i386/linux/linux_proto.h Sun May 24 14:40:41 2015 (r283375) +++ head/sys/i386/linux/linux_proto.h Sun May 24 14:43:06 2015 (r283376) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283370 2015-05-24 14:33:19Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283375 2015-05-24 14:40:41Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -490,6 +490,10 @@ struct linux_sched_get_priority_max_args struct linux_sched_get_priority_min_args { char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)]; }; +struct linux_sched_rr_get_interval_args { + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char interval_l_[PADL_(struct l_timespec *)]; struct l_timespec * interval; char interval_r_[PADR_(struct l_timespec *)]; +}; struct linux_nanosleep_args { char rqtp_l_[PADL_(const struct l_timespec *)]; const struct l_timespec * rqtp; char rqtp_r_[PADR_(const struct l_timespec *)]; char rmtp_l_[PADL_(struct l_timespec *)]; struct l_timespec * rmtp; char rmtp_r_[PADR_(struct l_timespec *)]; @@ -1238,6 +1242,7 @@ int linux_sched_setscheduler(struct thre int linux_sched_getscheduler(struct thread *, struct linux_sched_getscheduler_args *); int linux_sched_get_priority_max(struct thread *, struct linux_sched_get_priority_max_args *); int linux_sched_get_priority_min(struct thread *, struct linux_sched_get_priority_min_args *); +int linux_sched_rr_get_interval(struct thread *, struct linux_sched_rr_get_interval_args *); int linux_nanosleep(struct thread *, struct linux_nanosleep_args *); int linux_mremap(struct thread *, struct linux_mremap_args *); int linux_setresuid16(struct thread *, struct linux_setresuid16_args *); @@ -1542,6 +1547,7 @@ int linux_process_vm_writev(struct threa #define LINUX_SYS_AUE_linux_sched_getscheduler AUE_SCHED_GETSCHEDULER #define LINUX_SYS_AUE_linux_sched_get_priority_max AUE_SCHED_GET_PRIORITY_MAX #define LINUX_SYS_AUE_linux_sched_get_priority_min AUE_SCHED_GET_PRIORITY_MIN +#define LINUX_SYS_AUE_linux_sched_rr_get_interval AUE_SCHED_RR_GET_INTERVAL #define LINUX_SYS_AUE_linux_nanosleep AUE_NULL #define LINUX_SYS_AUE_linux_mremap AUE_NULL #define LINUX_SYS_AUE_linux_setresuid16 AUE_SETRESUID Modified: head/sys/i386/linux/linux_syscall.h ============================================================================== --- head/sys/i386/linux/linux_syscall.h Sun May 24 14:40:41 2015 (r283375) +++ head/sys/i386/linux/linux_syscall.h Sun May 24 14:43:06 2015 (r283376) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283370 2015-05-24 14:33:19Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283375 2015-05-24 14:40:41Z dchagin */ #define LINUX_SYS_linux_exit 1 @@ -155,7 +155,7 @@ #define LINUX_SYS_sched_yield 158 #define LINUX_SYS_linux_sched_get_priority_max 159 #define LINUX_SYS_linux_sched_get_priority_min 160 -#define LINUX_SYS_sched_rr_get_interval 161 +#define LINUX_SYS_linux_sched_rr_get_interval 161 #define LINUX_SYS_linux_nanosleep 162 #define LINUX_SYS_linux_mremap 163 #define LINUX_SYS_linux_setresuid16 164 Modified: head/sys/i386/linux/linux_syscalls.c ============================================================================== --- head/sys/i386/linux/linux_syscalls.c Sun May 24 14:40:41 2015 (r283375) +++ head/sys/i386/linux/linux_syscalls.c Sun May 24 14:43:06 2015 (r283376) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283370 2015-05-24 14:33:19Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283375 2015-05-24 14:40:41Z dchagin */ const char *linux_syscallnames[] = { @@ -169,7 +169,7 @@ const char *linux_syscallnames[] = { "sched_yield", /* 158 = sched_yield */ "linux_sched_get_priority_max", /* 159 = linux_sched_get_priority_max */ "linux_sched_get_priority_min", /* 160 = linux_sched_get_priority_min */ - "sched_rr_get_interval", /* 161 = sched_rr_get_interval */ + "linux_sched_rr_get_interval", /* 161 = linux_sched_rr_get_interval */ "linux_nanosleep", /* 162 = linux_nanosleep */ "linux_mremap", /* 163 = linux_mremap */ "linux_setresuid16", /* 164 = linux_setresuid16 */ Modified: head/sys/i386/linux/linux_sysent.c ============================================================================== --- head/sys/i386/linux/linux_sysent.c Sun May 24 14:40:41 2015 (r283375) +++ head/sys/i386/linux/linux_sysent.c Sun May 24 14:43:06 2015 (r283376) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283370 2015-05-24 14:33:19Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283375 2015-05-24 14:40:41Z dchagin */ #include @@ -179,7 +179,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)sys_sched_yield, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 158 = sched_yield */ { AS(linux_sched_get_priority_max_args), (sy_call_t *)linux_sched_get_priority_max, AUE_SCHED_GET_PRIORITY_MAX, NULL, 0, 0, 0, SY_THR_STATIC }, /* 159 = linux_sched_get_priority_max */ { AS(linux_sched_get_priority_min_args), (sy_call_t *)linux_sched_get_priority_min, AUE_SCHED_GET_PRIORITY_MIN, NULL, 0, 0, 0, SY_THR_STATIC }, /* 160 = linux_sched_get_priority_min */ - { AS(sched_rr_get_interval_args), (sy_call_t *)sys_sched_rr_get_interval, AUE_SCHED_RR_GET_INTERVAL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 161 = sched_rr_get_interval */ + { AS(linux_sched_rr_get_interval_args), (sy_call_t *)linux_sched_rr_get_interval, AUE_SCHED_RR_GET_INTERVAL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 161 = linux_sched_rr_get_interval */ { AS(linux_nanosleep_args), (sy_call_t *)linux_nanosleep, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 162 = linux_nanosleep */ { AS(linux_mremap_args), (sy_call_t *)linux_mremap, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 163 = linux_mremap */ { AS(linux_setresuid16_args), (sy_call_t *)linux_setresuid16, AUE_SETRESUID, NULL, 0, 0, 0, SY_THR_STATIC }, /* 164 = linux_setresuid16 */ Modified: head/sys/i386/linux/linux_systrace_args.c ============================================================================== --- head/sys/i386/linux/linux_systrace_args.c Sun May 24 14:40:41 2015 (r283375) +++ head/sys/i386/linux/linux_systrace_args.c Sun May 24 14:43:06 2015 (r283376) @@ -1132,9 +1132,9 @@ systrace_args(int sysnum, void *params, *n_args = 1; break; } - /* sched_rr_get_interval */ + /* linux_sched_rr_get_interval */ case 161: { - struct sched_rr_get_interval_args *p = params; + struct linux_sched_rr_get_interval_args *p = params; iarg[0] = p->pid; /* l_pid_t */ uarg[1] = (intptr_t) p->interval; /* struct l_timespec * */ *n_args = 2; @@ -4057,7 +4057,7 @@ systrace_entry_setargdesc(int sysnum, in break; }; break; - /* sched_rr_get_interval */ + /* linux_sched_rr_get_interval */ case 161: switch(ndx) { case 0: @@ -6397,7 +6397,7 @@ systrace_return_setargdesc(int sysnum, i if (ndx == 0 || ndx == 1) p = "int"; break; - /* sched_rr_get_interval */ + /* linux_sched_rr_get_interval */ case 161: if (ndx == 0 || ndx == 1) p = "int"; From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:44:08 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 14E18532; Sun, 24 May 2015 14:44:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 E9BE71771; Sun, 24 May 2015 14:44:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEi71g029042; Sun, 24 May 2015 14:44:07 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEi7Ic029040; Sun, 24 May 2015 14:44:07 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241444.t4OEi7Ic029040@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:44:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283377 - 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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:44:08 -0000 Author: dchagin Date: Sun May 24 14:44:06 2015 New Revision: 283377 URL: https://svnweb.freebsd.org/changeset/base/283377 Log: In preparation for switching linuxulator to the use the native 1:1 threads split sys_sched_getparam(), sys_sched_setparam(), sys_sched_getscheduler(), sys_sched_setscheduler() to their kern_* counterparts and add targettd parameter to allow specify the target thread directly by callee. Differential Revision: https://reviews.freebsd.org/D1034 Reviewed by: trasz Modified: head/sys/kern/p1003_1b.c head/sys/sys/syscallsubr.h Modified: head/sys/kern/p1003_1b.c ============================================================================== --- head/sys/kern/p1003_1b.c Sun May 24 14:43:06 2015 (r283376) +++ head/sys/kern/p1003_1b.c Sun May 24 14:44:06 2015 (r283377) @@ -130,16 +130,29 @@ sys_sched_setparam(struct thread *td, st targettd = FIRST_THREAD_IN_PROC(targetp); } - e = p_cansched(td, targetp); - if (e == 0) { - e = ksched_setparam(ksched, targettd, - (const struct sched_param *)&sched_param); - } + e = kern_sched_setparam(td, targettd, &sched_param); PROC_UNLOCK(targetp); return (e); } int +kern_sched_setparam(struct thread *td, struct thread *targettd, + struct sched_param *param) +{ + struct proc *targetp; + int error; + + targetp = targettd->td_proc; + PROC_LOCK_ASSERT(targetp, MA_OWNED); + + error = p_cansched(td, targetp); + if (error == 0) + error = ksched_setparam(ksched, targettd, + (const struct sched_param *)param); + return (error); +} + +int sys_sched_getparam(struct thread *td, struct sched_getparam_args *uap) { int e; @@ -159,10 +172,7 @@ sys_sched_getparam(struct thread *td, st targettd = FIRST_THREAD_IN_PROC(targetp); } - e = p_cansee(td, targetp); - if (e == 0) { - e = ksched_getparam(ksched, targettd, &sched_param); - } + e = kern_sched_getparam(td, targettd, &sched_param); PROC_UNLOCK(targetp); if (e == 0) e = copyout(&sched_param, uap->param, sizeof(sched_param)); @@ -170,6 +180,22 @@ sys_sched_getparam(struct thread *td, st } int +kern_sched_getparam(struct thread *td, struct thread *targettd, + struct sched_param *param) +{ + struct proc *targetp; + int error; + + targetp = targettd->td_proc; + PROC_LOCK_ASSERT(targetp, MA_OWNED); + + error = p_cansee(td, targetp); + if (error == 0) + error = ksched_getparam(ksched, targettd, param); + return (error); +} + +int sys_sched_setscheduler(struct thread *td, struct sched_setscheduler_args *uap) { int e; @@ -177,11 +203,6 @@ sys_sched_setscheduler(struct thread *td struct thread *targettd; struct proc *targetp; - /* Don't allow non root user to set a scheduler policy. */ - e = priv_check(td, PRIV_SCHED_SET); - if (e) - return (e); - e = copyin(uap->param, &sched_param, sizeof(sched_param)); if (e) return (e); @@ -197,16 +218,35 @@ sys_sched_setscheduler(struct thread *td targettd = FIRST_THREAD_IN_PROC(targetp); } - e = p_cansched(td, targetp); - if (e == 0) { - e = ksched_setscheduler(ksched, targettd, - uap->policy, (const struct sched_param *)&sched_param); - } + e = kern_sched_setscheduler(td, targettd, uap->policy, + &sched_param); PROC_UNLOCK(targetp); return (e); } int +kern_sched_setscheduler(struct thread *td, struct thread *targettd, + int policy, struct sched_param *param) +{ + struct proc *targetp; + int error; + + targetp = targettd->td_proc; + PROC_LOCK_ASSERT(targetp, MA_OWNED); + + /* Don't allow non root user to set a scheduler policy. */ + error = priv_check(td, PRIV_SCHED_SET); + if (error) + return (error); + + error = p_cansched(td, targetp); + if (error == 0) + error = ksched_setscheduler(ksched, targettd, policy, + (const struct sched_param *)param); + return (error); +} + +int sys_sched_getscheduler(struct thread *td, struct sched_getscheduler_args *uap) { int e, policy; @@ -224,17 +264,31 @@ sys_sched_getscheduler(struct thread *td targettd = FIRST_THREAD_IN_PROC(targetp); } - e = p_cansee(td, targetp); - if (e == 0) { - e = ksched_getscheduler(ksched, targettd, &policy); - td->td_retval[0] = policy; - } + e = kern_sched_getscheduler(td, targettd, &policy); PROC_UNLOCK(targetp); + if (e == 0) + td->td_retval[0] = policy; return (e); } int +kern_sched_getscheduler(struct thread *td, struct thread *targettd, + int *policy) +{ + struct proc *targetp; + int error; + + targetp = targettd->td_proc; + PROC_LOCK_ASSERT(targetp, MA_OWNED); + + error = p_cansee(td, targetp); + if (error == 0) + error = ksched_getscheduler(ksched, targettd, policy); + return (error); +} + +int sys_sched_yield(struct thread *td, struct sched_yield_args *uap) { Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Sun May 24 14:43:06 2015 (r283376) +++ head/sys/sys/syscallsubr.h Sun May 24 14:44:06 2015 (r283377) @@ -55,6 +55,7 @@ struct sendfile_args; struct sockaddr; struct stat; struct thr_param; +struct sched_param; struct __wrusage; int kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, @@ -169,6 +170,14 @@ int kern_renameat(struct thread *td, int char *new, enum uio_seg pathseg); int kern_rmdirat(struct thread *td, int fd, char *path, enum uio_seg pathseg); +int kern_sched_getparam(struct thread *td, struct thread *targettd, + struct sched_param *param); +int kern_sched_getscheduler(struct thread *td, struct thread *targettd, + int *policy); +int kern_sched_setparam(struct thread *td, struct thread *targettd, + struct sched_param *param); +int kern_sched_setscheduler(struct thread *td, struct thread *targettd, + int policy, struct sched_param *param); int kern_sched_rr_get_interval(struct thread *td, pid_t pid, struct timespec *ts); int kern_sched_rr_get_interval_td(struct thread *td, struct thread *targettd, From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:44:57 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE4BA686; Sun, 24 May 2015 14:44:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 BCC0C177E; Sun, 24 May 2015 14:44:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEivPX029209; Sun, 24 May 2015 14:44:57 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEiv78029208; Sun, 24 May 2015 14:44:57 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241444.t4OEiv78029208@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:44:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283378 - head/sys/amd64/linux32 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:44:57 -0000 Author: dchagin Date: Sun May 24 14:44:57 2015 New Revision: 283378 URL: https://svnweb.freebsd.org/changeset/base/283378 Log: Remove a now unused include. Differential Revision: https://reviews.freebsd.org/D1035 Reviewed by: trasz Modified: head/sys/amd64/linux32/linux32_machdep.c Modified: head/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- head/sys/amd64/linux32/linux32_machdep.c Sun May 24 14:44:06 2015 (r283377) +++ head/sys/amd64/linux32/linux32_machdep.c Sun May 24 14:44:57 2015 (r283378) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:45:59 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1B4447ED; Sun, 24 May 2015 14:45:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 09823178E; Sun, 24 May 2015 14:45:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEjwId029446; Sun, 24 May 2015 14:45:58 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEjwFW029435; Sun, 24 May 2015 14:45:58 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241445.t4OEjwFW029435@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:45:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283379 - in head/sys: amd64/linux32 compat/linux i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:45:59 -0000 Author: dchagin Date: Sun May 24 14:45:57 2015 New Revision: 283379 URL: https://svnweb.freebsd.org/changeset/base/283379 Log: Implement a Linux version of sched_getparam() && sched_setparam(). Temporarily use the first thread in proc. Differential Revision: https://reviews.freebsd.org/D1036 Reviewed by: trasz Modified: head/sys/amd64/linux32/syscalls.master head/sys/compat/linux/linux_misc.c head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux32/syscalls.master ============================================================================== --- head/sys/amd64/linux32/syscalls.master Sun May 24 14:44:57 2015 (r283378) +++ head/sys/amd64/linux32/syscalls.master Sun May 24 14:45:57 2015 (r283379) @@ -267,10 +267,10 @@ 151 AUE_MUNLOCK NOPROTO { int munlock(const void *addr, size_t len); } 152 AUE_MLOCKALL NOPROTO { int mlockall(int how); } 153 AUE_MUNLOCKALL NOPROTO { int munlockall(void); } -154 AUE_SCHED_SETPARAM NOPROTO { int sched_setparam(pid_t pid, \ - const struct sched_param *param); } -155 AUE_SCHED_GETPARAM NOPROTO { int sched_getparam(pid_t pid, \ - struct sched_param *param); } +154 AUE_SCHED_SETPARAM STD { int linux_sched_setparam(l_pid_t pid, \ + struct l_sched_param *param); } +155 AUE_SCHED_GETPARAM STD { int linux_sched_getparam(l_pid_t pid, \ + struct l_sched_param *param); } 156 AUE_SCHED_SETSCHEDULER STD { int linux_sched_setscheduler( \ l_pid_t pid, l_int policy, \ struct l_sched_param *param); } Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun May 24 14:44:57 2015 (r283378) +++ head/sys/compat/linux/linux_misc.c Sun May 24 14:45:57 2015 (r283379) @@ -1873,6 +1873,78 @@ linux_prctl(struct thread *td, struct li return (error); } +int +linux_sched_setparam(struct thread *td, + struct linux_sched_setparam_args *uap) +{ + struct sched_param sched_param; + struct thread *tdt; + struct proc *p; + int error; + +#ifdef DEBUG + if (ldebug(sched_setparam)) + printf(ARGS(sched_setparam, "%d, *"), uap->pid); +#endif + + error = copyin(uap->param, &sched_param, sizeof(sched_param)); + if (error) + return (error); + + if (uap->pid == 0) { + tdt = td; + p = tdt->td_proc; + PROC_LOCK(p); + } else { + p = pfind(uap->pid); + if (p == NULL) + return (ESRCH); + /* + * XXX. Scheduling parameters are in fact per-thread + * attributes in Linux. Temporarily use the first + * thread in proc. The same for get_param(). + */ + tdt = FIRST_THREAD_IN_PROC(p); + } + + error = kern_sched_setparam(td, tdt, &sched_param); + PROC_UNLOCK(p); + return (error); +} + +int +linux_sched_getparam(struct thread *td, + struct linux_sched_getparam_args *uap) +{ + struct sched_param sched_param; + struct thread *tdt; + struct proc *p; + int error; + +#ifdef DEBUG + if (ldebug(sched_getparam)) + printf(ARGS(sched_getparam, "%d, *"), uap->pid); +#endif + + if (uap->pid == 0) { + tdt = td; + p = tdt->td_proc; + PROC_LOCK(p); + } else { + p = pfind(uap->pid); + if (p == NULL) + return (ESRCH); + tdt = FIRST_THREAD_IN_PROC(p); + } + + error = kern_sched_getparam(td, tdt, &sched_param); + PROC_UNLOCK(p); + if (error == 0) + error = copyout(&sched_param, uap->param, + sizeof(sched_param)); + return (error); +} + /* * Get affinity of a process. */ Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Sun May 24 14:44:57 2015 (r283378) +++ head/sys/i386/linux/syscalls.master Sun May 24 14:45:57 2015 (r283379) @@ -269,10 +269,10 @@ 151 AUE_MUNLOCK NOPROTO { int munlock(const void *addr, size_t len); } 152 AUE_MLOCKALL NOPROTO { int mlockall(int how); } 153 AUE_MUNLOCKALL NOPROTO { int munlockall(void); } -154 AUE_SCHED_SETPARAM NOPROTO { int sched_setparam(pid_t pid, \ - const struct sched_param *param); } -155 AUE_SCHED_GETPARAM NOPROTO { int sched_getparam(pid_t pid, \ - struct sched_param *param); } +154 AUE_SCHED_SETPARAM STD { int linux_sched_setparam(l_pid_t pid, \ + struct l_sched_param *param); } +155 AUE_SCHED_GETPARAM STD { int linux_sched_getparam(l_pid_t pid, \ + struct l_sched_param *param); } 156 AUE_SCHED_SETSCHEDULER STD { int linux_sched_setscheduler( \ l_pid_t pid, l_int policy, \ struct l_sched_param *param); } From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:47:03 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 78525951; Sun, 24 May 2015 14:47:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 65A1817A3; Sun, 24 May 2015 14:47:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEl3P6029676; Sun, 24 May 2015 14:47:03 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEl0pd029660; Sun, 24 May 2015 14:47:00 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241447.t4OEl0pd029660@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:47:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283380 - in head/sys: amd64/linux32 i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:47:03 -0000 Author: dchagin Date: Sun May 24 14:47:00 2015 New Revision: 283380 URL: https://svnweb.freebsd.org/changeset/base/283380 Log: Regen for r283379. Modified: head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_syscall.h head/sys/amd64/linux32/linux32_syscalls.c head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux32/linux32_proto.h ============================================================================== --- head/sys/amd64/linux32/linux32_proto.h Sun May 24 14:45:57 2015 (r283379) +++ head/sys/amd64/linux32/linux32_proto.h Sun May 24 14:47:00 2015 (r283380) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283370 2015-05-24 14:33:19Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283379 2015-05-24 14:45:57Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -478,6 +478,14 @@ struct linux_fdatasync_args { struct linux_sysctl_args { char args_l_[PADL_(struct l___sysctl_args *)]; struct l___sysctl_args * args; char args_r_[PADR_(struct l___sysctl_args *)]; }; +struct linux_sched_setparam_args { + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)]; +}; +struct linux_sched_getparam_args { + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)]; +}; struct linux_sched_setscheduler_args { char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)]; @@ -1220,6 +1228,8 @@ int linux_writev(struct thread *, struct int linux_getsid(struct thread *, struct linux_getsid_args *); int linux_fdatasync(struct thread *, struct linux_fdatasync_args *); int linux_sysctl(struct thread *, struct linux_sysctl_args *); +int linux_sched_setparam(struct thread *, struct linux_sched_setparam_args *); +int linux_sched_getparam(struct thread *, struct linux_sched_getparam_args *); int linux_sched_setscheduler(struct thread *, struct linux_sched_setscheduler_args *); int linux_sched_getscheduler(struct thread *, struct linux_sched_getscheduler_args *); int linux_sched_get_priority_max(struct thread *, struct linux_sched_get_priority_max_args *); @@ -1523,6 +1533,8 @@ int linux_process_vm_writev(struct threa #define LINUX_SYS_AUE_linux_getsid AUE_GETSID #define LINUX_SYS_AUE_linux_fdatasync AUE_NULL #define LINUX_SYS_AUE_linux_sysctl AUE_SYSCTL +#define LINUX_SYS_AUE_linux_sched_setparam AUE_SCHED_SETPARAM +#define LINUX_SYS_AUE_linux_sched_getparam AUE_SCHED_GETPARAM #define LINUX_SYS_AUE_linux_sched_setscheduler AUE_SCHED_SETSCHEDULER #define LINUX_SYS_AUE_linux_sched_getscheduler AUE_SCHED_GETSCHEDULER #define LINUX_SYS_AUE_linux_sched_get_priority_max AUE_SCHED_GET_PRIORITY_MAX Modified: head/sys/amd64/linux32/linux32_syscall.h ============================================================================== --- head/sys/amd64/linux32/linux32_syscall.h Sun May 24 14:45:57 2015 (r283379) +++ head/sys/amd64/linux32/linux32_syscall.h Sun May 24 14:47:00 2015 (r283380) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283370 2015-05-24 14:33:19Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283379 2015-05-24 14:45:57Z dchagin */ #define LINUX_SYS_linux_exit 1 @@ -143,8 +143,8 @@ #define LINUX_SYS_munlock 151 #define LINUX_SYS_mlockall 152 #define LINUX_SYS_munlockall 153 -#define LINUX_SYS_sched_setparam 154 -#define LINUX_SYS_sched_getparam 155 +#define LINUX_SYS_linux_sched_setparam 154 +#define LINUX_SYS_linux_sched_getparam 155 #define LINUX_SYS_linux_sched_setscheduler 156 #define LINUX_SYS_linux_sched_getscheduler 157 #define LINUX_SYS_sched_yield 158 Modified: head/sys/amd64/linux32/linux32_syscalls.c ============================================================================== --- head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 14:45:57 2015 (r283379) +++ head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 14:47:00 2015 (r283380) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283370 2015-05-24 14:33:19Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283379 2015-05-24 14:45:57Z dchagin */ const char *linux_syscallnames[] = { @@ -162,8 +162,8 @@ const char *linux_syscallnames[] = { "munlock", /* 151 = munlock */ "mlockall", /* 152 = mlockall */ "munlockall", /* 153 = munlockall */ - "sched_setparam", /* 154 = sched_setparam */ - "sched_getparam", /* 155 = sched_getparam */ + "linux_sched_setparam", /* 154 = linux_sched_setparam */ + "linux_sched_getparam", /* 155 = linux_sched_getparam */ "linux_sched_setscheduler", /* 156 = linux_sched_setscheduler */ "linux_sched_getscheduler", /* 157 = linux_sched_getscheduler */ "sched_yield", /* 158 = sched_yield */ Modified: head/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysent.c Sun May 24 14:45:57 2015 (r283379) +++ head/sys/amd64/linux32/linux32_sysent.c Sun May 24 14:47:00 2015 (r283380) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283370 2015-05-24 14:33:19Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283379 2015-05-24 14:45:57Z dchagin */ #include "opt_compat.h" @@ -173,8 +173,8 @@ struct sysent linux_sysent[] = { { AS(munlock_args), (sy_call_t *)sys_munlock, AUE_MUNLOCK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 151 = munlock */ { AS(mlockall_args), (sy_call_t *)sys_mlockall, AUE_MLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 152 = mlockall */ { 0, (sy_call_t *)sys_munlockall, AUE_MUNLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 153 = munlockall */ - { AS(sched_setparam_args), (sy_call_t *)sys_sched_setparam, AUE_SCHED_SETPARAM, NULL, 0, 0, 0, SY_THR_STATIC }, /* 154 = sched_setparam */ - { AS(sched_getparam_args), (sy_call_t *)sys_sched_getparam, AUE_SCHED_GETPARAM, NULL, 0, 0, 0, SY_THR_STATIC }, /* 155 = sched_getparam */ + { AS(linux_sched_setparam_args), (sy_call_t *)linux_sched_setparam, AUE_SCHED_SETPARAM, NULL, 0, 0, 0, SY_THR_STATIC }, /* 154 = linux_sched_setparam */ + { AS(linux_sched_getparam_args), (sy_call_t *)linux_sched_getparam, AUE_SCHED_GETPARAM, NULL, 0, 0, 0, SY_THR_STATIC }, /* 155 = linux_sched_getparam */ { AS(linux_sched_setscheduler_args), (sy_call_t *)linux_sched_setscheduler, AUE_SCHED_SETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC }, /* 156 = linux_sched_setscheduler */ { AS(linux_sched_getscheduler_args), (sy_call_t *)linux_sched_getscheduler, AUE_SCHED_GETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC }, /* 157 = linux_sched_getscheduler */ { 0, (sy_call_t *)sys_sched_yield, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 158 = sched_yield */ Modified: head/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 14:45:57 2015 (r283379) +++ head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 14:47:00 2015 (r283380) @@ -1043,19 +1043,19 @@ systrace_args(int sysnum, void *params, *n_args = 0; break; } - /* sched_setparam */ + /* linux_sched_setparam */ case 154: { - struct sched_setparam_args *p = params; - iarg[0] = p->pid; /* pid_t */ - uarg[1] = (intptr_t) p->param; /* const struct sched_param * */ + struct linux_sched_setparam_args *p = params; + iarg[0] = p->pid; /* l_pid_t */ + uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */ *n_args = 2; break; } - /* sched_getparam */ + /* linux_sched_getparam */ case 155: { - struct sched_getparam_args *p = params; - iarg[0] = p->pid; /* pid_t */ - uarg[1] = (intptr_t) p->param; /* struct sched_param * */ + struct linux_sched_getparam_args *p = params; + iarg[0] = p->pid; /* l_pid_t */ + uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */ *n_args = 2; break; } @@ -3848,27 +3848,27 @@ systrace_entry_setargdesc(int sysnum, in /* munlockall */ case 153: break; - /* sched_setparam */ + /* linux_sched_setparam */ case 154: switch(ndx) { case 0: - p = "pid_t"; + p = "l_pid_t"; break; case 1: - p = "const struct sched_param *"; + p = "struct l_sched_param *"; break; default: break; }; break; - /* sched_getparam */ + /* linux_sched_getparam */ case 155: switch(ndx) { case 0: - p = "pid_t"; + p = "l_pid_t"; break; case 1: - p = "struct sched_param *"; + p = "struct l_sched_param *"; break; default: break; @@ -6112,12 +6112,12 @@ systrace_return_setargdesc(int sysnum, i break; /* munlockall */ case 153: - /* sched_setparam */ + /* linux_sched_setparam */ case 154: if (ndx == 0 || ndx == 1) p = "int"; break; - /* sched_getparam */ + /* linux_sched_getparam */ case 155: if (ndx == 0 || ndx == 1) p = "int"; Modified: head/sys/i386/linux/linux_proto.h ============================================================================== --- head/sys/i386/linux/linux_proto.h Sun May 24 14:45:57 2015 (r283379) +++ head/sys/i386/linux/linux_proto.h Sun May 24 14:47:00 2015 (r283380) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283375 2015-05-24 14:40:41Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283379 2015-05-24 14:45:57Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -476,6 +476,14 @@ struct linux_fdatasync_args { struct linux_sysctl_args { char args_l_[PADL_(struct l___sysctl_args *)]; struct l___sysctl_args * args; char args_r_[PADR_(struct l___sysctl_args *)]; }; +struct linux_sched_setparam_args { + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)]; +}; +struct linux_sched_getparam_args { + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char param_l_[PADL_(struct l_sched_param *)]; struct l_sched_param * param; char param_r_[PADR_(struct l_sched_param *)]; +}; struct linux_sched_setscheduler_args { char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; char policy_l_[PADL_(l_int)]; l_int policy; char policy_r_[PADR_(l_int)]; @@ -1238,6 +1246,8 @@ int linux_msync(struct thread *, struct int linux_getsid(struct thread *, struct linux_getsid_args *); int linux_fdatasync(struct thread *, struct linux_fdatasync_args *); int linux_sysctl(struct thread *, struct linux_sysctl_args *); +int linux_sched_setparam(struct thread *, struct linux_sched_setparam_args *); +int linux_sched_getparam(struct thread *, struct linux_sched_getparam_args *); int linux_sched_setscheduler(struct thread *, struct linux_sched_setscheduler_args *); int linux_sched_getscheduler(struct thread *, struct linux_sched_getscheduler_args *); int linux_sched_get_priority_max(struct thread *, struct linux_sched_get_priority_max_args *); @@ -1543,6 +1553,8 @@ int linux_process_vm_writev(struct threa #define LINUX_SYS_AUE_linux_getsid AUE_GETSID #define LINUX_SYS_AUE_linux_fdatasync AUE_NULL #define LINUX_SYS_AUE_linux_sysctl AUE_SYSCTL +#define LINUX_SYS_AUE_linux_sched_setparam AUE_SCHED_SETPARAM +#define LINUX_SYS_AUE_linux_sched_getparam AUE_SCHED_GETPARAM #define LINUX_SYS_AUE_linux_sched_setscheduler AUE_SCHED_SETSCHEDULER #define LINUX_SYS_AUE_linux_sched_getscheduler AUE_SCHED_GETSCHEDULER #define LINUX_SYS_AUE_linux_sched_get_priority_max AUE_SCHED_GET_PRIORITY_MAX Modified: head/sys/i386/linux/linux_syscall.h ============================================================================== --- head/sys/i386/linux/linux_syscall.h Sun May 24 14:45:57 2015 (r283379) +++ head/sys/i386/linux/linux_syscall.h Sun May 24 14:47:00 2015 (r283380) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283375 2015-05-24 14:40:41Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283379 2015-05-24 14:45:57Z dchagin */ #define LINUX_SYS_linux_exit 1 @@ -148,8 +148,8 @@ #define LINUX_SYS_munlock 151 #define LINUX_SYS_mlockall 152 #define LINUX_SYS_munlockall 153 -#define LINUX_SYS_sched_setparam 154 -#define LINUX_SYS_sched_getparam 155 +#define LINUX_SYS_linux_sched_setparam 154 +#define LINUX_SYS_linux_sched_getparam 155 #define LINUX_SYS_linux_sched_setscheduler 156 #define LINUX_SYS_linux_sched_getscheduler 157 #define LINUX_SYS_sched_yield 158 Modified: head/sys/i386/linux/linux_syscalls.c ============================================================================== --- head/sys/i386/linux/linux_syscalls.c Sun May 24 14:45:57 2015 (r283379) +++ head/sys/i386/linux/linux_syscalls.c Sun May 24 14:47:00 2015 (r283380) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283375 2015-05-24 14:40:41Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283379 2015-05-24 14:45:57Z dchagin */ const char *linux_syscallnames[] = { @@ -162,8 +162,8 @@ const char *linux_syscallnames[] = { "munlock", /* 151 = munlock */ "mlockall", /* 152 = mlockall */ "munlockall", /* 153 = munlockall */ - "sched_setparam", /* 154 = sched_setparam */ - "sched_getparam", /* 155 = sched_getparam */ + "linux_sched_setparam", /* 154 = linux_sched_setparam */ + "linux_sched_getparam", /* 155 = linux_sched_getparam */ "linux_sched_setscheduler", /* 156 = linux_sched_setscheduler */ "linux_sched_getscheduler", /* 157 = linux_sched_getscheduler */ "sched_yield", /* 158 = sched_yield */ Modified: head/sys/i386/linux/linux_sysent.c ============================================================================== --- head/sys/i386/linux/linux_sysent.c Sun May 24 14:45:57 2015 (r283379) +++ head/sys/i386/linux/linux_sysent.c Sun May 24 14:47:00 2015 (r283380) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283375 2015-05-24 14:40:41Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283379 2015-05-24 14:45:57Z dchagin */ #include @@ -172,8 +172,8 @@ struct sysent linux_sysent[] = { { AS(munlock_args), (sy_call_t *)sys_munlock, AUE_MUNLOCK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 151 = munlock */ { AS(mlockall_args), (sy_call_t *)sys_mlockall, AUE_MLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 152 = mlockall */ { 0, (sy_call_t *)sys_munlockall, AUE_MUNLOCKALL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 153 = munlockall */ - { AS(sched_setparam_args), (sy_call_t *)sys_sched_setparam, AUE_SCHED_SETPARAM, NULL, 0, 0, 0, SY_THR_STATIC }, /* 154 = sched_setparam */ - { AS(sched_getparam_args), (sy_call_t *)sys_sched_getparam, AUE_SCHED_GETPARAM, NULL, 0, 0, 0, SY_THR_STATIC }, /* 155 = sched_getparam */ + { AS(linux_sched_setparam_args), (sy_call_t *)linux_sched_setparam, AUE_SCHED_SETPARAM, NULL, 0, 0, 0, SY_THR_STATIC }, /* 154 = linux_sched_setparam */ + { AS(linux_sched_getparam_args), (sy_call_t *)linux_sched_getparam, AUE_SCHED_GETPARAM, NULL, 0, 0, 0, SY_THR_STATIC }, /* 155 = linux_sched_getparam */ { AS(linux_sched_setscheduler_args), (sy_call_t *)linux_sched_setscheduler, AUE_SCHED_SETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC }, /* 156 = linux_sched_setscheduler */ { AS(linux_sched_getscheduler_args), (sy_call_t *)linux_sched_getscheduler, AUE_SCHED_GETSCHEDULER, NULL, 0, 0, 0, SY_THR_STATIC }, /* 157 = linux_sched_getscheduler */ { 0, (sy_call_t *)sys_sched_yield, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 158 = sched_yield */ Modified: head/sys/i386/linux/linux_systrace_args.c ============================================================================== --- head/sys/i386/linux/linux_systrace_args.c Sun May 24 14:45:57 2015 (r283379) +++ head/sys/i386/linux/linux_systrace_args.c Sun May 24 14:47:00 2015 (r283380) @@ -1081,19 +1081,19 @@ systrace_args(int sysnum, void *params, *n_args = 0; break; } - /* sched_setparam */ + /* linux_sched_setparam */ case 154: { - struct sched_setparam_args *p = params; - iarg[0] = p->pid; /* pid_t */ - uarg[1] = (intptr_t) p->param; /* const struct sched_param * */ + struct linux_sched_setparam_args *p = params; + iarg[0] = p->pid; /* l_pid_t */ + uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */ *n_args = 2; break; } - /* sched_getparam */ + /* linux_sched_getparam */ case 155: { - struct sched_getparam_args *p = params; - iarg[0] = p->pid; /* pid_t */ - uarg[1] = (intptr_t) p->param; /* struct sched_param * */ + struct linux_sched_getparam_args *p = params; + iarg[0] = p->pid; /* l_pid_t */ + uarg[1] = (intptr_t) p->param; /* struct l_sched_param * */ *n_args = 2; break; } @@ -3982,27 +3982,27 @@ systrace_entry_setargdesc(int sysnum, in /* munlockall */ case 153: break; - /* sched_setparam */ + /* linux_sched_setparam */ case 154: switch(ndx) { case 0: - p = "pid_t"; + p = "l_pid_t"; break; case 1: - p = "const struct sched_param *"; + p = "struct l_sched_param *"; break; default: break; }; break; - /* sched_getparam */ + /* linux_sched_getparam */ case 155: switch(ndx) { case 0: - p = "pid_t"; + p = "l_pid_t"; break; case 1: - p = "struct sched_param *"; + p = "struct l_sched_param *"; break; default: break; @@ -6365,12 +6365,12 @@ systrace_return_setargdesc(int sysnum, i break; /* munlockall */ case 153: - /* sched_setparam */ + /* linux_sched_setparam */ case 154: if (ndx == 0 || ndx == 1) p = "int"; break; - /* sched_getparam */ + /* linux_sched_getparam */ case 155: if (ndx == 0 || ndx == 1) p = "int"; From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:49:22 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C6173BAF; Sun, 24 May 2015 14:49:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 B47AF17C8; Sun, 24 May 2015 14:49:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEnMsG030162; Sun, 24 May 2015 14:49:22 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEnMDI030161; Sun, 24 May 2015 14:49:22 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241449.t4OEnMDI030161@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:49:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283381 - head/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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:49:22 -0000 Author: dchagin Date: Sun May 24 14:49:21 2015 New Revision: 283381 URL: https://svnweb.freebsd.org/changeset/base/283381 Log: In preparation for switching linuxulator to the use the native 1:1 threads add per thread emulator state data. Differential Revision: https://reviews.freebsd.org/D1037 Reviewed by: trasz Modified: head/sys/sys/proc.h Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Sun May 24 14:47:00 2015 (r283380) +++ head/sys/sys/proc.h Sun May 24 14:49:21 2015 (r283381) @@ -325,6 +325,7 @@ struct thread { struct proc *td_rfppwait_p; /* (k) The vforked child */ struct vm_page **td_ma; /* (k) uio pages held */ int td_ma_cnt; /* (k) size of *td_ma */ + void *td_emuldata; /* Emulator state data */ }; struct mtx *thread_lock_block(struct thread *); From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:51:34 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 977ACD44; Sun, 24 May 2015 14:51:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 835BF1898; Sun, 24 May 2015 14:51:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEpYjo033447; Sun, 24 May 2015 14:51:34 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEpUad033423; Sun, 24 May 2015 14:51:30 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241451.t4OEpUad033423@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283382 - in head/sys: amd64/amd64 arm/arm compat/ia32 compat/svr4 i386/i386 i386/ibcs2 kern mips/mips powerpc/powerpc sparc64/sparc64 sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:51:34 -0000 Author: dchagin Date: Sun May 24 14:51:29 2015 New Revision: 283382 URL: https://svnweb.freebsd.org/changeset/base/283382 Log: In preparation for switching linuxulator to the use the native 1:1 threads add a hook for cleaning thread resources before the thread die. Differential Revision: https://reviews.freebsd.org/D1038 Modified: head/sys/amd64/amd64/elf_machdep.c head/sys/arm/arm/elf_machdep.c head/sys/compat/ia32/ia32_sysvec.c head/sys/compat/svr4/svr4_sysvec.c head/sys/i386/i386/elf_machdep.c head/sys/i386/ibcs2/ibcs2_sysvec.c head/sys/kern/imgact_aout.c head/sys/kern/init_main.c head/sys/kern/kern_thread.c head/sys/mips/mips/elf_machdep.c head/sys/mips/mips/freebsd32_machdep.c head/sys/powerpc/powerpc/elf32_machdep.c head/sys/powerpc/powerpc/elf64_machdep.c head/sys/sparc64/sparc64/elf_machdep.c head/sys/sys/sysent.h Modified: head/sys/amd64/amd64/elf_machdep.c ============================================================================== --- head/sys/amd64/amd64/elf_machdep.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/amd64/amd64/elf_machdep.c Sun May 24 14:51:29 2015 (r283382) @@ -82,6 +82,7 @@ struct sysentvec elf64_freebsd_sysvec = .sv_shared_page_base = SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec); Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/arm/arm/elf_machdep.c Sun May 24 14:51:29 2015 (r283382) @@ -81,6 +81,7 @@ struct sysentvec elf32_freebsd_sysvec = .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; static Elf32_Brandinfo freebsd_brand_info = { Modified: head/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- head/sys/compat/ia32/ia32_sysvec.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/compat/ia32/ia32_sysvec.c Sun May 24 14:51:29 2015 (r283382) @@ -136,6 +136,7 @@ struct sysentvec ia32_freebsd_sysvec = { .sv_shared_page_base = FREEBSD32_SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; INIT_SYSENTVEC(elf_ia32_sysvec, &ia32_freebsd_sysvec); Modified: head/sys/compat/svr4/svr4_sysvec.c ============================================================================== --- head/sys/compat/svr4/svr4_sysvec.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/compat/svr4/svr4_sysvec.c Sun May 24 14:51:29 2015 (r283382) @@ -196,6 +196,7 @@ struct sysentvec svr4_sysvec = { .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = NULL, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; const char svr4_emul_path[] = "/compat/svr4"; Modified: head/sys/i386/i386/elf_machdep.c ============================================================================== --- head/sys/i386/i386/elf_machdep.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/i386/i386/elf_machdep.c Sun May 24 14:51:29 2015 (r283382) @@ -88,6 +88,7 @@ struct sysentvec elf32_freebsd_sysvec = .sv_shared_page_base = SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); Modified: head/sys/i386/ibcs2/ibcs2_sysvec.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_sysvec.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/i386/ibcs2/ibcs2_sysvec.c Sun May 24 14:51:29 2015 (r283382) @@ -89,6 +89,7 @@ struct sysentvec ibcs2_svr3_sysvec = { .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = NULL, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; static int Modified: head/sys/kern/imgact_aout.c ============================================================================== --- head/sys/kern/imgact_aout.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/kern/imgact_aout.c Sun May 24 14:51:29 2015 (r283382) @@ -99,6 +99,7 @@ struct sysentvec aout_sysvec = { .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; #elif defined(__amd64__) Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/kern/init_main.c Sun May 24 14:51:29 2015 (r283382) @@ -411,6 +411,7 @@ struct sysentvec null_sysvec = { .sv_fetch_syscall_args = null_fetch_syscall_args, .sv_syscallnames = NULL, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; /* Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/kern/kern_thread.c Sun May 24 14:51:29 2015 (r283382) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -884,6 +885,14 @@ thread_suspend_check(int return_instead) if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) { PROC_UNLOCK(p); tidhash_remove(td); + + /* + * Allow Linux emulation layer to do some work + * before thread suicide. + */ + if (__predict_false(p->p_sysent->sv_thread_detach != NULL)) + (p->p_sysent->sv_thread_detach)(td); + PROC_LOCK(p); tdsigcleanup(td); umtx_thread_exit(td); Modified: head/sys/mips/mips/elf_machdep.c ============================================================================== --- head/sys/mips/mips/elf_machdep.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/mips/mips/elf_machdep.c Sun May 24 14:51:29 2015 (r283382) @@ -83,6 +83,7 @@ struct sysentvec elf64_freebsd_sysvec = .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; static Elf64_Brandinfo freebsd_brand_info = { @@ -139,6 +140,7 @@ struct sysentvec elf32_freebsd_sysvec = .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; static Elf32_Brandinfo freebsd_brand_info = { Modified: head/sys/mips/mips/freebsd32_machdep.c ============================================================================== --- head/sys/mips/mips/freebsd32_machdep.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/mips/mips/freebsd32_machdep.c Sun May 24 14:51:29 2015 (r283382) @@ -106,6 +106,7 @@ struct sysentvec elf32_freebsd_sysvec = .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = freebsd32_syscallnames, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); Modified: head/sys/powerpc/powerpc/elf32_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf32_machdep.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/powerpc/powerpc/elf32_machdep.c Sun May 24 14:51:29 2015 (r283382) @@ -108,6 +108,7 @@ struct sysentvec elf32_freebsd_sysvec = .sv_shared_page_base = FREEBSD32_SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec); Modified: head/sys/powerpc/powerpc/elf64_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf64_machdep.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/powerpc/powerpc/elf64_machdep.c Sun May 24 14:51:29 2015 (r283382) @@ -84,6 +84,7 @@ struct sysentvec elf64_freebsd_sysvec = .sv_shared_page_base = SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec); Modified: head/sys/sparc64/sparc64/elf_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/elf_machdep.c Sun May 24 14:49:21 2015 (r283381) +++ head/sys/sparc64/sparc64/elf_machdep.c Sun May 24 14:51:29 2015 (r283382) @@ -87,6 +87,7 @@ static struct sysentvec elf64_freebsd_sy .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, .sv_schedtail = NULL, + .sv_thread_detach = NULL, }; static Elf64_Brandinfo freebsd_brand_info = { Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Sun May 24 14:49:21 2015 (r283381) +++ head/sys/sys/sysent.h Sun May 24 14:51:29 2015 (r283382) @@ -136,6 +136,7 @@ struct sysentvec { uint32_t sv_timekeep_gen; void *sv_shared_page_obj; void (*sv_schedtail)(struct thread *); + void (*sv_thread_detach)(struct thread *); }; #define SV_ILP32 0x000100 From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:53:19 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6D738EAD; Sun, 24 May 2015 14:53:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 5AEC018AD; Sun, 24 May 2015 14:53:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OErJ6a034394; Sun, 24 May 2015 14:53:19 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OErHG2034385; Sun, 24 May 2015 14:53:17 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241453.t4OErHG2034385@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:53:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283383 - in head/sys: amd64/linux32 compat/linux i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:53:19 -0000 Author: dchagin Date: Sun May 24 14:53:16 2015 New Revision: 283383 URL: https://svnweb.freebsd.org/changeset/base/283383 Log: Switch linuxulator to use the native 1:1 threads. The reasons: 1. Get rid of the stubs/quirks with process dethreading, process reparent when the process group leader exits and close to this problems on wait(), waitpid(), etc. 2. Reuse our kernel code instead of writing excessive thread managment routines in Linuxulator. Implementation details: 1. The thread is created via kern_thr_new() in the clone() call with the CLONE_THREAD parameter. Thus, everything else is a process. 2. The test that the process has a threads is done via P_HADTHREADS bit p_flag of struct proc. 3. Per thread emulator state data structure is now located in the struct thread and freed in the thread_dtor() hook. Mandatory holdig of the p_mtx required when referencing emuldata from the other threads. 4. PID mangling has changed. Now Linux pid is the native tid and Linux tgid is the native pid, with the exception of the first thread in the process where tid and pid are one and the same. Ugliness: In case when the Linux thread is the initial thread in the thread group thread id is equal to the process id. Glibc depends on this magic (assert in pthread_getattr_np.c). So for system calls that take thread id as a parameter we should use the special method to reference struct thread. Differential Revision: https://reviews.freebsd.org/D1039 Modified: head/sys/amd64/linux32/linux32_machdep.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/linux/check_error.d head/sys/compat/linux/check_internal_locks.d head/sys/compat/linux/linux_emul.c head/sys/compat/linux/linux_emul.h head/sys/compat/linux/linux_fork.c head/sys/compat/linux/linux_futex.c head/sys/compat/linux/linux_futex.h head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h head/sys/compat/linux/linux_signal.c head/sys/compat/linux/stats_timing.d head/sys/i386/linux/linux_machdep.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- head/sys/amd64/linux32/linux32_machdep.c Sun May 24 14:51:29 2015 (r283382) +++ head/sys/amd64/linux32/linux32_machdep.c Sun May 24 14:53:16 2015 (r283383) @@ -157,15 +157,8 @@ linux_execve(struct thread *td, struct l free(path, M_TEMP); if (error == 0) error = kern_execve(td, &eargs, NULL); - if (error == 0) { - /* Linux process can execute FreeBSD one, do not attempt - * to create emuldata for such process using - * linux_proc_init, this leads to a panic on KASSERT - * because such process has p->p_emuldata == NULL. - */ - if (SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX) - error = linux_proc_init(td, 0, 0); - } + if (error == 0) + error = linux_common_execve(td, &eargs); post_execve(td, error, oldvmspace); return (error); } @@ -464,8 +457,14 @@ int linux_set_upcall_kse(struct thread *td, register_t stack) { - td->td_frame->tf_rsp = stack; + if (stack) + td->td_frame->tf_rsp = stack; + /* + * The newly created Linux thread returns + * to the user space by the same path that a parent do. + */ + td->td_frame->tf_rax = 0; return (0); } Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Sun May 24 14:51:29 2015 (r283382) +++ head/sys/amd64/linux32/linux32_sysvec.c Sun May 24 14:53:16 2015 (r283383) @@ -130,6 +130,7 @@ static boolean_t linux32_trans_osrel(con static eventhandler_tag linux_exit_tag; static eventhandler_tag linux_exec_tag; +static eventhandler_tag linux_thread_dtor_tag; /* * Linux syscalls return negative errno's, we do positive and map them @@ -1037,6 +1038,7 @@ struct sysentvec elf_linux_sysvec = { .sv_shared_page_base = LINUX32_SHAREDPAGE, .sv_shared_page_len = PAGE_SIZE, .sv_schedtail = linux_schedtail, + .sv_thread_detach = linux_thread_detach, }; INIT_SYSENTVEC(elf_sysvec, &elf_linux_sysvec); @@ -1125,14 +1127,14 @@ linux_elf_modevent(module_t mod, int typ linux_ioctl_register_handler(*lihp); SET_FOREACH(ldhp, linux_device_handler_set) linux_device_register_handler(*ldhp); - mtx_init(&emul_lock, "emuldata lock", NULL, MTX_DEF); - sx_init(&emul_shared_lock, "emuldata->shared lock"); LIST_INIT(&futex_list); mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF); linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit, NULL, 1000); linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec, NULL, 1000); + linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor, + linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY); linux_szplatform = roundup(strlen(linux_platform) + 1, sizeof(char *)); linux_osd_jail_register(); @@ -1158,11 +1160,10 @@ linux_elf_modevent(module_t mod, int typ linux_ioctl_unregister_handler(*lihp); SET_FOREACH(ldhp, linux_device_handler_set) linux_device_unregister_handler(*ldhp); - mtx_destroy(&emul_lock); - sx_destroy(&emul_shared_lock); mtx_destroy(&futex_mtx); EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag); EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag); + EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag); linux_osd_jail_deregister(); if (bootverbose) printf("Linux ELF exec handler removed\n"); Modified: head/sys/compat/linux/check_error.d ============================================================================== --- head/sys/compat/linux/check_error.d Sun May 24 14:51:29 2015 (r283382) +++ head/sys/compat/linux/check_error.d Sun May 24 14:53:16 2015 (r283383) @@ -36,8 +36,8 @@ */ linuxulator*:dummy::not_implemented, -linuxulator*:emul:proc_exit:child_clear_tid_error, -linuxulator*:emul:proc_exit:futex_failed, +linuxulator*:emul:linux_thread_detach:child_clear_tid_error, +linuxulator*:emul:linux_thread_detach:futex_failed, linuxulator*:emul:linux_schedtail:copyout_error, linuxulator*:futex:futex_get:error, linuxulator*:futex:futex_sleep:requeue_error, Modified: head/sys/compat/linux/check_internal_locks.d ============================================================================== --- head/sys/compat/linux/check_internal_locks.d Sun May 24 14:51:29 2015 (r283382) +++ head/sys/compat/linux/check_internal_locks.d Sun May 24 14:53:16 2015 (r283383) @@ -41,14 +41,9 @@ BEGIN { - check["emul_lock"] = 0; - check["emul_shared_rlock"] = 0; - check["emul_shared_wlock"] = 0; check["futex_mtx"] = 0; } -linuxulator*:locks:emul_lock:locked, -linuxulator*:locks:emul_shared_wlock:locked, linuxulator*:locks:futex_mtx:locked /check[probefunc] > 0/ { @@ -57,9 +52,6 @@ linuxulator*:locks:futex_mtx:locked stack(); } -linuxulator*:locks:emul_lock:locked, -linuxulator*:locks:emul_shared_rlock:locked, -linuxulator*:locks:emul_shared_wlock:locked, linuxulator*:locks:futex_mtx:locked { ++check[probefunc]; @@ -69,9 +61,6 @@ linuxulator*:locks:futex_mtx:locked spec[probefunc] = speculation(); } -linuxulator*:locks:emul_lock:unlock, -linuxulator*:locks:emul_shared_rlock:unlock, -linuxulator*:locks:emul_shared_wlock:unlock, linuxulator*:locks:futex_mtx:unlock /check[probefunc] == 0/ { @@ -82,9 +71,6 @@ linuxulator*:locks:futex_mtx:unlock stack(); } -linuxulator*:locks:emul_lock:unlock, -linuxulator*:locks:emul_shared_rlock:unlock, -linuxulator*:locks:emul_shared_wlock:unlock, linuxulator*:locks:futex_mtx:unlock { discard(spec[probefunc]); @@ -95,27 +81,6 @@ linuxulator*:locks:futex_mtx:unlock /* Timeout handling */ tick-10s -/spec["emul_lock"] != 0 && timestamp - ts["emul_lock"] >= 9999999000/ -{ - commit(spec["emul_lock"]); - spec["emul_lock"] = 0; -} - -tick-10s -/spec["emul_shared_wlock"] != 0 && timestamp - ts["emul_shared_wlock"] >= 9999999000/ -{ - commit(spec["emul_shared_wlock"]); - spec["emul_shared_wlock"] = 0; -} - -tick-10s -/spec["emul_shared_rlock"] != 0 && timestamp - ts["emul_shared_rlock"] >= 9999999000/ -{ - commit(spec["emul_shared_rlock"]); - spec["emul_shared_rlock"] = 0; -} - -tick-10s /spec["futex_mtx"] != 0 && timestamp - ts["futex_mtx"] >= 9999999000/ { commit(spec["futex_mtx"]); Modified: head/sys/compat/linux/linux_emul.c ============================================================================== --- head/sys/compat/linux/linux_emul.c Sun May 24 14:51:29 2015 (r283382) +++ head/sys/compat/linux/linux_emul.c Sun May 24 14:53:16 2015 (r283383) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2006 Roman Divacky + * Copyright (c) 2013 Dmitry Chagin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -58,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /** * Special DTrace provider for the linuxulator. @@ -73,33 +76,21 @@ __FBSDID("$FreeBSD$"); LIN_SDT_PROVIDER_DEFINE(LINUX_DTRACE); /** - * Special DTrace module "locks", it covers some linuxulator internal - * locks. - */ -LIN_SDT_PROBE_DEFINE1(locks, emul_lock, locked, "struct mtx *"); -LIN_SDT_PROBE_DEFINE1(locks, emul_lock, unlock, "struct mtx *"); -LIN_SDT_PROBE_DEFINE1(locks, emul_shared_rlock, locked, "struct sx *"); -LIN_SDT_PROBE_DEFINE1(locks, emul_shared_rlock, unlock, "struct sx *"); -LIN_SDT_PROBE_DEFINE1(locks, emul_shared_wlock, locked, "struct sx *"); -LIN_SDT_PROBE_DEFINE1(locks, emul_shared_wlock, unlock, "struct sx *"); - -/** * DTrace probes in this module. */ -LIN_SDT_PROBE_DEFINE2(emul, em_find, entry, "struct proc *", "int"); +LIN_SDT_PROBE_DEFINE1(emul, em_find, entry, "struct thread *"); LIN_SDT_PROBE_DEFINE0(emul, em_find, return); -LIN_SDT_PROBE_DEFINE3(emul, proc_init, entry, "struct thread *", "pid_t", - "int"); +LIN_SDT_PROBE_DEFINE3(emul, proc_init, entry, "struct thread *", + "struct thread *", "int"); LIN_SDT_PROBE_DEFINE0(emul, proc_init, create_thread); LIN_SDT_PROBE_DEFINE0(emul, proc_init, fork); LIN_SDT_PROBE_DEFINE0(emul, proc_init, exec); LIN_SDT_PROBE_DEFINE0(emul, proc_init, return); LIN_SDT_PROBE_DEFINE1(emul, proc_exit, entry, "struct proc *"); -LIN_SDT_PROBE_DEFINE0(emul, proc_exit, futex_failed); -LIN_SDT_PROBE_DEFINE3(emul, proc_exit, reparent, "pid_t", "pid_t", - "struct proc *"); -LIN_SDT_PROBE_DEFINE1(emul, proc_exit, child_clear_tid_error, "int"); -LIN_SDT_PROBE_DEFINE0(emul, proc_exit, return); +LIN_SDT_PROBE_DEFINE1(emul, linux_thread_detach, entry, "struct thread *"); +LIN_SDT_PROBE_DEFINE0(emul, linux_thread_detach, futex_failed); +LIN_SDT_PROBE_DEFINE1(emul, linux_thread_detach, child_clear_tid_error, "int"); +LIN_SDT_PROBE_DEFINE0(emul, linux_thread_detach, return); LIN_SDT_PROBE_DEFINE2(emul, proc_exec, entry, "struct proc *", "struct image_params *"); LIN_SDT_PROBE_DEFINE0(emul, proc_exec, return); @@ -108,284 +99,208 @@ LIN_SDT_PROBE_DEFINE1(emul, linux_schedt LIN_SDT_PROBE_DEFINE0(emul, linux_schedtail, return); LIN_SDT_PROBE_DEFINE1(emul, linux_set_tid_address, entry, "int *"); LIN_SDT_PROBE_DEFINE0(emul, linux_set_tid_address, return); -LIN_SDT_PROBE_DEFINE2(emul, linux_kill_threads, entry, "struct thread *", - "int"); -LIN_SDT_PROBE_DEFINE1(emul, linux_kill_threads, kill, "pid_t"); -LIN_SDT_PROBE_DEFINE0(emul, linux_kill_threads, return); - -struct sx emul_shared_lock; -struct mtx emul_lock; -/* this returns locked reference to the emuldata entry (if found) */ +/* + * This returns reference to the emuldata entry (if found) + * + * Hold PROC_LOCK when referencing emuldata from other threads. + */ struct linux_emuldata * -em_find(struct proc *p, int locked) +em_find(struct thread *td) { struct linux_emuldata *em; - LIN_SDT_PROBE2(emul, em_find, entry, p, locked); - - if (locked == EMUL_DOLOCK) - EMUL_LOCK(&emul_lock); + LIN_SDT_PROBE1(emul, em_find, entry, td); - em = p->p_emuldata; - - if (em == NULL && locked == EMUL_DOLOCK) - EMUL_UNLOCK(&emul_lock); + em = td->td_emuldata; LIN_SDT_PROBE1(emul, em_find, return, em); + return (em); } -int -linux_proc_init(struct thread *td, pid_t child, int flags) +void +linux_proc_init(struct thread *td, struct thread *newtd, int flags) { - struct linux_emuldata *em, *p_em; - struct proc *p; + struct linux_emuldata *em; - LIN_SDT_PROBE3(emul, proc_init, entry, td, child, flags); + LIN_SDT_PROBE3(emul, proc_init, entry, td, newtd, flags); - if (child != 0) { - /* fork or create a thread */ - em = malloc(sizeof *em, M_LINUX, M_WAITOK | M_ZERO); - em->pid = child; + if (newtd != NULL) { + /* non-exec call */ + em = malloc(sizeof(*em), M_TEMP, M_WAITOK | M_ZERO); em->pdeath_signal = 0; em->flags = 0; em->robust_futexes = NULL; if (flags & LINUX_CLONE_THREAD) { - /* handled later in the code */ LIN_SDT_PROBE0(emul, proc_init, create_thread); - } else { - struct linux_emuldata_shared *s; + em->em_tid = newtd->td_tid; + } else { LIN_SDT_PROBE0(emul, proc_init, fork); - s = malloc(sizeof *s, M_LINUX, M_WAITOK | M_ZERO); - s->refs = 1; - s->group_pid = child; - - LIST_INIT(&s->threads); - em->shared = s; + em->em_tid = newtd->td_proc->p_pid; } + newtd->td_emuldata = em; } else { /* exec */ LIN_SDT_PROBE0(emul, proc_init, exec); /* lookup the old one */ - em = em_find(td->td_proc, EMUL_DOLOCK); + em = em_find(td); KASSERT(em != NULL, ("proc_init: emuldata not found in exec case.\n")); + + em->em_tid = td->td_proc->p_pid; } em->child_clear_tid = NULL; em->child_set_tid = NULL; + LIN_SDT_PROBE0(emul, proc_init, return); +} + +void +linux_proc_exit(void *arg __unused, struct proc *p) +{ + struct thread *td = curthread; + + if (__predict_false(SV_CURPROC_ABI() != SV_ABI_LINUX)) { + LIN_SDT_PROBE1(emul, proc_exit, entry, p); + (p->p_sysent->sv_thread_detach)(td); + } +} + +int +linux_common_execve(struct thread *td, struct image_args *eargs) +{ + struct linux_emuldata *em; + struct proc *p; + int error; + + p = td->td_proc; + /* - * allocate the shared struct only in clone()/fork cases in the case - * of clone() td = calling proc and child = pid of the newly created - * proc + * Unlike FreeBSD abort all other threads before + * proceeding exec. */ - if (child != 0) { - if (flags & LINUX_CLONE_THREAD) { - /* lookup the parent */ - /* - * we dont have to lock the p_em because - * its waiting for us in linux_clone so - * there is no chance of it changing the - * p_em->shared address - */ - p_em = em_find(td->td_proc, EMUL_DONTLOCK); - KASSERT(p_em != NULL, ("proc_init: parent emuldata not found for CLONE_THREAD\n")); - em->shared = p_em->shared; - EMUL_SHARED_WLOCK(&emul_shared_lock); - em->shared->refs++; - EMUL_SHARED_WUNLOCK(&emul_shared_lock); - } else { - /* - * handled earlier to avoid malloc(M_WAITOK) with - * rwlock held - */ - } + PROC_LOCK(p); + /* See exit1() comments. */ + thread_suspend_check(0); + while (p->p_flag & P_HADTHREADS) { + if (!thread_single(p, SINGLE_EXIT)) + break; + thread_suspend_check(0); + } + PROC_UNLOCK(p); - EMUL_SHARED_WLOCK(&emul_shared_lock); - LIST_INSERT_HEAD(&em->shared->threads, em, threads); - EMUL_SHARED_WUNLOCK(&emul_shared_lock); - - p = pfind(child); - KASSERT(p != NULL, ("process not found in proc_init\n")); - p->p_emuldata = em; + error = kern_execve(td, eargs, NULL); + if (error != 0) + return (error); + + /* + * In a case of transition from Linux binary execing to + * FreeBSD binary we destroy linux emuldata thread entry. + */ + if (SV_CURPROC_ABI() != SV_ABI_LINUX) { + PROC_LOCK(p); + em = em_find(td); + KASSERT(em != NULL, ("proc_exec: emuldata not found.\n")); + td->td_emuldata = NULL; PROC_UNLOCK(p); - } else - EMUL_UNLOCK(&emul_lock); - LIN_SDT_PROBE0(emul, proc_init, return); + free(em, M_TEMP); + } return (0); } -void -linux_proc_exit(void *arg __unused, struct proc *p) +void +linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp) { - struct linux_emuldata *em; - int error, shared_flags, shared_xstat; - struct thread *td = FIRST_THREAD_IN_PROC(p); - int *child_clear_tid; - struct proc *q, *nq; - - if (__predict_true(p->p_sysent != &elf_linux_sysvec)) - return; + struct thread *td = curthread; - LIN_SDT_PROBE1(emul, proc_exit, entry, p); + /* + * In a case of execing to linux binary we create linux + * emuldata thread entry. + */ + if (__predict_false((imgp->sysent->sv_flags & SV_ABI_MASK) == + SV_ABI_LINUX)) { + LIN_SDT_PROBE2(emul, proc_exec, entry, p, imgp); + if (SV_PROC_ABI(p) == SV_ABI_LINUX) + linux_proc_init(td, NULL, 0); + else + linux_proc_init(td, td, 0); - release_futexes(p); + LIN_SDT_PROBE0(emul, proc_exec, return); + } +} - /* find the emuldata */ - em = em_find(p, EMUL_DOLOCK); +void +linux_thread_detach(struct thread *td) +{ + struct linux_sys_futex_args cup; + struct linux_emuldata *em; + int *child_clear_tid; + int null = 0; + int error; - KASSERT(em != NULL, ("proc_exit: emuldata not found.\n")); + LIN_SDT_PROBE1(emul, linux_thread_detach, entry, td); - /* reparent all procs that are not a thread leader to initproc */ - if (em->shared->group_pid != p->p_pid) { - LIN_SDT_PROBE3(emul, proc_exit, reparent, - em->shared->group_pid, p->p_pid, p); + em = em_find(td); + KASSERT(em != NULL, ("thread_detach: emuldata not found.\n")); - child_clear_tid = em->child_clear_tid; - EMUL_UNLOCK(&emul_lock); - sx_xlock(&proctree_lock); - wakeup(initproc); - PROC_LOCK(p); - proc_reparent(p, initproc); - p->p_sigparent = SIGCHLD; - PROC_UNLOCK(p); - sx_xunlock(&proctree_lock); - } else { - child_clear_tid = em->child_clear_tid; - EMUL_UNLOCK(&emul_lock); - } + LINUX_CTR1(exit, "thread detach(%d)", em->em_tid); - EMUL_SHARED_WLOCK(&emul_shared_lock); - shared_flags = em->shared->flags; - shared_xstat = em->shared->xstat; - LIST_REMOVE(em, threads); - - em->shared->refs--; - if (em->shared->refs == 0) { - EMUL_SHARED_WUNLOCK(&emul_shared_lock); - free(em->shared, M_LINUX); - } else - EMUL_SHARED_WUNLOCK(&emul_shared_lock); + release_futexes(td, em); - if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) - p->p_xstat = shared_xstat; + child_clear_tid = em->child_clear_tid; if (child_clear_tid != NULL) { - struct linux_sys_futex_args cup; - int null = 0; + LINUX_CTR2(exit, "thread detach(%d) %p", + em->em_tid, child_clear_tid); + error = copyout(&null, child_clear_tid, sizeof(null)); if (error) { - LIN_SDT_PROBE1(emul, proc_exit, + LIN_SDT_PROBE1(emul, linux_thread_detach, child_clear_tid_error, error); - free(em, M_LINUX); - - LIN_SDT_PROBE0(emul, proc_exit, return); + LIN_SDT_PROBE0(emul, linux_thread_detach, return); return; } - /* futexes stuff */ cup.uaddr = child_clear_tid; cup.op = LINUX_FUTEX_WAKE; cup.val = 0x7fffffff; /* Awake everyone */ cup.timeout = NULL; cup.uaddr2 = NULL; cup.val3 = 0; - error = linux_sys_futex(FIRST_THREAD_IN_PROC(p), &cup); + error = linux_sys_futex(td, &cup); /* * this cannot happen at the moment and if this happens it * probably means there is a user space bug */ if (error) { - LIN_SDT_PROBE0(emul, proc_exit, futex_failed); - printf(LMSG("futex stuff in proc_exit failed.\n")); - } - } - - /* clean the stuff up */ - free(em, M_LINUX); - - /* this is a little weird but rewritten from exit1() */ - sx_xlock(&proctree_lock); - q = LIST_FIRST(&p->p_children); - for (; q != NULL; q = nq) { - nq = LIST_NEXT(q, p_sibling); - if (q->p_flag & P_WEXIT) - continue; - if (__predict_false(q->p_sysent != &elf_linux_sysvec)) - continue; - em = em_find(q, EMUL_DOLOCK); - KASSERT(em != NULL, ("linux_reparent: emuldata not found: %i\n", q->p_pid)); - PROC_LOCK(q); - if ((q->p_flag & P_WEXIT) == 0 && em->pdeath_signal != 0) { - kern_psignal(q, em->pdeath_signal); + LIN_SDT_PROBE0(emul, linux_thread_detach, futex_failed); + printf(LMSG("futex stuff in thread_detach failed.\n")); } - PROC_UNLOCK(q); - EMUL_UNLOCK(&emul_lock); } - sx_xunlock(&proctree_lock); - LIN_SDT_PROBE0(emul, proc_exit, return); + LIN_SDT_PROBE0(emul, linux_thread_detach, return); } -/* - * This is used in a case of transition from FreeBSD binary execing to linux binary - * in this case we create linux emuldata proc entry with the pid of the currently running - * process. - */ -void -linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp) +void +linux_thread_dtor(void *arg __unused, struct thread *td) { - if (__predict_false(imgp->sysent == &elf_linux_sysvec)) { - LIN_SDT_PROBE2(emul, proc_exec, entry, p, imgp); - } - if (__predict_false(imgp->sysent == &elf_linux_sysvec - && p->p_sysent != &elf_linux_sysvec)) - linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); - if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) == - SV_ABI_LINUX)) - /* Kill threads regardless of imgp->sysent value */ - linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); - if (__predict_false(imgp->sysent != &elf_linux_sysvec - && p->p_sysent == &elf_linux_sysvec)) { - struct linux_emuldata *em; - - /* - * XXX:There's a race because here we assign p->p_emuldata NULL - * but the process is still counted as linux one for a short - * time so some other process might reference it and try to - * access its p->p_emuldata and panicing on a NULL reference. - */ - em = em_find(p, EMUL_DONTLOCK); - - KASSERT(em != NULL, ("proc_exec: emuldata not found.\n")); - - EMUL_SHARED_WLOCK(&emul_shared_lock); - LIST_REMOVE(em, threads); - - PROC_LOCK(p); - p->p_emuldata = NULL; - PROC_UNLOCK(p); + struct linux_emuldata *em; - em->shared->refs--; - if (em->shared->refs == 0) { - EMUL_SHARED_WUNLOCK(&emul_shared_lock); - free(em->shared, M_LINUX); - } else - EMUL_SHARED_WUNLOCK(&emul_shared_lock); + em = em_find(td); + if (em == NULL) + return; + td->td_emuldata = NULL; - free(em, M_LINUX); - } + LINUX_CTR1(exit, "thread dtor(%d)", em->em_tid); - if (__predict_false(imgp->sysent == &elf_linux_sysvec)) { - LIN_SDT_PROBE0(emul, proc_exec, return); - } + free(em, M_TEMP); } void @@ -396,30 +311,28 @@ linux_schedtail(struct thread *td) int error = 0; int *child_set_tid; - p = td->td_proc; - - LIN_SDT_PROBE1(emul, linux_schedtail, entry, p); + LIN_SDT_PROBE1(emul, linux_schedtail, entry, td); - /* find the emuldata */ - em = em_find(p, EMUL_DOLOCK); + p = td->td_proc; + em = em_find(td); KASSERT(em != NULL, ("linux_schedtail: emuldata not found.\n")); child_set_tid = em->child_set_tid; - EMUL_UNLOCK(&emul_lock); if (child_set_tid != NULL) { - error = copyout(&p->p_pid, (int *)child_set_tid, - sizeof(p->p_pid)); + error = copyout(&em->em_tid, (int *)child_set_tid, + sizeof(em->em_tid)); + LINUX_CTR4(clone, "schedtail(%d) %p stored %d error %d", + td->td_tid, child_set_tid, em->em_tid, error); if (error != 0) { LIN_SDT_PROBE1(emul, linux_schedtail, copyout_error, error); } - } + } else + LINUX_CTR1(clone, "schedtail(%d)", em->em_tid); LIN_SDT_PROBE0(emul, linux_schedtail, return); - - return; } int @@ -429,45 +342,16 @@ linux_set_tid_address(struct thread *td, LIN_SDT_PROBE1(emul, linux_set_tid_address, entry, args->tidptr); - /* find the emuldata */ - em = em_find(td->td_proc, EMUL_DOLOCK); - + em = em_find(td); KASSERT(em != NULL, ("set_tid_address: emuldata not found.\n")); em->child_clear_tid = args->tidptr; - td->td_retval[0] = td->td_proc->p_pid; - EMUL_UNLOCK(&emul_lock); + td->td_retval[0] = em->em_tid; - LIN_SDT_PROBE0(emul, linux_set_tid_address, return); - return 0; -} - -void -linux_kill_threads(struct thread *td, int sig) -{ - struct linux_emuldata *em, *td_em, *tmp_em; - struct proc *sp; - - LIN_SDT_PROBE2(emul, linux_kill_threads, entry, td, sig); - - td_em = em_find(td->td_proc, EMUL_DONTLOCK); + LINUX_CTR3(set_tid_address, "tidptr(%d) %p, returns %d", + em->em_tid, args->tidptr, td->td_retval[0]); - KASSERT(td_em != NULL, ("linux_kill_threads: emuldata not found.\n")); - - EMUL_SHARED_RLOCK(&emul_shared_lock); - LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) { - if (em->pid == td_em->pid) - continue; - - sp = pfind(em->pid); - if ((sp->p_flag & P_WEXIT) == 0) - kern_psignal(sp, sig); - PROC_UNLOCK(sp); - - LIN_SDT_PROBE1(emul, linux_kill_threads, kill, em->pid); - } - EMUL_SHARED_RUNLOCK(&emul_shared_lock); - - LIN_SDT_PROBE0(emul, linux_kill_threads, return); + LIN_SDT_PROBE0(emul, linux_set_tid_address, return); + return (0); } Modified: head/sys/compat/linux/linux_emul.h ============================================================================== --- head/sys/compat/linux/linux_emul.h Sun May 24 14:51:29 2015 (r283382) +++ head/sys/compat/linux/linux_emul.h Sun May 24 14:53:16 2015 (r283383) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2006 Roman Divacky + * Copyright (c) 2013 Dmitry Chagin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,91 +32,33 @@ #ifndef _LINUX_EMUL_H_ #define _LINUX_EMUL_H_ -#define EMUL_SHARED_HASXSTAT 0x01 - -struct linux_emuldata_shared { - int refs; - int flags; - int xstat; - pid_t group_pid; - - LIST_HEAD(, linux_emuldata) threads; /* head of list of linux threads */ -}; - /* * modeled after similar structure in NetBSD * this will be extended as we need more functionality */ struct linux_emuldata { - pid_t pid; - int *child_set_tid; /* in clone(): Child's TID to set on clone */ int *child_clear_tid;/* in clone(): Child's TID to clear on exit */ - struct linux_emuldata_shared *shared; - int pdeath_signal; /* parent death signal */ int flags; /* different emuldata flags */ + int em_tid; /* thread id */ struct linux_robust_list_head *robust_futexes; - - LIST_ENTRY(linux_emuldata) threads; /* list of linux threads */ }; -struct linux_emuldata *em_find(struct proc *, int locked); - -/* - * DTrace probes for locks should be fired after locking and before releasing - * to prevent races (to provide data/function stability in dtrace, see the - * output of "dtrace -v ..." and the corresponding dtrace docs). - */ -#define EMUL_LOCK(l) do { \ - mtx_lock(l); \ - LIN_SDT_PROBE1(locks, emul_lock, \ - locked, l); \ - } while (0) -#define EMUL_UNLOCK(l) do { \ - LIN_SDT_PROBE1(locks, emul_lock, \ - unlock, l); \ - mtx_unlock(l); \ - } while (0) - -#define EMUL_SHARED_RLOCK(l) do { \ - sx_slock(l); \ - LIN_SDT_PROBE1(locks, emul_shared_rlock, \ - locked, l); \ - } while (0) -#define EMUL_SHARED_RUNLOCK(l) do { \ - LIN_SDT_PROBE1(locks, emul_shared_rlock, \ - unlock, l); \ - sx_sunlock(l); \ - } while (0) -#define EMUL_SHARED_WLOCK(l) do { \ - sx_xlock(l); \ - LIN_SDT_PROBE1(locks, emul_shared_wlock, \ - locked, l); \ - } while (0) -#define EMUL_SHARED_WUNLOCK(l) do { \ - LIN_SDT_PROBE1(locks, emul_shared_wlock, \ - unlock, l); \ - sx_xunlock(l); \ - } while (0) - -/* for em_find use */ -#define EMUL_DOLOCK 1 -#define EMUL_DONTLOCK 0 +struct linux_emuldata *em_find(struct thread *); /* emuldata flags */ #define LINUX_XDEPR_REQUEUEOP 0x00000001 /* uses deprecated futex REQUEUE op*/ -int linux_proc_init(struct thread *, pid_t, int); +void linux_proc_init(struct thread *, struct thread *, int); void linux_proc_exit(void *, struct proc *); void linux_schedtail(struct thread *); void linux_proc_exec(void *, struct proc *, struct image_params *); -void linux_kill_threads(struct thread *, int); - -extern struct sx emul_shared_lock; -extern struct mtx emul_lock; +void linux_thread_dtor(void *arg __unused, struct thread *); +void linux_thread_detach(struct thread *); +int linux_common_execve(struct thread *, struct image_args *); #endif /* !_LINUX_EMUL_H_ */ Modified: head/sys/compat/linux/linux_fork.c ============================================================================== --- head/sys/compat/linux/linux_fork.c Sun May 24 14:51:29 2015 (r283382) +++ head/sys/compat/linux/linux_fork.c Sun May 24 14:53:16 2015 (r283383) @@ -34,15 +34,21 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include -#include +#include #include #include #include +#include +#include +#include + #ifdef COMPAT_LINUX32 #include #include @@ -50,18 +56,10 @@ __FBSDID("$FreeBSD$"); #include #include #endif -#include #include #include #include - -/* DTrace init */ -LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); - -/* Linuxulator-global DTrace probes */ -LIN_SDT_PROBE_DECLARE(locks, emul_lock, locked); -LIN_SDT_PROBE_DECLARE(locks, emul_lock, unlock); - +#include int linux_fork(struct thread *td, struct linux_fork_args *args) @@ -79,14 +77,11 @@ linux_fork(struct thread *td, struct lin != 0) return (error); - td->td_retval[0] = p2->p_pid; - td->td_retval[1] = 0; + td2 = FIRST_THREAD_IN_PROC(p2); - error = linux_proc_init(td, td->td_retval[0], 0); - if (error) - return (error); + linux_proc_init(td, td2, 0); - td2 = FIRST_THREAD_IN_PROC(p2); + td->td_retval[0] = p2->p_pid; /* * Make this runnable after we are finished with it. @@ -116,17 +111,16 @@ linux_vfork(struct thread *td, struct li NULL, 0)) != 0) return (error); - td->td_retval[0] = p2->p_pid; - error = linux_proc_init(td, td->td_retval[0], 0); - if (error) - return (error); + td2 = FIRST_THREAD_IN_PROC(p2); + + linux_proc_init(td, td2, 0); PROC_LOCK(p2); p2->p_flag |= P_PPWAIT; PROC_UNLOCK(p2); - td2 = FIRST_THREAD_IN_PROC(p2); + td->td_retval[0] = p2->p_pid; /* * Make this runnable after we are finished with it. @@ -145,8 +139,8 @@ linux_vfork(struct thread *td, struct li return (0); } -int -linux_clone(struct thread *td, struct linux_clone_args *args) +static int +linux_clone_proc(struct thread *td, struct linux_clone_args *args) { int error, ff = RFPROC | RFSTOPPED; struct proc *p2; @@ -183,22 +177,6 @@ linux_clone(struct thread *td, struct li if (!(args->flags & (LINUX_CLONE_FILES | LINUX_CLONE_FS))) ff |= RFFDG; - /* - * Attempt to detect when linux_clone(2) is used for creating - * kernel threads. Unfortunately despite the existence of the - * CLONE_THREAD flag, version of linuxthreads package used in - * most popular distros as of beginning of 2005 doesn't make - * any use of it. Therefore, this detection relies on - * empirical observation that linuxthreads sets certain - * combination of flags, so that we can make more or less - * precise detection and notify the FreeBSD kernel that several - * processes are in fact part of the same threading group, so - * that special treatment is necessary for signal delivery - * between those processes and fd locking. - */ - if ((args->flags & 0xffffff00) == LINUX_THREADING_FLAGS) - ff |= RFTHREAD; - if (args->flags & LINUX_CLONE_PARENT_SETTID) if (args->parent_tidptr == NULL) return (EINVAL); @@ -207,29 +185,13 @@ linux_clone(struct thread *td, struct li if (error) return (error); - if (args->flags & (LINUX_CLONE_PARENT | LINUX_CLONE_THREAD)) { - sx_xlock(&proctree_lock); - PROC_LOCK(p2); - proc_reparent(p2, td->td_proc->p_pptr); - PROC_UNLOCK(p2); - sx_xunlock(&proctree_lock); - } + td2 = FIRST_THREAD_IN_PROC(p2); /* create the emuldata */ - error = linux_proc_init(td, p2->p_pid, args->flags); - /* reference it - no need to check this */ - em = em_find(p2, EMUL_DOLOCK); - KASSERT(em != NULL, ("clone: emuldata not found.")); - /* and adjust it */ + linux_proc_init(td, td2, args->flags); - if (args->flags & LINUX_CLONE_THREAD) { -#ifdef notyet - PROC_LOCK(p2); - p2->p_pgrp = td->td_proc->p_pgrp; - PROC_UNLOCK(p2); -#endif - exit_signal = 0; - } + em = em_find(td2); + KASSERT(em != NULL, ("clone_proc: emuldata not found.\n")); if (args->flags & LINUX_CLONE_CHILD_SETTID) em->child_set_tid = args->child_tidptr; @@ -241,8 +203,6 @@ linux_clone(struct thread *td, struct li else em->child_clear_tid = NULL; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:54:13 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6C735B2; Sun, 24 May 2015 14:54:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 5A8F618BB; Sun, 24 May 2015 14:54:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEsDHB034571; Sun, 24 May 2015 14:54:13 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEsDXX034570; Sun, 24 May 2015 14:54:13 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241454.t4OEsDXX034570@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:54:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283384 - 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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:54:13 -0000 Author: dchagin Date: Sun May 24 14:54:12 2015 New Revision: 283384 URL: https://svnweb.freebsd.org/changeset/base/283384 Log: pthread_join() caller do futex_wait on child_clear_tid. As a results of multiple simultaneous calls to pthread_join() specifying the same target thread are undefined wake up the one thread. Differential Revision: https://reviews.freebsd.org/D1040 Modified: head/sys/compat/linux/linux_emul.c Modified: head/sys/compat/linux/linux_emul.c ============================================================================== --- head/sys/compat/linux/linux_emul.c Sun May 24 14:53:16 2015 (r283383) +++ head/sys/compat/linux/linux_emul.c Sun May 24 14:54:12 2015 (r283384) @@ -270,7 +270,7 @@ linux_thread_detach(struct thread *td) cup.uaddr = child_clear_tid; cup.op = LINUX_FUTEX_WAKE; - cup.val = 0x7fffffff; /* Awake everyone */ + cup.val = 1; /* wake one */ cup.timeout = NULL; cup.uaddr2 = NULL; cup.val3 = 0; From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:55:13 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CCDAE20C; Sun, 24 May 2015 14:55:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 ADD9418C9; Sun, 24 May 2015 14:55:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEtD7H034809; Sun, 24 May 2015 14:55:13 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEtDdA034805; Sun, 24 May 2015 14:55:13 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241455.t4OEtDdA034805@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:55:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283385 - in head/sys: amd64/linux32 i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:55:14 -0000 Author: dchagin Date: Sun May 24 14:55:12 2015 New Revision: 283385 URL: https://svnweb.freebsd.org/changeset/base/283385 Log: Some style(9) && whitespaces fixes. No functional changes. Differential Revision: https://reviews.freebsd.org/D1041 Reviewed by: emaste Modified: head/sys/amd64/linux32/linux32_sysvec.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Sun May 24 14:54:12 2015 (r283384) +++ head/sys/amd64/linux32/linux32_sysvec.c Sun May 24 14:55:12 2015 (r283385) @@ -294,7 +294,7 @@ elf_linux_fixup(register_t **stack_base, base--; suword32(base, (uint32_t)imgp->args->argc); *stack_base = (register_t *)base; - return 0; + return (0); } extern unsigned long linux_sznonrtsigcode; @@ -1171,9 +1171,9 @@ linux_elf_modevent(module_t mod, int typ printf("Could not deinstall ELF interpreter entry\n"); break; default: - return EOPNOTSUPP; + return (EOPNOTSUPP); } - return error; + return (error); } static moduledata_t linux_elf_mod = { Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Sun May 24 14:54:12 2015 (r283384) +++ head/sys/i386/linux/linux_sysvec.c Sun May 24 14:55:12 2015 (r283385) @@ -209,15 +209,15 @@ static int translate_traps(int signal, int trap_code) { if (signal != SIGBUS) - return signal; + return (signal); switch (trap_code) { case T_PROTFLT: case T_TSSFLT: case T_DOUBLEFLT: case T_PAGEFLT: - return SIGSEGV; + return (SIGSEGV); default: - return signal; + return (signal); } } @@ -685,7 +685,7 @@ linux_sigreturn(struct thread *td, struc #define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) eflags = frame.sf_sc.sc_eflags; if (!EFLAGS_SECURE(eflags, regs->tf_eflags)) - return(EINVAL); + return (EINVAL); /* * Don't allow users to load a valid privileged %cs. Let the @@ -700,7 +700,7 @@ linux_sigreturn(struct thread *td, struc ksi.ksi_trapno = T_PROTFLT; ksi.ksi_addr = (void *)regs->tf_eip; trapsignal(td, &ksi); - return(EINVAL); + return (EINVAL); } lmask.__bits[0] = frame.sf_sc.sc_mask; @@ -776,7 +776,7 @@ linux_rt_sigreturn(struct thread *td, st #define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) eflags = context->sc_eflags; if (!EFLAGS_SECURE(eflags, regs->tf_eflags)) - return(EINVAL); + return (EINVAL); /* * Don't allow users to load a valid privileged %cs. Let the @@ -791,7 +791,7 @@ linux_rt_sigreturn(struct thread *td, st ksi.ksi_trapno = T_PROTFLT; ksi.ksi_addr = (void *)regs->tf_eip; trapsignal(td, &ksi); - return(EINVAL); + return (EINVAL); } linux_to_bsd_sigset(&uc.uc_sigmask, &bmask); @@ -1147,9 +1147,9 @@ linux_elf_modevent(module_t mod, int typ printf("Could not deinstall ELF interpreter entry\n"); break; default: - return EOPNOTSUPP; + return (EOPNOTSUPP); } - return error; + return (error); } static moduledata_t linux_elf_mod = { From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:56:22 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 831A436C; Sun, 24 May 2015 14:56:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 576ED18D9; Sun, 24 May 2015 14:56:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEuMd0035010; Sun, 24 May 2015 14:56:22 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEuLmx035008; Sun, 24 May 2015 14:56:21 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241456.t4OEuLmx035008@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:56:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283386 - 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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:56:22 -0000 Author: dchagin Date: Sun May 24 14:56:21 2015 New Revision: 283386 URL: https://svnweb.freebsd.org/changeset/base/283386 Log: Introduce LINUX_VERSION_STR, LINUX_VERSION_CODE macro for use instead of harcoded pr_osrelease, pr_osrel values. This will be used later in the VDSO. Differential Revision: https://reviews.freebsd.org/D1042 Reviewed by: trasz Modified: head/sys/compat/linux/linux_mib.c head/sys/compat/linux/linux_mib.h Modified: head/sys/compat/linux/linux_mib.c ============================================================================== --- head/sys/compat/linux/linux_mib.c Sun May 24 14:55:12 2015 (r283385) +++ head/sys/compat/linux/linux_mib.c Sun May 24 14:56:21 2015 (r283386) @@ -129,9 +129,9 @@ struct linux_prison { static struct linux_prison lprison0 = { .pr_osname = "Linux", - .pr_osrelease = "2.6.18", + .pr_osrelease = LINUX_VERSION_STR, .pr_oss_version = 0x030600, - .pr_osrel = 2006018 + .pr_osrel = LINUX_VERSION_CODE }; static unsigned linux_osd_jail_slot; Modified: head/sys/compat/linux/linux_mib.h ============================================================================== --- head/sys/compat/linux/linux_mib.h Sun May 24 14:55:12 2015 (r283385) +++ head/sys/compat/linux/linux_mib.h Sun May 24 14:56:21 2015 (r283386) @@ -42,8 +42,19 @@ int linux_get_oss_version(struct thread int linux_kernver(struct thread *td); -#define LINUX_KERNVER_2004000 2004000 -#define LINUX_KERNVER_2006000 2006000 +#define LINUX_KVERSION 2 +#define LINUX_KPATCHLEVEL 6 +#define LINUX_KSUBLEVEL 18 + +#define LINUX_KERNVER(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +#define LINUX_VERSION_CODE LINUX_KERNVER(LINUX_KVERSION, \ + LINUX_KPATCHLEVEL, LINUX_KSUBLEVEL) +#define LINUX_KERNVERSTR(x) #x +#define LINUX_XKERNVERSTR(x) LINUX_KERNVERSTR(x) +#define LINUX_VERSION_STR LINUX_XKERNVERSTR(LINUX_KVERSION.LINUX_KPATCHLEVEL.LINUX_KSUBLEVEL) + +#define LINUX_KERNVER_2004000 LINUX_KERNVER(2,4,0) +#define LINUX_KERNVER_2006000 LINUX_KERNVER(2,6,0) #define linux_use26(t) (linux_kernver(t) >= LINUX_KERNVER_2006000) From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:57:20 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D2EC34C9; Sun, 24 May 2015 14:57:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 BEB8618EB; Sun, 24 May 2015 14:57:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEvKuB035201; Sun, 24 May 2015 14:57:20 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEvIL5035187; Sun, 24 May 2015 14:57:18 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505241457.t4OEvIL5035187@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 24 May 2015 14:57:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283387 - stable/10/sys/arm/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:57:20 -0000 Author: ian Date: Sun May 24 14:57:17 2015 New Revision: 283387 URL: https://svnweb.freebsd.org/changeset/base/283387 Log: MFC r279837: Remove MODULES_OVERRIDE="" and WITHOUT_MODULES="ahc" from armv6 configs. Modified: stable/10/sys/arm/conf/ARMADAXP stable/10/sys/arm/conf/CUBIEBOARD stable/10/sys/arm/conf/CUBIEBOARD2 stable/10/sys/arm/conf/EXYNOS5.common stable/10/sys/arm/conf/PANDABOARD stable/10/sys/arm/conf/TS7800 stable/10/sys/arm/conf/VYBRID stable/10/sys/arm/conf/ZEDBOARD Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/conf/ARMADAXP ============================================================================== --- stable/10/sys/arm/conf/ARMADAXP Sun May 24 14:56:21 2015 (r283386) +++ stable/10/sys/arm/conf/ARMADAXP Sun May 24 14:57:17 2015 (r283387) @@ -22,7 +22,6 @@ ident MV-88F78XX0 include "../mv/armadaxp/std.mv78x60" options SOC_MV_ARMADAXP -makeoptions MODULES_OVERRIDE="" makeoptions WERROR="-Werror" Modified: stable/10/sys/arm/conf/CUBIEBOARD ============================================================================== --- stable/10/sys/arm/conf/CUBIEBOARD Sun May 24 14:56:21 2015 (r283386) +++ stable/10/sys/arm/conf/CUBIEBOARD Sun May 24 14:57:17 2015 (r283387) @@ -23,9 +23,6 @@ ident CUBIEBOARD include "../allwinner/std.a10" -makeoptions MODULES_OVERRIDE="" -makeoptions WITHOUT_MODULES="ahc" - options HZ=100 options SCHED_4BSD # 4BSD scheduler options PREEMPTION # Enable kernel thread preemption Modified: stable/10/sys/arm/conf/CUBIEBOARD2 ============================================================================== --- stable/10/sys/arm/conf/CUBIEBOARD2 Sun May 24 14:56:21 2015 (r283386) +++ stable/10/sys/arm/conf/CUBIEBOARD2 Sun May 24 14:57:17 2015 (r283387) @@ -23,9 +23,6 @@ ident CUBIEBOARD2 include "../allwinner/a20/std.a20" -makeoptions MODULES_OVERRIDE="" -makeoptions WITHOUT_MODULES="ahc" - options HZ=100 options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption Modified: stable/10/sys/arm/conf/EXYNOS5.common ============================================================================== --- stable/10/sys/arm/conf/EXYNOS5.common Sun May 24 14:56:21 2015 (r283386) +++ stable/10/sys/arm/conf/EXYNOS5.common Sun May 24 14:57:17 2015 (r283387) @@ -18,9 +18,6 @@ # # $FreeBSD$ -makeoptions MODULES_OVERRIDE="" -makeoptions WITHOUT_MODULES="ahc" - makeoptions WERROR="-Werror" options HZ=100 Modified: stable/10/sys/arm/conf/PANDABOARD ============================================================================== --- stable/10/sys/arm/conf/PANDABOARD Sun May 24 14:56:21 2015 (r283386) +++ stable/10/sys/arm/conf/PANDABOARD Sun May 24 14:57:17 2015 (r283387) @@ -29,9 +29,6 @@ hints "PANDABOARD.hints" include "../ti/omap4/pandaboard/std.pandaboard" -makeoptions MODULES_OVERRIDE="" -makeoptions WITHOUT_MODULES="ahc" - options HZ=100 options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption Modified: stable/10/sys/arm/conf/TS7800 ============================================================================== --- stable/10/sys/arm/conf/TS7800 Sun May 24 14:56:21 2015 (r283386) +++ stable/10/sys/arm/conf/TS7800 Sun May 24 14:57:17 2015 (r283387) @@ -8,7 +8,6 @@ ident TS7800 include "../mv/orion/std.ts7800" options SOC_MV_ORION -makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions WERROR="-Werror" Modified: stable/10/sys/arm/conf/VYBRID ============================================================================== --- stable/10/sys/arm/conf/VYBRID Sun May 24 14:56:21 2015 (r283386) +++ stable/10/sys/arm/conf/VYBRID Sun May 24 14:57:17 2015 (r283387) @@ -21,9 +21,6 @@ ident VYBRID include "../freescale/vybrid/std.vybrid" -makeoptions MODULES_OVERRIDE="" -makeoptions WITHOUT_MODULES="ahc" - makeoptions WERROR="-Werror" options HZ=100 Modified: stable/10/sys/arm/conf/ZEDBOARD ============================================================================== --- stable/10/sys/arm/conf/ZEDBOARD Sun May 24 14:56:21 2015 (r283386) +++ stable/10/sys/arm/conf/ZEDBOARD Sun May 24 14:57:17 2015 (r283387) @@ -23,9 +23,6 @@ ident ZEDBOARD include "../xilinx/zedboard/std.zedboard" -makeoptions MODULES_OVERRIDE="" -makeoptions WITHOUT_MODULES="ahc" - options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:57:40 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 90DB95FA; Sun, 24 May 2015 14:57:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 7F34818ED; Sun, 24 May 2015 14:57:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEveff035288; Sun, 24 May 2015 14:57:40 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEvejd035287; Sun, 24 May 2015 14:57:40 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241457.t4OEvejd035287@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:57:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283388 - 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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:57:40 -0000 Author: dchagin Date: Sun May 24 14:57:39 2015 New Revision: 283388 URL: https://svnweb.freebsd.org/changeset/base/283388 Log: Remove a now unused define. Differential Revision: https://reviews.freebsd.org/D1043 Reviewed by: trasz Modified: head/sys/compat/linux/linux_misc.h Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Sun May 24 14:57:17 2015 (r283387) +++ head/sys/compat/linux/linux_misc.h Sun May 24 14:57:39 2015 (r283388) @@ -90,10 +90,6 @@ extern const char *linux_platform; #define LINUX_CLONE_CHILD_CLEARTID 0x00200000 #define LINUX_CLONE_CHILD_SETTID 0x01000000 -#define LINUX_THREADING_FLAGS \ - (LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES | \ - LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD) - /* Scheduling policies */ #define LINUX_SCHED_OTHER 0 #define LINUX_SCHED_FIFO 1 From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:58:32 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 044F574B; Sun, 24 May 2015 14:58:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 D96BE1900; Sun, 24 May 2015 14:58:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OEwV2Y035510; Sun, 24 May 2015 14:58:31 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OEwVAp035506; Sun, 24 May 2015 14:58:31 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241458.t4OEwVAp035506@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 14:58:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283389 - 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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:58:32 -0000 Author: dchagin Date: Sun May 24 14:58:30 2015 New Revision: 283389 URL: https://svnweb.freebsd.org/changeset/base/283389 Log: Add a siginfo_t conversion function. Differential Revision: https://reviews.freebsd.org/D1044 Reviewed by: emaste, trasz Modified: head/sys/compat/linux/linux_signal.c head/sys/compat/linux/linux_signal.h Modified: head/sys/compat/linux/linux_signal.c ============================================================================== --- head/sys/compat/linux/linux_signal.c Sun May 24 14:57:39 2015 (r283388) +++ head/sys/compat/linux/linux_signal.c Sun May 24 14:58:30 2015 (r283389) @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); static int linux_do_tkill(struct thread *td, struct thread *tdt, ksiginfo_t *ksi); +static void sicode_to_lsicode(int si_code, int *lsi_code); + void linux_to_bsd_sigset(l_sigset_t *lss, sigset_t *bss) @@ -595,7 +597,7 @@ linux_tgkill(struct thread *td, struct l ksiginfo_init(&ksi); ksi.ksi_signo = sig; - ksi.ksi_code = LINUX_SI_TKILL; + ksi.ksi_code = SI_LWP; ksi.ksi_errno = 0; ksi.ksi_pid = td->td_proc->p_pid; ksi.ksi_uid = td->td_proc->p_ucred->cr_ruid; @@ -633,7 +635,7 @@ linux_tkill(struct thread *td, struct li ksiginfo_init(&ksi); ksi.ksi_signo = sig; - ksi.ksi_code = LINUX_SI_TKILL; + ksi.ksi_code = SI_LWP; ksi.ksi_errno = 0; ksi.ksi_pid = td->td_proc->p_pid; ksi.ksi_uid = td->td_proc->p_ucred->cr_ruid; @@ -641,36 +643,111 @@ linux_tkill(struct thread *td, struct li } void -ksiginfo_to_lsiginfo(ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig) +ksiginfo_to_lsiginfo(const ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig) { - lsi->lsi_signo = sig; - lsi->lsi_code = ksi->ksi_code; + siginfo_to_lsiginfo(&ksi->ksi_info, lsi, sig); +} + +static void +sicode_to_lsicode(int si_code, int *lsi_code) +{ - switch (sig) { - case LINUX_SIGPOLL: - /* XXX si_fd? */ - lsi->lsi_band = ksi->ksi_band; - break; - case LINUX_SIGCHLD: - lsi->lsi_pid = ksi->ksi_pid; - lsi->lsi_uid = ksi->ksi_uid; - lsi->lsi_status = ksi->ksi_status; - break; - case LINUX_SIGBUS: - case LINUX_SIGILL: - case LINUX_SIGFPE: - case LINUX_SIGSEGV: - lsi->lsi_addr = PTROUT(ksi->ksi_addr); + switch (si_code) { + case SI_USER: + *lsi_code = LINUX_SI_USER; + break; + case SI_KERNEL: + *lsi_code = LINUX_SI_KERNEL; + break; + case SI_QUEUE: + *lsi_code = LINUX_SI_QUEUE; + break; + case SI_TIMER: + *lsi_code = LINUX_SI_TIMER; + break; + case SI_MESGQ: + *lsi_code = LINUX_SI_MESGQ; + break; + case SI_ASYNCIO: + *lsi_code = LINUX_SI_ASYNCIO; + break; + case SI_LWP: + *lsi_code = LINUX_SI_TKILL; break; default: - /* XXX SI_TIMER etc... */ - lsi->lsi_pid = ksi->ksi_pid; - lsi->lsi_uid = ksi->ksi_uid; + *lsi_code = si_code; break; } - if (sig >= LINUX_SIGRTMIN) { - lsi->lsi_int = ksi->ksi_info.si_value.sival_int; - lsi->lsi_ptr = PTROUT(ksi->ksi_info.si_value.sival_ptr); +} + +void +siginfo_to_lsiginfo(const siginfo_t *si, l_siginfo_t *lsi, l_int sig) +{ + + /* sig alredy converted */ + lsi->lsi_signo = sig; + sicode_to_lsicode(si->si_code, &lsi->lsi_code); + + switch (si->si_code) { + case SI_LWP: + lsi->lsi_pid = si->si_pid; + lsi->lsi_uid = si->si_uid; + break; + + case SI_TIMER: + lsi->lsi_int = si->si_value.sival_int; + lsi->lsi_ptr = PTROUT(si->si_value.sival_ptr); + lsi->lsi_tid = si->si_timerid; + break; + + case SI_QUEUE: + lsi->lsi_pid = si->si_pid; + lsi->lsi_uid = si->si_uid; + lsi->lsi_ptr = PTROUT(si->si_value.sival_ptr); + break; + + case SI_ASYNCIO: + lsi->lsi_int = si->si_value.sival_int; + lsi->lsi_ptr = PTROUT(si->si_value.sival_ptr); + break; + + default: + switch (sig) { + case LINUX_SIGPOLL: + /* XXX si_fd? */ + lsi->lsi_band = si->si_band; + break; + + case LINUX_SIGCHLD: + lsi->lsi_errno = 0; + lsi->lsi_pid = si->si_pid; + lsi->lsi_uid = si->si_uid; + + if (si->si_code == CLD_STOPPED) + lsi->lsi_status = BSD_TO_LINUX_SIGNAL(si->si_status); + else if (si->si_code == CLD_CONTINUED) + lsi->lsi_status = BSD_TO_LINUX_SIGNAL(SIGCONT); + else + lsi->lsi_status = si->si_status; + break; + + case LINUX_SIGBUS: + case LINUX_SIGILL: + case LINUX_SIGFPE: + case LINUX_SIGSEGV: + lsi->lsi_addr = PTROUT(si->si_addr); + break; + + default: + lsi->lsi_pid = si->si_pid; + lsi->lsi_uid = si->si_uid; + if (sig >= LINUX_SIGRTMIN) { + lsi->lsi_int = si->si_value.sival_int; + lsi->lsi_ptr = PTROUT(si->si_value.sival_ptr); + } + break; + } + break; } } Modified: head/sys/compat/linux/linux_signal.h ============================================================================== --- head/sys/compat/linux/linux_signal.h Sun May 24 14:57:39 2015 (r283388) +++ head/sys/compat/linux/linux_signal.h Sun May 24 14:58:30 2015 (r283389) @@ -31,7 +31,17 @@ #ifndef _LINUX_SIGNAL_H_ #define _LINUX_SIGNAL_H_ -#define LINUX_SI_TKILL -6; +/* + * si_code values + */ +#define LINUX_SI_USER 0 /* sent by kill, sigsend, raise */ +#define LINUX_SI_KERNEL 0x80 /* sent by the kernel from somewhere */ +#define LINUX_SI_QUEUE -1 /* sent by sigqueue */ +#define LINUX_SI_TIMER -2 /* sent by timer expiration */ +#define LINUX_SI_MESGQ -3 /* sent by real time mesq state change */ +#define LINUX_SI_ASYNCIO -4 /* sent by AIO completion */ +#define LINUX_SI_SIGIO -5 /* sent by queued SIGIO */ +#define LINUX_SI_TKILL -6 /* sent by tkill system call */ extern int bsd_to_linux_signal[]; extern int linux_to_bsd_signal[]; @@ -39,7 +49,8 @@ extern int linux_to_bsd_signal[]; void linux_to_bsd_sigset(l_sigset_t *, sigset_t *); void bsd_to_linux_sigset(sigset_t *, l_sigset_t *); int linux_do_sigaction(struct thread *, int, l_sigaction_t *, l_sigaction_t *); -void ksiginfo_to_lsiginfo(ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig); +void ksiginfo_to_lsiginfo(const ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig); +void siginfo_to_lsiginfo(const siginfo_t *si, l_siginfo_t *lsi, l_int sig); #define LINUX_SIG_VALID(sig) ((sig) <= LINUX_NSIG && (sig) > 0) From owner-svn-src-all@FreeBSD.ORG Sun May 24 14:59:45 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E208F8D5; Sun, 24 May 2015 14:59:45 +0000 (UTC) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) (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 6D2BC1921; Sun, 24 May 2015 14:59:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.5/8.14.5) with ESMTP id t4OEsJQp072865; Sun, 24 May 2015 17:55:19 +0300 (MSK) (envelope-from marck@rinet.ru) Date: Sun, 24 May 2015 17:54:19 +0300 (MSK) From: Dmitry Morozovsky To: Dmitry Chagin cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r283383 - in head/sys: amd64/linux32 compat/linux i386/linux In-Reply-To: <201505241453.t4OErHG2034385@svn.freebsd.org> Message-ID: References: <201505241453.t4OErHG2034385@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (woozle.rinet.ru [0.0.0.0]); Sun, 24 May 2015 17:55:20 +0300 (MSK) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 14:59:46 -0000 On Sun, 24 May 2015, Dmitry Chagin wrote: > Author: dchagin > Date: Sun May 24 14:53:16 2015 > New Revision: 283383 > URL: https://svnweb.freebsd.org/changeset/base/283383 > > Log: > Switch linuxulator to use the native 1:1 threads. Wow. Quite a bit of work! -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:00:28 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D8E53A2D; Sun, 24 May 2015 15:00:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 AD40D192C; Sun, 24 May 2015 15:00:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OF0SXd035961; Sun, 24 May 2015 15:00:28 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OF0Sxp035959; Sun, 24 May 2015 15:00:28 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241500.t4OF0Sxp035959@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:00:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283390 - 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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:00:29 -0000 Author: dchagin Date: Sun May 24 15:00:27 2015 New Revision: 283390 URL: https://svnweb.freebsd.org/changeset/base/283390 Log: Add a function for converting wait options. Differential Revision: https://reviews.freebsd.org/D1045 Reviewed by: trasz Modified: head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun May 24 14:58:30 2015 (r283389) +++ head/sys/compat/linux/linux_misc.c Sun May 24 15:00:27 2015 (r283390) @@ -2008,3 +2008,22 @@ linux_tdfind(struct thread *td, lwpid_t return (tdt); } + +void +linux_to_bsd_waitopts(int options, int *bsdopts) +{ + + if (options & LINUX_WNOHANG) + *bsdopts |= WNOHANG; + if (options & LINUX_WUNTRACED) + *bsdopts |= WUNTRACED; + if (options & LINUX_WEXITED) + *bsdopts |= WEXITED; + if (options & LINUX_WCONTINUED) + *bsdopts |= WCONTINUED; + if (options & LINUX_WNOWAIT) + *bsdopts |= WNOWAIT; + + if (options & __WCLONE) + *bsdopts |= WLINUXCLONE; +} Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Sun May 24 14:58:30 2015 (r283389) +++ head/sys/compat/linux/linux_misc.h Sun May 24 15:00:27 2015 (r283390) @@ -113,10 +113,21 @@ struct l_new_utsname { extern int stclohz; -#define __WCLONE 0x80000000 +#define LINUX_WNOHANG 0x00000001 +#define LINUX_WUNTRACED 0x00000002 +#define LINUX_WSTOPPED LINUX_WUNTRACED +#define LINUX_WEXITED 0x00000004 +#define LINUX_WCONTINUED 0x00000008 +#define LINUX_WNOWAIT 0x01000000 + + +#define __WNOTHREAD 0x20000000 +#define __WALL 0x40000000 +#define __WCLONE 0x80000000 int linux_common_wait(struct thread *td, int pid, int *status, int options, struct rusage *ru); +void linux_to_bsd_waitopts(int options, int *bsdopts); int linux_set_upcall_kse(struct thread *td, register_t stack); int linux_set_cloned_tls(struct thread *td, void *desc); struct thread *linux_tdfind(struct thread *, lwpid_t, pid_t); From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:03:12 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2C20FBAF; Sun, 24 May 2015 15:03:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 1A1CA1A2A; Sun, 24 May 2015 15:03:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OF3Bp6039913; Sun, 24 May 2015 15:03:11 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OF3AQA039904; Sun, 24 May 2015 15:03:10 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241503.t4OF3AQA039904@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:03:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283391 - in head/sys: amd64/linux32 compat/linux i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:03:12 -0000 Author: dchagin Date: Sun May 24 15:03:09 2015 New Revision: 283391 URL: https://svnweb.freebsd.org/changeset/base/283391 Log: To reduce code duplication introduce linux_copyout_rusage() method. Use it in linux_wait4() system call and move linux_wait4() to the MI path. While here add a prototype for the static bsd_to_linux_rusage(). Differential Revision: https://reviews.freebsd.org/D2138 Reviewed by: trasz Modified: head/sys/amd64/linux32/linux.h head/sys/amd64/linux32/linux32_genassym.c head/sys/amd64/linux32/linux32_machdep.c head/sys/compat/linux/linux_misc.c head/sys/i386/linux/linux.h head/sys/i386/linux/linux_machdep.c Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Sun May 24 15:00:27 2015 (r283390) +++ head/sys/amd64/linux32/linux.h Sun May 24 15:03:09 2015 (r283391) @@ -780,6 +780,7 @@ struct l_iovec32 { int linux32_copyiniov(struct l_iovec32 *iovp32, l_ulong iovcnt, struct iovec **iovp, int error); +int linux_copyout_rusage(struct rusage *ru, void *uaddr); /* robust futexes */ struct linux_robust_list { Modified: head/sys/amd64/linux32/linux32_genassym.c ============================================================================== --- head/sys/amd64/linux32/linux32_genassym.c Sun May 24 15:00:27 2015 (r283390) +++ head/sys/amd64/linux32/linux32_genassym.c Sun May 24 15:03:09 2015 (r283391) @@ -3,6 +3,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- head/sys/amd64/linux32/linux32_machdep.c Sun May 24 15:00:27 2015 (r283390) +++ head/sys/amd64/linux32/linux32_machdep.c Sun May 24 15:03:09 2015 (r283391) @@ -72,6 +72,8 @@ __FBSDID("$FreeBSD$"); #include #include +static void bsd_to_linux_rusage(struct rusage *ru, struct l_rusage *lru); + struct l_old_select_argv { l_int nfds; l_uintptr_t readfds; @@ -133,6 +135,16 @@ bsd_to_linux_rusage(struct rusage *ru, s } int +linux_copyout_rusage(struct rusage *ru, void *uaddr) +{ + struct l_rusage lru; + + bsd_to_linux_rusage(ru, &lru); + + return (copyout(&lru, uaddr, sizeof(struct l_rusage))); +} + +int linux_execve(struct thread *td, struct linux_execve_args *args) { struct image_args eargs; @@ -908,17 +920,14 @@ linux_settimeofday(struct thread *td, st int linux_getrusage(struct thread *td, struct linux_getrusage_args *uap) { - struct l_rusage s32; struct rusage s; int error; error = kern_getrusage(td, uap->who, &s); if (error != 0) return (error); - if (uap->rusage != NULL) { - bsd_to_linux_rusage(&s, &s32); - error = copyout(&s32, uap->rusage, sizeof(s32)); - } + if (uap->rusage != NULL) + error = linux_copyout_rusage(&s, uap->rusage); return (error); } @@ -1024,37 +1033,3 @@ linux_set_thread_area(struct thread *td, return (0); } - -int -linux_wait4(struct thread *td, struct linux_wait4_args *args) -{ - int error, options; - struct rusage ru, *rup; - struct l_rusage lru; - -#ifdef DEBUG - if (ldebug(wait4)) - printf(ARGS(wait4, "%d, %p, %d, %p"), - args->pid, (void *)args->status, args->options, - (void *)args->rusage); -#endif - - options = (args->options & (WNOHANG | WUNTRACED)); - /* WLINUXCLONE should be equal to __WCLONE, but we make sure */ - if (args->options & __WCLONE) - options |= WLINUXCLONE; - - if (args->rusage != NULL) - rup = &ru; - else - rup = NULL; - error = linux_common_wait(td, args->pid, args->status, options, rup); - if (error) - return (error); - if (args->rusage != NULL) { - bsd_to_linux_rusage(rup, &lru); - error = copyout(&lru, args->rusage, sizeof(lru)); - } - - return (error); -} Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun May 24 15:00:27 2015 (r283390) +++ head/sys/compat/linux/linux_misc.c Sun May 24 15:03:09 2015 (r283391) @@ -886,6 +886,35 @@ linux_waitpid(struct thread *td, struct return (linux_common_wait(td, args->pid, args->status, options, NULL)); } +int +linux_wait4(struct thread *td, struct linux_wait4_args *args) +{ + int error, options; + struct rusage ru, *rup; + +#ifdef DEBUG + if (ldebug(wait4)) + printf(ARGS(wait4, "%d, %p, %d, %p"), + args->pid, (void *)args->status, args->options, + (void *)args->rusage); +#endif + + options = (args->options & (WNOHANG | WUNTRACED)); + /* WLINUXCLONE should be equal to __WCLONE, but we make sure */ + if (args->options & __WCLONE) + options |= WLINUXCLONE; + + if (args->rusage != NULL) + rup = &ru; + else + rup = NULL; + error = linux_common_wait(td, args->pid, args->status, options, rup); + if (error != 0) + return (error); + if (args->rusage != NULL) + error = linux_copyout_rusage(&ru, args->rusage); + return (error); +} int linux_mknod(struct thread *td, struct linux_mknod_args *args) Modified: head/sys/i386/linux/linux.h ============================================================================== --- head/sys/i386/linux/linux.h Sun May 24 15:00:27 2015 (r283390) +++ head/sys/i386/linux/linux.h Sun May 24 15:03:09 2015 (r283391) @@ -741,6 +741,8 @@ struct l_desc_struct { #define LINUX_GET_USEABLE(desc) \ (((desc)->b >> LINUX_ENTRY_B_USEABLE) & 1) +#define linux_copyout_rusage(r, u) copyout(r, u, sizeof(*r)) + /* robust futexes */ struct linux_robust_list { struct linux_robust_list *next; Modified: head/sys/i386/linux/linux_machdep.c ============================================================================== --- head/sys/i386/linux/linux_machdep.c Sun May 24 15:00:27 2015 (r283390) +++ head/sys/i386/linux/linux_machdep.c Sun May 24 15:03:09 2015 (r283391) @@ -1047,34 +1047,3 @@ linux_mq_getsetattr(struct thread *td, s return (ENOSYS); #endif } - -int -linux_wait4(struct thread *td, struct linux_wait4_args *args) -{ - int error, options; - struct rusage ru, *rup; - -#ifdef DEBUG - if (ldebug(wait4)) - printf(ARGS(wait4, "%d, %p, %d, %p"), - args->pid, (void *)args->status, args->options, - (void *)args->rusage); -#endif - - options = (args->options & (WNOHANG | WUNTRACED)); - /* WLINUXCLONE should be equal to __WCLONE, but we make sure */ - if (args->options & __WCLONE) - options |= WLINUXCLONE; - - if (args->rusage != NULL) - rup = &ru; - else - rup = NULL; - error = linux_common_wait(td, args->pid, args->status, options, rup); - if (error) - return (error); - if (args->rusage != NULL) - error = copyout(&ru, args->rusage, sizeof(ru)); - - return (error); -} From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:04:13 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 61798CFE; Sun, 24 May 2015 15:04:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 4F1431A34; Sun, 24 May 2015 15:04:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OF4DTK040110; Sun, 24 May 2015 15:04:13 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OF4DZO040109; Sun, 24 May 2015 15:04:13 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241504.t4OF4DZO040109@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:04:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283392 - head/sys/i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:04:13 -0000 Author: dchagin Date: Sun May 24 15:04:12 2015 New Revision: 283392 URL: https://svnweb.freebsd.org/changeset/base/283392 Log: struct l_rusage does not defined for i386 Linuxulator due to it's nature. Differential Revision: https://reviews.freebsd.org/D2139 Modified: head/sys/i386/linux/syscalls.master Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Sun May 24 15:03:09 2015 (r283391) +++ head/sys/i386/linux/syscalls.master Sun May 24 15:04:12 2015 (r283392) @@ -208,7 +208,7 @@ 113 AUE_NULL STD { int linux_vm86old(void); } 114 AUE_WAIT4 STD { int linux_wait4(l_pid_t pid, \ l_int *status, l_int options, \ - struct l_rusage *rusage); } + void *rusage); } 115 AUE_SWAPOFF STD { int linux_swapoff(void); } 116 AUE_NULL STD { int linux_sysinfo(struct l_sysinfo *info); } 117 AUE_NULL STD { int linux_ipc(l_uint what, l_int arg1, \ From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:05:24 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5879BE68; Sun, 24 May 2015 15:05:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 46CF11A4C; Sun, 24 May 2015 15:05:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OF5OpH040357; Sun, 24 May 2015 15:05:24 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OF5Ml3040348; Sun, 24 May 2015 15:05:22 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241505.t4OF5Ml3040348@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283393 - head/sys/i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:05:24 -0000 Author: dchagin Date: Sun May 24 15:05:22 2015 New Revision: 283393 URL: https://svnweb.freebsd.org/changeset/base/283393 Log: Regen for r283392. Modified: head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/i386/linux/linux_proto.h ============================================================================== --- head/sys/i386/linux/linux_proto.h Sun May 24 15:04:12 2015 (r283392) +++ head/sys/i386/linux/linux_proto.h Sun May 24 15:05:22 2015 (r283393) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283379 2015-05-24 14:45:57Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283392 2015-05-24 15:04:12Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -360,7 +360,7 @@ struct linux_wait4_args { char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; char status_l_[PADL_(l_int *)]; l_int * status; char status_r_[PADR_(l_int *)]; char options_l_[PADL_(l_int)]; l_int options; char options_r_[PADR_(l_int)]; - char rusage_l_[PADL_(struct l_rusage *)]; struct l_rusage * rusage; char rusage_r_[PADR_(struct l_rusage *)]; + char rusage_l_[PADL_(void *)]; void * rusage; char rusage_r_[PADR_(void *)]; }; struct linux_swapoff_args { register_t dummy; Modified: head/sys/i386/linux/linux_syscall.h ============================================================================== --- head/sys/i386/linux/linux_syscall.h Sun May 24 15:04:12 2015 (r283392) +++ head/sys/i386/linux/linux_syscall.h Sun May 24 15:05:22 2015 (r283393) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283379 2015-05-24 14:45:57Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283392 2015-05-24 15:04:12Z dchagin */ #define LINUX_SYS_linux_exit 1 Modified: head/sys/i386/linux/linux_syscalls.c ============================================================================== --- head/sys/i386/linux/linux_syscalls.c Sun May 24 15:04:12 2015 (r283392) +++ head/sys/i386/linux/linux_syscalls.c Sun May 24 15:05:22 2015 (r283393) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283379 2015-05-24 14:45:57Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283392 2015-05-24 15:04:12Z dchagin */ const char *linux_syscallnames[] = { Modified: head/sys/i386/linux/linux_sysent.c ============================================================================== --- head/sys/i386/linux/linux_sysent.c Sun May 24 15:04:12 2015 (r283392) +++ head/sys/i386/linux/linux_sysent.c Sun May 24 15:05:22 2015 (r283393) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283379 2015-05-24 14:45:57Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283392 2015-05-24 15:04:12Z dchagin */ #include Modified: head/sys/i386/linux/linux_systrace_args.c ============================================================================== --- head/sys/i386/linux/linux_systrace_args.c Sun May 24 15:04:12 2015 (r283392) +++ head/sys/i386/linux/linux_systrace_args.c Sun May 24 15:05:22 2015 (r283393) @@ -792,7 +792,7 @@ systrace_args(int sysnum, void *params, iarg[0] = p->pid; /* l_pid_t */ uarg[1] = (intptr_t) p->status; /* l_int * */ iarg[2] = p->options; /* l_int */ - uarg[3] = (intptr_t) p->rusage; /* struct l_rusage * */ + uarg[3] = (intptr_t) p->rusage; /* void * */ *n_args = 4; break; } @@ -3548,7 +3548,7 @@ systrace_entry_setargdesc(int sysnum, in p = "l_int"; break; case 3: - p = "struct l_rusage *"; + p = "void *"; break; default: break; From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:06:41 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A00F0FD5; Sun, 24 May 2015 15:06:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 810A01A5E; Sun, 24 May 2015 15:06:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OF6faH040574; Sun, 24 May 2015 15:06:41 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OF6d6v040562; Sun, 24 May 2015 15:06:39 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241506.t4OF6d6v040562@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:06:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283394 - in head/sys: amd64/linux32 compat/linux i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:06:41 -0000 Author: dchagin Date: Sun May 24 15:06:39 2015 New Revision: 283394 URL: https://svnweb.freebsd.org/changeset/base/283394 Log: Implement waitid() system call. Differential Revision: https://reviews.freebsd.org/D1046 Modified: head/sys/amd64/linux32/linux32_dummy.c head/sys/amd64/linux32/syscalls.master head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h head/sys/i386/linux/linux_dummy.c head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- head/sys/amd64/linux32/linux32_dummy.c Sun May 24 15:05:22 2015 (r283393) +++ head/sys/amd64/linux32/linux32_dummy.c Sun May 24 15:06:39 2015 (r283394) @@ -84,7 +84,6 @@ DUMMY(mq_timedreceive); DUMMY(mq_notify); DUMMY(mq_getsetattr); DUMMY(kexec_load); -DUMMY(waitid); /* linux 2.6.11: */ DUMMY(add_key); DUMMY(request_key); Modified: head/sys/amd64/linux32/syscalls.master ============================================================================== --- head/sys/amd64/linux32/syscalls.master Sun May 24 15:05:22 2015 (r283393) +++ head/sys/amd64/linux32/syscalls.master Sun May 24 15:06:39 2015 (r283394) @@ -466,7 +466,9 @@ 281 AUE_NULL STD { int linux_mq_notify(void); } 282 AUE_NULL STD { int linux_mq_getsetattr(void); } 283 AUE_NULL STD { int linux_kexec_load(void); } -284 AUE_NULL STD { int linux_waitid(void); } +284 AUE_WAIT6 STD { int linux_waitid(int idtype, l_pid_t id, \ + l_siginfo_t *info, int options, \ + struct l_rusage *rusage); } 285 AUE_NULL UNIMPL ; linux 2.6.11: 286 AUE_NULL STD { int linux_add_key(void); } Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun May 24 15:05:22 2015 (r283393) +++ head/sys/compat/linux/linux_misc.c Sun May 24 15:06:39 2015 (r283394) @@ -917,6 +917,68 @@ linux_wait4(struct thread *td, struct li } int +linux_waitid(struct thread *td, struct linux_waitid_args *args) +{ + int status, options, sig; + struct __wrusage wru; + siginfo_t siginfo; + l_siginfo_t lsi; + idtype_t idtype; + struct proc *p; + int error; + + options = 0; + linux_to_bsd_waitopts(args->options, &options); + + if (options & ~(WNOHANG | WNOWAIT | WEXITED | WUNTRACED | WCONTINUED)) + return (EINVAL); + if (!(options & (WEXITED | WUNTRACED | WCONTINUED))) + return (EINVAL); + + switch (args->idtype) { + case LINUX_P_ALL: + idtype = P_ALL; + break; + case LINUX_P_PID: + if (args->id <= 0) + return (EINVAL); + idtype = P_PID; + break; + case LINUX_P_PGID: + if (args->id <= 0) + return (EINVAL); + idtype = P_PGID; + break; + default: + return (EINVAL); + } + + error = kern_wait6(td, idtype, args->id, &status, options, + &wru, &siginfo); + if (error != 0) + return (error); + if (args->rusage != NULL) { + error = linux_copyout_rusage(&wru.wru_children, + args->rusage); + if (error != 0) + return (error); + } + if (args->info != NULL) { + p = td->td_proc; + if (td->td_retval[0] == 0) + bzero(&lsi, sizeof(lsi)); + else { + sig = BSD_TO_LINUX_SIGNAL(siginfo.si_signo); + siginfo_to_lsiginfo(&siginfo, &lsi, sig); + } + error = copyout(&lsi, args->info, sizeof(lsi)); + } + td->td_retval[0] = 0; + + return (error); +} + +int linux_mknod(struct thread *td, struct linux_mknod_args *args) { char *path; Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Sun May 24 15:05:22 2015 (r283393) +++ head/sys/compat/linux/linux_misc.h Sun May 24 15:06:39 2015 (r283394) @@ -125,6 +125,12 @@ extern int stclohz; #define __WALL 0x40000000 #define __WCLONE 0x80000000 +/* Linux waitid idtype */ +#define LINUX_P_ALL 0 +#define LINUX_P_PID 1 +#define LINUX_P_PGID 2 + + int linux_common_wait(struct thread *td, int pid, int *status, int options, struct rusage *ru); void linux_to_bsd_waitopts(int options, int *bsdopts); Modified: head/sys/i386/linux/linux_dummy.c ============================================================================== --- head/sys/i386/linux/linux_dummy.c Sun May 24 15:05:22 2015 (r283393) +++ head/sys/i386/linux/linux_dummy.c Sun May 24 15:06:39 2015 (r283394) @@ -80,7 +80,6 @@ DUMMY(mbind); DUMMY(get_mempolicy); DUMMY(set_mempolicy); DUMMY(kexec_load); -DUMMY(waitid); /* linux 2.6.11: */ DUMMY(add_key); DUMMY(request_key); Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Sun May 24 15:05:22 2015 (r283393) +++ head/sys/i386/linux/syscalls.master Sun May 24 15:06:39 2015 (r283394) @@ -474,7 +474,9 @@ 282 AUE_NULL STD { int linux_mq_getsetattr(l_mqd_t mqd, const struct mq_attr *attr, \ struct mq_attr *oattr); } 283 AUE_NULL STD { int linux_kexec_load(void); } -284 AUE_NULL STD { int linux_waitid(void); } +284 AUE_WAIT6 STD { int linux_waitid(int idtype, l_pid_t id, \ + l_siginfo_t *info, int options, \ + void *rusage); } 285 AUE_NULL UNIMPL ; linux 2.6.11: 286 AUE_NULL STD { int linux_add_key(void); } From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:08:29 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A8261C6; Sun, 24 May 2015 15:08:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 2779F1A7B; Sun, 24 May 2015 15:08:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OF8TWK040900; Sun, 24 May 2015 15:08:29 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OF8QZP040883; Sun, 24 May 2015 15:08:26 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241508.t4OF8QZP040883@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:08:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283395 - in head/sys: amd64/linux32 i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:08:29 -0000 Author: dchagin Date: Sun May 24 15:08:25 2015 New Revision: 283395 URL: https://svnweb.freebsd.org/changeset/base/283395 Log: Regen for r283394. Modified: head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_syscall.h head/sys/amd64/linux32/linux32_syscalls.c head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux32/linux32_proto.h ============================================================================== --- head/sys/amd64/linux32/linux32_proto.h Sun May 24 15:06:39 2015 (r283394) +++ head/sys/amd64/linux32/linux32_proto.h Sun May 24 15:08:25 2015 (r283395) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283379 2015-05-24 14:45:57Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283394 2015-05-24 15:06:39Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -884,7 +884,11 @@ struct linux_kexec_load_args { register_t dummy; }; struct linux_waitid_args { - register_t dummy; + char idtype_l_[PADL_(int)]; int idtype; char idtype_r_[PADR_(int)]; + char id_l_[PADL_(l_pid_t)]; l_pid_t id; char id_r_[PADR_(l_pid_t)]; + char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)]; + char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)]; + char rusage_l_[PADL_(struct l_rusage *)]; struct l_rusage * rusage; char rusage_r_[PADR_(struct l_rusage *)]; }; struct linux_add_key_args { register_t dummy; @@ -1634,7 +1638,7 @@ int linux_process_vm_writev(struct threa #define LINUX_SYS_AUE_linux_mq_notify AUE_NULL #define LINUX_SYS_AUE_linux_mq_getsetattr AUE_NULL #define LINUX_SYS_AUE_linux_kexec_load AUE_NULL -#define LINUX_SYS_AUE_linux_waitid AUE_NULL +#define LINUX_SYS_AUE_linux_waitid AUE_WAIT6 #define LINUX_SYS_AUE_linux_add_key AUE_NULL #define LINUX_SYS_AUE_linux_request_key AUE_NULL #define LINUX_SYS_AUE_linux_keyctl AUE_NULL Modified: head/sys/amd64/linux32/linux32_syscall.h ============================================================================== --- head/sys/amd64/linux32/linux32_syscall.h Sun May 24 15:06:39 2015 (r283394) +++ head/sys/amd64/linux32/linux32_syscall.h Sun May 24 15:08:25 2015 (r283395) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283379 2015-05-24 14:45:57Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283394 2015-05-24 15:06:39Z dchagin */ #define LINUX_SYS_linux_exit 1 Modified: head/sys/amd64/linux32/linux32_syscalls.c ============================================================================== --- head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 15:06:39 2015 (r283394) +++ head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 15:08:25 2015 (r283395) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283379 2015-05-24 14:45:57Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283394 2015-05-24 15:06:39Z dchagin */ const char *linux_syscallnames[] = { Modified: head/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysent.c Sun May 24 15:06:39 2015 (r283394) +++ head/sys/amd64/linux32/linux32_sysent.c Sun May 24 15:08:25 2015 (r283395) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283379 2015-05-24 14:45:57Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283394 2015-05-24 15:06:39Z dchagin */ #include "opt_compat.h" @@ -303,7 +303,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)linux_mq_notify, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 281 = linux_mq_notify */ { 0, (sy_call_t *)linux_mq_getsetattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 282 = linux_mq_getsetattr */ { 0, (sy_call_t *)linux_kexec_load, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 283 = linux_kexec_load */ - { 0, (sy_call_t *)linux_waitid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 284 = linux_waitid */ + { AS(linux_waitid_args), (sy_call_t *)linux_waitid, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC }, /* 284 = linux_waitid */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 285 = */ { 0, (sy_call_t *)linux_add_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 286 = linux_add_key */ { 0, (sy_call_t *)linux_request_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 287 = linux_request_key */ Modified: head/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 15:06:39 2015 (r283394) +++ head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 15:08:25 2015 (r283395) @@ -1886,7 +1886,13 @@ systrace_args(int sysnum, void *params, } /* linux_waitid */ case 284: { - *n_args = 0; + struct linux_waitid_args *p = params; + iarg[0] = p->idtype; /* int */ + iarg[1] = p->id; /* l_pid_t */ + uarg[2] = (intptr_t) p->info; /* l_siginfo_t * */ + iarg[3] = p->options; /* int */ + uarg[4] = (intptr_t) p->rusage; /* struct l_rusage * */ + *n_args = 5; break; } /* linux_add_key */ @@ -5068,6 +5074,25 @@ systrace_entry_setargdesc(int sysnum, in break; /* linux_waitid */ case 284: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "l_pid_t"; + break; + case 2: + p = "l_siginfo_t *"; + break; + case 3: + p = "int"; + break; + case 4: + p = "struct l_rusage *"; + break; + default: + break; + }; break; /* linux_add_key */ case 286: @@ -6569,6 +6594,9 @@ systrace_return_setargdesc(int sysnum, i case 283: /* linux_waitid */ case 284: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_add_key */ case 286: /* linux_request_key */ Modified: head/sys/i386/linux/linux_proto.h ============================================================================== --- head/sys/i386/linux/linux_proto.h Sun May 24 15:06:39 2015 (r283394) +++ head/sys/i386/linux/linux_proto.h Sun May 24 15:08:25 2015 (r283395) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283392 2015-05-24 15:04:12Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283394 2015-05-24 15:06:39Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -902,7 +902,11 @@ struct linux_kexec_load_args { register_t dummy; }; struct linux_waitid_args { - register_t dummy; + char idtype_l_[PADL_(int)]; int idtype; char idtype_r_[PADR_(int)]; + char id_l_[PADL_(l_pid_t)]; l_pid_t id; char id_r_[PADR_(l_pid_t)]; + char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)]; + char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)]; + char rusage_l_[PADL_(void *)]; void * rusage; char rusage_r_[PADR_(void *)]; }; struct linux_add_key_args { register_t dummy; @@ -1656,7 +1660,7 @@ int linux_process_vm_writev(struct threa #define LINUX_SYS_AUE_linux_mq_notify AUE_NULL #define LINUX_SYS_AUE_linux_mq_getsetattr AUE_NULL #define LINUX_SYS_AUE_linux_kexec_load AUE_NULL -#define LINUX_SYS_AUE_linux_waitid AUE_NULL +#define LINUX_SYS_AUE_linux_waitid AUE_WAIT6 #define LINUX_SYS_AUE_linux_add_key AUE_NULL #define LINUX_SYS_AUE_linux_request_key AUE_NULL #define LINUX_SYS_AUE_linux_keyctl AUE_NULL Modified: head/sys/i386/linux/linux_syscall.h ============================================================================== --- head/sys/i386/linux/linux_syscall.h Sun May 24 15:06:39 2015 (r283394) +++ head/sys/i386/linux/linux_syscall.h Sun May 24 15:08:25 2015 (r283395) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283392 2015-05-24 15:04:12Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283394 2015-05-24 15:06:39Z dchagin */ #define LINUX_SYS_linux_exit 1 Modified: head/sys/i386/linux/linux_syscalls.c ============================================================================== --- head/sys/i386/linux/linux_syscalls.c Sun May 24 15:06:39 2015 (r283394) +++ head/sys/i386/linux/linux_syscalls.c Sun May 24 15:08:25 2015 (r283395) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283392 2015-05-24 15:04:12Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283394 2015-05-24 15:06:39Z dchagin */ const char *linux_syscallnames[] = { Modified: head/sys/i386/linux/linux_sysent.c ============================================================================== --- head/sys/i386/linux/linux_sysent.c Sun May 24 15:06:39 2015 (r283394) +++ head/sys/i386/linux/linux_sysent.c Sun May 24 15:08:25 2015 (r283395) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283392 2015-05-24 15:04:12Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283394 2015-05-24 15:06:39Z dchagin */ #include @@ -302,7 +302,7 @@ struct sysent linux_sysent[] = { { AS(linux_mq_notify_args), (sy_call_t *)linux_mq_notify, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 281 = linux_mq_notify */ { AS(linux_mq_getsetattr_args), (sy_call_t *)linux_mq_getsetattr, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 282 = linux_mq_getsetattr */ { 0, (sy_call_t *)linux_kexec_load, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 283 = linux_kexec_load */ - { 0, (sy_call_t *)linux_waitid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 284 = linux_waitid */ + { AS(linux_waitid_args), (sy_call_t *)linux_waitid, AUE_WAIT6, NULL, 0, 0, 0, SY_THR_STATIC }, /* 284 = linux_waitid */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 285 = */ { 0, (sy_call_t *)linux_add_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 286 = linux_add_key */ { 0, (sy_call_t *)linux_request_key, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 287 = linux_request_key */ Modified: head/sys/i386/linux/linux_systrace_args.c ============================================================================== --- head/sys/i386/linux/linux_systrace_args.c Sun May 24 15:06:39 2015 (r283394) +++ head/sys/i386/linux/linux_systrace_args.c Sun May 24 15:08:25 2015 (r283395) @@ -1962,7 +1962,13 @@ systrace_args(int sysnum, void *params, } /* linux_waitid */ case 284: { - *n_args = 0; + struct linux_waitid_args *p = params; + iarg[0] = p->idtype; /* int */ + iarg[1] = p->id; /* l_pid_t */ + uarg[2] = (intptr_t) p->info; /* l_siginfo_t * */ + iarg[3] = p->options; /* int */ + uarg[4] = (intptr_t) p->rusage; /* void * */ + *n_args = 5; break; } /* linux_add_key */ @@ -5299,6 +5305,25 @@ systrace_entry_setargdesc(int sysnum, in break; /* linux_waitid */ case 284: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "l_pid_t"; + break; + case 2: + p = "l_siginfo_t *"; + break; + case 3: + p = "int"; + break; + case 4: + p = "void *"; + break; + default: + break; + }; break; /* linux_add_key */ case 286: @@ -6847,6 +6872,9 @@ systrace_return_setargdesc(int sysnum, i case 283: /* linux_waitid */ case 284: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_add_key */ case 286: /* linux_request_key */ From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:11:34 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6C165353; Sun, 24 May 2015 15:11:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 4C8E21A9E; Sun, 24 May 2015 15:11:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OFBYgp044461; Sun, 24 May 2015 15:11:34 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OFBW1c044455; Sun, 24 May 2015 15:11:32 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241511.t4OFBW1c044455@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:11:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283396 - in head/sys: amd64/linux32 compat/linux i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:11:34 -0000 Author: dchagin Date: Sun May 24 15:11:32 2015 New Revision: 283396 URL: https://svnweb.freebsd.org/changeset/base/283396 Log: Implement rt_sigqueueinfo() system call. Differential Revision: https://reviews.freebsd.org/D1047 Reviewed by: trasz Modified: head/sys/amd64/linux32/linux32_dummy.c head/sys/amd64/linux32/syscalls.master head/sys/compat/linux/linux_signal.c head/sys/compat/linux/linux_signal.h head/sys/i386/linux/linux_dummy.c head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- head/sys/amd64/linux32/linux32_dummy.c Sun May 24 15:08:25 2015 (r283395) +++ head/sys/amd64/linux32/linux32_dummy.c Sun May 24 15:11:32 2015 (r283396) @@ -61,7 +61,6 @@ DUMMY(bdflush); DUMMY(sysfs); DUMMY(query_module); DUMMY(nfsservctl); -DUMMY(rt_sigqueueinfo); DUMMY(sendfile); DUMMY(setfsuid); DUMMY(setfsgid); Modified: head/sys/amd64/linux32/syscalls.master ============================================================================== --- head/sys/amd64/linux32/syscalls.master Sun May 24 15:08:25 2015 (r283395) +++ head/sys/amd64/linux32/syscalls.master Sun May 24 15:11:32 2015 (r283396) @@ -318,7 +318,8 @@ l_siginfo_t *ptr, \ struct l_timeval *timeout, \ l_size_t sigsetsize); } -178 AUE_NULL STD { int linux_rt_sigqueueinfo(void); } +178 AUE_NULL STD { int linux_rt_sigqueueinfo(l_pid_t pid, l_int sig, \ + l_siginfo_t *info); } 179 AUE_NULL STD { int linux_rt_sigsuspend( \ l_sigset_t *newset, \ l_size_t sigsetsize); } Modified: head/sys/compat/linux/linux_signal.c ============================================================================== --- head/sys/compat/linux/linux_signal.c Sun May 24 15:08:25 2015 (r283395) +++ head/sys/compat/linux/linux_signal.c Sun May 24 15:11:32 2015 (r283396) @@ -751,3 +751,58 @@ siginfo_to_lsiginfo(const siginfo_t *si, break; } } + +void +lsiginfo_to_ksiginfo(const l_siginfo_t *lsi, ksiginfo_t *ksi, int sig) +{ + + ksi->ksi_signo = sig; + ksi->ksi_code = lsi->lsi_code; /* XXX. Convert. */ + ksi->ksi_pid = lsi->lsi_pid; + ksi->ksi_uid = lsi->lsi_uid; + ksi->ksi_status = lsi->lsi_status; + ksi->ksi_addr = PTRIN(lsi->lsi_addr); + ksi->ksi_info.si_value.sival_int = lsi->lsi_int; +} + +int +linux_rt_sigqueueinfo(struct thread *td, struct linux_rt_sigqueueinfo_args *args) +{ + l_siginfo_t linfo; + struct proc *p; + ksiginfo_t ksi; + int error; + int sig; + + if (!LINUX_SIG_VALID(args->sig)) + return (EINVAL); + + error = copyin(args->info, &linfo, sizeof(linfo)); + if (error != 0) + return (error); + + if (linfo.lsi_code >= 0) + return (EPERM); + + if (args->sig > 0 && args->sig <= LINUX_SIGTBLSZ) + sig = linux_to_bsd_signal[_SIG_IDX(args->sig)]; + else + sig = args->sig; + + error = ESRCH; + if ((p = pfind(args->pid)) != NULL || + (p = zpfind(args->pid)) != NULL) { + error = p_cansignal(td, p, sig); + if (error != 0) { + PROC_UNLOCK(p); + return (error); + } + + ksiginfo_init(&ksi); + lsiginfo_to_ksiginfo(&linfo, &ksi, sig); + error = tdsendsignal(p, NULL, sig, &ksi); + PROC_UNLOCK(p); + } + + return (error); +} Modified: head/sys/compat/linux/linux_signal.h ============================================================================== --- head/sys/compat/linux/linux_signal.h Sun May 24 15:08:25 2015 (r283395) +++ head/sys/compat/linux/linux_signal.h Sun May 24 15:11:32 2015 (r283396) @@ -51,6 +51,7 @@ void bsd_to_linux_sigset(sigset_t *, l_s int linux_do_sigaction(struct thread *, int, l_sigaction_t *, l_sigaction_t *); void ksiginfo_to_lsiginfo(const ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig); void siginfo_to_lsiginfo(const siginfo_t *si, l_siginfo_t *lsi, l_int sig); +void lsiginfo_to_ksiginfo(const l_siginfo_t *lsi, ksiginfo_t *ksi, int sig); #define LINUX_SIG_VALID(sig) ((sig) <= LINUX_NSIG && (sig) > 0) Modified: head/sys/i386/linux/linux_dummy.c ============================================================================== --- head/sys/i386/linux/linux_dummy.c Sun May 24 15:08:25 2015 (r283395) +++ head/sys/i386/linux/linux_dummy.c Sun May 24 15:11:32 2015 (r283396) @@ -64,7 +64,6 @@ DUMMY(sysfs); DUMMY(vm86); DUMMY(query_module); DUMMY(nfsservctl); -DUMMY(rt_sigqueueinfo); DUMMY(sendfile); /* different semantics */ DUMMY(setfsuid); DUMMY(setfsgid); Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Sun May 24 15:08:25 2015 (r283395) +++ head/sys/i386/linux/syscalls.master Sun May 24 15:11:32 2015 (r283396) @@ -320,7 +320,8 @@ l_siginfo_t *ptr, \ struct l_timeval *timeout, \ l_size_t sigsetsize); } -178 AUE_NULL STD { int linux_rt_sigqueueinfo(void); } +178 AUE_NULL STD { int linux_rt_sigqueueinfo(l_pid_t pid, l_int sig, \ + l_siginfo_t *info); } 179 AUE_NULL STD { int linux_rt_sigsuspend( \ l_sigset_t *newset, \ l_size_t sigsetsize); } From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:12:41 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7723F4AF; Sun, 24 May 2015 15:12:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 592291B55; Sun, 24 May 2015 15:12:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OFCfKO045162; Sun, 24 May 2015 15:12:41 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OFCcwQ045149; Sun, 24 May 2015 15:12:38 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241512.t4OFCcwQ045149@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:12:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283397 - in head/sys: amd64/linux32 i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:12:41 -0000 Author: dchagin Date: Sun May 24 15:12:38 2015 New Revision: 283397 URL: https://svnweb.freebsd.org/changeset/base/283397 Log: Regen for r283396. Modified: head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_syscall.h head/sys/amd64/linux32/linux32_syscalls.c head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux32/linux32_proto.h ============================================================================== --- head/sys/amd64/linux32/linux32_proto.h Sun May 24 15:11:32 2015 (r283396) +++ head/sys/amd64/linux32/linux32_proto.h Sun May 24 15:12:38 2015 (r283397) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283394 2015-05-24 15:06:39Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283396 2015-05-24 15:11:32Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -574,7 +574,9 @@ struct linux_rt_sigtimedwait_args { char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)]; }; struct linux_rt_sigqueueinfo_args { - register_t dummy; + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)]; + char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)]; }; struct linux_rt_sigsuspend_args { char newset_l_[PADL_(l_sigset_t *)]; l_sigset_t * newset; char newset_r_[PADR_(l_sigset_t *)]; Modified: head/sys/amd64/linux32/linux32_syscall.h ============================================================================== --- head/sys/amd64/linux32/linux32_syscall.h Sun May 24 15:11:32 2015 (r283396) +++ head/sys/amd64/linux32/linux32_syscall.h Sun May 24 15:12:38 2015 (r283397) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283394 2015-05-24 15:06:39Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283396 2015-05-24 15:11:32Z dchagin */ #define LINUX_SYS_linux_exit 1 Modified: head/sys/amd64/linux32/linux32_syscalls.c ============================================================================== --- head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 15:11:32 2015 (r283396) +++ head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 15:12:38 2015 (r283397) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283394 2015-05-24 15:06:39Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283396 2015-05-24 15:11:32Z dchagin */ const char *linux_syscallnames[] = { Modified: head/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysent.c Sun May 24 15:11:32 2015 (r283396) +++ head/sys/amd64/linux32/linux32_sysent.c Sun May 24 15:12:38 2015 (r283397) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283394 2015-05-24 15:06:39Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283396 2015-05-24 15:11:32Z dchagin */ #include "opt_compat.h" @@ -197,7 +197,7 @@ struct sysent linux_sysent[] = { { AS(linux_rt_sigprocmask_args), (sy_call_t *)linux_rt_sigprocmask, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 175 = linux_rt_sigprocmask */ { AS(linux_rt_sigpending_args), (sy_call_t *)linux_rt_sigpending, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 176 = linux_rt_sigpending */ { AS(linux_rt_sigtimedwait_args), (sy_call_t *)linux_rt_sigtimedwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 177 = linux_rt_sigtimedwait */ - { 0, (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 178 = linux_rt_sigqueueinfo */ + { AS(linux_rt_sigqueueinfo_args), (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 178 = linux_rt_sigqueueinfo */ { AS(linux_rt_sigsuspend_args), (sy_call_t *)linux_rt_sigsuspend, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 179 = linux_rt_sigsuspend */ { AS(linux_pread_args), (sy_call_t *)linux_pread, AUE_PREAD, NULL, 0, 0, 0, SY_THR_STATIC }, /* 180 = linux_pread */ { AS(linux_pwrite_args), (sy_call_t *)linux_pwrite, AUE_PWRITE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 181 = linux_pwrite */ Modified: head/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 15:11:32 2015 (r283396) +++ head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 15:12:38 2015 (r283397) @@ -1234,7 +1234,11 @@ systrace_args(int sysnum, void *params, } /* linux_rt_sigqueueinfo */ case 178: { - *n_args = 0; + struct linux_rt_sigqueueinfo_args *p = params; + iarg[0] = p->pid; /* l_pid_t */ + iarg[1] = p->sig; /* l_int */ + uarg[2] = (intptr_t) p->info; /* l_siginfo_t * */ + *n_args = 3; break; } /* linux_rt_sigsuspend */ @@ -4167,6 +4171,19 @@ systrace_entry_setargdesc(int sysnum, in break; /* linux_rt_sigqueueinfo */ case 178: + switch(ndx) { + case 0: + p = "l_pid_t"; + break; + case 1: + p = "l_int"; + break; + case 2: + p = "l_siginfo_t *"; + break; + default: + break; + }; break; /* linux_rt_sigsuspend */ case 179: @@ -6245,6 +6262,9 @@ systrace_return_setargdesc(int sysnum, i break; /* linux_rt_sigqueueinfo */ case 178: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_rt_sigsuspend */ case 179: if (ndx == 0 || ndx == 1) Modified: head/sys/i386/linux/linux_proto.h ============================================================================== --- head/sys/i386/linux/linux_proto.h Sun May 24 15:11:32 2015 (r283396) +++ head/sys/i386/linux/linux_proto.h Sun May 24 15:12:38 2015 (r283397) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283394 2015-05-24 15:06:39Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283396 2015-05-24 15:11:32Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -575,7 +575,9 @@ struct linux_rt_sigtimedwait_args { char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)]; }; struct linux_rt_sigqueueinfo_args { - register_t dummy; + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)]; + char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)]; }; struct linux_rt_sigsuspend_args { char newset_l_[PADL_(l_sigset_t *)]; l_sigset_t * newset; char newset_r_[PADR_(l_sigset_t *)]; Modified: head/sys/i386/linux/linux_syscall.h ============================================================================== --- head/sys/i386/linux/linux_syscall.h Sun May 24 15:11:32 2015 (r283396) +++ head/sys/i386/linux/linux_syscall.h Sun May 24 15:12:38 2015 (r283397) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283394 2015-05-24 15:06:39Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283396 2015-05-24 15:11:32Z dchagin */ #define LINUX_SYS_linux_exit 1 Modified: head/sys/i386/linux/linux_syscalls.c ============================================================================== --- head/sys/i386/linux/linux_syscalls.c Sun May 24 15:11:32 2015 (r283396) +++ head/sys/i386/linux/linux_syscalls.c Sun May 24 15:12:38 2015 (r283397) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283394 2015-05-24 15:06:39Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283396 2015-05-24 15:11:32Z dchagin */ const char *linux_syscallnames[] = { Modified: head/sys/i386/linux/linux_sysent.c ============================================================================== --- head/sys/i386/linux/linux_sysent.c Sun May 24 15:11:32 2015 (r283396) +++ head/sys/i386/linux/linux_sysent.c Sun May 24 15:12:38 2015 (r283397) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283394 2015-05-24 15:06:39Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283396 2015-05-24 15:11:32Z dchagin */ #include @@ -196,7 +196,7 @@ struct sysent linux_sysent[] = { { AS(linux_rt_sigprocmask_args), (sy_call_t *)linux_rt_sigprocmask, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 175 = linux_rt_sigprocmask */ { AS(linux_rt_sigpending_args), (sy_call_t *)linux_rt_sigpending, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 176 = linux_rt_sigpending */ { AS(linux_rt_sigtimedwait_args), (sy_call_t *)linux_rt_sigtimedwait, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 177 = linux_rt_sigtimedwait */ - { 0, (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 178 = linux_rt_sigqueueinfo */ + { AS(linux_rt_sigqueueinfo_args), (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 178 = linux_rt_sigqueueinfo */ { AS(linux_rt_sigsuspend_args), (sy_call_t *)linux_rt_sigsuspend, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 179 = linux_rt_sigsuspend */ { AS(linux_pread_args), (sy_call_t *)linux_pread, AUE_PREAD, NULL, 0, 0, 0, SY_THR_STATIC }, /* 180 = linux_pread */ { AS(linux_pwrite_args), (sy_call_t *)linux_pwrite, AUE_PWRITE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 181 = linux_pwrite */ Modified: head/sys/i386/linux/linux_systrace_args.c ============================================================================== --- head/sys/i386/linux/linux_systrace_args.c Sun May 24 15:11:32 2015 (r283396) +++ head/sys/i386/linux/linux_systrace_args.c Sun May 24 15:12:38 2015 (r283397) @@ -1277,7 +1277,11 @@ systrace_args(int sysnum, void *params, } /* linux_rt_sigqueueinfo */ case 178: { - *n_args = 0; + struct linux_rt_sigqueueinfo_args *p = params; + iarg[0] = p->pid; /* l_pid_t */ + iarg[1] = p->sig; /* l_int */ + uarg[2] = (intptr_t) p->info; /* l_siginfo_t * */ + *n_args = 3; break; } /* linux_rt_sigsuspend */ @@ -4304,6 +4308,19 @@ systrace_entry_setargdesc(int sysnum, in break; /* linux_rt_sigqueueinfo */ case 178: + switch(ndx) { + case 0: + p = "l_pid_t"; + break; + case 1: + p = "l_int"; + break; + case 2: + p = "l_siginfo_t *"; + break; + default: + break; + }; break; /* linux_rt_sigsuspend */ case 179: @@ -6500,6 +6517,9 @@ systrace_return_setargdesc(int sysnum, i break; /* linux_rt_sigqueueinfo */ case 178: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_rt_sigsuspend */ case 179: if (ndx == 0 || ndx == 1) From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:13:57 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1AD61606; Sun, 24 May 2015 15:13:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 084C51B6D; Sun, 24 May 2015 15:13:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OFDuus045368; Sun, 24 May 2015 15:13:56 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OFDu5X045367; Sun, 24 May 2015 15:13:56 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241513.t4OFDu5X045367@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:13:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283398 - 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-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:13:57 -0000 Author: dchagin Date: Sun May 24 15:13:56 2015 New Revision: 283398 URL: https://svnweb.freebsd.org/changeset/base/283398 Log: Sched_rr_get_interval returns EINVAL in case when the invalid pid specified. This silence the ltp tests. Differential Revision: https://reviews.freebsd.org/D1048 Reviewed by: trasz Modified: head/sys/compat/linux/linux_misc.c Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun May 24 15:12:38 2015 (r283397) +++ head/sys/compat/linux/linux_misc.c Sun May 24 15:13:56 2015 (r283398) @@ -2043,6 +2043,13 @@ linux_sched_rr_get_interval(struct threa struct thread *tdt; int error; + /* + * According to man in case the invalid pid specified + * EINVAL should be returned. + */ + if (uap->pid < 0) + return (EINVAL); + tdt = linux_tdfind(td, uap->pid, -1); if (tdt == NULL) return (ESRCH); From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:14:53 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B4A7E759; Sun, 24 May 2015 15:14:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 A1F391B7E; Sun, 24 May 2015 15:14:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OFErQr045559; Sun, 24 May 2015 15:14:53 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OFEqs5045553; Sun, 24 May 2015 15:14:52 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241514.t4OFEqs5045553@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:14:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283399 - in head/sys: amd64/linux32 compat/linux i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:14:53 -0000 Author: dchagin Date: Sun May 24 15:14:51 2015 New Revision: 283399 URL: https://svnweb.freebsd.org/changeset/base/283399 Log: Implement dup3() system call. Differential Revision: https://reviews.freebsd.org/D1049 Reviewed by: emaste Modified: head/sys/amd64/linux32/linux32_dummy.c head/sys/amd64/linux32/syscalls.master head/sys/compat/linux/linux_file.c head/sys/i386/linux/linux_dummy.c head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- head/sys/amd64/linux32/linux32_dummy.c Sun May 24 15:13:56 2015 (r283398) +++ head/sys/amd64/linux32/linux32_dummy.c Sun May 24 15:14:51 2015 (r283399) @@ -122,7 +122,6 @@ DUMMY(timerfd_gettime); DUMMY(signalfd4); DUMMY(eventfd2); DUMMY(epoll_create1); -DUMMY(dup3); DUMMY(inotify_init1); /* linux 2.6.30: */ DUMMY(preadv); Modified: head/sys/amd64/linux32/syscalls.master ============================================================================== --- head/sys/amd64/linux32/syscalls.master Sun May 24 15:13:56 2015 (r283398) +++ head/sys/amd64/linux32/syscalls.master Sun May 24 15:14:51 2015 (r283399) @@ -539,7 +539,8 @@ 327 AUE_NULL STD { int linux_signalfd4(void); } 328 AUE_NULL STD { int linux_eventfd2(void); } 329 AUE_NULL STD { int linux_epoll_create1(void); } -330 AUE_NULL STD { int linux_dup3(void); } +330 AUE_NULL STD { int linux_dup3(l_int oldfd, \ + l_int newfd, l_int flags); } 331 AUE_NULL STD { int linux_pipe2(l_int *pipefds, l_int flags); } 332 AUE_NULL STD { int linux_inotify_init1(void); } ; linux 2.6.30: Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Sun May 24 15:13:56 2015 (r283398) +++ head/sys/compat/linux/linux_file.c Sun May 24 15:14:51 2015 (r283399) @@ -1608,3 +1608,22 @@ linux_pipe2(struct thread *td, struct li /* XXX: Close descriptors on error. */ return (copyout(fildes, args->pipefds, sizeof(fildes))); } + +int +linux_dup3(struct thread *td, struct linux_dup3_args *args) +{ + int cmd; + intptr_t newfd; + + if (args->oldfd == args->newfd) + return (EINVAL); + if ((args->flags & ~LINUX_O_CLOEXEC) != 0) + return (EINVAL); + if (args->flags & LINUX_O_CLOEXEC) + cmd = F_DUP2FD_CLOEXEC; + else + cmd = F_DUP2FD; + + newfd = args->newfd; + return (kern_fcntl(td, args->oldfd, cmd, newfd)); +} Modified: head/sys/i386/linux/linux_dummy.c ============================================================================== --- head/sys/i386/linux/linux_dummy.c Sun May 24 15:13:56 2015 (r283398) +++ head/sys/i386/linux/linux_dummy.c Sun May 24 15:14:51 2015 (r283399) @@ -118,7 +118,6 @@ DUMMY(timerfd_gettime); DUMMY(signalfd4); DUMMY(eventfd2); DUMMY(epoll_create1); -DUMMY(dup3); DUMMY(inotify_init1); /* linux 2.6.30: */ DUMMY(preadv); Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Sun May 24 15:13:56 2015 (r283398) +++ head/sys/i386/linux/syscalls.master Sun May 24 15:14:51 2015 (r283399) @@ -547,7 +547,8 @@ 327 AUE_NULL STD { int linux_signalfd4(void); } 328 AUE_NULL STD { int linux_eventfd2(void); } 329 AUE_NULL STD { int linux_epoll_create1(void); } -330 AUE_NULL STD { int linux_dup3(void); } +330 AUE_NULL STD { int linux_dup3(l_int oldfd, \ + l_int newfd, l_int flags); } 331 AUE_NULL STD { int linux_pipe2(l_int *pipefds, l_int flags); } 332 AUE_NULL STD { int linux_inotify_init1(void); } ; linux 2.6.30: From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:15:49 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C933A8B6; Sun, 24 May 2015 15:15:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 A55471B93; Sun, 24 May 2015 15:15:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OFFnIu045797; Sun, 24 May 2015 15:15:49 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OFFkCu045782; Sun, 24 May 2015 15:15:46 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241515.t4OFFkCu045782@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:15:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283400 - in head/sys: amd64/linux32 i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:15:49 -0000 Author: dchagin Date: Sun May 24 15:15:46 2015 New Revision: 283400 URL: https://svnweb.freebsd.org/changeset/base/283400 Log: Regen for r283399. Modified: head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_syscall.h head/sys/amd64/linux32/linux32_syscalls.c head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux32/linux32_proto.h ============================================================================== --- head/sys/amd64/linux32/linux32_proto.h Sun May 24 15:14:51 2015 (r283399) +++ head/sys/amd64/linux32/linux32_proto.h Sun May 24 15:15:46 2015 (r283400) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283396 2015-05-24 15:11:32Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283399 2015-05-24 15:14:51Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -1064,7 +1064,9 @@ struct linux_epoll_create1_args { register_t dummy; }; struct linux_dup3_args { - register_t dummy; + char oldfd_l_[PADL_(l_int)]; l_int oldfd; char oldfd_r_[PADR_(l_int)]; + char newfd_l_[PADL_(l_int)]; l_int newfd; char newfd_r_[PADR_(l_int)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_pipe2_args { char pipefds_l_[PADL_(l_int *)]; l_int * pipefds; char pipefds_r_[PADR_(l_int *)]; Modified: head/sys/amd64/linux32/linux32_syscall.h ============================================================================== --- head/sys/amd64/linux32/linux32_syscall.h Sun May 24 15:14:51 2015 (r283399) +++ head/sys/amd64/linux32/linux32_syscall.h Sun May 24 15:15:46 2015 (r283400) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283396 2015-05-24 15:11:32Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283399 2015-05-24 15:14:51Z dchagin */ #define LINUX_SYS_linux_exit 1 Modified: head/sys/amd64/linux32/linux32_syscalls.c ============================================================================== --- head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 15:14:51 2015 (r283399) +++ head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 15:15:46 2015 (r283400) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283396 2015-05-24 15:11:32Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283399 2015-05-24 15:14:51Z dchagin */ const char *linux_syscallnames[] = { Modified: head/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysent.c Sun May 24 15:14:51 2015 (r283399) +++ head/sys/amd64/linux32/linux32_sysent.c Sun May 24 15:15:46 2015 (r283400) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283396 2015-05-24 15:11:32Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283399 2015-05-24 15:14:51Z dchagin */ #include "opt_compat.h" @@ -349,7 +349,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)linux_signalfd4, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 327 = linux_signalfd4 */ { 0, (sy_call_t *)linux_eventfd2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 328 = linux_eventfd2 */ { 0, (sy_call_t *)linux_epoll_create1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 329 = linux_epoll_create1 */ - { 0, (sy_call_t *)linux_dup3, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 330 = linux_dup3 */ + { AS(linux_dup3_args), (sy_call_t *)linux_dup3, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 330 = linux_dup3 */ { AS(linux_pipe2_args), (sy_call_t *)linux_pipe2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 331 = linux_pipe2 */ { 0, (sy_call_t *)linux_inotify_init1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 332 = linux_inotify_init1 */ { 0, (sy_call_t *)linux_preadv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 333 = linux_preadv */ Modified: head/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 15:14:51 2015 (r283399) +++ head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 15:15:46 2015 (r283400) @@ -2190,7 +2190,11 @@ systrace_args(int sysnum, void *params, } /* linux_dup3 */ case 330: { - *n_args = 0; + struct linux_dup3_args *p = params; + iarg[0] = p->oldfd; /* l_int */ + iarg[1] = p->newfd; /* l_int */ + iarg[2] = p->flags; /* l_int */ + *n_args = 3; break; } /* linux_pipe2 */ @@ -5467,6 +5471,19 @@ systrace_entry_setargdesc(int sysnum, in break; /* linux_dup3 */ case 330: + switch(ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "l_int"; + break; + case 2: + p = "l_int"; + break; + default: + break; + }; break; /* linux_pipe2 */ case 331: @@ -6752,6 +6769,9 @@ systrace_return_setargdesc(int sysnum, i case 329: /* linux_dup3 */ case 330: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_pipe2 */ case 331: if (ndx == 0 || ndx == 1) Modified: head/sys/i386/linux/linux_proto.h ============================================================================== --- head/sys/i386/linux/linux_proto.h Sun May 24 15:14:51 2015 (r283399) +++ head/sys/i386/linux/linux_proto.h Sun May 24 15:15:46 2015 (r283400) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283396 2015-05-24 15:11:32Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283399 2015-05-24 15:14:51Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -1082,7 +1082,9 @@ struct linux_epoll_create1_args { register_t dummy; }; struct linux_dup3_args { - register_t dummy; + char oldfd_l_[PADL_(l_int)]; l_int oldfd; char oldfd_r_[PADR_(l_int)]; + char newfd_l_[PADL_(l_int)]; l_int newfd; char newfd_r_[PADR_(l_int)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_pipe2_args { char pipefds_l_[PADL_(l_int *)]; l_int * pipefds; char pipefds_r_[PADR_(l_int *)]; Modified: head/sys/i386/linux/linux_syscall.h ============================================================================== --- head/sys/i386/linux/linux_syscall.h Sun May 24 15:14:51 2015 (r283399) +++ head/sys/i386/linux/linux_syscall.h Sun May 24 15:15:46 2015 (r283400) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283396 2015-05-24 15:11:32Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283399 2015-05-24 15:14:51Z dchagin */ #define LINUX_SYS_linux_exit 1 Modified: head/sys/i386/linux/linux_syscalls.c ============================================================================== --- head/sys/i386/linux/linux_syscalls.c Sun May 24 15:14:51 2015 (r283399) +++ head/sys/i386/linux/linux_syscalls.c Sun May 24 15:15:46 2015 (r283400) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283396 2015-05-24 15:11:32Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283399 2015-05-24 15:14:51Z dchagin */ const char *linux_syscallnames[] = { Modified: head/sys/i386/linux/linux_sysent.c ============================================================================== --- head/sys/i386/linux/linux_sysent.c Sun May 24 15:14:51 2015 (r283399) +++ head/sys/i386/linux/linux_sysent.c Sun May 24 15:15:46 2015 (r283400) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283396 2015-05-24 15:11:32Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283399 2015-05-24 15:14:51Z dchagin */ #include @@ -348,7 +348,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)linux_signalfd4, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 327 = linux_signalfd4 */ { 0, (sy_call_t *)linux_eventfd2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 328 = linux_eventfd2 */ { 0, (sy_call_t *)linux_epoll_create1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 329 = linux_epoll_create1 */ - { 0, (sy_call_t *)linux_dup3, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 330 = linux_dup3 */ + { AS(linux_dup3_args), (sy_call_t *)linux_dup3, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 330 = linux_dup3 */ { AS(linux_pipe2_args), (sy_call_t *)linux_pipe2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 331 = linux_pipe2 */ { 0, (sy_call_t *)linux_inotify_init1, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 332 = linux_inotify_init1 */ { 0, (sy_call_t *)linux_preadv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 333 = linux_preadv */ Modified: head/sys/i386/linux/linux_systrace_args.c ============================================================================== --- head/sys/i386/linux/linux_systrace_args.c Sun May 24 15:14:51 2015 (r283399) +++ head/sys/i386/linux/linux_systrace_args.c Sun May 24 15:15:46 2015 (r283400) @@ -2266,7 +2266,11 @@ systrace_args(int sysnum, void *params, } /* linux_dup3 */ case 330: { - *n_args = 0; + struct linux_dup3_args *p = params; + iarg[0] = p->oldfd; /* l_int */ + iarg[1] = p->newfd; /* l_int */ + iarg[2] = p->flags; /* l_int */ + *n_args = 3; break; } /* linux_pipe2 */ @@ -5698,6 +5702,19 @@ systrace_entry_setargdesc(int sysnum, in break; /* linux_dup3 */ case 330: + switch(ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "l_int"; + break; + case 2: + p = "l_int"; + break; + default: + break; + }; break; /* linux_pipe2 */ case 331: @@ -7030,6 +7047,9 @@ systrace_return_setargdesc(int sysnum, i case 329: /* linux_dup3 */ case 330: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_pipe2 */ case 331: if (ndx == 0 || ndx == 1) From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:18:22 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0E088B00; Sun, 24 May 2015 15:18:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 E2F661BB3; Sun, 24 May 2015 15:18:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OFILnA046322; Sun, 24 May 2015 15:18:21 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OFIKeJ046306; Sun, 24 May 2015 15:18:20 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241518.t4OFIKeJ046306@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:18:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283401 - in head/sys: amd64/linux32 compat/linux i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:18:22 -0000 Author: dchagin Date: Sun May 24 15:18:19 2015 New Revision: 283401 URL: https://svnweb.freebsd.org/changeset/base/283401 Log: Implement prlimit64() system call. Differential Revision: https://reviews.freebsd.org/D1050 Reviewed by: emaste, trasz Modified: head/sys/amd64/linux32/linux32_dummy.c head/sys/amd64/linux32/syscalls.master head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h head/sys/i386/linux/linux_dummy.c head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- head/sys/amd64/linux32/linux32_dummy.c Sun May 24 15:15:46 2015 (r283400) +++ head/sys/amd64/linux32/linux32_dummy.c Sun May 24 15:18:19 2015 (r283401) @@ -133,8 +133,6 @@ DUMMY(perf_event_open); DUMMY(recvmmsg); DUMMY(fanotify_init); DUMMY(fanotify_mark); -/* linux 2.6.36: */ -DUMMY(prlimit64); /* later: */ DUMMY(name_to_handle_at); DUMMY(open_by_handle_at); Modified: head/sys/amd64/linux32/syscalls.master ============================================================================== --- head/sys/amd64/linux32/syscalls.master Sun May 24 15:15:46 2015 (r283400) +++ head/sys/amd64/linux32/syscalls.master Sun May 24 15:18:19 2015 (r283401) @@ -554,7 +554,10 @@ 338 AUE_NULL STD { int linux_fanotify_init(void); } 339 AUE_NULL STD { int linux_fanotify_mark(void); } ; linux 2.6.36: -340 AUE_NULL STD { int linux_prlimit64(void); } +340 AUE_NULL STD { int linux_prlimit64(l_pid_t pid, \ + l_uint resource, \ + struct rlimit *new, \ + struct rlimit *old); } ; later: 341 AUE_NULL STD { int linux_name_to_handle_at(void); } 342 AUE_NULL STD { int linux_open_by_handle_at(void); } Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun May 24 15:15:46 2015 (r283400) +++ head/sys/compat/linux/linux_misc.c Sun May 24 15:18:19 2015 (r283401) @@ -2034,6 +2034,79 @@ linux_sched_setaffinity(struct thread *t return (sys_cpuset_setaffinity(td, &csa)); } +struct linux_rlimit64 { + uint64_t rlim_cur; + uint64_t rlim_max; +}; + +int +linux_prlimit64(struct thread *td, struct linux_prlimit64_args *args) +{ + struct rlimit rlim, nrlim; + struct linux_rlimit64 lrlim; + struct proc *p; + u_int which; + int flags; + int error; + +#ifdef DEBUG + if (ldebug(prlimit64)) + printf(ARGS(prlimit64, "%d, %d, %p, %p"), args->pid, + args->resource, (void *)args->new, (void *)args->old); +#endif + + if (args->resource >= LINUX_RLIM_NLIMITS) + return (EINVAL); + + which = linux_to_bsd_resource[args->resource]; + if (which == -1) + return (EINVAL); + + if (args->new != NULL) { + /* + * Note. Unlike FreeBSD where rlim is signed 64-bit Linux + * rlim is unsigned 64-bit. FreeBSD treats negative limits + * as INFINITY so we do not need a conversion even. + */ + error = copyin(args->new, &nrlim, sizeof(nrlim)); + if (error != 0) + return (error); + } + + flags = PGET_HOLD | PGET_NOTWEXIT; + if (args->new != NULL) + flags |= PGET_CANDEBUG; + else + flags |= PGET_CANSEE; + error = pget(args->pid, flags, &p); + if (error != 0) + return (error); + + if (args->old != NULL) { + PROC_LOCK(p); + lim_rlimit(p, which, &rlim); + PROC_UNLOCK(p); + if (rlim.rlim_cur == RLIM_INFINITY) + lrlim.rlim_cur = LINUX_RLIM_INFINITY; + else + lrlim.rlim_cur = rlim.rlim_cur; + if (rlim.rlim_max == RLIM_INFINITY) + lrlim.rlim_max = LINUX_RLIM_INFINITY; + else + lrlim.rlim_max = rlim.rlim_max; + error = copyout(&lrlim, args->old, sizeof(lrlim)); + if (error != 0) + goto out; + } + + if (args->new != NULL) + error = kern_proc_setrlimit(td, p, which, &nrlim); + + out: + PRELE(p); + return (error); +} + int linux_sched_rr_get_interval(struct thread *td, struct linux_sched_rr_get_interval_args *uap) Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Sun May 24 15:15:46 2015 (r283400) +++ head/sys/compat/linux/linux_misc.h Sun May 24 15:18:19 2015 (r283401) @@ -130,6 +130,7 @@ extern int stclohz; #define LINUX_P_PID 1 #define LINUX_P_PGID 2 +#define LINUX_RLIM_INFINITY (~0UL) int linux_common_wait(struct thread *td, int pid, int *status, int options, struct rusage *ru); Modified: head/sys/i386/linux/linux_dummy.c ============================================================================== --- head/sys/i386/linux/linux_dummy.c Sun May 24 15:15:46 2015 (r283400) +++ head/sys/i386/linux/linux_dummy.c Sun May 24 15:18:19 2015 (r283401) @@ -129,8 +129,6 @@ DUMMY(perf_event_open); DUMMY(recvmmsg); DUMMY(fanotify_init); DUMMY(fanotify_mark); -/* linux 2.6.36: */ -DUMMY(prlimit64); /* later: */ DUMMY(name_to_handle_at); DUMMY(open_by_handle_at); Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Sun May 24 15:15:46 2015 (r283400) +++ head/sys/i386/linux/syscalls.master Sun May 24 15:18:19 2015 (r283401) @@ -562,7 +562,10 @@ 338 AUE_NULL STD { int linux_fanotify_init(void); } 339 AUE_NULL STD { int linux_fanotify_mark(void); } ; linux 2.6.36: -340 AUE_NULL STD { int linux_prlimit64(void); } +340 AUE_NULL STD { int linux_prlimit64(l_pid_t pid, \ + l_uint resource, \ + struct rlimit *new, \ + struct rlimit *old); } ; later: 341 AUE_NULL STD { int linux_name_to_handle_at(void); } 342 AUE_NULL STD { int linux_open_by_handle_at(void); } From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:19:48 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C3A9C72; Sun, 24 May 2015 15:19:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 6D3F01BCD; Sun, 24 May 2015 15:19:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OFJmYu046553; Sun, 24 May 2015 15:19:48 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OFJjbS046543; Sun, 24 May 2015 15:19:45 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241519.t4OFJjbS046543@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:19:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283402 - in head/sys: amd64/linux32 i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:19:48 -0000 Author: dchagin Date: Sun May 24 15:19:44 2015 New Revision: 283402 URL: https://svnweb.freebsd.org/changeset/base/283402 Log: Regen for r283401. Modified: head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_syscall.h head/sys/amd64/linux32/linux32_syscalls.c head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux32/linux32_proto.h ============================================================================== --- head/sys/amd64/linux32/linux32_proto.h Sun May 24 15:18:19 2015 (r283401) +++ head/sys/amd64/linux32/linux32_proto.h Sun May 24 15:19:44 2015 (r283402) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283399 2015-05-24 15:14:51Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283401 2015-05-24 15:18:19Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -1097,7 +1097,10 @@ struct linux_fanotify_mark_args { register_t dummy; }; struct linux_prlimit64_args { - register_t dummy; + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char resource_l_[PADL_(l_uint)]; l_uint resource; char resource_r_[PADR_(l_uint)]; + char new_l_[PADL_(struct rlimit *)]; struct rlimit * new; char new_r_[PADR_(struct rlimit *)]; + char old_l_[PADL_(struct rlimit *)]; struct rlimit * old; char old_r_[PADR_(struct rlimit *)]; }; struct linux_name_to_handle_at_args { register_t dummy; Modified: head/sys/amd64/linux32/linux32_syscall.h ============================================================================== --- head/sys/amd64/linux32/linux32_syscall.h Sun May 24 15:18:19 2015 (r283401) +++ head/sys/amd64/linux32/linux32_syscall.h Sun May 24 15:19:44 2015 (r283402) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283399 2015-05-24 15:14:51Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283401 2015-05-24 15:18:19Z dchagin */ #define LINUX_SYS_linux_exit 1 Modified: head/sys/amd64/linux32/linux32_syscalls.c ============================================================================== --- head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 15:18:19 2015 (r283401) +++ head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 15:19:44 2015 (r283402) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283399 2015-05-24 15:14:51Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283401 2015-05-24 15:18:19Z dchagin */ const char *linux_syscallnames[] = { Modified: head/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysent.c Sun May 24 15:18:19 2015 (r283401) +++ head/sys/amd64/linux32/linux32_sysent.c Sun May 24 15:19:44 2015 (r283402) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283399 2015-05-24 15:14:51Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283401 2015-05-24 15:18:19Z dchagin */ #include "opt_compat.h" @@ -359,7 +359,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)linux_recvmmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 337 = linux_recvmmsg */ { 0, (sy_call_t *)linux_fanotify_init, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 338 = linux_fanotify_init */ { 0, (sy_call_t *)linux_fanotify_mark, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 339 = linux_fanotify_mark */ - { 0, (sy_call_t *)linux_prlimit64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 340 = linux_prlimit64 */ + { AS(linux_prlimit64_args), (sy_call_t *)linux_prlimit64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 340 = linux_prlimit64 */ { 0, (sy_call_t *)linux_name_to_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 341 = linux_name_to_handle_at */ { 0, (sy_call_t *)linux_open_by_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 342 = linux_open_by_handle_at */ { 0, (sy_call_t *)linux_clock_adjtime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 343 = linux_clock_adjtime */ Modified: head/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 15:18:19 2015 (r283401) +++ head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 15:19:44 2015 (r283402) @@ -2247,7 +2247,12 @@ systrace_args(int sysnum, void *params, } /* linux_prlimit64 */ case 340: { - *n_args = 0; + struct linux_prlimit64_args *p = params; + iarg[0] = p->pid; /* l_pid_t */ + iarg[1] = p->resource; /* l_uint */ + uarg[2] = (intptr_t) p->new; /* struct rlimit * */ + uarg[3] = (intptr_t) p->old; /* struct rlimit * */ + *n_args = 4; break; } /* linux_name_to_handle_at */ @@ -5524,6 +5529,22 @@ systrace_entry_setargdesc(int sysnum, in break; /* linux_prlimit64 */ case 340: + switch(ndx) { + case 0: + p = "l_pid_t"; + break; + case 1: + p = "l_uint"; + break; + case 2: + p = "struct rlimit *"; + break; + case 3: + p = "struct rlimit *"; + break; + default: + break; + }; break; /* linux_name_to_handle_at */ case 341: @@ -6795,6 +6816,9 @@ systrace_return_setargdesc(int sysnum, i case 339: /* linux_prlimit64 */ case 340: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_name_to_handle_at */ case 341: /* linux_open_by_handle_at */ Modified: head/sys/i386/linux/linux_proto.h ============================================================================== --- head/sys/i386/linux/linux_proto.h Sun May 24 15:18:19 2015 (r283401) +++ head/sys/i386/linux/linux_proto.h Sun May 24 15:19:44 2015 (r283402) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283399 2015-05-24 15:14:51Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283401 2015-05-24 15:18:19Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -1115,7 +1115,10 @@ struct linux_fanotify_mark_args { register_t dummy; }; struct linux_prlimit64_args { - register_t dummy; + char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; + char resource_l_[PADL_(l_uint)]; l_uint resource; char resource_r_[PADR_(l_uint)]; + char new_l_[PADL_(struct rlimit *)]; struct rlimit * new; char new_r_[PADR_(struct rlimit *)]; + char old_l_[PADL_(struct rlimit *)]; struct rlimit * old; char old_r_[PADR_(struct rlimit *)]; }; struct linux_name_to_handle_at_args { register_t dummy; Modified: head/sys/i386/linux/linux_syscall.h ============================================================================== --- head/sys/i386/linux/linux_syscall.h Sun May 24 15:18:19 2015 (r283401) +++ head/sys/i386/linux/linux_syscall.h Sun May 24 15:19:44 2015 (r283402) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283399 2015-05-24 15:14:51Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283401 2015-05-24 15:18:19Z dchagin */ #define LINUX_SYS_linux_exit 1 Modified: head/sys/i386/linux/linux_syscalls.c ============================================================================== --- head/sys/i386/linux/linux_syscalls.c Sun May 24 15:18:19 2015 (r283401) +++ head/sys/i386/linux/linux_syscalls.c Sun May 24 15:19:44 2015 (r283402) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283399 2015-05-24 15:14:51Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283401 2015-05-24 15:18:19Z dchagin */ const char *linux_syscallnames[] = { Modified: head/sys/i386/linux/linux_sysent.c ============================================================================== --- head/sys/i386/linux/linux_sysent.c Sun May 24 15:18:19 2015 (r283401) +++ head/sys/i386/linux/linux_sysent.c Sun May 24 15:19:44 2015 (r283402) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283399 2015-05-24 15:14:51Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283401 2015-05-24 15:18:19Z dchagin */ #include @@ -358,7 +358,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)linux_recvmmsg, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 337 = linux_recvmmsg */ { 0, (sy_call_t *)linux_fanotify_init, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 338 = linux_fanotify_init */ { 0, (sy_call_t *)linux_fanotify_mark, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 339 = linux_fanotify_mark */ - { 0, (sy_call_t *)linux_prlimit64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 340 = linux_prlimit64 */ + { AS(linux_prlimit64_args), (sy_call_t *)linux_prlimit64, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 340 = linux_prlimit64 */ { 0, (sy_call_t *)linux_name_to_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 341 = linux_name_to_handle_at */ { 0, (sy_call_t *)linux_open_by_handle_at, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 342 = linux_open_by_handle_at */ { 0, (sy_call_t *)linux_clock_adjtime, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 343 = linux_clock_adjtime */ Modified: head/sys/i386/linux/linux_systrace_args.c ============================================================================== --- head/sys/i386/linux/linux_systrace_args.c Sun May 24 15:18:19 2015 (r283401) +++ head/sys/i386/linux/linux_systrace_args.c Sun May 24 15:19:44 2015 (r283402) @@ -2323,7 +2323,12 @@ systrace_args(int sysnum, void *params, } /* linux_prlimit64 */ case 340: { - *n_args = 0; + struct linux_prlimit64_args *p = params; + iarg[0] = p->pid; /* l_pid_t */ + iarg[1] = p->resource; /* l_uint */ + uarg[2] = (intptr_t) p->new; /* struct rlimit * */ + uarg[3] = (intptr_t) p->old; /* struct rlimit * */ + *n_args = 4; break; } /* linux_name_to_handle_at */ @@ -5755,6 +5760,22 @@ systrace_entry_setargdesc(int sysnum, in break; /* linux_prlimit64 */ case 340: + switch(ndx) { + case 0: + p = "l_pid_t"; + break; + case 1: + p = "l_uint"; + break; + case 2: + p = "struct rlimit *"; + break; + case 3: + p = "struct rlimit *"; + break; + default: + break; + }; break; /* linux_name_to_handle_at */ case 341: @@ -7073,6 +7094,9 @@ systrace_return_setargdesc(int sysnum, i case 339: /* linux_prlimit64 */ case 340: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_name_to_handle_at */ case 341: /* linux_open_by_handle_at */ From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:21:27 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 97443FED; Sun, 24 May 2015 15:21:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 788D81BFC; Sun, 24 May 2015 15:21:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OFLRAI049939; Sun, 24 May 2015 15:21:27 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OFLQMD049929; Sun, 24 May 2015 15:21:26 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241521.t4OFLQMD049929@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:21:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283403 - in head/sys: amd64/linux32 compat/linux i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:21:27 -0000 Author: dchagin Date: Sun May 24 15:21:25 2015 New Revision: 283403 URL: https://svnweb.freebsd.org/changeset/base/283403 Log: Implement pselect6() system call. Differential Revision: https://reviews.freebsd.org/D1051 Reviewed by: trasz Modified: head/sys/amd64/linux32/linux32_dummy.c head/sys/amd64/linux32/syscalls.master head/sys/compat/linux/linux_misc.c head/sys/i386/linux/linux_dummy.c head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- head/sys/amd64/linux32/linux32_dummy.c Sun May 24 15:19:44 2015 (r283402) +++ head/sys/amd64/linux32/linux32_dummy.c Sun May 24 15:21:25 2015 (r283403) @@ -95,7 +95,6 @@ DUMMY(inotify_add_watch); DUMMY(inotify_rm_watch); /* linux 2.6.16: */ DUMMY(migrate_pages); -DUMMY(pselect6); DUMMY(ppoll); DUMMY(unshare); /* linux 2.6.17: */ Modified: head/sys/amd64/linux32/syscalls.master ============================================================================== --- head/sys/amd64/linux32/syscalls.master Sun May 24 15:19:44 2015 (r283402) +++ head/sys/amd64/linux32/syscalls.master Sun May 24 15:21:25 2015 (r283403) @@ -508,7 +508,9 @@ 306 AUE_FCHMODAT STD { int linux_fchmodat(l_int dfd, const char *filename, \ l_mode_t mode); } 307 AUE_FACCESSAT STD { int linux_faccessat(l_int dfd, const char *filename, l_int amode, int flag); } -308 AUE_NULL STD { int linux_pselect6(void); } +308 AUE_SELECT STD { int linux_pselect6(l_int nfds, l_fd_set *readfds, \ + l_fd_set *writefds, l_fd_set *exceptfds, \ + struct l_timespec *tsp, l_uintptr_t *sig); } 309 AUE_NULL STD { int linux_ppoll(void); } 310 AUE_NULL STD { int linux_unshare(void); } ; linux 2.6.17: Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun May 24 15:19:44 2015 (r283402) +++ head/sys/compat/linux/linux_misc.c Sun May 24 15:21:25 2015 (r283403) @@ -116,6 +116,12 @@ struct l_sysinfo { l_uint mem_unit; char _f[20-2*sizeof(l_long)-sizeof(l_int)]; /* padding */ }; + +struct l_pselect6arg { + l_uintptr_t ss; + l_size_t ss_len; +}; + int linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args) { @@ -2108,6 +2114,84 @@ linux_prlimit64(struct thread *td, struc } int +linux_pselect6(struct thread *td, struct linux_pselect6_args *args) +{ + struct timeval utv, tv0, tv1, *tvp; + struct l_pselect6arg lpse6; + struct l_timespec lts; + struct timespec uts; + l_sigset_t l_ss; + sigset_t *ssp; + sigset_t ss; + int error; + + ssp = NULL; + if (args->sig != NULL) { + error = copyin(args->sig, &lpse6, sizeof(lpse6)); + if (error != 0) + return (error); + if (lpse6.ss_len != sizeof(l_ss)) + return (EINVAL); + if (lpse6.ss != 0) { + error = copyin(PTRIN(lpse6.ss), &l_ss, + sizeof(l_ss)); + if (error != 0) + return (error); + linux_to_bsd_sigset(&l_ss, &ss); + ssp = &ss; + } + } + + /* + * Currently glibc changes nanosecond number to microsecond. + * This mean losing precision but for now it is hardly seen. + */ + if (args->tsp != NULL) { + error = copyin(args->tsp, <s, sizeof(lts)); + if (error != 0) + return (error); + uts.tv_sec = lts.tv_sec; + uts.tv_nsec = lts.tv_nsec; + + TIMESPEC_TO_TIMEVAL(&utv, &uts); + if (itimerfix(&utv)) + return (EINVAL); + + microtime(&tv0); + tvp = &utv; + } else + tvp = NULL; + + error = kern_pselect(td, args->nfds, args->readfds, args->writefds, + args->exceptfds, tvp, ssp, sizeof(l_int) * 8); + + if (error == 0 && args->tsp != NULL) { + if (td->td_retval[0] != 0) { + /* + * Compute how much time was left of the timeout, + * by subtracting the current time and the time + * before we started the call, and subtracting + * that result from the user-supplied value. + */ + + microtime(&tv1); + timevalsub(&tv1, &tv0); + timevalsub(&utv, &tv1); + if (utv.tv_sec < 0) + timevalclear(&utv); + } else + timevalclear(&utv); + + TIMEVAL_TO_TIMESPEC(&utv, &uts); + lts.tv_sec = uts.tv_sec; + lts.tv_nsec = uts.tv_nsec; + error = copyout(<s, args->tsp, sizeof(lts)); + } + + return (error); +} + +int linux_sched_rr_get_interval(struct thread *td, struct linux_sched_rr_get_interval_args *uap) { Modified: head/sys/i386/linux/linux_dummy.c ============================================================================== --- head/sys/i386/linux/linux_dummy.c Sun May 24 15:19:44 2015 (r283402) +++ head/sys/i386/linux/linux_dummy.c Sun May 24 15:21:25 2015 (r283403) @@ -91,7 +91,6 @@ DUMMY(inotify_add_watch); DUMMY(inotify_rm_watch); /* linux 2.6.16: */ DUMMY(migrate_pages); -DUMMY(pselect6); DUMMY(ppoll); DUMMY(unshare); /* linux 2.6.17: */ Modified: head/sys/i386/linux/syscalls.master ============================================================================== --- head/sys/i386/linux/syscalls.master Sun May 24 15:19:44 2015 (r283402) +++ head/sys/i386/linux/syscalls.master Sun May 24 15:21:25 2015 (r283403) @@ -516,7 +516,9 @@ 306 AUE_FCHMODAT STD { int linux_fchmodat(l_int dfd, const char *filename, \ l_mode_t mode); } 307 AUE_FACCESSAT STD { int linux_faccessat(l_int dfd, const char *filename, l_int amode, l_int flag); } -308 AUE_NULL STD { int linux_pselect6(void); } +308 AUE_SELECT STD { int linux_pselect6(l_int nfds, l_fd_set *readfds, \ + l_fd_set *writefds, l_fd_set *exceptfds, \ + struct l_timespec *tsp, l_uintptr_t *sig); } 309 AUE_NULL STD { int linux_ppoll(void); } 310 AUE_NULL STD { int linux_unshare(void); } ; linux 2.6.17: From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:21:49 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A526F1CC; Sun, 24 May 2015 15:21:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 92FB41CAD; Sun, 24 May 2015 15:21:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OFLntS050530; Sun, 24 May 2015 15:21:49 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OFLmgC050522; Sun, 24 May 2015 15:21:48 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201505241521.t4OFLmgC050522@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 24 May 2015 15:21:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283404 - stable/10/sys/arm/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:21:49 -0000 Author: ian Date: Sun May 24 15:21:47 2015 New Revision: 283404 URL: https://svnweb.freebsd.org/changeset/base/283404 Log: MFC r279850: Remove MODULES_OVERRIDE="" for Marvel-based armv5 systems. Also add some #NO_UNIVERSE to configs that essentially duplicate DB-88F6XXX. Modified: stable/10/sys/arm/conf/DB-78XXX stable/10/sys/arm/conf/DB-88F5XXX stable/10/sys/arm/conf/DB-88F6XXX stable/10/sys/arm/conf/DOCKSTAR stable/10/sys/arm/conf/DREAMPLUG-1001 stable/10/sys/arm/conf/SHEEVAPLUG Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/conf/DB-78XXX ============================================================================== --- stable/10/sys/arm/conf/DB-78XXX Sun May 24 15:21:25 2015 (r283403) +++ stable/10/sys/arm/conf/DB-78XXX Sun May 24 15:21:47 2015 (r283404) @@ -8,7 +8,6 @@ ident DB-88F78XX include "../mv/discovery/std.db78xxx" options SOC_MV_DISCOVERY -makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions WERROR="-Werror" Modified: stable/10/sys/arm/conf/DB-88F5XXX ============================================================================== --- stable/10/sys/arm/conf/DB-88F5XXX Sun May 24 15:21:25 2015 (r283403) +++ stable/10/sys/arm/conf/DB-88F5XXX Sun May 24 15:21:47 2015 (r283404) @@ -8,7 +8,6 @@ ident DB-88F5XXX include "../mv/orion/std.db88f5xxx" options SOC_MV_ORION -makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions WERROR="-Werror" Modified: stable/10/sys/arm/conf/DB-88F6XXX ============================================================================== --- stable/10/sys/arm/conf/DB-88F6XXX Sun May 24 15:21:25 2015 (r283403) +++ stable/10/sys/arm/conf/DB-88F6XXX Sun May 24 15:21:47 2015 (r283404) @@ -8,7 +8,6 @@ ident DB-88F6XXX include "../mv/kirkwood/std.db88f6xxx" options SOC_MV_KIRKWOOD -makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions WERROR="-Werror" Modified: stable/10/sys/arm/conf/DOCKSTAR ============================================================================== --- stable/10/sys/arm/conf/DOCKSTAR Sun May 24 15:21:25 2015 (r283403) +++ stable/10/sys/arm/conf/DOCKSTAR Sun May 24 15:21:47 2015 (r283404) @@ -17,6 +17,7 @@ # # $FreeBSD$ # +#NO_UNIVERSE ident DOCKSTAR @@ -24,8 +25,6 @@ include "../mv/kirkwood/std.db88f6xxx" makeoptions FDT_DTS_FILE=dockstar.dts -makeoptions MODULES_OVERRIDE="" - options SOC_MV_KIRKWOOD options SCHED_4BSD # 4BSD scheduler Modified: stable/10/sys/arm/conf/DREAMPLUG-1001 ============================================================================== --- stable/10/sys/arm/conf/DREAMPLUG-1001 Sun May 24 15:21:25 2015 (r283403) +++ stable/10/sys/arm/conf/DREAMPLUG-1001 Sun May 24 15:21:47 2015 (r283404) @@ -20,6 +20,7 @@ # # $FreeBSD$ # +#NO_UNIVERSE ident DREAMPLUG-1001 @@ -27,8 +28,6 @@ include "../mv/kirkwood/std.db88f6xxx" makeoptions FDT_DTS_FILE=dreamplug-1001.dts -makeoptions MODULES_OVERRIDE="" - options SOC_MV_KIRKWOOD options SCHED_4BSD # 4BSD scheduler Modified: stable/10/sys/arm/conf/SHEEVAPLUG ============================================================================== --- stable/10/sys/arm/conf/SHEEVAPLUG Sun May 24 15:21:25 2015 (r283403) +++ stable/10/sys/arm/conf/SHEEVAPLUG Sun May 24 15:21:47 2015 (r283404) @@ -3,12 +3,12 @@ # # $FreeBSD$ # +#NO_UNIVERSE ident SHEEVAPLUG include "../mv/kirkwood/std.db88f6xxx" options SOC_MV_KIRKWOOD -makeoptions MODULES_OVERRIDE="" #makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols makeoptions WERROR="-Werror" From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:22:37 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F3BF732B; Sun, 24 May 2015 15:22:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 E07DB1CC2; Sun, 24 May 2015 15:22:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OFMaO7050781; Sun, 24 May 2015 15:22:36 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OFMYmM050757; Sun, 24 May 2015 15:22:34 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241522.t4OFMYmM050757@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:22:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283405 - in head/sys: amd64/linux32 i386/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:22:37 -0000 Author: dchagin Date: Sun May 24 15:22:33 2015 New Revision: 283405 URL: https://svnweb.freebsd.org/changeset/base/283405 Log: Regen for r283403. Modified: head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_syscall.h head/sys/amd64/linux32/linux32_syscalls.c head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux32/linux32_proto.h ============================================================================== --- head/sys/amd64/linux32/linux32_proto.h Sun May 24 15:21:47 2015 (r283404) +++ head/sys/amd64/linux32/linux32_proto.h Sun May 24 15:22:33 2015 (r283405) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283401 2015-05-24 15:18:19Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283403 2015-05-24 15:21:25Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -995,7 +995,12 @@ struct linux_faccessat_args { char flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)]; }; struct linux_pselect6_args { - register_t dummy; + char nfds_l_[PADL_(l_int)]; l_int nfds; char nfds_r_[PADR_(l_int)]; + char readfds_l_[PADL_(l_fd_set *)]; l_fd_set * readfds; char readfds_r_[PADR_(l_fd_set *)]; + char writefds_l_[PADL_(l_fd_set *)]; l_fd_set * writefds; char writefds_r_[PADR_(l_fd_set *)]; + char exceptfds_l_[PADL_(l_fd_set *)]; l_fd_set * exceptfds; char exceptfds_r_[PADR_(l_fd_set *)]; + char tsp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tsp; char tsp_r_[PADR_(struct l_timespec *)]; + char sig_l_[PADL_(l_uintptr_t *)]; l_uintptr_t * sig; char sig_r_[PADR_(l_uintptr_t *)]; }; struct linux_ppoll_args { register_t dummy; @@ -1668,7 +1673,7 @@ int linux_process_vm_writev(struct threa #define LINUX_SYS_AUE_linux_readlinkat AUE_READLINKAT #define LINUX_SYS_AUE_linux_fchmodat AUE_FCHMODAT #define LINUX_SYS_AUE_linux_faccessat AUE_FACCESSAT -#define LINUX_SYS_AUE_linux_pselect6 AUE_NULL +#define LINUX_SYS_AUE_linux_pselect6 AUE_SELECT #define LINUX_SYS_AUE_linux_ppoll AUE_NULL #define LINUX_SYS_AUE_linux_unshare AUE_NULL #define LINUX_SYS_AUE_linux_set_robust_list AUE_NULL Modified: head/sys/amd64/linux32/linux32_syscall.h ============================================================================== --- head/sys/amd64/linux32/linux32_syscall.h Sun May 24 15:21:47 2015 (r283404) +++ head/sys/amd64/linux32/linux32_syscall.h Sun May 24 15:22:33 2015 (r283405) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283401 2015-05-24 15:18:19Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283403 2015-05-24 15:21:25Z dchagin */ #define LINUX_SYS_linux_exit 1 Modified: head/sys/amd64/linux32/linux32_syscalls.c ============================================================================== --- head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 15:21:47 2015 (r283404) +++ head/sys/amd64/linux32/linux32_syscalls.c Sun May 24 15:22:33 2015 (r283405) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283401 2015-05-24 15:18:19Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283403 2015-05-24 15:21:25Z dchagin */ const char *linux_syscallnames[] = { Modified: head/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysent.c Sun May 24 15:21:47 2015 (r283404) +++ head/sys/amd64/linux32/linux32_sysent.c Sun May 24 15:22:33 2015 (r283405) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283401 2015-05-24 15:18:19Z dchagin + * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 283403 2015-05-24 15:21:25Z dchagin */ #include "opt_compat.h" @@ -327,7 +327,7 @@ struct sysent linux_sysent[] = { { AS(linux_readlinkat_args), (sy_call_t *)linux_readlinkat, AUE_READLINKAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 305 = linux_readlinkat */ { AS(linux_fchmodat_args), (sy_call_t *)linux_fchmodat, AUE_FCHMODAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 306 = linux_fchmodat */ { AS(linux_faccessat_args), (sy_call_t *)linux_faccessat, AUE_FACCESSAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 307 = linux_faccessat */ - { 0, (sy_call_t *)linux_pselect6, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 308 = linux_pselect6 */ + { AS(linux_pselect6_args), (sy_call_t *)linux_pselect6, AUE_SELECT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 308 = linux_pselect6 */ { 0, (sy_call_t *)linux_ppoll, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 309 = linux_ppoll */ { 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 310 = linux_unshare */ { AS(linux_set_robust_list_args), (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 311 = linux_set_robust_list */ Modified: head/sys/amd64/linux32/linux32_systrace_args.c ============================================================================== --- head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 15:21:47 2015 (r283404) +++ head/sys/amd64/linux32/linux32_systrace_args.c Sun May 24 15:22:33 2015 (r283405) @@ -2073,7 +2073,14 @@ systrace_args(int sysnum, void *params, } /* linux_pselect6 */ case 308: { - *n_args = 0; + struct linux_pselect6_args *p = params; + iarg[0] = p->nfds; /* l_int */ + uarg[1] = (intptr_t) p->readfds; /* l_fd_set * */ + uarg[2] = (intptr_t) p->writefds; /* l_fd_set * */ + uarg[3] = (intptr_t) p->exceptfds; /* l_fd_set * */ + uarg[4] = (intptr_t) p->tsp; /* struct l_timespec * */ + uarg[5] = (intptr_t) p->sig; /* l_uintptr_t * */ + *n_args = 6; break; } /* linux_ppoll */ @@ -5387,6 +5394,28 @@ systrace_entry_setargdesc(int sysnum, in break; /* linux_pselect6 */ case 308: + switch(ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "l_fd_set *"; + break; + case 2: + p = "l_fd_set *"; + break; + case 3: + p = "l_fd_set *"; + break; + case 4: + p = "struct l_timespec *"; + break; + case 5: + p = "l_uintptr_t *"; + break; + default: + break; + }; break; /* linux_ppoll */ case 309: @@ -6740,6 +6769,9 @@ systrace_return_setargdesc(int sysnum, i break; /* linux_pselect6 */ case 308: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_ppoll */ case 309: /* linux_unshare */ Modified: head/sys/i386/linux/linux_proto.h ============================================================================== --- head/sys/i386/linux/linux_proto.h Sun May 24 15:21:47 2015 (r283404) +++ head/sys/i386/linux/linux_proto.h Sun May 24 15:22:33 2015 (r283405) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283401 2015-05-24 15:18:19Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283403 2015-05-24 15:21:25Z dchagin */ #ifndef _LINUX_SYSPROTO_H_ @@ -1013,7 +1013,12 @@ struct linux_faccessat_args { char flag_l_[PADL_(l_int)]; l_int flag; char flag_r_[PADR_(l_int)]; }; struct linux_pselect6_args { - register_t dummy; + char nfds_l_[PADL_(l_int)]; l_int nfds; char nfds_r_[PADR_(l_int)]; + char readfds_l_[PADL_(l_fd_set *)]; l_fd_set * readfds; char readfds_r_[PADR_(l_fd_set *)]; + char writefds_l_[PADL_(l_fd_set *)]; l_fd_set * writefds; char writefds_r_[PADR_(l_fd_set *)]; + char exceptfds_l_[PADL_(l_fd_set *)]; l_fd_set * exceptfds; char exceptfds_r_[PADR_(l_fd_set *)]; + char tsp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tsp; char tsp_r_[PADR_(struct l_timespec *)]; + char sig_l_[PADL_(l_uintptr_t *)]; l_uintptr_t * sig; char sig_r_[PADR_(l_uintptr_t *)]; }; struct linux_ppoll_args { register_t dummy; @@ -1690,7 +1695,7 @@ int linux_process_vm_writev(struct threa #define LINUX_SYS_AUE_linux_readlinkat AUE_READLINKAT #define LINUX_SYS_AUE_linux_fchmodat AUE_FCHMODAT #define LINUX_SYS_AUE_linux_faccessat AUE_FACCESSAT -#define LINUX_SYS_AUE_linux_pselect6 AUE_NULL +#define LINUX_SYS_AUE_linux_pselect6 AUE_SELECT #define LINUX_SYS_AUE_linux_ppoll AUE_NULL #define LINUX_SYS_AUE_linux_unshare AUE_NULL #define LINUX_SYS_AUE_linux_set_robust_list AUE_NULL Modified: head/sys/i386/linux/linux_syscall.h ============================================================================== --- head/sys/i386/linux/linux_syscall.h Sun May 24 15:21:47 2015 (r283404) +++ head/sys/i386/linux/linux_syscall.h Sun May 24 15:22:33 2015 (r283405) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283401 2015-05-24 15:18:19Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283403 2015-05-24 15:21:25Z dchagin */ #define LINUX_SYS_linux_exit 1 Modified: head/sys/i386/linux/linux_syscalls.c ============================================================================== --- head/sys/i386/linux/linux_syscalls.c Sun May 24 15:21:47 2015 (r283404) +++ head/sys/i386/linux/linux_syscalls.c Sun May 24 15:22:33 2015 (r283405) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283401 2015-05-24 15:18:19Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283403 2015-05-24 15:21:25Z dchagin */ const char *linux_syscallnames[] = { Modified: head/sys/i386/linux/linux_sysent.c ============================================================================== --- head/sys/i386/linux/linux_sysent.c Sun May 24 15:21:47 2015 (r283404) +++ head/sys/i386/linux/linux_sysent.c Sun May 24 15:22:33 2015 (r283405) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/i386/linux/syscalls.master 283401 2015-05-24 15:18:19Z dchagin + * created from FreeBSD: head/sys/i386/linux/syscalls.master 283403 2015-05-24 15:21:25Z dchagin */ #include @@ -326,7 +326,7 @@ struct sysent linux_sysent[] = { { AS(linux_readlinkat_args), (sy_call_t *)linux_readlinkat, AUE_READLINKAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 305 = linux_readlinkat */ { AS(linux_fchmodat_args), (sy_call_t *)linux_fchmodat, AUE_FCHMODAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 306 = linux_fchmodat */ { AS(linux_faccessat_args), (sy_call_t *)linux_faccessat, AUE_FACCESSAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 307 = linux_faccessat */ - { 0, (sy_call_t *)linux_pselect6, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 308 = linux_pselect6 */ + { AS(linux_pselect6_args), (sy_call_t *)linux_pselect6, AUE_SELECT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 308 = linux_pselect6 */ { 0, (sy_call_t *)linux_ppoll, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 309 = linux_ppoll */ { 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 310 = linux_unshare */ { AS(linux_set_robust_list_args), (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 311 = linux_set_robust_list */ Modified: head/sys/i386/linux/linux_systrace_args.c ============================================================================== --- head/sys/i386/linux/linux_systrace_args.c Sun May 24 15:21:47 2015 (r283404) +++ head/sys/i386/linux/linux_systrace_args.c Sun May 24 15:22:33 2015 (r283405) @@ -2149,7 +2149,14 @@ systrace_args(int sysnum, void *params, } /* linux_pselect6 */ case 308: { - *n_args = 0; + struct linux_pselect6_args *p = params; + iarg[0] = p->nfds; /* l_int */ + uarg[1] = (intptr_t) p->readfds; /* l_fd_set * */ + uarg[2] = (intptr_t) p->writefds; /* l_fd_set * */ + uarg[3] = (intptr_t) p->exceptfds; /* l_fd_set * */ + uarg[4] = (intptr_t) p->tsp; /* struct l_timespec * */ + uarg[5] = (intptr_t) p->sig; /* l_uintptr_t * */ + *n_args = 6; break; } /* linux_ppoll */ @@ -5618,6 +5625,28 @@ systrace_entry_setargdesc(int sysnum, in break; /* linux_pselect6 */ case 308: + switch(ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "l_fd_set *"; + break; + case 2: + p = "l_fd_set *"; + break; + case 3: + p = "l_fd_set *"; + break; + case 4: + p = "struct l_timespec *"; + break; + case 5: + p = "l_uintptr_t *"; + break; + default: + break; + }; break; /* linux_ppoll */ case 309: @@ -7018,6 +7047,9 @@ systrace_return_setargdesc(int sysnum, i break; /* linux_pselect6 */ case 308: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_ppoll */ case 309: /* linux_unshare */ From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:27:32 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 60BD54D1; Sun, 24 May 2015 15:27:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 4EB0C1CF1; Sun, 24 May 2015 15:27:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OFRWvr051426; Sun, 24 May 2015 15:27:32 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OFRWqX051425; Sun, 24 May 2015 15:27:32 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201505241527.t4OFRWqX051425@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Sun, 24 May 2015 15:27:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283406 - head/lib/libiconv_modules/UTF7 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:27:32 -0000 Author: tijl Date: Sun May 24 15:27:31 2015 New Revision: 283406 URL: https://svnweb.freebsd.org/changeset/base/283406 Log: Fix decoding of UTF-7 when a base64 encoded chunk appears at the end of the input buffer. _citrus_UTF7_mbtoutf16 stored the decoder state at the beginning so it could restore this state on an incomplete character such that the next call would restart the decoding. The problem was that "-" (end of base64 mode) at the end of a string was also treated as an incomplete character but was also removed from the state buffer. So the initial state would be restored (with base64 mode) and the next call would no longer see the "-" so it continued in base64 mode. This state saving/restoring isn't needed here. It's already handled elsewhere (citrus_iconv_std.c:_citrus_iconv_std_iconv_convert) so just remove it. Also initialise *nresult. PR: 200398 Tested by: delphij MFC after: 1 week Modified: head/lib/libiconv_modules/UTF7/citrus_utf7.c Modified: head/lib/libiconv_modules/UTF7/citrus_utf7.c ============================================================================== --- head/lib/libiconv_modules/UTF7/citrus_utf7.c Sun May 24 15:22:33 2015 (r283405) +++ head/lib/libiconv_modules/UTF7/citrus_utf7.c Sun May 24 15:27:31 2015 (r283406) @@ -154,21 +154,17 @@ _citrus_UTF7_mbtoutf16(_UTF7EncodingInfo uint16_t * __restrict u16, char ** __restrict s, size_t n, _UTF7State * __restrict psenc, size_t * __restrict nresult) { - _UTF7State sv; char *s0; int done, i, len; + *nresult = 0; s0 = *s; - sv = *psenc; for (i = 0, done = 0; done == 0; i++) { if (i == psenc->chlen) { if (n-- < 1) { *nresult = (size_t)-2; *s = s0; - sv.chlen = psenc->chlen; - memcpy(sv.ch, psenc->ch, sizeof(sv.ch)); - *psenc = sv; return (0); } psenc->ch[psenc->chlen++] = *s0++; From owner-svn-src-all@FreeBSD.ORG Sun May 24 15:28:21 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C519561B; Sun, 24 May 2015 15:28:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 B103B1CF9; Sun, 24 May 2015 15:28:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4OFSLgk051618; Sun, 24 May 2015 15:28:21 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4OFSILt051595; Sun, 24 May 2015 15:28:18 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201505241528.t4OFSILt051595@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 24 May 2015 15:28:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283407 - in head/sys: amd64/linux32 compat/linux conf i386/linux modules/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 May 2015 15:28:21 -0000 Author: dchagin Date: Sun May 24 15:28:17 2015 New Revision: 283407 URL: https://svnweb.freebsd.org/changeset/base/283407 Log: Implement vdso - virtual dynamic shared object. Through vdso Linux exposes functions from kernel with proper DWARF CFI information so that it becomes easier to unwind through them. Using vdso is a mandatory for a thread cancelation && cleanup on a modern glibc. Differential Revision: https://reviews.freebsd.org/D1060 Added: head/sys/amd64/linux32/linux32_vdso.lds.s (contents, props changed) head/sys/compat/linux/linux_vdso.c (contents, props changed) head/sys/compat/linux/linux_vdso.h (contents, props changed) head/sys/i386/linux/linux_vdso.lds.s (contents, props changed) Modified: head/sys/amd64/linux32/linux.h head/sys/amd64/linux32/linux32_genassym.c head/sys/amd64/linux32/linux32_locore.s head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/linux/linux_misc.h head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/i386/linux/linux.h head/sys/i386/linux/linux_genassym.c head/sys/i386/linux/linux_locore.s head/sys/i386/linux/linux_sysvec.c head/sys/modules/linux/Makefile Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Sun May 24 15:27:31 2015 (r283406) +++ head/sys/amd64/linux32/linux.h Sun May 24 15:28:17 2015 (r283407) @@ -114,7 +114,7 @@ typedef struct { /* * Miscellaneous */ -#define LINUX_AT_COUNT 16 /* Count of used aux entry types. +#define LINUX_AT_COUNT 18 /* Count of used aux entry types. * Keep this synchronized with * elf_linux_fixup() code. */ Modified: head/sys/amd64/linux32/linux32_genassym.c ============================================================================== --- head/sys/amd64/linux32/linux32_genassym.c Sun May 24 15:27:31 2015 (r283406) +++ head/sys/amd64/linux32/linux32_genassym.c Sun May 24 15:28:17 2015 (r283407) @@ -7,9 +7,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include ASSYM(LINUX_SIGF_HANDLER, offsetof(struct l_sigframe, sf_handler)); ASSYM(LINUX_SIGF_SC, offsetof(struct l_sigframe, sf_sc)); ASSYM(LINUX_RT_SIGF_HANDLER, offsetof(struct l_rt_sigframe, sf_handler)); ASSYM(LINUX_RT_SIGF_UC, offsetof(struct l_rt_sigframe, sf_sc)); ASSYM(LINUX_RT_SIGF_SC, offsetof(struct l_ucontext, uc_mcontext)); +ASSYM(LINUX_VERSION_CODE, LINUX_VERSION_CODE); +ASSYM(LINUX_SC_ESP, offsetof(struct l_sigcontext, sc_esp)); Modified: head/sys/amd64/linux32/linux32_locore.s ============================================================================== --- head/sys/amd64/linux32/linux32_locore.s Sun May 24 15:27:31 2015 (r283406) +++ head/sys/amd64/linux32/linux32_locore.s Sun May 24 15:28:17 2015 (r283407) @@ -8,31 +8,143 @@ .text .code32 -NON_GPROF_ENTRY(linux_sigcode) - call *LINUX_SIGF_HANDLER(%esp) - leal LINUX_SIGF_SC(%esp),%ebx /* linux scp */ - movl %esp, %ebx /* pass sigframe */ - push %eax /* fake ret addr */ +/* + * To avoid excess stack frame the signal trampoline code emulates + * the 'call' instruction. + */ +NON_GPROF_ENTRY(linux32_sigcode) + movl %esp, %ebx /* preserve sigframe */ + call .getip0 +.getip0: + popl %eax + add $.startsigcode-.getip0, %eax /* ret address */ + push %eax + jmp *LINUX_SIGF_HANDLER(%ebx) +.startsigcode: + popl %eax movl $LINUX_SYS_linux_sigreturn,%eax /* linux_sigreturn() */ int $0x80 /* enter kernel with args */ +.endsigcode: 0: jmp 0b - ALIGN_TEXT -/* XXXXX */ -linux_rt_sigcode: - call *LINUX_RT_SIGF_HANDLER(%esp) + +NON_GPROF_ENTRY(linux32_rt_sigcode) leal LINUX_RT_SIGF_UC(%esp),%ebx /* linux ucp */ leal LINUX_RT_SIGF_SC(%ebx),%ecx /* linux sigcontext */ - push %eax /* fake ret addr */ + movl %esp, %edi + call .getip1 +.getip1: + popl %eax + add $.startrtsigcode-.getip1, %eax /* ret address */ + push %eax + jmp *LINUX_RT_SIGF_HANDLER(%edi) +.startrtsigcode: movl $LINUX_SYS_linux_rt_sigreturn,%eax /* linux_rt_sigreturn() */ int $0x80 /* enter kernel with args */ +.endrtsigcode: 0: jmp 0b - ALIGN_TEXT -/* XXXXX */ -linux_esigcode: - - .data - .globl linux_szsigcode, linux_sznonrtsigcode -linux_szsigcode: - .long linux_esigcode-linux_sigcode -linux_sznonrtsigcode: - .long linux_rt_sigcode-linux_sigcode + +NON_GPROF_ENTRY(linux32_vsyscall) +.startvsyscall: + int $0x80 + ret +.endvsyscall: + + + .section .note.Linux, "a",@note + .long 2f - 1f /* namesz */ + .balign 4 + .long 4f - 3f /* descsz */ + .long 0 +1: + .asciz "Linux" +2: + .balign 4 +3: + .long LINUX_VERSION_CODE +4: + .balign 4 + .previous + + +#define do_cfa_expr(offset) \ + .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ + .uleb128 11f-10f; /* length */ \ +10: .byte 0x74; /* DW_OP_breg4 */ \ + .sleb128 offset; /* offset */ \ + .byte 0x06; /* DW_OP_deref */ \ +11: + + + /* CIE */ + .section .eh_frame,"a",@progbits +.LSTARTFRAMEDLSI1: + .long .LENDCIEDLSI1-.LSTARTCIEDLSI1 +.LSTARTCIEDLSI1: + .long