From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 09:37:25 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7ED3106564A; Sun, 11 Dec 2011 09:37:25 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE6748FC0A; Sun, 11 Dec 2011 09:37:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBB9bPWP045565; Sun, 11 Dec 2011 09:37:25 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBB9bPWC045562; Sun, 11 Dec 2011 09:37:25 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201112110937.pBB9bPWC045562@svn.freebsd.org> From: Jack F Vogel Date: Sun, 11 Dec 2011 09:37:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228405 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 09:37:25 -0000 Author: jfv Date: Sun Dec 11 09:37:25 2011 New Revision: 228405 URL: http://svn.freebsd.org/changeset/base/228405 Log: Correct LINT build issues in the ioctl code. Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sun Dec 11 00:04:18 2011 (r228404) +++ head/sys/dev/e1000/if_em.c Sun Dec 11 09:37:25 2011 (r228405) @@ -1045,8 +1045,8 @@ em_ioctl(struct ifnet *ifp, u_long comma struct ifreq *ifr = (struct ifreq *)data; #if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; -#endif bool avoid_reset = FALSE; +#endif int error = 0; if (adapter->in_detach) @@ -1058,6 +1058,11 @@ em_ioctl(struct ifnet *ifp, u_long comma if (ifa->ifa_addr->sa_family == AF_INET) avoid_reset = TRUE; #endif +#ifdef INET6 + if (ifa->ifa_addr->sa_family == AF_INET6) + avoid_reset = TRUE; +#endif +#if defined(INET) || defined(INET6) /* ** Calling init results in link renegotiation, ** so we avoid doing it when possible. @@ -1066,12 +1071,11 @@ em_ioctl(struct ifnet *ifp, u_long comma ifp->if_flags |= IFF_UP; if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) em_init(adapter); -#ifdef INET if (!(ifp->if_flags & IFF_NOARP)) arp_ifinit(ifp, ifa); -#endif } else error = ether_ioctl(ifp, command, data); +#endif break; case SIOCSIFMTU: { Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Sun Dec 11 00:04:18 2011 (r228404) +++ head/sys/dev/e1000/if_igb.c Sun Dec 11 09:37:25 2011 (r228405) @@ -992,9 +992,9 @@ igb_ioctl(struct ifnet *ifp, u_long comm struct ifreq *ifr = (struct ifreq *)data; #if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; + bool avoid_reset = FALSE; #endif int error = 0; - bool avoid_reset = FALSE; if (adapter->in_detach) return (error); @@ -1005,10 +1005,11 @@ igb_ioctl(struct ifnet *ifp, u_long comm if (ifa->ifa_addr->sa_family == AF_INET) avoid_reset = TRUE; #endif -#ifdef INET +#ifdef INET6 if (ifa->ifa_addr->sa_family == AF_INET6) avoid_reset = TRUE; #endif +#if defined(INET) || defined(INET6) /* ** Calling init results in link renegotiation, ** so we avoid doing it when possible. @@ -1017,12 +1018,11 @@ igb_ioctl(struct ifnet *ifp, u_long comm ifp->if_flags |= IFF_UP; if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) igb_init(adapter); -#ifdef INET if (!(ifp->if_flags & IFF_NOARP)) arp_ifinit(ifp, ifa); -#endif } else error = ether_ioctl(ifp, command, data); +#endif break; case SIOCSIFMTU: { From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 09:56:48 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79A63106566B; Sun, 11 Dec 2011 09:56:48 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69ECF8FC0C; Sun, 11 Dec 2011 09:56:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBB9umXn046184; Sun, 11 Dec 2011 09:56:48 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBB9umW8046182; Sun, 11 Dec 2011 09:56:48 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112110956.pBB9umW8046182@svn.freebsd.org> From: Ed Schouten Date: Sun, 11 Dec 2011 09:56:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228406 - head/bin/stty X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 09:56:48 -0000 Author: ed Date: Sun Dec 11 09:56:48 2011 New Revision: 228406 URL: http://svn.freebsd.org/changeset/base/228406 Log: Move 3.5 KB from the data segment to the text segment. The `struct modes' are only used by the getter-functions in the same file, so we can safely mark them static and const. Modified: head/bin/stty/modes.c Modified: head/bin/stty/modes.c ============================================================================== --- head/bin/stty/modes.c Sun Dec 11 09:37:25 2011 (r228405) +++ head/bin/stty/modes.c Sun Dec 11 09:56:48 2011 (r228406) @@ -52,7 +52,7 @@ struct modes { * The code in optlist() depends on minus options following regular * options, i.e. "foo" must immediately precede "-foo". */ -struct modes cmodes[] = { +static const struct modes cmodes[] = { { "cs5", CS5, CSIZE }, { "cs6", CS6, CSIZE }, { "cs7", CS7, CSIZE }, @@ -94,7 +94,7 @@ struct modes cmodes[] = { { NULL, 0, 0 }, }; -struct modes imodes[] = { +static const struct modes imodes[] = { { "ignbrk", IGNBRK, 0 }, { "-ignbrk", 0, IGNBRK }, { "brkint", BRKINT, 0 }, @@ -130,7 +130,7 @@ struct modes imodes[] = { { NULL, 0, 0 }, }; -struct modes lmodes[] = { +static const struct modes lmodes[] = { { "echo", ECHO, 0 }, { "-echo", 0, ECHO }, { "echoe", ECHOE, 0 }, @@ -182,7 +182,7 @@ struct modes lmodes[] = { { NULL, 0, 0 }, }; -struct modes omodes[] = { +static const struct modes omodes[] = { { "opost", OPOST, 0 }, { "-opost", 0, OPOST }, { "litout", 0, OPOST }, @@ -209,7 +209,7 @@ struct modes omodes[] = { int msearch(char ***argvp, struct info *ip) { - struct modes *mp; + const struct modes *mp; char *name; name = **argvp; From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 11:38:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA547106564A; Sun, 11 Dec 2011 11:38:50 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ACA018FC12; Sun, 11 Dec 2011 11:38:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBBcoBH050884; Sun, 11 Dec 2011 11:38:50 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBBcojY050881; Sun, 11 Dec 2011 11:38:50 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112111138.pBBBcojY050881@svn.freebsd.org> From: Ed Schouten Date: Sun, 11 Dec 2011 11:38:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228407 - head/sbin/camcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 11:38:51 -0000 Author: ed Date: Sun Dec 11 11:38:50 2011 New Revision: 228407 URL: http://svn.freebsd.org/changeset/base/228407 Log: Add missing static keywords to global variables in camcontrol. While there, make the vendor list const and add appropriate keywords to functions that use this list. Modified: head/sbin/camcontrol/fwdownload.c head/sbin/camcontrol/modeedit.c Modified: head/sbin/camcontrol/fwdownload.c ============================================================================== --- head/sbin/camcontrol/fwdownload.c Sun Dec 11 09:56:48 2011 (r228406) +++ head/sbin/camcontrol/fwdownload.c Sun Dec 11 11:38:50 2011 (r228407) @@ -88,7 +88,7 @@ struct fw_vendor { int inc_cdb_offset; }; -struct fw_vendor vendors_list[] = { +static const struct fw_vendor vendors_list[] = { {VENDOR_HITACHI, "HITACHI", 0x8000, 0x05, 0x05, 1, 0}, {VENDOR_HP, "HP", 0x8000, 0x07, 0x07, 0, 1}, {VENDOR_IBM, "IBM", 0x8000, 0x05, 0x05, 1, 0}, @@ -98,22 +98,22 @@ struct fw_vendor vendors_list[] = { {VENDOR_UNKNOWN, NULL, 0x0000, 0x00, 0x00, 0, 0} }; -static struct fw_vendor *fw_get_vendor(struct cam_device *cam_dev); -static char *fw_read_img(char *fw_img_path, struct fw_vendor *vp, - int *num_bytes); +static const struct fw_vendor *fw_get_vendor(struct cam_device *cam_dev); +static char *fw_read_img(const char *fw_img_path, + const struct fw_vendor *vp, int *num_bytes); static int fw_download_img(struct cam_device *cam_dev, - struct fw_vendor *vp, char *buf, int img_size, + const struct fw_vendor *vp, char *buf, int img_size, int sim_mode, int verbose, int retry_count, int timeout); /* * Find entry in vendors list that belongs to * the vendor of given cam device. */ -static struct fw_vendor * +static const struct fw_vendor * fw_get_vendor(struct cam_device *cam_dev) { char vendor[SID_VENDOR_SIZE + 1]; - struct fw_vendor *vp; + const struct fw_vendor *vp; if (cam_dev == NULL) return (NULL); @@ -133,7 +133,7 @@ fw_get_vendor(struct cam_device *cam_dev * in num_bytes. */ static char * -fw_read_img(char *fw_img_path, struct fw_vendor *vp, int *num_bytes) +fw_read_img(const char *fw_img_path, const struct fw_vendor *vp, int *num_bytes) { int fd; struct stat stbuf; @@ -205,7 +205,7 @@ bailout1: * device but do not sent any actual packets */ static int -fw_download_img(struct cam_device *cam_dev, struct fw_vendor *vp, +fw_download_img(struct cam_device *cam_dev, const struct fw_vendor *vp, char *buf, int img_size, int sim_mode, int verbose, int retry_count, int timeout) { @@ -319,7 +319,7 @@ int fwdownload(struct cam_device *device, int argc, char **argv, char *combinedopt, int verbose, int retry_count, int timeout) { - struct fw_vendor *vp; + const struct fw_vendor *vp; char *fw_img_path = NULL; char *buf; int img_size; Modified: head/sbin/camcontrol/modeedit.c ============================================================================== --- head/sbin/camcontrol/modeedit.c Sun Dec 11 09:56:48 2011 (r228406) +++ head/sbin/camcontrol/modeedit.c Sun Dec 11 11:38:50 2011 (r228407) @@ -83,15 +83,15 @@ struct editentry { char *svalue; } value; }; -STAILQ_HEAD(, editentry) editlist; /* List of page entries. */ -int editlist_changed = 0; /* Whether any entries were changed. */ +static STAILQ_HEAD(, editentry) editlist; /* List of page entries. */ +static int editlist_changed = 0; /* Whether any entries were changed. */ struct pagename { SLIST_ENTRY(pagename) link; int pagenum; char *name; }; -SLIST_HEAD(, pagename) namelist; /* Page number to name mappings. */ +static SLIST_HEAD(, pagename) namelist; /* Page number to name mappings. */ static char format[MAX_FORMAT_SPEC]; /* Buffer for scsi cdb format def. */ From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 11:42:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CB5A106564A; Sun, 11 Dec 2011 11:42:44 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CE1E8FC08; Sun, 11 Dec 2011 11:42:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBBgi6b051038; Sun, 11 Dec 2011 11:42:44 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBBgiO1051036; Sun, 11 Dec 2011 11:42:44 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112111142.pBBBgiO1051036@svn.freebsd.org> From: Ed Schouten Date: Sun, 11 Dec 2011 11:42:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228408 - head/sbin/reboot X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 11:42:44 -0000 Author: ed Date: Sun Dec 11 11:42:44 2011 New Revision: 228408 URL: http://svn.freebsd.org/changeset/base/228408 Log: Let reboot(8) use getprogname() to compare the program name. While there, mark the global variable dohalt static, as reboot(8) only consists of a single C file. Modified: head/sbin/reboot/reboot.c Modified: head/sbin/reboot/reboot.c ============================================================================== --- head/sbin/reboot/reboot.c Sun Dec 11 11:38:50 2011 (r228407) +++ head/sbin/reboot/reboot.c Sun Dec 11 11:42:44 2011 (r228408) @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); static void usage(void); static u_int get_pageins(void); -int dohalt; +static int dohalt; int main(int argc, char *argv[]) @@ -69,9 +69,9 @@ main(int argc, char *argv[]) const struct passwd *pw; int ch, howto, i, fd, lflag, nflag, qflag, sverrno; u_int pageins; - const char *p, *user, *kernel = NULL; + const char *user, *kernel = NULL; - if (strstr((p = rindex(*argv, '/')) ? p + 1 : *argv, "halt")) { + if (strcmp(getprogname(), "halt") == 0) { dohalt = 1; howto = RB_HALT; } else From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 14:01:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74DB01065675; Sun, 11 Dec 2011 14:01:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49CD38FC15; Sun, 11 Dec 2011 14:01:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBE1CLN055274; Sun, 11 Dec 2011 14:01:12 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBE1CPs055272; Sun, 11 Dec 2011 14:01:12 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112111401.pBBE1CPs055272@svn.freebsd.org> From: Dimitry Andric Date: Sun, 11 Dec 2011 14:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228409 - head/tools/build/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 14:01:12 -0000 Author: dim Date: Sun Dec 11 14:01:11 2011 New Revision: 228409 URL: http://svn.freebsd.org/changeset/base/228409 Log: Add more files to cleanup with 'make delete-old' when WITHOUT_CLANG is in effect. MFC after: 1 week Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Sun Dec 11 11:42:44 2011 (r228408) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Sun Dec 11 14:01:11 2011 (r228409) @@ -627,6 +627,8 @@ OLD_FILES+=usr/share/man/man8/zpool.8.gz .if ${MK_CLANG} == no OLD_FILES+=usr/bin/clang OLD_FILES+=usr/bin/clang++ +OLD_FILES+=usr/bin/clang-cpp +OLD_FILES+=usr/bin/clang-tblgen OLD_FILES+=usr/bin/tblgen OLD_FILES+=usr/include/clang/2.8/emmintrin.h OLD_FILES+=usr/include/clang/2.8/mm_malloc.h @@ -634,6 +636,39 @@ OLD_FILES+=usr/include/clang/2.8/mmintri OLD_FILES+=usr/include/clang/2.8/pmmintrin.h OLD_FILES+=usr/include/clang/2.8/tmmintrin.h OLD_FILES+=usr/include/clang/2.8/xmmintrin.h +OLD_DIRS+=usr/include/clang/2.8 +OLD_FILES+=usr/include/clang/2.9/emmintrin.h +OLD_FILES+=usr/include/clang/2.9/mm_malloc.h +OLD_FILES+=usr/include/clang/2.9/mmintrin.h +OLD_FILES+=usr/include/clang/2.9/pmmintrin.h +OLD_FILES+=usr/include/clang/2.9/tmmintrin.h +OLD_FILES+=usr/include/clang/2.9/xmmintrin.h +OLD_DIRS+=usr/include/clang/2.9 +OLD_FILES+=usr/include/clang/3.0/altivec.h +OLD_FILES+=usr/include/clang/3.0/avxintrin.h +OLD_FILES+=usr/include/clang/3.0/emmintrin.h +OLD_FILES+=usr/include/clang/3.0/immintrin.h +OLD_FILES+=usr/include/clang/3.0/mm3dnow.h +OLD_FILES+=usr/include/clang/3.0/mm_malloc.h +OLD_FILES+=usr/include/clang/3.0/mmintrin.h +OLD_FILES+=usr/include/clang/3.0/nmmintrin.h +OLD_FILES+=usr/include/clang/3.0/pmmintrin.h +OLD_FILES+=usr/include/clang/3.0/smmintrin.h +OLD_FILES+=usr/include/clang/3.0/tmmintrin.h +OLD_FILES+=usr/include/clang/3.0/wmmintrin.h +OLD_FILES+=usr/include/clang/3.0/x86intrin.h +OLD_FILES+=usr/include/clang/3.0/xmmintrin.h +OLD_DIRS+=usr/include/clang/3.0 +OLD_DIRS+=usr/include/clang +OLD_FILES+=usr/share/doc/llvm/clang/LICENSE.TXT +OLD_DIRS+=usr/share/doc/llvm/clang +OLD_FILES+=usr/share/doc/llvm/COPYRIGHT.regex +OLD_FILES+=usr/share/doc/llvm/LICENSE.TXT +OLD_DIRS+=usr/share/doc/llvm +OLD_FILES+=usr/share/man/man1/clang.1.gz +OLD_FILES+=usr/share/man/man1/clang++.1.gz +OLD_FILES+=usr/share/man/man1/clang-cpp.1.gz +OLD_FILES+=usr/share/man/man1/tblgen.1.gz .endif .if ${MK_CPP} == no From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 16:57:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26841106564A; Sun, 11 Dec 2011 16:57:28 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0CAB28FC0A; Sun, 11 Dec 2011 16:57:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBGvRHj060662; Sun, 11 Dec 2011 16:57:27 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBGvRVF060660; Sun, 11 Dec 2011 16:57:27 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201112111657.pBBGvRVF060660@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Sun, 11 Dec 2011 16:57:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228410 - stable/9/lib/libpam/modules/pam_ssh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 16:57:28 -0000 Author: des Date: Sun Dec 11 16:57:27 2011 New Revision: 228410 URL: http://svn.freebsd.org/changeset/base/228410 Log: MFH r227757: check for null passphrases, since openssl doesn't Approved by: re (kib) Security: prevents users with unencrypted ssh keys (prohibited unless the nullok option is specified) from logging in by providing a bogus non-null passphrase. Modified: stable/9/lib/libpam/modules/pam_ssh/pam_ssh.c Directory Properties: stable/9/lib/libpam/ (props changed) Modified: stable/9/lib/libpam/modules/pam_ssh/pam_ssh.c ============================================================================== --- stable/9/lib/libpam/modules/pam_ssh/pam_ssh.c Sun Dec 11 14:01:11 2011 (r228409) +++ stable/9/lib/libpam/modules/pam_ssh/pam_ssh.c Sun Dec 11 16:57:27 2011 (r228410) @@ -91,7 +91,8 @@ static char *const pam_ssh_agent_envp[] * struct pam_ssh_key containing the key and its comment. */ static struct pam_ssh_key * -pam_ssh_load_key(const char *dir, const char *kfn, const char *passphrase) +pam_ssh_load_key(const char *dir, const char *kfn, const char *passphrase, + int nullok) { struct pam_ssh_key *psk; char fn[PATH_MAX]; @@ -101,7 +102,21 @@ pam_ssh_load_key(const char *dir, const if (snprintf(fn, sizeof(fn), "%s/%s", dir, kfn) > (int)sizeof(fn)) return (NULL); comment = NULL; - key = key_load_private(fn, passphrase, &comment); + /* + * If the key is unencrypted, OpenSSL ignores the passphrase, so + * it will seem like the user typed in the right one. This allows + * a user to circumvent nullok by providing a dummy passphrase. + * Verify that the key really *is* encrypted by trying to load it + * with an empty passphrase, and if the key is not encrypted, + * accept only an empty passphrase. + */ + key = key_load_private(fn, NULL, &comment); + if (key != NULL && !(*passphrase == '\0' && nullok)) { + key_free(key); + return (NULL); + } + if (key == NULL) + key = key_load_private(fn, passphrase, &comment); if (key == NULL) { openpam_log(PAM_LOG_DEBUG, "failed to load key from %s", fn); return (NULL); @@ -168,9 +183,6 @@ pam_sm_authenticate(pam_handle_t *pamh, if (pam_err != PAM_SUCCESS) return (pam_err); - if (*passphrase == '\0' && !nullok) - goto skip_keys; - /* switch to user credentials */ pam_err = openpam_borrow_cred(pamh, pwd); if (pam_err != PAM_SUCCESS) @@ -178,7 +190,7 @@ pam_sm_authenticate(pam_handle_t *pamh, /* try to load keys from all keyfiles we know of */ for (kfn = pam_ssh_keyfiles; *kfn != NULL; ++kfn) { - psk = pam_ssh_load_key(pwd->pw_dir, *kfn, passphrase); + psk = pam_ssh_load_key(pwd->pw_dir, *kfn, passphrase, nullok); if (psk != NULL) { pam_set_data(pamh, *kfn, psk, pam_ssh_free_key); ++nkeys; @@ -188,7 +200,6 @@ pam_sm_authenticate(pam_handle_t *pamh, /* switch back to arbitrator credentials */ openpam_restore_cred(pamh); - skip_keys: /* * If we tried an old token and didn't get anything, and * try_first_pass was specified, try again after prompting the From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 17:10:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72B8E1065670; Sun, 11 Dec 2011 17:10:33 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 628FB8FC0A; Sun, 11 Dec 2011 17:10:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBHAXG1061120; Sun, 11 Dec 2011 17:10:33 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBHAXXJ061118; Sun, 11 Dec 2011 17:10:33 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112111710.pBBHAXXJ061118@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 11 Dec 2011 17:10:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228411 - head/contrib/bsnmp/snmpd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 17:10:33 -0000 Author: trociny Date: Sun Dec 11 17:10:33 2011 New Revision: 228411 URL: http://svn.freebsd.org/changeset/base/228411 Log: Include sys/queue.h: snmpmod.h uses TAILQ. PR: bin/153153 MFC after: 2 weeks Modified: head/contrib/bsnmp/snmpd/snmpmod.h Modified: head/contrib/bsnmp/snmpd/snmpmod.h ============================================================================== --- head/contrib/bsnmp/snmpd/snmpmod.h Sun Dec 11 16:57:27 2011 (r228410) +++ head/contrib/bsnmp/snmpd/snmpmod.h Sun Dec 11 17:10:33 2011 (r228411) @@ -40,6 +40,7 @@ #define snmpmod_h_ #include +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 17:19:49 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C260106564A; Sun, 11 Dec 2011 17:19:49 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3AF208FC0C; Sun, 11 Dec 2011 17:19:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBHJnDZ061454; Sun, 11 Dec 2011 17:19:49 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBHJn48061450; Sun, 11 Dec 2011 17:19:49 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201112111719.pBBHJn48061450@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 11 Dec 2011 17:19:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228412 - in head/sys/powerpc: aim include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 17:19:49 -0000 Author: nwhitehorn Date: Sun Dec 11 17:19:48 2011 New Revision: 228412 URL: http://svn.freebsd.org/changeset/base/228412 Log: Keep track of PVO entries in each pmap, which allows much faster pmap_remove() for large sparse requests. This can prevent pmap_remove() operations on 64-bit process destruction or swapout that would take several hundred times the lifetime of the universe to complete. This behavior is largely indistinguishable from a hang. Modified: head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/include/pmap.h Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Sun Dec 11 17:10:33 2011 (r228411) +++ head/sys/powerpc/aim/mmu_oea.c Sun Dec 11 17:19:48 2011 (r228412) @@ -824,6 +824,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k for (i = 0; i < 16; i++) kernel_pmap->pm_sr[i] = EMPTY_SEGMENT + i; CPU_FILL(&kernel_pmap->pm_active); + LIST_INIT(&kernel_pmap->pmap_pvo); /* * Set up the Open Firmware mappings @@ -1582,6 +1583,7 @@ moea_pinit(mmu_t mmu, pmap_t pmap) KASSERT((int)pmap < VM_MIN_KERNEL_ADDRESS, ("moea_pinit: virt pmap")); PMAP_LOCK_INIT(pmap); + LIST_INIT(&pmap->pmap_pvo); entropy = 0; __asm __volatile("mftb %0" : "=r"(entropy)); @@ -1765,10 +1767,17 @@ moea_remove(mmu_t mmu, pmap_t pm, vm_off vm_page_lock_queues(); PMAP_LOCK(pm); - for (; sva < eva; sva += PAGE_SIZE) { - pvo = moea_pvo_find_va(pm, sva, &pteidx); - if (pvo != NULL) { - moea_pvo_remove(pvo, pteidx); + if ((eva - sva)/PAGE_SIZE < 10) { + for (; sva < eva; sva += PAGE_SIZE) { + pvo = moea_pvo_find_va(pm, sva, &pteidx); + if (pvo != NULL) + moea_pvo_remove(pvo, pteidx); + } + } else { + LIST_FOREACH(pvo, &pm->pmap_pvo, pvo_plink) { + if (PVO_VADDR(pvo) < sva || PVO_VADDR(pvo) >= eva) + continue; + moea_pvo_remove(pvo, -1); } } PMAP_UNLOCK(pm); @@ -1931,6 +1940,11 @@ moea_pvo_enter(pmap_t pm, uma_zone_t zon moea_pte_create(&pvo->pvo_pte.pte, sr, va, pa | pte_lo); /* + * Add to pmap list + */ + LIST_INSERT_HEAD(&pm->pmap_pvo, pvo, pvo_plink); + + /* * Remember if the list was empty and therefore will be the first * item. */ @@ -1996,9 +2010,10 @@ moea_pvo_remove(struct pvo_entry *pvo, i } /* - * Remove this PVO from the PV list. + * Remove this PVO from the PV and pmap lists. */ LIST_REMOVE(pvo, pvo_vlink); + LIST_REMOVE(pvo, pvo_plink); /* * Remove this from the overflow list and return it to the pool Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sun Dec 11 17:10:33 2011 (r228411) +++ head/sys/powerpc/aim/mmu_oea64.c Sun Dec 11 17:19:48 2011 (r228412) @@ -831,6 +831,7 @@ moea64_mid_bootstrap(mmu_t mmup, vm_offs kernel_pmap->pmap_phys = kernel_pmap; CPU_FILL(&kernel_pmap->pm_active); + LIST_INIT(&kernel_pmap->pmap_pvo); PMAP_LOCK_INIT(kernel_pmap); @@ -1855,6 +1856,7 @@ void moea64_pinit(mmu_t mmu, pmap_t pmap) { PMAP_LOCK_INIT(pmap); + LIST_INIT(&pmap->pmap_pvo); pmap->pm_slb_tree_root = slb_alloc_tree(); pmap->pm_slb = slb_alloc_user_cache(); @@ -1868,6 +1870,7 @@ moea64_pinit(mmu_t mmu, pmap_t pmap) uint32_t hash; PMAP_LOCK_INIT(pmap); + LIST_INIT(&pmap->pmap_pvo); if (pmap_bootstrapped) pmap->pmap_phys = (pmap_t)moea64_kextract(mmu, @@ -2034,10 +2037,18 @@ moea64_remove(mmu_t mmu, pmap_t pm, vm_o vm_page_lock_queues(); PMAP_LOCK(pm); - for (; sva < eva; sva += PAGE_SIZE) { - pvo = moea64_pvo_find_va(pm, sva); - if (pvo != NULL) + if ((eva - sva)/PAGE_SIZE < 10) { + for (; sva < eva; sva += PAGE_SIZE) { + pvo = moea64_pvo_find_va(pm, sva); + if (pvo != NULL) + moea64_pvo_remove(mmu, pvo); + } + } else { + LIST_FOREACH(pvo, &pm->pmap_pvo, pvo_plink) { + if (PVO_VADDR(pvo) < sva || PVO_VADDR(pvo) >= eva) + continue; moea64_pvo_remove(mmu, pvo); + } } vm_page_unlock_queues(); PMAP_UNLOCK(pm); @@ -2231,6 +2242,11 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, u (uint64_t)(pa) | pte_lo, flags); /* + * Add to pmap list + */ + LIST_INSERT_HEAD(&pm->pmap_pvo, pvo, pvo_plink); + + /* * Remember if the list was empty and therefore will be the first * item. */ @@ -2311,9 +2327,10 @@ moea64_pvo_remove(mmu_t mmu, struct pvo_ } /* - * Remove this PVO from the PV list. + * Remove this PVO from the PV and pmap lists. */ LIST_REMOVE(pvo, pvo_vlink); + LIST_REMOVE(pvo, pvo_plink); /* * Remove this from the overflow list and return it to the pool Modified: head/sys/powerpc/include/pmap.h ============================================================================== --- head/sys/powerpc/include/pmap.h Sun Dec 11 17:10:33 2011 (r228411) +++ head/sys/powerpc/include/pmap.h Sun Dec 11 17:19:48 2011 (r228412) @@ -88,28 +88,13 @@ struct pmap_md { #endif /* !defined(NPMAPS) */ struct slbtnode; - -struct pmap { - struct mtx pm_mtx; - - #ifdef __powerpc64__ - struct slbtnode *pm_slb_tree_root; - struct slb **pm_slb; - int pm_slb_len; - #else - register_t pm_sr[16]; - #endif - cpuset_t pm_active; - - struct pmap *pmap_phys; - struct pmap_statistics pm_stats; -}; - +struct pmap; typedef struct pmap *pmap_t; struct pvo_entry { LIST_ENTRY(pvo_entry) pvo_vlink; /* Link to common virt page */ LIST_ENTRY(pvo_entry) pvo_olink; /* Link to overflow entry */ + LIST_ENTRY(pvo_entry) pvo_plink; /* Link to pmap entries */ union { struct pte pte; /* 32 bit PTE */ struct lpte lpte; /* 64 bit PTE */ @@ -137,6 +122,23 @@ LIST_HEAD(pvo_head, pvo_entry); ((void)((pvo)->pvo_vaddr |= (i)|PVO_PTEGIDX_VALID)) #define PVO_VSID(pvo) ((pvo)->pvo_vpn >> 16) +struct pmap { + struct mtx pm_mtx; + + #ifdef __powerpc64__ + struct slbtnode *pm_slb_tree_root; + struct slb **pm_slb; + int pm_slb_len; + #else + register_t pm_sr[16]; + #endif + cpuset_t pm_active; + + struct pmap *pmap_phys; + struct pmap_statistics pm_stats; + struct pvo_head pmap_pvo; +}; + struct md_page { u_int64_t mdpg_attrs; vm_memattr_t mdpg_cache_attrs; From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 17:23:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7D8E106564A; Sun, 11 Dec 2011 17:23:03 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7DF648FC0C; Sun, 11 Dec 2011 17:23:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBHN3wJ061599; Sun, 11 Dec 2011 17:23:03 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBHN3v6061597; Sun, 11 Dec 2011 17:23:03 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201112111723.pBBHN3v6061597@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 11 Dec 2011 17:23:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228413 - head/sys/powerpc/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 17:23:03 -0000 Author: nwhitehorn Date: Sun Dec 11 17:23:03 2011 New Revision: 228413 URL: http://svn.freebsd.org/changeset/base/228413 Log: Increase the available virtual address space for user programs on PowerPC AIM systems to 4 GB on 32-bit systems and 2^64 bytes on 64-bit systems. VM_MAXUSER_ADDRESS remains at 2 GB on pending Book-E, pending review of an increase to 3 GB by those more familiar with Book-E. Modified: head/sys/powerpc/include/vmparam.h Modified: head/sys/powerpc/include/vmparam.h ============================================================================== --- head/sys/powerpc/include/vmparam.h Sun Dec 11 17:19:48 2011 (r228412) +++ head/sys/powerpc/include/vmparam.h Sun Dec 11 17:23:03 2011 (r228413) @@ -57,29 +57,34 @@ #define MAXSSIZ (64*1024*1024) /* max stack size */ #endif +#ifdef AIM +#define VM_MAXUSER_ADDRESS32 ((vm_offset_t)0xfffff000) +#else +#define VM_MAXUSER_ADDRESS32 ((vm_offset_t)0x7ffff000) +#endif + /* * Would like to have MAX addresses = 0, but this doesn't (currently) work */ #if !defined(LOCORE) #ifdef __powerpc64__ #define VM_MIN_ADDRESS (0x0000000000000000UL) -#define VM_MAXUSER_ADDRESS (0x7ffffffffffff000UL) -#define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) +#define VM_MAXUSER_ADDRESS (0xfffffffffffff000UL) #define VM_MAX_ADDRESS (0xffffffffffffffffUL) #else #define VM_MIN_ADDRESS ((vm_offset_t)0) -#define VM_MAXUSER_ADDRESS ((vm_offset_t)0x7ffff000) -#define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) -#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS +#define VM_MAXUSER_ADDRESS VM_MAXUSER_ADDRESS32 +#define VM_MAX_ADDRESS ((vm_offset_t)0xffffffff) #endif +#define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) #else /* LOCORE */ -#ifndef __powerpc64__ +#if !defined(__powerpc64__) && defined(E500) #define VM_MIN_ADDRESS 0 #define VM_MAXUSER_ADDRESS 0x7ffff000 #endif #endif /* LOCORE */ -#define FREEBSD32_SHAREDPAGE (0x7ffff000 - PAGE_SIZE) +#define FREEBSD32_SHAREDPAGE (VM_MAXUSER_ADDRESS32 - PAGE_SIZE) #define FREEBSD32_USRSTACK FREEBSD32_SHAREDPAGE #ifdef AIM From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 17:32:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63801106567C; Sun, 11 Dec 2011 17:32:38 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49B3D8FC0C; Sun, 11 Dec 2011 17:32:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBHWct8061964; Sun, 11 Dec 2011 17:32:38 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBHWchu061962; Sun, 11 Dec 2011 17:32:38 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201112111732.pBBHWchu061962@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Sun, 11 Dec 2011 17:32:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228414 - releng/9.0/lib/libpam/modules/pam_ssh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 17:32:38 -0000 Author: des Date: Sun Dec 11 17:32:37 2011 New Revision: 228414 URL: http://svn.freebsd.org/changeset/base/228414 Log: MFH r228410: check for null passphrases, since openssl doesn't Approved by: re (kib) Security: prevents users with unencrypted ssh keys (prohibited unless the nullok option is specified) from logging in by providing a bogus non-null passphrase. Modified: releng/9.0/lib/libpam/modules/pam_ssh/pam_ssh.c Directory Properties: releng/9.0/lib/libpam/ (props changed) Modified: releng/9.0/lib/libpam/modules/pam_ssh/pam_ssh.c ============================================================================== --- releng/9.0/lib/libpam/modules/pam_ssh/pam_ssh.c Sun Dec 11 17:23:03 2011 (r228413) +++ releng/9.0/lib/libpam/modules/pam_ssh/pam_ssh.c Sun Dec 11 17:32:37 2011 (r228414) @@ -91,7 +91,8 @@ static char *const pam_ssh_agent_envp[] * struct pam_ssh_key containing the key and its comment. */ static struct pam_ssh_key * -pam_ssh_load_key(const char *dir, const char *kfn, const char *passphrase) +pam_ssh_load_key(const char *dir, const char *kfn, const char *passphrase, + int nullok) { struct pam_ssh_key *psk; char fn[PATH_MAX]; @@ -101,7 +102,21 @@ pam_ssh_load_key(const char *dir, const if (snprintf(fn, sizeof(fn), "%s/%s", dir, kfn) > (int)sizeof(fn)) return (NULL); comment = NULL; - key = key_load_private(fn, passphrase, &comment); + /* + * If the key is unencrypted, OpenSSL ignores the passphrase, so + * it will seem like the user typed in the right one. This allows + * a user to circumvent nullok by providing a dummy passphrase. + * Verify that the key really *is* encrypted by trying to load it + * with an empty passphrase, and if the key is not encrypted, + * accept only an empty passphrase. + */ + key = key_load_private(fn, NULL, &comment); + if (key != NULL && !(*passphrase == '\0' && nullok)) { + key_free(key); + return (NULL); + } + if (key == NULL) + key = key_load_private(fn, passphrase, &comment); if (key == NULL) { openpam_log(PAM_LOG_DEBUG, "failed to load key from %s", fn); return (NULL); @@ -168,9 +183,6 @@ pam_sm_authenticate(pam_handle_t *pamh, if (pam_err != PAM_SUCCESS) return (pam_err); - if (*passphrase == '\0' && !nullok) - goto skip_keys; - /* switch to user credentials */ pam_err = openpam_borrow_cred(pamh, pwd); if (pam_err != PAM_SUCCESS) @@ -178,7 +190,7 @@ pam_sm_authenticate(pam_handle_t *pamh, /* try to load keys from all keyfiles we know of */ for (kfn = pam_ssh_keyfiles; *kfn != NULL; ++kfn) { - psk = pam_ssh_load_key(pwd->pw_dir, *kfn, passphrase); + psk = pam_ssh_load_key(pwd->pw_dir, *kfn, passphrase, nullok); if (psk != NULL) { pam_set_data(pamh, *kfn, psk, pam_ssh_free_key); ++nkeys; @@ -188,7 +200,6 @@ pam_sm_authenticate(pam_handle_t *pamh, /* switch back to arbitrator credentials */ openpam_restore_cred(pamh); - skip_keys: /* * If we tried an old token and didn't get anything, and * try_first_pass was specified, try again after prompting the From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 18:46:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0FC11065676; Sun, 11 Dec 2011 18:46:14 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B78478FC08; Sun, 11 Dec 2011 18:46:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBIkEVR064251; Sun, 11 Dec 2011 18:46:14 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBIkE65064248; Sun, 11 Dec 2011 18:46:14 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201112111846.pBBIkE65064248@svn.freebsd.org> From: Jack F Vogel Date: Sun, 11 Dec 2011 18:46:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228415 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 18:46:15 -0000 Author: jfv Date: Sun Dec 11 18:46:14 2011 New Revision: 228415 URL: http://svn.freebsd.org/changeset/base/228415 Log: Last change still had an issue, one more time... Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sun Dec 11 17:32:37 2011 (r228414) +++ head/sys/dev/e1000/if_em.c Sun Dec 11 18:46:14 2011 (r228415) @@ -1045,8 +1045,8 @@ em_ioctl(struct ifnet *ifp, u_long comma struct ifreq *ifr = (struct ifreq *)data; #if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; - bool avoid_reset = FALSE; #endif + bool avoid_reset = FALSE; int error = 0; if (adapter->in_detach) @@ -1062,7 +1062,6 @@ em_ioctl(struct ifnet *ifp, u_long comma if (ifa->ifa_addr->sa_family == AF_INET6) avoid_reset = TRUE; #endif -#if defined(INET) || defined(INET6) /* ** Calling init results in link renegotiation, ** so we avoid doing it when possible. @@ -1071,11 +1070,12 @@ em_ioctl(struct ifnet *ifp, u_long comma ifp->if_flags |= IFF_UP; if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) em_init(adapter); +#ifdef INET if (!(ifp->if_flags & IFF_NOARP)) arp_ifinit(ifp, ifa); +#endif } else error = ether_ioctl(ifp, command, data); -#endif break; case SIOCSIFMTU: { Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Sun Dec 11 17:32:37 2011 (r228414) +++ head/sys/dev/e1000/if_igb.c Sun Dec 11 18:46:14 2011 (r228415) @@ -992,8 +992,8 @@ igb_ioctl(struct ifnet *ifp, u_long comm struct ifreq *ifr = (struct ifreq *)data; #if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; - bool avoid_reset = FALSE; #endif + bool avoid_reset = FALSE; int error = 0; if (adapter->in_detach) @@ -1009,7 +1009,6 @@ igb_ioctl(struct ifnet *ifp, u_long comm if (ifa->ifa_addr->sa_family == AF_INET6) avoid_reset = TRUE; #endif -#if defined(INET) || defined(INET6) /* ** Calling init results in link renegotiation, ** so we avoid doing it when possible. @@ -1018,11 +1017,12 @@ igb_ioctl(struct ifnet *ifp, u_long comm ifp->if_flags |= IFF_UP; if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) igb_init(adapter); +#ifdef INET if (!(ifp->if_flags & IFF_NOARP)) arp_ifinit(ifp, ifa); +#endif } else error = ether_ioctl(ifp, command, data); -#endif break; case SIOCSIFMTU: { From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 19:22:42 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B57CA106566B; Sun, 11 Dec 2011 19:22:42 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A57488FC0C; Sun, 11 Dec 2011 19:22:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBJMgNG065455; Sun, 11 Dec 2011 19:22:42 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBJMgB1065453; Sun, 11 Dec 2011 19:22:42 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112111922.pBBJMgB1065453@svn.freebsd.org> From: Ed Schouten Date: Sun, 11 Dec 2011 19:22:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228416 - head/usr.sbin/powerd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 19:22:42 -0000 Author: ed Date: Sun Dec 11 19:22:42 2011 New Revision: 228416 URL: http://svn.freebsd.org/changeset/base/228416 Log: Add missing static keyword. All global variables and functions in powerd are marked static, except this array of strings. Add the keyword, for consistency. Modified: head/usr.sbin/powerd/powerd.c Modified: head/usr.sbin/powerd/powerd.c ============================================================================== --- head/usr.sbin/powerd/powerd.c Sun Dec 11 18:46:14 2011 (r228415) +++ head/usr.sbin/powerd/powerd.c Sun Dec 11 19:22:42 2011 (r228416) @@ -71,7 +71,7 @@ typedef enum { SRC_UNKNOWN, } power_src_t; -const char *modes[] = { +static const char *modes[] = { "AC", "battery", "unknown" From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 19:28:04 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA2A1106564A; Sun, 11 Dec 2011 19:28:04 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA52F8FC0C; Sun, 11 Dec 2011 19:28:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBJS42W065650; Sun, 11 Dec 2011 19:28:04 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBJS4Nb065648; Sun, 11 Dec 2011 19:28:04 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112111928.pBBJS4Nb065648@svn.freebsd.org> From: Ed Schouten Date: Sun, 11 Dec 2011 19:28:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228417 - head/sbin/bsdlabel X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 19:28:04 -0000 Author: ed Date: Sun Dec 11 19:28:04 2011 New Revision: 228417 URL: http://svn.freebsd.org/changeset/base/228417 Log: Add missing static keyword. All global variables and functions are marked static. Simply because this is an enum, doesn't mean we can't do so as well. Modified: head/sbin/bsdlabel/bsdlabel.c Modified: head/sbin/bsdlabel/bsdlabel.c ============================================================================== --- head/sbin/bsdlabel/bsdlabel.c Sun Dec 11 19:22:42 2011 (r228416) +++ head/sbin/bsdlabel/bsdlabel.c Sun Dec 11 19:28:04 2011 (r228417) @@ -130,7 +130,7 @@ static int labelsoffset = LABELSECTOR; static int labeloffset = LABELOFFSET; static int bbsize = BBSIZE; -enum { +static enum { UNSPEC, EDIT, READ, RESTORE, WRITE, WRITEBOOT } op = UNSPEC; From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 19:53:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E5821065670; Sun, 11 Dec 2011 19:53:12 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E2D98FC0A; Sun, 11 Dec 2011 19:53:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBJrBSk066473; Sun, 11 Dec 2011 19:53:11 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBJrBbF066471; Sun, 11 Dec 2011 19:53:11 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201112111953.pBBJrBbF066471@svn.freebsd.org> From: Glen Barber Date: Sun, 11 Dec 2011 19:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228418 - head/share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 19:53:12 -0000 Author: gjb (doc committer) Date: Sun Dec 11 19:53:11 2011 New Revision: 228418 URL: http://svn.freebsd.org/changeset/base/228418 Log: Document the SVN variable needs to be set in make.conf(5) when SVN_UPDATE is set. PR: 163162 Submitted by: Oliver Hartmann Patch by: Benjamin Kaduk (original) MFC after: 1 week Modified: head/share/man/man5/make.conf.5 Modified: head/share/man/man5/make.conf.5 ============================================================================== --- head/share/man/man5/make.conf.5 Sun Dec 11 19:28:04 2011 (r228417) +++ head/share/man/man5/make.conf.5 Sun Dec 11 19:53:11 2011 (r228418) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 16, 2011 +.Dd December 11, 2011 .Dt MAKE.CONF 5 .Os .Sh NAME @@ -333,6 +333,12 @@ to update your .Pa src tree with .Dq Li "make update" . +Note that since a subversion client is not included in the base system, +you will need to set +.Va SVN +to the full path of a +.Xr svn 1 +binary. .It Va WWWSUPFILE .Pq Vt str The www From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 20:01:37 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EF241065672; Sun, 11 Dec 2011 20:01:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EF668FC13; Sun, 11 Dec 2011 20:01:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBK1bre066866; Sun, 11 Dec 2011 20:01:37 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBK1bfm066864; Sun, 11 Dec 2011 20:01:37 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201112112001.pBBK1bfm066864@svn.freebsd.org> From: Glen Barber Date: Sun, 11 Dec 2011 20:01:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228419 - head/share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 20:01:37 -0000 Author: gjb (doc committer) Date: Sun Dec 11 20:01:37 2011 New Revision: 228419 URL: http://svn.freebsd.org/changeset/base/228419 Log: Minor whitespace cleanup to make.conf(5). MFC after: 1 week X-MFC-With: 228418 Modified: head/share/man/man5/make.conf.5 Modified: head/share/man/man5/make.conf.5 ============================================================================== --- head/share/man/man5/make.conf.5 Sun Dec 11 19:53:11 2011 (r228418) +++ head/share/man/man5/make.conf.5 Sun Dec 11 20:01:37 2011 (r228419) @@ -500,7 +500,7 @@ rather than load the server's kernel. .Pq Vt bool Defining this and recompiling .Pa /usr/src/sys/boot/i386 -will add +will add .Xr dcons 4 console driver to .Xr loader 8 @@ -640,7 +640,7 @@ The default value is 0640. .Pq Vt str Additional maps to rebuild when using .Pa /etc/mail/Makefile . -The +The .Pa access , .Pa bitdomain , .Pa domaintable , From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 20:38:37 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 377FA1065672; Sun, 11 Dec 2011 20:38:37 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D78A8FC0A; Sun, 11 Dec 2011 20:38:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBKcb2f067990; Sun, 11 Dec 2011 20:38:37 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBKcaWD067988; Sun, 11 Dec 2011 20:38:37 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201112112038.pBBKcaWD067988@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Sun, 11 Dec 2011 20:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228420 - stable/8/lib/libpam/modules/pam_ssh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 20:38:37 -0000 Author: des Date: Sun Dec 11 20:38:36 2011 New Revision: 228420 URL: http://svn.freebsd.org/changeset/base/228420 Log: MFH r227757: check for null passphrases, since openssl doesn't Security: prevents users with unencrypted ssh keys (prohibited unless the nullok option is specified) from logging in by providing a bogus non-null passphrase. Modified: stable/8/lib/libpam/modules/pam_ssh/pam_ssh.c Directory Properties: stable/8/lib/libpam/ (props changed) Modified: stable/8/lib/libpam/modules/pam_ssh/pam_ssh.c ============================================================================== --- stable/8/lib/libpam/modules/pam_ssh/pam_ssh.c Sun Dec 11 20:01:37 2011 (r228419) +++ stable/8/lib/libpam/modules/pam_ssh/pam_ssh.c Sun Dec 11 20:38:36 2011 (r228420) @@ -91,7 +91,8 @@ static char *const pam_ssh_agent_envp[] * struct pam_ssh_key containing the key and its comment. */ static struct pam_ssh_key * -pam_ssh_load_key(const char *dir, const char *kfn, const char *passphrase) +pam_ssh_load_key(const char *dir, const char *kfn, const char *passphrase, + int nullok) { struct pam_ssh_key *psk; char fn[PATH_MAX]; @@ -101,7 +102,21 @@ pam_ssh_load_key(const char *dir, const if (snprintf(fn, sizeof(fn), "%s/%s", dir, kfn) > (int)sizeof(fn)) return (NULL); comment = NULL; - key = key_load_private(fn, passphrase, &comment); + /* + * If the key is unencrypted, OpenSSL ignores the passphrase, so + * it will seem like the user typed in the right one. This allows + * a user to circumvent nullok by providing a dummy passphrase. + * Verify that the key really *is* encrypted by trying to load it + * with an empty passphrase, and if the key is not encrypted, + * accept only an empty passphrase. + */ + key = key_load_private(fn, NULL, &comment); + if (key != NULL && !(*passphrase == '\0' && nullok)) { + key_free(key); + return (NULL); + } + if (key == NULL) + key = key_load_private(fn, passphrase, &comment); if (key == NULL) { openpam_log(PAM_LOG_DEBUG, "failed to load key from %s\n", fn); return (NULL); @@ -168,9 +183,6 @@ pam_sm_authenticate(pam_handle_t *pamh, if (pam_err != PAM_SUCCESS) return (pam_err); - if (*passphrase == '\0' && !nullok) - goto skip_keys; - /* switch to user credentials */ pam_err = openpam_borrow_cred(pamh, pwd); if (pam_err != PAM_SUCCESS) @@ -178,7 +190,7 @@ pam_sm_authenticate(pam_handle_t *pamh, /* try to load keys from all keyfiles we know of */ for (kfn = pam_ssh_keyfiles; *kfn != NULL; ++kfn) { - psk = pam_ssh_load_key(pwd->pw_dir, *kfn, passphrase); + psk = pam_ssh_load_key(pwd->pw_dir, *kfn, passphrase, nullok); if (psk != NULL) { pam_set_data(pamh, *kfn, psk, pam_ssh_free_key); ++nkeys; @@ -188,7 +200,6 @@ pam_sm_authenticate(pam_handle_t *pamh, /* switch back to arbitrator credentials */ openpam_restore_cred(pamh); - skip_keys: /* * If we tried an old token and didn't get anything, and * try_first_pass was specified, try again after prompting the From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 20:40:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CE4F1065670; Sun, 11 Dec 2011 20:40:24 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 132238FC13; Sun, 11 Dec 2011 20:40:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBKeNZL068091; Sun, 11 Dec 2011 20:40:23 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBKeNOa068089; Sun, 11 Dec 2011 20:40:23 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201112112040.pBBKeNOa068089@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Sun, 11 Dec 2011 20:40:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228421 - stable/7/lib/libpam/modules/pam_ssh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 20:40:24 -0000 Author: des Date: Sun Dec 11 20:40:23 2011 New Revision: 228421 URL: http://svn.freebsd.org/changeset/base/228421 Log: MFH r227757: check for null passphrases, since openssl doesn't Security: prevents users with unencrypted ssh keys (prohibited unless the nullok option is specified) from logging in by providing a bogus non-null passphrase. Modified: stable/7/lib/libpam/modules/pam_ssh/pam_ssh.c Directory Properties: stable/7/lib/libpam/ (props changed) Modified: stable/7/lib/libpam/modules/pam_ssh/pam_ssh.c ============================================================================== --- stable/7/lib/libpam/modules/pam_ssh/pam_ssh.c Sun Dec 11 20:38:36 2011 (r228420) +++ stable/7/lib/libpam/modules/pam_ssh/pam_ssh.c Sun Dec 11 20:40:23 2011 (r228421) @@ -88,7 +88,8 @@ static char *const pam_ssh_agent_envp[] * struct pam_ssh_key containing the key and its comment. */ static struct pam_ssh_key * -pam_ssh_load_key(const char *dir, const char *kfn, const char *passphrase) +pam_ssh_load_key(const char *dir, const char *kfn, const char *passphrase, + int nullok) { struct pam_ssh_key *psk; char fn[PATH_MAX]; @@ -98,7 +99,21 @@ pam_ssh_load_key(const char *dir, const if (snprintf(fn, sizeof(fn), "%s/%s", dir, kfn) > (int)sizeof(fn)) return (NULL); comment = NULL; - key = key_load_private(fn, passphrase, &comment); + /* + * If the key is unencrypted, OpenSSL ignores the passphrase, so + * it will seem like the user typed in the right one. This allows + * a user to circumvent nullok by providing a dummy passphrase. + * Verify that the key really *is* encrypted by trying to load it + * with an empty passphrase, and if the key is not encrypted, + * accept only an empty passphrase. + */ + key = key_load_private(fn, NULL, &comment); + if (key != NULL && !(*passphrase == '\0' && nullok)) { + key_free(key); + return (NULL); + } + if (key == NULL) + key = key_load_private(fn, passphrase, &comment); if (key == NULL) { openpam_log(PAM_LOG_DEBUG, "failed to load key from %s\n", fn); return (NULL); @@ -165,9 +180,6 @@ pam_sm_authenticate(pam_handle_t *pamh, if (pam_err != PAM_SUCCESS) return (pam_err); - if (*passphrase == '\0' && !nullok) - goto skip_keys; - /* switch to user credentials */ pam_err = openpam_borrow_cred(pamh, pwd); if (pam_err != PAM_SUCCESS) @@ -175,7 +187,7 @@ pam_sm_authenticate(pam_handle_t *pamh, /* try to load keys from all keyfiles we know of */ for (kfn = pam_ssh_keyfiles; *kfn != NULL; ++kfn) { - psk = pam_ssh_load_key(pwd->pw_dir, *kfn, passphrase); + psk = pam_ssh_load_key(pwd->pw_dir, *kfn, passphrase, nullok); if (psk != NULL) { pam_set_data(pamh, *kfn, psk, pam_ssh_free_key); ++nkeys; @@ -185,7 +197,6 @@ pam_sm_authenticate(pam_handle_t *pamh, /* switch back to arbitrator credentials */ openpam_restore_cred(pamh); - skip_keys: /* * If we tried an old token and didn't get anything, and * try_first_pass was specified, try again after prompting the From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 20:48:40 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF7FB106566B; Sun, 11 Dec 2011 20:48:40 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE9B88FC0C; Sun, 11 Dec 2011 20:48:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBKmeJc068408; Sun, 11 Dec 2011 20:48:40 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBKmeFb068406; Sun, 11 Dec 2011 20:48:40 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112112048.pBBKmeFb068406@svn.freebsd.org> From: Ed Schouten Date: Sun, 11 Dec 2011 20:48:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228422 - head/sbin/rcorder X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 20:48:40 -0000 Author: ed Date: Sun Dec 11 20:48:40 2011 New Revision: 228422 URL: http://svn.freebsd.org/changeset/base/228422 Log: Add more static keywords to rcorder(8). The global variables and functions provided by rcorder.c are not used in the other C files, as the other C files only provide memory allocation and hash functions. This reduces the binary size by 10%. Modified: head/sbin/rcorder/rcorder.c Modified: head/sbin/rcorder/rcorder.c ============================================================================== --- head/sbin/rcorder/rcorder.c Sun Dec 11 20:40:23 2011 (r228421) +++ head/sbin/rcorder/rcorder.c Sun Dec 11 20:48:40 2011 (r228422) @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); #include "hash.h" #ifdef DEBUG -int debug = 0; +static int debug = 0; # define DPRINTF(args) if (debug) { fflush(stdout); fprintf args; } #else # define DPRINTF(args) @@ -124,33 +124,32 @@ struct filenode { strnodelist *keyword_list; }; -filenode fn_head_s, *fn_head; +static filenode fn_head_s, *fn_head; -strnodelist *bl_list; -strnodelist *keep_list; -strnodelist *skip_list; - -void do_file(filenode *fnode); -void strnode_add(strnodelist **, char *, filenode *); -int skip_ok(filenode *fnode); -int keep_ok(filenode *fnode); -void satisfy_req(f_reqnode *rnode, char *filename); -void crunch_file(char *); -void parse_require(filenode *, char *); -void parse_provide(filenode *, char *); -void parse_before(filenode *, char *); -void parse_keywords(filenode *, char *); -filenode *filenode_new(char *); -void add_require(filenode *, char *); -void add_provide(filenode *, char *); -void add_before(filenode *, char *); -void add_keyword(filenode *, char *); -void insert_before(void); -Hash_Entry *make_fake_provision(filenode *); -void crunch_all_files(void); -void initialize(void); -void generate_ordering(void); -int main(int, char *[]); +static strnodelist *bl_list; +static strnodelist *keep_list; +static strnodelist *skip_list; + +static void do_file(filenode *fnode); +static void strnode_add(strnodelist **, char *, filenode *); +static int skip_ok(filenode *fnode); +static int keep_ok(filenode *fnode); +static void satisfy_req(f_reqnode *rnode, char *filename); +static void crunch_file(char *); +static void parse_require(filenode *, char *); +static void parse_provide(filenode *, char *); +static void parse_before(filenode *, char *); +static void parse_keywords(filenode *, char *); +static filenode *filenode_new(char *); +static void add_require(filenode *, char *); +static void add_provide(filenode *, char *); +static void add_before(filenode *, char *); +static void add_keyword(filenode *, char *); +static void insert_before(void); +static Hash_Entry *make_fake_provision(filenode *); +static void crunch_all_files(void); +static void initialize(void); +static void generate_ordering(void); int main(int argc, char *argv[]) @@ -196,7 +195,7 @@ main(int argc, char *argv[]) /* * initialise various variables. */ -void +static void initialize(void) { @@ -207,7 +206,7 @@ initialize(void) } /* generic function to insert a new strnodelist element */ -void +static void strnode_add(strnodelist **listp, char *s, filenode *fnode) { strnodelist *ent; @@ -229,7 +228,7 @@ strnode_add(strnodelist **listp, char *s * we have a new filename, create a new filenode structure. * fill in the bits, and put it in the filenode linked list */ -filenode * +static filenode * filenode_new(char *filename) { filenode *temp; @@ -257,7 +256,7 @@ filenode_new(char *filename) /* * add a requirement to a filenode. */ -void +static void add_require(filenode *fnode, char *s) { Hash_Entry *entry; @@ -277,7 +276,7 @@ add_require(filenode *fnode, char *s) * add a provision to a filenode. if this provision doesn't * have a head node, create one here. */ -void +static void add_provide(filenode *fnode, char *s) { Hash_Entry *entry; @@ -356,7 +355,7 @@ add_provide(filenode *fnode, char *s) /* * put the BEFORE: lines to a list and handle them later. */ -void +static void add_before(filenode *fnode, char *s) { strnodelist *bf_ent; @@ -371,7 +370,7 @@ add_before(filenode *fnode, char *s) /* * add a key to a filenode. */ -void +static void add_keyword(filenode *fnode, char *s) { @@ -382,7 +381,7 @@ add_keyword(filenode *fnode, char *s) * loop over the rest of a REQUIRE line, giving each word to * add_require() to do the real work. */ -void +static void parse_require(filenode *node, char *buffer) { char *s; @@ -396,7 +395,7 @@ parse_require(filenode *node, char *buff * loop over the rest of a PROVIDE line, giving each word to * add_provide() to do the real work. */ -void +static void parse_provide(filenode *node, char *buffer) { char *s; @@ -410,7 +409,7 @@ parse_provide(filenode *node, char *buff * loop over the rest of a BEFORE line, giving each word to * add_before() to do the real work. */ -void +static void parse_before(filenode *node, char *buffer) { char *s; @@ -424,7 +423,7 @@ parse_before(filenode *node, char *buffe * loop over the rest of a KEYWORD line, giving each word to * add_keyword() to do the real work. */ -void +static void parse_keywords(filenode *node, char *buffer) { char *s; @@ -438,7 +437,7 @@ parse_keywords(filenode *node, char *buf * given a file name, create a filenode for it, read in lines looking * for provision and requirement lines, building the graphs as needed. */ -void +static void crunch_file(char *filename) { FILE *fp; @@ -510,7 +509,7 @@ crunch_file(char *filename) fclose(fp); } -Hash_Entry * +static Hash_Entry * make_fake_provision(filenode *node) { Hash_Entry *entry; @@ -556,7 +555,7 @@ make_fake_provision(filenode *node) * for each entry in the provision list for S, add a requirement to * that provisions filenode for P. */ -void +static void insert_before(void) { Hash_Entry *entry, *fake_prov_entry; @@ -594,7 +593,7 @@ insert_before(void) * real work. after we have built all the nodes, insert the BEFORE: * lines into graph(s). */ -void +static void crunch_all_files(void) { int i; @@ -619,7 +618,7 @@ crunch_all_files(void) * calling do_file() (enter recursion) for each filenode in this * provision. */ -void +static void satisfy_req(f_reqnode *rnode, char *filename) { Hash_Entry *entry; @@ -660,7 +659,7 @@ satisfy_req(f_reqnode *rnode, char *file do_file(head->next->fnode); } -int +static int skip_ok(filenode *fnode) { strnodelist *s; @@ -674,7 +673,7 @@ skip_ok(filenode *fnode) return (1); } -int +static int keep_ok(filenode *fnode) { strnodelist *s; @@ -699,7 +698,7 @@ keep_ok(filenode *fnode) * safely free() anything related to items that may be recursed on. * Circular dependancies will cause problems if we do. */ -void +static void do_file(filenode *fnode) { f_reqnode *r, *r_tmp; @@ -782,7 +781,7 @@ do_file(filenode *fnode) #endif } -void +static void generate_ordering(void) { From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 20:53:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 857C9106566B; Sun, 11 Dec 2011 20:53:12 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7596D8FC12; Sun, 11 Dec 2011 20:53:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBKrCFB068633; Sun, 11 Dec 2011 20:53:12 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBKrCAM068631; Sun, 11 Dec 2011 20:53:12 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112112053.pBBKrCAM068631@svn.freebsd.org> From: Ed Schouten Date: Sun, 11 Dec 2011 20:53:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228423 - head/bin/chio X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 20:53:12 -0000 Author: ed Date: Sun Dec 11 20:53:12 2011 New Revision: 228423 URL: http://svn.freebsd.org/changeset/base/228423 Log: Add static keywords to chio(1). All other global variables are already marked static, so for consistency sake, add them to these three arrays as well. Modified: head/bin/chio/chio.c Modified: head/bin/chio/chio.c ============================================================================== --- head/bin/chio/chio.c Sun Dec 11 20:48:40 2011 (r228422) +++ head/bin/chio/chio.c Sun Dec 11 20:53:12 2011 (r228423) @@ -87,7 +87,7 @@ static int do_voltag(const char *, int, #endif /* Valid changer element types. */ -const struct element_type elements[] = { +static const struct element_type elements[] = { { "drive", CHET_DT }, { "picker", CHET_MT }, { "portal", CHET_IE }, @@ -97,7 +97,7 @@ const struct element_type elements[] = { }; /* Valid commands. */ -const struct changer_command commands[] = { +static const struct changer_command commands[] = { { "exchange", do_exchange }, { "getpicker", do_getpicker }, { "ielem", do_ielem }, @@ -112,7 +112,7 @@ const struct changer_command commands[] }; /* Valid special words. */ -const struct special_word specials[] = { +static const struct special_word specials[] = { { "inv", SW_INVERT }, { "inv1", SW_INVERT1 }, { "inv2", SW_INVERT2 }, From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 21:02:02 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C609B106566B; Sun, 11 Dec 2011 21:02:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4D928FC0A; Sun, 11 Dec 2011 21:02:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBL21ho068981; Sun, 11 Dec 2011 21:02:01 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBL21kB068967; Sun, 11 Dec 2011 21:02:01 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112112102.pBBL21kB068967@svn.freebsd.org> From: Andriy Gapon Date: Sun, 11 Dec 2011 21:02:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228424 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 21:02:02 -0000 Author: avg Date: Sun Dec 11 21:02:01 2011 New Revision: 228424 URL: http://svn.freebsd.org/changeset/base/228424 Log: panic: add a switch and infrastructure for stopping other CPUs in SMP case Historical behavior of letting other CPUs merily go on is a default for time being. The new behavior can be switched on via kern.stop_scheduler_on_panic tunable and sysctl. Stopping of the CPUs has (at least) the following benefits: - more of the system state at panic time is preserved intact - threads and interrupts do not interfere with dumping of the system state Only one thread runs uninterrupted after panic if stop_scheduler_on_panic is set. That thread might call code that is also used in normal context and that code might use locks to prevent concurrent execution of certain parts. Those locks might be held by the stopped threads and would never be released. To work around this issue, it was decided that instead of explicit checks for panic context, we would rather put those checks inside the locking primitives. This change has substantial portions written and re-written by attilio and kib at various times. Other changes are heavily based on the ideas and patches submitted by jhb and mdf. bde has provided many insights into the details and history of the current code. The new behavior may cause problems for systems that use a USB keyboard for interfacing with system console. This is because of some unusual locking patterns in the ukbd code which have to be used because on one hand ukbd is below syscons, but on the other hand it has to interface with other usb code that uses regular mutexes/Giant for its concurrency protection. Dumping to USB-connected disks may also be affected. PR: amd64/139614 (at least) In cooperation with: attilio, jhb, kib, mdf Discussed with: arch@, bde Tested by: Eugene Grosbein , gnn, Steven Hartland , glebius, Andrew Boyer (various versions of the patch) MFC after: 3 months (or never) Modified: head/sys/kern/kern_lock.c head/sys/kern/kern_mutex.c head/sys/kern/kern_rmlock.c head/sys/kern/kern_rwlock.c head/sys/kern/kern_shutdown.c head/sys/kern/kern_sx.c head/sys/kern/kern_synch.c head/sys/kern/subr_kdb.c head/sys/kern/subr_lock.c head/sys/kern/subr_witness.c head/sys/sys/lockstat.h head/sys/sys/mutex.h head/sys/sys/systm.h Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Sun Dec 11 20:53:12 2011 (r228423) +++ head/sys/kern/kern_lock.c Sun Dec 11 21:02:01 2011 (r228424) @@ -1232,6 +1232,9 @@ _lockmgr_disown(struct lock *lk, const c { uintptr_t tid, x; + if (SCHEDULER_STOPPED()) + return; + tid = (uintptr_t)curthread; _lockmgr_assert(lk, KA_XLOCKED | KA_NOTRECURSED, file, line); Modified: head/sys/kern/kern_mutex.c ============================================================================== --- head/sys/kern/kern_mutex.c Sun Dec 11 20:53:12 2011 (r228423) +++ head/sys/kern/kern_mutex.c Sun Dec 11 21:02:01 2011 (r228424) @@ -192,6 +192,8 @@ void _mtx_lock_flags(struct mtx *m, int opts, const char *file, int line) { + if (SCHEDULER_STOPPED()) + return; MPASS(curthread != NULL); KASSERT(m->mtx_lock != MTX_DESTROYED, ("mtx_lock() of destroyed mutex @ %s:%d", file, line)); @@ -211,6 +213,9 @@ _mtx_lock_flags(struct mtx *m, int opts, void _mtx_unlock_flags(struct mtx *m, int opts, const char *file, int line) { + + if (SCHEDULER_STOPPED()) + return; MPASS(curthread != NULL); KASSERT(m->mtx_lock != MTX_DESTROYED, ("mtx_unlock() of destroyed mutex @ %s:%d", file, line)); @@ -232,6 +237,8 @@ void _mtx_lock_spin_flags(struct mtx *m, int opts, const char *file, int line) { + if (SCHEDULER_STOPPED()) + return; MPASS(curthread != NULL); KASSERT(m->mtx_lock != MTX_DESTROYED, ("mtx_lock_spin() of destroyed mutex @ %s:%d", file, line)); @@ -254,6 +261,8 @@ void _mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file, int line) { + if (SCHEDULER_STOPPED()) + return; MPASS(curthread != NULL); KASSERT(m->mtx_lock != MTX_DESTROYED, ("mtx_unlock_spin() of destroyed mutex @ %s:%d", file, line)); @@ -282,6 +291,9 @@ mtx_trylock_flags_(struct mtx *m, int op #endif int rval; + if (SCHEDULER_STOPPED()) + return (1); + MPASS(curthread != NULL); KASSERT(m->mtx_lock != MTX_DESTROYED, ("mtx_trylock() of destroyed mutex @ %s:%d", file, line)); @@ -338,6 +350,9 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t int64_t sleep_time = 0; #endif + if (SCHEDULER_STOPPED()) + return; + if (mtx_owned(m)) { KASSERT((m->lock_object.lo_flags & LO_RECURSABLE) != 0, ("_mtx_lock_sleep: recursed on non-recursive mutex %s @ %s:%d\n", @@ -508,6 +523,9 @@ _mtx_lock_spin(struct mtx *m, uintptr_t uint64_t waittime = 0; #endif + if (SCHEDULER_STOPPED()) + return; + if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_lock_spin: %p spinning", m); @@ -555,6 +573,10 @@ thread_lock_flags_(struct thread *td, in i = 0; tid = (uintptr_t)curthread; + + if (SCHEDULER_STOPPED()) + return; + for (;;) { retry: spinlock_enter(); @@ -656,6 +678,9 @@ _mtx_unlock_sleep(struct mtx *m, int opt { struct turnstile *ts; + if (SCHEDULER_STOPPED()) + return; + if (mtx_recursed(m)) { if (--(m->mtx_recurse) == 0) atomic_clear_ptr(&m->mtx_lock, MTX_RECURSED); Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Sun Dec 11 20:53:12 2011 (r228423) +++ head/sys/kern/kern_rmlock.c Sun Dec 11 21:02:01 2011 (r228424) @@ -344,6 +344,9 @@ _rm_rlock(struct rmlock *rm, struct rm_p struct thread *td = curthread; struct pcpu *pc; + if (SCHEDULER_STOPPED()) + return (1); + tracker->rmp_flags = 0; tracker->rmp_thread = td; tracker->rmp_rmlock = rm; @@ -413,6 +416,9 @@ _rm_runlock(struct rmlock *rm, struct rm struct pcpu *pc; struct thread *td = tracker->rmp_thread; + if (SCHEDULER_STOPPED()) + return; + td->td_critnest++; /* critical_enter(); */ pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */ rm_tracker_remove(pc, tracker); @@ -432,6 +438,9 @@ _rm_wlock(struct rmlock *rm) struct turnstile *ts; cpuset_t readcpus; + if (SCHEDULER_STOPPED()) + return; + if (rm->lock_object.lo_flags & RM_SLEEPABLE) sx_xlock(&rm->rm_lock_sx); else @@ -486,6 +495,9 @@ _rm_wunlock(struct rmlock *rm) void _rm_wlock_debug(struct rmlock *rm, const char *file, int line) { + if (SCHEDULER_STOPPED()) + return; + WITNESS_CHECKORDER(&rm->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file, line, NULL); @@ -507,6 +519,9 @@ void _rm_wunlock_debug(struct rmlock *rm, const char *file, int line) { + if (SCHEDULER_STOPPED()) + return; + curthread->td_locks--; if (rm->lock_object.lo_flags & RM_SLEEPABLE) WITNESS_UNLOCK(&rm->rm_lock_sx.lock_object, LOP_EXCLUSIVE, @@ -521,6 +536,10 @@ int _rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker, int trylock, const char *file, int line) { + + if (SCHEDULER_STOPPED()) + return (1); + if (!trylock && (rm->lock_object.lo_flags & RM_SLEEPABLE)) WITNESS_CHECKORDER(&rm->rm_lock_sx.lock_object, LOP_NEWORDER, file, line, NULL); @@ -544,6 +563,9 @@ _rm_runlock_debug(struct rmlock *rm, str const char *file, int line) { + if (SCHEDULER_STOPPED()) + return; + curthread->td_locks--; WITNESS_UNLOCK(&rm->lock_object, 0, file, line); LOCK_LOG_LOCK("RMRUNLOCK", &rm->lock_object, 0, 0, file, line); Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Sun Dec 11 20:53:12 2011 (r228423) +++ head/sys/kern/kern_rwlock.c Sun Dec 11 21:02:01 2011 (r228424) @@ -233,6 +233,8 @@ void _rw_wlock(struct rwlock *rw, const char *file, int line) { + if (SCHEDULER_STOPPED()) + return; MPASS(curthread != NULL); KASSERT(rw->rw_lock != RW_DESTROYED, ("rw_wlock() of destroyed rwlock @ %s:%d", file, line)); @@ -249,6 +251,9 @@ _rw_try_wlock(struct rwlock *rw, const c { int rval; + if (SCHEDULER_STOPPED()) + return (1); + KASSERT(rw->rw_lock != RW_DESTROYED, ("rw_try_wlock() of destroyed rwlock @ %s:%d", file, line)); @@ -273,6 +278,8 @@ void _rw_wunlock(struct rwlock *rw, const char *file, int line) { + if (SCHEDULER_STOPPED()) + return; MPASS(curthread != NULL); KASSERT(rw->rw_lock != RW_DESTROYED, ("rw_wunlock() of destroyed rwlock @ %s:%d", file, line)); @@ -317,6 +324,9 @@ _rw_rlock(struct rwlock *rw, const char int64_t sleep_time = 0; #endif + if (SCHEDULER_STOPPED()) + return; + KASSERT(rw->rw_lock != RW_DESTROYED, ("rw_rlock() of destroyed rwlock @ %s:%d", file, line)); KASSERT(rw_wowner(rw) != curthread, @@ -499,6 +509,9 @@ _rw_try_rlock(struct rwlock *rw, const c { uintptr_t x; + if (SCHEDULER_STOPPED()) + return (1); + for (;;) { x = rw->rw_lock; KASSERT(rw->rw_lock != RW_DESTROYED, @@ -525,6 +538,9 @@ _rw_runlock(struct rwlock *rw, const cha struct turnstile *ts; uintptr_t x, v, queue; + if (SCHEDULER_STOPPED()) + return; + KASSERT(rw->rw_lock != RW_DESTROYED, ("rw_runlock() of destroyed rwlock @ %s:%d", file, line)); _rw_assert(rw, RA_RLOCKED, file, line); @@ -650,6 +666,9 @@ _rw_wlock_hard(struct rwlock *rw, uintpt int64_t sleep_time = 0; #endif + if (SCHEDULER_STOPPED()) + return; + if (rw_wlocked(rw)) { KASSERT(rw->lock_object.lo_flags & LO_RECURSABLE, ("%s: recursing but non-recursive rw %s @ %s:%d\n", @@ -814,6 +833,9 @@ _rw_wunlock_hard(struct rwlock *rw, uint uintptr_t v; int queue; + if (SCHEDULER_STOPPED()) + return; + if (rw_wlocked(rw) && rw_recursed(rw)) { rw->rw_recurse--; if (LOCK_LOG_TEST(&rw->lock_object, 0)) @@ -876,6 +898,9 @@ _rw_try_upgrade(struct rwlock *rw, const struct turnstile *ts; int success; + if (SCHEDULER_STOPPED()) + return (1); + KASSERT(rw->rw_lock != RW_DESTROYED, ("rw_try_upgrade() of destroyed rwlock @ %s:%d", file, line)); _rw_assert(rw, RA_RLOCKED, file, line); @@ -946,6 +971,9 @@ _rw_downgrade(struct rwlock *rw, const c uintptr_t tid, v; int rwait, wwait; + if (SCHEDULER_STOPPED()) + return; + KASSERT(rw->rw_lock != RW_DESTROYED, ("rw_downgrade() of destroyed rwlock @ %s:%d", file, line)); _rw_assert(rw, RA_WLOCKED | RA_NOTRECURSED, file, line); Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Sun Dec 11 20:53:12 2011 (r228423) +++ head/sys/kern/kern_shutdown.c Sun Dec 11 21:02:01 2011 (r228424) @@ -121,6 +121,11 @@ SYSCTL_INT(_kern, OID_AUTO, sync_on_pani &sync_on_panic, 0, "Do a sync before rebooting from a panic"); TUNABLE_INT("kern.sync_on_panic", &sync_on_panic); +static int stop_scheduler_on_panic = 0; +SYSCTL_INT(_kern, OID_AUTO, stop_scheduler_on_panic, CTLFLAG_RW | CTLFLAG_TUN, + &stop_scheduler_on_panic, 0, "stop scheduler upon entering panic"); +TUNABLE_INT("kern.stop_scheduler_on_panic", &stop_scheduler_on_panic); + static SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, "Shutdown environment"); @@ -138,6 +143,7 @@ SYSCTL_INT(_kern_shutdown, OID_AUTO, sho */ const char *panicstr; +int stop_scheduler; /* system stopped CPUs for panic */ int dumping; /* system is dumping */ int rebooting; /* system is rebooting */ static struct dumperinfo dumper; /* our selected dumper */ @@ -294,10 +300,12 @@ kern_reboot(int howto) * systems don't shutdown properly (i.e., ACPI power off) if we * run on another processor. */ - thread_lock(curthread); - sched_bind(curthread, 0); - thread_unlock(curthread); - KASSERT(PCPU_GET(cpuid) == 0, ("%s: not running on cpu 0", __func__)); + if (!SCHEDULER_STOPPED()) { + thread_lock(curthread); + sched_bind(curthread, 0); + thread_unlock(curthread); + KASSERT(PCPU_GET(cpuid) == 0, ("boot: not running on cpu 0")); + } #endif /* We're in the process of rebooting. */ rebooting = 1; @@ -547,13 +555,18 @@ panic(const char *fmt, ...) { #ifdef SMP static volatile u_int panic_cpu = NOCPU; + cpuset_t other_cpus; #endif struct thread *td = curthread; int bootopt, newpanic; va_list ap; static char buf[256]; - critical_enter(); + if (stop_scheduler_on_panic) + spinlock_enter(); + else + critical_enter(); + #ifdef SMP /* * We don't want multiple CPU's to panic at the same time, so we @@ -566,6 +579,22 @@ panic(const char *fmt, ...) PCPU_GET(cpuid)) == 0) while (panic_cpu != NOCPU) ; /* nothing */ + + if (stop_scheduler_on_panic) { + if (panicstr == NULL && !kdb_active) { + other_cpus = all_cpus; + CPU_CLR(PCPU_GET(cpuid), &other_cpus); + stop_cpus_hard(other_cpus); + } + + /* + * We set stop_scheduler here and not in the block above, + * because we want to ensure that if panic has been called and + * stop_scheduler_on_panic is true, then stop_scheduler will + * always be set. Even if panic has been entered from kdb. + */ + stop_scheduler = 1; + } #endif bootopt = RB_AUTOBOOT; @@ -604,7 +633,8 @@ panic(const char *fmt, ...) /* thread_unlock(td); */ if (!sync_on_panic) bootopt |= RB_NOSYNC; - critical_exit(); + if (!stop_scheduler_on_panic) + critical_exit(); kern_reboot(bootopt); } Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Sun Dec 11 20:53:12 2011 (r228423) +++ head/sys/kern/kern_sx.c Sun Dec 11 21:02:01 2011 (r228424) @@ -241,6 +241,8 @@ _sx_slock(struct sx *sx, int opts, const { int error = 0; + if (SCHEDULER_STOPPED()) + return (0); MPASS(curthread != NULL); KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, ("sx_slock() of destroyed sx @ %s:%d", file, line)); @@ -260,6 +262,9 @@ sx_try_slock_(struct sx *sx, const char { uintptr_t x; + if (SCHEDULER_STOPPED()) + return (1); + for (;;) { x = sx->sx_lock; KASSERT(x != SX_LOCK_DESTROYED, @@ -283,6 +288,8 @@ _sx_xlock(struct sx *sx, int opts, const { int error = 0; + if (SCHEDULER_STOPPED()) + return (0); MPASS(curthread != NULL); KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, ("sx_xlock() of destroyed sx @ %s:%d", file, line)); @@ -304,6 +311,9 @@ sx_try_xlock_(struct sx *sx, const char { int rval; + if (SCHEDULER_STOPPED()) + return (1); + MPASS(curthread != NULL); KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, ("sx_try_xlock() of destroyed sx @ %s:%d", file, line)); @@ -330,6 +340,8 @@ void _sx_sunlock(struct sx *sx, const char *file, int line) { + if (SCHEDULER_STOPPED()) + return; MPASS(curthread != NULL); KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, ("sx_sunlock() of destroyed sx @ %s:%d", file, line)); @@ -345,6 +357,8 @@ void _sx_xunlock(struct sx *sx, const char *file, int line) { + if (SCHEDULER_STOPPED()) + return; MPASS(curthread != NULL); KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, ("sx_xunlock() of destroyed sx @ %s:%d", file, line)); @@ -369,6 +383,9 @@ sx_try_upgrade_(struct sx *sx, const cha uintptr_t x; int success; + if (SCHEDULER_STOPPED()) + return (1); + KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, ("sx_try_upgrade() of destroyed sx @ %s:%d", file, line)); _sx_assert(sx, SA_SLOCKED, file, line); @@ -399,6 +416,9 @@ sx_downgrade_(struct sx *sx, const char uintptr_t x; int wakeup_swapper; + if (SCHEDULER_STOPPED()) + return; + KASSERT(sx->sx_lock != SX_LOCK_DESTROYED, ("sx_downgrade() of destroyed sx @ %s:%d", file, line)); _sx_assert(sx, SA_XLOCKED | SA_NOTRECURSED, file, line); @@ -481,6 +501,9 @@ _sx_xlock_hard(struct sx *sx, uintptr_t int64_t sleep_time = 0; #endif + if (SCHEDULER_STOPPED()) + return (0); + /* If we already hold an exclusive lock, then recurse. */ if (sx_xlocked(sx)) { KASSERT((sx->lock_object.lo_flags & LO_RECURSABLE) != 0, @@ -681,6 +704,9 @@ _sx_xunlock_hard(struct sx *sx, uintptr_ uintptr_t x; int queue, wakeup_swapper; + if (SCHEDULER_STOPPED()) + return; + MPASS(!(sx->sx_lock & SX_LOCK_SHARED)); /* If the lock is recursed, then unrecurse one level. */ @@ -753,6 +779,9 @@ _sx_slock_hard(struct sx *sx, int opts, int64_t sleep_time = 0; #endif + if (SCHEDULER_STOPPED()) + return (0); + /* * As with rwlocks, we don't make any attempt to try to block * shared locks once there is an exclusive waiter. @@ -919,6 +948,9 @@ _sx_sunlock_hard(struct sx *sx, const ch uintptr_t x; int wakeup_swapper; + if (SCHEDULER_STOPPED()) + return; + for (;;) { x = sx->sx_lock; Modified: head/sys/kern/kern_synch.c ============================================================================== --- head/sys/kern/kern_synch.c Sun Dec 11 20:53:12 2011 (r228423) +++ head/sys/kern/kern_synch.c Sun Dec 11 21:02:01 2011 (r228424) @@ -158,7 +158,7 @@ _sleep(void *ident, struct lock_object * else class = NULL; - if (cold) { + if (cold || SCHEDULER_STOPPED()) { /* * During autoconfiguration, just return; * don't run any other threads or panic below, @@ -260,7 +260,7 @@ msleep_spin(void *ident, struct mtx *mtx KASSERT(p != NULL, ("msleep1")); KASSERT(ident != NULL && TD_IS_RUNNING(td), ("msleep")); - if (cold) { + if (cold || SCHEDULER_STOPPED()) { /* * During autoconfiguration, just return; * don't run any other threads or panic below, @@ -429,6 +429,8 @@ mi_switch(int flags, struct thread *newt */ if (kdb_active) kdb_switch(); + if (SCHEDULER_STOPPED()) + return; if (flags & SW_VOL) { td->td_ru.ru_nvcsw++; td->td_swvoltick = ticks; Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Sun Dec 11 20:53:12 2011 (r228423) +++ head/sys/kern/subr_kdb.c Sun Dec 11 21:02:01 2011 (r228424) @@ -226,13 +226,7 @@ kdb_sysctl_trap_code(SYSCTL_HANDLER_ARGS void kdb_panic(const char *msg) { -#ifdef SMP - cpuset_t other_cpus; - other_cpus = all_cpus; - CPU_CLR(PCPU_GET(cpuid), &other_cpus); - stop_cpus_hard(other_cpus); -#endif printf("KDB: panic\n"); panic("%s", msg); } @@ -594,6 +588,9 @@ kdb_trap(int type, int code, struct trap struct kdb_dbbe *be; register_t intr; int handled; +#ifdef SMP + int did_stop_cpus; +#endif be = kdb_dbbe; if (be == NULL || be->dbbe_trap == NULL) @@ -606,9 +603,13 @@ kdb_trap(int type, int code, struct trap intr = intr_disable(); #ifdef SMP - other_cpus = all_cpus; - CPU_CLR(PCPU_GET(cpuid), &other_cpus); - stop_cpus_hard(other_cpus); + if (!SCHEDULER_STOPPED()) { + other_cpus = all_cpus; + CPU_CLR(PCPU_GET(cpuid), &other_cpus); + stop_cpus_hard(other_cpus); + did_stop_cpus = 1; + } else + did_stop_cpus = 0; #endif kdb_active++; @@ -634,7 +635,8 @@ kdb_trap(int type, int code, struct trap kdb_active--; #ifdef SMP - restart_cpus(stopped_cpus); + if (did_stop_cpus) + restart_cpus(stopped_cpus); #endif intr_restore(intr); Modified: head/sys/kern/subr_lock.c ============================================================================== --- head/sys/kern/subr_lock.c Sun Dec 11 20:53:12 2011 (r228423) +++ head/sys/kern/subr_lock.c Sun Dec 11 21:02:01 2011 (r228424) @@ -532,6 +532,9 @@ lock_profile_obtain_lock_success(struct struct lock_profile_object *l; int spin; + if (SCHEDULER_STOPPED()) + return; + /* don't reset the timer when/if recursing */ if (!lock_prof_enable || (lo->lo_flags & LO_NOPROFILE)) return; @@ -596,6 +599,8 @@ lock_profile_release_lock(struct lock_ob struct lpohead *head; int spin; + if (SCHEDULER_STOPPED()) + return; if (lo->lo_flags & LO_NOPROFILE) return; spin = (LOCK_CLASS(lo)->lc_flags & LC_SPINLOCK) ? 1 : 0; Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Sun Dec 11 20:53:12 2011 (r228423) +++ head/sys/kern/subr_witness.c Sun Dec 11 21:02:01 2011 (r228424) @@ -2162,6 +2162,13 @@ witness_save(struct lock_object *lock, c struct lock_instance *instance; struct lock_class *class; + /* + * This function is used independently in locking code to deal with + * Giant, SCHEDULER_STOPPED() check can be removed here after Giant + * is gone. + */ + if (SCHEDULER_STOPPED()) + return; KASSERT(witness_cold == 0, ("%s: witness_cold", __func__)); if (lock->lo_witness == NULL || witness_watch == -1 || panicstr != NULL) return; @@ -2188,6 +2195,13 @@ witness_restore(struct lock_object *lock struct lock_instance *instance; struct lock_class *class; + /* + * This function is used independently in locking code to deal with + * Giant, SCHEDULER_STOPPED() check can be removed here after Giant + * is gone. + */ + if (SCHEDULER_STOPPED()) + return; KASSERT(witness_cold == 0, ("%s: witness_cold", __func__)); if (lock->lo_witness == NULL || witness_watch == -1 || panicstr != NULL) return; Modified: head/sys/sys/lockstat.h ============================================================================== --- head/sys/sys/lockstat.h Sun Dec 11 20:53:12 2011 (r228423) +++ head/sys/sys/lockstat.h Sun Dec 11 21:02:01 2011 (r228424) @@ -185,17 +185,24 @@ extern uint64_t lockstat_nsecs(void); #define LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l) do { \ uint32_t id; \ \ - lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, f, l); \ - if ((id = lockstat_probemap[(probe)])) \ - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); \ + if (!SCHEDULER_STOPPED()) { \ + lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, \ + f, l); \ + if ((id = lockstat_probemap[(probe)])) \ + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, \ + 0, 0); \ + } \ } while (0) #define LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp) do { \ uint32_t id; \ \ - lock_profile_release_lock(&(lp)->lock_object); \ - if ((id = lockstat_probemap[(probe)])) \ - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); \ + if (!SCHEDULER_STOPPED()) { \ + lock_profile_release_lock(&(lp)->lock_object); \ + if ((id = lockstat_probemap[(probe)])) \ + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, \ + 0, 0); \ + } \ } while (0) #else /* !KDTRACE_HOOKS */ Modified: head/sys/sys/mutex.h ============================================================================== --- head/sys/sys/mutex.h Sun Dec 11 20:53:12 2011 (r228423) +++ head/sys/sys/mutex.h Sun Dec 11 21:02:01 2011 (r228424) @@ -370,7 +370,8 @@ do { \ \ if (mtx_owned(&Giant)) { \ WITNESS_SAVE(&Giant.lock_object, Giant); \ - for (_giantcnt = 0; mtx_owned(&Giant); _giantcnt++) \ + for (_giantcnt = 0; mtx_owned(&Giant) && \ + !SCHEDULER_STOPPED(); _giantcnt++) \ mtx_unlock(&Giant); \ } Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Sun Dec 11 20:53:12 2011 (r228423) +++ head/sys/sys/systm.h Sun Dec 11 21:02:01 2011 (r228424) @@ -47,6 +47,7 @@ extern int cold; /* nonzero if we are doing a cold boot */ extern int rebooting; /* kern_reboot() has been called. */ +extern int stop_scheduler; /* only one thread runs after panic */ extern const char *panicstr; /* panic message */ extern char version[]; /* system version */ extern char copyright[]; /* system copyright */ @@ -109,6 +110,14 @@ enum VM_GUEST { VM_GUEST_NO = 0, VM_GUES ((uintptr_t)&(var) & (sizeof(void *) - 1)) == 0, msg) /* + * If we have already panic'd and this is the thread that called + * panic(), then don't block on any mutexes but silently succeed. + * Otherwise, the kernel will deadlock since the scheduler isn't + * going to run the thread that holds any lock we need. + */ +#define SCHEDULER_STOPPED() __predict_false(stop_scheduler) + +/* * XXX the hints declarations are even more misplaced than most declarations * in this file, since they are needed in one file (per arch) and only used * in two files. From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 21:02:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF278106566B; Sun, 11 Dec 2011 21:02:33 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF4408FC0C; Sun, 11 Dec 2011 21:02:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBL2XnZ069034; Sun, 11 Dec 2011 21:02:33 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBL2XQs069032; Sun, 11 Dec 2011 21:02:33 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112112102.pBBL2XQs069032@svn.freebsd.org> From: Ed Schouten Date: Sun, 11 Dec 2011 21:02:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228425 - head/usr.sbin/vidcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 21:02:34 -0000 Author: ed Date: Sun Dec 11 21:02:33 2011 New Revision: 228425 URL: http://svn.freebsd.org/changeset/base/228425 Log: Add static keywords to vidcontrol(1). While there, remove the false optimisation of the colors array. It seems that changing it to an array of pointers instead of a 16x16 array does not cause any increase in binary size at all. Modified: head/usr.sbin/vidcontrol/vidcontrol.c Modified: head/usr.sbin/vidcontrol/vidcontrol.c ============================================================================== --- head/usr.sbin/vidcontrol/vidcontrol.c Sun Dec 11 21:02:01 2011 (r228424) +++ head/usr.sbin/vidcontrol/vidcontrol.c Sun Dec 11 21:02:33 2011 (r228425) @@ -63,7 +63,7 @@ static const char rcsid[] = /* Screen dump file format revision */ #define DUMP_FMT_REV 1 -char legal_colors[16][16] = { +static const char *legal_colors[16] = { "black", "blue", "green", "cyan", "red", "magenta", "brown", "white", "grey", "lightblue", "lightgreen", "lightcyan", @@ -78,18 +78,16 @@ struct { struct video_info video_mode_info; } cur_info; -int hex = 0; -int number; -int vesa_cols; -int vesa_rows; -int font_height; -int colors_changed; -int video_mode_changed; -int normal_fore_color, normal_back_color; -int revers_fore_color, revers_back_color; -char letter; -struct vid_info info; -struct video_info new_mode_info; +static int hex = 0; +static int vesa_cols; +static int vesa_rows; +static int font_height; +static int colors_changed; +static int video_mode_changed; +static int normal_fore_color, normal_back_color; +static int revers_fore_color, revers_back_color; +static struct vid_info info; +static struct video_info new_mode_info; /* From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 21:10:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2ACAB106566B; Sun, 11 Dec 2011 21:10:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AEE68FC08; Sun, 11 Dec 2011 21:10:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBBLABKp069308; Sun, 11 Dec 2011 21:10:11 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBBLABRe069305; Sun, 11 Dec 2011 21:10:11 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112112110.pBBLABRe069305@svn.freebsd.org> From: Andriy Gapon Date: Sun, 11 Dec 2011 21:10:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228426 - head/sys/dev/syscons X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 21:10:12 -0000 Author: avg Date: Sun Dec 11 21:10:11 2011 New Revision: 228426 URL: http://svn.freebsd.org/changeset/base/228426 Log: syscons: make sc_puts static as it is used only privately Perhaps sc_puts should also be renamed to scputs to follow the implied naming conventions in the file... MFC after: 2 weeks Modified: head/sys/dev/syscons/syscons.c head/sys/dev/syscons/syscons.h Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Sun Dec 11 21:02:33 2011 (r228425) +++ head/sys/dev/syscons/syscons.c Sun Dec 11 21:10:11 2011 (r228426) @@ -185,6 +185,7 @@ static void scshutdown(void *, int); static void scsuspend(void *); static void scresume(void *); static u_int scgetc(sc_softc_t *sc, u_int flags); +static void sc_puts(scr_stat *scp, u_char *buf, int len, int kernel); #define SCGETC_CN 1 #define SCGETC_NONBLOCK 2 static void sccnupdate(scr_stat *scp); @@ -2603,7 +2604,7 @@ exchange_scr(sc_softc_t *sc) mark_all(scp); } -void +static void sc_puts(scr_stat *scp, u_char *buf, int len, int kernel) { int need_unlock = 0; Modified: head/sys/dev/syscons/syscons.h ============================================================================== --- head/sys/dev/syscons/syscons.h Sun Dec 11 21:02:33 2011 (r228425) +++ head/sys/dev/syscons/syscons.h Sun Dec 11 21:10:11 2011 (r228426) @@ -562,7 +562,6 @@ void sc_save_font(scr_stat *scp, int pa void sc_show_font(scr_stat *scp, int page); void sc_touch_scrn_saver(void); -void sc_puts(scr_stat *scp, u_char *buf, int len, int kernel); void sc_draw_cursor_image(scr_stat *scp); void sc_remove_cursor_image(scr_stat *scp); void sc_set_cursor_image(scr_stat *scp); From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 21:12:09 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62B13106566B; Sun, 11 Dec 2011 21:12:09 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id D0CF18FC0A; Sun, 11 Dec 2011 21:12:08 +0000 (UTC) Received: from deuterium.andreas.nets (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id pBBLA06F089408; Sun, 11 Dec 2011 22:10:02 +0100 (CET) (envelope-from andreast@FreeBSD.org) Message-ID: <4EE51CA3.9060809@FreeBSD.org> Date: Sun, 11 Dec 2011 22:12:03 +0100 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: David Chisnall References: <201112072117.pB7LHoaL055972@svn.freebsd.org> <4EE120D7.10903@FreeBSD.org> In-Reply-To: <4EE120D7.10903@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228330 - in head: include sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 21:12:09 -0000 On 08.12.11 21:40, Andreas Tobler wrote: > On 07.12.11 22:17, David Chisnall wrote: >> Author: theraven >> Date: Wed Dec 7 21:17:50 2011 >> New Revision: 228330 >> URL: http://svn.freebsd.org/changeset/base/228330 >> >> Log: >> As per das@'s suggestion, s/__noreturn/_Noreturn/, since the latter is an >> identifier reserved for the implementation in C99 and earlier so there is >> no sensible reason for introducing yet another reserved identifier when we >> could just use the one C1x uses. >> >> Approved by: brooks (mentor) > >> Modified: head/sys/sys/cdefs.h >> ============================================================================== >> --- head/sys/sys/cdefs.h Wed Dec 7 21:02:35 2011 (r228329) >> +++ head/sys/sys/cdefs.h Wed Dec 7 21:17:50 2011 (r228330) >> @@ -220,13 +220,13 @@ >> >> >> #if defined(__cplusplus)&& __cplusplus>= 201103L >> -#define __noreturn [[noreturn]] >> +#define _Noreturn [[noreturn]] >> #elif defined(__STDC_VERSION__)&& __STDC_VERSION__> 201000L >> -#define __noreturn _Noreturn >> +/* Do nothing - _Noreturn is a keyword */ >> #elif defined(__GNUC__) >> -#define __noreturn __attribute__((__noreturn__)) >> +#define _Noreturn __attribute__((__noreturn__)) > > This and the previous commit broke bootstrapping gcc. > The problem is this: > /export/devel/build/gcc/head/objdir/./gcc/include-fixed/stdlib.h:96:1: > error: expected unqualified-id before '[' token > > Line in question is: _Noreturn void abort(void); > Where _Noreturn gets expanded to [[noreturn]] > > I helped myself with adding the below. Well. No clue if it is correct. > But at least I can continue building gcc trunk. As far as I understand, GCC does not support this attribute [[noreturn]] yet. But it defines both, __cplusplus and __cplusplus=201103L. On gcc-4.7 __cplusplus=201103L is the default when we build libstdc++. So I think we have to extend the check as below or we can reorder the defines that GNUC is before the __cplusplus && __cplusplus>= 201103L. I'd appreciate any comments on this. Thanks, Andreas > Index: cdefs.h > =================================================================== > --- cdefs.h (revision 228352) > +++ cdefs.h (working copy) > @@ -219,7 +219,7 @@ > #endif > > > -#if defined(__cplusplus)&& __cplusplus>= 201103L > +#if defined(__cplusplus)&& __cplusplus>= 201103L&& !defined(__GNUC__) > #define _Noreturn [[noreturn]] > #elif defined(__STDC_VERSION__)&& __STDC_VERSION__> 201000L > /* Do nothing - _Noreturn is a keyword */ From owner-svn-src-all@FreeBSD.ORG Sun Dec 11 21:15:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96390106566B; Sun, 11 Dec 2011 21:15:43 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id 36B618FC0C; Sun, 11 Dec 2011 21:15:43 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id 3A1382A28CC9; Sun, 11 Dec 2011 22:15:42 +0100 (CET) Date: Sun, 11 Dec 2011 22:15:42 +0100 From: Ed Schouten To: David Chisnall Message-ID: <20111211211542.GQ59489@hoeg.nl> References: <201112072117.pB7LHoaL055972@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lpUp1egui7PDlNtH" Content-Disposition: inline In-Reply-To: <201112072117.pB7LHoaL055972@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228330 - in head: include sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 11 Dec 2011 21:15:43 -0000 --lpUp1egui7PDlNtH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * David Chisnall , 20111207 22:17: > As per das@'s suggestion, s/__noreturn/_Noreturn/, since the latter is = an > identifier reserved for the implementation in C99 and earlier so there = is > no sensible reason for introducing yet another reserved identifier when= we > could just use the one C1x uses. So this is the same as __dead2, right? Maybe we should do a sweep of the tree and replace all __dead2's by _Noreturn? --=20 Ed Schouten WWW: http://80386.nl/ --lpUp1egui7PDlNtH Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iQIcBAEBAgAGBQJO5R19AAoJEG5e2P40kaK7s5kP/2LfBVoXLPIWkNHICllWyma1 S1pcW0IVGkYp7DYjQjC+2SejAwE1PK5iHCvBImll2NXcZDR6n8b1Fp13IogMBdb4 JA6t8zHCs2GrjHqZxY42hmy/2yqQqoGrp2f+ABYyeBYxlC3YULUg5gqewjpv5XP1 +9PYEiYU4uWoDMQqTYsUsi48SL0+IUkSo4EmJTXdNYoeausdLDs+TgEpd8eWCBlq hk2qu+LnmDcZY/MOKdbumMd9MGDhj9mhciwyHyCuf4BCrOq3qCc2B2lFBkXzEpM3 azDDYsHGV1t5RBrsn7T/Xj2eVR9jp5h2nbMH2DnCzc2/1Q++5zrYUUxhdWME71CC uUxZKTCX5j1o56f6/E8FyLlq09y2sA9ShnP4450WvNGofHG2lZGq5aKFWO18ibjm ltvRCKjowQB7hp1XQVfs5uv5aGNXxGxTJWtFMXj7/au4lRIByO2IT8nZRYHJq4Fb FBIAjj8HlS43J2RPPZDjGdonSdc/Ez43FGoHOWRatfW0zKkF/i5J7ozFPFLJN+Up ZMFsZMJ8fgUueymMkNt1AgNt2yegHcyJUuqNyyBWWxIKg09SFLt6wxgg/KS/1e9M orlIlDHF0SGEtpozSlT83cynIunXYGLOel6QO2umgzxXlXjpr4EpQZrJ2qXfUO+c 9SIjokjw9yf0alE5PSYE =GVq/ -----END PGP SIGNATURE----- --lpUp1egui7PDlNtH-- From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 07:46:10 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA5461065670; Mon, 12 Dec 2011 07:46:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9E528FC13; Mon, 12 Dec 2011 07:46:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBC7kAv4089107; Mon, 12 Dec 2011 07:46:10 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBC7kAmF089105; Mon, 12 Dec 2011 07:46:10 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112120746.pBC7kAmF089105@svn.freebsd.org> From: Andriy Gapon Date: Mon, 12 Dec 2011 07:46:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228430 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 07:46:10 -0000 Author: avg Date: Mon Dec 12 07:46:10 2011 New Revision: 228430 URL: http://svn.freebsd.org/changeset/base/228430 Log: kern_racct: move sys/systm.h inclusion to its proper place This should fix the build failure introduced with r228424. Also remove duplicate inclusion of sys/param.h. Pointyhat to: avg MFC after: 1 week Modified: head/sys/kern/kern_racct.c Modified: head/sys/kern/kern_racct.c ============================================================================== --- head/sys/kern/kern_racct.c Sun Dec 11 23:19:57 2011 (r228429) +++ head/sys/kern/kern_racct.c Mon Dec 12 07:46:10 2011 (r228430) @@ -35,8 +35,8 @@ __FBSDID("$FreeBSD$"); #include "opt_kdtrace.h" #include +#include #include -#include #include #include #include @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #ifdef RCTL From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 09:21:14 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFB061065673; Mon, 12 Dec 2011 09:21:14 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 5B38D8FC16; Mon, 12 Dec 2011 09:21:14 +0000 (UTC) Received: from lstewart1.loshell.room52.net (ppp59-167-184-191.static.internode.on.net [59.167.184.191]) by lauren.room52.net (Postfix) with ESMTPSA id 1178C7E824; Mon, 12 Dec 2011 20:21:12 +1100 (EST) Message-ID: <4EE5C787.9080905@freebsd.org> Date: Mon, 12 Dec 2011 20:21:11 +1100 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0.1) Gecko/20111016 Thunderbird/7.0.1 MIME-Version: 1.0 To: Andriy Gapon References: <201112120746.pBC7kAmF089105@svn.freebsd.org> In-Reply-To: <201112120746.pBC7kAmF089105@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228430 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 09:21:14 -0000 On 12/12/11 18:46, Andriy Gapon wrote: > Author: avg > Date: Mon Dec 12 07:46:10 2011 > New Revision: 228430 > URL: http://svn.freebsd.org/changeset/base/228430 > > Log: > kern_racct: move sys/systm.h inclusion to its proper place > > This should fix the build failure introduced with r228424. > Also remove duplicate inclusion of sys/param.h. > > Pointyhat to: avg > MFC after: 1 week lstewart@lstewart3:head> svn up Updating '.': At revision 228430. lstewart@lstewart3:head> make -DNO_CLEAN KERNCONF=LINT buildkernel [...] cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -std=c99 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/work/svn/freebsd_mirror/head/sys -I/work/svn/freebsd_mirror/head/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -DGPROF -falign-functions=16 -DGPROF4 -DGUPROF -fno-builtin -fno-omit-frame-pointer -mno-sse -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror -pg -mprofiler-epilogue /work/svn/freebsd_mirror/head/sys/kern/kern_sx.c cc1: warnings being treated as errors In file included from /work/svn/freebsd_mirror/head/sys/kern/kern_sx.c:52: /work/svn/freebsd_mirror/head/sys/sys/sx.h: In function '__sx_xlock': /work/svn/freebsd_mirror/head/sys/sys/sx.h:154: warning: implicit declaration of function 'SCHEDULER_STOPPED' /work/svn/freebsd_mirror/head/sys/sys/sx.h:154: warning: nested extern declaration of 'SCHEDULER_STOPPED' [-Wnested-externs] *** Error code 1 Stop in /usr/obj/work/svn/freebsd_mirror/head/sys/LINT. *** Error code 1 Stop in /work/svn/freebsd_mirror/head. *** Error code 1 Stop in /work/svn/freebsd_mirror/head. Perhaps another place which needs a fix similar to r228430? Cheers, Lawrence From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 09:50:13 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4F6E106564A; Mon, 12 Dec 2011 09:50:13 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 77BAF8FC17; Mon, 12 Dec 2011 09:50:13 +0000 (UTC) Received: from lstewart1.loshell.room52.net (ppp59-167-184-191.static.internode.on.net [59.167.184.191]) by lauren.room52.net (Postfix) with ESMTPSA id 6ED477E820; Mon, 12 Dec 2011 20:50:12 +1100 (EST) Message-ID: <4EE5CE54.3060401@freebsd.org> Date: Mon, 12 Dec 2011 20:50:12 +1100 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0.1) Gecko/20111016 Thunderbird/7.0.1 MIME-Version: 1.0 To: Andriy Gapon References: <201112120746.pBC7kAmF089105@svn.freebsd.org> <4EE5C787.9080905@freebsd.org> In-Reply-To: <4EE5C787.9080905@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228430 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 09:50:13 -0000 On 12/12/11 20:21, Lawrence Stewart wrote: > On 12/12/11 18:46, Andriy Gapon wrote: >> Author: avg >> Date: Mon Dec 12 07:46:10 2011 >> New Revision: 228430 >> URL: http://svn.freebsd.org/changeset/base/228430 >> >> Log: >> kern_racct: move sys/systm.h inclusion to its proper place >> >> This should fix the build failure introduced with r228424. >> Also remove duplicate inclusion of sys/param.h. >> >> Pointyhat to: avg >> MFC after: 1 week > > > lstewart@lstewart3:head> svn up > Updating '.': > At revision 228430. > lstewart@lstewart3:head> make -DNO_CLEAN KERNCONF=LINT buildkernel > [...] > cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -std=c99 -Wall > -Wredundant-decls -Wnested-externs -Wstrict-prototypes > -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef > -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs > -fdiagnostics-show-option -nostdinc -I. > -I/work/svn/freebsd_mirror/head/sys > -I/work/svn/freebsd_mirror/head/sys/contrib/altq -D_KERNEL > -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common > -finline-limit=8000 --param inline-unit-growth=100 --param > large-function-growth=1000 -DGPROF -falign-functions=16 -DGPROF4 > -DGUPROF -fno-builtin -fno-omit-frame-pointer -mno-sse -mcmodel=kernel > -mno-red-zone -mno-mmx -msoft-float -fno-asynchronous-unwind-tables > -ffreestanding -fstack-protector -Werror -pg -mprofiler-epilogue > /work/svn/freebsd_mirror/head/sys/kern/kern_sx.c > cc1: warnings being treated as errors > In file included from /work/svn/freebsd_mirror/head/sys/kern/kern_sx.c:52: > /work/svn/freebsd_mirror/head/sys/sys/sx.h: In function '__sx_xlock': > /work/svn/freebsd_mirror/head/sys/sys/sx.h:154: warning: implicit > declaration of function 'SCHEDULER_STOPPED' > /work/svn/freebsd_mirror/head/sys/sys/sx.h:154: warning: nested extern > declaration of 'SCHEDULER_STOPPED' [-Wnested-externs] > *** Error code 1 > > Stop in /usr/obj/work/svn/freebsd_mirror/head/sys/LINT. > *** Error code 1 > > Stop in /work/svn/freebsd_mirror/head. > *** Error code 1 > > Stop in /work/svn/freebsd_mirror/head. > > > > Perhaps another place which needs a fix similar to r228430? Other files that also require fixing: sys/kern/vfs_cache.c sys/security/mac/mac_framework.c sys/security/mac/mac_priv.c Cheers, Lawrence From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 09:50:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52EB61065670; Mon, 12 Dec 2011 09:50:34 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EC958FC14; Mon, 12 Dec 2011 09:50:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBC9oYUW093080; Mon, 12 Dec 2011 09:50:34 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBC9oYXp093069; Mon, 12 Dec 2011 09:50:34 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201112120950.pBC9oYXp093069@svn.freebsd.org> From: Fabien Thomas Date: Mon, 12 Dec 2011 09:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228431 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/viawd sys/i386/conf sys/modules sys/modules/viawd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 09:50:34 -0000 Author: fabient Date: Mon Dec 12 09:50:33 2011 New Revision: 228431 URL: http://svn.freebsd.org/changeset/base/228431 Log: Add watchdog support for VIA south bridge chipset. Tested on VT8251, VX900 but CX700, VX800, VX855 should works. MFC after: 1 month Sponsored by: NETASQ Added: head/share/man/man4/viawd.4 (contents, props changed) head/sys/dev/viawd/ head/sys/dev/viawd/viawd.c (contents, props changed) head/sys/dev/viawd/viawd.h (contents, props changed) head/sys/modules/viawd/ head/sys/modules/viawd/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/amd64/conf/NOTES head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/i386/conf/NOTES head/sys/modules/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon Dec 12 07:46:10 2011 (r228430) +++ head/share/man/man4/Makefile Mon Dec 12 09:50:33 2011 (r228431) @@ -499,6 +499,7 @@ MAN= aac.4 \ vga.4 \ vge.4 \ viapm.4 \ + ${_viawd.4} \ vinum.4 \ vkbd.4 \ vlan.4 \ @@ -711,6 +712,7 @@ _speaker.4= speaker.4 _spkr.4= spkr.4 _tpm.4= tpm.4 _urtw.4= urtw.4 +_viawd.4= viawd.4 _wpi.4= wpi.4 _xen.4= xen.4 Added: head/share/man/man4/viawd.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/viawd.4 Mon Dec 12 09:50:33 2011 (r228431) @@ -0,0 +1,79 @@ +.\"- +.\" Copyright (c) 2011 Fabien Thomas +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 7, 2011 +.Dt VIAWD 4 +.Os +.Sh NAME +.Nm viawd +.Nd device driver for VIA south bridge watchdog timer +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device viawd" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +viawd_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides +.Xr watchdog 4 +support for the watchdog interrupt timer present on +VIA south bridge chipset (VT8251, CX700, VX800, VX855, VX900). +.Pp +The VIA south bridge have a built-in watchdog timer, +which can be enabled and disabled by user's program and set between +1 to 1023 seconds. +.Pp +The +.Nm +driver when unloaded with running watchdog will reschedule the watchdog +to 5 minutes. +.Sh SEE ALSO +.Xr watchdog 4 , +.Xr watchdog 8 , +.Xr watchdogd 8 , +.Xr watchdog 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 10.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver and this manual page were written by +.An Fabien Thomas Aq fabient@FreeBSD.org . Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Mon Dec 12 07:46:10 2011 (r228430) +++ head/sys/amd64/conf/NOTES Mon Dec 12 09:50:33 2011 (r228431) @@ -458,6 +458,7 @@ device tpm # device ichwd device amdsbwd +device viawd # # Temperature sensors: Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Mon Dec 12 07:46:10 2011 (r228430) +++ head/sys/conf/files.amd64 Mon Dec 12 09:50:33 2011 (r228431) @@ -260,6 +260,7 @@ dev/tpm/tpm.c optional tpm dev/tpm/tpm_acpi.c optional tpm acpi dev/tpm/tpm_isa.c optional tpm isa dev/uart/uart_cpu_amd64.c optional uart +dev/viawd/viawd.c optional viawd dev/wpi/if_wpi.c optional wpi isa/syscons_isa.c optional sc isa/vga_isa.c optional vga Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Mon Dec 12 07:46:10 2011 (r228430) +++ head/sys/conf/files.i386 Mon Dec 12 09:50:33 2011 (r228431) @@ -236,6 +236,7 @@ dev/tpm/tpm.c optional tpm dev/tpm/tpm_acpi.c optional tpm acpi dev/tpm/tpm_isa.c optional tpm isa dev/uart/uart_cpu_i386.c optional uart +dev/viawd/viawd.c optional viawd dev/acpica/acpi_if.m standard dev/acpi_support/acpi_wmi_if.m standard dev/wpi/if_wpi.c optional wpi Added: head/sys/dev/viawd/viawd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/viawd/viawd.c Mon Dec 12 09:50:33 2011 (r228431) @@ -0,0 +1,286 @@ +/*- + * Copyright (c) 2011 Fabien Thomas + * 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 "viawd.h" + +#define viawd_read_wd_4(sc, off) \ + bus_space_read_4((sc)->wd_bst, (sc)->wd_bsh, (off)) +#define viawd_write_wd_4(sc, off, val) \ + bus_space_write_4((sc)->wd_bst, (sc)->wd_bsh, (off), (val)) + +static struct viawd_device viawd_devices[] = { + { DEVICEID_VT8251, "VIA VT8251 watchdog timer" }, + { DEVICEID_CX700, "VIA CX700 watchdog timer" }, + { DEVICEID_VX800, "VIA VX800 watchdog timer" }, + { DEVICEID_VX855, "VIA VX855 watchdog timer" }, + { DEVICEID_VX900, "VIA VX900 watchdog timer" }, + { 0, NULL }, +}; + +static devclass_t viawd_devclass; + +static device_t +viawd_find(struct viawd_device **id_p) +{ + struct viawd_device *id; + device_t sb_dev = NULL; + + /* Look for a supported VIA south bridge. */ + for (id = viawd_devices; id->desc != NULL; ++id) + if ((sb_dev = pci_find_device(VENDORID_VIA, id->device)) != NULL) + break; + + if (sb_dev == NULL) + return (NULL); + + if (id_p != NULL) + *id_p = id; + + return (sb_dev); +} + +static void +viawd_tmr_state(struct viawd_softc *sc, int enable) +{ + uint32_t reg; + + reg = viawd_read_wd_4(sc, VIAWD_MEM_CTRL); + if (enable) + reg |= VIAWD_MEM_CTRL_TRIGGER | VIAWD_MEM_CTRL_ENABLE; + else + reg &= ~VIAWD_MEM_CTRL_ENABLE; + viawd_write_wd_4(sc, VIAWD_MEM_CTRL, reg); +} + +static void +viawd_tmr_set(struct viawd_softc *sc, unsigned int timeout) +{ + + /* Keep value in range. */ + if (timeout < VIAWD_MEM_COUNT_MIN) + timeout = VIAWD_MEM_COUNT_MIN; + else if (timeout > VIAWD_MEM_COUNT_MAX) + timeout = VIAWD_MEM_COUNT_MAX; + + viawd_write_wd_4(sc, VIAWD_MEM_COUNT, timeout); + sc->timeout = timeout; +} + +/* + * Watchdog event handler - called by the framework to enable or disable + * the watchdog or change the initial timeout value. + */ +static void +viawd_event(void *arg, unsigned int cmd, int *error) +{ + struct viawd_softc *sc = arg; + unsigned int timeout; + + /* Convert from power-of-two-ns to second. */ + cmd &= WD_INTERVAL; + timeout = ((uint64_t)1 << cmd) / 1000000000; + if (cmd) { + if (timeout != sc->timeout) + viawd_tmr_set(sc, timeout); + viawd_tmr_state(sc, 1); + *error = 0; + } else + viawd_tmr_state(sc, 0); +} + +static void +viawd_identify(driver_t *driver, device_t parent) +{ + device_t dev; + device_t sb_dev; + struct viawd_device *id_p; + + sb_dev = viawd_find(&id_p); + if (sb_dev == NULL) + return; + + /* Good, add child to bus. */ + if ((dev = device_find_child(parent, driver->name, 0)) == NULL) + dev = BUS_ADD_CHILD(parent, 0, driver->name, 0); + + if (dev == NULL) + return; + + device_set_desc_copy(dev, id_p->desc); +} + +static int +viawd_probe(device_t dev) +{ + + /* Do not claim some ISA PnP device by accident. */ + if (isa_get_logicalid(dev) != 0) + return (ENXIO); + return (0); +} + +static int +viawd_attach(device_t dev) +{ + device_t sb_dev; + struct viawd_softc *sc; + struct viawd_device *id_p; + uint32_t pmbase, reg; + + sc = device_get_softc(dev); + sc->dev = dev; + + sb_dev = viawd_find(&id_p); + if (sb_dev == NULL) { + device_printf(dev, "Can not find watchdog device.\n"); + goto fail; + } + sc->sb_dev = sb_dev; + + /* Get watchdog memory base. */ + pmbase = pci_read_config(sb_dev, VIAWD_CONFIG_BASE, 4); + if (pmbase == 0) { + device_printf(dev, + "Watchdog disabled in BIOS or hardware\n"); + goto fail; + } + + /* Allocate I/O register space. */ + sc->wd_rid = 0; + sc->wd_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->wd_rid, + pmbase, pmbase + VIAWD_MEM_LEN - 1, VIAWD_MEM_LEN, + RF_ACTIVE | RF_SHAREABLE); + if (sc->wd_res == NULL) { + device_printf(dev, "Unable to map watchdog memory\n"); + goto fail; + } + sc->wd_bst = rman_get_bustag(sc->wd_res); + sc->wd_bsh = rman_get_bushandle(sc->wd_res); + + /* Check if watchdog fired last boot. */ + reg = viawd_read_wd_4(sc, VIAWD_MEM_CTRL); + if (reg & VIAWD_MEM_CTRL_FIRED) { + device_printf(dev, + "ERROR: watchdog rebooted the system\n"); + /* Reset bit state. */ + viawd_write_wd_4(sc, VIAWD_MEM_CTRL, reg); + } + + /* Register the watchdog event handler. */ + sc->ev_tag = EVENTHANDLER_REGISTER(watchdog_list, viawd_event, sc, 0); + + return (0); +fail: + if (sc->wd_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + sc->wd_rid, sc->wd_res); + return (ENXIO); +} + +static int +viawd_detach(device_t dev) +{ + struct viawd_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + /* Deregister event handler. */ + if (sc->ev_tag != NULL) + EVENTHANDLER_DEREGISTER(watchdog_list, sc->ev_tag); + sc->ev_tag = NULL; + + /* + * Do not stop the watchdog on shutdown if active but bump the + * timer to avoid spurious reset. + */ + reg = viawd_read_wd_4(sc, VIAWD_MEM_CTRL); + if (reg & VIAWD_MEM_CTRL_ENABLE) { + viawd_tmr_set(sc, VIAWD_TIMEOUT_SHUTDOWN); + viawd_tmr_state(sc, 1); + device_printf(dev, + "Keeping watchog alive during shutdown for %d seconds\n", + VIAWD_TIMEOUT_SHUTDOWN); + } + + if (sc->wd_res != NULL) + bus_release_resource(sc->dev, SYS_RES_MEMORY, + sc->wd_rid, sc->wd_res); + + return (0); +} + +static device_method_t viawd_methods[] = { + DEVMETHOD(device_identify, viawd_identify), + DEVMETHOD(device_probe, viawd_probe), + DEVMETHOD(device_attach, viawd_attach), + DEVMETHOD(device_detach, viawd_detach), + DEVMETHOD(device_shutdown, viawd_detach), + {0,0} +}; + +static driver_t viawd_driver = { + "viawd", + viawd_methods, + sizeof(struct viawd_softc), +}; + +static int +viawd_modevent(module_t mode, int type, void *data) +{ + int error = 0; + + switch (type) { + case MOD_LOAD: + printf("viawd module loaded\n"); + break; + case MOD_UNLOAD: + printf("viawd module unloaded\n"); + break; + case MOD_SHUTDOWN: + printf("viawd module shutting down\n"); + break; + } + return (error); +} + +DRIVER_MODULE(viawd, isa, viawd_driver, viawd_devclass, viawd_modevent, NULL); Added: head/sys/dev/viawd/viawd.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/viawd/viawd.h Mon Dec 12 09:50:33 2011 (r228431) @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 2011 Fabien Thomas + * 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$ + */ + +#ifndef _VIAWD_H_ +#define _VIAWD_H_ + +struct viawd_device { + uint16_t device; + char *desc; +}; + +struct viawd_softc { + device_t dev; + device_t sb_dev; + + int wd_rid; + struct resource *wd_res; + bus_space_tag_t wd_bst; + bus_space_handle_t wd_bsh; + + eventhandler_tag ev_tag; + unsigned int timeout; +}; + +#define VENDORID_VIA 0x1106 +#define DEVICEID_VT8251 0x3287 +#define DEVICEID_CX700 0x8324 +#define DEVICEID_VX800 0x8353 +#define DEVICEID_VX855 0x8409 +#define DEVICEID_VX900 0x8410 + +#define VIAWD_CONFIG_BASE 0xE8 + +#define VIAWD_MEM_LEN 8 + +#define VIAWD_MEM_CTRL 0x00 +#define VIAWD_MEM_CTRL_TRIGGER 0x000000080 +#define VIAWD_MEM_CTRL_DISABLE 0x000000008 +#define VIAWD_MEM_CTRL_POWEROFF 0x000000004 +#define VIAWD_MEM_CTRL_FIRED 0x000000002 +#define VIAWD_MEM_CTRL_ENABLE 0x000000001 + +#define VIAWD_MEM_COUNT 0x04 + +#define VIAWD_MEM_COUNT_MIN 1 +#define VIAWD_MEM_COUNT_MAX 1023 + +#define VIAWD_TIMEOUT_SHUTDOWN (5 * 60) + +#endif Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Mon Dec 12 07:46:10 2011 (r228430) +++ head/sys/i386/conf/NOTES Mon Dec 12 09:50:33 2011 (r228431) @@ -831,6 +831,7 @@ hint.pcf.0.irq="5" # device ichwd device amdsbwd +device viawd # # Temperature sensors: Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Mon Dec 12 07:46:10 2011 (r228430) +++ head/sys/modules/Makefile Mon Dec 12 09:50:33 2011 (r228431) @@ -318,6 +318,7 @@ SUBDIR= ${_3dfx} \ ${_vesa} \ ${_virtio} \ vge \ + ${_viawd} \ vkbd \ ${_vpo} \ vr \ @@ -528,6 +529,7 @@ _nve= nve _nvram= nvram _nxge= nxge _tpm= tpm +_viawd= viawd _wpi= wpi _wpifw= wpifw .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) @@ -637,6 +639,7 @@ _sppp= sppp _tpm= tpm _twa= twa _vesa= vesa +_viawd= viawd _virtio= virtio _vxge= vxge _x86bios= x86bios Added: head/sys/modules/viawd/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/viawd/Makefile Mon Dec 12 09:50:33 2011 (r228431) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../dev/viawd + +KMOD= viawd +SRCS= viawd.c device_if.h bus_if.h pci_if.h isa_if.h + +.include From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 10:04:04 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A24C71065672; Mon, 12 Dec 2011 10:04:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 919008FC0A; Mon, 12 Dec 2011 10:04:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCA444p093640; Mon, 12 Dec 2011 10:04:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCA44vF093638; Mon, 12 Dec 2011 10:04:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112121004.pBCA44vF093638@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 12 Dec 2011 10:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228432 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 10:04:04 -0000 Author: kib Date: Mon Dec 12 10:04:04 2011 New Revision: 228432 URL: http://svn.freebsd.org/changeset/base/228432 Log: Fix printf. Submitted by: az MFC after: 1 week Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Mon Dec 12 09:50:33 2011 (r228431) +++ head/sys/vm/swap_pager.c Mon Dec 12 10:04:04 2011 (r228432) @@ -233,7 +233,7 @@ swap_reserve_by_cred(vm_ooffset_t incr, } if (!res && ppsratecheck(&lastfail, &curfail, 1)) { printf("uid %d, pid %d: swap reservation for %jd bytes failed\n", - curproc->p_pid, uip->ui_uid, incr); + uip->ui_uid, curproc->p_pid, incr); } #ifdef RACCT From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 10:05:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E4AD1065675; Mon, 12 Dec 2011 10:05:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7ECD8FC26; Mon, 12 Dec 2011 10:05:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCA5DFL093716; Mon, 12 Dec 2011 10:05:13 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCA5Dar093711; Mon, 12 Dec 2011 10:05:13 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112121005.pBCA5Dar093711@svn.freebsd.org> From: Andriy Gapon Date: Mon, 12 Dec 2011 10:05:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228433 - in head/sys: kern security/mac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 10:05:14 -0000 Author: avg Date: Mon Dec 12 10:05:13 2011 New Revision: 228433 URL: http://svn.freebsd.org/changeset/base/228433 Log: put sys/systm.h at its proper place or add it if missing Reported by: lstewart, tinderbox Pointyhat to: avg, attilio MFC after: 1 week MFC with: r228430 Modified: head/sys/kern/kern_sx.c head/sys/kern/vfs_cache.c head/sys/security/mac/mac_framework.c head/sys/security/mac/mac_priv.c Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Mon Dec 12 10:04:04 2011 (r228432) +++ head/sys/kern/kern_sx.c Mon Dec 12 10:05:13 2011 (r228433) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -51,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #if defined(SMP) && !defined(NO_ADAPTIVE_SX) #include Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Dec 12 10:04:04 2011 (r228432) +++ head/sys/kern/vfs_cache.c Mon Dec 12 10:05:13 2011 (r228433) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ktrace.h" #include +#include #include #include #include @@ -52,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #ifdef KTRACE #include Modified: head/sys/security/mac/mac_framework.c ============================================================================== --- head/sys/security/mac/mac_framework.c Mon Dec 12 10:04:04 2011 (r228432) +++ head/sys/security/mac/mac_framework.c Mon Dec 12 10:05:13 2011 (r228433) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -81,7 +82,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/security/mac/mac_priv.c ============================================================================== --- head/sys/security/mac/mac_priv.c Mon Dec 12 10:04:04 2011 (r228432) +++ head/sys/security/mac/mac_priv.c Mon Dec 12 10:05:13 2011 (r228433) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include "opt_mac.h" #include +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 10:10:49 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61CCB1065670; Mon, 12 Dec 2011 10:10:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 515758FC18; Mon, 12 Dec 2011 10:10:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCAAnoD093910; Mon, 12 Dec 2011 10:10:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCAAn9B093908; Mon, 12 Dec 2011 10:10:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112121010.pBCAAn9B093908@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 12 Dec 2011 10:10:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228434 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 10:10:49 -0000 Author: kib Date: Mon Dec 12 10:10:49 2011 New Revision: 228434 URL: http://svn.freebsd.org/changeset/base/228434 Log: Add definitions for GNU-specific STT_GNU_IFUNC symbol type, and R_{386,X86_64}_IRELATIVE relocations. MFC after: 3 weeks Modified: head/sys/sys/elf_common.h Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Mon Dec 12 10:05:13 2011 (r228433) +++ head/sys/sys/elf_common.h Mon Dec 12 10:10:49 2011 (r228434) @@ -503,6 +503,7 @@ typedef struct { #define STT_TLS 6 /* TLS object. */ #define STT_NUM 7 #define STT_LOOS 10 /* Reserved range for operating system */ +#define STT_GNU_IFUNC 10 #define STT_HIOS 12 /* specific semantics. */ #define STT_LOPROC 13 /* reserved range for processor */ #define STT_HIPROC 15 /* specific semantics. */ @@ -612,6 +613,7 @@ typedef struct { #define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */ #define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */ #define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */ +#define R_386_IRELATIVE 42 /* PLT entry resolved indirectly at runtime */ #define R_ARM_NONE 0 /* No relocation. */ #define R_ARM_PC24 1 @@ -961,6 +963,7 @@ typedef struct { #define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ #define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */ #define R_X86_64_TPOFF32 23 /* Offset in static TLS block */ +#define R_X86_64_IRELATIVE 37 #endif /* !_SYS_ELF_COMMON_H_ */ From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 10:14:45 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23A951065676; Mon, 12 Dec 2011 10:14:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id CFA638FC08; Mon, 12 Dec 2011 10:14:43 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id MAA18466; Mon, 12 Dec 2011 12:14:42 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Ra2u9-000I4K-IX; Mon, 12 Dec 2011 12:14:42 +0200 Message-ID: <4EE5D40D.4070207@FreeBSD.org> Date: Mon, 12 Dec 2011 12:14:37 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111206 Thunderbird/8.0 MIME-Version: 1.0 To: Lawrence Stewart References: <201112120746.pBC7kAmF089105@svn.freebsd.org> <4EE5C787.9080905@freebsd.org> <4EE5CE54.3060401@freebsd.org> In-Reply-To: <4EE5CE54.3060401@freebsd.org> X-Enigmail-Version: undefined Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228430 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 10:14:45 -0000 on 12/12/2011 11:50 Lawrence Stewart said the following: > On 12/12/11 20:21, Lawrence Stewart wrote: >> On 12/12/11 18:46, Andriy Gapon wrote: >>> Author: avg >>> Date: Mon Dec 12 07:46:10 2011 >>> New Revision: 228430 >>> URL: http://svn.freebsd.org/changeset/base/228430 >>> >>> Log: >>> kern_racct: move sys/systm.h inclusion to its proper place >>> >>> This should fix the build failure introduced with r228424. >>> Also remove duplicate inclusion of sys/param.h. >>> >>> Pointyhat to: avg >>> MFC after: 1 week >> >> >> lstewart@lstewart3:head> svn up >> Updating '.': >> At revision 228430. >> lstewart@lstewart3:head> make -DNO_CLEAN KERNCONF=LINT buildkernel >> [...] >> cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -std=c99 -Wall >> -Wredundant-decls -Wnested-externs -Wstrict-prototypes >> -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef >> -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs >> -fdiagnostics-show-option -nostdinc -I. >> -I/work/svn/freebsd_mirror/head/sys >> -I/work/svn/freebsd_mirror/head/sys/contrib/altq -D_KERNEL >> -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common >> -finline-limit=8000 --param inline-unit-growth=100 --param >> large-function-growth=1000 -DGPROF -falign-functions=16 -DGPROF4 >> -DGUPROF -fno-builtin -fno-omit-frame-pointer -mno-sse -mcmodel=kernel >> -mno-red-zone -mno-mmx -msoft-float -fno-asynchronous-unwind-tables >> -ffreestanding -fstack-protector -Werror -pg -mprofiler-epilogue >> /work/svn/freebsd_mirror/head/sys/kern/kern_sx.c >> cc1: warnings being treated as errors >> In file included from /work/svn/freebsd_mirror/head/sys/kern/kern_sx.c:52: >> /work/svn/freebsd_mirror/head/sys/sys/sx.h: In function '__sx_xlock': >> /work/svn/freebsd_mirror/head/sys/sys/sx.h:154: warning: implicit >> declaration of function 'SCHEDULER_STOPPED' >> /work/svn/freebsd_mirror/head/sys/sys/sx.h:154: warning: nested extern >> declaration of 'SCHEDULER_STOPPED' [-Wnested-externs] >> *** Error code 1 >> >> Stop in /usr/obj/work/svn/freebsd_mirror/head/sys/LINT. >> *** Error code 1 >> >> Stop in /work/svn/freebsd_mirror/head. >> *** Error code 1 >> >> Stop in /work/svn/freebsd_mirror/head. >> >> >> >> Perhaps another place which needs a fix similar to r228430? > > Other files that also require fixing: > > sys/kern/vfs_cache.c > sys/security/mac/mac_framework.c > sys/security/mac/mac_priv.c Thank you. I should have tried to compile LINT myself :-( -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 10:16:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B218B106566B; Mon, 12 Dec 2011 10:16:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 2C14C8FC08; Mon, 12 Dec 2011 10:16:02 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pBCAFxTq094219 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 12 Dec 2011 12:15:59 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pBCAFxLn034246; Mon, 12 Dec 2011 12:15:59 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pBCAFwse034245; Mon, 12 Dec 2011 12:15:58 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 12 Dec 2011 12:15:58 +0200 From: Kostik Belousov To: Andriy Gapon Message-ID: <20111212101558.GK50300@deviant.kiev.zoral.com.ua> References: <201112121005.pBCA5Dar093711@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5vJiDM1iby/ERrcn" Content-Disposition: inline In-Reply-To: <201112121005.pBCA5Dar093711@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228433 - in head/sys: kern security/mac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 10:16:03 -0000 --5vJiDM1iby/ERrcn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 12, 2011 at 10:05:13AM +0000, Andriy Gapon wrote: > Author: avg > Date: Mon Dec 12 10:05:13 2011 > New Revision: 228433 > URL: http://svn.freebsd.org/changeset/base/228433 >=20 > Log: > put sys/systm.h at its proper place or add it if missing > =20 > Reported by: lstewart, tinderbox > Pointyhat to: avg, attilio > MFC after: 1 week > MFC with: r228430 >=20 > Modified: > head/sys/kern/kern_sx.c > head/sys/kern/vfs_cache.c > head/sys/security/mac/mac_framework.c > head/sys/security/mac/mac_priv.c It means that previously sx.h did not required systm.h and now it does ? Might be, you should move SCHEDULER_STOPPED and stop_scheduler declarations into sys/lock.h ? --5vJiDM1iby/ERrcn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7l1F4ACgkQC3+MBN1Mb4jgVgCggvTvuKzi/7myxBU8fG/hsdlA 0P0AoNmLpw2KKd+a7ed+yp3Rzrv80waZ =cpHS -----END PGP SIGNATURE----- --5vJiDM1iby/ERrcn-- From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 10:20:43 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A48F106564A; Mon, 12 Dec 2011 10:20:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 3C8288FC15; Mon, 12 Dec 2011 10:20:41 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id MAA18621; Mon, 12 Dec 2011 12:20:39 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1Ra2zu-000I4v-Ve; Mon, 12 Dec 2011 12:20:39 +0200 Message-ID: <4EE5D574.9080303@FreeBSD.org> Date: Mon, 12 Dec 2011 12:20:36 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111206 Thunderbird/8.0 MIME-Version: 1.0 To: Kostik Belousov References: <201112121005.pBCA5Dar093711@svn.freebsd.org> <20111212101558.GK50300@deviant.kiev.zoral.com.ua> In-Reply-To: <20111212101558.GK50300@deviant.kiev.zoral.com.ua> X-Enigmail-Version: undefined Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228433 - in head/sys: kern security/mac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 10:20:43 -0000 on 12/12/2011 12:15 Kostik Belousov said the following: > On Mon, Dec 12, 2011 at 10:05:13AM +0000, Andriy Gapon wrote: >> Author: avg >> Date: Mon Dec 12 10:05:13 2011 >> New Revision: 228433 >> URL: http://svn.freebsd.org/changeset/base/228433 >> >> Log: >> put sys/systm.h at its proper place or add it if missing >> >> Reported by: lstewart, tinderbox >> Pointyhat to: avg, attilio >> MFC after: 1 week >> MFC with: r228430 >> >> Modified: >> head/sys/kern/kern_sx.c >> head/sys/kern/vfs_cache.c >> head/sys/security/mac/mac_framework.c >> head/sys/security/mac/mac_priv.c > It means that previously sx.h did not required systm.h and now it does ? > Might be, you should move SCHEDULER_STOPPED and stop_scheduler declarations > into sys/lock.h ? > Strictly speaking it's sys/lockstat.h that now requires systm.h. I am not an expert in FreeBSD header file organization, so I will just follow whatever the experts advise. -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 11:03:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6815C1065670; Mon, 12 Dec 2011 11:03:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 553518FC19; Mon, 12 Dec 2011 11:03:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCB3FCU097592; Mon, 12 Dec 2011 11:03:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCB3FuT097580; Mon, 12 Dec 2011 11:03:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112121103.pBCB3FuT097580@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 12 Dec 2011 11:03:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 11:03:15 -0000 Author: kib Date: Mon Dec 12 11:03:14 2011 New Revision: 228435 URL: http://svn.freebsd.org/changeset/base/228435 Log: Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to rtld on 386 and amd64. This adds runtime bits neccessary for the use of the dispatch functions from the dynamically-linked executables and shared libraries. To allow use of external references from the dispatch function, resolution of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries for PLT are prepared, and normal resolution of the GOT entries is finished. Similar to how it is done by GNU, IRELATIVE relocations are resolved in advance, instead of normal lazy handling for PLT. Move the init_pltgot() call before the relocations for the object are processed. MFC after: 3 weeks Modified: head/libexec/rtld-elf/amd64/reloc.c head/libexec/rtld-elf/arm/reloc.c head/libexec/rtld-elf/i386/reloc.c head/libexec/rtld-elf/ia64/reloc.c head/libexec/rtld-elf/mips/reloc.c head/libexec/rtld-elf/powerpc/reloc.c head/libexec/rtld-elf/powerpc64/reloc.c head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h head/libexec/rtld-elf/sparc64/reloc.c Modified: head/libexec/rtld-elf/amd64/reloc.c ============================================================================== --- head/libexec/rtld-elf/amd64/reloc.c Mon Dec 12 10:10:49 2011 (r228434) +++ head/libexec/rtld-elf/amd64/reloc.c Mon Dec 12 11:03:14 2011 (r228435) @@ -344,11 +344,22 @@ reloc_plt(Obj_Entry *obj) for (rela = obj->pltrela; rela < relalim; rela++) { Elf_Addr *where; - assert(ELF_R_TYPE(rela->r_info) == R_X86_64_JMP_SLOT); - - /* Relocate the GOT slot pointing into the PLT. */ - where = (Elf_Addr *)(obj->relocbase + rela->r_offset); - *where += (Elf_Addr)obj->relocbase; + switch(ELF_R_TYPE(rela->r_info)) { + case R_X86_64_JMP_SLOT: + /* Relocate the GOT slot pointing into the PLT. */ + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + *where += (Elf_Addr)obj->relocbase; + break; + + case R_X86_64_IRELATIVE: + obj->irelative = true; + break; + + default: + _rtld_error("Unknown relocation type %x in PLT", + (unsigned int)ELF_R_TYPE(rela->r_info)); + return (-1); + } } return 0; } @@ -368,19 +379,91 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS const Elf_Sym *def; const Obj_Entry *defobj; - assert(ELF_R_TYPE(rela->r_info) == R_X86_64_JMP_SLOT); - where = (Elf_Addr *)(obj->relocbase + rela->r_offset); - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, true, NULL, - lockstate); - if (def == NULL) - return -1; - target = (Elf_Addr)(defobj->relocbase + def->st_value + rela->r_addend); - reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); + switch (ELF_R_TYPE(rela->r_info)) { + case R_X86_64_JMP_SLOT: + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, true, NULL, + lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { + obj->gnu_ifunc = true; + continue; + } + target = (Elf_Addr)(defobj->relocbase + def->st_value + rela->r_addend); + reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); + break; + + case R_X86_64_IRELATIVE: + break; + + default: + _rtld_error("Unknown relocation type %x in PLT", + (unsigned int)ELF_R_TYPE(rela->r_info)); + return (-1); + } } obj->jmpslots_done = true; return 0; } +int +reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate) +{ + const Elf_Rela *relalim; + const Elf_Rela *rela; + + relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + for (rela = obj->pltrela; rela < relalim; rela++) { + Elf_Addr *where, target, *ptr; + + switch (ELF_R_TYPE(rela->r_info)) { + case R_X86_64_JMP_SLOT: + break; + + case R_X86_64_IRELATIVE: + ptr = (Elf_Addr *)(obj->relocbase + rela->r_addend); + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + target = ((Elf_Addr (*)(void))ptr)(); + *where = target; + break; + } + } + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, RtldLockState *lockstate) +{ + const Elf_Rela *relalim; + const Elf_Rela *rela; + + if (!obj->gnu_ifunc) + return (0); + relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + for (rela = obj->pltrela; rela < relalim; rela++) { + Elf_Addr *where, target; + const Elf_Sym *def; + const Obj_Entry *defobj; + + switch (ELF_R_TYPE(rela->r_info)) { + case R_X86_64_JMP_SLOT: + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, true, NULL, + lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) + continue; + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); + reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); + break; + } + } + obj->gnu_ifunc = false; + return 0; +} + void allocate_initial_tls(Obj_Entry *objs) { Modified: head/libexec/rtld-elf/arm/reloc.c ============================================================================== --- head/libexec/rtld-elf/arm/reloc.c Mon Dec 12 10:10:49 2011 (r228434) +++ head/libexec/rtld-elf/arm/reloc.c Mon Dec 12 11:03:14 2011 (r228435) @@ -337,6 +337,22 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS return (0); } +int +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj, const Obj_Entry *obj, const Elf_Rel *rel) Modified: head/libexec/rtld-elf/i386/reloc.c ============================================================================== --- head/libexec/rtld-elf/i386/reloc.c Mon Dec 12 10:10:49 2011 (r228434) +++ head/libexec/rtld-elf/i386/reloc.c Mon Dec 12 11:03:14 2011 (r228435) @@ -298,13 +298,24 @@ reloc_plt(Obj_Entry *obj) rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); for (rel = obj->pltrel; rel < rellim; rel++) { - Elf_Addr *where; + Elf_Addr *where/*, val*/; - assert(ELF_R_TYPE(rel->r_info) == R_386_JMP_SLOT); - - /* Relocate the GOT slot pointing into the PLT. */ - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); - *where += (Elf_Addr)obj->relocbase; + switch (ELF_R_TYPE(rel->r_info)) { + case R_386_JMP_SLOT: + /* Relocate the GOT slot pointing into the PLT. */ + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); + *where += (Elf_Addr)obj->relocbase; + break; + + case R_386_IRELATIVE: + obj->irelative = true; + break; + + default: + _rtld_error("Unknown relocation type %x in PLT", + ELF_R_TYPE(rel->r_info)); + return (-1); + } } return 0; } @@ -324,19 +335,88 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS const Elf_Sym *def; const Obj_Entry *defobj; - assert(ELF_R_TYPE(rel->r_info) == R_386_JMP_SLOT); - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); - def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL, - lockstate); - if (def == NULL) - return -1; - target = (Elf_Addr)(defobj->relocbase + def->st_value); - reloc_jmpslot(where, target, defobj, obj, rel); + switch (ELF_R_TYPE(rel->r_info)) { + case R_386_JMP_SLOT: + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); + def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL, + lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { + obj->gnu_ifunc = true; + continue; + } + target = (Elf_Addr)(defobj->relocbase + def->st_value); + reloc_jmpslot(where, target, defobj, obj, rel); + break; + + case R_386_IRELATIVE: + break; + + default: + _rtld_error("Unknown relocation type %x in PLT", + ELF_R_TYPE(rel->r_info)); + return (-1); + } } + obj->jmpslots_done = true; return 0; } +int +reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate) +{ + const Elf_Rel *rellim; + const Elf_Rel *rel; + Elf_Addr *where, target; + + rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); + for (rel = obj->pltrel; rel < rellim; rel++) { + switch (ELF_R_TYPE(rel->r_info)) { + case R_386_IRELATIVE: + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); + target = ((Elf_Addr (*)(void))(*where))(); + *where = target; + break; + } + } + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, RtldLockState *lockstate) +{ + const Elf_Rel *rellim; + const Elf_Rel *rel; + + if (!obj->gnu_ifunc) + return (0); + rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); + for (rel = obj->pltrel; rel < rellim; rel++) { + Elf_Addr *where, target; + const Elf_Sym *def; + const Obj_Entry *defobj; + + switch (ELF_R_TYPE(rel->r_info)) { + case R_386_JMP_SLOT: + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); + def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL, + lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) + continue; + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); + reloc_jmpslot(where, target, defobj, obj, rel); + break; + } + } + + obj->gnu_ifunc = false; + return (0); +} + void allocate_initial_tls(Obj_Entry *objs) { Modified: head/libexec/rtld-elf/ia64/reloc.c ============================================================================== --- head/libexec/rtld-elf/ia64/reloc.c Mon Dec 12 10:10:49 2011 (r228434) +++ head/libexec/rtld-elf/ia64/reloc.c Mon Dec 12 11:03:14 2011 (r228435) @@ -435,6 +435,22 @@ reloc_plt(Obj_Entry *obj) return 0; } +int +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + /* Relocate the jump slots in an object. */ int reloc_jmpslots(Obj_Entry *obj, RtldLockState *lockstate) Modified: head/libexec/rtld-elf/mips/reloc.c ============================================================================== --- head/libexec/rtld-elf/mips/reloc.c Mon Dec 12 10:10:49 2011 (r228434) +++ head/libexec/rtld-elf/mips/reloc.c Mon Dec 12 11:03:14 2011 (r228435) @@ -498,6 +498,22 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS return (0); } +int +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj, const Obj_Entry *obj, const Elf_Rel *rel) Modified: head/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc/reloc.c Mon Dec 12 10:10:49 2011 (r228434) +++ head/libexec/rtld-elf/powerpc/reloc.c Mon Dec 12 11:03:14 2011 (r228435) @@ -504,6 +504,21 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr return (target); } +int +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} /* * Setup the plt glue routines. Modified: head/libexec/rtld-elf/powerpc64/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc64/reloc.c Mon Dec 12 10:10:49 2011 (r228434) +++ head/libexec/rtld-elf/powerpc64/reloc.c Mon Dec 12 11:03:14 2011 (r228435) @@ -456,6 +456,22 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr return (target); } +int +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + void init_pltgot(Obj_Entry *obj) { Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Mon Dec 12 10:10:49 2011 (r228434) +++ head/libexec/rtld-elf/rtld.c Mon Dec 12 11:03:14 2011 (r228435) @@ -561,6 +561,17 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ return (func_ptr_type) obj_main->entry; } +void * +rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def) +{ + void *ptr; + Elf_Addr target; + + ptr = (void *)make_function_pointer(def, obj); + target = ((Elf_Addr (*)(void))ptr)(); + return ((void *)target); +} + Elf_Addr _rtld_bind(Obj_Entry *obj, Elf_Size reloff) { @@ -584,8 +595,10 @@ _rtld_bind(Obj_Entry *obj, Elf_Size relo &lockstate); if (def == NULL) die(); - - target = (Elf_Addr)(defobj->relocbase + def->st_value); + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); + else + target = (Elf_Addr)(defobj->relocbase + def->st_value); dbg("\"%s\" in \"%s\" ==> %p in \"%s\"", defobj->strtab + def->st_name, basename(obj->path), @@ -1944,6 +1957,10 @@ relocate_objects(Obj_Entry *first, bool } } + + /* Set the special PLT or GOT entries. */ + init_pltgot(obj); + /* Process the PLT relocations. */ if (reloc_plt(obj) == -1) return -1; @@ -1952,7 +1969,6 @@ relocate_objects(Obj_Entry *first, bool if (reloc_jmpslots(obj, lockstate) == -1) return -1; - /* * Set up the magic number and version in the Obj_Entry. These * were checked in the crt1.o from the original ElfKit, so we @@ -1960,11 +1976,26 @@ relocate_objects(Obj_Entry *first, bool */ obj->magic = RTLD_MAGIC; obj->version = RTLD_VERSION; - - /* Set the special PLT or GOT entries. */ - init_pltgot(obj); } + /* + * The handling of R_MACHINE_IRELATIVE relocations and jumpslots + * referencing STT_GNU_IFUNC symbols is postponed till the other + * relocations are done. The indirect functions specified as + * ifunc are allowed to call other symbols, so we need to have + * objects relocated before asking for resolution from indirects. + * + * The R_MACHINE_IRELATIVE slots are resolved in greedy fashion, + * instead of the usual lazy handling of PLT slots. It is + * consistent with how GNU does it. + */ + for (obj = first; obj != NULL; obj = obj->next) { + if (obj->irelative && reloc_iresolve(obj, lockstate) == -1) + return (-1); + if ((obj->bind_now || bind_now) && obj->gnu_ifunc && + reloc_gnu_ifunc(obj, lockstate) == -1) + return (-1); + } return 0; } @@ -2376,9 +2407,11 @@ do_dlsym(void *handle, const char *name, * the relocated value of the symbol. */ if (ELF_ST_TYPE(def->st_info) == STT_FUNC) - return make_function_pointer(def, defobj); + return (make_function_pointer(def, defobj)); + else if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) + return (rtld_resolve_ifunc(defobj, def)); else - return defobj->relocbase + def->st_value; + return (defobj->relocbase + def->st_value); } _rtld_error("Undefined symbol \"%s\"", name); @@ -2822,6 +2855,8 @@ get_program_var_addr(const char *name, R if (ELF_ST_TYPE(req.sym_out->st_info) == STT_FUNC) return ((const void **)make_function_pointer(req.sym_out, req.defobj_out)); + else if (ELF_ST_TYPE(req.sym_out->st_info) == STT_GNU_IFUNC) + return ((const void **)rtld_resolve_ifunc(req.defobj_out, req.sym_out)); else return ((const void **)(req.defobj_out->relocbase + req.sym_out->st_value)); @@ -3088,6 +3123,7 @@ symlook_obj1(SymLook *req, const Obj_Ent case STT_FUNC: case STT_NOTYPE: case STT_OBJECT: + case STT_GNU_IFUNC: if (symp->st_value == 0) continue; /* fallthrough */ Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Mon Dec 12 10:10:49 2011 (r228434) +++ head/libexec/rtld-elf/rtld.h Mon Dec 12 11:03:14 2011 (r228435) @@ -230,6 +230,8 @@ typedef struct Struct_Obj_Entry { bool on_fini_list: 1; /* Object is already on fini list. */ bool dag_inited : 1; /* Object has its DAG initialized. */ bool filtees_loaded : 1; /* Filtees loaded */ + bool irelative : 1; /* Object has R_MACHDEP_IRELATIVE relocs */ + bool gnu_ifunc : 1; /* Object has references to STT_GNU_IFUNC */ struct link_map linkmap; /* For GDB and dlinfo() */ Objlist dldags; /* Object belongs to these dlopened DAGs (%) */ @@ -317,6 +319,7 @@ void lockdflt_init(void); void obj_free(Obj_Entry *); Obj_Entry *obj_new(void); void _rtld_bind_start(void); +void *rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def); void symlook_init(SymLook *, const char *); int symlook_obj(SymLook *, const Obj_Entry *); void *tls_get_addr_common(Elf_Addr** dtvp, int index, size_t offset); @@ -334,6 +337,8 @@ int do_copy_relocations(Obj_Entry *); int reloc_non_plt(Obj_Entry *, Obj_Entry *, struct Struct_RtldLockState *); int reloc_plt(Obj_Entry *); int reloc_jmpslots(Obj_Entry *, struct Struct_RtldLockState *); +int reloc_iresolve(Obj_Entry *, struct Struct_RtldLockState *); +int reloc_gnu_ifunc(Obj_Entry *, struct Struct_RtldLockState *); void allocate_initial_tls(Obj_Entry *); #endif /* } */ Modified: head/libexec/rtld-elf/sparc64/reloc.c ============================================================================== --- head/libexec/rtld-elf/sparc64/reloc.c Mon Dec 12 10:10:49 2011 (r228434) +++ head/libexec/rtld-elf/sparc64/reloc.c Mon Dec 12 11:03:14 2011 (r228435) @@ -550,6 +550,22 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS return (0); } +int +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + Elf_Addr reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, const Obj_Entry *refobj, const Elf_Rel *rel) From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 11:08:31 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54C891065670; Mon, 12 Dec 2011 11:08:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id C7C1F8FC1E; Mon, 12 Dec 2011 11:08:30 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pBCB8QcG000229 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 12 Dec 2011 13:08:26 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pBCB8QCn034495; Mon, 12 Dec 2011 13:08:26 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pBCB8Qd3034494; Mon, 12 Dec 2011 13:08:26 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 12 Dec 2011 13:08:26 +0200 From: Kostik Belousov To: toolchain@freebsd.org Message-ID: <20111212110826.GM50300@deviant.kiev.zoral.com.ua> References: <201112121103.pBCB3FuT097580@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FYQbxHc1c8B/Anrp" Content-Disposition: inline In-Reply-To: <201112121103.pBCB3FuT097580@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 11:08:31 -0000 --FYQbxHc1c8B/Anrp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 12, 2011 at 11:03:15AM +0000, Konstantin Belousov wrote: > Author: kib > Date: Mon Dec 12 11:03:14 2011 > New Revision: 228435 > URL: http://svn.freebsd.org/changeset/base/228435 >=20 > Log: > Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to > rtld on 386 and amd64. This adds runtime bits neccessary for the use > of the dispatch functions from the dynamically-linked executables and > shared libraries. > =20 > To allow use of external references from the dispatch function, resolut= ion > of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT ent= ries > for PLT are prepared, and normal resolution of the GOT entries is finis= hed. > Similar to how it is done by GNU, IRELATIVE relocations are resolved in > advance, instead of normal lazy handling for PLT. > =20 > Move the init_pltgot() call before the relocations for the object are > processed. > =20 > MFC after: 3 weeks An example use of the facilities is provided at http://vger.kernel.org/~davem/cgi-bin/blog.cgi/2010/02/07 Inner working is described by http://www.airs.com/blog/archives/403 To use this feature on FreeBSD, you need patched gas from recent binutils. Patch is available at http://people.freebsd.org/~kib/misc/gas_ifunc_freebsd.1.patch. The 4.6 gcc should be configured with --enable-gnu-indirect-function option to turn on the 'ifunc' function attributes, no patch for compiler is required. Only dynamically linked executables and shared objects are supported, support for static binaries requires changes for csu. Since in-tree toolchain cannot handle dispatch, and I am only interested in the dynamic linking case, I did not modified csu. If we ever need dispatch for system libraries (cases like CPU-optimized string functions, or math) and have a capable toolchain, I promise to add support for static binaries. I handled just x86oids. If maintainer of missed architecture wants to implement dispatch, I am willing to help (as usual). Does anybody on toolchain@ know how to submit the gas change to maintainers for inclusion into mainline, or better, can submit it himself ? I assume that no copyright assignment is required for this trivial flip of settings. --FYQbxHc1c8B/Anrp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7l4KkACgkQC3+MBN1Mb4guPACgw8rUbLaX0VIlDbgKQcrP97Hw sZUAoOckniL1/o/Q7XMsuI3hs5Vbqqcv =eV03 -----END PGP SIGNATURE----- --FYQbxHc1c8B/Anrp-- From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 12:18:13 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37A2F1065672; Mon, 12 Dec 2011 12:18:13 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theravensnest.org [109.169.23.128]) by mx1.freebsd.org (Postfix) with ESMTP id CCDF28FC08; Mon, 12 Dec 2011 12:18:12 +0000 (UTC) Received: from [192.168.0.2] (cpc2-cwma5-0-0-cust875.7-3.cable.virginmedia.com [86.11.39.108]) (authenticated bits=0) by theravensnest.org (8.14.4/8.14.4) with ESMTP id pBCCIA2G036877 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Mon, 12 Dec 2011 12:18:11 GMT (envelope-from theraven@FreeBSD.org) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii From: David Chisnall In-Reply-To: <4EE51CA3.9060809@FreeBSD.org> Date: Sun, 11 Dec 2011 22:40:26 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201112072117.pB7LHoaL055972@svn.freebsd.org> <4EE120D7.10903@FreeBSD.org> <4EE51CA3.9060809@FreeBSD.org> To: Andreas Tobler X-Mailer: Apple Mail (2.1251.1) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228330 - in head: include sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 12:18:13 -0000 On 11 Dec 2011, at 21:12, Andreas Tobler wrote: > As far as I understand, GCC does not support this attribute = [[noreturn]] yet. But it defines both, __cplusplus and = __cplusplus=3D201103L. On gcc-4.7 __cplusplus=3D201103L is the default = when we build libstdc++. Advertising C++11 compatibility and then not supporting fairly simple = C++11 features seems like a pretty major GCC bug. =20 > So I think we have to extend the check as below or we can reorder the = defines that GNUC is before the __cplusplus && __cplusplus>=3D 201103L. I'd rather prefer the standard version to the non-standard version, but = maybe we can add an extra check to see if your compiler incompetent. David= From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 12:30:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3291106566B; Mon, 12 Dec 2011 12:30:44 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6E288FC0A; Mon, 12 Dec 2011 12:30:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCCUiup001184; Mon, 12 Dec 2011 12:30:44 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCCUio4001178; Mon, 12 Dec 2011 12:30:44 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201112121230.pBCCUio4001178@svn.freebsd.org> From: Fabien Thomas Date: Mon, 12 Dec 2011 12:30:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228436 - in head: sys/dev/cpuctl usr.sbin/cpucontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 12:30:45 -0000 Author: fabient Date: Mon Dec 12 12:30:44 2011 New Revision: 228436 URL: http://svn.freebsd.org/changeset/base/228436 Log: Add VIA microde update support to cpuctl(4) and cpucontrol(8). Support have been tested with X2 CPU and QuadCore CPU. MFC after: 1 month Added: head/usr.sbin/cpucontrol/via.c (contents, props changed) head/usr.sbin/cpucontrol/via.h (contents, props changed) Modified: head/sys/dev/cpuctl/cpuctl.c head/usr.sbin/cpucontrol/Makefile head/usr.sbin/cpucontrol/cpucontrol.c Modified: head/sys/dev/cpuctl/cpuctl.c ============================================================================== --- head/sys/dev/cpuctl/cpuctl.c Mon Dec 12 11:03:14 2011 (r228435) +++ head/sys/dev/cpuctl/cpuctl.c Mon Dec 12 12:30:44 2011 (r228436) @@ -74,6 +74,8 @@ static int cpuctl_do_update(int cpu, cpu static int update_intel(int cpu, cpuctl_update_args_t *args, struct thread *td); static int update_amd(int cpu, cpuctl_update_args_t *args, struct thread *td); +static int update_via(int cpu, cpuctl_update_args_t *args, + struct thread *td); static struct cdev **cpuctl_devs; static MALLOC_DEFINE(M_CPUCTL, "cpuctl", "CPUCTL buffer"); @@ -281,8 +283,10 @@ cpuctl_do_update(int cpu, cpuctl_update_ vendor[12] = '\0'; if (strncmp(vendor, INTEL_VENDOR_ID, sizeof(INTEL_VENDOR_ID)) == 0) ret = update_intel(cpu, data, td); - else if(strncmp(vendor, INTEL_VENDOR_ID, sizeof(AMD_VENDOR_ID)) == 0) + else if(strncmp(vendor, AMD_VENDOR_ID, sizeof(AMD_VENDOR_ID)) == 0) ret = update_amd(cpu, data, td); + else if(strncmp(vendor, CENTAUR_VENDOR_ID, sizeof(CENTAUR_VENDOR_ID)) == 0) + ret = update_via(cpu, data, td); else ret = ENXIO; return (ret); @@ -402,6 +406,81 @@ fail: return (ret); } +static int +update_via(int cpu, cpuctl_update_args_t *args, struct thread *td) +{ + void *ptr = NULL; + uint64_t rev0, rev1, res; + uint32_t tmp[4]; + int is_bound = 0; + int oldcpu; + int ret; + + if (args->size == 0 || args->data == NULL) { + DPRINTF("[cpuctl,%d]: zero-sized firmware image", __LINE__); + return (EINVAL); + } + if (args->size > UCODE_SIZE_MAX) { + DPRINTF("[cpuctl,%d]: firmware image too large", __LINE__); + return (EINVAL); + } + + /* + * 4 byte alignment required. + */ + ptr = malloc(args->size + 16, M_CPUCTL, M_WAITOK); + ptr = (void *)(16 + ((intptr_t)ptr & ~0xf)); + if (copyin(args->data, ptr, args->size) != 0) { + DPRINTF("[cpuctl,%d]: copyin %p->%p of %zd bytes failed", + __LINE__, args->data, ptr, args->size); + ret = EFAULT; + goto fail; + } + oldcpu = td->td_oncpu; + is_bound = cpu_sched_is_bound(td); + set_cpu(cpu, td); + critical_enter(); + rdmsr_safe(MSR_BIOS_SIGN, &rev0); /* Get current micorcode revision. */ + + /* + * Perform update. + */ + wrmsr_safe(MSR_BIOS_UPDT_TRIG, (uintptr_t)(ptr)); + do_cpuid(1, tmp); + + /* + * Result are in low byte of MSR FCR5: + * 0x00: No update has been attempted since RESET. + * 0x01: The last attempted update was successful. + * 0x02: The last attempted update was unsuccessful due to a bad + * environment. No update was loaded and any preexisting + * patches are still active. + * 0x03: The last attempted update was not applicable to this processor. + * No update was loaded and any preexisting patches are still + * active. + * 0x04: The last attempted update was not successful due to an invalid + * update data block. No update was loaded and any preexisting + * patches are still active + */ + rdmsr_safe(0x1205, &res); + res &= 0xff; + critical_exit(); + rdmsr_safe(MSR_BIOS_SIGN, &rev1); /* Get new microcode revision. */ + restore_cpu(oldcpu, is_bound, td); + + DPRINTF("[cpu,%d]: rev0=%x rev1=%x res=%x\n", __LINE__, + (unsigned)(rev0 >> 32), (unsigned)(rev1 >> 32), (unsigned)res); + + if (res != 0x01) + ret = EINVAL; + else + ret = 0; +fail: + if (ptr != NULL) + contigfree(ptr, args->size, M_CPUCTL); + return (ret); +} + int cpuctl_open(struct cdev *dev, int flags, int fmt __unused, struct thread *td) { Modified: head/usr.sbin/cpucontrol/Makefile ============================================================================== --- head/usr.sbin/cpucontrol/Makefile Mon Dec 12 11:03:14 2011 (r228435) +++ head/usr.sbin/cpucontrol/Makefile Mon Dec 12 12:30:44 2011 (r228436) @@ -2,6 +2,6 @@ PROG= cpucontrol MAN= cpucontrol.8 -SRCS= cpucontrol.c intel.c amd.c +SRCS= cpucontrol.c intel.c amd.c via.c .include Modified: head/usr.sbin/cpucontrol/cpucontrol.c ============================================================================== --- head/usr.sbin/cpucontrol/cpucontrol.c Mon Dec 12 11:03:14 2011 (r228435) +++ head/usr.sbin/cpucontrol/cpucontrol.c Mon Dec 12 12:30:44 2011 (r228436) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include "cpucontrol.h" #include "amd.h" #include "intel.h" +#include "via.h" int verbosity_level = 0; @@ -91,6 +92,7 @@ struct ucode_handler { } handlers[] = { { intel_probe, intel_update }, { amd_probe, amd_update }, + { via_probe, via_update }, }; #define NHANDLERS (sizeof(handlers) / sizeof(*handlers)) Added: head/usr.sbin/cpucontrol/via.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/cpucontrol/via.c Mon Dec 12 12:30:44 2011 (r228436) @@ -0,0 +1,222 @@ +/*- + * Copyright (c) 2011 Fabien Thomas . + * 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "cpucontrol.h" +#include "via.h" + +int +via_probe(int fd) +{ + char vendor[13]; + int error; + cpuctl_cpuid_args_t idargs = { + .level = 0, + }; + + error = ioctl(fd, CPUCTL_CPUID, &idargs); + if (error < 0) { + WARN(0, "ioctl()"); + return (1); + } + ((uint32_t *)vendor)[0] = idargs.data[1]; + ((uint32_t *)vendor)[1] = idargs.data[3]; + ((uint32_t *)vendor)[2] = idargs.data[2]; + vendor[12] = '\0'; + if (strncmp(vendor, CENTAUR_VENDOR_ID, sizeof(CENTAUR_VENDOR_ID)) != 0) + return (1); + + /* TODO: detect Nano CPU. */ + return (0); +} + +void +via_update(const char *dev, const char *path) +{ + int fd, devfd; + struct stat st; + uint32_t *fw_image; + uint32_t sum; + unsigned int i; + size_t payload_size; + via_fw_header_t *fw_header; + uint32_t signature, flags; + int32_t revision; + void *fw_data; + size_t data_size, total_size; + cpuctl_msr_args_t msrargs = { + .msr = MSR_IA32_PLATFORM_ID, + }; + cpuctl_cpuid_args_t idargs = { + .level = 1, /* Signature. */ + }; + cpuctl_update_args_t args; + int error; + + assert(path); + assert(dev); + + fd = -1; + devfd = -1; + fw_image = MAP_FAILED; + devfd = open(dev, O_RDWR); + if (devfd < 0) { + WARN(0, "could not open %s for writing", dev); + return; + } + error = ioctl(devfd, CPUCTL_CPUID, &idargs); + if (error < 0) { + WARN(0, "ioctl(%s)", dev); + goto fail; + } + signature = idargs.data[0]; + error = ioctl(devfd, CPUCTL_RDMSR, &msrargs); + if (error < 0) { + WARN(0, "ioctl(%s)", dev); + goto fail; + } + + /* + * MSR_IA32_PLATFORM_ID contains flag in BCD in bits 52-50. + */ + flags = 1 << ((msrargs.data >> 50) & 7); + msrargs.msr = MSR_BIOS_SIGN; + error = ioctl(devfd, CPUCTL_RDMSR, &msrargs); + if (error < 0) { + WARN(0, "ioctl(%s)", dev); + goto fail; + } + revision = msrargs.data >> 32; /* Revision in the high dword. */ + WARNX(2, "found cpu type %#x family %#x model %#x stepping %#x.", + (signature >> 12) & 0x03, (signature >> 8) & 0x0f, + (signature >> 4) & 0x0f, (signature >> 0) & 0x0f); + /* + * Open firmware image. + */ + fd = open(path, O_RDONLY, 0); + if (fd < 0) { + WARN(0, "open(%s)", path); + return; + } + error = fstat(fd, &st); + if (error != 0) { + WARN(0, "fstat(%s)", path); + goto fail; + } + if (st.st_size < 0 || (unsigned)st.st_size < sizeof(*fw_header)) { + WARNX(2, "file too short: %s", path); + goto fail; + } + + /* + * mmap the whole image. + */ + fw_image = (uint32_t *)mmap(NULL, st.st_size, PROT_READ, + MAP_PRIVATE, fd, 0); + if (fw_image == MAP_FAILED) { + WARN(0, "mmap(%s)", path); + goto fail; + } + fw_header = (via_fw_header_t *)fw_image; + if (fw_header->signature != VIA_HEADER_SIGNATURE || + fw_header->loader_revision != VIA_LOADER_REVISION) { + WARNX(2, "%s is not a valid via firmware: version mismatch", + path); + goto fail; + } + data_size = fw_header->data_size; + total_size = fw_header->total_size; + if (total_size > (unsigned)st.st_size || st.st_size < 0) { + WARNX(2, "file too short: %s", path); + goto fail; + } + payload_size = data_size + sizeof(*fw_header); + + /* + * Check the primary checksum. + */ + sum = 0; + for (i = 0; i < (payload_size / sizeof(uint32_t)); i++) + sum += *((uint32_t *)fw_image + i); + if (sum != 0) { + WARNX(2, "%s: update data checksum invalid", path); + goto fail; + } + + fw_data = fw_header + 1; /* Pointer to the update data. */ + + /* + * Check if the given image is ok for this cpu. + */ + if (signature != fw_header->cpu_signature) + goto fail; + + if (fw_header->revision != 0 && revision >= fw_header->revision) { + WARNX(1, "skipping %s of rev %#x: up to date", + path, fw_header->revision); + goto fail; + } + fprintf(stderr, "%s: updating cpu %s from rev %#x to rev %#x... ", + path, dev, revision, fw_header->revision); + args.data = fw_data; + args.size = data_size; + error = ioctl(devfd, CPUCTL_UPDATE, &args); + if (error < 0) { + fprintf(stderr, "failed.\n"); + WARN(0, "ioctl()"); + goto fail; + } + fprintf(stderr, "done.\n"); + +fail: + if (fw_image != MAP_FAILED) + if (munmap(fw_image, st.st_size) != 0) + warn("munmap(%s)", path); + if (devfd >= 0) + close(devfd); + if (fd >= 0) + close(fd); + return; +} Added: head/usr.sbin/cpucontrol/via.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/cpucontrol/via.h Mon Dec 12 12:30:44 2011 (r228436) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2011 Fabien Thomas . + * 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef VIA_H +#define VIA_H + +/* + * Prototypes. + */ +ucode_probe_t via_probe; +ucode_update_t via_update; + +typedef struct via_fw_header { + uint32_t signature; /* Signature. */ + int32_t revision; /* Unique version number. */ + uint32_t date; /* Date of creation in BCD. */ + uint32_t cpu_signature; /* Extended family, extended + model, type, family, model + and stepping. */ + uint32_t checksum; /* Sum of all DWORDS should + be 0. */ + uint32_t loader_revision; /* Version of the loader + required to load update. */ + uint32_t reserverd1; /* Platform IDs encoded in + the lower 8 bits. */ + uint32_t data_size; + uint32_t total_size; + uint8_t reserved2[12]; +} via_fw_header_t; + +typedef struct via_cpu_signature { + uint32_t cpu_signature; + uint32_t checksum; +} via_cpu_signature_t; + +#define VIA_HEADER_SIGNATURE 0x53415252 +#define VIA_LOADER_REVISION 0x00000001 + +#endif /* !VIA_H */ From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 12:33:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3EA40106566B; Mon, 12 Dec 2011 12:33:39 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2CF1C8FC12; Mon, 12 Dec 2011 12:33:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCCXdJm001315; Mon, 12 Dec 2011 12:33:39 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCCXdrW001313; Mon, 12 Dec 2011 12:33:39 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112121233.pBCCXdrW001313@svn.freebsd.org> From: Ed Schouten Date: Mon, 12 Dec 2011 12:33:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228437 - head/usr.sbin/kbdcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 12:33:39 -0000 Author: ed Date: Mon Dec 12 12:33:38 2011 New Revision: 228437 URL: http://svn.freebsd.org/changeset/base/228437 Log: Add missing static and const keywords to kbdcontrol. None of the symbols provided by kbdcontrol.c are used by other source files of this binary. Slightly reduce the binary size and make much more symbols read-only by adding proper static and const keywords. Modified: head/usr.sbin/kbdcontrol/kbdcontrol.c Modified: head/usr.sbin/kbdcontrol/kbdcontrol.c ============================================================================== --- head/usr.sbin/kbdcontrol/kbdcontrol.c Mon Dec 12 12:30:44 2011 (r228436) +++ head/usr.sbin/kbdcontrol/kbdcontrol.c Mon Dec 12 12:33:38 2011 (r228437) @@ -57,26 +57,26 @@ __FBSDID("$FreeBSD$"); #define SPECIAL 0x80000000 -char ctrl_names[32][4] = { +static const char ctrl_names[32][4] = { "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs ", "ht ", "nl ", "vt ", "ff ", "cr ", "so ", "si ", "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", "can", "em ", "sub", "esc", "fs ", "gs ", "rs ", "us " }; -char acc_names[15][5] = { +static const char acc_names[15][5] = { "dgra", "dacu", "dcir", "dtil", "dmac", "dbre", "ddot", "duml", "dsla", "drin", "dced", "dapo", "ddac", "dogo", "dcar", }; -char acc_names_u[15][5] = { +static const char acc_names_u[15][5] = { "DGRA", "DACU", "DCIR", "DTIL", "DMAC", "DBRE", "DDOT", "DUML", "DSLA", "DRIN", "DCED", "DAPO", "DDAC", "DOGO", "DCAR", }; -char fkey_table[96][MAXFK] = { +static const char fkey_table[96][MAXFK] = { /* 01-04 */ "\033[M", "\033[N", "\033[O", "\033[P", /* 05-08 */ "\033[Q", "\033[R", "\033[S", "\033[T", /* 09-12 */ "\033[U", "\033[V", "\033[W", "\033[X", @@ -103,44 +103,45 @@ char fkey_table[96][MAXFK] = { /* 93-96 */ "" , "" , "" , "" , }; -const int delays[] = {250, 500, 750, 1000}; -const int repeats[] = { 34, 38, 42, 46, 50, 55, 59, 63, - 68, 76, 84, 92, 100, 110, 118, 126, - 136, 152, 168, 184, 200, 220, 236, 252, - 272, 304, 336, 368, 400, 440, 472, 504}; -const int ndelays = (sizeof(delays) / sizeof(int)); -const int nrepeats = (sizeof(repeats) / sizeof(int)); -int hex = 0; -int number; -char letter; -int token; - -void dump_accent_definition(char *name, accentmap_t *accentmap); -void dump_entry(int value); -void dump_key_definition(char *name, keymap_t *keymap); -int get_accent_definition_line(accentmap_t *); -int get_entry(void); -int get_key_definition_line(keymap_t *); -void load_keymap(char *opt, int dumponly); -void load_default_functionkeys(void); -char * nextarg(int ac, char **av, int *indp, int oc); -char * mkfullname(const char *s1, const char *s2, const char *s3); -void print_accent_definition_line(FILE *fp, int accent, - struct acc_t *key); -void print_entry(FILE *fp, int value); -void print_key_definition_line(FILE *fp, int scancode, - struct keyent_t *key); -void print_keymap(void); -void release_keyboard(void); -void mux_keyboard(u_int op, char *kbd); -void set_bell_values(char *opt); -void set_functionkey(char *keynumstr, char *string); -void set_keyboard(char *device); -void set_keyrates(char *opt); -void show_kbd_info(void); -void usage(void) __dead2; +static const int delays[] = {250, 500, 750, 1000}; +static const int repeats[] = { 34, 38, 42, 46, 50, 55, 59, 63, + 68, 76, 84, 92, 100, 110, 118, 126, + 136, 152, 168, 184, 200, 220, 236, 252, + 272, 304, 336, 368, 400, 440, 472, 504}; +static const int ndelays = (sizeof(delays) / sizeof(int)); +static const int nrepeats = (sizeof(repeats) / sizeof(int)); +static int hex = 0; +static int token; + +int number; +char letter; + +static void dump_accent_definition(char *name, accentmap_t *accentmap); +static void dump_entry(int value); +static void dump_key_definition(char *name, keymap_t *keymap); +static int get_accent_definition_line(accentmap_t *); +static int get_entry(void); +static int get_key_definition_line(keymap_t *); +static void load_keymap(char *opt, int dumponly); +static void load_default_functionkeys(void); +static char * nextarg(int ac, char **av, int *indp, int oc); +static char * mkfullname(const char *s1, const char *s2, const char *s3); +static void print_accent_definition_line(FILE *fp, int accent, + struct acc_t *key); +static void print_entry(FILE *fp, int value); +static void print_key_definition_line(FILE *fp, int scancode, + struct keyent_t *key); +static void print_keymap(void); +static void release_keyboard(void); +static void mux_keyboard(u_int op, char *kbd); +static void set_bell_values(char *opt); +static void set_functionkey(char *keynumstr, char *string); +static void set_keyboard(char *device); +static void set_keyrates(char *opt); +static void show_kbd_info(void); +static void usage(void) __dead2; -char * +static char * nextarg(int ac, char **av, int *indp, int oc) { if (*indp < ac) @@ -150,7 +151,7 @@ nextarg(int ac, char **av, int *indp, in } -char * +static char * mkfullname(const char *s1, const char *s2, const char *s3) { static char *buf = NULL; @@ -177,7 +178,7 @@ mkfullname(const char *s1, const char *s } -int +static int get_entry(void) { switch ((token = yylex())) { @@ -297,7 +298,7 @@ get_definition_line(FILE *fd, keymap_t * return c; } -int +static int get_key_definition_line(keymap_t *map) { int i, def, scancode; @@ -324,7 +325,7 @@ get_key_definition_line(keymap_t *map) return (scancode + 1); } -int +static int get_accent_definition_line(accentmap_t *map) { int accent; @@ -385,7 +386,7 @@ get_accent_definition_line(accentmap_t * return (accent + 1); } -void +static void print_entry(FILE *fp, int value) { int val = value & ~SPECIAL; @@ -509,7 +510,7 @@ print_entry(FILE *fp, int value) } } -void +static void print_key_definition_line(FILE *fp, int scancode, struct keyent_t *key) { int i; @@ -545,7 +546,7 @@ print_key_definition_line(FILE *fp, int } } -void +static void print_accent_definition_line(FILE *fp, int accent, struct acc_t *key) { int c; @@ -586,7 +587,7 @@ print_accent_definition_line(FILE *fp, i fprintf(fp, "\n"); } -void +static void dump_entry(int value) { if (value & SPECIAL) { @@ -704,7 +705,7 @@ dump_entry(int value) } } -void +static void dump_key_definition(char *name, keymap_t *keymap) { int i, j; @@ -732,7 +733,7 @@ dump_key_definition(char *name, keymap_t printf("} };\n\n"); } -void +static void dump_accent_definition(char *name, accentmap_t *accentmap) { int i, j; @@ -776,7 +777,7 @@ dump_accent_definition(char *name, accen printf("} };\n\n"); } -void +static void load_keymap(char *opt, int dumponly) { keymap_t keymap; @@ -835,7 +836,7 @@ load_keymap(char *opt, int dumponly) } } -void +static void print_keymap(void) { keymap_t keymap; @@ -861,7 +862,7 @@ print_keymap(void) } -void +static void load_default_functionkeys(void) { fkeyarg_t fkey; @@ -876,7 +877,7 @@ load_default_functionkeys(void) } } -void +static void set_functionkey(char *keynumstr, char *string) { fkeyarg_t fkey; @@ -902,7 +903,7 @@ set_functionkey(char *keynumstr, char *s warn("setting function key"); } -void +static void set_bell_values(char *opt) { int bell, duration, pitch; @@ -942,7 +943,7 @@ badopt: fprintf(stderr, "[=%d;%dB", pitch, duration); } -void +static void set_keyrates(char *opt) { int arg[2]; @@ -1011,7 +1012,7 @@ get_kbd_type_name(int type) return "unknown"; } -void +static void show_kbd_info(void) { keyboard_info_t info; @@ -1026,7 +1027,7 @@ show_kbd_info(void) get_kbd_type_name(info.kb_type), info.kb_type); } -void +static void set_keyboard(char *device) { keyboard_info_t info; @@ -1060,7 +1061,7 @@ set_keyboard(char *device) warn("unable to set keyboard"); } -void +static void release_keyboard(void) { keyboard_info_t info; @@ -1083,7 +1084,7 @@ release_keyboard(void) warn("unable to release the keyboard"); } -void +static void mux_keyboard(u_int op, char *kbd) { keyboard_info_t info; @@ -1147,7 +1148,7 @@ mux_keyboard(u_int op, char *kbd) warn("unable to (un)mux the keyboard"); } -void +static void usage(void) { fprintf(stderr, "%s\n%s\n%s\n", From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 12:52:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D87581065670; Mon, 12 Dec 2011 12:52:34 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 91CE38FC12; Mon, 12 Dec 2011 12:52:34 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 95D207300A; Mon, 12 Dec 2011 14:08:49 +0100 (CET) Date: Mon, 12 Dec 2011 14:08:49 +0100 From: Luigi Rizzo To: Jack F Vogel Message-ID: <20111212130849.GA24560@onelab2.iet.unipi.it> References: <201112111846.pBBIkE65064248@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112111846.pBBIkE65064248@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228415 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 12:52:34 -0000 On Sun, Dec 11, 2011 at 06:46:14PM +0000, Jack F Vogel wrote: > Author: jfv > Date: Sun Dec 11 18:46:14 2011 > New Revision: 228415 > URL: http://svn.freebsd.org/changeset/base/228415 > > Log: > Last change still had an issue, one more time... Jack, the previous commit (rev. 228387) removed netmap support from if_igb.c I believe it was unintentional. Can you put it back, or do you want me to handle it ? cheers luigi > Modified: > head/sys/dev/e1000/if_em.c > head/sys/dev/e1000/if_igb.c > > Modified: head/sys/dev/e1000/if_em.c > ============================================================================== > --- head/sys/dev/e1000/if_em.c Sun Dec 11 17:32:37 2011 (r228414) > +++ head/sys/dev/e1000/if_em.c Sun Dec 11 18:46:14 2011 (r228415) > @@ -1045,8 +1045,8 @@ em_ioctl(struct ifnet *ifp, u_long comma > struct ifreq *ifr = (struct ifreq *)data; > #if defined(INET) || defined(INET6) > struct ifaddr *ifa = (struct ifaddr *)data; > - bool avoid_reset = FALSE; > #endif > + bool avoid_reset = FALSE; > int error = 0; > > if (adapter->in_detach) > @@ -1062,7 +1062,6 @@ em_ioctl(struct ifnet *ifp, u_long comma > if (ifa->ifa_addr->sa_family == AF_INET6) > avoid_reset = TRUE; > #endif > -#if defined(INET) || defined(INET6) > /* > ** Calling init results in link renegotiation, > ** so we avoid doing it when possible. > @@ -1071,11 +1070,12 @@ em_ioctl(struct ifnet *ifp, u_long comma > ifp->if_flags |= IFF_UP; > if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) > em_init(adapter); > +#ifdef INET > if (!(ifp->if_flags & IFF_NOARP)) > arp_ifinit(ifp, ifa); > +#endif > } else > error = ether_ioctl(ifp, command, data); > -#endif > break; > case SIOCSIFMTU: > { > > Modified: head/sys/dev/e1000/if_igb.c > ============================================================================== > --- head/sys/dev/e1000/if_igb.c Sun Dec 11 17:32:37 2011 (r228414) > +++ head/sys/dev/e1000/if_igb.c Sun Dec 11 18:46:14 2011 (r228415) > @@ -992,8 +992,8 @@ igb_ioctl(struct ifnet *ifp, u_long comm > struct ifreq *ifr = (struct ifreq *)data; > #if defined(INET) || defined(INET6) > struct ifaddr *ifa = (struct ifaddr *)data; > - bool avoid_reset = FALSE; > #endif > + bool avoid_reset = FALSE; > int error = 0; > > if (adapter->in_detach) > @@ -1009,7 +1009,6 @@ igb_ioctl(struct ifnet *ifp, u_long comm > if (ifa->ifa_addr->sa_family == AF_INET6) > avoid_reset = TRUE; > #endif > -#if defined(INET) || defined(INET6) > /* > ** Calling init results in link renegotiation, > ** so we avoid doing it when possible. > @@ -1018,11 +1017,12 @@ igb_ioctl(struct ifnet *ifp, u_long comm > ifp->if_flags |= IFF_UP; > if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) > igb_init(adapter); > +#ifdef INET > if (!(ifp->if_flags & IFF_NOARP)) > arp_ifinit(ifp, ifa); > +#endif > } else > error = ether_ioctl(ifp, command, data); > -#endif > break; > case SIOCSIFMTU: > { From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 13:12:55 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A70AE106564A; Mon, 12 Dec 2011 13:12:55 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 960398FC08; Mon, 12 Dec 2011 13:12:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCDCtUG002695; Mon, 12 Dec 2011 13:12:55 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCDCtQu002693; Mon, 12 Dec 2011 13:12:55 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201112121312.pBCDCtQu002693@svn.freebsd.org> From: Fabien Thomas Date: Mon, 12 Dec 2011 13:12:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228438 - head/sys/dev/hwpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 13:12:55 -0000 Author: fabient Date: Mon Dec 12 13:12:55 2011 New Revision: 228438 URL: http://svn.freebsd.org/changeset/base/228438 Log: There's a small set of events on Nehalem, that are not supported in processors with CPUID signature 06_1AH, 06_1EH, and 06_1FH. Refuse to allocate them on unsupported model. Submitted by: Davide Italiano MFC after: 1 month Modified: head/sys/dev/hwpmc/hwpmc_core.c Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Mon Dec 12 12:33:38 2011 (r228437) +++ head/sys/dev/hwpmc/hwpmc_core.c Mon Dec 12 13:12:55 2011 (r228438) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #define CORE_CPUID_REQUEST 0xA @@ -1553,7 +1554,7 @@ static int iap_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) { - int n; + int n, model; enum pmc_event ev; struct iap_event_descr *ie; uint32_t c, caps, config, cpuflag, evsel, mask; @@ -1573,6 +1574,16 @@ iap_allocate_pmc(int cpu, int ri, struct if (iap_architectural_event_is_unsupported(ev)) return (EOPNOTSUPP); + /* + * A small number of events are not supported in all the + * processors based on a given microarchitecture. + */ + if (ev == PMC_EV_IAP_EVENT_0FH_01H || ev == PMC_EV_IAP_EVENT_0FH_80H) { + model = ((cpu_id & 0xF0000) >> 12) | ((cpu_id & 0xF0) >> 4); + if (core_cputype == PMC_CPU_INTEL_COREI7 && model != 0x2E) + return (EINVAL); + } + switch (core_cputype) { case PMC_CPU_INTEL_COREI7: if (iap_event_corei7_ok_on_counter(ev, ri) == 0) From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 13:38:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 738B21065670; Mon, 12 Dec 2011 13:38:50 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id ECA588FC08; Mon, 12 Dec 2011 13:38:49 +0000 (UTC) Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pBCDckjL022777 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 13 Dec 2011 00:38:47 +1100 Date: Tue, 13 Dec 2011 00:38:46 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andriy Gapon In-Reply-To: <4EE5D574.9080303@FreeBSD.org> Message-ID: <20111212225057.E2739@besplex.bde.org> References: <201112121005.pBCA5Dar093711@svn.freebsd.org> <20111212101558.GK50300@deviant.kiev.zoral.com.ua> <4EE5D574.9080303@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Kostik Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228433 - in head/sys: kern security/mac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 13:38:50 -0000 On Mon, 12 Dec 2011, Andriy Gapon wrote: > on 12/12/2011 12:15 Kostik Belousov said the following: >> On Mon, Dec 12, 2011 at 10:05:13AM +0000, Andriy Gapon wrote: >>> Author: avg >>> Date: Mon Dec 12 10:05:13 2011 >>> New Revision: 228433 >>> URL: http://svn.freebsd.org/changeset/base/228433 >>> >>> Log: >>> put sys/systm.h at its proper place or add it if missing >>> >>> Reported by: lstewart, tinderbox >>> Pointyhat to: avg, attilio >>> MFC after: 1 week >>> MFC with: r228430 >>> >>> Modified: >>> head/sys/kern/kern_sx.c >>> head/sys/kern/vfs_cache.c >>> head/sys/security/mac/mac_framework.c >>> head/sys/security/mac/mac_priv.c >> It means that previously sx.h did not required systm.h and now it does ? >> Might be, you should move SCHEDULER_STOPPED and stop_scheduler declarations >> into sys/lock.h ? > > Strictly speaking it's sys/lockstat.h that now requires systm.h. > I am not an expert in FreeBSD header file organization, so I will just follow > whatever the experts advise. should always be included second (after ) since it defines interfaces like KASSERT() and now SCHEDULER_STOPPED() that _might_ be used in other headers. KASSERT() was already used in a few critical headers. However, this shouldn't necessary in practice since KASSERT() and SCHEDULER_STOPPED() are implemented as macros. The other headers should also use macros and not use inline functions, so that they don't depend on the include order. The headers that use SCHEDULER_STOPPED(), namely and already don't use any inline functions, although they use rather bloated macros that give too much inlining in a different way to inline functions. The compilation failures occurred because other headers use inline functions that use the macros that use SCHEDULER_STOPPED(). seems to be the main offender. It uses LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(). This horribly named interface now uses SCHEDULER_STOPPED(). When lockstat profiling is configured, the expansion in nested macros becomes even larger. I think the SCHEDULER_STOPPED() call should be in lock_profile_obtain_lock_success(), not in the macro that invokes it. The usual excuse for bloated macros and inlines -- that they execute only a small amount of code in the usual case -- applies inversely here, since it is the unusual case of SCHEDULER_STOPPED() that is optimized by testing in the macro to avoid the function call. 's excessive dependencies on other headers can also be seen in its namespace pollution. It includes nested all of the following: - : Needed for some reason(?) - : These are more reasonable. sx.h uses lock profiling, etc., so it needs the lock profiling interfaces defined somewhere in cases where they are actually referenced, and since sx.h uses inline functions the lock profiling interfaces are _always_ referenced if sx.h is included, even if they are not used because the sx.h inlines that reference them are not referenced. If sx.h used macros instead of inlines, then the lock profiling headers would only be used sometimes, and then including them nested would save having to include them in .c files that don't really know about them. But style rules forbid such nested includes, since they result in almost every header including every other header via transitive closure of creeping pollution, and make it very hard to see the actual dependencies. davidg cleaned up the vm header pollution in 1995. Despite attempts to keep it under control, pollution in other headers is probably 10 times larger than it was then :-(. - : bogus. This is standard namespace pollution in , and it is a style bug not to depend on this, since it is usually a not just a style bug to not include . This style bug used to be only in mutex.h among headers. I fixed it there long ago in my version. Now it is also in refcount.h, rwlock.h and sx.h. Some of the other bugs in this area are including instead of and not including at all. This discussion shows that _may_ be a prerequisite for almost any system header in the kernel (_KERNEL defined). Even if not including at all (or sorted alphabetically) works when it is tested and committed, another header may grow a dependency on , though it shouldn't. Similarly for . provides lots of standard namespace pollution that _may_ be depended on. It is also hard to test whether minimal headers work in all cases even before the future, due to some things depending on options and the labyrinth include dependencies sometimes being satisifed accidentally by pollution in unrelated headers. may be the wrong place for critical macros like KASSERT(). I've thought of putting it in instead, but there is already too much non-parameter and other pollution there. If I knew what "systm" stood for, then I might know what should be put in systm.h. In 4.4BSD, it only declares a few variables and prototypes, and includes (which declares a few inline functions and prototypes), and defines 3 bogus macros which FreeBSD removed. An implementation from scratch should have only types in , only parameters in , extern declarations prototypes in somewhere like , and general macros and inlines in 1 or 2 other headers. 4.4BSD and FreeBSD also have kernel.h a only small subset of kernel stuff in it. In 4.4BSD. this has a prominent comment saying that it is for global kernel variables. In FreeBSD, it still has this comment, but most of the file is now for SYSINITs and TUNABLEs. It also has intrhook stuff, and namespace pollution for SYSINITs and intrhooks. In FreeBSD-1, all except 1 of the data declarations in systm.h was moved to kernel.h, apparently to give a more logical split of data declarations and prototypes. Most kernel files won' need the data declarations, since globals were uncommon and are less common with SMP. But most kernel files need some general prototypes, for printf() at least. Bruce From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 15:49:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E44B1106564A; Mon, 12 Dec 2011 15:49:52 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 7B9F78FC18; Mon, 12 Dec 2011 15:49:52 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 110EB46B37; Mon, 12 Dec 2011 10:49:52 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8DE9EB93A; Mon, 12 Dec 2011 10:49:51 -0500 (EST) From: John Baldwin To: Fabien Thomas Date: Mon, 12 Dec 2011 10:49:50 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201112120950.pBC9oYXp093069@svn.freebsd.org> In-Reply-To: <201112120950.pBC9oYXp093069@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201112121049.50947.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 12 Dec 2011 10:49:51 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228431 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/viawd sys/i386/conf sys/modules sys/modules/viawd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 15:49:53 -0000 On Monday, December 12, 2011 4:50:34 am Fabien Thomas wrote: > Author: fabient > Date: Mon Dec 12 09:50:33 2011 > New Revision: 228431 > URL: http://svn.freebsd.org/changeset/base/228431 > > Log: > Add watchdog support for VIA south bridge chipset. > Tested on VT8251, VX900 but CX700, VX800, VX855 should works. > > MFC after: 1 month > Sponsored by: NETASQ Eh, please don't use pci_find_device() but use a PCI probe routine instead. What should happen in this case is that this should be a child of 'isab' and it should attach based on the PCI ID of the 'isab' device. You can find that by fetching the PCI ID of the parent device in your identify routine like so: /* Look for a supported VIA south bridge. */ static struct viawd_device * viawd_find(device_t dev) { struct viawd_device *id; if (pci_get_vendor(dev) != VENDORID_VIA) return (NULL); for (id = viawd_devices; id->desc != NULL; id++) if (pci_get_device(dev) == id->device) return (id); return (NULL); } static void viawd_identify(driver_t *driver, device_t parent) { if (viawd_find(parent) == NULL) return; if (device_find_child(parent, driver->name, -1) == NULL) BUS_ADD_CHILD(parent, 0, driver->name, 0); } static int viawd_probe(device_t dev) { struct viawd_device *id; id = viawd_find(device_get_parent(dev)); KASSERT(id != NULL, ("parent should be a valid VIA SB")); device_set_desc(dev, id->desc); return (BUS_GENERIC_PROBE); } static int viawd_attach(device_t dev) { device_t sb_dev; ... sb_dev = device_get_parent(dev); ... } (Note use of device_set_desc(), you only need device_set_desc_copy() if your strings are not constant.) Also, please remove wd_bst and wd_bsh. Instead, change the read/write macros like so: #define viawd_read_wd_4(sc, off) bus_read_4((sc)->wd_res, (off)) #define viawd_write_wd_4(sc, off, val) \ bus_write_r((sc)->wd_res, (off), (val)) (I would even consider dropping the "_wd" from their names since it is redundant since "viawd" already has wd in the name.) Finally, it looks like viawd_modevent() is debugging? It can probably be removed now? > Added: > head/share/man/man4/viawd.4 (contents, props changed) > head/sys/dev/viawd/ > head/sys/dev/viawd/viawd.c (contents, props changed) > head/sys/dev/viawd/viawd.h (contents, props changed) > head/sys/modules/viawd/ > head/sys/modules/viawd/Makefile (contents, props changed) > Modified: > head/share/man/man4/Makefile > head/sys/amd64/conf/NOTES > head/sys/conf/files.amd64 > head/sys/conf/files.i386 > head/sys/i386/conf/NOTES > head/sys/modules/Makefile > > Modified: head/share/man/man4/Makefile > ============================================================================== > --- head/share/man/man4/Makefile Mon Dec 12 07:46:10 2011 (r228430) > +++ head/share/man/man4/Makefile Mon Dec 12 09:50:33 2011 (r228431) > @@ -499,6 +499,7 @@ MAN= aac.4 \ > vga.4 \ > vge.4 \ > viapm.4 \ > + ${_viawd.4} \ > vinum.4 \ > vkbd.4 \ > vlan.4 \ > @@ -711,6 +712,7 @@ _speaker.4= speaker.4 > _spkr.4= spkr.4 > _tpm.4= tpm.4 > _urtw.4= urtw.4 > +_viawd.4= viawd.4 > _wpi.4= wpi.4 > _xen.4= xen.4 > > > Added: head/share/man/man4/viawd.4 > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/share/man/man4/viawd.4 Mon Dec 12 09:50:33 2011 (r228431) > @@ -0,0 +1,79 @@ > +.\"- > +.\" Copyright (c) 2011 Fabien Thomas > +.\" All rights reserved. > +.\" > +.\" Redistribution and use in source and binary forms, with or without > +.\" modification, are permitted provided that the following conditions > +.\" are met: > +.\" 1. Redistributions of source code must retain the above copyright > +.\" notice, this list of conditions and the following disclaimer. > +.\" 2. Redistributions in binary form must reproduce the above copyright > +.\" notice, this list of conditions and the following disclaimer in the > +.\" documentation and/or other materials provided with the distribution. > +.\" > +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND > +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > +.\" SUCH DAMAGE. > +.\" > +.\" $FreeBSD$ > +.\" > +.Dd December 7, 2011 > +.Dt VIAWD 4 > +.Os > +.Sh NAME > +.Nm viawd > +.Nd device driver for VIA south bridge watchdog timer > +.Sh SYNOPSIS > +To compile this driver into the kernel, > +place the following line in your > +kernel configuration file: > +.Bd -ragged -offset indent > +.Cd "device viawd" > +.Ed > +.Pp > +Alternatively, to load the driver as a > +module at boot time, place the following line in > +.Xr loader.conf 5 : > +.Bd -literal -offset indent > +viawd_load="YES" > +.Ed > +.Sh DESCRIPTION > +The > +.Nm > +driver provides > +.Xr watchdog 4 > +support for the watchdog interrupt timer present on > +VIA south bridge chipset (VT8251, CX700, VX800, VX855, VX900). > +.Pp > +The VIA south bridge have a built-in watchdog timer, > +which can be enabled and disabled by user's program and set between > +1 to 1023 seconds. > +.Pp > +The > +.Nm > +driver when unloaded with running watchdog will reschedule the watchdog > +to 5 minutes. > +.Sh SEE ALSO > +.Xr watchdog 4 , > +.Xr watchdog 8 , > +.Xr watchdogd 8 , > +.Xr watchdog 9 > +.Sh HISTORY > +The > +.Nm > +driver first appeared in > +.Fx 10.0 . > +.Sh AUTHORS > +.An -nosplit > +The > +.Nm > +driver and this manual page were written by > +.An Fabien Thomas Aq fabient@FreeBSD.org . > > Modified: head/sys/amd64/conf/NOTES > ============================================================================== > --- head/sys/amd64/conf/NOTES Mon Dec 12 07:46:10 2011 (r228430) > +++ head/sys/amd64/conf/NOTES Mon Dec 12 09:50:33 2011 (r228431) > @@ -458,6 +458,7 @@ device tpm > # > device ichwd > device amdsbwd > +device viawd > > # > # Temperature sensors: > > Modified: head/sys/conf/files.amd64 > ============================================================================== > --- head/sys/conf/files.amd64 Mon Dec 12 07:46:10 2011 (r228430) > +++ head/sys/conf/files.amd64 Mon Dec 12 09:50:33 2011 (r228431) > @@ -260,6 +260,7 @@ dev/tpm/tpm.c optional tpm > dev/tpm/tpm_acpi.c optional tpm acpi > dev/tpm/tpm_isa.c optional tpm isa > dev/uart/uart_cpu_amd64.c optional uart > +dev/viawd/viawd.c optional viawd > dev/wpi/if_wpi.c optional wpi > isa/syscons_isa.c optional sc > isa/vga_isa.c optional vga > > Modified: head/sys/conf/files.i386 > ============================================================================== > --- head/sys/conf/files.i386 Mon Dec 12 07:46:10 2011 (r228430) > +++ head/sys/conf/files.i386 Mon Dec 12 09:50:33 2011 (r228431) > @@ -236,6 +236,7 @@ dev/tpm/tpm.c optional tpm > dev/tpm/tpm_acpi.c optional tpm acpi > dev/tpm/tpm_isa.c optional tpm isa > dev/uart/uart_cpu_i386.c optional uart > +dev/viawd/viawd.c optional viawd > dev/acpica/acpi_if.m standard > dev/acpi_support/acpi_wmi_if.m standard > dev/wpi/if_wpi.c optional wpi > > Added: head/sys/dev/viawd/viawd.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/viawd/viawd.c Mon Dec 12 09:50:33 2011 (r228431) > @@ -0,0 +1,286 @@ > +/*- > + * Copyright (c) 2011 Fabien Thomas > + * 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 "viawd.h" > + > +#define viawd_read_wd_4(sc, off) \ > + bus_space_read_4((sc)->wd_bst, (sc)->wd_bsh, (off)) > +#define viawd_write_wd_4(sc, off, val) \ > + bus_space_write_4((sc)->wd_bst, (sc)->wd_bsh, (off), (val)) > + > +static struct viawd_device viawd_devices[] = { > + { DEVICEID_VT8251, "VIA VT8251 watchdog timer" }, > + { DEVICEID_CX700, "VIA CX700 watchdog timer" }, > + { DEVICEID_VX800, "VIA VX800 watchdog timer" }, > + { DEVICEID_VX855, "VIA VX855 watchdog timer" }, > + { DEVICEID_VX900, "VIA VX900 watchdog timer" }, > + { 0, NULL }, > +}; > + > +static devclass_t viawd_devclass; > + > +static device_t > +viawd_find(struct viawd_device **id_p) > +{ > + struct viawd_device *id; > + device_t sb_dev = NULL; > + > + /* Look for a supported VIA south bridge. */ > + for (id = viawd_devices; id->desc != NULL; ++id) > + if ((sb_dev = pci_find_device(VENDORID_VIA, id->device)) != NULL) > + break; > + > + if (sb_dev == NULL) > + return (NULL); > + > + if (id_p != NULL) > + *id_p = id; > + > + return (sb_dev); > +} > + > +static void > +viawd_tmr_state(struct viawd_softc *sc, int enable) > +{ > + uint32_t reg; > + > + reg = viawd_read_wd_4(sc, VIAWD_MEM_CTRL); > + if (enable) > + reg |= VIAWD_MEM_CTRL_TRIGGER | VIAWD_MEM_CTRL_ENABLE; > + else > + reg &= ~VIAWD_MEM_CTRL_ENABLE; > + viawd_write_wd_4(sc, VIAWD_MEM_CTRL, reg); > +} > + > +static void > +viawd_tmr_set(struct viawd_softc *sc, unsigned int timeout) > +{ > + > + /* Keep value in range. */ > + if (timeout < VIAWD_MEM_COUNT_MIN) > + timeout = VIAWD_MEM_COUNT_MIN; > + else if (timeout > VIAWD_MEM_COUNT_MAX) > + timeout = VIAWD_MEM_COUNT_MAX; > + > + viawd_write_wd_4(sc, VIAWD_MEM_COUNT, timeout); > + sc->timeout = timeout; > +} > + > +/* > + * Watchdog event handler - called by the framework to enable or disable > + * the watchdog or change the initial timeout value. > + */ > +static void > +viawd_event(void *arg, unsigned int cmd, int *error) > +{ > + struct viawd_softc *sc = arg; > + unsigned int timeout; > + > + /* Convert from power-of-two-ns to second. */ > + cmd &= WD_INTERVAL; > + timeout = ((uint64_t)1 << cmd) / 1000000000; > + if (cmd) { > + if (timeout != sc->timeout) > + viawd_tmr_set(sc, timeout); > + viawd_tmr_state(sc, 1); > + *error = 0; > + } else > + viawd_tmr_state(sc, 0); > +} > + > +static void > +viawd_identify(driver_t *driver, device_t parent) > +{ > + device_t dev; > + device_t sb_dev; > + struct viawd_device *id_p; > + > + sb_dev = viawd_find(&id_p); > + if (sb_dev == NULL) > + return; > + > + /* Good, add child to bus. */ > + if ((dev = device_find_child(parent, driver->name, 0)) == NULL) > + dev = BUS_ADD_CHILD(parent, 0, driver->name, 0); > + > + if (dev == NULL) > + return; > + > + device_set_desc_copy(dev, id_p->desc); > +} > + > +static int > +viawd_probe(device_t dev) > +{ > + > + /* Do not claim some ISA PnP device by accident. */ > + if (isa_get_logicalid(dev) != 0) > + return (ENXIO); > + return (0); > +} > + > +static int > +viawd_attach(device_t dev) > +{ > + device_t sb_dev; > + struct viawd_softc *sc; > + struct viawd_device *id_p; > + uint32_t pmbase, reg; > + > + sc = device_get_softc(dev); > + sc->dev = dev; > + > + sb_dev = viawd_find(&id_p); > + if (sb_dev == NULL) { > + device_printf(dev, "Can not find watchdog device.\n"); > + goto fail; > + } > + sc->sb_dev = sb_dev; > + > + /* Get watchdog memory base. */ > + pmbase = pci_read_config(sb_dev, VIAWD_CONFIG_BASE, 4); > + if (pmbase == 0) { > + device_printf(dev, > + "Watchdog disabled in BIOS or hardware\n"); > + goto fail; > + } > + > + /* Allocate I/O register space. */ > + sc->wd_rid = 0; > + sc->wd_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->wd_rid, > + pmbase, pmbase + VIAWD_MEM_LEN - 1, VIAWD_MEM_LEN, > + RF_ACTIVE | RF_SHAREABLE); > + if (sc->wd_res == NULL) { > + device_printf(dev, "Unable to map watchdog memory\n"); > + goto fail; > + } > + sc->wd_bst = rman_get_bustag(sc->wd_res); > + sc->wd_bsh = rman_get_bushandle(sc->wd_res); > + > + /* Check if watchdog fired last boot. */ > + reg = viawd_read_wd_4(sc, VIAWD_MEM_CTRL); > + if (reg & VIAWD_MEM_CTRL_FIRED) { > + device_printf(dev, > + "ERROR: watchdog rebooted the system\n"); > + /* Reset bit state. */ > + viawd_write_wd_4(sc, VIAWD_MEM_CTRL, reg); > + } > + > + /* Register the watchdog event handler. */ > + sc->ev_tag = EVENTHANDLER_REGISTER(watchdog_list, viawd_event, sc, 0); > + > + return (0); > +fail: > + if (sc->wd_res != NULL) > + bus_release_resource(dev, SYS_RES_MEMORY, > + sc->wd_rid, sc->wd_res); > + return (ENXIO); > +} > + > +static int > +viawd_detach(device_t dev) > +{ > + struct viawd_softc *sc; > + uint32_t reg; > + > + sc = device_get_softc(dev); > + > + /* Deregister event handler. */ > + if (sc->ev_tag != NULL) > + EVENTHANDLER_DEREGISTER(watchdog_list, sc->ev_tag); > + sc->ev_tag = NULL; > + > + /* > + * Do not stop the watchdog on shutdown if active but bump the > + * timer to avoid spurious reset. > + */ > + reg = viawd_read_wd_4(sc, VIAWD_MEM_CTRL); > + if (reg & VIAWD_MEM_CTRL_ENABLE) { > + viawd_tmr_set(sc, VIAWD_TIMEOUT_SHUTDOWN); > + viawd_tmr_state(sc, 1); > + device_printf(dev, > + "Keeping watchog alive during shutdown for %d seconds\n", > + VIAWD_TIMEOUT_SHUTDOWN); > + } > + > + if (sc->wd_res != NULL) > + bus_release_resource(sc->dev, SYS_RES_MEMORY, > + sc->wd_rid, sc->wd_res); > + > + return (0); > +} > + > +static device_method_t viawd_methods[] = { > + DEVMETHOD(device_identify, viawd_identify), > + DEVMETHOD(device_probe, viawd_probe), > + DEVMETHOD(device_attach, viawd_attach), > + DEVMETHOD(device_detach, viawd_detach), > + DEVMETHOD(device_shutdown, viawd_detach), > + {0,0} > +}; > + > +static driver_t viawd_driver = { > + "viawd", > + viawd_methods, > + sizeof(struct viawd_softc), > +}; > + > +static int > +viawd_modevent(module_t mode, int type, void *data) > +{ > + int error = 0; > + > + switch (type) { > + case MOD_LOAD: > + printf("viawd module loaded\n"); > + break; > + case MOD_UNLOAD: > + printf("viawd module unloaded\n"); > + break; > + case MOD_SHUTDOWN: > + printf("viawd module shutting down\n"); > + break; > + } > + return (error); > +} > + > +DRIVER_MODULE(viawd, isa, viawd_driver, viawd_devclass, viawd_modevent, NULL); > > Added: head/sys/dev/viawd/viawd.h > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/viawd/viawd.h Mon Dec 12 09:50:33 2011 (r228431) > @@ -0,0 +1,75 @@ > +/*- > + * Copyright (c) 2011 Fabien Thomas > + * 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$ > + */ > + > +#ifndef _VIAWD_H_ > +#define _VIAWD_H_ > + > +struct viawd_device { > + uint16_t device; > + char *desc; > +}; > + > +struct viawd_softc { > + device_t dev; > + device_t sb_dev; > + > + int wd_rid; > + struct resource *wd_res; > + bus_space_tag_t wd_bst; > + bus_space_handle_t wd_bsh; > + > + eventhandler_tag ev_tag; > + unsigned int timeout; > +}; > + > +#define VENDORID_VIA 0x1106 > +#define DEVICEID_VT8251 0x3287 > +#define DEVICEID_CX700 0x8324 > +#define DEVICEID_VX800 0x8353 > +#define DEVICEID_VX855 0x8409 > +#define DEVICEID_VX900 0x8410 > + > +#define VIAWD_CONFIG_BASE 0xE8 > + > +#define VIAWD_MEM_LEN 8 > + > +#define VIAWD_MEM_CTRL 0x00 > +#define VIAWD_MEM_CTRL_TRIGGER 0x000000080 > +#define VIAWD_MEM_CTRL_DISABLE 0x000000008 > +#define VIAWD_MEM_CTRL_POWEROFF 0x000000004 > +#define VIAWD_MEM_CTRL_FIRED 0x000000002 > +#define VIAWD_MEM_CTRL_ENABLE 0x000000001 > + > +#define VIAWD_MEM_COUNT 0x04 > + > +#define VIAWD_MEM_COUNT_MIN 1 > +#define VIAWD_MEM_COUNT_MAX 1023 > + > +#define VIAWD_TIMEOUT_SHUTDOWN (5 * 60) > + > +#endif > > Modified: head/sys/i386/conf/NOTES > ============================================================================== > --- head/sys/i386/conf/NOTES Mon Dec 12 07:46:10 2011 (r228430) > +++ head/sys/i386/conf/NOTES Mon Dec 12 09:50:33 2011 (r228431) > @@ -831,6 +831,7 @@ hint.pcf.0.irq="5" > # > device ichwd > device amdsbwd > +device viawd > > # > # Temperature sensors: > > Modified: head/sys/modules/Makefile > ============================================================================== > --- head/sys/modules/Makefile Mon Dec 12 07:46:10 2011 (r228430) > +++ head/sys/modules/Makefile Mon Dec 12 09:50:33 2011 (r228431) > @@ -318,6 +318,7 @@ SUBDIR= ${_3dfx} \ > ${_vesa} \ > ${_virtio} \ > vge \ > + ${_viawd} \ > vkbd \ > ${_vpo} \ > vr \ > @@ -528,6 +529,7 @@ _nve= nve > _nvram= nvram > _nxge= nxge > _tpm= tpm > +_viawd= viawd > _wpi= wpi > _wpifw= wpifw > .if ${MK_CRYPT} != "no" || defined(ALL_MODULES) > @@ -637,6 +639,7 @@ _sppp= sppp > _tpm= tpm > _twa= twa > _vesa= vesa > +_viawd= viawd > _virtio= virtio > _vxge= vxge > _x86bios= x86bios > > Added: head/sys/modules/viawd/Makefile > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/modules/viawd/Makefile Mon Dec 12 09:50:33 2011 (r228431) > @@ -0,0 +1,8 @@ > +# $FreeBSD$ > + > +.PATH: ${.CURDIR}/../../dev/viawd > + > +KMOD= viawd > +SRCS= viawd.c device_if.h bus_if.h pci_if.h isa_if.h > + > +.include > -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 16:33:08 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0644B106568C; Mon, 12 Dec 2011 16:33:08 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 31B588FC32; Mon, 12 Dec 2011 16:33:07 +0000 (UTC) Received: by faaf16 with SMTP id f16so464195faa.13 for ; Mon, 12 Dec 2011 08:33:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=s/tdSP7RIRhv0qqMRTH15KnyR9IvV2CxKuIkjhZG11Y=; b=kEyyGYLPMF/HnSV1ROJIBWdjLYUWWTyZpbKbckKr4SHwusUfUl6Asr2VZ0Ha9ekkXb TcJJ6szMTPi0wRpubeRU1wg3LAZqX8fcWiCnOshY5VX+e28xn+Qc4RFKj+X56NLswsJs qPQv1dJaF85jOJlZgSFmUeUor/50qeNkEC9IU= MIME-Version: 1.0 Received: by 10.180.96.103 with SMTP id dr7mr23323388wib.16.1323706227418; Mon, 12 Dec 2011 08:10:27 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.216.171.8 with HTTP; Mon, 12 Dec 2011 08:10:27 -0800 (PST) In-Reply-To: <4EE5D574.9080303@FreeBSD.org> References: <201112121005.pBCA5Dar093711@svn.freebsd.org> <20111212101558.GK50300@deviant.kiev.zoral.com.ua> <4EE5D574.9080303@FreeBSD.org> Date: Mon, 12 Dec 2011 17:10:27 +0100 X-Google-Sender-Auth: CF3_-ni9bWSySsipDzOFWE3mEpM Message-ID: From: Attilio Rao To: Andriy Gapon Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Kostik Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228433 - in head/sys: kern security/mac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 16:33:08 -0000 2011/12/12 Andriy Gapon : > on 12/12/2011 12:15 Kostik Belousov said the following: >> On Mon, Dec 12, 2011 at 10:05:13AM +0000, Andriy Gapon wrote: >>> Author: avg >>> Date: Mon Dec 12 10:05:13 2011 >>> New Revision: 228433 >>> URL: http://svn.freebsd.org/changeset/base/228433 >>> >>> Log: >>> =C2=A0 put sys/systm.h at its proper place or add it if missing >>> >>> =C2=A0 Reported by: =C2=A0 =C2=A0 =C2=A0 lstewart, tinderbox >>> =C2=A0 Pointyhat to: =C2=A0 =C2=A0 =C2=A0avg, attilio >>> =C2=A0 MFC after: 1 week >>> =C2=A0 MFC with: =C2=A0r228430 >>> >>> Modified: >>> =C2=A0 head/sys/kern/kern_sx.c >>> =C2=A0 head/sys/kern/vfs_cache.c >>> =C2=A0 head/sys/security/mac/mac_framework.c >>> =C2=A0 head/sys/security/mac/mac_priv.c >> It means that previously sx.h did not required systm.h and now it does ? >> Might be, you should move SCHEDULER_STOPPED and stop_scheduler declarati= ons >> into sys/lock.h ? >> > > Strictly speaking it's sys/lockstat.h that now requires systm.h. > I am not an expert in FreeBSD header file organization, so I will just fo= llow > whatever the experts advise. I think that we should revert this part of the patch and just fix dtrace_probe() for pollution, this way we get the same effect and avoid namespace pollution (and still improve the MFC situation). I'll make a patch available in the next hour. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 17:05:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C501B106564A; Mon, 12 Dec 2011 17:05:15 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id D17BA8FC15; Mon, 12 Dec 2011 17:05:14 +0000 (UTC) Received: by wgbdr11 with SMTP id dr11so11742286wgb.31 for ; Mon, 12 Dec 2011 09:05:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=S5ocepTA4NFwRNMjPg/nRk4uawmXUhhmsAt6lfKRkPY=; b=s1MYCeWotWuiQdwSwryss6hddt8Tvnx8ChbcO6EpMmC4tLAZqvk3rtc1rfrDrJOIfQ OydYXwOtXsxYRuanax3612MBtBWj9IQ+OIHqy/Su3ZBJke8/w9bSDRavJ3BKhhl+TDZO 2l8dMdKTDoCQ90zVlYi2E00qoKmDuwW1GzMs0= MIME-Version: 1.0 Received: by 10.227.60.4 with SMTP id n4mr14865331wbh.9.1323709513598; Mon, 12 Dec 2011 09:05:13 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.216.171.8 with HTTP; Mon, 12 Dec 2011 09:05:13 -0800 (PST) In-Reply-To: References: <201112121005.pBCA5Dar093711@svn.freebsd.org> <20111212101558.GK50300@deviant.kiev.zoral.com.ua> <4EE5D574.9080303@FreeBSD.org> Date: Mon, 12 Dec 2011 18:05:13 +0100 X-Google-Sender-Auth: 3FOe0PLB1NH1w3uL7E8aJhoNiww Message-ID: From: Attilio Rao To: Andriy Gapon Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Kostik Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228433 - in head/sys: kern security/mac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 17:05:15 -0000 2011/12/12 Attilio Rao : > 2011/12/12 Andriy Gapon : >> on 12/12/2011 12:15 Kostik Belousov said the following: >>> On Mon, Dec 12, 2011 at 10:05:13AM +0000, Andriy Gapon wrote: >>>> Author: avg >>>> Date: Mon Dec 12 10:05:13 2011 >>>> New Revision: 228433 >>>> URL: http://svn.freebsd.org/changeset/base/228433 >>>> >>>> Log: >>>> =C2=A0 put sys/systm.h at its proper place or add it if missing >>>> >>>> =C2=A0 Reported by: =C2=A0 =C2=A0 =C2=A0 lstewart, tinderbox >>>> =C2=A0 Pointyhat to: =C2=A0 =C2=A0 =C2=A0avg, attilio >>>> =C2=A0 MFC after: 1 week >>>> =C2=A0 MFC with: =C2=A0r228430 >>>> >>>> Modified: >>>> =C2=A0 head/sys/kern/kern_sx.c >>>> =C2=A0 head/sys/kern/vfs_cache.c >>>> =C2=A0 head/sys/security/mac/mac_framework.c >>>> =C2=A0 head/sys/security/mac/mac_priv.c >>> It means that previously sx.h did not required systm.h and now it does = ? >>> Might be, you should move SCHEDULER_STOPPED and stop_scheduler declarat= ions >>> into sys/lock.h ? >>> >> >> Strictly speaking it's sys/lockstat.h that now requires systm.h. >> I am not an expert in FreeBSD header file organization, so I will just f= ollow >> whatever the experts advise. > > I think that we should revert this part of the patch and just fix > dtrace_probe() for pollution, this way we get the same effect and > avoid namespace pollution (and still improve the MFC situation). > > I'll make a patch available in the next hour. More precisely, what do you think about the patch below? I just didn't revert the moving of systm.h under param.h because Bruce seems to prefer that. I'm starting test-compile right now, let me know your preference. Attilio Index: sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (revision 228438) +++ sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (working co= py) @@ -5877,6 +5877,9 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintp volatile uint16_t *flags; hrtime_t now; + if (SCHEDULER_STOPPED()) + return; + #if defined(sun) /* * Kick out immediately if this CPU is still being born (in which c= ase Index: sys/security/mac/mac_priv.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/security/mac/mac_priv.c (revision 228438) +++ sys/security/mac/mac_priv.c (working copy) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include "opt_mac.h" #include -#include #include #include #include Index: sys/sys/lockstat.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/sys/lockstat.h (revision 228438) +++ sys/sys/lockstat.h (working copy) @@ -185,24 +185,17 @@ extern uint64_t lockstat_nsecs(void); #define LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l) do { \ uint32_t id; = \ = \ - if (!SCHEDULER_STOPPED()) { = \ - lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt,= \ - f, l); = \ - if ((id =3D lockstat_probemap[(probe)])) = \ - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, = \ - 0, 0); = \ - } = \ + lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, f, l); = \ + if ((id =3D lockstat_probemap[(probe)])) = \ + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); = \ } while (0) #define LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp) do { \ uint32_t id; = \ = \ - if (!SCHEDULER_STOPPED()) { = \ - lock_profile_release_lock(&(lp)->lock_object); = \ - if ((id =3D lockstat_probemap[(probe)])) = \ - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, = \ - 0, 0); = \ - } = \ + lock_profile_release_lock(&(lp)->lock_object); = \ + if ((id =3D lockstat_probemap[(probe)])) = \ + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); = \ } while (0) #else /* !KDTRACE_HOOKS */ From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 17:15:43 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FDF31065677; Mon, 12 Dec 2011 17:15:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 2A94F8FC12; Mon, 12 Dec 2011 17:15:41 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA25763; Mon, 12 Dec 2011 19:15:40 +0200 (EET) (envelope-from avg@FreeBSD.org) Message-ID: <4EE636BB.7050008@FreeBSD.org> Date: Mon, 12 Dec 2011 19:15:39 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111109 Thunderbird/8.0 MIME-Version: 1.0 To: Attilio Rao References: <201112121005.pBCA5Dar093711@svn.freebsd.org> <20111212101558.GK50300@deviant.kiev.zoral.com.ua> <4EE5D574.9080303@FreeBSD.org> In-Reply-To: X-Enigmail-Version: undefined Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Kostik Belousov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228433 - in head/sys: kern security/mac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 17:15:43 -0000 on 12/12/2011 19:05 Attilio Rao said the following: > More precisely, what do you think about the patch below? > I just didn't revert the moving of systm.h under param.h because Bruce > seems to prefer that. > > I'm starting test-compile right now, let me know your preference. The patch looks good to me. > Index: sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c > =================================================================== > --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c > (revision 228438) > +++ sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (working copy) > @@ -5877,6 +5877,9 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintp > volatile uint16_t *flags; > hrtime_t now; > > + if (SCHEDULER_STOPPED()) > + return; > + I think that this could even be "panicstr != NULL", there is probably no use for DTrace at panic time. > #if defined(sun) > /* > * Kick out immediately if this CPU is still being born (in which case > Index: sys/security/mac/mac_priv.c > =================================================================== > --- sys/security/mac/mac_priv.c (revision 228438) > +++ sys/security/mac/mac_priv.c (working copy) > @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); > #include "opt_mac.h" > > #include > -#include > #include > #include > #include I would even keep this inclusion, just for the "why not" reason. > Index: sys/sys/lockstat.h > =================================================================== > --- sys/sys/lockstat.h (revision 228438) > +++ sys/sys/lockstat.h (working copy) > @@ -185,24 +185,17 @@ extern uint64_t lockstat_nsecs(void); > #define LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, > f, l) do { \ > uint32_t id; \ > \ > - if (!SCHEDULER_STOPPED()) { \ > - lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, \ > - f, l); \ > - if ((id = lockstat_probemap[(probe)])) \ > - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, \ > - 0, 0); \ > - } \ > + lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, f, l); \ > + if ((id = lockstat_probemap[(probe)])) \ > + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); \ > } while (0) > > #define LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp) do { > \ > uint32_t id; \ > \ > - if (!SCHEDULER_STOPPED()) { \ > - lock_profile_release_lock(&(lp)->lock_object); \ > - if ((id = lockstat_probemap[(probe)])) \ > - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, \ > - 0, 0); \ > - } \ > + lock_profile_release_lock(&(lp)->lock_object); \ > + if ((id = lockstat_probemap[(probe)])) \ > + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); \ > } while (0) > > #else /* !KDTRACE_HOOKS */ -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 17:17:21 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22678106564A; Mon, 12 Dec 2011 17:17:21 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo-p00-ob6.rzone.de (mo-p00-ob6.rzone.de [IPv6:2a01:238:20a:202:53f0::1]) by mx1.freebsd.org (Postfix) with ESMTP id 37F5F8FC14; Mon, 12 Dec 2011 17:17:20 +0000 (UTC) X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQv0cW+St/nW/avgusCdvwXOZ/NA7x/bslxlDPy6G726REW7piU2JIqNTwRM= X-RZG-CLASS-ID: mo00 Received: from britannica.bec.de ([2001:6f8:13f0:0:5e26:aff:fe1e:99a9]) by post.strato.de (mrclete mo10) (RZmta 26.15 AUTH) with (DHE-RSA-AES128-SHA encrypted) ESMTPA id 904baenBCFr1kN ; Mon, 12 Dec 2011 18:17:11 +0100 (MET) Received: by britannica.bec.de (sSMTP sendmail emulation); Mon, 12 Dec 2011 18:17:09 +0100 Date: Mon, 12 Dec 2011 18:17:09 +0100 From: Joerg Sonnenberger To: Konstantin Belousov Message-ID: <20111212171709.GA22002@britannica.bec.de> References: <201112121103.pBCB3FuT097580@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112121103.pBCB3FuT097580@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 17:17:21 -0000 On Mon, Dec 12, 2011 at 11:03:15AM +0000, Konstantin Belousov wrote: > To allow use of external references from the dispatch function, resolution > of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries > for PLT are prepared, and normal resolution of the GOT entries is finished. > Similar to how it is done by GNU, IRELATIVE relocations are resolved in > advance, instead of normal lazy handling for PLT. Are you sure that you didn't introduce major locking issues with this? Joerg From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 17:21:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 864631065673; Mon, 12 Dec 2011 17:21:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id F31218FC08; Mon, 12 Dec 2011 17:21:37 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pBCHLXb1049670 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 12 Dec 2011 19:21:33 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pBCHLWIc035823; Mon, 12 Dec 2011 19:21:32 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pBCHLWUZ035822; Mon, 12 Dec 2011 19:21:32 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 12 Dec 2011 19:21:32 +0200 From: Kostik Belousov To: Joerg Sonnenberger Message-ID: <20111212172132.GN50300@deviant.kiev.zoral.com.ua> References: <201112121103.pBCB3FuT097580@svn.freebsd.org> <20111212171709.GA22002@britannica.bec.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NIGquufZ0ZWchBC3" Content-Disposition: inline In-Reply-To: <20111212171709.GA22002@britannica.bec.de> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 17:21:38 -0000 --NIGquufZ0ZWchBC3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 12, 2011 at 06:17:09PM +0100, Joerg Sonnenberger wrote: > On Mon, Dec 12, 2011 at 11:03:15AM +0000, Konstantin Belousov wrote: > > To allow use of external references from the dispatch function, resol= ution > > of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT e= ntries > > for PLT are prepared, and normal resolution of the GOT entries is fin= ished. > > Similar to how it is done by GNU, IRELATIVE relocations are resolved = in > > advance, instead of normal lazy handling for PLT. >=20 > Are you sure that you didn't introduce major locking issues with this? What do you mean, exactly ? The dispatcher function is called under the bind lock, yes. --NIGquufZ0ZWchBC3 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7mOBwACgkQC3+MBN1Mb4gDtQCg614hsk6wJ/Kr+wbOB21Om/fG iPMAoOg//59I3AnGJOMTwucicXYDT+aC =FNWK -----END PGP SIGNATURE----- --NIGquufZ0ZWchBC3-- From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 17:33:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36BB11065675; Mon, 12 Dec 2011 17:33:39 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 239278FC08; Mon, 12 Dec 2011 17:33:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCHXdCq011172; Mon, 12 Dec 2011 17:33:39 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCHXcfc011168; Mon, 12 Dec 2011 17:33:38 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201112121733.pBCHXcfc011168@svn.freebsd.org> From: Peter Holm Date: Mon, 12 Dec 2011 17:33:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228439 - in stable/8/sys: conf kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 17:33:39 -0000 Author: pho Date: Mon Dec 12 17:33:38 2011 New Revision: 228439 URL: http://svn.freebsd.org/changeset/base/228439 Log: MFC: r228218, r228219, 228220, 228221 Rename copyin_timeout32 to umtx_copyin_timeout32 and move parameter check here. Include check for negative seconds value. Add umtx_copyin_timeout() and move parameter checks here. Add declaration of umtx_copyin_timeout() Use umtx_copyin_timeout() to copy and check timeout parameteri in kern_thr_suspend(). Modified: stable/8/sys/kern/kern_thr.c stable/8/sys/kern/kern_umtx.c stable/8/sys/sys/umtx.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_thr.c ============================================================================== --- stable/8/sys/kern/kern_thr.c Mon Dec 12 13:12:55 2011 (r228438) +++ stable/8/sys/kern/kern_thr.c Mon Dec 12 17:33:38 2011 (r228439) @@ -428,8 +428,7 @@ thr_suspend(struct thread *td, struct th tsp = NULL; if (uap->timeout != NULL) { - error = copyin((const void *)uap->timeout, (void *)&ts, - sizeof(struct timespec)); + error = umtx_copyin_timeout(uap->timeout, &ts); if (error != 0) return (error); tsp = &ts; @@ -445,9 +444,6 @@ kern_thr_suspend(struct thread *td, stru int error = 0, hz = 0; if (tsp != NULL) { - if (tsp->tv_sec < 0 || tsp->tv_nsec < 0 || - tsp->tv_nsec > 1000000000) - return (EINVAL); if (tsp->tv_sec == 0 && tsp->tv_nsec == 0) return (ETIMEDOUT); TIMESPEC_TO_TIMEVAL(&tv, tsp); Modified: stable/8/sys/kern/kern_umtx.c ============================================================================== --- stable/8/sys/kern/kern_umtx.c Mon Dec 12 13:12:55 2011 (r228438) +++ stable/8/sys/kern/kern_umtx.c Mon Dec 12 17:33:38 2011 (r228439) @@ -2740,6 +2740,21 @@ _umtx_unlock(struct thread *td, struct _ return do_unlock_umtx(td, uap->umtx, td->td_tid); } +inline int +umtx_copyin_timeout(const void *addr, struct timespec *tsp) +{ + int error; + + error = copyin(addr, tsp, sizeof(struct timespec)); + if (error == 0) { + if (tsp->tv_sec < 0 || + tsp->tv_nsec >= 1000000000 || + tsp->tv_nsec < 0) + error = EINVAL; + } + return (error); +} + static int __umtx_op_lock_umtx(struct thread *td, struct _umtx_op_args *uap) { @@ -2750,13 +2765,9 @@ __umtx_op_lock_umtx(struct thread *td, s if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } ts = &timeout; } return (do_lock_umtx(td, uap->obj, uap->val, ts)); @@ -2777,12 +2788,9 @@ __umtx_op_wait(struct thread *td, struct if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_wait(td, uap->obj, uap->val, ts, 0, 0); @@ -2797,12 +2805,9 @@ __umtx_op_wait_uint(struct thread *td, s if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_wait(td, uap->obj, uap->val, ts, 1, 0); @@ -2817,12 +2822,9 @@ __umtx_op_wait_uint_private(struct threa if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_wait(td, uap->obj, uap->val, ts, 1, 1); @@ -2850,14 +2852,9 @@ __umtx_op_lock_umutex(struct thread *td, if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, - sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } ts = &timeout; } return do_lock_umutex(td, uap->obj, ts, 0); @@ -2879,14 +2876,9 @@ __umtx_op_wait_umutex(struct thread *td, if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, - sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } ts = &timeout; } return do_lock_umutex(td, uap->obj, ts, _UMUTEX_WAIT); @@ -2920,14 +2912,9 @@ __umtx_op_cv_wait(struct thread *td, str if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin(uap->uaddr2, &timeout, - sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } ts = &timeout; } return (do_cv_wait(td, uap->obj, uap->uaddr1, ts, uap->val)); @@ -2955,14 +2942,9 @@ __umtx_op_rw_rdlock(struct thread *td, s if (uap->uaddr2 == NULL) { error = do_rw_rdlock(td, uap->obj, uap->val, 0); } else { - error = copyin(uap->uaddr2, &timeout, - sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } error = do_rw_rdlock2(td, uap->obj, uap->val, &timeout); } return (error); @@ -2978,14 +2960,9 @@ __umtx_op_rw_wrlock(struct thread *td, s if (uap->uaddr2 == NULL) { error = do_rw_wrlock(td, uap->obj, 0); } else { - error = copyin(uap->uaddr2, &timeout, - sizeof(timeout)); + error = umtx_copyin_timeout(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } error = do_rw_wrlock2(td, uap->obj, &timeout); } @@ -3051,15 +3028,21 @@ struct timespec32 { }; static inline int -copyin_timeout32(void *addr, struct timespec *tsp) +umtx_copyin_timeout32(void *addr, struct timespec *tsp) { struct timespec32 ts32; int error; error = copyin(addr, &ts32, sizeof(struct timespec32)); if (error == 0) { - tsp->tv_sec = ts32.tv_sec; - tsp->tv_nsec = ts32.tv_nsec; + if (ts32.tv_sec < 0 || + ts32.tv_nsec >= 1000000000 || + ts32.tv_nsec < 0) + error = EINVAL; + else { + tsp->tv_sec = ts32.tv_sec; + tsp->tv_nsec = ts32.tv_nsec; + } } return (error); } @@ -3074,13 +3057,9 @@ __umtx_op_lock_umtx_compat32(struct thre if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } ts = &timeout; } return (do_lock_umtx32(td, uap->obj, uap->val, ts)); @@ -3101,12 +3080,9 @@ __umtx_op_wait_compat32(struct thread *t if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_wait(td, uap->obj, uap->val, ts, 1, 0); @@ -3122,12 +3098,9 @@ __umtx_op_lock_umutex_compat32(struct th if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_lock_umutex(td, uap->obj, ts, 0); @@ -3143,12 +3116,9 @@ __umtx_op_wait_umutex_compat32(struct th if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_lock_umutex(td, uap->obj, ts, _UMUTEX_WAIT); @@ -3164,12 +3134,9 @@ __umtx_op_cv_wait_compat32(struct thread if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return (do_cv_wait(td, uap->obj, uap->uaddr1, ts, uap->val)); @@ -3185,13 +3152,9 @@ __umtx_op_rw_rdlock_compat32(struct thre if (uap->uaddr2 == NULL) { error = do_rw_rdlock(td, uap->obj, uap->val, 0); } else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } error = do_rw_rdlock2(td, uap->obj, uap->val, &timeout); } return (error); @@ -3207,13 +3170,9 @@ __umtx_op_rw_wrlock_compat32(struct thre if (uap->uaddr2 == NULL) { error = do_rw_wrlock(td, uap->obj, 0); } else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) { - return (EINVAL); - } error = do_rw_wrlock2(td, uap->obj, &timeout); } @@ -3229,12 +3188,9 @@ __umtx_op_wait_uint_private_compat32(str if (uap->uaddr2 == NULL) ts = NULL; else { - error = copyin_timeout32(uap->uaddr2, &timeout); + error = umtx_copyin_timeout32(uap->uaddr2, &timeout); if (error != 0) return (error); - if (timeout.tv_nsec >= 1000000000 || - timeout.tv_nsec < 0) - return (EINVAL); ts = &timeout; } return do_wait(td, uap->obj, uap->val, ts, 1, 1); Modified: stable/8/sys/sys/umtx.h ============================================================================== --- stable/8/sys/sys/umtx.h Mon Dec 12 13:12:55 2011 (r228438) +++ stable/8/sys/sys/umtx.h Mon Dec 12 17:33:38 2011 (r228439) @@ -241,6 +241,7 @@ umtx_key_match(const struct umtx_key *k1 k1->info.both.b == k2->info.both.b); } +int umtx_copyin_timeout(const void *, struct timespec *); int umtx_key_get(void *, int, int, struct umtx_key *); void umtx_key_release(struct umtx_key *); struct umtx_q *umtxq_alloc(void); From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 17:39:07 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E24E91065670 for ; Mon, 12 Dec 2011 17:39:07 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo-p00-ob6.rzone.de (mo-p00-ob6.rzone.de [IPv6:2a01:238:20a:202:53f0::1]) by mx1.freebsd.org (Postfix) with ESMTP id 7D8598FC14 for ; Mon, 12 Dec 2011 17:39:02 +0000 (UTC) X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQv0cW+St/nW/avgusCdvwXOZ/NA7x/bslxlDPy6G726REW7piU2JIqNTwRM= X-RZG-CLASS-ID: mo00 Received: from britannica.bec.de ([2001:6f8:13f0:0:5e26:aff:fe1e:99a9]) by smtp.strato.de (cohen mo2) (RZmta 26.15 AUTH) with (DHE-RSA-AES128-SHA encrypted) ESMTPA id Z024d1nBCG81Vm for ; Mon, 12 Dec 2011 18:38:50 +0100 (MET) Received: by britannica.bec.de (sSMTP sendmail emulation); Mon, 12 Dec 2011 18:38:48 +0100 Date: Mon, 12 Dec 2011 18:38:48 +0100 From: Joerg Sonnenberger To: svn-src-all@freebsd.org Message-ID: <20111212173847.GA1035@britannica.bec.de> References: <201112121103.pBCB3FuT097580@svn.freebsd.org> <20111212171709.GA22002@britannica.bec.de> <20111212172132.GN50300@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111212172132.GN50300@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 17:39:08 -0000 On Mon, Dec 12, 2011 at 07:21:32PM +0200, Kostik Belousov wrote: > On Mon, Dec 12, 2011 at 06:17:09PM +0100, Joerg Sonnenberger wrote: > > On Mon, Dec 12, 2011 at 11:03:15AM +0000, Konstantin Belousov wrote: > > > To allow use of external references from the dispatch function, resolution > > > of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries > > > for PLT are prepared, and normal resolution of the GOT entries is finished. > > > Similar to how it is done by GNU, IRELATIVE relocations are resolved in > > > advance, instead of normal lazy handling for PLT. > > > > Are you sure that you didn't introduce major locking issues with this? > What do you mean, exactly ? > > The dispatcher function is called under the bind lock, yes. What happens if the dispatcher function is trying to re-enter the dynamic linker? Joerg From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 18:27:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA7701065673; Mon, 12 Dec 2011 18:27:28 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E4748FC1B; Mon, 12 Dec 2011 18:27:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCIRSJG012851; Mon, 12 Dec 2011 18:27:28 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCIRSjZ012847; Mon, 12 Dec 2011 18:27:28 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201112121827.pBCIRSjZ012847@svn.freebsd.org> From: Matthew D Fleming Date: Mon, 12 Dec 2011 18:27:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228440 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 18:27:28 -0000 Author: mdf Date: Mon Dec 12 18:27:28 2011 New Revision: 228440 URL: http://svn.freebsd.org/changeset/base/228440 Log: Consistently use types in ixgbe driver code: - {ixgbe,ixv}_header_split is passed to TUNABLE_INT, so delcare it int, not bool. - {ixgbe,ixv}_tx_ctx_setup() returns a boolean value, so declare it bool, not int. - {ixgbe,ixv}_tso_setup() returns a bool, so declare it bool, not boolean_t. - {ixgbe,ixv}_txeof() returns a bool, so declare it bool, not boolean_t. - Do not re-define bool if the symbol already exists. MFC after: 2 weeks Sponsored by: Isilon Systems, LLC Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe_osdep.h head/sys/dev/ixgbe/ixv.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Mon Dec 12 17:33:38 2011 (r228439) +++ head/sys/dev/ixgbe/ixgbe.c Mon Dec 12 18:27:28 2011 (r228440) @@ -265,7 +265,7 @@ TUNABLE_INT("hw.ixgbe.enable_msix", &ixg * it can be a performance win in some workloads, but * in others it actually hurts, its off by default. */ -static bool ixgbe_header_split = FALSE; +static int ixgbe_header_split = FALSE; TUNABLE_INT("hw.ixgbe.hdr_split", &ixgbe_header_split); /* @@ -3066,7 +3066,7 @@ ixgbe_free_transmit_buffers(struct tx_ri * **********************************************************************/ -static boolean_t +static bool ixgbe_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp) { struct adapter *adapter = txr->adapter; @@ -3184,7 +3184,7 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, * adapters using advanced tx descriptors * **********************************************************************/ -static boolean_t +static bool ixgbe_tso_setup(struct tx_ring *txr, struct mbuf *mp, u32 *paylen) { struct adapter *adapter = txr->adapter; @@ -3348,7 +3348,7 @@ ixgbe_atr(struct tx_ring *txr, struct mb * tx_buffer is put back on the free queue. * **********************************************************************/ -static boolean_t +static bool ixgbe_txeof(struct tx_ring *txr) { struct adapter *adapter = txr->adapter; Modified: head/sys/dev/ixgbe/ixgbe_osdep.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe_osdep.h Mon Dec 12 17:33:38 2011 (r228439) +++ head/sys/dev/ixgbe/ixgbe_osdep.h Mon Dec 12 18:27:28 2011 (r228440) @@ -95,7 +95,9 @@ typedef uint16_t u16; typedef uint32_t u32; typedef int32_t s32; typedef uint64_t u64; +#ifndef __bool_true_false_are_defined typedef boolean_t bool; +#endif #define le16_to_cpu Modified: head/sys/dev/ixgbe/ixv.c ============================================================================== --- head/sys/dev/ixgbe/ixv.c Mon Dec 12 17:33:38 2011 (r228439) +++ head/sys/dev/ixgbe/ixv.c Mon Dec 12 18:27:28 2011 (r228440) @@ -207,7 +207,7 @@ TUNABLE_INT("hw.ixv.flow_control", &ixv_ * it can be a performance win in some workloads, but * in others it actually hurts, its off by default. */ -static bool ixv_header_split = FALSE; +static int ixv_header_split = FALSE; TUNABLE_INT("hw.ixv.hdr_split", &ixv_header_split); /* @@ -2374,7 +2374,7 @@ ixv_free_transmit_buffers(struct tx_ring * **********************************************************************/ -static boolean_t +static bool ixv_tx_ctx_setup(struct tx_ring *txr, struct mbuf *mp) { struct adapter *adapter = txr->adapter; @@ -2497,7 +2497,7 @@ ixv_tx_ctx_setup(struct tx_ring *txr, st * adapters using advanced tx descriptors * **********************************************************************/ -static boolean_t +static bool ixv_tso_setup(struct tx_ring *txr, struct mbuf *mp, u32 *paylen) { struct adapter *adapter = txr->adapter; @@ -2586,7 +2586,7 @@ ixv_tso_setup(struct tx_ring *txr, struc * tx_buffer is put back on the free queue. * **********************************************************************/ -static boolean_t +static bool ixv_txeof(struct tx_ring *txr) { struct adapter *adapter = txr->adapter; From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 18:27:35 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 392DA1065770; Mon, 12 Dec 2011 18:27:34 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B8CD8FC14; Mon, 12 Dec 2011 18:27:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCIRYER012896; Mon, 12 Dec 2011 18:27:34 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCIRYOS012892; Mon, 12 Dec 2011 18:27:34 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201112121827.pBCIRYOS012892@svn.freebsd.org> From: Matthew D Fleming Date: Mon, 12 Dec 2011 18:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228441 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 18:27:35 -0000 Author: mdf Date: Mon Dec 12 18:27:34 2011 New Revision: 228441 URL: http://svn.freebsd.org/changeset/base/228441 Log: Consistently use types in e1000 driver code: - Two struct members eee_disable are used in a function that expects an int *, so declare them int, not bool. - igb_tx_ctx_setup() returns a boolean value, so declare it bool, not int. - igb_header_split is passed to TUNABLE_INT, so delcare it int, not bool. - igb_tso_setup() returns a bool, so declare it bool, not boolean_t. - Do not re-define bool/true/false if the symbols already exist. MFC after: 2 weeks Sponsored by: Isilon Systems, LLC Modified: head/sys/dev/e1000/e1000_hw.h head/sys/dev/e1000/e1000_osdep.h head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/e1000_hw.h ============================================================================== --- head/sys/dev/e1000/e1000_hw.h Mon Dec 12 18:27:28 2011 (r228440) +++ head/sys/dev/e1000/e1000_hw.h Mon Dec 12 18:27:34 2011 (r228441) @@ -911,13 +911,13 @@ struct e1000_dev_spec_ich8lan { E1000_MUTEX nvm_mutex; E1000_MUTEX swflag_mutex; bool nvm_k1_enabled; - bool eee_disable; + int eee_disable; }; struct e1000_dev_spec_82575 { bool sgmii_active; bool global_device_reset; - bool eee_disable; + int eee_disable; bool module_plugged; u32 mtu; }; Modified: head/sys/dev/e1000/e1000_osdep.h ============================================================================== --- head/sys/dev/e1000/e1000_osdep.h Mon Dec 12 18:27:28 2011 (r228440) +++ head/sys/dev/e1000/e1000_osdep.h Mon Dec 12 18:27:34 2011 (r228441) @@ -73,9 +73,11 @@ #define STATIC static #define FALSE 0 -#define false FALSE #define TRUE 1 +#ifndef __bool_true_false_are_defined +#define false FALSE #define true TRUE +#endif #define CMD_MEM_WRT_INVALIDATE 0x0010 /* BIT_4 */ #define PCI_COMMAND_REGISTER PCIR_COMMAND @@ -96,7 +98,9 @@ typedef int64_t s64; typedef int32_t s32; typedef int16_t s16; typedef int8_t s8; +#ifndef __bool_true_false_are_defined typedef boolean_t bool; +#endif #define __le16 u16 #define __le32 u32 Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Mon Dec 12 18:27:28 2011 (r228440) +++ head/sys/dev/e1000/if_igb.c Mon Dec 12 18:27:34 2011 (r228441) @@ -223,7 +223,7 @@ static __inline void igb_rx_input(struct static bool igb_rxeof(struct igb_queue *, int, int *); static void igb_rx_checksum(u32, struct mbuf *, u32); -static int igb_tx_ctx_setup(struct tx_ring *, struct mbuf *); +static bool igb_tx_ctx_setup(struct tx_ring *, struct mbuf *); static bool igb_tso_setup(struct tx_ring *, struct mbuf *, int, struct ip *, struct tcphdr *); static void igb_set_promisc(struct adapter *); @@ -335,7 +335,7 @@ TUNABLE_INT("hw.igb.max_interrupt_rate", ** into the header and thus use no cluster. Its ** a very workload dependent type feature. */ -static bool igb_header_split = FALSE; +static int igb_header_split = FALSE; TUNABLE_INT("hw.igb.hdr_split", &igb_header_split); /* @@ -3441,7 +3441,7 @@ igb_free_transmit_buffers(struct tx_ring * Setup work for hardware segmentation offload (TSO) * **********************************************************************/ -static boolean_t +static bool igb_tso_setup(struct tx_ring *txr, struct mbuf *mp, int ehdrlen, struct ip *ip, struct tcphdr *th) { From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 18:43:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2244106566B; Mon, 12 Dec 2011 18:43:18 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B16BF8FC19; Mon, 12 Dec 2011 18:43:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCIhIrq013488; Mon, 12 Dec 2011 18:43:18 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCIhIYB013486; Mon, 12 Dec 2011 18:43:18 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201112121843.pBCIhIYB013486@svn.freebsd.org> From: Matthew D Fleming Date: Mon, 12 Dec 2011 18:43:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228442 - head/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 18:43:18 -0000 Author: mdf Date: Mon Dec 12 18:43:18 2011 New Revision: 228442 URL: http://svn.freebsd.org/changeset/base/228442 Log: Do not use the sometimes-reserved work 'bool' for a variable name. MFC after: 2 weeks Sponsored by: Isilon Systems, LLC Modified: head/sys/cam/scsi/scsi_xpt.c Modified: head/sys/cam/scsi/scsi_xpt.c ============================================================================== --- head/sys/cam/scsi/scsi_xpt.c Mon Dec 12 18:27:34 2011 (r228441) +++ head/sys/cam/scsi/scsi_xpt.c Mon Dec 12 18:43:18 2011 (r228442) @@ -1811,14 +1811,14 @@ scsi_find_quirk(struct cam_ed *device) static int sysctl_cam_search_luns(SYSCTL_HANDLER_ARGS) { - int error, bool; + int error, val; - bool = cam_srch_hi; - error = sysctl_handle_int(oidp, &bool, 0, req); + val = cam_srch_hi; + error = sysctl_handle_int(oidp, &val, 0, req); if (error != 0 || req->newptr == NULL) return (error); - if (bool == 0 || bool == 1) { - cam_srch_hi = bool; + if (val == 0 || val == 1) { + cam_srch_hi = val; return (0); } else { return (EINVAL); From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 18:43:25 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A77241065775; Mon, 12 Dec 2011 18:43:24 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 986A98FC0A; Mon, 12 Dec 2011 18:43:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCIhOoh013537; Mon, 12 Dec 2011 18:43:24 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCIhOuP013530; Mon, 12 Dec 2011 18:43:24 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201112121843.pBCIhOuP013530@svn.freebsd.org> From: Matthew D Fleming Date: Mon, 12 Dec 2011 18:43:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228443 - in head/sys: dev/cxgbe dev/drm dev/speaker dev/tws dev/vxge ofed/include/linux X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 18:43:25 -0000 Author: mdf Date: Mon Dec 12 18:43:24 2011 New Revision: 228443 URL: http://svn.freebsd.org/changeset/base/228443 Log: Do not define bool/true/false if the symbols already exist. MFC after: 2 weeks Sponsored by: Isilon Systems, LLC Modified: head/sys/dev/cxgbe/osdep.h head/sys/dev/drm/i915_drv.h head/sys/dev/speaker/spkr.c head/sys/dev/tws/tws.h head/sys/dev/vxge/vxge-osdep.h head/sys/ofed/include/linux/types.h Modified: head/sys/dev/cxgbe/osdep.h ============================================================================== --- head/sys/dev/cxgbe/osdep.h Mon Dec 12 18:43:18 2011 (r228442) +++ head/sys/dev/cxgbe/osdep.h Mon Dec 12 18:43:24 2011 (r228443) @@ -70,9 +70,11 @@ typedef uint64_t __be64; #error "Must set BYTE_ORDER" #endif +#ifndef __bool_true_false_are_defined typedef boolean_t bool; #define false FALSE #define true TRUE +#endif #define mdelay(x) DELAY((x) * 1000) #define udelay(x) DELAY(x) Modified: head/sys/dev/drm/i915_drv.h ============================================================================== --- head/sys/dev/drm/i915_drv.h Mon Dec 12 18:43:18 2011 (r228442) +++ head/sys/dev/drm/i915_drv.h Mon Dec 12 18:43:24 2011 (r228443) @@ -560,7 +560,7 @@ extern void opregion_enable_asle(struct LOCK_TEST_WITH_RETURN(dev, file_priv); \ } while (0) -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) && !defined(__bool_true_false_are_defined) typedef boolean_t bool; #endif Modified: head/sys/dev/speaker/spkr.c ============================================================================== --- head/sys/dev/speaker/spkr.c Mon Dec 12 18:43:18 2011 (r228442) +++ head/sys/dev/speaker/spkr.c Mon Dec 12 18:43:24 2011 (r228443) @@ -130,7 +130,9 @@ rest(int centisecs) * except possibly at physical block boundaries. */ +#ifndef __bool_true_false_are_defined typedef int bool; +#endif #define TRUE 1 #define FALSE 0 Modified: head/sys/dev/tws/tws.h ============================================================================== --- head/sys/dev/tws/tws.h Mon Dec 12 18:43:18 2011 (r228442) +++ head/sys/dev/tws/tws.h Mon Dec 12 18:43:24 2011 (r228443) @@ -205,7 +205,11 @@ struct tws_init_connect_info { /* ------------ boolean types ------------------- */ +#ifndef __bool_true_false_are_defined typedef enum _boolean { false, true } boolean; +#else +#define boolean bool +#endif enum err { SUCCESS, FAILURE }; /* ----------- per instance data ---------------- */ Modified: head/sys/dev/vxge/vxge-osdep.h ============================================================================== --- head/sys/dev/vxge/vxge-osdep.h Mon Dec 12 18:43:18 2011 (r228442) +++ head/sys/dev/vxge/vxge-osdep.h Mon Dec 12 18:43:24 2011 (r228443) @@ -161,7 +161,9 @@ typedef uint16_t u16; typedef int32_t s32; typedef uint32_t u32; typedef unsigned long long int u64; +#ifndef __bool_true_false_are_defined typedef boolean_t bool; +#endif typedef bus_addr_t dma_addr_t; typedef struct mtx spinlock_t; typedef struct resource *pci_irq_h; Modified: head/sys/ofed/include/linux/types.h ============================================================================== --- head/sys/ofed/include/linux/types.h Mon Dec 12 18:43:18 2011 (r228442) +++ head/sys/ofed/include/linux/types.h Mon Dec 12 18:43:24 2011 (r228443) @@ -39,9 +39,11 @@ typedef __u32 __le32; typedef __u32 __be32; typedef __u64 __le64; typedef __u64 __be64; +#ifndef __bool_true_false_are_defined typedef _Bool bool; #define true TRUE #define false FALSE +#endif typedef unsigned long kernel_ulong_t; typedef unsigned int uint; From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 18:44:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A270A1065673; Mon, 12 Dec 2011 18:44:17 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 773F28FC26; Mon, 12 Dec 2011 18:44:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCIiHbh013620; Mon, 12 Dec 2011 18:44:17 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCIiHel013616; Mon, 12 Dec 2011 18:44:17 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201112121844.pBCIiHel013616@svn.freebsd.org> From: Matthew D Fleming Date: Mon, 12 Dec 2011 18:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228444 - in head: include sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 18:44:17 -0000 Author: mdf Date: Mon Dec 12 18:44:17 2011 New Revision: 228444 URL: http://svn.freebsd.org/changeset/base/228444 Log: - Define true and false in sys/types.h for _KERNEL consumers, and typedef bool. Due to macro expansion it seemed better to use a typedef for kernel consumers (specifically ofed won't compile without more changes if a define is used). - should also not re-define bool/true/false if they are defined by . It would probably be a programming error to define _KERNEL for user-space code, but downstream consumers like Isilon have already been including in kernel sources, and this protects that usage. - sizeof(_Bool) is not necessarily the same as sizeof(int), so kernel modules should be rebuild with this change. Bump __FreeBSD_version. MFC after: 2 weeks Sponsored by: Isilon Systems, LLC Modified: head/include/stdbool.h head/sys/sys/param.h head/sys/sys/types.h Modified: head/include/stdbool.h ============================================================================== --- head/include/stdbool.h Mon Dec 12 18:43:24 2011 (r228443) +++ head/include/stdbool.h Mon Dec 12 18:44:17 2011 (r228444) @@ -29,6 +29,7 @@ #ifndef _STDBOOL_H_ #define _STDBOOL_H_ +#ifndef __bool_true_false_are_defined #define __bool_true_false_are_defined 1 #ifndef __cplusplus @@ -42,5 +43,6 @@ typedef int _Bool; #endif #endif /* !__cplusplus */ +#endif /* __bool_true_false_are_defined */ #endif /* !_STDBOOL_H_ */ Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Dec 12 18:43:24 2011 (r228443) +++ head/sys/sys/param.h Mon Dec 12 18:44:17 2011 (r228444) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000001 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000002 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/sys/sys/types.h ============================================================================== --- head/sys/sys/types.h Mon Dec 12 18:43:24 2011 (r228443) +++ head/sys/sys/types.h Mon Dec 12 18:44:17 2011 (r228444) @@ -261,6 +261,16 @@ typedef __uint64_t uoff_t; typedef char vm_memattr_t; /* memory attribute codes */ typedef struct vm_page *vm_page_t; +#if !defined(__bool_true_false_are_defined) && !defined(__cplusplus) +#define __bool_true_false_are_defined 1 +#define false 0 +#define true 1 +#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER) +typedef int _Bool; +#endif +typedef _Bool bool; +#endif /* !__bool_true_false_are_defined && !__cplusplus */ + #define offsetof(type, field) __offsetof(type, field) #endif /* !_KERNEL */ From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 19:07:58 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79D37106564A; Mon, 12 Dec 2011 19:07:58 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 392A08FC12; Mon, 12 Dec 2011 19:07:58 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id C692C46B3B; Mon, 12 Dec 2011 14:07:57 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 5911EB93A; Mon, 12 Dec 2011 14:07:57 -0500 (EST) From: John Baldwin To: Mikolaj Golub Date: Mon, 12 Dec 2011 14:07:56 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201111242054.pAOKs6vj012296@svn.freebsd.org> <4EE12CE0.5070803@FreeBSD.org> <86y5ukvnll.fsf@kopusha.home.net> In-Reply-To: <86y5ukvnll.fsf@kopusha.home.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201112121407.56869.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 12 Dec 2011 14:07:57 -0500 (EST) Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Kostik Belousov Subject: Re: svn commit: r227956 - head/usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 19:07:58 -0000 On Saturday, December 10, 2011 3:26:46 am Mikolaj Golub wrote: > > On Thu, 08 Dec 2011 16:32:16 -0500 John Baldwin wrote: > > >> JB> Hmm, I would stick as close to limits output as possible. I would > >> JB> consider duplicating the unit field in each of soft and hard, so you > >> JB> end up with something like this: > >> > >> JB> PID COMM RLIMIT SOFT HARD > >> JB> 48798 zsh cputime 100000 secs infinity secs > >> JB> 48798 zsh filesize infinity kb infinity kb > >> JB> 48798 zsh datasize 524288 kb 524288 kb > >> > >> JB> etc. > >> > >> Ok. > >> > >> JB> (Things like 'openfiles' is simply more intuitive than 'nofile' (no > >> JB> file?, huh? oh, num open files.. (except not all users will make the > >> JB> last step there). > >> > >> Then why do we have so non-intuitive rlimit_ident names? > >> > >> It looks like they are used only in procfs_rlimit.c. Do procfs(5) users always > >> make that last step with 'nofile'? :-) > > JB> Well, I suspect it's best not to change the names in procfs in case > JB> there are existing binaries that parse the output of that file > JB> (unfortunately). > > >> Is it possible to change rlimit_ident names? Just to ones that are used by > >> limit(1) or (if they look too long) to something like below: > > JB> Hmm, I have no idea what other things might use rlimit_ident. Probably > JB> not many. (Also, for fun, note that the 'ulimit' and 'limit' built-in > JB> commands in sh and csh also have their own sets of names, fun!) I would > JB> maybe add a rlimit_names[] (just leave rlimit_ident alone), and give > JB> that the names from limits(1), and change both procstat and sh's > JB> ulimit' command to use those. > > Adding yet another rlimit names to the header file does not look so attractive > for me as it was just using/reusing what we had :-). So I decided to hardcode > the names in procstat_rlimit.c (see the attached patch). > > Output example: > > PID COMM RLIMIT SOFT HARD > 11949 zsh cputime 10000 sec infinity > 11949 zsh filesize infinity infinity > 11949 zsh datasize 524288 kB 524288 kB > 11949 zsh stacksize 65536 kB 65536 kB > 11949 zsh coredumpsize 190734 MB 190734 MB > 11949 zsh memoryuse infinity infinity > 11949 zsh memorylocked infinity infinity > 11949 zsh maxprocesses 5547 5547 > 11949 zsh openfiles 11095 11095 > 11949 zsh sbsize infinity infinity > 11949 zsh vmemoryuse infinity infinity > 11949 zsh pseudo-terminals infinity infinity > 11949 zsh swapuse infinity infinity This looks great to me, thanks! -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 19:20:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 566201065675; Mon, 12 Dec 2011 19:20:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id B1E6C8FC1B; Mon, 12 Dec 2011 19:20:33 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pBCJKLsa095073 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 12 Dec 2011 21:20:22 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pBCJKLpP036280; Mon, 12 Dec 2011 21:20:21 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pBCJKLIS036279; Mon, 12 Dec 2011 21:20:21 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 12 Dec 2011 21:20:21 +0200 From: Kostik Belousov To: Joerg Sonnenberger Message-ID: <20111212192021.GQ50300@deviant.kiev.zoral.com.ua> References: <201112121103.pBCB3FuT097580@svn.freebsd.org> <20111212171709.GA22002@britannica.bec.de> <20111212172132.GN50300@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XZPmG3kZLpEx7yD+" Content-Disposition: inline In-Reply-To: <20111212172132.GN50300@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 19:20:34 -0000 --XZPmG3kZLpEx7yD+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 12, 2011 at 07:21:32PM +0200, Kostik Belousov wrote: > On Mon, Dec 12, 2011 at 06:17:09PM +0100, Joerg Sonnenberger wrote: > > On Mon, Dec 12, 2011 at 11:03:15AM +0000, Konstantin Belousov wrote: > > > To allow use of external references from the dispatch function, res= olution > > > of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT= entries > > > for PLT are prepared, and normal resolution of the GOT entries is f= inished. > > > Similar to how it is done by GNU, IRELATIVE relocations are resolve= d in > > > advance, instead of normal lazy handling for PLT. > >=20 > > Are you sure that you didn't introduce major locking issues with this? > What do you mean, exactly ? >=20 > The dispatcher function is called under the bind lock, yes. To describe it in more details, _rtld_bind() read-locks the bind lock, and possible plt resolution from the dispatcher would also acquire bind lock in read mode, which is the supported operation. plt is explicitely designed to allow safe multithreaded updates, so the shared lock do not cause problems. What does not work with rtld locks is read lock acquisition after the write lock. Even more, it works for single-threaded locks, but fails for thr_rtld.c. After thinking more about your question, I see how this exact sequence can happen. If we dlopened the shared object that contains IRELATIVE or jump slot which target is STT_GNU_IFUNC, then possible recursive plt resolve from the dispatcher would cause it. Note that I do not even consider implementing support for dl*(3) calls from a dispatcher. The solution is to postpone the resolution for irelative/ifunc right before initializers are called, and drop bind lock around calls to dispatcher. The following patch is the implementation of the idea. It is somewhat bigger then I hoped because I decided to use initlist to iterate over the objects instead of the ->next, due to drop of the bind lock in iteration. diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c index 5ae8493..3b00987 100644 --- a/libexec/rtld-elf/amd64/reloc.c +++ b/libexec/rtld-elf/amd64/reloc.c @@ -413,6 +413,8 @@ reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate) const Elf_Rela *relalim; const Elf_Rela *rela; =20 + if (!obj->irelative) + return (0); relalim =3D (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize= ); for (rela =3D obj->pltrela; rela < relalim; rela++) { Elf_Addr *where, target, *ptr; @@ -424,11 +426,14 @@ reloc_iresolve(Obj_Entry *obj, RtldLockState *locksta= te) case R_X86_64_IRELATIVE: ptr =3D (Elf_Addr *)(obj->relocbase + rela->r_addend); where =3D (Elf_Addr *)(obj->relocbase + rela->r_offset); + lock_release(rtld_bind_lock, lockstate); target =3D ((Elf_Addr (*)(void))ptr)(); + wlock_acquire(rtld_bind_lock, lockstate); *where =3D target; break; } } + obj->irelative =3D false; return (0); } =20 @@ -455,13 +460,15 @@ reloc_gnu_ifunc(Obj_Entry *obj, RtldLockState *lockst= ate) return (-1); if (ELF_ST_TYPE(def->st_info) !=3D STT_GNU_IFUNC) continue; + lock_release(rtld_bind_lock, lockstate); target =3D (Elf_Addr)rtld_resolve_ifunc(defobj, def); + wlock_acquire(rtld_bind_lock, lockstate); reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); break; } } obj->gnu_ifunc =3D false; - return 0; + return (0); } =20 void diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c index 5f11106..30292ca 100644 --- a/libexec/rtld-elf/i386/reloc.c +++ b/libexec/rtld-elf/i386/reloc.c @@ -371,16 +371,21 @@ reloc_iresolve(Obj_Entry *obj, RtldLockState *locksta= te) const Elf_Rel *rel; Elf_Addr *where, target; =20 + if (!obj->irelative) + return (0); rellim =3D (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); for (rel =3D obj->pltrel; rel < rellim; rel++) { switch (ELF_R_TYPE(rel->r_info)) { case R_386_IRELATIVE: where =3D (Elf_Addr *)(obj->relocbase + rel->r_offset); + lock_release(rtld_bind_lock, lockstate); target =3D ((Elf_Addr (*)(void))(*where))(); + wlock_acquire(rtld_bind_lock, lockstate); *where =3D target; break; } } + obj->irelative =3D false; return (0); } =20 @@ -407,7 +412,9 @@ reloc_gnu_ifunc(Obj_Entry *obj, RtldLockState *lockstat= e) return (-1); if (ELF_ST_TYPE(def->st_info) !=3D STT_GNU_IFUNC) continue; + lock_release(rtld_bind_lock, lockstate); target =3D (Elf_Addr)rtld_resolve_ifunc(defobj, def); + wlock_acquire(rtld_bind_lock, lockstate); reloc_jmpslot(where, target, defobj, obj, rel); break; } diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 17cd67c..f91ebf7 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -116,6 +116,8 @@ static void objlist_push_tail(Objlist *, Obj_Entry *); static void objlist_remove(Objlist *, Obj_Entry *); static void *path_enumerate(const char *, path_enum_proc, void *); static int relocate_objects(Obj_Entry *, bool, Obj_Entry *, RtldLockState = *); +static int resolve_objects_ifunc(Obj_Entry *first, bool bind_now, + RtldLockState *lockstate); static int rtld_dirname(const char *, char *); static int rtld_dirname_abs(const char *, char *); static void rtld_exit(void); @@ -513,6 +515,10 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr= y **objp) ld_bind_now !=3D NULL && *ld_bind_now !=3D '\0', &obj_rtld, NULL) = =3D=3D -1) die(); =20 + if (resolve_objects_ifunc(obj_main, + ld_bind_now !=3D NULL && *ld_bind_now !=3D '\0', NULL) =3D=3D -1) + die(); + dbg("doing copy relocations"); if (do_copy_relocations(obj_main) =3D=3D -1) die(); @@ -1978,17 +1984,25 @@ relocate_objects(Obj_Entry *first, bool bind_now, O= bj_Entry *rtldobj, obj->version =3D RTLD_VERSION; } =20 - /* - * The handling of R_MACHINE_IRELATIVE relocations and jumpslots - * referencing STT_GNU_IFUNC symbols is postponed till the other - * relocations are done. The indirect functions specified as - * ifunc are allowed to call other symbols, so we need to have - * objects relocated before asking for resolution from indirects. - * - * The R_MACHINE_IRELATIVE slots are resolved in greedy fashion, - * instead of the usual lazy handling of PLT slots. It is - * consistent with how GNU does it. - */ + return (0); +} + +/* + * The handling of R_MACHINE_IRELATIVE relocations and jumpslots + * referencing STT_GNU_IFUNC symbols is postponed till the other + * relocations are done. The indirect functions specified as + * ifunc are allowed to call other symbols, so we need to have + * objects relocated before asking for resolution from indirects. + * + * The R_MACHINE_IRELATIVE slots are resolved in greedy fashion, + * instead of the usual lazy handling of PLT slots. It is + * consistent with how GNU does it. + */ +static int +resolve_objects_ifunc(Obj_Entry *first, bool bind_now, RtldLockState *lock= state) +{ + Obj_Entry *obj; + for (obj =3D first; obj !=3D NULL; obj =3D obj->next) { if (obj->irelative && reloc_iresolve(obj, lockstate) =3D=3D -1) return (-1); @@ -1996,7 +2010,24 @@ relocate_objects(Obj_Entry *first, bool bind_now, Ob= j_Entry *rtldobj, reloc_gnu_ifunc(obj, lockstate) =3D=3D -1) return (-1); } - return 0; + return (0); +} + +static int +initlist_objects_ifunc(Objlist *list, bool bind_now, RtldLockState *lockst= ate) +{ + Objlist_Entry *elm; + Obj_Entry *obj; + + STAILQ_FOREACH(elm, list, link) { + obj =3D elm->obj; + if (obj->irelative && reloc_iresolve(obj, lockstate) =3D=3D -1) + return (-1); + if ((obj->bind_now || bind_now) && obj->gnu_ifunc && + reloc_gnu_ifunc(obj, lockstate) =3D=3D -1) + return (-1); + } + return (0); } =20 /* @@ -2276,6 +2307,17 @@ dlopen_object(const char *name, Obj_Entry *refobj, i= nt lo_flags, int mode) =20 map_stacks_exec(&lockstate); =20 + if (initlist_objects_ifunc(&initlist, (mode & RTLD_MODEMASK) =3D=3D RT= LD_NOW, + &lockstate) =3D=3D -1) { + objlist_clear(&initlist); + obj->dl_refcount--; + unref_dag(obj); + if (obj->refcount =3D=3D 0) + unload_object(obj); + lock_release(rtld_bind_lock, &lockstate); + return (NULL); + } + /* Call the init functions. */ objlist_call_init(&initlist, &lockstate); objlist_clear(&initlist); --XZPmG3kZLpEx7yD+ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7mU/QACgkQC3+MBN1Mb4jnWQCaAuioLax20R5khgTmP++MHIxa CxAAnj0V3IRqEqSVlaHGkQh0LyFzQScX =ktbR -----END PGP SIGNATURE----- --XZPmG3kZLpEx7yD+-- From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 19:25:42 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36F781065672; Mon, 12 Dec 2011 19:25:42 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id B0FB78FC12; Mon, 12 Dec 2011 19:25:38 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.5/8.14.2) with ESMTP id pBCJPbTS053077; Mon, 12 Dec 2011 14:25:37 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.5/8.14.2/Submit) id pBCJPbfx053076; Mon, 12 Dec 2011 14:25:37 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Mon, 12 Dec 2011 14:25:37 -0500 From: David Schultz To: David Chisnall Message-ID: <20111212192537.GA52939@zim.MIT.EDU> Mail-Followup-To: David Chisnall , Andreas Tobler , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201112072117.pB7LHoaL055972@svn.freebsd.org> <4EE120D7.10903@FreeBSD.org> <4EE51CA3.9060809@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Andreas Tobler Subject: Re: svn commit: r228330 - in head: include sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 19:25:42 -0000 On Sun, Dec 11, 2011, David Chisnall wrote: > On 11 Dec 2011, at 21:12, Andreas Tobler wrote: > > > As far as I understand, GCC does not support this attribute [[noreturn]] yet. But it defines both, __cplusplus and __cplusplus=201103L. On gcc-4.7 __cplusplus=201103L is the default when we build libstdc++. > > Advertising C++11 compatibility and then not supporting fairly simple C++11 features seems like a pretty major GCC bug. > > > So I think we have to extend the check as below or we can reorder the defines that GNUC is before the __cplusplus && __cplusplus>= 201103L. > > I'd rather prefer the standard version to the non-standard version, but maybe we can add an extra check to see if your compiler incompetent. The reality is that none of the open source compilers even fully support C99. We try to make sure the FreeBSD headers don't blow up with other compilers, although some of the support for the Intel compiler and ancient versions of gcc has rotted. It is ugly at times, but many of the compiler-specific details are abstracted away in macros in . Note that for the POSIX/XSI/C standards, we actually define our own visibility macros, because the standard ones are such a mess. We will presumably need one for C1X soon. From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 21:12:08 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E11F1065704; Mon, 12 Dec 2011 21:12:08 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B8E98FC08; Mon, 12 Dec 2011 21:12:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCLC7uP018469; Mon, 12 Dec 2011 21:12:07 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCLC7Cv018464; Mon, 12 Dec 2011 21:12:07 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112122112.pBCLC7Cv018464@svn.freebsd.org> From: Eitan Adler Date: Mon, 12 Dec 2011 21:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228445 - in head: share/man/man4 sys/dev/fb sys/modules/splash sys/modules/splash/txt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 21:12:08 -0000 Author: eadler (ports committer) Date: Mon Dec 12 21:12:07 2011 New Revision: 228445 URL: http://svn.freebsd.org/changeset/base/228445 Log: - Add support for ASCII art splash screens in TheDraw format PR: kern/143370 Submitted by: Antony Mawer Reviewed by: gjb (doc) Reviewed by: des (style) Approved by: ed MFC after: 1 month Added: head/sys/dev/fb/splash_txt.c (contents, props changed) head/sys/modules/splash/txt/ head/sys/modules/splash/txt/Makefile (contents, props changed) Modified: head/share/man/man4/splash.4 head/sys/modules/splash/Makefile Modified: head/share/man/man4/splash.4 ============================================================================== --- head/share/man/man4/splash.4 Mon Dec 12 18:44:17 2011 (r228444) +++ head/share/man/man4/splash.4 Mon Dec 12 21:12:07 2011 (r228445) @@ -74,6 +74,14 @@ Bitmaps of other color depths will not b ZSoft PCX decoder. This decoder currently only supports version 5 8-bpp single-plane images. +.It Pa splash_txt.ko +TheDraw binary ASCII drawing file decoder. +Displays a text-mode 80x25 ASCII drawing, such as that produced by +the Binary save format in TheDraw. +This format consists of a sequence +of two byte pairs representing the 80x25 display, where the first byte +is the ASCII character to draw and the second byte indicates the +colors/attributes to use when drawing the character. .El .Pp The @@ -223,6 +231,16 @@ If the VESA support is statically linked necessary to load the VESA module. Just load the bitmap file and the splash decoder module as in the first example above. +.Pp +To load a binary ASCII drawing and display this while booting, include the +following into your +.Pa /boot/loader.conf +: +.Bd -literal -offset indent +splash_txt_load="YES" +bitmap_load="YES" +bitmap_name="/boot/splash.bin" +.Ed .\".Sh DIAGNOSTICS .Sh SEE ALSO .Xr vidcontrol 1 , @@ -256,6 +274,15 @@ module was written by based on the .Pa splash_bmp code. +The +.Pa splash_txt +module was written by +.An Antony Mawer Aq antony@mawer.org +based on the +.Pa splash_bmp +code, with some additional inspiration from the +.Pa daemon_saver +code. .Sh CAVEATS Both the splash screen and the screen saver work with .Xr syscons 4 Added: head/sys/dev/fb/splash_txt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/fb/splash_txt.c Mon Dec 12 21:12:07 2011 (r228445) @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 1999 Michael Smith + * Copyright (c) 1999 Kazutaka YOKOTA + * Copyright (c) 2005 Antony Mawer + * 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 AUTHORS 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 AUTHORS 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$ + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +static int splash_on = FALSE; + +static int txt_init(video_adapter_t *adp); +static int txt_end(video_adapter_t *adp); +static int txt_splash(video_adapter_t * adp, const int on); + +/* These are rows by columns of the text-mode display device. */ +#define BIN_IMAGE_WIDTH 80 +#define BIN_IMAGE_HEIGHT 25 + +static splash_decoder_t txt_decoder = { + .name = "splash_txt", + .init = txt_init, + .term = txt_end, + .splash = txt_splash, + .data_type = SPLASH_IMAGE, +}; + +SPLASH_DECODER(splash_txt, txt_decoder); + +static void +draw_text_splash(sc_softc_t *sc) +{ + u_int x, y; + u_char ch, attr; + u_char *pdata = txt_decoder.data; + + /* Init failed. */ + if (txt_decoder.data == NULL) + return; + for (y = 0; y < BIN_IMAGE_HEIGHT; y++) { + for (x = 0; x < BIN_IMAGE_WIDTH; x++) { + ch = *pdata++; + attr = *pdata++; + sc_vtb_putc(&sc->cur_scp->scr, + (y * sc->cur_scp->xsize) + x, + sc->scr_map[ch], (int)attr << 8); + } + } +} + +static int +txt_init(video_adapter_t *adp) +{ + + /* Ensure that the image data exists. */ + if (txt_decoder.data == NULL || txt_decoder.data_size <= 0) { + printf("splash_txt: No ASCII bitmap file found\n"); + return (ENODEV); + } + return (0); +} + +static int +txt_end(video_adapter_t *adp) +{ + + return (0); +} + +static int +txt_splash(video_adapter_t *adp, const int on) +{ + sc_softc_t *sc; + scr_stat *scp; + + sc = sc_find_softc(adp, NULL); + if (sc == NULL) + return (EAGAIN); + scp = sc->cur_scp; + if (on) { + if (!splash_on) { + if (adp->va_info.vi_flags & V_INFO_GRAPHICS) + return EAGAIN; + /* Clear screen and set border colour. */ + sc_vtb_clear(&scp->scr, sc->scr_map[0x20], + (FG_LIGHTGREY | BG_BLACK) << 8); + (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1); + sc_set_border(scp, 0); + splash_on = TRUE; + /* Display the splash screen. */ + draw_text_splash(sc); + } + return (0); + } else { + /* The video mode will be restored by the caller. */ + splash_on = FALSE; + return (0); + } +} + + Modified: head/sys/modules/splash/Makefile ============================================================================== --- head/sys/modules/splash/Makefile Mon Dec 12 18:44:17 2011 (r228444) +++ head/sys/modules/splash/Makefile Mon Dec 12 21:12:07 2011 (r228445) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR= bmp pcx +SUBDIR= bmp pcx txt .include Added: head/sys/modules/splash/txt/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/splash/txt/Makefile Mon Dec 12 21:12:07 2011 (r228445) @@ -0,0 +1,7 @@ +# $FreeBSD$ +.PATH: ${.CURDIR}/../../../dev/fb + +KMOD= splash_txt +SRCS= splash_txt.c + +.include From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 21:41:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CDDE106564A; Mon, 12 Dec 2011 21:41:05 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 722AD8FC08; Mon, 12 Dec 2011 21:41:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCLf5JT019395; Mon, 12 Dec 2011 21:41:05 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCLf5Tm019393; Mon, 12 Dec 2011 21:41:05 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112122141.pBCLf5Tm019393@svn.freebsd.org> From: Mikolaj Golub Date: Mon, 12 Dec 2011 21:41:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228446 - head/usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 21:41:05 -0000 Author: trociny Date: Mon Dec 12 21:41:05 2011 New Revision: 228446 URL: http://svn.freebsd.org/changeset/base/228446 Log: Make procstat -l output similar to the output of limits(1). Suggested by: jhb MFC after: 1 week Modified: head/usr.bin/procstat/procstat_rlimit.c Modified: head/usr.bin/procstat/procstat_rlimit.c ============================================================================== --- head/usr.bin/procstat/procstat_rlimit.c Mon Dec 12 21:12:07 2011 (r228445) +++ head/usr.bin/procstat/procstat_rlimit.c Mon Dec 12 21:41:05 2011 (r228446) @@ -28,7 +28,6 @@ #include #include -#define _RLIMIT_IDENT #include #include #include @@ -36,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -43,17 +43,60 @@ #include "procstat.h" +static struct { + const char *name; + const char *suffix; +} rlimit_param[13] = { + {"cputime", "sec"}, + {"filesize", "B "}, + {"datasize", "B "}, + {"stacksize", "B "}, + {"coredumpsize", "B "}, + {"memoryuse", "B "}, + {"memorylocked", "B "}, + {"maxprocesses", " "}, + {"openfiles", " "}, + {"sbsize", "B "}, + {"vmemoryuse", "B "}, + {"pseudo-terminals", " "}, + {"swapuse", "B "}, +}; + +#if RLIM_NLIMITS > 13 +#error "Resource limits have grown. Add new entries to rlimit_param[]." +#endif + static struct rlimit rlimit[RLIM_NLIMITS]; +static +const char *humanize_rlimit(int indx, rlim_t limit) +{ + static char buf[14]; + int scale; + + if (limit == RLIM_INFINITY) + return ("infinity "); + + scale = humanize_number(buf, sizeof(buf) - 1, (int64_t)limit, + rlimit_param[indx].suffix, HN_AUTOSCALE | HN_GETSCALE, HN_DECIMAL); + (void)humanize_number(buf, sizeof(buf) - 1, (int64_t)limit, + rlimit_param[indx].suffix, HN_AUTOSCALE, HN_DECIMAL); + /* Pad with one space if there is no suffix prefix. */ + if (scale == 0) + sprintf(buf + strlen(buf), " "); + return (buf); +} + void procstat_rlimit(struct kinfo_proc *kipp) { int error, i, name[4]; size_t len; - if (!hflag) - printf("%5s %-16s %-10s %12s %12s\n", "PID", "COMM", "RLIMIT", - "CURRENT", "MAX"); + if (!hflag) { + printf("%5s %-16s %-16s %16s %16s\n", + "PID", "COMM", "RLIMIT", "SOFT ", "HARD "); + } name[0] = CTL_KERN; name[1] = KERN_PROC; name[2] = KERN_PROC_RLIMIT; @@ -68,11 +111,9 @@ procstat_rlimit(struct kinfo_proc *kipp) return; for (i = 0; i < RLIM_NLIMITS; i++) { - printf("%5d %-16s %-10s %12jd %12jd\n", kipp->ki_pid, - kipp->ki_comm, rlimit_ident[i], - rlimit[i].rlim_cur == RLIM_INFINITY ? - -1 : rlimit[i].rlim_cur, - rlimit[i].rlim_max == RLIM_INFINITY ? - -1 : rlimit[i].rlim_max); + printf("%5d %-16s %-16s ", kipp->ki_pid, kipp->ki_comm, + rlimit_param[i].name); + printf("%16s ", humanize_rlimit(i, rlimit[i].rlim_cur)); + printf("%16s\n", humanize_rlimit(i, rlimit[i].rlim_max)); } } From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 21:43:36 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C06A1065675; Mon, 12 Dec 2011 21:43:36 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8FDCD8FC14; Mon, 12 Dec 2011 21:43:34 +0000 (UTC) Received: by bkbzv15 with SMTP id zv15so7737504bkb.13 for ; Mon, 12 Dec 2011 13:43:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=W4a/dGQ/wrNQt/dbD5bzC6GRWTe1EwjpoOWDlACYiHY=; b=IzVw1ZoM5708Ilppp1dOkwFFfa+POxuaNicR/UU9+zHH8YqYa+92cPX5eoiWgAQgqU /kX9R+5ClINF+DUGl2RwWjBBcjkuTTI3HwPgfO6m2zq53WWMrVB2hQixwP22/KkbNl2h lAJsAZec5hGEakvZ0eWI8OOfRYr5aqrSgBKoI= Received: by 10.204.157.12 with SMTP id z12mr8214366bkw.18.1323726213350; Mon, 12 Dec 2011 13:43:33 -0800 (PST) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id h7sm35397965bkw.12.2011.12.12.13.43.30 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 12 Dec 2011 13:43:31 -0800 (PST) From: Mikolaj Golub To: John Baldwin References: <201111242054.pAOKs6vj012296@svn.freebsd.org> <4EE12CE0.5070803@FreeBSD.org> <86y5ukvnll.fsf@kopusha.home.net> <201112121407.56869.jhb@freebsd.org> X-Comment-To: John Baldwin Sender: Mikolaj Golub Date: Mon, 12 Dec 2011 23:43:29 +0200 In-Reply-To: <201112121407.56869.jhb@freebsd.org> (John Baldwin's message of "Mon, 12 Dec 2011 14:07:56 -0500") Message-ID: <86r509mpoe.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Kostik Belousov Subject: Re: svn commit: r227956 - head/usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 21:43:36 -0000 On Mon, 12 Dec 2011 14:07:56 -0500 John Baldwin wrote: JB> On Saturday, December 10, 2011 3:26:46 am Mikolaj Golub wrote: >> >> Output example: >> >> PID COMM RLIMIT SOFT HARD >> 11949 zsh cputime 10000 sec infinity >> 11949 zsh filesize infinity infinity >> 11949 zsh datasize 524288 kB 524288 kB >> 11949 zsh stacksize 65536 kB 65536 kB >> 11949 zsh coredumpsize 190734 MB 190734 MB >> 11949 zsh memoryuse infinity infinity >> 11949 zsh memorylocked infinity infinity >> 11949 zsh maxprocesses 5547 5547 >> 11949 zsh openfiles 11095 11095 >> 11949 zsh sbsize infinity infinity >> 11949 zsh vmemoryuse infinity infinity >> 11949 zsh pseudo-terminals infinity infinity >> 11949 zsh swapuse infinity infinity JB> This looks great to me, thanks! Thanks, committed. -- Mikolaj Golub From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 21:54:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67389106566B; Mon, 12 Dec 2011 21:54:34 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 6B57A8FC15; Mon, 12 Dec 2011 21:54:33 +0000 (UTC) Received: by faaf16 with SMTP id f16so931889faa.13 for ; Mon, 12 Dec 2011 13:54:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=apDSeh+feYNvE3EXA0Nx54nDnBjg48Fm8+jdAHRgGFs=; b=KiNy/s+miQ6awnBnBSkAveX4nLQ4o6E3GKze1BbtPu5fDNC/ENmD+fe2JWrEPP4xqM 7E4xsIVkHsLrIE/CTfrAAPUeh4iUIe6TQrtnAZzKKt67RWKFuqtTE0VZ6IoNs/Yzn1iQ l5vCAfJEOK/i7NPIlo9zRq/aURHMZEc1n6Snc= MIME-Version: 1.0 Received: by 10.180.74.211 with SMTP id w19mr24134021wiv.7.1323726872230; Mon, 12 Dec 2011 13:54:32 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.216.171.8 with HTTP; Mon, 12 Dec 2011 13:54:32 -0800 (PST) In-Reply-To: <4EE636BB.7050008@FreeBSD.org> References: <201112121005.pBCA5Dar093711@svn.freebsd.org> <20111212101558.GK50300@deviant.kiev.zoral.com.ua> <4EE5D574.9080303@FreeBSD.org> <4EE636BB.7050008@FreeBSD.org> Date: Mon, 12 Dec 2011 22:54:32 +0100 X-Google-Sender-Auth: 6bHrRjDNMQHlr2dI4bOVsM7MzRE Message-ID: From: Attilio Rao To: Andriy Gapon Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Kostik Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228433 - in head/sys: kern security/mac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 21:54:34 -0000 2011/12/12 Andriy Gapon : > on 12/12/2011 19:05 Attilio Rao said the following: >> More precisely, what do you think about the patch below? >> I just didn't revert the moving of systm.h under param.h because Bruce >> seems to prefer that. >> >> I'm starting test-compile right now, let me know your preference. > > The patch looks good to me. > >> Index: sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c >> (revision 228438) >> +++ sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c =C2=A0 =C2= =A0 (working copy) >> @@ -5877,6 +5877,9 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintp >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 volatile uint16_t *flags; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 hrtime_t now; >> >> + =C2=A0 =C2=A0 =C2=A0 if (SCHEDULER_STOPPED()) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return; >> + > > I think that this could even be "panicstr !=3D NULL", there is probably n= o use for > DTrace at panic time. I agree, I will go with panicstr. > >> =C2=A0#if defined(sun) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Kick out immediately if this CPU is = still being born (in which case >> Index: sys/security/mac/mac_priv.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- sys/security/mac/mac_priv.c (revision 228438) >> +++ sys/security/mac/mac_priv.c (working copy) >> @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); >> =C2=A0#include "opt_mac.h" >> >> =C2=A0#include >> -#include >> =C2=A0#include >> =C2=A0#include >> =C2=A0#include > > I would even keep this inclusion, just for the "why not" reason. If it passes testing I will remove it as it is unneeded. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 22:01:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BD581065675; Mon, 12 Dec 2011 22:01:34 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AD368FC0A; Mon, 12 Dec 2011 22:01:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCM1XHF020127; Mon, 12 Dec 2011 22:01:33 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCM1XVV020125; Mon, 12 Dec 2011 22:01:33 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112122201.pBCM1XVV020125@svn.freebsd.org> From: Mikolaj Golub Date: Mon, 12 Dec 2011 22:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228447 - head/usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 22:01:34 -0000 Author: trociny Date: Mon Dec 12 22:01:33 2011 New Revision: 228447 URL: http://svn.freebsd.org/changeset/base/228447 Log: Make 64-bit procstat output ELF auxiliary vectors for 32-bit processes. Reviewed by: kib MFC after: 1 week Modified: head/usr.bin/procstat/procstat_auxv.c Modified: head/usr.bin/procstat/procstat_auxv.c ============================================================================== --- head/usr.bin/procstat/procstat_auxv.c Mon Dec 12 21:41:05 2011 (r228446) +++ head/usr.bin/procstat/procstat_auxv.c Mon Dec 12 22:01:33 2011 (r228447) @@ -43,39 +43,110 @@ #include "procstat.h" -static Elf_Auxinfo auxv[256]; +#define PROC_AUXV_MAX 256 + +static Elf_Auxinfo auxv[PROC_AUXV_MAX]; static char prefix[256]; +#if __ELF_WORD_SIZE == 64 +static Elf32_Auxinfo auxv32[PROC_AUXV_MAX]; + +static const char *elf32_sv_names[] = { + "Linux ELF32", + "FreeBSD ELF32", +}; + +static int +is_elf32(pid_t pid) +{ + int error, name[4]; + size_t len, i; + static char sv_name[256]; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_SV_NAME; + name[3] = pid; + len = sizeof(sv_name); + error = sysctl(name, 4, sv_name, &len, NULL, 0); + if (error != 0 || len == 0) + return (0); + for (i = 0; i < sizeof(elf32_sv_names) / sizeof(*elf32_sv_names); i++) { + if (strncmp(sv_name, elf32_sv_names[i], sizeof(sv_name)) == 0) + return (1); + } + return (0); +} + +static size_t +retrieve_auxv32(pid_t pid) +{ + int error, name[4]; + size_t len, i; + void *ptr; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_AUXV; + name[3] = pid; + len = sizeof(auxv32); + error = sysctl(name, 4, auxv32, &len, NULL, 0); + if (error < 0 && errno != ESRCH && errno != EPERM) { + warn("sysctl: kern.proc.auxv: %d: %d", pid, errno); + return (0); + } + for (i = 0; i < len; i++) { + /* + * XXX: We expect that values for a_type on a 32-bit platform + * are directly mapped to those on 64-bit one, which is not + * necessarily true. + */ + auxv[i].a_type = auxv32[i].a_type; + ptr = &auxv32[i].a_un; + auxv[i].a_un.a_val = *((uint32_t *)ptr); + } + return (len); +} +#endif /* __ELF_WORD_SIZE == 64 */ + #define PRINT(name, spec, val) \ printf("%s %-16s " #spec "\n", prefix, #name, (val)) #define PRINT_UNKNOWN(type, val) \ printf("%s %16ld %#lx\n", prefix, (long)type, (u_long)(val)) -void -procstat_auxv(struct kinfo_proc *kipp) +static size_t +retrieve_auxv(pid_t pid) { int error, name[4]; - size_t len, i; - - if (!hflag) - printf("%5s %-16s %-16s %-16s\n", "PID", "COMM", "AUXV", "VALUE"); + size_t len; +#if __ELF_WORD_SIZE == 64 + if (is_elf32(pid)) + return (retrieve_auxv32(pid)); +#endif name[0] = CTL_KERN; name[1] = KERN_PROC; name[2] = KERN_PROC_AUXV; - name[3] = kipp->ki_pid; - len = sizeof(auxv) * sizeof(*auxv); + name[3] = pid; + len = sizeof(auxv); error = sysctl(name, 4, auxv, &len, NULL, 0); if (error < 0 && errno != ESRCH && errno != EPERM) { - warn("sysctl: kern.proc.auxv: %d: %d", kipp->ki_pid, errno); - return; + warn("sysctl: kern.proc.auxv: %d: %d", pid, errno); + return (0); } - if (error < 0 || len == 0) - return; - if (len == 0) { - printf(" -\n"); + return (len); +} + +void +procstat_auxv(struct kinfo_proc *kipp) +{ + size_t len, i; + + if (!hflag) + printf("%5s %-16s %-16s %-16s\n", "PID", "COMM", "AUXV", "VALUE"); + len = retrieve_auxv(kipp->ki_pid); + if (len == 0) return; - } snprintf(prefix, sizeof(prefix), "%5d %-16s", kipp->ki_pid, kipp->ki_comm); for (i = 0; i < len; i++) { From owner-svn-src-all@FreeBSD.ORG Mon Dec 12 23:29:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28D0B1065672; Mon, 12 Dec 2011 23:29:33 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0CCAA8FC12; Mon, 12 Dec 2011 23:29:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBCNTWiw023138; Mon, 12 Dec 2011 23:29:32 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBCNTWL9023134; Mon, 12 Dec 2011 23:29:32 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201112122329.pBCNTWL9023134@svn.freebsd.org> From: Attilio Rao Date: Mon, 12 Dec 2011 23:29:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228448 - in head/sys: cddl/contrib/opensolaris/uts/common/dtrace security/mac sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 12 Dec 2011 23:29:33 -0000 Author: attilio Date: Mon Dec 12 23:29:32 2011 New Revision: 228448 URL: http://svn.freebsd.org/changeset/base/228448 Log: Revert the approach for skipping lockstat_probe_func call when doing lock_success/lock_failure, introduced in r228424, by directly skipping in dtrace_probe. This mainly helps in avoiding namespace pollution and thus lockstat.h dependency by systm.h. As an added bonus, this also helps in MFC case. Reviewed by: avg MFC after: 3 months (or never) X-MFC: r228424 Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/security/mac/mac_priv.c head/sys/sys/lockstat.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Mon Dec 12 22:01:33 2011 (r228447) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Mon Dec 12 23:29:32 2011 (r228448) @@ -5877,6 +5877,9 @@ dtrace_probe(dtrace_id_t id, uintptr_t a volatile uint16_t *flags; hrtime_t now; + if (panicstr != NULL) + return; + #if defined(sun) /* * Kick out immediately if this CPU is still being born (in which case Modified: head/sys/security/mac/mac_priv.c ============================================================================== --- head/sys/security/mac/mac_priv.c Mon Dec 12 22:01:33 2011 (r228447) +++ head/sys/security/mac/mac_priv.c Mon Dec 12 23:29:32 2011 (r228448) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include "opt_mac.h" #include -#include #include #include #include Modified: head/sys/sys/lockstat.h ============================================================================== --- head/sys/sys/lockstat.h Mon Dec 12 22:01:33 2011 (r228447) +++ head/sys/sys/lockstat.h Mon Dec 12 23:29:32 2011 (r228448) @@ -185,24 +185,17 @@ extern uint64_t lockstat_nsecs(void); #define LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l) do { \ uint32_t id; \ \ - if (!SCHEDULER_STOPPED()) { \ - lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, \ - f, l); \ - if ((id = lockstat_probemap[(probe)])) \ - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, \ - 0, 0); \ - } \ + lock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, f, l); \ + if ((id = lockstat_probemap[(probe)])) \ + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); \ } while (0) #define LOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp) do { \ uint32_t id; \ \ - if (!SCHEDULER_STOPPED()) { \ - lock_profile_release_lock(&(lp)->lock_object); \ - if ((id = lockstat_probemap[(probe)])) \ - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, \ - 0, 0); \ - } \ + lock_profile_release_lock(&(lp)->lock_object); \ + if ((id = lockstat_probemap[(probe)])) \ + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); \ } while (0) #else /* !KDTRACE_HOOKS */ From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 00:38:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71266106564A; Tue, 13 Dec 2011 00:38:50 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DBAC8FC08; Tue, 13 Dec 2011 00:38:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBD0cosp025306; Tue, 13 Dec 2011 00:38:50 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBD0co5e025298; Tue, 13 Dec 2011 00:38:50 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112130038.pBD0co5e025298@svn.freebsd.org> From: Eitan Adler Date: Tue, 13 Dec 2011 00:38:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228449 - in head/sys: dev/md kern vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 00:38:50 -0000 Author: eadler (ports committer) Date: Tue Dec 13 00:38:50 2011 New Revision: 228449 URL: http://svn.freebsd.org/changeset/base/228449 Log: Document a large number of currently undocumented sysctls. While here fix some style(9) issues and reduce redundancy. PR: kern/155491 PR: kern/155490 PR: kern/155489 Submitted by: Galimov Albert Approved by: bde Reviewed by: jhb MFC after: 1 week Modified: head/sys/dev/md/md.c head/sys/kern/kern_ntptime.c head/sys/kern/kern_shutdown.c head/sys/kern/kern_thr.c head/sys/kern/uipc_sockbuf.c head/sys/kern/vfs_syscalls.c head/sys/vm/vm_meter.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Mon Dec 12 23:29:32 2011 (r228448) +++ head/sys/dev/md/md.c Tue Dec 13 00:38:50 2011 (r228449) @@ -105,9 +105,11 @@ static MALLOC_DEFINE(M_MD, "md_disk", "M static MALLOC_DEFINE(M_MDSECT, "md_sectors", "Memory Disk Sectors"); static int md_debug; -SYSCTL_INT(_debug, OID_AUTO, mddebug, CTLFLAG_RW, &md_debug, 0, ""); +SYSCTL_INT(_debug, OID_AUTO, mddebug, CTLFLAG_RW, &md_debug, 0, + "Enable md(4) debug messages"); static int md_malloc_wait; -SYSCTL_INT(_vm, OID_AUTO, md_malloc_wait, CTLFLAG_RW, &md_malloc_wait, 0, ""); +SYSCTL_INT(_vm, OID_AUTO, md_malloc_wait, CTLFLAG_RW, &md_malloc_wait, 0, + "Allow malloc to wait for memory allocations"); #if defined(MD_ROOT) && defined(MD_ROOT_SIZE) /* Modified: head/sys/kern/kern_ntptime.c ============================================================================== --- head/sys/kern/kern_ntptime.c Mon Dec 12 23:29:32 2011 (r228448) +++ head/sys/kern/kern_ntptime.c Tue Dec 13 00:38:50 2011 (r228449) @@ -301,13 +301,17 @@ SYSCTL_PROC(_kern_ntp_pll, OID_AUTO, get 0, sizeof(struct ntptimeval) , ntp_sysctl, "S,ntptimeval", ""); #ifdef PPS_SYNC -SYSCTL_INT(_kern_ntp_pll, OID_AUTO, pps_shiftmax, CTLFLAG_RW, &pps_shiftmax, 0, ""); -SYSCTL_INT(_kern_ntp_pll, OID_AUTO, pps_shift, CTLFLAG_RW, &pps_shift, 0, ""); +SYSCTL_INT(_kern_ntp_pll, OID_AUTO, pps_shiftmax, CTLFLAG_RW, + &pps_shiftmax, 0, "Max interval duration (sec) (shift)"); +SYSCTL_INT(_kern_ntp_pll, OID_AUTO, pps_shift, CTLFLAG_RW, + &pps_shift, 0, "Interval duration (sec) (shift)"); SYSCTL_LONG(_kern_ntp_pll, OID_AUTO, time_monitor, CTLFLAG_RD, - &time_monitor, 0, ""); + &time_monitor, 0, "Last time offset scaled (ns)"); -SYSCTL_OPAQUE(_kern_ntp_pll, OID_AUTO, pps_freq, CTLFLAG_RD, &pps_freq, sizeof(pps_freq), "I", ""); -SYSCTL_OPAQUE(_kern_ntp_pll, OID_AUTO, time_freq, CTLFLAG_RD, &time_freq, sizeof(time_freq), "I", ""); +SYSCTL_OPAQUE(_kern_ntp_pll, OID_AUTO, pps_freq, CTLFLAG_RD, + &pps_freq, sizeof(pps_freq), "I", "Scaled frequency offset (ns/sec)"); +SYSCTL_OPAQUE(_kern_ntp_pll, OID_AUTO, time_freq, CTLFLAG_RD, + &time_freq, sizeof(time_freq), "I", "Frequency offset (ns/sec)"); #endif /* Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Mon Dec 12 23:29:32 2011 (r228448) +++ head/sys/kern/kern_shutdown.c Tue Dec 13 00:38:50 2011 (r228449) @@ -651,7 +651,7 @@ panic(const char *fmt, ...) static int poweroff_delay = POWEROFF_DELAY; SYSCTL_INT(_kern_shutdown, OID_AUTO, poweroff_delay, CTLFLAG_RW, - &poweroff_delay, 0, ""); + &poweroff_delay, 0, "Delay before poweroff to write disk caches (msec)"); static void poweroff_wait(void *junk, int howto) @@ -671,7 +671,7 @@ poweroff_wait(void *junk, int howto) */ static int kproc_shutdown_wait = 60; SYSCTL_INT(_kern_shutdown, OID_AUTO, kproc_shutdown_wait, CTLFLAG_RW, - &kproc_shutdown_wait, 0, ""); + &kproc_shutdown_wait, 0, "Max wait time (sec) to stop for each process"); void kproc_shutdown(void *arg, int howto) Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Mon Dec 12 23:29:32 2011 (r228448) +++ head/sys/kern/kern_thr.c Tue Dec 13 00:38:50 2011 (r228449) @@ -63,11 +63,11 @@ static SYSCTL_NODE(_kern, OID_AUTO, thre static int max_threads_per_proc = 1500; SYSCTL_INT(_kern_threads, OID_AUTO, max_threads_per_proc, CTLFLAG_RW, - &max_threads_per_proc, 0, "Limit on threads per proc"); + &max_threads_per_proc, 0, "Limit on threads per proc"); static int max_threads_hits; SYSCTL_INT(_kern_threads, OID_AUTO, max_threads_hits, CTLFLAG_RD, - &max_threads_hits, 0, ""); + &max_threads_hits, 0, "kern.threads.max_threads_per_proc hit count"); #ifdef COMPAT_FREEBSD32 Modified: head/sys/kern/uipc_sockbuf.c ============================================================================== --- head/sys/kern/uipc_sockbuf.c Mon Dec 12 23:29:32 2011 (r228448) +++ head/sys/kern/uipc_sockbuf.c Tue Dec 13 00:38:50 2011 (r228449) @@ -1048,4 +1048,4 @@ SYSCTL_INT(_kern, KERN_DUMMY, dummy, CTL SYSCTL_OID(_kern_ipc, KIPC_MAXSOCKBUF, maxsockbuf, CTLTYPE_ULONG|CTLFLAG_RW, &sb_max, 0, sysctl_handle_sb_max, "LU", "Maximum socket buffer size"); SYSCTL_ULONG(_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW, - &sb_efficiency, 0, ""); + &sb_efficiency, 0, "Socket buffer size waste factor"); Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Mon Dec 12 23:29:32 2011 (r228448) +++ head/sys/kern/vfs_syscalls.c Tue Dec 13 00:38:50 2011 (r228449) @@ -880,7 +880,8 @@ chroot_refuse_vdir_fds(fdp) static int chroot_allow_open_directories = 1; SYSCTL_INT(_kern, OID_AUTO, chroot_allow_open_directories, CTLFLAG_RW, - &chroot_allow_open_directories, 0, ""); + &chroot_allow_open_directories, 0, + "Allow a process to chroot(2) if it has a directory open"); /* * Change notion of root (``/'') directory. Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Mon Dec 12 23:29:32 2011 (r228448) +++ head/sys/vm/vm_meter.c Tue Dec 13 00:38:50 2011 (r228449) @@ -55,21 +55,21 @@ __FBSDID("$FreeBSD$"); struct vmmeter cnt; SYSCTL_UINT(_vm, VM_V_FREE_MIN, v_free_min, - CTLFLAG_RW, &cnt.v_free_min, 0, ""); + CTLFLAG_RW, &cnt.v_free_min, 0, "Minimum low-free-pages threshold"); SYSCTL_UINT(_vm, VM_V_FREE_TARGET, v_free_target, - CTLFLAG_RW, &cnt.v_free_target, 0, ""); + CTLFLAG_RW, &cnt.v_free_target, 0, "Desired free pages"); SYSCTL_UINT(_vm, VM_V_FREE_RESERVED, v_free_reserved, - CTLFLAG_RW, &cnt.v_free_reserved, 0, ""); + CTLFLAG_RW, &cnt.v_free_reserved, 0, "Pages reserved for deadlock"); SYSCTL_UINT(_vm, VM_V_INACTIVE_TARGET, v_inactive_target, - CTLFLAG_RW, &cnt.v_inactive_target, 0, ""); + CTLFLAG_RW, &cnt.v_inactive_target, 0, "Pages desired inactive"); SYSCTL_UINT(_vm, VM_V_CACHE_MIN, v_cache_min, - CTLFLAG_RW, &cnt.v_cache_min, 0, ""); + CTLFLAG_RW, &cnt.v_cache_min, 0, "Min pages on cache queue"); SYSCTL_UINT(_vm, VM_V_CACHE_MAX, v_cache_max, - CTLFLAG_RW, &cnt.v_cache_max, 0, ""); + CTLFLAG_RW, &cnt.v_cache_max, 0, "Max pages on cache queue"); SYSCTL_UINT(_vm, VM_V_PAGEOUT_FREE_MIN, v_pageout_free_min, - CTLFLAG_RW, &cnt.v_pageout_free_min, 0, ""); + CTLFLAG_RW, &cnt.v_pageout_free_min, 0, "Min pages reserved for kernel"); SYSCTL_UINT(_vm, OID_AUTO, v_free_severe, - CTLFLAG_RW, &cnt.v_free_severe, 0, ""); + CTLFLAG_RW, &cnt.v_free_severe, 0, "Severe page depletion point"); static int sysctl_vm_loadavg(SYSCTL_HANDLER_ARGS) @@ -270,104 +270,59 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, "VM meter vm stats"); SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats"); -SYSCTL_PROC(_vm_stats_sys, OID_AUTO, v_swtch, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_swtch, 0, vcnt, "IU", "Context switches"); -SYSCTL_PROC(_vm_stats_sys, OID_AUTO, v_trap, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_trap, 0, vcnt, "IU", "Traps"); -SYSCTL_PROC(_vm_stats_sys, OID_AUTO, v_syscall, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_syscall, 0, vcnt, "IU", "Syscalls"); -SYSCTL_PROC(_vm_stats_sys, OID_AUTO, v_intr, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_intr, 0, vcnt, "IU", "Hardware interrupts"); -SYSCTL_PROC(_vm_stats_sys, OID_AUTO, v_soft, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_soft, 0, vcnt, "IU", "Software interrupts"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vm_faults, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_vm_faults, 0, vcnt, "IU", "VM faults"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_cow_faults, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_cow_faults, 0, vcnt, "IU", "COW faults"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_cow_optim, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_cow_optim, 0, vcnt, "IU", "Optimized COW faults"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_zfod, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_zfod, 0, vcnt, "IU", "Zero fill"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_ozfod, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_ozfod, 0, vcnt, "IU", "Optimized zero fill"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_swapin, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_swapin, 0, vcnt, "IU", "Swapin operations"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_swapout, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_swapout, 0, vcnt, "IU", "Swapout operations"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_swappgsin, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_swappgsin, 0, vcnt, "IU", "Swapin pages"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_swappgsout, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_swappgsout, 0, vcnt, "IU", "Swapout pages"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vnodein, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_vnodein, 0, vcnt, "IU", "Vnodein operations"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vnodeout, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_vnodeout, 0, vcnt, "IU", "Vnodeout operations"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vnodepgsin, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_vnodepgsin, 0, vcnt, "IU", "Vnodein pages"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vnodepgsout, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_vnodepgsout, 0, vcnt, "IU", "Vnodeout pages"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_intrans, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_intrans, 0, vcnt, "IU", "In transit page blocking"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_reactivated, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_reactivated, 0, vcnt, "IU", "Reactivated pages"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_pdwakeups, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_pdwakeups, 0, vcnt, "IU", "Pagedaemon wakeups"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_pdpages, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_pdpages, 0, vcnt, "IU", "Pagedaemon page scans"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_tcached, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_tcached, 0, vcnt, "IU", "Total pages cached"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_dfree, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_dfree, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_pfree, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_pfree, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_tfree, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_tfree, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_page_size, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_page_size, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_page_count, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_page_count, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_free_reserved, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_free_reserved, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_free_target, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_free_target, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_free_min, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_free_min, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_free_count, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_free_count, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_wire_count, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_wire_count, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_active_count, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_active_count, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_inactive_target, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_inactive_target, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_inactive_count, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_inactive_count, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_cache_count, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_cache_count, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_cache_min, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_cache_min, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_cache_max, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_cache_max, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_pageout_free_min, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_pageout_free_min, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_interrupt_free_min, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_interrupt_free_min, 0, vcnt, "IU", ""); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_forks, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_forks, 0, vcnt, "IU", "Number of fork() calls"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vforks, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_vforks, 0, vcnt, "IU", "Number of vfork() calls"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_rforks, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_rforks, 0, vcnt, "IU", "Number of rfork() calls"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_kthreads, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_kthreads, 0, vcnt, "IU", "Number of fork() calls by kernel"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_forkpages, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_forkpages, 0, vcnt, "IU", "VM pages affected by fork()"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vforkpages, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_vforkpages, 0, vcnt, "IU", "VM pages affected by vfork()"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_rforkpages, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_rforkpages, 0, vcnt, "IU", "VM pages affected by rfork()"); -SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_kthreadpages, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE, - &cnt.v_kthreadpages, 0, vcnt, "IU", "VM pages affected by fork() by kernel"); +#define VM_STATS_SYS(var, descr) SYSCTL_PROC(_vm_stats_sys, OID_AUTO, var, \ + (CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_MPSAFE), &cnt.v_swtch, 0, vcnt, \ + "IU", descr); + +VM_STATS_SYS(v_swtch, "Context switches"); +VM_STATS_SYS(v_trap, "Traps"); +VM_STATS_SYS(v_syscall, "System calls"); +VM_STATS_SYS(v_intr, "Device interrupts"); +VM_STATS_SYS(v_soft, "Software interrupts"); +VM_STATS_SYS(v_vm_faults, "Address memory faults"); +VM_STATS_SYS(v_cow_faults, "Copy-on-write faults"); +VM_STATS_SYS(v_cow_optim, "Optimized COW faults") +VM_STATS_SYS(v_zfod, "Pages zero-filled on demand") +VM_STATS_SYS(v_ozfod, "Optimized zero fill pages") +VM_STATS_SYS(v_swapin, "Swap pager pageins") +VM_STATS_SYS(v_swapout, "Swap pager pageouts") +VM_STATS_SYS(v_swappgsin, "Swap pages swapped in") +VM_STATS_SYS(v_swappgsout, "Swap pages swapped out") +VM_STATS_SYS(v_vnodein, "Vnode pager pageins") +VM_STATS_SYS(v_vnodeout, "Vnode pager pageouts") +VM_STATS_SYS(v_vnodepgsin, "Vnode pages paged in") +VM_STATS_SYS(v_vnodepgsout, "Vnode pages paged out") +VM_STATS_SYS(v_intrans, "In transit page faults") +VM_STATS_SYS(v_reactivated, "Pages reactivated from free list") +VM_STATS_SYS(v_pdwakeups, "Pagedaemon wakeups") +VM_STATS_SYS(v_pdpages, "Pages analyzed by pagedaemon") +VM_STATS_SYS(v_tcached, "Total pages cached") +VM_STATS_SYS(v_dfree, "Pages freed by pagedaemon") +VM_STATS_SYS(v_pfree, "Pages freed by exiting processes") +VM_STATS_SYS(v_tfree, "Total pages freed") +VM_STATS_SYS(v_page_size, "Page size in bytes") +VM_STATS_SYS(v_page_count, "Total number of pages in system") +VM_STATS_SYS(v_free_reserved, "Pages reserved for deadlock") +VM_STATS_SYS(v_free_target, "Pages desired free") +VM_STATS_SYS(v_free_min, "Minimum low-free-pages threshold") +VM_STATS_SYS(v_free_count, "Free pages") +VM_STATS_SYS(v_wire_count, "Wired pages") +VM_STATS_SYS(v_active_count, "Active pages") +VM_STATS_SYS(v_inactive_target, "Desired inactive pages") +VM_STATS_SYS(v_inactive_count, "Inactive pages") +VM_STATS_SYS(v_cache_count, "Pages on cache queue") +VM_STATS_SYS(v_cache_min, "Min pages on cache queue") +VM_STATS_SYS(v_cache_max, "Max pages on cached queue") +VM_STATS_SYS(v_pageout_free_min, "Min pages reserved for kernel") +VM_STATS_SYS(v_interrupt_free_min, "Reserved pages for interrupt code") +VM_STATS_SYS(v_forks, "Number of fork() calls") +VM_STATS_SYS(v_vforks, "Number of vfork() calls") +VM_STATS_SYS(v_rforks, "Number of rfork() calls") +VM_STATS_SYS(v_kthreads, "Number of fork() calls by kernel") +VM_STATS_SYS(v_forkpages, "VM pages affected by fork()") +VM_STATS_SYS(v_vforkpages, "VM pages affected by vfork()") +VM_STATS_SYS(v_rforkpages, "VM pages affected by rfork()") +VM_STATS_SYS(v_kthreadpages, "VM pages affected by fork() by kernel") -SYSCTL_INT(_vm_stats_misc, OID_AUTO, - zero_page_count, CTLFLAG_RD, &vm_page_zero_count, 0, ""); +SYSCTL_INT(_vm_stats_misc, OID_AUTO, zero_page_count, CTLFLAG_RD, + &vm_page_zero_count, 0, "Number of zero-ed free pages"); From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 05:13:51 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92920106564A; Tue, 13 Dec 2011 05:13:51 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 80A0A8FC0A; Tue, 13 Dec 2011 05:13:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBD5Dpcf034014; Tue, 13 Dec 2011 05:13:51 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBD5DpmB034010; Tue, 13 Dec 2011 05:13:51 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201112130513.pBD5DpmB034010@svn.freebsd.org> From: Adrian Chadd Date: Tue, 13 Dec 2011 05:13:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228450 - head/sys/mips/atheros X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 05:13:51 -0000 Author: adrian Date: Tue Dec 13 05:13:51 2011 New Revision: 228450 URL: http://svn.freebsd.org/changeset/base/228450 Log: Style(9) changes. Modified: head/sys/mips/atheros/ar71xx_chip.c head/sys/mips/atheros/ar724x_chip.c head/sys/mips/atheros/ar91xx_chip.c Modified: head/sys/mips/atheros/ar71xx_chip.c ============================================================================== --- head/sys/mips/atheros/ar71xx_chip.c Tue Dec 13 00:38:50 2011 (r228449) +++ head/sys/mips/atheros/ar71xx_chip.c Tue Dec 13 05:13:51 2011 (r228450) @@ -37,12 +37,12 @@ __FBSDID("$FreeBSD$"); #include #include #include - + #include #include - + #include - + #include #include #include @@ -50,11 +50,9 @@ __FBSDID("$FreeBSD$"); #include #include #include - -#include +#include #include - #include #include @@ -135,7 +133,7 @@ ar71xx_chip_device_stopped(uint32_t mask uint32_t reg; reg = ATH_READ_REG(AR71XX_RST_RESET); - return ((reg & mask) == mask); + return ((reg & mask) == mask); } /* Speed is either 10, 100 or 1000 */ @@ -144,20 +142,20 @@ ar71xx_chip_set_pll_ge(int unit, int spe { uint32_t pll; - switch(speed) { - case 10: - pll = PLL_ETH_INT_CLK_10; - break; - case 100: - pll = PLL_ETH_INT_CLK_100; - break; - case 1000: - pll = PLL_ETH_INT_CLK_1000; - break; - default: - printf("%s%d: invalid speed %d\n", - __func__, unit, speed); - return; + switch (speed) { + case 10: + pll = PLL_ETH_INT_CLK_10; + break; + case 100: + pll = PLL_ETH_INT_CLK_100; + break; + case 1000: + pll = PLL_ETH_INT_CLK_1000; + break; + default: + printf("%s%d: invalid speed %d\n", + __func__, unit, speed); + return; } switch (unit) { case 0: @@ -180,6 +178,7 @@ ar71xx_chip_set_pll_ge(int unit, int spe static void ar71xx_chip_ddr_flush_ge(int unit) { + switch (unit) { case 0: ar71xx_ddr_flush(AR71XX_WB_FLUSH_GE0); @@ -209,18 +208,24 @@ ar71xx_chip_get_eth_pll(unsigned int mac static void ar71xx_chip_init_usb_peripheral(void) { - ar71xx_device_stop(RST_RESET_USB_OHCI_DLL | RST_RESET_USB_HOST | RST_RESET_USB_PHY); + + ar71xx_device_stop(RST_RESET_USB_OHCI_DLL | + RST_RESET_USB_HOST | RST_RESET_USB_PHY); DELAY(1000); - ar71xx_device_start(RST_RESET_USB_OHCI_DLL | RST_RESET_USB_HOST | RST_RESET_USB_PHY); + ar71xx_device_start(RST_RESET_USB_OHCI_DLL | + RST_RESET_USB_HOST | RST_RESET_USB_PHY); DELAY(1000); ATH_WRITE_REG(AR71XX_USB_CTRL_CONFIG, - USB_CTRL_CONFIG_OHCI_DES_SWAP | USB_CTRL_CONFIG_OHCI_BUF_SWAP | - USB_CTRL_CONFIG_EHCI_DES_SWAP | USB_CTRL_CONFIG_EHCI_BUF_SWAP); + USB_CTRL_CONFIG_OHCI_DES_SWAP | + USB_CTRL_CONFIG_OHCI_BUF_SWAP | + USB_CTRL_CONFIG_EHCI_DES_SWAP | + USB_CTRL_CONFIG_EHCI_BUF_SWAP); ATH_WRITE_REG(AR71XX_USB_CTRL_FLADJ, - (32 << USB_CTRL_FLADJ_HOST_SHIFT) | (3 << USB_CTRL_FLADJ_A5_SHIFT)); + (32 << USB_CTRL_FLADJ_HOST_SHIFT) | + (3 << USB_CTRL_FLADJ_A5_SHIFT)); DELAY(1000); } Modified: head/sys/mips/atheros/ar724x_chip.c ============================================================================== --- head/sys/mips/atheros/ar724x_chip.c Tue Dec 13 00:38:50 2011 (r228449) +++ head/sys/mips/atheros/ar724x_chip.c Tue Dec 13 05:13:51 2011 (r228450) @@ -37,12 +37,12 @@ __FBSDID("$FreeBSD$"); #include #include #include - + #include #include - + #include - + #include #include #include @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include - + #include #include @@ -71,20 +71,20 @@ ar724x_chip_detect_sys_frequency(void) uint32_t pll; uint32_t freq; uint32_t div; - + pll = ATH_READ_REG(AR724X_PLL_REG_CPU_CONFIG); - + div = ((pll >> AR724X_PLL_DIV_SHIFT) & AR724X_PLL_DIV_MASK); freq = div * AR724X_BASE_FREQ; div = ((pll >> AR724X_PLL_REF_DIV_SHIFT) & AR724X_PLL_REF_DIV_MASK); freq *= div; - + u_ar71xx_cpu_freq = freq; - + div = ((pll >> AR724X_DDR_DIV_SHIFT) & AR724X_DDR_DIV_MASK) + 1; u_ar71xx_ddr_freq = freq / div; - + div = (((pll >> AR724X_AHB_DIV_SHIFT) & AR724X_AHB_DIV_MASK) + 1) * 2; u_ar71xx_ahb_freq = u_ar71xx_cpu_freq / div; } @@ -125,12 +125,13 @@ ar724x_chip_device_stopped(uint32_t mask static void ar724x_chip_set_pll_ge(int unit, int speed) { + switch (unit) { case 0: - /* TODO */ + /* XXX TODO */ break; case 1: - /* TODO */ + /* XXX TODO */ break; default: printf("%s: invalid PLL set for arge unit: %d\n", @@ -142,6 +143,7 @@ ar724x_chip_set_pll_ge(int unit, int spe static void ar724x_chip_ddr_flush_ge(int unit) { + switch (unit) { case 0: ar71xx_ddr_flush(AR724X_DDR_REG_FLUSH_GE0); @@ -159,14 +161,15 @@ ar724x_chip_ddr_flush_ge(int unit) static void ar724x_chip_ddr_flush_ip2(void) { + ar71xx_ddr_flush(AR724X_DDR_REG_FLUSH_PCIE); } - static uint32_t ar724x_chip_get_eth_pll(unsigned int mac, int speed) { - return 0; + + return 0; } static void @@ -174,42 +177,39 @@ ar724x_chip_init_usb_peripheral(void) { switch (ar71xx_soc) { - case AR71XX_SOC_AR7240: - - ar71xx_device_stop(AR724X_RESET_MODULE_USB_OHCI_DLL | - AR724X_RESET_USB_HOST); - DELAY(1000); - - ar71xx_device_start(AR724X_RESET_MODULE_USB_OHCI_DLL | - AR724X_RESET_USB_HOST); - DELAY(1000); - - /* - * WAR for HW bug. Here it adjusts the duration - * between two SOFS. - */ - ATH_WRITE_REG(AR71XX_USB_CTRL_FLADJ, - (3 << USB_CTRL_FLADJ_A0_SHIFT)); + case AR71XX_SOC_AR7240: + ar71xx_device_stop(AR724X_RESET_MODULE_USB_OHCI_DLL | + AR724X_RESET_USB_HOST); + DELAY(1000); + + ar71xx_device_start(AR724X_RESET_MODULE_USB_OHCI_DLL | + AR724X_RESET_USB_HOST); + DELAY(1000); + + /* + * WAR for HW bug. Here it adjusts the duration + * between two SOFS. + */ + ATH_WRITE_REG(AR71XX_USB_CTRL_FLADJ, + (3 << USB_CTRL_FLADJ_A0_SHIFT)); - break; - - case AR71XX_SOC_AR7241: - case AR71XX_SOC_AR7242: + break; - ar71xx_device_start(AR724X_RESET_MODULE_USB_OHCI_DLL); - DELAY(100); + case AR71XX_SOC_AR7241: + case AR71XX_SOC_AR7242: + ar71xx_device_start(AR724X_RESET_MODULE_USB_OHCI_DLL); + DELAY(100); - ar71xx_device_start(AR724X_RESET_USB_HOST); - DELAY(100); + ar71xx_device_start(AR724X_RESET_USB_HOST); + DELAY(100); - ar71xx_device_start(AR724X_RESET_USB_PHY); - DELAY(100); + ar71xx_device_start(AR724X_RESET_USB_PHY); + DELAY(100); - break; + break; - default: - /* fallthrough */ - break; + default: + break; } } Modified: head/sys/mips/atheros/ar91xx_chip.c ============================================================================== --- head/sys/mips/atheros/ar91xx_chip.c Tue Dec 13 00:38:50 2011 (r228449) +++ head/sys/mips/atheros/ar91xx_chip.c Tue Dec 13 05:13:51 2011 (r228450) @@ -37,12 +37,12 @@ __FBSDID("$FreeBSD$"); #include #include #include - + #include #include - + #include - + #include #include #include @@ -50,11 +50,10 @@ __FBSDID("$FreeBSD$"); #include #include #include - -#include -#include +#include #include +#include #include #include @@ -67,49 +66,48 @@ ar91xx_chip_detect_mem_size(void) static void ar91xx_chip_detect_sys_frequency(void) { - uint32_t pll; - uint32_t freq; - uint32_t div; - - pll = ATH_READ_REG(AR91XX_PLL_REG_CPU_CONFIG); - - div = ((pll >> AR91XX_PLL_DIV_SHIFT) & AR91XX_PLL_DIV_MASK); - freq = div * AR91XX_BASE_FREQ; - - u_ar71xx_cpu_freq = freq; - - div = ((pll >> AR91XX_DDR_DIV_SHIFT) & AR91XX_DDR_DIV_MASK) + 1; - u_ar71xx_ddr_freq = freq / div; - - div = (((pll >> AR91XX_AHB_DIV_SHIFT) & AR91XX_AHB_DIV_MASK) + 1) * 2; - u_ar71xx_ahb_freq = u_ar71xx_cpu_freq / div; + uint32_t pll; + uint32_t freq; + uint32_t div; + + pll = ATH_READ_REG(AR91XX_PLL_REG_CPU_CONFIG); + + div = ((pll >> AR91XX_PLL_DIV_SHIFT) & AR91XX_PLL_DIV_MASK); + freq = div * AR91XX_BASE_FREQ; + u_ar71xx_cpu_freq = freq; + + div = ((pll >> AR91XX_DDR_DIV_SHIFT) & AR91XX_DDR_DIV_MASK) + 1; + u_ar71xx_ddr_freq = freq / div; + + div = (((pll >> AR91XX_AHB_DIV_SHIFT) & AR91XX_AHB_DIV_MASK) + 1) * 2; + u_ar71xx_ahb_freq = u_ar71xx_cpu_freq / div; } static void ar91xx_chip_device_stop(uint32_t mask) { - uint32_t reg; - - reg = ATH_READ_REG(AR91XX_RESET_REG_RESET_MODULE); - ATH_WRITE_REG(AR91XX_RESET_REG_RESET_MODULE, reg | mask); + uint32_t reg; + + reg = ATH_READ_REG(AR91XX_RESET_REG_RESET_MODULE); + ATH_WRITE_REG(AR91XX_RESET_REG_RESET_MODULE, reg | mask); } static void ar91xx_chip_device_start(uint32_t mask) { - uint32_t reg; - - reg = ATH_READ_REG(AR91XX_RESET_REG_RESET_MODULE); - ATH_WRITE_REG(AR91XX_RESET_REG_RESET_MODULE, reg & ~mask); + uint32_t reg; + + reg = ATH_READ_REG(AR91XX_RESET_REG_RESET_MODULE); + ATH_WRITE_REG(AR91XX_RESET_REG_RESET_MODULE, reg & ~mask); } static int ar91xx_chip_device_stopped(uint32_t mask) { - uint32_t reg; - - reg = ATH_READ_REG(AR91XX_RESET_REG_RESET_MODULE); - return ((reg & mask) == mask); + uint32_t reg; + + reg = ATH_READ_REG(AR91XX_RESET_REG_RESET_MODULE); + return ((reg & mask) == mask); } static void @@ -118,19 +116,19 @@ ar91xx_chip_set_pll_ge(int unit, int spe uint32_t pll; switch(speed) { - case 10: - pll = AR91XX_PLL_VAL_10; - break; - case 100: - pll = AR91XX_PLL_VAL_100; - break; - case 1000: - pll = AR91XX_PLL_VAL_1000; - break; - default: - printf("%s%d: invalid speed %d\n", - __func__, unit, speed); - return; + case 10: + pll = AR91XX_PLL_VAL_10; + break; + case 100: + pll = AR91XX_PLL_VAL_100; + break; + case 1000: + pll = AR91XX_PLL_VAL_1000; + break; + default: + printf("%s%d: invalid speed %d\n", + __func__, unit, speed); + return; } switch (unit) { case 0: @@ -153,6 +151,7 @@ ar91xx_chip_set_pll_ge(int unit, int spe static void ar91xx_chip_ddr_flush_ge(int unit) { + switch (unit) { case 0: ar71xx_ddr_flush(AR91XX_DDR_REG_FLUSH_GE0); @@ -170,6 +169,7 @@ ar91xx_chip_ddr_flush_ge(int unit) static void ar91xx_chip_ddr_flush_ip2(void) { + ar71xx_ddr_flush(AR91XX_DDR_REG_FLUSH_WMAC); } @@ -177,12 +177,14 @@ ar91xx_chip_ddr_flush_ip2(void) static uint32_t ar91xx_chip_get_eth_pll(unsigned int mac, int speed) { - return 0; + + return 0; } static void ar91xx_chip_init_usb_peripheral(void) { + ar71xx_device_stop(AR91XX_RST_RESET_MODULE_USBSUS_OVERRIDE); DELAY(100); @@ -201,14 +203,14 @@ ar91xx_chip_init_usb_peripheral(void) } struct ar71xx_cpu_def ar91xx_chip_def = { - &ar91xx_chip_detect_mem_size, - &ar91xx_chip_detect_sys_frequency, - &ar91xx_chip_device_stop, - &ar91xx_chip_device_start, - &ar91xx_chip_device_stopped, - &ar91xx_chip_set_pll_ge, - &ar91xx_chip_ddr_flush_ge, - &ar91xx_chip_get_eth_pll, - &ar91xx_chip_ddr_flush_ip2, + &ar91xx_chip_detect_mem_size, + &ar91xx_chip_detect_sys_frequency, + &ar91xx_chip_device_stop, + &ar91xx_chip_device_start, + &ar91xx_chip_device_stopped, + &ar91xx_chip_set_pll_ge, + &ar91xx_chip_ddr_flush_ge, + &ar91xx_chip_get_eth_pll, + &ar91xx_chip_ddr_flush_ip2, &ar91xx_chip_init_usb_peripheral, }; From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 06:56:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2407106566B; Tue, 13 Dec 2011 06:56:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A177A8FC16; Tue, 13 Dec 2011 06:56:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBD6uhf2037255; Tue, 13 Dec 2011 06:56:43 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBD6uh3O037253; Tue, 13 Dec 2011 06:56:43 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112130656.pBD6uh3O037253@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 13 Dec 2011 06:56:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228454 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 06:56:43 -0000 Author: glebius Date: Tue Dec 13 06:56:43 2011 New Revision: 228454 URL: http://svn.freebsd.org/changeset/base/228454 Log: Belatedly catch up with r151555. in_scrubprefix() also needs this fix. We should compare not only addresses, but their masks, too, when searching for matching prefix. Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Tue Dec 13 06:53:03 2011 (r228453) +++ head/sys/netinet/in.c Tue Dec 13 06:56:43 2011 (r228454) @@ -1072,7 +1072,7 @@ static int in_scrubprefix(struct in_ifaddr *target, u_int flags) { struct in_ifaddr *ia; - struct in_addr prefix, mask, p; + struct in_addr prefix, mask, p, m; int error = 0; struct sockaddr_in prefix0, mask0; @@ -1118,9 +1118,10 @@ in_scrubprefix(struct in_ifaddr *target, arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr); } - if (rtinitflags(target)) + if (rtinitflags(target)) { prefix = target->ia_dstaddr.sin_addr; - else { + mask.s_addr = 0; + } else { prefix = target->ia_addr.sin_addr; mask = target->ia_sockmask.sin_addr; prefix.s_addr &= mask.s_addr; @@ -1133,15 +1134,22 @@ in_scrubprefix(struct in_ifaddr *target, IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { - if (rtinitflags(ia)) + if (rtinitflags(ia)) { p = ia->ia_dstaddr.sin_addr; - else { + + if (prefix.s_addr != p.s_addr) + continue; + } else { p = ia->ia_addr.sin_addr; - p.s_addr &= ia->ia_sockmask.sin_addr.s_addr; + m = ia->ia_sockmask.sin_addr; + p.s_addr &= m.s_addr; + + if (prefix.s_addr != p.s_addr || + mask.s_addr != m.s_addr) + continue; } - if ((prefix.s_addr != p.s_addr) || - !(ia->ia_ifp->if_flags & IFF_UP)) + if ((ia->ia_ifp->if_flags & IFF_UP) == 0) continue; /* From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 07:02:49 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2815C1065676; Tue, 13 Dec 2011 07:02:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 163728FC13; Tue, 13 Dec 2011 07:02:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBD72nf4037488; Tue, 13 Dec 2011 07:02:49 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBD72nC2037486; Tue, 13 Dec 2011 07:02:49 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112130702.pBD72nC2037486@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 13 Dec 2011 07:02:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228455 - head/sys/nfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 07:02:49 -0000 Author: glebius Date: Tue Dec 13 07:02:48 2011 New Revision: 228455 URL: http://svn.freebsd.org/changeset/base/228455 Log: Some cleanup of BOOTP code. Initially I wanted to just change the ifioctl() usage, but end up with more changes. - Use SIOCAIFADDR instead of old rusty SIOCSIFADDR, SIOCSIFBRDADDR and SIOCSIFNETMASK. - Use queue(9) instead of hand made stailq. - Use one socket for all ifioctl() and send/receive operations. - Use __func__ instead of cut-n-paste in logging and panics. - Axe some dead or strange code. Tested by: gonzo, Stefan Bethke Modified: head/sys/nfs/bootp_subr.c Modified: head/sys/nfs/bootp_subr.c ============================================================================== --- head/sys/nfs/bootp_subr.c Tue Dec 13 06:56:43 2011 (r228454) +++ head/sys/nfs/bootp_subr.c Tue Dec 13 07:02:48 2011 (r228455) @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -109,19 +110,22 @@ struct bootp_packet { }; struct bootpc_ifcontext { - struct bootpc_ifcontext *next; + STAILQ_ENTRY(bootpc_ifcontext) next; struct bootp_packet call; struct bootp_packet reply; int replylen; int overload; - struct socket *so; - struct ifreq ireq; + union { + struct ifreq _ifreq; + struct in_aliasreq _in_alias_req; + } _req; +#define ireq _req._ifreq +#define iareq _req._in_alias_req struct ifnet *ifp; struct sockaddr_dl *sdl; struct sockaddr_in myaddr; struct sockaddr_in netmask; struct sockaddr_in gw; - struct sockaddr_in broadcast; /* Different for each interface */ int gotgw; int gotnetmask; int gotrootpath; @@ -153,8 +157,7 @@ struct bootpc_tagcontext { }; struct bootpc_globalcontext { - struct bootpc_ifcontext *interfaces; - struct bootpc_ifcontext *lastinterface; + STAILQ_HEAD(, bootpc_ifcontext) interfaces; u_int32_t xid; int gotrootpath; int gotgw; @@ -215,6 +218,7 @@ struct bootpc_globalcontext { #endif static char bootp_cookie[128]; +static struct socket *bootp_so; SYSCTL_STRING(_kern, OID_AUTO, bootp_cookie, CTLFLAG_RD, bootp_cookie, 0, "Cookie (T134) supplied by bootp server"); @@ -233,7 +237,7 @@ static void print_sin_addr(struct sockad static void clear_sinaddr(struct sockaddr_in *sin); static void allocifctx(struct bootpc_globalcontext *gctx); static void bootpc_compose_query(struct bootpc_ifcontext *ifctx, - struct bootpc_globalcontext *gctx, struct thread *td); + struct thread *td); static unsigned char *bootpc_tag(struct bootpc_tagcontext *tctx, struct bootp_packet *bp, int len, int tag); static void bootpc_tag_helper(struct bootpc_tagcontext *tctx, @@ -251,8 +255,8 @@ void bootpboot_p_iflist(void); static int bootpc_call(struct bootpc_globalcontext *gctx, struct thread *td); -static int bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, - struct bootpc_globalcontext *gctx, struct thread *td); +static void bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, + struct thread *td); static int bootpc_adjust_interface(struct bootpc_ifcontext *ifctx, struct bootpc_globalcontext *gctx, struct thread *td); @@ -270,14 +274,9 @@ static __inline int bootpc_ifctx_isfaile /* * In order to have multiple active interfaces with address 0.0.0.0 - * and be able to send data to a selected interface, we perform - * some tricks: - * - * - The 'broadcast' address is different for each interface. - * - * - We temporarily add routing pointing 255.255.255.255 to the - * selected interface broadcast address, thus the packet sent - * goes to that interface. + * and be able to send data to a selected interface, we first set + * mask to /8 on all interfaces, and temporarily set it to /0 when + * doing sosend(). */ #ifdef BOOTP_DEBUG @@ -419,11 +418,8 @@ static void allocifctx(struct bootpc_globalcontext *gctx) { struct bootpc_ifcontext *ifctx; - ifctx = (struct bootpc_ifcontext *) malloc(sizeof(*ifctx), - M_TEMP, M_WAITOK | M_ZERO); - if (ifctx == NULL) - panic("Failed to allocate bootp interface context structure"); + ifctx = malloc(sizeof(*ifctx), M_TEMP, M_WAITOK | M_ZERO); ifctx->xid = gctx->xid; #ifdef BOOTP_NO_DHCP ifctx->state = IF_BOOTP_UNRESOLVED; @@ -431,11 +427,7 @@ allocifctx(struct bootpc_globalcontext * ifctx->state = IF_DHCP_UNRESOLVED; #endif gctx->xid += 0x100; - if (gctx->interfaces != NULL) - gctx->lastinterface->next = ifctx; - else - gctx->interfaces = ifctx; - gctx->lastinterface = ifctx; + STAILQ_INSERT_TAIL(&gctx->interfaces, ifctx, next); } static __inline int @@ -570,7 +562,6 @@ bootpc_received(struct bootpc_globalcont static int bootpc_call(struct bootpc_globalcontext *gctx, struct thread *td) { - struct socket *so; struct sockaddr_in *sin, dst; struct uio auio; struct sockopt sopt; @@ -585,13 +576,6 @@ bootpc_call(struct bootpc_globalcontext int retry; const char *s; - /* - * Create socket and set its recieve timeout. - */ - error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td); - if (error != 0) - goto out0; - tv.tv_sec = 1; tv.tv_usec = 0; bzero(&sopt, sizeof(sopt)); @@ -601,7 +585,7 @@ bootpc_call(struct bootpc_globalcontext sopt.sopt_val = &tv; sopt.sopt_valsize = sizeof tv; - error = sosetopt(so, &sopt); + error = sosetopt(bootp_so, &sopt); if (error != 0) goto out; @@ -613,7 +597,7 @@ bootpc_call(struct bootpc_globalcontext sopt.sopt_val = &on; sopt.sopt_valsize = sizeof on; - error = sosetopt(so, &sopt); + error = sosetopt(bootp_so, &sopt); if (error != 0) goto out; @@ -626,7 +610,7 @@ bootpc_call(struct bootpc_globalcontext sopt.sopt_val = &on; sopt.sopt_valsize = sizeof on; - error = sosetopt(so, &sopt); + error = sosetopt(bootp_so, &sopt); if (error != 0) goto out; @@ -636,7 +620,7 @@ bootpc_call(struct bootpc_globalcontext sin = &dst; clear_sinaddr(sin); sin->sin_port = htons(IPPORT_BOOTPC); - error = sobind(so, (struct sockaddr *)sin, td); + error = sobind(bootp_so, (struct sockaddr *)sin, td); if (error != 0) { printf("bind failed\n"); goto out; @@ -662,9 +646,7 @@ bootpc_call(struct bootpc_globalcontext outstanding = 0; gotrootpath = 0; - for (ifctx = gctx->interfaces; - ifctx != NULL; - ifctx = ifctx->next) { + STAILQ_FOREACH(ifctx, &gctx->interfaces, next) { if (bootpc_ifctx_isresolved(ifctx) != 0 && bootpc_tag(&gctx->tmptag, &ifctx->reply, ifctx->replylen, @@ -672,9 +654,10 @@ bootpc_call(struct bootpc_globalcontext gotrootpath = 1; } - for (ifctx = gctx->interfaces; - ifctx != NULL; - ifctx = ifctx->next) { + STAILQ_FOREACH(ifctx, &gctx->interfaces, next) { + struct in_aliasreq *ifra = &ifctx->iareq; + sin = (struct sockaddr_in *)&ifra->ifra_mask; + ifctx->outstanding = 0; if (bootpc_ifctx_isresolved(ifctx) != 0 && gotrootpath != 0) { @@ -694,7 +677,7 @@ bootpc_call(struct bootpc_globalcontext (ifctx->state == IF_BOOTP_UNRESOLVED && ifctx->dhcpquerytype != DHCP_NOMSG)) { ifctx->sentmsg = 0; - bootpc_compose_query(ifctx, gctx, td); + bootpc_compose_query(ifctx, td); } /* Send BOOTP request (or re-send). */ @@ -734,44 +717,32 @@ bootpc_call(struct bootpc_globalcontext auio.uio_td = td; /* Set netmask to 0.0.0.0 */ - - sin = (struct sockaddr_in *) &ifctx->ireq.ifr_addr; clear_sinaddr(sin); - error = ifioctl(ifctx->so, SIOCSIFNETMASK, - (caddr_t) &ifctx->ireq, td); + error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra, + td); if (error != 0) - panic("bootpc_call:" - "set if netmask, error=%d", - error); + panic("%s: SIOCAIFADDR, error=%d", __func__, + error); - error = sosend(so, (struct sockaddr *) &dst, + error = sosend(bootp_so, (struct sockaddr *) &dst, &auio, NULL, NULL, 0, td); - if (error != 0) { - printf("bootpc_call: sosend: %d state %08x\n", - error, (int) so->so_state); - } - - /* XXX: Is this needed ? */ - pause("bootpw", hz/10); + if (error != 0) + printf("%s: sosend: %d state %08x\n", __func__, + error, (int )bootp_so->so_state); /* Set netmask to 255.0.0.0 */ - - sin = (struct sockaddr_in *) &ifctx->ireq.ifr_addr; - clear_sinaddr(sin); - sin->sin_addr.s_addr = htonl(0xff000000u); - error = ifioctl(ifctx->so, SIOCSIFNETMASK, - (caddr_t) &ifctx->ireq, td); + sin->sin_addr.s_addr = htonl(IN_CLASSA_NET); + error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra, + td); if (error != 0) - panic("bootpc_call:" - "set if netmask, error=%d", - error); - + panic("%s: SIOCAIFADDR, error=%d", __func__, + error); } if (outstanding == 0 && (rtimo == 0 || time_second >= rtimo)) { error = 0; - goto gotreply; + goto out; } /* Determine new timeout. */ @@ -801,12 +772,10 @@ bootpc_call(struct bootpc_globalcontext auio.uio_td = td; rcvflg = 0; - error = soreceive(so, NULL, &auio, + error = soreceive(bootp_so, NULL, &auio, NULL, NULL, &rcvflg); gctx->secs = time_second - gctx->starttime; - for (ifctx = gctx->interfaces; - ifctx != NULL; - ifctx = ifctx->next) { + STAILQ_FOREACH(ifctx, &gctx->interfaces, next) { if (bootpc_ifctx_isresolved(ifctx) != 0 || bootpc_ifctx_isfailed(ifctx) != 0) continue; @@ -829,9 +798,7 @@ bootpc_call(struct bootpc_globalcontext continue; /* Is this an answer to our query */ - for (ifctx = gctx->interfaces; - ifctx != NULL; - ifctx = ifctx->next) { + STAILQ_FOREACH(ifctx, &gctx->interfaces, next) { if (gctx->reply.xid != ifctx->call.xid) continue; @@ -906,15 +873,13 @@ bootpc_call(struct bootpc_globalcontext #endif /* Force a retry if halfway in DHCP negotiation */ retry = 0; - for (ifctx = gctx->interfaces; ifctx != NULL; - ifctx = ifctx->next) { + STAILQ_FOREACH(ifctx, &gctx->interfaces, next) if (ifctx->state == IF_DHCP_OFFERED) { if (ifctx->dhcpquerytype == DHCP_DISCOVER) retry = 1; else ifctx->state = IF_DHCP_UNRESOLVED; } - } if (retry != 0) continue; @@ -931,14 +896,14 @@ bootpc_call(struct bootpc_globalcontext * ignored */ - for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = ifctx->next) { + STAILQ_FOREACH(ifctx, &gctx->interfaces, next) if (bootpc_ifctx_isresolved(ifctx) == 0) { printf("%s timeout for interface %s\n", ifctx->dhcpquerytype != DHCP_NOMSG ? "DHCP" : "BOOTP", ifctx->ireq.ifr_name); } - } + if (gctx->gotrootpath != 0) { #if 0 printf("Got a root path, ignoring remaining timeout\n"); @@ -947,40 +912,28 @@ bootpc_call(struct bootpc_globalcontext goto out; } #ifndef BOOTP_NFSROOT - for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = ifctx->next) { + STAILQ_FOREACH(ifctx, &gctx->interfaces, next) if (bootpc_ifctx_isresolved(ifctx) != 0) { error = 0; goto out; } - } #endif error = ETIMEDOUT; - goto out; -gotreply: out: - soclose(so); -out0: - return error; + return (error); } -static int -bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, - struct bootpc_globalcontext *gctx, struct thread *td) +static void +bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, struct thread *td) { + struct ifreq *ifr; + struct in_aliasreq *ifra; struct sockaddr_in *sin; int error; - struct ifreq *ireq; - struct socket *so; - struct ifaddr *ifa; - struct sockaddr_dl *sdl; - - error = socreate(AF_INET, &ifctx->so, SOCK_DGRAM, 0, td->td_ucred, td); - if (error != 0) - panic("nfs_boot: socreate, error=%d", error); - ireq = &ifctx->ireq; - so = ifctx->so; + ifr = &ifctx->ireq; + ifra = &ifctx->iareq; /* * Bring up the interface. @@ -988,71 +941,57 @@ bootpc_fakeup_interface(struct bootpc_if * Get the old interface flags and or IFF_UP into them; if * IFF_UP set blindly, interface selection can be clobbered. */ - error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)ireq, td); + error = ifioctl(bootp_so, SIOCGIFFLAGS, (caddr_t)ifr, td); if (error != 0) - panic("bootpc_fakeup_interface: GIFFLAGS, error=%d", error); - ireq->ifr_flags |= IFF_UP; - error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)ireq, td); + panic("%s: SIOCGIFFLAGS, error=%d", __func__, error); + ifr->ifr_flags |= IFF_UP; + error = ifioctl(bootp_so, SIOCSIFFLAGS, (caddr_t)ifr, td); if (error != 0) - panic("bootpc_fakeup_interface: SIFFLAGS, error=%d", error); + panic("%s: SIOCSIFFLAGS, error=%d", __func__, error); /* * Do enough of ifconfig(8) so that the chosen interface - * can talk to the servers. (just set the address) + * can talk to the servers. Set address to 0.0.0.0/8 and + * broadcast address to local broadcast. */ - - /* addr is 0.0.0.0 */ - - sin = (struct sockaddr_in *) &ireq->ifr_addr; + sin = (struct sockaddr_in *)&ifra->ifra_addr; clear_sinaddr(sin); - error = ifioctl(so, SIOCSIFADDR, (caddr_t) ireq, td); - if (error != 0 && (error != EEXIST || ifctx == gctx->interfaces)) - panic("bootpc_fakeup_interface: " - "set if addr, error=%d", error); - - /* netmask is 255.0.0.0 */ - - sin = (struct sockaddr_in *) &ireq->ifr_addr; + sin = (struct sockaddr_in *)&ifra->ifra_mask; + clear_sinaddr(sin); + sin->sin_addr.s_addr = htonl(IN_CLASSA_NET); + sin = (struct sockaddr_in *)&ifra->ifra_broadaddr; clear_sinaddr(sin); - sin->sin_addr.s_addr = htonl(0xff000000u); - error = ifioctl(so, SIOCSIFNETMASK, (caddr_t)ireq, td); + sin->sin_addr.s_addr = htonl(INADDR_BROADCAST); + error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra, td); if (error != 0) - panic("bootpc_fakeup_interface: set if netmask, error=%d", - error); + panic("%s: SIOCAIFADDR, error=%d", __func__, error); +} - /* Broadcast is 255.255.255.255 */ +static void +bootpc_shutdown_interface(struct bootpc_ifcontext *ifctx, struct thread *td) +{ + struct ifreq *ifr; + struct sockaddr_in *sin; + int error; - sin = (struct sockaddr_in *)&ireq->ifr_addr; - clear_sinaddr(sin); - clear_sinaddr(&ifctx->broadcast); - sin->sin_addr.s_addr = htonl(INADDR_BROADCAST); - ifctx->broadcast.sin_addr.s_addr = sin->sin_addr.s_addr; + ifr = &ifctx->ireq; - error = ifioctl(so, SIOCSIFBRDADDR, (caddr_t)ireq, td); + printf("Shutdown interface %s\n", ifctx->ireq.ifr_name); + error = ifioctl(bootp_so, SIOCGIFFLAGS, (caddr_t)ifr, td); if (error != 0) - panic("bootpc_fakeup_interface: " - "set if broadcast addr, error=%d", - error); - - /* Get HW address */ - - sdl = NULL; - TAILQ_FOREACH(ifa, &ifctx->ifp->if_addrhead, ifa_link) - if (ifa->ifa_addr->sa_family == AF_LINK) { - sdl = (struct sockaddr_dl *)ifa->ifa_addr; - if (sdl->sdl_type == IFT_ETHER) - break; - } - - if (sdl == NULL) - panic("bootpc: Unable to find HW address for %s", - ifctx->ireq.ifr_name); - ifctx->sdl = sdl; + panic("%s: SIOCGIFFLAGS, error=%d", __func__, error); + ifr->ifr_flags &= ~IFF_UP; + error = ifioctl(bootp_so, SIOCSIFFLAGS, (caddr_t)ifr, td); + if (error != 0) + panic("%s: SIOCSIFFLAGS, error=%d", __func__, error); - return error; + sin = (struct sockaddr_in *) &ifr->ifr_addr; + clear_sinaddr(sin); + error = ifioctl(bootp_so, SIOCDIFADDR, (caddr_t) ifr, td); + if (error != 0) + panic("%s: SIOCDIFADDR, error=%d", __func__, error); } - static int bootpc_adjust_interface(struct bootpc_ifcontext *ifctx, struct bootpc_globalcontext *gctx, struct thread *td) @@ -1061,42 +1000,22 @@ bootpc_adjust_interface(struct bootpc_if struct sockaddr_in defdst; struct sockaddr_in defmask; struct sockaddr_in *sin; - struct ifreq *ireq; - struct socket *so; + struct ifreq *ifr; + struct in_aliasreq *ifra; struct sockaddr_in *myaddr; struct sockaddr_in *netmask; struct sockaddr_in *gw; - ireq = &ifctx->ireq; - so = ifctx->so; + ifr = &ifctx->ireq; + ifra = &ifctx->iareq; myaddr = &ifctx->myaddr; netmask = &ifctx->netmask; gw = &ifctx->gw; if (bootpc_ifctx_isresolved(ifctx) == 0) { - /* Shutdown interfaces where BOOTP failed */ - - printf("Shutdown interface %s\n", ifctx->ireq.ifr_name); - error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)ireq, td); - if (error != 0) - panic("bootpc_adjust_interface: " - "SIOCGIFFLAGS, error=%d", error); - ireq->ifr_flags &= ~IFF_UP; - error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)ireq, td); - if (error != 0) - panic("bootpc_adjust_interface: " - "SIOCSIFFLAGS, error=%d", error); - - sin = (struct sockaddr_in *) &ireq->ifr_addr; - clear_sinaddr(sin); - error = ifioctl(so, SIOCDIFADDR, (caddr_t) ireq, td); - if (error != 0 && (error != EEXIST || - ifctx == gctx->interfaces)) - panic("bootpc_adjust_interface: " - "SIOCDIFADDR, error=%d", error); - - return 0; + bootpc_shutdown_interface(ifctx, td); + return (0); } printf("Adjusted interface %s\n", ifctx->ireq.ifr_name); @@ -1104,28 +1023,21 @@ bootpc_adjust_interface(struct bootpc_if * Do enough of ifconfig(8) so that the chosen interface * can talk to the servers. (just set the address) */ - bcopy(netmask, &ireq->ifr_addr, sizeof(*netmask)); - error = ifioctl(so, SIOCSIFNETMASK, (caddr_t) ireq, td); + sin = (struct sockaddr_in *) &ifr->ifr_addr; + clear_sinaddr(sin); + error = ifioctl(bootp_so, SIOCDIFADDR, (caddr_t) ifr, td); if (error != 0) - panic("bootpc_adjust_interface: " - "set if netmask, error=%d", error); + panic("%s: SIOCDIFADDR, error=%d", __func__, error); - /* Broadcast is with host part of IP address all 1's */ + bcopy(myaddr, &ifra->ifra_addr, sizeof(*myaddr)); + bcopy(netmask, &ifra->ifra_mask, sizeof(*netmask)); + clear_sinaddr(&ifra->ifra_broadaddr); + ifra->ifra_broadaddr.sin_addr.s_addr = myaddr->sin_addr.s_addr | + ~netmask->sin_addr.s_addr; - sin = (struct sockaddr_in *) &ireq->ifr_addr; - clear_sinaddr(sin); - sin->sin_addr.s_addr = myaddr->sin_addr.s_addr | - ~ netmask->sin_addr.s_addr; - error = ifioctl(so, SIOCSIFBRDADDR, (caddr_t) ireq, td); + error = ifioctl(bootp_so, SIOCAIFADDR, (caddr_t)ifra, td); if (error != 0) - panic("bootpc_adjust_interface: " - "set if broadcast addr, error=%d", error); - - bcopy(myaddr, &ireq->ifr_addr, sizeof(*myaddr)); - error = ifioctl(so, SIOCSIFADDR, (caddr_t) ireq, td); - if (error != 0 && (error != EEXIST || ifctx == gctx->interfaces)) - panic("bootpc_adjust_interface: " - "set if addr, error=%d", error); + panic("%s: SIOCAIFADDR, error=%d", __func__, error); /* Add new default route */ @@ -1139,13 +1051,12 @@ bootpc_adjust_interface(struct bootpc_if (struct sockaddr *) &defmask, (RTF_UP | RTF_GATEWAY | RTF_STATIC), NULL, 0); if (error != 0) { - printf("bootpc_adjust_interface: " - "add net route, error=%d\n", error); - return error; + printf("%s: RTM_ADD, error=%d\n", __func__, error); + return (error); } } - return 0; + return (0); } static int @@ -1288,8 +1199,7 @@ print_in_addr(struct in_addr addr) } static void -bootpc_compose_query(struct bootpc_ifcontext *ifctx, - struct bootpc_globalcontext *gctx, struct thread *td) +bootpc_compose_query(struct bootpc_ifcontext *ifctx, struct thread *td) { unsigned char *vendp; unsigned char vendor_client[64]; @@ -1595,9 +1505,11 @@ bootpc_decode_reply(struct nfsv3_diskles void bootpc_init(void) { - struct bootpc_ifcontext *ifctx, *nctx; /* Interface BOOTP contexts */ + struct bootpc_ifcontext *ifctx; /* Interface BOOTP contexts */ struct bootpc_globalcontext *gctx; /* Global BOOTP context */ struct ifnet *ifp; + struct sockaddr_dl *sdl; + struct ifaddr *ifa; int error; #ifndef BOOTP_WIRED_TO int ifcnt; @@ -1615,9 +1527,7 @@ bootpc_init(void) return; gctx = malloc(sizeof(*gctx), M_TEMP, M_WAITOK | M_ZERO); - if (gctx == NULL) - panic("Failed to allocate bootp global context structure"); - + STAILQ_INIT(&gctx->interfaces); gctx->xid = ~0xFFFF; gctx->starttime = time_second; @@ -1626,7 +1536,7 @@ bootpc_init(void) */ CURVNET_SET(TD_TO_VNET(td)); #ifdef BOOTP_WIRED_TO - printf("bootpc_init: wired to interface '%s'\n", + printf("%s: wired to interface '%s'\n", __func__, __XSTRING(BOOTP_WIRED_TO)); allocifctx(gctx); #else @@ -1634,60 +1544,94 @@ bootpc_init(void) * Preallocate interface context storage, if another interface * attaches and wins the race, it won't be eligible for bootp. */ + ifcnt = 0; IFNET_RLOCK(); - for (ifp = TAILQ_FIRST(&V_ifnet), ifcnt = 0; - ifp != NULL; - ifp = TAILQ_NEXT(ifp, if_link)) { + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if ((ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT | IFF_BROADCAST)) != IFF_BROADCAST) continue; + switch (ifp->if_alloctype) { + case IFT_ETHER: + case IFT_FDDI: + case IFT_ISO88025: + break; + default: + continue; + } ifcnt++; } IFNET_RUNLOCK(); if (ifcnt == 0) - panic("bootpc_init: no eligible interfaces"); + panic("%s: no eligible interfaces", __func__); for (; ifcnt > 0; ifcnt--) allocifctx(gctx); #endif + ifctx = STAILQ_FIRST(&gctx->interfaces); IFNET_RLOCK(); - for (ifp = TAILQ_FIRST(&V_ifnet), ifctx = gctx->interfaces; - ifp != NULL && ifctx != NULL; - ifp = TAILQ_NEXT(ifp, if_link)) { - strlcpy(ifctx->ireq.ifr_name, ifp->if_xname, - sizeof(ifctx->ireq.ifr_name)); + TAILQ_FOREACH(ifp, &V_ifnet, if_link) { + if (ifctx == NULL) + break; #ifdef BOOTP_WIRED_TO - if (strcmp(ifctx->ireq.ifr_name, - __XSTRING(BOOTP_WIRED_TO)) != 0) + if (strcmp(ifp->if_xname, __XSTRING(BOOTP_WIRED_TO)) != 0) continue; #else if ((ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT | IFF_BROADCAST)) != IFF_BROADCAST) continue; + switch (ifp->if_alloctype) { + case IFT_ETHER: + case IFT_FDDI: + case IFT_ISO88025: + break; + default: + continue; + } #endif + strlcpy(ifctx->ireq.ifr_name, ifp->if_xname, + sizeof(ifctx->ireq.ifr_name)); ifctx->ifp = ifp; - ifctx = ifctx->next; + + /* Get HW address */ + sdl = NULL; + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) + if (ifa->ifa_addr->sa_family == AF_LINK) { + sdl = (struct sockaddr_dl *)ifa->ifa_addr; + if (sdl->sdl_type == IFT_ETHER) + break; + } + if (sdl == NULL) + panic("bootpc: Unable to find HW address for %s", + ifctx->ireq.ifr_name); + ifctx->sdl = sdl; + + ifctx = STAILQ_NEXT(ifctx, next); } IFNET_RUNLOCK(); CURVNET_RESTORE(); - if (gctx->interfaces == NULL || gctx->interfaces->ifp == NULL) { + if (STAILQ_EMPTY(&gctx->interfaces) || + STAILQ_FIRST(&gctx->interfaces)->ifp == NULL) { #ifdef BOOTP_WIRED_TO - panic("bootpc_init: Could not find interface specified " + panic("%s: Could not find interface specified " "by BOOTP_WIRED_TO: " - __XSTRING(BOOTP_WIRED_TO)); + __XSTRING(BOOTP_WIRED_TO), __func__); #else - panic("bootpc_init: no suitable interface"); + panic("%s: no suitable interface", __func__); #endif } - for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = ifctx->next) - bootpc_fakeup_interface(ifctx, gctx, td); + error = socreate(AF_INET, &bootp_so, SOCK_DGRAM, 0, td->td_ucred, td); + if (error != 0) + panic("%s: socreate, error=%d", __func__, error); - for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = ifctx->next) - bootpc_compose_query(ifctx, gctx, td); + STAILQ_FOREACH(ifctx, &gctx->interfaces, next) + bootpc_fakeup_interface(ifctx, td); + + STAILQ_FOREACH(ifctx, &gctx->interfaces, next) + bootpc_compose_query(ifctx, td); error = bootpc_call(gctx, td); @@ -1705,7 +1649,7 @@ bootpc_init(void) #endif mountopts(&nd->root_args, NULL); - for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = ifctx->next) + STAILQ_FOREACH(ifctx, &gctx->interfaces, next) if (bootpc_ifctx_isresolved(ifctx) != 0) bootpc_decode_reply(nd, ifctx, gctx); @@ -1714,19 +1658,16 @@ bootpc_init(void) panic("bootpc: No root path offered"); #endif - for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = ifctx->next) { + STAILQ_FOREACH(ifctx, &gctx->interfaces, next) bootpc_adjust_interface(ifctx, gctx, td); - soclose(ifctx->so); - } + soclose(bootp_so); - for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = ifctx->next) + STAILQ_FOREACH(ifctx, &gctx->interfaces, next) if (ifctx->gotrootpath != 0) break; if (ifctx == NULL) { - for (ifctx = gctx->interfaces; - ifctx != NULL; - ifctx = ifctx->next) + STAILQ_FOREACH(ifctx, &gctx->interfaces, next) if (bootpc_ifctx_isresolved(ifctx) != 0) break; } @@ -1755,8 +1696,8 @@ bootpc_init(void) bcopy(&ifctx->netmask, &nd->myif.ifra_mask, sizeof(ifctx->netmask)); out: - for (ifctx = gctx->interfaces; ifctx != NULL; ifctx = nctx) { - nctx = ifctx->next; + while((ifctx = STAILQ_FIRST(&gctx->interfaces)) != NULL) { + STAILQ_REMOVE_HEAD(&gctx->interfaces, next); free(ifctx, M_TEMP); } free(gctx, M_TEMP); From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 08:23:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB4921065672; Tue, 13 Dec 2011 08:23:03 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BAC858FC12; Tue, 13 Dec 2011 08:23:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBD8N3s3039970; Tue, 13 Dec 2011 08:23:03 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBD8N3LR039968; Tue, 13 Dec 2011 08:23:03 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201112130823.pBD8N3LR039968@svn.freebsd.org> From: Ruslan Ermilov Date: Tue, 13 Dec 2011 08:23:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228457 - head/share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 08:23:03 -0000 Author: ru Date: Tue Dec 13 08:23:03 2011 New Revision: 228457 URL: http://svn.freebsd.org/changeset/base/228457 Log: The "inet" keyword in the "ifconfig_IF_aliasN" is mandatory for IPv4 aliases to work since network.subr@197139. MFC after: 3 days Modified: head/share/man/man5/rc.conf.5 Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Tue Dec 13 07:13:48 2011 (r228456) +++ head/share/man/man5/rc.conf.5 Tue Dec 13 08:23:03 2011 (r228457) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 23, 2011 +.Dd December 13, 2011 .Dt RC.CONF 5 .Os .Sh NAME @@ -1101,7 +1101,9 @@ ipv4_addrs_ed0="192.0.2.129/27 192.0.2.1 .Pp It is also possible to add IP alias entries using .Xr ifconfig 8 -syntax. +syntax with the +.Dq Li inet +keyword. Assuming that the interface in question was .Li ed0 , it might look @@ -1114,7 +1116,9 @@ ifconfig_ed0_alias1="inet 127.0.0.254 ne And so on. For each .Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n -entry that is found, +entry with the +.Dq Li inet +keyword that is found, its contents are passed to .Xr ifconfig 8 . Execution stops at the first unsuccessful access, so if From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 08:56:59 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E7271065672; Tue, 13 Dec 2011 08:56:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id E9CF78FC1A; Tue, 13 Dec 2011 08:56:58 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id pBD8uvMd098505; Tue, 13 Dec 2011 12:56:57 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id pBD8uvCZ098504; Tue, 13 Dec 2011 12:56:57 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 13 Dec 2011 12:56:57 +0400 From: Gleb Smirnoff To: Ruslan Ermilov Message-ID: <20111213085657.GR67033@FreeBSD.org> References: <201112130823.pBD8N3LR039968@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201112130823.pBD8N3LR039968@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228457 - head/share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 08:56:59 -0000 On Tue, Dec 13, 2011 at 08:23:03AM +0000, Ruslan Ermilov wrote: R> Author: ru R> Date: Tue Dec 13 08:23:03 2011 R> New Revision: 228457 R> URL: http://svn.freebsd.org/changeset/base/228457 R> R> Log: R> The "inet" keyword in the "ifconfig_IF_aliasN" is mandatory for R> IPv4 aliases to work since network.subr@197139. I already mentioned to hrs@ and to re@ team that this MUST be mentioned in UPDATING and release notes. Ruslan, since you are already here :) please update relnotes and UPDATING! -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 09:01:46 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 068C8106564A; Tue, 13 Dec 2011 09:01:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 578708FC20; Tue, 13 Dec 2011 09:01:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBD91iO0041320; Tue, 13 Dec 2011 09:01:44 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBD91ivU041318; Tue, 13 Dec 2011 09:01:44 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112130901.pBD91ivU041318@svn.freebsd.org> From: Ed Schouten Date: Tue, 13 Dec 2011 09:01:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228458 - head/sbin/dumpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 09:01:46 -0000 Author: ed Date: Tue Dec 13 09:01:44 2011 New Revision: 228458 URL: http://svn.freebsd.org/changeset/base/228458 Log: Staticify dumpfs. This tool only consists of a single C file, so we can simply mark everything except main() static. This seems to shave off about 8% of the binary size. Modified: head/sbin/dumpfs/dumpfs.c Modified: head/sbin/dumpfs/dumpfs.c ============================================================================== --- head/sbin/dumpfs/dumpfs.c Tue Dec 13 08:23:03 2011 (r228457) +++ head/sbin/dumpfs/dumpfs.c Tue Dec 13 09:01:44 2011 (r228458) @@ -79,16 +79,16 @@ static const char rcsid[] = static struct uufsd disk; -int dumpfs(const char *); -int dumpfsid(void); -int dumpcg(void); -int dumpfreespace(const char *, int); -void dumpfreespacecg(int); -int marshal(const char *); -void pbits(void *, int); -void pblklist(void *, int, off_t, int); -void ufserr(const char *); -void usage(void) __dead2; +static int dumpfs(const char *); +static int dumpfsid(void); +static int dumpcg(void); +static int dumpfreespace(const char *, int); +static void dumpfreespacecg(int); +static int marshal(const char *); +static void pbits(void *, int); +static void pblklist(void *, int, off_t, int); +static void ufserr(const char *); +static void usage(void) __dead2; int main(int argc, char *argv[]) @@ -143,7 +143,7 @@ main(int argc, char *argv[]) exit(eval); } -int +static int dumpfsid(void) { @@ -151,7 +151,7 @@ dumpfsid(void) return 0; } -int +static int dumpfs(const char *name) { time_t fstime; @@ -309,7 +309,7 @@ err: ufserr(name); return (1); } -int +static int dumpcg(void) { time_t cgtime; @@ -370,7 +370,7 @@ dumpcg(void) return (0); } -int +static int dumpfreespace(const char *name, int fflag) { int i; @@ -386,7 +386,7 @@ err: return (1); } -void +static void dumpfreespacecg(int fflag) { @@ -394,7 +394,7 @@ dumpfreespacecg(int fflag) fflag); } -int +static int marshal(const char *name) { struct fs *fs; @@ -444,7 +444,7 @@ marshal(const char *name) return 0; } -void +static void pbits(void *vp, int max) { int i; @@ -466,7 +466,7 @@ pbits(void *vp, int max) printf("\n"); } -void +static void pblklist(void *vp, int max, off_t offset, int fflag) { int i, j; @@ -487,7 +487,7 @@ pblklist(void *vp, int max, off_t offset } } -void +static void ufserr(const char *name) { if (disk.d_error != NULL) @@ -496,7 +496,7 @@ ufserr(const char *name) warn("%s", name); } -void +static void usage(void) { (void)fprintf(stderr, "usage: dumpfs [-fm] filesys | device\n"); From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 09:58:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC9211065767; Tue, 13 Dec 2011 09:58:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A86C8FC0A; Tue, 13 Dec 2011 09:58:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBD9w5dM043125; Tue, 13 Dec 2011 09:58:05 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBD9w5Sv043122; Tue, 13 Dec 2011 09:58:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201112130958.pBD9w5Sv043122@svn.freebsd.org> From: Alexander Motin Date: Tue, 13 Dec 2011 09:58:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228461 - head/sys/dev/isp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 09:58:09 -0000 Author: mav Date: Tue Dec 13 09:58:05 2011 New Revision: 228461 URL: http://svn.freebsd.org/changeset/base/228461 Log: Fix few bugs in isp(4) target mode support: - in destroy_lun_state() assert hold == 1 instead of 0, as it should receive hold taken by the create_lun_state() or get_lun_statep() before; - fix hold count leak inside rls_lun_statep() that also fired above assert; - in destroy_lun_state() use SIM bus number instead of SIM path id for ISP_GET_PC_ADDR(), as it was before r196008; - make isp_disable_lun() to set status in CCB; - make isp_target_mark_aborted() set status into the proper CCB. Reviewed by: mjacob Sponsored by: iXsystems, inc. MFC after: 1 month Modified: head/sys/dev/isp/isp_freebsd.c Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Tue Dec 13 09:57:59 2011 (r228460) +++ head/sys/dev/isp/isp_freebsd.c Tue Dec 13 09:58:05 2011 (r228461) @@ -1087,8 +1087,9 @@ static ISP_INLINE void destroy_lun_state(ispsoftc_t *isp, tstate_t *tptr) { struct tslist *lhp; - KASSERT((tptr->hold == 0), ("tptr still held")); - ISP_GET_PC_ADDR(isp, xpt_path_path_id(tptr->owner), lun_hash[LUN_HASH_FUNC(xpt_path_lun_id(tptr->owner))], lhp); + KASSERT((tptr->hold != 0), ("tptr is not held")); + KASSERT((tptr->hold == 1), ("tptr still held (%d)", tptr->hold)); + ISP_GET_PC_ADDR(isp, cam_sim_bus(xpt_path_sim(tptr->owner)), lun_hash[LUN_HASH_FUNC(xpt_path_lun_id(tptr->owner))], lhp); SLIST_REMOVE(lhp, tptr, tstate, next); xpt_free_path(tptr->owner); free(tptr, M_DEVBUF); @@ -1316,12 +1317,13 @@ isp_disable_lun(ispsoftc_t *isp, union c mtx_sleep(isp, &isp->isp_lock, PRIBIO, "want_isp_disable_lun", 0); } isp->isp_osinfo.tmbusy = 1; + status = CAM_REQ_INPROG; /* * Find the state pointer. */ if ((tptr = get_lun_statep(isp, bus, lun)) == NULL) { - ccb->ccb_h.status = CAM_PATH_INVALID; + status = CAM_PATH_INVALID; goto done; } @@ -1341,13 +1343,13 @@ isp_disable_lun(ispsoftc_t *isp, union c } isp->isp_osinfo.rptr = &status; - status = CAM_REQ_INPROG; if (isp_lun_cmd(isp, RQSTYPE_ENABLE_LUN, bus, lun, 0, 0)) { status = CAM_RESRC_UNAVAIL; } else { mtx_sleep(ccb, &isp->isp_lock, PRIBIO, "isp_disable_lun", 0); } done: + ccb->ccb_h.status = status; if (status == CAM_REQ_CMP) { xpt_print(ccb->ccb_h.path, "now disabled for target mode\n"); } @@ -2949,23 +2951,25 @@ isp_target_mark_aborted(ispsoftc_t *isp, { tstate_t *tptr; atio_private_data_t *atp; + union ccb *accb = ccb->cab.abort_ccb; - tptr = get_lun_statep(isp, XS_CHANNEL(ccb), XS_LUN(ccb)); + tptr = get_lun_statep(isp, XS_CHANNEL(accb), XS_LUN(accb)); if (tptr == NULL) { - tptr = get_lun_statep(isp, XS_CHANNEL(ccb), CAM_LUN_WILDCARD); + tptr = get_lun_statep(isp, XS_CHANNEL(accb), CAM_LUN_WILDCARD); if (tptr == NULL) { ccb->ccb_h.status = CAM_REQ_INVALID; return; } } - atp = isp_get_atpd(isp, tptr, ccb->atio.tag_id); + atp = isp_get_atpd(isp, tptr, accb->atio.tag_id); if (atp == NULL) { ccb->ccb_h.status = CAM_REQ_INVALID; - return; + } else { + atp->dead = 1; + ccb->ccb_h.status = CAM_REQ_CMP; } - atp->dead = 1; - ccb->ccb_h.status = CAM_REQ_CMP; + rls_lun_statep(isp, tptr); } static void @@ -4519,7 +4523,7 @@ isp_action(struct cam_sim *sim, union cc switch (accb->ccb_h.func_code) { #ifdef ISP_TARGET_MODE case XPT_ACCEPT_TARGET_IO: - isp_target_mark_aborted(isp, accb); + isp_target_mark_aborted(isp, ccb); break; #endif case XPT_SCSI_IO: From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 11:13:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A32A1065672; Tue, 13 Dec 2011 11:13:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F0478FC18; Tue, 13 Dec 2011 11:13:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDBDSvJ047445; Tue, 13 Dec 2011 11:13:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDBDSdL047443; Tue, 13 Dec 2011 11:13:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201112131113.pBDBDSdL047443@svn.freebsd.org> From: Alexander Motin Date: Tue, 13 Dec 2011 11:13:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228462 - head/share/examples/scsi_target X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 11:13:28 -0000 Author: mav Date: Tue Dec 13 11:13:28 2011 New Revision: 228462 URL: http://svn.freebsd.org/changeset/base/228462 Log: - Fix different variable types use in different files after r121184, causing problems on amd64. - s/%lud/%lu/. MFC after: 1 month Modified: head/share/examples/scsi_target/scsi_cmds.c Modified: head/share/examples/scsi_target/scsi_cmds.c ============================================================================== --- head/share/examples/scsi_target/scsi_cmds.c Tue Dec 13 09:58:05 2011 (r228461) +++ head/share/examples/scsi_target/scsi_cmds.c Tue Dec 13 11:13:28 2011 (r228462) @@ -103,8 +103,8 @@ static struct targ_cdb_handlers cdb_hand static struct scsi_inquiry_data inq_data; static struct initiator_state istates[MAX_INITIATORS]; extern int debug; -extern uint64_t volume_size; -extern size_t sector_size; +extern off_t volume_size; +extern u_int sector_size; extern size_t buf_size; cam_status @@ -609,7 +609,7 @@ start_io(struct ccb_accept_tio *atio, st if (dir == CAM_DIR_IN) { if (notaio) { if (debug) - warnx("read sync %lud @ block " OFF_FMT, + warnx("read sync %lu @ block " OFF_FMT, (unsigned long) (ctio->dxfer_len / sector_size), c_descr->offset / sector_size); @@ -625,7 +625,7 @@ start_io(struct ccb_accept_tio *atio, st } } else { if (debug) - warnx("read async %lud @ block " OFF_FMT, + warnx("read async %lu @ block " OFF_FMT, (unsigned long) (ctio->dxfer_len / sector_size), c_descr->offset / sector_size); @@ -725,7 +725,7 @@ tcmd_rdwr_done(struct ccb_accept_tio *at a_descr->targ_req += ctio->dxfer_len; if (notaio) { if (debug) - warnx("write sync %lud @ block " + warnx("write sync %lu @ block " OFF_FMT, (unsigned long) (ctio->dxfer_len / sector_size), c_descr->offset / sector_size); @@ -742,7 +742,7 @@ tcmd_rdwr_done(struct ccb_accept_tio *at tcmd_rdwr_done(atio, ctio, AIO_DONE); } else { if (debug) - warnx("write async %lud @ block " + warnx("write async %lu @ block " OFF_FMT, (unsigned long) (ctio->dxfer_len / sector_size), c_descr->offset / sector_size); From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 11:54:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07DCD106566B; Tue, 13 Dec 2011 11:54:52 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EAF868FC0A; Tue, 13 Dec 2011 11:54:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDBsppq048700; Tue, 13 Dec 2011 11:54:51 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDBspAu048698; Tue, 13 Dec 2011 11:54:51 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112131154.pBDBspAu048698@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 13 Dec 2011 11:54:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228463 - head/sbin/dhclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 11:54:52 -0000 Author: glebius Date: Tue Dec 13 11:54:51 2011 New Revision: 228463 URL: http://svn.freebsd.org/changeset/base/228463 Log: dhclient-script relied on incorrect behavior of SIOCAIFADDR ioctl, that changed 0.0.0.0/0.0.0.0 prefix to 0.0.0.0/255.0.0.0. In the r228313 this behavior was fixed, and since dhclient-script got broken. I'm not sure this fix is a perfect one, it just changes dhclient-script to set 0.0.0.0/255.0.0.0 explicitly. PR: kern/163206 Modified: head/sbin/dhclient/dhclient-script Modified: head/sbin/dhclient/dhclient-script ============================================================================== --- head/sbin/dhclient/dhclient-script Tue Dec 13 11:13:28 2011 (r228462) +++ head/sbin/dhclient/dhclient-script Tue Dec 13 11:54:51 2011 (r228463) @@ -320,7 +320,7 @@ MEDIUM) PREINIT) delete_old_alias - $IFCONFIG $interface inet alias 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up + $IFCONFIG $interface inet alias 0.0.0.0 netmask 255.0.0.0 broadcast 255.255.255.255 up ;; ARPCHECK|ARPSEND) From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 12:36:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3EF891065670; Tue, 13 Dec 2011 12:36:53 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id DE5088FC0A; Tue, 13 Dec 2011 12:36:52 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 391BC9F4; Tue, 13 Dec 2011 13:36:50 +0100 (CET) Date: Tue, 13 Dec 2011 13:35:49 +0100 From: Pawel Jakub Dawidek To: Hiroki Sato Message-ID: <20111213123549.GB1659@garage.freebsd.pl> References: <200909122213.n8CMDfdW098895@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uQr8t48UFsdbeI+V" Content-Disposition: inline In-Reply-To: <200909122213.n8CMDfdW098895@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r197139 - in head/etc: . rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 12:36:53 -0000 --uQr8t48UFsdbeI+V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 12, 2009 at 10:13:41PM +0000, Hiroki Sato wrote: > Author: hrs > Date: Sat Sep 12 22:13:41 2009 > New Revision: 197139 > URL: http://svn.freebsd.org/changeset/base/197139 >=20 > Log: > Integrate rc.d/network_ipv6 into rc.d/netif: > =20 > - Add rc.d/stf and rc.d/faith for stf(4) and faith(4). > - Remove rc.d/auto_linklocal and rc.d/network_ipv6. > - Move rc.d/sysctl to just before FILESYSTEMS because rc.d/netif > depends on some sysctl variables. Is this true that after this commit 'inet' is required for ifconfig__alias variables? If that's true, this is huge POLA violation and I'd really reconsider or found a way to make 'inet' not to be required. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --uQr8t48UFsdbeI+V Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk7nRqQACgkQForvXbEpPzQhsACg0BNnHj0DQLst12at0R14+d5y XfcAoKO39a9fn0Pb6R/x7PBEzxl3dA3e =63fK -----END PGP SIGNATURE----- --uQr8t48UFsdbeI+V-- From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 12:59:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDF81106566B; Tue, 13 Dec 2011 12:59:39 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC39E8FC0A; Tue, 13 Dec 2011 12:59:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDCxduh050689; Tue, 13 Dec 2011 12:59:39 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDCxduA050687; Tue, 13 Dec 2011 12:59:39 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201112131259.pBDCxduA050687@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 13 Dec 2011 12:59:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228464 - stable/9/contrib/openpam/lib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 12:59:39 -0000 Author: des Date: Tue Dec 13 12:59:39 2011 New Revision: 228464 URL: http://svn.freebsd.org/changeset/base/228464 Log: MFH r228384: validate the service name Approved by: re (kib) Security: some poorly thought out programs allow the user to specify the service name; this patch makes it harder to trick these programs into loading and executing arbitrary code. Modified: stable/9/contrib/openpam/lib/openpam_configure.c Directory Properties: stable/9/contrib/openpam/ (props changed) Modified: stable/9/contrib/openpam/lib/openpam_configure.c ============================================================================== --- stable/9/contrib/openpam/lib/openpam_configure.c Tue Dec 13 11:54:51 2011 (r228463) +++ stable/9/contrib/openpam/lib/openpam_configure.c Tue Dec 13 12:59:39 2011 (r228464) @@ -285,6 +285,13 @@ openpam_load_chain(pam_handle_t *pamh, size_t len; int r; + /* don't allow to escape from policy_path */ + if (strchr(service, '/')) { + openpam_log(PAM_LOG_ERROR, "invalid service name: %s", + service); + return (-PAM_SYSTEM_ERR); + } + for (path = openpam_policy_path; *path != NULL; ++path) { len = strlen(*path); if ((*path)[len - 1] == '/') { From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 13:02:31 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F02FA1065670; Tue, 13 Dec 2011 13:02:31 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DEE858FC0C; Tue, 13 Dec 2011 13:02:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDD2V2x050847; Tue, 13 Dec 2011 13:02:31 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDD2Vx2050845; Tue, 13 Dec 2011 13:02:31 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201112131302.pBDD2Vx2050845@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 13 Dec 2011 13:02:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228465 - releng/9.0/contrib/openpam/lib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 13:02:32 -0000 Author: des Date: Tue Dec 13 13:02:31 2011 New Revision: 228465 URL: http://svn.freebsd.org/changeset/base/228465 Log: MFH r228384: validate the service name Approved by: re (kib) Security: some poorly thought out programs allow the user to specify the service name; this patch makes it harder to trick these programs into loading and executing arbitrary code. Modified: releng/9.0/contrib/openpam/lib/openpam_configure.c Directory Properties: releng/9.0/contrib/openpam/ (props changed) Modified: releng/9.0/contrib/openpam/lib/openpam_configure.c ============================================================================== --- releng/9.0/contrib/openpam/lib/openpam_configure.c Tue Dec 13 12:59:39 2011 (r228464) +++ releng/9.0/contrib/openpam/lib/openpam_configure.c Tue Dec 13 13:02:31 2011 (r228465) @@ -285,6 +285,13 @@ openpam_load_chain(pam_handle_t *pamh, size_t len; int r; + /* don't allow to escape from policy_path */ + if (strchr(service, '/')) { + openpam_log(PAM_LOG_ERROR, "invalid service name: %s", + service); + return (-PAM_SYSTEM_ERR); + } + for (path = openpam_policy_path; *path != NULL; ++path) { len = strlen(*path); if ((*path)[len - 1] == '/') { From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 13:02:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C18C1065670; Tue, 13 Dec 2011 13:02:53 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE6488FC0A; Tue, 13 Dec 2011 13:02:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDD2q80050895; Tue, 13 Dec 2011 13:02:52 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDD2qn6050893; Tue, 13 Dec 2011 13:02:52 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201112131302.pBDD2qn6050893@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 13 Dec 2011 13:02:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228466 - stable/8/contrib/openpam/lib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 13:02:53 -0000 Author: des Date: Tue Dec 13 13:02:52 2011 New Revision: 228466 URL: http://svn.freebsd.org/changeset/base/228466 Log: MFH r228384: validate the service name Security: some poorly thought out programs allow the user to specify the service name; this patch makes it harder to trick these programs into loading and executing arbitrary code. Modified: stable/8/contrib/openpam/lib/openpam_configure.c Directory Properties: stable/8/contrib/openpam/ (props changed) Modified: stable/8/contrib/openpam/lib/openpam_configure.c ============================================================================== --- stable/8/contrib/openpam/lib/openpam_configure.c Tue Dec 13 13:02:31 2011 (r228465) +++ stable/8/contrib/openpam/lib/openpam_configure.c Tue Dec 13 13:02:52 2011 (r228466) @@ -285,6 +285,13 @@ openpam_load_chain(pam_handle_t *pamh, size_t len; int r; + /* don't allow to escape from policy_path */ + if (strchr(service, '/')) { + openpam_log(PAM_LOG_ERROR, "invalid service name: %s", + service); + return (-PAM_SYSTEM_ERR); + } + for (path = openpam_policy_path; *path != NULL; ++path) { len = strlen(*path); if ((*path)[len - 1] == '/') { From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 13:03:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FBEA1065675; Tue, 13 Dec 2011 13:03:11 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DF038FC0C; Tue, 13 Dec 2011 13:03:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDD3BtR050940; Tue, 13 Dec 2011 13:03:11 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDD3Bdp050938; Tue, 13 Dec 2011 13:03:11 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201112131303.pBDD3Bdp050938@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 13 Dec 2011 13:03:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228467 - stable/7/contrib/openpam/lib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 13:03:11 -0000 Author: des Date: Tue Dec 13 13:03:11 2011 New Revision: 228467 URL: http://svn.freebsd.org/changeset/base/228467 Log: MFH r228384: validate the service name Security: some poorly thought out programs allow the user to specify the service name; this patch makes it harder to trick these programs into loading and executing arbitrary code. Modified: stable/7/contrib/openpam/lib/openpam_configure.c Directory Properties: stable/7/contrib/openpam/ (props changed) Modified: stable/7/contrib/openpam/lib/openpam_configure.c ============================================================================== --- stable/7/contrib/openpam/lib/openpam_configure.c Tue Dec 13 13:02:52 2011 (r228466) +++ stable/7/contrib/openpam/lib/openpam_configure.c Tue Dec 13 13:03:11 2011 (r228467) @@ -285,6 +285,13 @@ openpam_load_chain(pam_handle_t *pamh, size_t len; int r; + /* don't allow to escape from policy_path */ + if (strchr(service, '/')) { + openpam_log(PAM_LOG_ERROR, "invalid service name: %s", + service); + return (-PAM_SYSTEM_ERR); + } + for (path = openpam_policy_path; *path != NULL; ++path) { len = strlen(*path); if ((*path)[len - 1] == '/') { From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 13:32:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1424D1065741; Tue, 13 Dec 2011 13:32:57 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0222C8FC12; Tue, 13 Dec 2011 13:32:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDDWuMF051872; Tue, 13 Dec 2011 13:32:56 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDDWuYF051862; Tue, 13 Dec 2011 13:32:56 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112131332.pBDDWuYF051862@svn.freebsd.org> From: Ed Schouten Date: Tue, 13 Dec 2011 13:32:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228468 - in head: include sys/dev/uart sys/sys usr.bin/mail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 13:32:57 -0000 Author: ed Date: Tue Dec 13 13:32:56 2011 New Revision: 228468 URL: http://svn.freebsd.org/changeset/base/228468 Log: Replace __const by const in all non-contributed source code. As C1X is close to being released, there is no need to wrap around a feature that is already part of C90. Most of these files already use `const' in different placed as well. Modified: head/include/netdb.h head/include/regex.h head/include/signal.h head/include/stdio.h head/include/stdlib.h head/sys/dev/uart/uart_subr.c head/sys/sys/types.h head/usr.bin/mail/extern.h head/usr.bin/mail/lex.c Modified: head/include/netdb.h ============================================================================== --- head/include/netdb.h Tue Dec 13 13:03:11 2011 (r228467) +++ head/include/netdb.h Tue Dec 13 13:32:56 2011 (r228468) @@ -276,7 +276,7 @@ int getservbyport_r(int, const char *, int getservent_r(struct servent *, char *, size_t, struct servent **); void herror(const char *); -__const char *hstrerror(int); +const char *hstrerror(int); int innetgr(const char *, const char *, const char *, const char *); void setnetgrent(const char *); #endif Modified: head/include/regex.h ============================================================================== --- head/include/regex.h Tue Dec 13 13:03:11 2011 (r228467) +++ head/include/regex.h Tue Dec 13 13:32:56 2011 (r228468) @@ -51,7 +51,7 @@ typedef __size_t size_t; typedef struct { int re_magic; size_t re_nsub; /* number of parenthesized subexpressions */ - __const char *re_endp; /* end pointer for REG_PEND */ + const char *re_endp; /* end pointer for REG_PEND */ struct re_guts *re_g; /* none of your business :-) */ } regex_t; Modified: head/include/signal.h ============================================================================== --- head/include/signal.h Tue Dec 13 13:03:11 2011 (r228467) +++ head/include/signal.h Tue Dec 13 13:32:56 2011 (r228468) @@ -42,9 +42,9 @@ * XXX should enlarge these, if only to give empty names instead of bounds * errors for large signal numbers. */ -extern __const char *__const sys_signame[NSIG]; -extern __const char *__const sys_siglist[NSIG]; -extern __const int sys_nsig; +extern const char * const sys_signame[NSIG]; +extern const char * const sys_siglist[NSIG]; +extern const int sys_nsig; #endif #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE Modified: head/include/stdio.h ============================================================================== --- head/include/stdio.h Tue Dec 13 13:03:11 2011 (r228467) +++ head/include/stdio.h Tue Dec 13 13:32:56 2011 (r228468) @@ -404,8 +404,8 @@ int vasprintf(char **, const char *, __ * positive errno values. Use strerror() or strerror_r() from * instead. */ -extern __const int sys_nerr; -extern __const char *__const sys_errlist[]; +extern const int sys_nerr; +extern const char * const sys_errlist[]; /* * Stdio function-access interface. Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Tue Dec 13 13:03:11 2011 (r228467) +++ head/include/stdlib.h Tue Dec 13 13:32:56 2011 (r228468) @@ -271,7 +271,7 @@ char *devname_r(__dev_t, __mode_t, char char *fdevname(int); char *fdevname_r(int, char *, int); int getloadavg(double [], int); -__const char * +const char * getprogname(void); int heapsort(void *, size_t, size_t, int (*)(const void *, const void *)); Modified: head/sys/dev/uart/uart_subr.c ============================================================================== --- head/sys/dev/uart/uart_subr.c Tue Dec 13 13:03:11 2011 (r228467) +++ head/sys/dev/uart/uart_subr.c Tue Dec 13 13:32:56 2011 (r228468) @@ -56,13 +56,13 @@ static struct uart_class *uart_classes[] static size_t uart_nclasses = sizeof(uart_classes) / sizeof(uart_classes[0]); static bus_addr_t -uart_parse_addr(__const char **p) +uart_parse_addr(const char **p) { return (strtoul(*p, (char**)(uintptr_t)p, 0)); } static struct uart_class * -uart_parse_class(struct uart_class *class, __const char **p) +uart_parse_class(struct uart_class *class, const char **p) { struct uart_class *uc; const char *nm; @@ -84,13 +84,13 @@ uart_parse_class(struct uart_class *clas } static long -uart_parse_long(__const char **p) +uart_parse_long(const char **p) { return (strtol(*p, (char**)(uintptr_t)p, 0)); } static int -uart_parse_parity(__const char **p) +uart_parse_parity(const char **p) { if (!strncmp(*p, "even", 4)) { *p += 4; @@ -116,7 +116,7 @@ uart_parse_parity(__const char **p) } static int -uart_parse_tag(__const char **p) +uart_parse_tag(const char **p) { int tag; @@ -192,7 +192,7 @@ out: int uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class) { - __const char *spec; + const char *spec; bus_addr_t addr = ~0U; int error; Modified: head/sys/sys/types.h ============================================================================== --- head/sys/sys/types.h Tue Dec 13 13:03:11 2011 (r228467) +++ head/sys/sys/types.h Tue Dec 13 13:32:56 2011 (r228468) @@ -72,7 +72,7 @@ typedef __int64_t quad_t; typedef quad_t * qaddr_t; typedef char * caddr_t; /* core address */ -typedef __const char * c_caddr_t; /* core address, pointer to const */ +typedef const char * c_caddr_t; /* core address, pointer to const */ typedef __volatile char *v_caddr_t; /* core address, pointer to volatile */ #ifndef _BLKSIZE_T_DECLARED Modified: head/usr.bin/mail/extern.h ============================================================================== --- head/usr.bin/mail/extern.h Tue Dec 13 13:03:11 2011 (r228467) +++ head/usr.bin/mail/extern.h Tue Dec 13 13:32:56 2011 (r228468) @@ -154,7 +154,7 @@ int ishead(char []); int isign(const char *, struct ignoretab []); int isprefix(const char *, const char *); void istrncpy(char *, const char *, size_t); -__const struct cmd * +const struct cmd * lex(char []); void load(char *); struct var * Modified: head/usr.bin/mail/lex.c ============================================================================== --- head/usr.bin/mail/lex.c Tue Dec 13 13:03:11 2011 (r228467) +++ head/usr.bin/mail/lex.c Tue Dec 13 13:32:56 2011 (r228468) @@ -482,7 +482,7 @@ setmsize(int sz) * to the passed command "word" */ -__const struct cmd * +const struct cmd * lex(char word[]) { const struct cmd *cp; From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 13:38:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6D231065673; Tue, 13 Dec 2011 13:38:03 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3AF18FC1A; Tue, 13 Dec 2011 13:38:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDDc3MR052077; Tue, 13 Dec 2011 13:38:03 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDDc3lt052068; Tue, 13 Dec 2011 13:38:03 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112131338.pBDDc3lt052068@svn.freebsd.org> From: Ed Schouten Date: Tue, 13 Dec 2011 13:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228469 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include ofed/include/asm powerpc/include sparc64/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 13:38:03 -0000 Author: ed Date: Tue Dec 13 13:38:03 2011 New Revision: 228469 URL: http://svn.freebsd.org/changeset/base/228469 Log: Replace __signed by signed. The signed keyword is an integral part of the C syntax. There's no need to use __signed. Modified: head/sys/amd64/include/_types.h head/sys/arm/include/_types.h head/sys/i386/include/_types.h head/sys/ia64/include/_types.h head/sys/mips/include/_types.h head/sys/ofed/include/asm/types.h head/sys/powerpc/include/_types.h head/sys/sparc64/include/_types.h Modified: head/sys/amd64/include/_types.h ============================================================================== --- head/sys/amd64/include/_types.h Tue Dec 13 13:32:56 2011 (r228468) +++ head/sys/amd64/include/_types.h Tue Dec 13 13:38:03 2011 (r228469) @@ -48,7 +48,7 @@ /* * Basic types upon which most other types are built. */ -typedef __signed char __int8_t; +typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; Modified: head/sys/arm/include/_types.h ============================================================================== --- head/sys/arm/include/_types.h Tue Dec 13 13:32:56 2011 (r228468) +++ head/sys/arm/include/_types.h Tue Dec 13 13:38:03 2011 (r228469) @@ -46,7 +46,7 @@ /* * Basic types upon which most other types are built. */ -typedef __signed char __int8_t; +typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; Modified: head/sys/i386/include/_types.h ============================================================================== --- head/sys/i386/include/_types.h Tue Dec 13 13:32:56 2011 (r228468) +++ head/sys/i386/include/_types.h Tue Dec 13 13:38:03 2011 (r228469) @@ -48,7 +48,7 @@ /* * Basic types upon which most other types are built. */ -typedef __signed char __int8_t; +typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; Modified: head/sys/ia64/include/_types.h ============================================================================== --- head/sys/ia64/include/_types.h Tue Dec 13 13:32:56 2011 (r228468) +++ head/sys/ia64/include/_types.h Tue Dec 13 13:38:03 2011 (r228469) @@ -46,7 +46,7 @@ /* * Basic types upon which most other types are built. */ -typedef __signed char __int8_t; +typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; Modified: head/sys/mips/include/_types.h ============================================================================== --- head/sys/mips/include/_types.h Tue Dec 13 13:32:56 2011 (r228468) +++ head/sys/mips/include/_types.h Tue Dec 13 13:38:03 2011 (r228469) @@ -47,7 +47,7 @@ /* * Basic types upon which most other types are built. */ -typedef __signed char __int8_t; +typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; Modified: head/sys/ofed/include/asm/types.h ============================================================================== --- head/sys/ofed/include/asm/types.h Tue Dec 13 13:32:56 2011 (r228468) +++ head/sys/ofed/include/asm/types.h Tue Dec 13 13:38:03 2011 (r228469) @@ -30,17 +30,17 @@ typedef unsigned short umode_t; -typedef __signed__ char __s8; +typedef signed char __s8; typedef unsigned char __u8; -typedef __signed__ short __s16; +typedef signed short __s16; typedef unsigned short __u16; -typedef __signed__ int __s32; +typedef signed int __s32; typedef unsigned int __u32; #if defined(__GNUC__) // && !defined(__STRICT_ANSI__) -typedef __signed__ long long __s64; +typedef signed long long __s64; typedef unsigned long long __u64; #endif Modified: head/sys/powerpc/include/_types.h ============================================================================== --- head/sys/powerpc/include/_types.h Tue Dec 13 13:32:56 2011 (r228468) +++ head/sys/powerpc/include/_types.h Tue Dec 13 13:38:03 2011 (r228469) @@ -46,7 +46,7 @@ /* * Basic types upon which most other types are built. */ -typedef __signed char __int8_t; +typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; Modified: head/sys/sparc64/include/_types.h ============================================================================== --- head/sys/sparc64/include/_types.h Tue Dec 13 13:32:56 2011 (r228468) +++ head/sys/sparc64/include/_types.h Tue Dec 13 13:38:03 2011 (r228469) @@ -42,7 +42,7 @@ /* * Basic types upon which most other types are built. */ -typedef __signed char __int8_t; +typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 14:00:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54B291065672; Tue, 13 Dec 2011 14:00:28 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 434F08FC0C; Tue, 13 Dec 2011 14:00:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDE0SnJ053403; Tue, 13 Dec 2011 14:00:28 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDE0S6M053401; Tue, 13 Dec 2011 14:00:28 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112131400.pBDE0S6M053401@svn.freebsd.org> From: Eitan Adler Date: Tue, 13 Dec 2011 14:00:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228470 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 14:00:28 -0000 Author: eadler (ports committer) Date: Tue Dec 13 14:00:27 2011 New Revision: 228470 URL: http://svn.freebsd.org/changeset/base/228470 Log: - Add a sysctl to allow non-root users the ability to set idle priorities. - While here fix up some style nits. Discussed with: cperciva (breifly) Reviewed by: pjd (earlier version) Reviewed by: bde Approved by: jhb MFC after: 1 month Modified: head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Tue Dec 13 13:38:03 2011 (r228469) +++ head/sys/kern/kern_resource.c Tue Dec 13 14:00:27 2011 (r228470) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -273,6 +274,10 @@ donice(struct thread *td, struct proc *p return (0); } +static int unprivileged_idprio; +SYSCTL_INT(_security_bsd, OID_AUTO, unprivileged_idprio, CTLFLAG_RW, + &unprivileged_idprio, 0, "Allow non-root users to set an idle priority"); + /* * Set realtime priority for LWP. */ @@ -321,18 +326,26 @@ sys_rtprio_thread(struct thread *td, str break; /* Disallow setting rtprio in most cases if not superuser. */ -/* - * Realtime priority has to be restricted for reasons which should be - * obvious. However, for idle priority, there is a potential for - * system deadlock if an idleprio process gains a lock on a resource - * that other processes need (and the idleprio process can't run - * due to a CPU-bound normal process). Fix me! XXX - */ -#if 0 - if (RTP_PRIO_IS_REALTIME(rtp.type)) { -#else - if (rtp.type != RTP_PRIO_NORMAL) { -#endif + + /* + * Realtime priority has to be restricted for reasons which + * should be obvious. However, for idleprio processes, there is + * a potential for system deadlock if an idleprio process gains + * a lock on a resource that other processes need (and the + * idleprio process can't run due to a CPU-bound normal + * process). Fix me! XXX + * + * This problem is not only related to idleprio process. + * A user level program can obtain a file lock and hold it + * indefinitely. Additionally, without idleprio processes it is + * still conceivable that a program with low priority will never + * get to run. In short, allowing this feature might make it + * easier to lock a resource indefinitely, but it is not the + * only thing that makes it possible. + */ + if (RTP_PRIO_BASE(rtp.type) == RTP_PRIO_REALTIME || + (RTP_PRIO_BASE(rtp.type) == RTP_PRIO_IDLE && + unprivileged_idprio == 0)) { error = priv_check(td, PRIV_SCHED_RTPRIO); if (error) break; @@ -417,19 +430,14 @@ sys_rtprio(td, uap) if ((error = p_cansched(td, p)) || (error = cierror)) break; - /* Disallow setting rtprio in most cases if not superuser. */ -/* - * Realtime priority has to be restricted for reasons which should be - * obvious. However, for idle priority, there is a potential for - * system deadlock if an idleprio process gains a lock on a resource - * that other processes need (and the idleprio process can't run - * due to a CPU-bound normal process). Fix me! XXX - */ -#if 0 - if (RTP_PRIO_IS_REALTIME(rtp.type)) { -#else - if (rtp.type != RTP_PRIO_NORMAL) { -#endif + /* + * Disallow setting rtprio in most cases if not superuser. + * See the comment in sys_rtprio_thread about idprio + * threads holding a lock. + */ + if (RTP_PRIO_BASE(rtp.type) == RTP_PRIO_REALTIME || + (RTP_PRIO_BASE(rtp.type) == RTP_PRIO_IDLE && + !unprivileged_idprio)) { error = priv_check(td, PRIV_SCHED_RTPRIO); if (error) break; From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 14:05:56 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F3E11065679; Tue, 13 Dec 2011 14:05:56 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 22A9F8FC1B; Tue, 13 Dec 2011 14:05:52 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.5/8.14.2) with ESMTP id pBDE5pLA093260; Tue, 13 Dec 2011 09:05:51 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.5/8.14.2/Submit) id pBDE5pqS093259; Tue, 13 Dec 2011 09:05:51 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Tue, 13 Dec 2011 09:05:51 -0500 From: David Schultz To: Ed Schouten Message-ID: <20111213140551.GA93161@zim.MIT.EDU> Mail-Followup-To: Ed Schouten , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201112131338.pBDDc3lt052068@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112131338.pBDDc3lt052068@svn.freebsd.org> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r228469 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include ofed/include/asm powerpc/include sparc64/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 14:05:56 -0000 On Tue, Dec 13, 2011, Ed Schouten wrote: > Author: ed > Date: Tue Dec 13 13:38:03 2011 > New Revision: 228469 > URL: http://svn.freebsd.org/changeset/base/228469 > > Log: > Replace __signed by signed. > > The signed keyword is an integral part of the C syntax. There's no need > to use __signed. For what it's worth, I believe __signed and __const were intended to support gcc's -traditional flag, which was needed to get some pre-ANSI programs to compile. But any vestiges of pre-ANSI support probably rotted a long time ago, and the -traditional option isn't supported anymore in gcc. From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 14:06:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADBF21065675; Tue, 13 Dec 2011 14:06:01 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A8468FC16; Tue, 13 Dec 2011 14:06:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDE61Cx053703; Tue, 13 Dec 2011 14:06:01 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDE61bc053693; Tue, 13 Dec 2011 14:06:01 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112131406.pBDE61bc053693@svn.freebsd.org> From: Ed Schouten Date: Tue, 13 Dec 2011 14:06:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228471 - in head/sys: boot/arm/at91/libat91 dev/cm dev/de dev/fdc dev/pccard dev/spibus dev/xen/netback pc98/cbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 14:06:01 -0000 Author: ed Date: Tue Dec 13 14:06:01 2011 New Revision: 228471 URL: http://svn.freebsd.org/changeset/base/228471 Log: Replace `inline static' by `static inline'. If I interpret the C standard correctly, the storage specifier should be placed before the inline keyword. While at it, replace __inline by inline in the files affected. Modified: head/sys/boot/arm/at91/libat91/sd-card.c head/sys/dev/cm/smc90cx6.c head/sys/dev/de/if_de.c head/sys/dev/fdc/fdc.c head/sys/dev/pccard/pccardvar.h head/sys/dev/spibus/spibusvar.h head/sys/dev/xen/netback/netback.c head/sys/pc98/cbus/scterm-sck.c head/sys/pc98/cbus/scvtb.c Modified: head/sys/boot/arm/at91/libat91/sd-card.c ============================================================================== --- head/sys/boot/arm/at91/libat91/sd-card.c Tue Dec 13 14:00:27 2011 (r228470) +++ head/sys/boot/arm/at91/libat91/sd-card.c Tue Dec 13 14:06:01 2011 (r228471) @@ -94,14 +94,14 @@ MCIDeviceWaitReady(unsigned int timeout) } // End of if AT91C_MCI_RXBUFF } -inline static unsigned int +static inline unsigned int swap(unsigned int a) { return (((a & 0xff) << 24) | ((a & 0xff00) << 8) | ((a & 0xff0000) >> 8) | ((a & 0xff000000) >> 24)); } -inline static void +static inline void wait_ready() { int status; Modified: head/sys/dev/cm/smc90cx6.c ============================================================================== --- head/sys/dev/cm/smc90cx6.c Tue Dec 13 14:00:27 2011 (r228470) +++ head/sys/dev/cm/smc90cx6.c Tue Dec 13 14:06:01 2011 (r228471) @@ -596,7 +596,7 @@ cleanup: } } -__inline static void +static inline void cm_tint_locked(sc, isr) struct cm_softc *sc; int isr; Modified: head/sys/dev/de/if_de.c ============================================================================== --- head/sys/dev/de/if_de.c Tue Dec 13 14:00:27 2011 (r228470) +++ head/sys/dev/de/if_de.c Tue Dec 13 14:06:01 2011 (r228471) @@ -1567,7 +1567,7 @@ tulip_null_media_poll(tulip_softc_t * co #endif } -__inline static void +static inline void tulip_21140_mediainit(tulip_softc_t * const sc, tulip_media_info_t * const mip, tulip_media_t const media, unsigned gpdata, unsigned cmdmode) { Modified: head/sys/dev/fdc/fdc.c ============================================================================== --- head/sys/dev/fdc/fdc.c Tue Dec 13 14:00:27 2011 (r228470) +++ head/sys/dev/fdc/fdc.c Tue Dec 13 14:06:01 2011 (r228471) @@ -314,14 +314,14 @@ fdsettype(struct fd_data *fd, struct fd_ /* * Bus space handling (access to low-level IO). */ -__inline static void +static inline void fdregwr(struct fdc_data *fdc, int reg, uint8_t v) { bus_space_write_1(fdc->iot, fdc->ioh[reg], fdc->ioff[reg], v); } -__inline static uint8_t +static inline uint8_t fdregrd(struct fdc_data *fdc, int reg) { Modified: head/sys/dev/pccard/pccardvar.h ============================================================================== --- head/sys/dev/pccard/pccardvar.h Tue Dec 13 14:00:27 2011 (r228470) +++ head/sys/dev/pccard/pccardvar.h Tue Dec 13 14:06:01 2011 (r228471) @@ -106,7 +106,7 @@ typedef int (*pccard_product_match_fn) ( * make this inline so that we don't have to worry about dangling references * to it in the modules or the code. */ -static __inline const struct pccard_product * +static inline const struct pccard_product * pccard_product_lookup(device_t dev, const struct pccard_product *tab, size_t ent_size, pccard_product_match_fn matchfn) { @@ -150,31 +150,31 @@ pccard_product_lookup(device_t dev, cons /* Convenience functions */ -static __inline int +static inline int pccard_cis_scan(device_t dev, pccard_scan_t fct, void *arg) { return (CARD_CIS_SCAN(device_get_parent(dev), dev, fct, arg)); } -static __inline int +static inline int pccard_attr_read_1(device_t dev, uint32_t offset, uint8_t *val) { return (CARD_ATTR_READ(device_get_parent(dev), dev, offset, val)); } -static __inline int +static inline int pccard_attr_write_1(device_t dev, uint32_t offset, uint8_t val) { return (CARD_ATTR_WRITE(device_get_parent(dev), dev, offset, val)); } -static __inline int +static inline int pccard_ccr_read_1(device_t dev, uint32_t offset, uint8_t *val) { return (CARD_CCR_READ(device_get_parent(dev), dev, offset, val)); } -static __inline int +static inline int pccard_ccr_write_1(device_t dev, uint32_t offset, uint8_t val) { return (CARD_CCR_WRITE(device_get_parent(dev), dev, offset, val)); @@ -199,7 +199,7 @@ enum { }; #define PCCARD_ACCESSOR(A, B, T) \ -__inline static int \ +static inline int \ pccard_get_ ## A(device_t dev, T *t) \ { \ return BUS_READ_IVAR(device_get_parent(dev), dev, \ Modified: head/sys/dev/spibus/spibusvar.h ============================================================================== --- head/sys/dev/spibus/spibusvar.h Tue Dec 13 14:00:27 2011 (r228470) +++ head/sys/dev/spibus/spibusvar.h Tue Dec 13 14:06:01 2011 (r228471) @@ -18,7 +18,7 @@ enum { }; #define SPIBUS_ACCESSOR(A, B, T) \ -__inline static int \ +static inline int \ spibus_get_ ## A(device_t dev, T *t) \ { \ return BUS_READ_IVAR(device_get_parent(dev), dev, \ Modified: head/sys/dev/xen/netback/netback.c ============================================================================== --- head/sys/dev/xen/netback/netback.c Tue Dec 13 14:00:27 2011 (r228470) +++ head/sys/dev/xen/netback/netback.c Tue Dec 13 14:06:01 2011 (r228471) @@ -530,7 +530,7 @@ make_tx_response(netif_t *netif, #endif } -inline static void +static inline void net_tx_action_dealloc(void) { gnttab_unmap_grant_ref_t *gop; Modified: head/sys/pc98/cbus/scterm-sck.c ============================================================================== --- head/sys/pc98/cbus/scterm-sck.c Tue Dec 13 14:00:27 2011 (r228470) +++ head/sys/pc98/cbus/scterm-sck.c Tue Dec 13 14:06:01 2011 (r228471) @@ -133,7 +133,7 @@ static void scterm_scan_esc(scr_stat *s static int mask2attr(term_stat *tcp); #ifdef KANJI -__inline static u_char +static inline u_char iskanji1(u_char mode, u_char c) { if (c > 0x80) { @@ -186,7 +186,7 @@ iskanji1(u_char mode, u_char c) return KTYPE_ASCII; } -__inline static u_char +static inline u_char iskanji2(u_char mode, u_char c) { switch (mode) { Modified: head/sys/pc98/cbus/scvtb.c ============================================================================== --- head/sys/pc98/cbus/scvtb.c Tue Dec 13 14:00:27 2011 (r228470) +++ head/sys/pc98/cbus/scvtb.c Tue Dec 13 14:06:01 2011 (r228471) @@ -174,7 +174,7 @@ sc_vtb_geta(sc_vtb_t *vtb, int at) return (*(u_int16_t *)(p + attr_offset(vtb)) & 0xff00); } -__inline static void +static inline void vtb_putc(sc_vtb_t *vtb, vm_offset_t p, int c, int a) { if (vtb->vtb_type == VTB_FRAMEBUFFER) { From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 14:36:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F5EF106568F; Tue, 13 Dec 2011 14:36:05 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E6E28FC23; Tue, 13 Dec 2011 14:36:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDEa4k2054791; Tue, 13 Dec 2011 14:36:04 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDEa4mH054789; Tue, 13 Dec 2011 14:36:04 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112131436.pBDEa4mH054789@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 13 Dec 2011 14:36:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228472 - head/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 14:36:05 -0000 Author: glebius Date: Tue Dec 13 14:36:04 2011 New Revision: 228472 URL: http://svn.freebsd.org/changeset/base/228472 Log: Add compatibility support for specifing IPv4 aliases in rc.conf without the "inet" keyword. Obtained from: hrs Modified: head/etc/network.subr Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Tue Dec 13 14:06:01 2011 (r228471) +++ head/etc/network.subr Tue Dec 13 14:36:04 2011 (r228472) @@ -716,9 +716,16 @@ ifalias_ipv4_up() inet\ *) ifconfig $1 ${ifconfig_args} alias && _ret=0 ;; + inet6\ *) + ;; "") break ;; + *) + warn "\$ifconfig_$1_alias${alias} needs " \ + "\"inet\" keyword for an IPv4 address." + ifconfig $1 ${ifconfig_args} alias && _ret=0 + ;; esac alias=$((${alias} + 1)) done From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 14:45:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4D391065676; Tue, 13 Dec 2011 14:45:43 +0000 (UTC) (envelope-from stefan@fafoe.narf.at) Received: from fep19.mx.upcmail.net (fep19.mx.upcmail.net [62.179.121.39]) by mx1.freebsd.org (Postfix) with ESMTP id B30068FC08; Tue, 13 Dec 2011 14:45:42 +0000 (UTC) Received: from edge03.upcmail.net ([192.168.13.238]) by viefep19-int.chello.at (InterMail vM.8.01.05.04 201-2260-151-105-20111014) with ESMTP id <20111213144541.PUSJ9634.viefep19-int.chello.at@edge03.upcmail.net>; Tue, 13 Dec 2011 15:45:41 +0100 Received: from mole.fafoe.narf.at ([213.47.85.26]) by edge03.upcmail.net with edge id 8elg1i0230a5KZh03elghi; Tue, 13 Dec 2011 15:45:41 +0100 X-SourceIP: 213.47.85.26 Received: by mole.fafoe.narf.at (Postfix, from userid 1001) id BEE516D432; Tue, 13 Dec 2011 15:45:40 +0100 (CET) Date: Tue, 13 Dec 2011 15:45:40 +0100 From: Stefan Farfeleder To: Ed Schouten Message-ID: <20111213144539.GB1587@mole.fafoe.narf.at> References: <201112131406.pBDE61bc053693@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112131406.pBDE61bc053693@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228471 - in head/sys: boot/arm/at91/libat91 dev/cm dev/de dev/fdc dev/pccard dev/spibus dev/xen/netback pc98/cbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 14:45:43 -0000 On Tue, Dec 13, 2011 at 02:06:01PM +0000, Ed Schouten wrote: > Author: ed > Date: Tue Dec 13 14:06:01 2011 > New Revision: 228471 > URL: http://svn.freebsd.org/changeset/base/228471 > > Log: > Replace `inline static' by `static inline'. > > If I interpret the C standard correctly, the storage specifier should be > placed before the inline keyword. While at it, replace __inline by > inline in the files affected. No, declaration-specifier is defined recursively - any order is allowed. Still I think having a consistent order is a good idea. Stefan From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 14:53:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6E08106564A; Tue, 13 Dec 2011 14:53:26 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95DF28FC08; Tue, 13 Dec 2011 14:53:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDErQVa055345; Tue, 13 Dec 2011 14:53:26 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDErQjx055343; Tue, 13 Dec 2011 14:53:26 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112131453.pBDErQjx055343@svn.freebsd.org> From: Ed Schouten Date: Tue, 13 Dec 2011 14:53:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228473 - head/lib/libedit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 14:53:26 -0000 Author: ed Date: Tue Dec 13 14:53:26 2011 New Revision: 228473 URL: http://svn.freebsd.org/changeset/base/228473 Log: Don't use __P(). The rest of the file doesn't use it either and according to style(9), it should not be used. Modified: head/lib/libedit/histedit.h Modified: head/lib/libedit/histedit.h ============================================================================== --- head/lib/libedit/histedit.h Tue Dec 13 14:36:04 2011 (r228472) +++ head/lib/libedit/histedit.h Tue Dec 13 14:53:26 2011 (r228473) @@ -158,8 +158,8 @@ void el_resize(EditLine *); /* * Set user private data. */ -void el_data_set __P((EditLine *, void *)); -void * el_data_get __P((EditLine *)); +void el_data_set(EditLine *, void *); +void * el_data_get(EditLine *); /* * User-defined function interface. From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 15:36:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37D84106564A; Tue, 13 Dec 2011 15:36:09 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id A20768FC0C; Tue, 13 Dec 2011 15:36:08 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 5C2BEAE6; Tue, 13 Dec 2011 16:36:07 +0100 (CET) Date: Tue, 13 Dec 2011 16:35:06 +0100 From: Pawel Jakub Dawidek To: Eitan Adler Message-ID: <20111213153506.GC1659@garage.freebsd.pl> References: <201112131400.pBDE0S6M053401@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mvpLiMfbWzRoNl4x" Content-Disposition: inline In-Reply-To: <201112131400.pBDE0S6M053401@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228470 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 15:36:09 -0000 --mvpLiMfbWzRoNl4x Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 13, 2011 at 02:00:28PM +0000, Eitan Adler wrote: > Author: eadler (ports committer) > Date: Tue Dec 13 14:00:27 2011 > New Revision: 228470 > URL: http://svn.freebsd.org/changeset/base/228470 >=20 > Log: > - Add a sysctl to allow non-root users the ability to set idle > priorities. [...] I'd suggest using consistent style with those two: [...] > + unprivileged_idprio =3D=3D 0)) { [...] > + !unprivileged_idprio)) { [...] Because it should be either 0 or 1, the latter is better. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --mvpLiMfbWzRoNl4x Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk7ncKoACgkQForvXbEpPzTNYgCgl4/ZJrmmjPmntJy4+hf5v7Oz /B0An2U19PGf6a33HWq2j30qc+9XNUWF =ymwP -----END PGP SIGNATURE----- --mvpLiMfbWzRoNl4x-- From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 17:34:48 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70EAF1065673; Tue, 13 Dec 2011 17:34:48 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 564AC8FC12; Tue, 13 Dec 2011 17:34:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDHYmWS060404; Tue, 13 Dec 2011 17:34:48 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDHYmf1060399; Tue, 13 Dec 2011 17:34:48 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112131734.pBDHYmf1060399@svn.freebsd.org> From: Ed Schouten Date: Tue, 13 Dec 2011 17:34:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228474 - in head/contrib/gcclibs/libcpp: . include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 17:34:48 -0000 Author: ed Date: Tue Dec 13 17:34:47 2011 New Revision: 228474 URL: http://svn.freebsd.org/changeset/base/228474 Log: Add support for __COUNTER__. __COUNTER__ allows one to obtain incrementing (read: unique) numbers from the C preprocesor. This is useful when implementing things like a robust implementation of CTASSERT(), which currently fails when using it more than once on a single line of code. Probably not likely to cause any breakage, but still. __COUNTER__ was also added to GCC 4.3, but since that implementation is GPLv3 licensed, I took the liberty of implementing it without looking at any upstream sources. Therefore, this version is licensed under the same license as the rest of the code; GPLv2. Modified: head/contrib/gcclibs/libcpp/include/cpplib.h head/contrib/gcclibs/libcpp/init.c head/contrib/gcclibs/libcpp/internal.h head/contrib/gcclibs/libcpp/macro.c Modified: head/contrib/gcclibs/libcpp/include/cpplib.h ============================================================================== --- head/contrib/gcclibs/libcpp/include/cpplib.h Tue Dec 13 14:53:26 2011 (r228473) +++ head/contrib/gcclibs/libcpp/include/cpplib.h Tue Dec 13 17:34:47 2011 (r228474) @@ -555,7 +555,8 @@ enum builtin_type BT_TIME, /* `__TIME__' */ BT_STDC, /* `__STDC__' */ BT_PRAGMA, /* `_Pragma' operator */ - BT_TIMESTAMP /* `__TIMESTAMP__' */ + BT_TIMESTAMP, /* `__TIMESTAMP__' */ + BT_COUNTER /* `__COUNTER__' */ }; #define CPP_HASHNODE(HNODE) ((cpp_hashnode *) (HNODE)) Modified: head/contrib/gcclibs/libcpp/init.c ============================================================================== --- head/contrib/gcclibs/libcpp/init.c Tue Dec 13 14:53:26 2011 (r228473) +++ head/contrib/gcclibs/libcpp/init.c Tue Dec 13 17:34:47 2011 (r228474) @@ -308,6 +308,7 @@ static const struct builtin builtin_arra B("__BASE_FILE__", BT_BASE_FILE), B("__LINE__", BT_SPECLINE), B("__INCLUDE_LEVEL__", BT_INCLUDE_LEVEL), + B("__COUNTER__", BT_COUNTER), /* Keep builtins not used for -traditional-cpp at the end, and update init_builtins() if any more are added. */ B("_Pragma", BT_PRAGMA), Modified: head/contrib/gcclibs/libcpp/internal.h ============================================================================== --- head/contrib/gcclibs/libcpp/internal.h Tue Dec 13 14:53:26 2011 (r228473) +++ head/contrib/gcclibs/libcpp/internal.h Tue Dec 13 17:34:47 2011 (r228474) @@ -448,6 +448,8 @@ struct cpp_reader /* A saved list of the defined macros, for dependency checking of precompiled headers. */ struct cpp_savedstate *savedstate; + + unsigned int nextcounter; }; /* Character classes. Based on the more primitive macros in safe-ctype.h. Modified: head/contrib/gcclibs/libcpp/macro.c ============================================================================== --- head/contrib/gcclibs/libcpp/macro.c Tue Dec 13 14:53:26 2011 (r228473) +++ head/contrib/gcclibs/libcpp/macro.c Tue Dec 13 17:34:47 2011 (r228474) @@ -262,6 +262,10 @@ _cpp_builtin_macro_text (cpp_reader *pfi else result = pfile->time; break; + + case BT_COUNTER: + number = pfile->nextcounter++; + break; } if (result == NULL) From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 17:59:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18C701065670; Tue, 13 Dec 2011 17:59:17 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 080428FC13; Tue, 13 Dec 2011 17:59:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDHxGnA061183; Tue, 13 Dec 2011 17:59:16 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDHxG3K061181; Tue, 13 Dec 2011 17:59:16 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201112131759.pBDHxG3K061181@svn.freebsd.org> From: "David E. O'Brien" Date: Tue, 13 Dec 2011 17:59:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228475 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 17:59:17 -0000 Author: obrien Date: Tue Dec 13 17:59:16 2011 New Revision: 228475 URL: http://svn.freebsd.org/changeset/base/228475 Log: Disallow various debug.kdb sysctl's when securelevel is raised. PR: 161350 Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Tue Dec 13 17:34:47 2011 (r228474) +++ head/sys/kern/kern_shutdown.c Tue Dec 13 17:59:16 2011 (r228475) @@ -102,8 +102,9 @@ int debugger_on_panic = 0; #else int debugger_on_panic = 1; #endif -SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW | CTLFLAG_TUN, - &debugger_on_panic, 0, "Run debugger on kernel panic"); +SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, + CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_TUN, &debugger_on_panic, 0, + "Run debugger on kernel panic"); TUNABLE_INT("debug.debugger_on_panic", &debugger_on_panic); #ifdef KDB_TRACE @@ -111,8 +112,9 @@ static int trace_on_panic = 1; #else static int trace_on_panic = 0; #endif -SYSCTL_INT(_debug, OID_AUTO, trace_on_panic, CTLFLAG_RW | CTLFLAG_TUN, - &trace_on_panic, 0, "Print stack trace on kernel panic"); +SYSCTL_INT(_debug, OID_AUTO, trace_on_panic, + CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_TUN, &trace_on_panic, 0, + "Print stack trace on kernel panic"); TUNABLE_INT("debug.trace_on_panic", &trace_on_panic); #endif /* KDB */ From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 18:11:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C7CF1065687; Tue, 13 Dec 2011 18:11:26 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5E658FC0C; Tue, 13 Dec 2011 18:11:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDIBP2R061608; Tue, 13 Dec 2011 18:11:25 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDIBP7q061605; Tue, 13 Dec 2011 18:11:25 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112131811.pBDIBP7q061605@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 13 Dec 2011 18:11:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228476 - head/sys/dev/bce X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 18:11:26 -0000 Author: yongari Date: Tue Dec 13 18:11:25 2011 New Revision: 228476 URL: http://svn.freebsd.org/changeset/base/228476 Log: Rework link state tracking and remove superfluous link UP/DOWN messages. o Add check for actually resolved speed in miibus_statchg callback instead of blindly reprogramming BCE_EMAC_MODE register. The callback may be called multiple times(e.g. link UP, link transition, auto-negotiate complete etc) while auto-negotiation is in progress. All unresolved link state changes are ignored now and setting BCE_EMAC_MODE after link establishment is done once. o bce(4) is careful enough not to drive MII_TICK if driver got a valid link. To detect lost link, bce(4) relied on link state change interrupt and if driver see the interrupt, it forced to drive MII_TICK by calling bce_tick() in interrupt handler. Because bce(4) generates multiple link state change interrupts while auto-negotiation is in progress, bce_tick() would be called multiple times and this resulted in generating multiple link UP/DOWN messages. With this change, bce_tick() is not called in interrupt handler anymore such that miibus_statchg callback handles link state changes with consistent manner. Reviewed by: davidch Modified: head/sys/dev/bce/if_bce.c head/sys/dev/bce/if_bcereg.h Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Tue Dec 13 17:59:16 2011 (r228475) +++ head/sys/dev/bce/if_bce.c Tue Dec 13 18:11:25 2011 (r228476) @@ -1982,6 +1982,7 @@ static void bce_miibus_statchg(device_t dev) { struct bce_softc *sc; + struct ifnet *ifp; struct mii_data *mii; int val; @@ -1989,42 +1990,57 @@ bce_miibus_statchg(device_t dev) DBENTER(BCE_VERBOSE_PHY); + ifp = sc->bce_ifp; mii = device_get_softc(sc->bce_miibus); + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + sc->bce_link_up = FALSE; val = REG_RD(sc, BCE_EMAC_MODE); val &= ~(BCE_EMAC_MODE_PORT | BCE_EMAC_MODE_HALF_DUPLEX | BCE_EMAC_MODE_MAC_LOOP | BCE_EMAC_MODE_FORCE_LINK | BCE_EMAC_MODE_25G); /* Set MII or GMII interface based on the PHY speed. */ - switch (IFM_SUBTYPE(mii->mii_media_active)) { - case IFM_10_T: - if (BCE_CHIP_NUM(sc) != BCE_CHIP_NUM_5706) { - DBPRINT(sc, BCE_INFO_PHY, - "Enabling 10Mb interface.\n"); - val |= BCE_EMAC_MODE_PORT_MII_10; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + if (BCE_CHIP_NUM(sc) != BCE_CHIP_NUM_5706) { + DBPRINT(sc, BCE_INFO_PHY, + "Enabling 10Mb interface.\n"); + val |= BCE_EMAC_MODE_PORT_MII_10; + sc->bce_link_up = TRUE; + break; + } + /* FALLTHROUGH */ + case IFM_100_TX: + DBPRINT(sc, BCE_INFO_PHY, "Enabling MII interface.\n"); + val |= BCE_EMAC_MODE_PORT_MII; + sc->bce_link_up = TRUE; + break; + case IFM_2500_SX: + DBPRINT(sc, BCE_INFO_PHY, "Enabling 2.5G MAC mode.\n"); + val |= BCE_EMAC_MODE_25G; + /* FALLTHROUGH */ + case IFM_1000_T: + case IFM_1000_SX: + DBPRINT(sc, BCE_INFO_PHY, "Enabling GMII interface.\n"); + val |= BCE_EMAC_MODE_PORT_GMII; + sc->bce_link_up = TRUE; + if (bce_verbose || bootverbose) + BCE_PRINTF("Gigabit link up!\n"); + break; + default: + DBPRINT(sc, BCE_INFO_PHY, "Unknown link speed.\n"); break; } - /* fall-through */ - case IFM_100_TX: - DBPRINT(sc, BCE_INFO_PHY, "Enabling MII interface.\n"); - val |= BCE_EMAC_MODE_PORT_MII; - break; - case IFM_2500_SX: - DBPRINT(sc, BCE_INFO_PHY, "Enabling 2.5G MAC mode.\n"); - val |= BCE_EMAC_MODE_25G; - /* fall-through */ - case IFM_1000_T: - case IFM_1000_SX: - DBPRINT(sc, BCE_INFO_PHY, "Enabling GMII interface.\n"); - val |= BCE_EMAC_MODE_PORT_GMII; - break; - default: - DBPRINT(sc, BCE_INFO_PHY, "Unknown link speed, enabling " - "default GMII interface.\n"); - val |= BCE_EMAC_MODE_PORT_GMII; } + if (sc->bce_link_up == FALSE) + return; + /* Set half or full duplex based on PHY settings. */ if ((mii->mii_media_active & IFM_GMASK) == IFM_HDX) { DBPRINT(sc, BCE_INFO_PHY, @@ -2036,7 +2052,7 @@ bce_miibus_statchg(device_t dev) REG_WR(sc, BCE_EMAC_MODE, val); - if ((mii->mii_media_active & IFM_ETH_RXPAUSE) != 0) { + if ((mii->mii_media_active & IFM_ETH_RXPAUSE) != 0) { DBPRINT(sc, BCE_INFO_PHY, "%s(): Enabling RX flow control.\n", __FUNCTION__); BCE_SETBIT(sc, BCE_EMAC_RX_MODE, BCE_EMAC_RX_MODE_FLOW_EN); @@ -2046,7 +2062,7 @@ bce_miibus_statchg(device_t dev) BCE_CLRBIT(sc, BCE_EMAC_RX_MODE, BCE_EMAC_RX_MODE_FLOW_EN); } - if ((mii->mii_media_active & IFM_ETH_TXPAUSE) != 0) { + if ((mii->mii_media_active & IFM_ETH_TXPAUSE) != 0) { DBPRINT(sc, BCE_INFO_PHY, "%s(): Enabling TX flow control.\n", __FUNCTION__); BCE_SETBIT(sc, BCE_EMAC_TX_MODE, BCE_EMAC_TX_MODE_FLOW_EN); @@ -6206,15 +6222,11 @@ bce_phy_intr(struct bce_softc *sc) DBPRINT(sc, BCE_INFO_PHY, "%s(): Link is now DOWN.\n", __FUNCTION__); } - /* - * Assume link is down and allow - * tick routine to update the state - * based on the actual media state. + * Link state changed, allow tick routine to update + * the state baased on actual media state. */ - sc->bce_link_up = FALSE; - callout_stop(&sc->bce_tick_callout); - bce_tick(sc); + sc->bce_link_tick = TRUE; } /* Acknowledge the link change interrupt. */ @@ -6898,12 +6910,13 @@ bce_init_locked(struct bce_softc *sc) /* Enable host interrupts. */ bce_enable_intr(sc, 1); - bce_ifmedia_upd_locked(ifp); - /* Let the OS know the driver is up and running. */ ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + sc->bce_link_tick = TRUE; + bce_ifmedia_upd_locked(ifp); + callout_reset(&sc->bce_tick_callout, hz, bce_tick, sc); bce_init_locked_exit: @@ -8199,31 +8212,19 @@ bce_tick(void *xsc) bce_watchdog(sc); /* If link is up already up then we're done. */ - if (sc->bce_link_up == TRUE) + if (sc->bce_link_tick == FALSE && sc->bce_link_up == TRUE) goto bce_tick_exit; /* Link is down. Check what the PHY's doing. */ mii = device_get_softc(sc->bce_miibus); mii_tick(mii); - /* Check if the link has come up. */ - if ((mii->mii_media_status & IFM_ACTIVE) && - (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)) { + sc->bce_link_tick = FALSE; + /* Now that link is up, handle any outstanding TX traffic. */ + if (sc->bce_link_up == TRUE && !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { DBPRINT(sc, BCE_VERBOSE_MISC, - "%s(): Link up!\n", __FUNCTION__); - sc->bce_link_up = TRUE; - if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T || - IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX || - IFM_SUBTYPE(mii->mii_media_active) == IFM_2500_SX) && - (bce_verbose || bootverbose)) - BCE_PRINTF("Gigabit link up!\n"); - - /* Now that link is up, handle any outstanding TX traffic. */ - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { - DBPRINT(sc, BCE_VERBOSE_MISC, "%s(): Found " - "pending TX traffic.\n", __FUNCTION__); - bce_start_locked(ifp); - } + "%s(): Found pending TX traffic.\n", __FUNCTION__); + bce_start_locked(ifp); } bce_tick_exit: Modified: head/sys/dev/bce/if_bcereg.h ============================================================================== --- head/sys/dev/bce/if_bcereg.h Tue Dec 13 17:59:16 2011 (r228475) +++ head/sys/dev/bce/if_bcereg.h Tue Dec 13 18:11:25 2011 (r228476) @@ -6560,6 +6560,7 @@ struct bce_softc u16 pg_prod; u16 pg_cons; + int bce_link_tick; int bce_link_up; struct callout bce_tick_callout; struct callout bce_pulse_callout; From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 19:34:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5EC9106564A; Tue, 13 Dec 2011 19:34:14 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from fsm1.ukr.net (fsm1.ukr.net [195.214.192.120]) by mx1.freebsd.org (Postfix) with ESMTP id 9B50C8FC12; Tue, 13 Dec 2011 19:34:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:Mime-Version:Message-ID:Subject:To:From:Date; bh=CplUBQ9ae+J12Hnl2XqeXn/EYGFWDJHfBWuAUEtpeN0=; b=S4GGhEXzsdcFfmOzeX6NCAne/8NLsZmQdXQgPwmwc6ZZu9uopXB6laMyx6JPSDhfzApB3TUnzdYQyT+votwS2dkyolgz1/2pF+n6GgCkIdHMTbOsnqx3Kx3ogepmTmOrS+oSpckeezRV4cAhDv9ILeYOkON1EwQSb6dQ+q0lGvc=; Received: from [178.137.138.140] (helo=nonamehost.) by fsm1.ukr.net with esmtpsa ID 1RaY7A-00014C-M6 ; Tue, 13 Dec 2011 21:34:12 +0200 Date: Tue, 13 Dec 2011 21:34:11 +0200 From: Ivan Klymenko To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20111213213411.2441d043@nonamehost.> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Subject: r228377 to r228473 top not working X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 19:34:15 -0000 Hi all! I have uname -a FreeBSD nonamehost 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r228473M: Tue Dec 13 20:09:45 EET 2011 ivan@nonamehost:/usr/obj/usr/src/sys/mk9 amd64 After update source code from r228377 to r228473 "top" stopped working # top top: sysctl(vm.stats.vm.v_active_count...) failed: No such file or directory # There are some ideas? Thanks! From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 19:37:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97B041065673; Tue, 13 Dec 2011 19:37:27 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 875E58FC13; Tue, 13 Dec 2011 19:37:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDJbRDB064235; Tue, 13 Dec 2011 19:37:27 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDJbRLn064233; Tue, 13 Dec 2011 19:37:27 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112131937.pBDJbRLn064233@svn.freebsd.org> From: Ed Schouten Date: Tue, 13 Dec 2011 19:37:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228477 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 19:37:27 -0000 Author: ed Date: Tue Dec 13 19:37:27 2011 New Revision: 228477 URL: http://svn.freebsd.org/changeset/base/228477 Log: Make support for C1X keywords more complete. - _Alignof(), which returns the aligment of a certain type. - _Static_assert(), which can be used to check compile-time assertions. - _Thread_local, which uses TLS on a variable. MFC after: 3 months Reviewed by: mdf Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Tue Dec 13 18:11:25 2011 (r228476) +++ head/sys/sys/cdefs.h Tue Dec 13 19:37:27 2011 (r228477) @@ -218,15 +218,34 @@ #endif #endif - +/* + * Keywords added in C1X. + */ #if defined(__cplusplus) && __cplusplus >= 201103L +#define _Alignof(e) alignof(e) #define _Noreturn [[noreturn]] +#define _Static_assert(e, s) static_assert(e, s) +#define _Thread_local thread_local #elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L -/* Do nothing - _Noreturn is a keyword */ -#elif defined(__GNUC__) +/* Do nothing. They are language keywords. */ +#else +/* Not supported. Implement them manually. */ +#ifdef __GNUC__ +#define _Alignof(e) __alignof__(e) #define _Noreturn __attribute__((__noreturn__)) +#define _Thread_local __thread #else +#define _Alignof(e) __offsetof(struct { char __a; e __b; }, __b) #define _Noreturn +#define _Thread_local +#endif +#ifdef __COUNTER__ +#define _Static_assert(e, s) __Static_assert(e, __COUNTER__) +#else +#define _Static_assert(e, s) __Static_assert(e, __LINE__) +#endif +#define __Static_assert(e, c) ___Static_assert(e, c) +#define ___Static_assert(e, c) typedef char __assert ## c[(e) ? 1 : -1] #endif #if __GNUC_PREREQ__(2, 96) From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 19:39:25 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11206106566B; Tue, 13 Dec 2011 19:39:25 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00B0B8FC14; Tue, 13 Dec 2011 19:39:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDJdOBt064327; Tue, 13 Dec 2011 19:39:24 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDJdOm4064325; Tue, 13 Dec 2011 19:39:24 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112131939.pBDJdOm4064325@svn.freebsd.org> From: Ed Schouten Date: Tue, 13 Dec 2011 19:39:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228478 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 19:39:25 -0000 Author: ed Date: Tue Dec 13 19:39:24 2011 New Revision: 228478 URL: http://svn.freebsd.org/changeset/base/228478 Log: Reimplement CTASSERT() using _Static_assert(). Modified: head/sys/sys/systm.h Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Tue Dec 13 19:37:27 2011 (r228477) +++ head/sys/sys/systm.h Tue Dec 13 19:39:24 2011 (r228478) @@ -92,10 +92,8 @@ enum VM_GUEST { VM_GUEST_NO = 0, VM_GUES } while (0) #endif -#ifndef CTASSERT /* Allow lint to override */ -#define CTASSERT(x) _CTASSERT(x, __LINE__) -#define _CTASSERT(x, y) __CTASSERT(x, y) -#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] +#ifndef CTASSERT /* Allow lint to override */ +#define CTASSERT(x) _Static_assert(x, "compile-time assertion failed") #endif /* From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 19:43:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 805BE1065675; Tue, 13 Dec 2011 19:43:50 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9D2C18FC08; Tue, 13 Dec 2011 19:43:49 +0000 (UTC) Received: by lahl5 with SMTP id l5so21347lah.13 for ; Tue, 13 Dec 2011 11:43:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=Zvg/0xhPCzIGioD0kfGqmAlzSZnAm/WGPjlgQ2R7SFs=; b=s2Nk93sP3A2ZlNJ8jt4R+QVhz1EtTmsveNyUZNGoQbT3RKC8S1N1Xd9eyzaL2Gj4YZ uD4JAUrGLufBiS9ul+4AZzUzTVDTiwR0FgBVKHwbTJL65ce5v9MWsZorPFWCVP/etiW0 w5wNlA3lveYTBEe/fgYmdVeAKB52YXP9Fg8Us= Received: by 10.152.109.105 with SMTP id hr9mr13161516lab.24.1323805428308; Tue, 13 Dec 2011 11:43:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.23.68 with HTTP; Tue, 13 Dec 2011 11:43:17 -0800 (PST) In-Reply-To: <4ee7a8c6.8e72e50a.3ab3.028bSMTPIN_ADDED@mx.google.com> References: <4ee7a8c6.8e72e50a.3ab3.028bSMTPIN_ADDED@mx.google.com> From: Eitan Adler Date: Tue, 13 Dec 2011 14:43:17 -0500 Message-ID: To: Ivan Klymenko Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: r228377 to r228473 top not working X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 19:43:50 -0000 On Tue, Dec 13, 2011 at 2:34 PM, Ivan Klymenko wrote: > Hi all! > I have uname -a > FreeBSD nonamehost 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r228473M: Tue Dec= 13 20:09:45 EET 2011 =C2=A0 =C2=A0 ivan@nonamehost:/usr/obj/usr/src/sys/mk= 9 =C2=A0amd64 > After update source code from r228377 to r228473 "top" stopped working > > # top > top: sysctl(vm.stats.vm.v_active_count...) failed: No such file or direct= ory > # > > There are some ideas? Mea Culpa. I am currently testing a patch to fix this. > > Thanks! > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" --=20 Eitan Adler From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 20:06:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56DFD106566B; Tue, 13 Dec 2011 20:06:44 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id DD4048FC17; Tue, 13 Dec 2011 20:06:43 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id E05D125D3810; Tue, 13 Dec 2011 20:06:42 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 199A9BD6EE9; Tue, 13 Dec 2011 20:06:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id irFkgl096L+o; Tue, 13 Dec 2011 20:06:41 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id D2FF6BD6EE8; Tue, 13 Dec 2011 20:06:40 +0000 (UTC) Date: Tue, 13 Dec 2011 20:06:40 +0000 (UTC) From: "Bjoern A. Zeeb" To: Ed Schouten In-Reply-To: <201112131939.pBDJdOm4064325@svn.freebsd.org> Message-ID: References: <201112131939.pBDJdOm4064325@svn.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228478 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 20:06:44 -0000 On Tue, 13 Dec 2011, Ed Schouten wrote: > Author: ed > Date: Tue Dec 13 19:39:24 2011 > New Revision: 228478 > URL: http://svn.freebsd.org/changeset/base/228478 > > Log: > Reimplement CTASSERT() using _Static_assert(). Cool, can we have a second variant with a custom error message? Not having file:line and more information is freakingly unhelpful often when compiling with -j and our current default compiler. > Modified: > head/sys/sys/systm.h > > Modified: head/sys/sys/systm.h > ============================================================================== > --- head/sys/sys/systm.h Tue Dec 13 19:37:27 2011 (r228477) > +++ head/sys/sys/systm.h Tue Dec 13 19:39:24 2011 (r228478) > @@ -92,10 +92,8 @@ enum VM_GUEST { VM_GUEST_NO = 0, VM_GUES > } while (0) > #endif > > -#ifndef CTASSERT /* Allow lint to override */ > -#define CTASSERT(x) _CTASSERT(x, __LINE__) > -#define _CTASSERT(x, y) __CTASSERT(x, y) > -#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1] > +#ifndef CTASSERT /* Allow lint to override */ > +#define CTASSERT(x) _Static_assert(x, "compile-time assertion failed") > #endif > > /* > -- Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 20:11:13 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AB60106566B; Tue, 13 Dec 2011 20:11:13 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id E4AE28FC18; Tue, 13 Dec 2011 20:11:12 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id 5BD382A28CD6; Tue, 13 Dec 2011 21:11:12 +0100 (CET) Date: Tue, 13 Dec 2011 21:11:12 +0100 From: Ed Schouten To: "Bjoern A. Zeeb" Message-ID: <20111213201112.GG1771@hoeg.nl> References: <201112131939.pBDJdOm4064325@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HB4mHL4PVvkpZAgW" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228478 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 20:11:13 -0000 --HB4mHL4PVvkpZAgW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Bjoern A. Zeeb , 20111213 21:06: > Cool, can we have a second variant with a custom error message? Yes; just use _Static_assert for that! It won't print the custom error message right now, but as soon as compilers implement C1X, it will work for you. --=20 Ed Schouten WWW: http://80386.nl/ --HB4mHL4PVvkpZAgW Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iQIcBAEBAgAGBQJO57FgAAoJEG5e2P40kaK7iZIQAKI+u2Gveqh2cIpCfupA1P8L 0n0gnzvGJGAUQac8qntjqcwMvSCzBbmA5dTJ5nCFlbE6hB3r6nrwmEaveE2yXpCU jSGVWLzQBWY8qihC5yALTtzP8RonFtfWPa5Dt1UIKqgHiQ21gKhxjt93Zg9d7/bN ey12mweNpyC4MiTPOB4EXrgUtqIcJ/aNSuHVWWUqFjgrtPTHbNzLxi54S0P5J/Tb PtkFn8NwRdfF72La0RtIlH6MYZq+2I9D56sIJTu0djGptccx15hs+rDi+CmLzX31 CIh1+911HsVhRTz5AWXY1ovSTpyX3+438ezvF8H1Ikmi3hPKshcbqbENsYKpKCo3 SWDsSfBuYIpjfRWZ22EBmTm7ppv/UayA8WZkOnpEVAmtdKMX/m0Fs41o+anNulY2 ycqiNcX6xkpLhoOnKxZMhbIpTeXbDArMPmSWYrfBy6pguP5nANIqnVfhBXeUdBBN mQIde2jAq26jO5Et/A56wU1bEkzx7leGcX4+/Jr5MclsDdrGBQtHckZL16tENr79 f7adEJaomJGt3kuswN5/Hz6PfaNFgXW5L3UcwnT4V5lclSeaY9KBBOEuVzZ7axwx uZ69dbXUV0WzZKz79gFaE+AL8eg89j77aq/+4uHsysOhXSAya4QdLw93qyYOsNEZ w/cKvdZj9Kr4SIxa2f6j =X4mw -----END PGP SIGNATURE----- --HB4mHL4PVvkpZAgW-- From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 20:26:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 462AB106568C; Tue, 13 Dec 2011 20:26:47 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B5A58FC12; Tue, 13 Dec 2011 20:26:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDKQlmS066040; Tue, 13 Dec 2011 20:26:47 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDKQkfi066037; Tue, 13 Dec 2011 20:26:46 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112132026.pBDKQkfi066037@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 13 Dec 2011 20:26:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228479 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 20:26:47 -0000 Author: yongari Date: Tue Dec 13 20:26:46 2011 New Revision: 228479 URL: http://svn.freebsd.org/changeset/base/228479 Log: BCM5720 performance tweak from Broadcom. o Allow multiple outstanding read requests from non-LSO read DMA engine. o Allow 4KB burst length reads for non-LSO frames. o Enable 512B burst length reads for buffer descriptors. Submitted by: Geans Pin < geanspin <> broadcom dot com > Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Tue Dec 13 19:39:24 2011 (r228478) +++ head/sys/dev/bge/if_bge.c Tue Dec 13 20:26:46 2011 (r228479) @@ -2080,9 +2080,15 @@ bge_blockinit(struct bge_softc *sc) val |= BGE_RDMAMODE_TSO6_ENABLE; } - if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) { val |= CSR_READ_4(sc, BGE_RDMA_MODE) & BGE_RDMAMODE_H2BNC_VLAN_DET; + /* + * Allow multiple outstanding read requests from + * non-LSO read DMA engine. + */ + val &= ~BGE_RDMAMODE_MULT_DMA_RD_DIS; + } if (sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5784 || @@ -2112,12 +2118,20 @@ bge_blockinit(struct bge_softc *sc) BGE_RDMA_RSRVCTRL_FIFO_OFLW_FIX); } - if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || - sc->bge_asicrev == BGE_ASICREV_BCM5720) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5719) { CSR_WRITE_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL, CSR_READ_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL) | BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_4K | BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_LSO_4K); + } else if (sc->bge_asicrev == BGE_ASICREV_BCM5720) { + /* + * Allow 4KB burst length reads for non-LSO frames. + * Enable 512B burst length reads for buffer descriptors. + */ + CSR_WRITE_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL, + CSR_READ_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL) | + BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_512 | + BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_LSO_4K); } CSR_WRITE_4(sc, BGE_RDMA_MODE, val); Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Tue Dec 13 19:39:24 2011 (r228478) +++ head/sys/dev/bge/if_bgereg.h Tue Dec 13 20:26:46 2011 (r228479) @@ -1573,6 +1573,7 @@ #define BGE_RDMA_RSRVCTRL_FIFO_HWM_MASK 0x000FF000 #define BGE_RDMA_RSRVCTRL_TXMRGN_MASK 0xFFE00000 +#define BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_512 0x00020000 #define BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_4K 0x00030000 #define BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_LSO_4K 0x000C0000 From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 20:31:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C43E41065673; Tue, 13 Dec 2011 20:31:57 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B35268FC08; Tue, 13 Dec 2011 20:31:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDKVvbi066233; Tue, 13 Dec 2011 20:31:57 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDKVvfU066231; Tue, 13 Dec 2011 20:31:57 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112132031.pBDKVvfU066231@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 13 Dec 2011 20:31:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228480 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 20:31:57 -0000 Author: yongari Date: Tue Dec 13 20:31:57 2011 New Revision: 228480 URL: http://svn.freebsd.org/changeset/base/228480 Log: Destroy DMA tag for jumbo RX buffer in device detach. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Tue Dec 13 20:26:46 2011 (r228479) +++ head/sys/dev/bge/if_bge.c Tue Dec 13 20:31:57 2011 (r228480) @@ -2358,6 +2358,8 @@ bge_dma_free(struct bge_softc *sc) if (sc->bge_cdata.bge_rx_mtag) bus_dma_tag_destroy(sc->bge_cdata.bge_rx_mtag); + if (sc->bge_cdata.bge_mtag_jumbo) + bus_dma_tag_destroy(sc->bge_cdata.bge_mtag_jumbo); if (sc->bge_cdata.bge_tx_mtag) bus_dma_tag_destroy(sc->bge_cdata.bge_tx_mtag); From owner-svn-src-all@FreeBSD.ORG Tue Dec 13 21:26:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EB1D1065672; Tue, 13 Dec 2011 21:26:33 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81FC08FC15; Tue, 13 Dec 2011 21:26:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBDLQXOG067889; Tue, 13 Dec 2011 21:26:33 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBDLQXTd067885; Tue, 13 Dec 2011 21:26:33 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112132126.pBDLQXTd067885@svn.freebsd.org> From: Ed Schouten Date: Tue, 13 Dec 2011 21:26:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228481 - in head: share/examples/scsi_target share/man/man4 sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 13 Dec 2011 21:26:33 -0000 Author: ed Date: Tue Dec 13 21:26:33 2011 New Revision: 228481 URL: http://svn.freebsd.org/changeset/base/228481 Log: Change targ(4) to use cdevpriv, instead of multiple character devices. Also update the manpage and the scsi_target example program accordingly. Discussed on: scsi@ Tested by: Chuck Tuffli Modified: head/share/examples/scsi_target/scsi_target.c head/share/man/man4/targ.4 head/sys/cam/scsi/scsi_target.c Modified: head/share/examples/scsi_target/scsi_target.c ============================================================================== --- head/share/examples/scsi_target/scsi_target.c Tue Dec 13 20:31:57 2011 (r228480) +++ head/share/examples/scsi_target/scsi_target.c Tue Dec 13 21:26:33 2011 (r228481) @@ -100,8 +100,8 @@ static void usage(void); int main(int argc, char *argv[]) { - int ch, unit; - char *file_name, targname[16]; + int ch; + char *file_name; u_int16_t req_flags, sim_flags; off_t user_size; @@ -283,17 +283,11 @@ main(int argc, char *argv[]) warnx("aio support tested ok"); } - /* Go through all the control devices and find one that isn't busy. */ - unit = 0; - do { - snprintf(targname, sizeof(targname), "/dev/targ%d", unit++); - targ_fd = open(targname, O_RDWR); - } while (targ_fd < 0 && errno == EBUSY); - + targ_fd = open("/dev/targ", O_RDWR); if (targ_fd < 0) - errx(1, "Tried to open %d devices, none available", unit); + err(1, "/dev/targ"); else - warnx("opened %s", targname); + warnx("opened /dev/targ"); /* The first three are handled by kevent() later */ signal(SIGHUP, SIG_IGN); Modified: head/share/man/man4/targ.4 ============================================================================== --- head/share/man/man4/targ.4 Tue Dec 13 20:31:57 2011 (r228480) +++ head/share/man/man4/targ.4 Tue Dec 13 21:26:33 2011 (r228481) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 15, 2002 +.Dd December 13, 2011 .Dt TARG 4 .Os .Sh NAME @@ -49,16 +49,8 @@ can be found in .Pp The .Nm -driver supplies control devices, -.Pa /dev/targ0 , -.Pa /dev/targ1 , -etc. -If a device is already in use, -.Xr open 2 -will fail and -.Va errno -will be set to -.Er EBUSY . +driver supplies the control device +.Pa /dev/targ . After opening the device, the file descriptor must be bound to a specific bus/target/LUN and enabled to process CCBs using the .Dv TARGIOCENABLE @@ -123,8 +115,8 @@ it. describes the usermode interface. .It Pa /sys/cam/scsi/scsi_target.c is the driver source file. -.It Pa /dev/targ* -are the control devices. +.It Pa /dev/targ +is the control device. .El .Sh SEE ALSO .Pa /usr/share/examples/scsi_target , Modified: head/sys/cam/scsi/scsi_target.c ============================================================================== --- head/sys/cam/scsi/scsi_target.c Tue Dec 13 20:31:57 2011 (r228480) +++ head/sys/cam/scsi/scsi_target.c Tue Dec 13 21:26:33 2011 (r228481) @@ -96,12 +96,9 @@ struct targ_softc { targ_state state; struct selinfo read_select; struct devstat device_stats; - struct callout destroy_dev_callout; - struct mtx destroy_mtx; }; static d_open_t targopen; -static d_close_t targclose; static d_read_t targread; static d_write_t targwrite; static d_ioctl_t targioctl; @@ -119,7 +116,6 @@ static struct cdevsw targ_cdevsw = { .d_version = D_VERSION, .d_flags = D_NEEDGIANT, .d_open = targopen, - .d_close = targclose, .d_read = targread, .d_write = targwrite, .d_ioctl = targioctl, @@ -152,15 +148,12 @@ static void targfreeccb(struct targ_sof static struct targ_cmd_descr * targgetdescr(struct targ_softc *softc); static periph_init_t targinit; -static void targclone(void *arg, struct ucred *cred, char *name, - int namelen, struct cdev **dev); static void targasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg); static void abort_all_pending(struct targ_softc *softc); static void notify_user(struct targ_softc *softc); static int targcamstatus(cam_status status); static size_t targccblen(xpt_opcode func_code); -static void targdestroy(void *); static struct periph_driver targdriver = { @@ -171,66 +164,18 @@ PERIPHDRIVER_DECLARE(targ, targdriver); static MALLOC_DEFINE(M_TARG, "TARG", "TARG data"); -/* - * Create softc and initialize it. Only one proc can open each targ device. - * There is no locking here because a periph doesn't get created until an - * ioctl is issued to do so, and that can't happen until this method returns. - */ -static int -targopen(struct cdev *dev, int flags, int fmt, struct thread *td) -{ - struct targ_softc *softc; - - if (dev->si_drv1 != 0) { - return (EBUSY); - } - - /* Mark device busy before any potentially blocking operations */ - dev->si_drv1 = (void *)~0; - - /* Create the targ device, allocate its softc, initialize it */ - if ((dev->si_flags & SI_NAMED) == 0) { - make_dev(&targ_cdevsw, dev2unit(dev), UID_ROOT, GID_WHEEL, 0600, - "targ%d", dev2unit(dev)); - } - softc = malloc(sizeof(*softc), M_TARG, - M_WAITOK | M_ZERO); - dev->si_drv1 = softc; - softc->state = TARG_STATE_OPENED; - softc->periph = NULL; - softc->path = NULL; - - TAILQ_INIT(&softc->pending_ccb_queue); - TAILQ_INIT(&softc->work_queue); - TAILQ_INIT(&softc->abort_queue); - TAILQ_INIT(&softc->user_ccb_queue); - knlist_init_mtx(&softc->read_select.si_note, NULL); - - return (0); -} - /* Disable LUN if enabled and teardown softc */ -static int -targclose(struct cdev *dev, int flag, int fmt, struct thread *td) +static void +targcdevdtor(void *data) { - struct targ_softc *softc; - struct cam_periph *periph; - int error; + struct targ_softc *softc; + struct cam_periph *periph; - softc = (struct targ_softc *)dev->si_drv1; - mtx_init(&softc->destroy_mtx, "targ_destroy", "SCSI Target dev destroy", MTX_DEF); - callout_init_mtx(&softc->destroy_dev_callout, &softc->destroy_mtx, CALLOUT_RETURNUNLOCKED); + softc = data; if (softc->periph == NULL) { -#if 0 - destroy_dev(dev); - free(softc, M_TARG); -#endif printf("%s: destroying non-enabled target\n", __func__); - mtx_lock(&softc->destroy_mtx); - callout_reset(&softc->destroy_dev_callout, hz / 2, - (void *)targdestroy, (void *)dev); - mtx_unlock(&softc->destroy_mtx); - return (0); + free(softc, M_TARG); + return; } /* @@ -240,25 +185,41 @@ targclose(struct cdev *dev, int flag, in periph = softc->periph; cam_periph_acquire(periph); cam_periph_lock(periph); - error = targdisable(softc); + (void)targdisable(softc); if (softc->periph != NULL) { cam_periph_invalidate(softc->periph); softc->periph = NULL; } cam_periph_unlock(periph); cam_periph_release(periph); - -#if 0 - destroy_dev(dev); free(softc, M_TARG); -#endif +} - printf("%s: close finished error(%d)\n", __func__, error); - mtx_lock(&softc->destroy_mtx); - callout_reset(&softc->destroy_dev_callout, hz / 2, - (void *)targdestroy, (void *)dev); - mtx_unlock(&softc->destroy_mtx); - return (error); +/* + * Create softc and initialize it. There is no locking here because a + * periph doesn't get created until an ioctl is issued to do so, and + * that can't happen until this method returns. + */ +static int +targopen(struct cdev *dev, int flags, int fmt, struct thread *td) +{ + struct targ_softc *softc; + + /* Allocate its softc, initialize it */ + softc = malloc(sizeof(*softc), M_TARG, + M_WAITOK | M_ZERO); + softc->state = TARG_STATE_OPENED; + softc->periph = NULL; + softc->path = NULL; + + TAILQ_INIT(&softc->pending_ccb_queue); + TAILQ_INIT(&softc->work_queue); + TAILQ_INIT(&softc->abort_queue); + TAILQ_INIT(&softc->user_ccb_queue); + knlist_init_mtx(&softc->read_select.si_note, NULL); + + devfs_set_cdevpriv(softc, targcdevdtor); + return (0); } /* Enable/disable LUNs, set debugging level */ @@ -268,7 +229,7 @@ targioctl(struct cdev *dev, u_long cmd, struct targ_softc *softc; cam_status status; - softc = (struct targ_softc *)dev->si_drv1; + devfs_get_cdevpriv((void **)&softc); switch (cmd) { case TARGIOCENABLE: @@ -346,7 +307,7 @@ targpoll(struct cdev *dev, int poll_even struct targ_softc *softc; int revents; - softc = (struct targ_softc *)dev->si_drv1; + devfs_get_cdevpriv((void **)&softc); /* Poll for write() is always ok. */ revents = poll_events & (POLLOUT | POLLWRNORM); @@ -371,7 +332,7 @@ targkqfilter(struct cdev *dev, struct kn { struct targ_softc *softc; - softc = (struct targ_softc *)dev->si_drv1; + devfs_get_cdevpriv((void **)&softc); kn->kn_hook = (caddr_t)softc; kn->kn_fop = &targread_filtops; knlist_add(&softc->read_select.si_note, kn, 0); @@ -572,7 +533,7 @@ targwrite(struct cdev *dev, struct uio * int write_len, error; int func_code, priority; - softc = (struct targ_softc *)dev->si_drv1; + devfs_get_cdevpriv((void **)&softc); write_len = error = 0; CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, ("write - uio_resid %zd\n", uio->uio_resid)); @@ -866,7 +827,7 @@ targread(struct cdev *dev, struct uio *u error = 0; read_len = 0; - softc = (struct targ_softc *)dev->si_drv1; + devfs_get_cdevpriv((void **)&softc); user_queue = &softc->user_ccb_queue; abort_queue = &softc->abort_queue; CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, ("targread\n")); @@ -1051,23 +1012,11 @@ targgetdescr(struct targ_softc *softc) static void targinit(void) { - EVENTHANDLER_REGISTER(dev_clone, targclone, 0, 1000); -} - -static void -targclone(void *arg, struct ucred *cred, char *name, int namelen, - struct cdev **dev) -{ - int u; + struct cdev *dev; - if (*dev != NULL) - return; - if (dev_stdclone(name, NULL, "targ", &u) != 1) - return; - *dev = make_dev(&targ_cdevsw, u, UID_ROOT, GID_WHEEL, - 0600, "targ%d", u); - dev_ref(*dev); - (*dev)->si_flags |= SI_CHEAPCLONE; + /* Add symbolic link to targ0 for compatibility. */ + dev = make_dev(&targ_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "targ"); + make_dev_alias(dev, "targ0"); } static void @@ -1221,25 +1170,3 @@ targccblen(xpt_opcode func_code) return (len); } - -/* - * work around to destroy targ device - * outside of targclose - */ -static void -targdestroy(void *dev) -{ - struct cdev *device = (struct cdev *)dev; - struct targ_softc *softc = (struct targ_softc *)device->si_drv1; - -#if 0 - callout_stop(&softc->destroy_dev_callout); -#endif - - mtx_unlock(&softc->destroy_mtx); - mtx_destroy(&softc->destroy_mtx); - free(softc, M_TARG); - device->si_drv1 = 0; - destroy_dev(device); - printf("%s: destroyed dev\n", __func__); -} From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 00:28:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 082E71065689; Wed, 14 Dec 2011 00:28:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11D218FC0C; Wed, 14 Dec 2011 00:28:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBE0StnP074084; Wed, 14 Dec 2011 00:28:55 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBE0Sssh074069; Wed, 14 Dec 2011 00:28:54 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201112140028.pBE0Sssh074069@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 14 Dec 2011 00:28:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228483 - in head/sys: arm/econa dev/usb dev/usb/controller mips/atheros mips/cavium/usb mips/rmi mips/rt305x modules/usb modules/usb/avr32dci powerpc/ps3 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 00:28:56 -0000 Author: hselasky Date: Wed Dec 14 00:28:54 2011 New Revision: 228483 URL: http://svn.freebsd.org/changeset/base/228483 Log: Implement better support for USB controller suspend and resume. This patch should remove the need for kldunload of USB controller drivers at suspend and kldload of USB controller drivers at resume. This patch also fixes some build issues in avr32dci.c MFC after: 2 weeks Added: head/sys/modules/usb/avr32dci/ head/sys/modules/usb/avr32dci/Makefile (contents, props changed) Modified: head/sys/arm/econa/ehci_ebus.c head/sys/arm/econa/ohci_ec.c head/sys/dev/usb/controller/at91dci.c head/sys/dev/usb/controller/at91dci.h head/sys/dev/usb/controller/at91dci_atmelarm.c head/sys/dev/usb/controller/atmegadci.c head/sys/dev/usb/controller/atmegadci.h head/sys/dev/usb/controller/atmegadci_atmelarm.c head/sys/dev/usb/controller/avr32dci.c head/sys/dev/usb/controller/avr32dci.h head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/ehci.h head/sys/dev/usb/controller/ehci_ixp4xx.c head/sys/dev/usb/controller/ehci_mv.c head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/musb_otg.c head/sys/dev/usb/controller/musb_otg.h head/sys/dev/usb/controller/musb_otg_atmelarm.c head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/ohci.h head/sys/dev/usb/controller/ohci_atmelarm.c head/sys/dev/usb/controller/ohci_pci.c head/sys/dev/usb/controller/ohci_s3c24x0.c head/sys/dev/usb/controller/uhci.c head/sys/dev/usb/controller/uhci.h head/sys/dev/usb/controller/uhci_pci.c head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/controller/uss820dci.c head/sys/dev/usb/controller/uss820dci.h head/sys/dev/usb/controller/uss820dci_atmelarm.c head/sys/dev/usb/controller/xhci_pci.c head/sys/dev/usb/usb_bus.h head/sys/dev/usb/usb_controller.h head/sys/dev/usb/usb_if.m head/sys/mips/atheros/ar71xx_ehci.c head/sys/mips/atheros/ar71xx_ohci.c head/sys/mips/cavium/usb/octusb.c head/sys/mips/cavium/usb/octusb.h head/sys/mips/cavium/usb/octusb_octeon.c head/sys/mips/rmi/xls_ehci.c head/sys/mips/rt305x/rt305x_dotg.c head/sys/modules/usb/Makefile head/sys/powerpc/ps3/ehci_ps3.c head/sys/powerpc/ps3/ohci_ps3.c Modified: head/sys/arm/econa/ehci_ebus.c ============================================================================== --- head/sys/arm/econa/ehci_ebus.c Tue Dec 13 23:49:32 2011 (r228482) +++ head/sys/arm/econa/ehci_ebus.c Wed Dec 14 00:28:54 2011 (r228483) @@ -75,10 +75,6 @@ __FBSDID("$FreeBSD$"); static device_attach_t ehci_ebus_attach; static device_detach_t ehci_ebus_detach; -static device_shutdown_t ehci_ebus_shutdown; -static device_suspend_t ehci_ebus_suspend; -static device_resume_t ehci_ebus_resume; - static void *ih_err; @@ -86,45 +82,6 @@ static void *ih_err; #define USB_BRIDGE_INTR_MASK 0x214 static int -ehci_ebus_suspend(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_suspend(self); - if (err) - return (err); - ehci_suspend(sc); - return (0); -} - -static int -ehci_ebus_resume(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - - ehci_resume(sc); - - bus_generic_resume(self); - - return (0); -} - -static int -ehci_ebus_shutdown(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_shutdown(self); - if (err) - return (err); - ehci_shutdown(sc); - - return (0); -} - -static int ehci_ebus_probe(device_t self) { @@ -277,17 +234,17 @@ static device_method_t ehci_methods[] = DEVMETHOD(device_probe, ehci_ebus_probe), DEVMETHOD(device_attach, ehci_ebus_attach), DEVMETHOD(device_detach, ehci_ebus_detach), - DEVMETHOD(device_suspend, ehci_ebus_suspend), - DEVMETHOD(device_resume, ehci_ebus_resume), - DEVMETHOD(device_shutdown, ehci_ebus_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD_END }; static driver_t ehci_driver = { - "ehci", - ehci_methods, - sizeof(ehci_softc_t), + .name = "ehci", + .methods = ehci_methods, + .size = sizeof(ehci_softc_t), }; static devclass_t ehci_devclass; Modified: head/sys/arm/econa/ohci_ec.c ============================================================================== --- head/sys/arm/econa/ohci_ec.c Tue Dec 13 23:49:32 2011 (r228482) +++ head/sys/arm/econa/ohci_ec.c Wed Dec 14 00:28:54 2011 (r228483) @@ -220,15 +220,17 @@ static device_method_t ohci_methods[] = DEVMETHOD(device_probe, ohci_ec_probe), DEVMETHOD(device_attach, ohci_ec_attach), DEVMETHOD(device_detach, ohci_ec_detach), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_suspend, bus_generic_suspend), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD_END }; static driver_t ohci_driver = { - "ohci", - ohci_methods, - sizeof(struct ec_ohci_softc), + .name = "ohci", + .methods = ohci_methods, + .size = sizeof(struct ec_ohci_softc), }; static devclass_t ohci_devclass; Modified: head/sys/dev/usb/controller/at91dci.c ============================================================================== --- head/sys/dev/usb/controller/at91dci.c Tue Dec 13 23:49:32 2011 (r228482) +++ head/sys/dev/usb/controller/at91dci.c Wed Dec 14 00:28:54 2011 (r228483) @@ -1461,16 +1461,16 @@ at91dci_uninit(struct at91dci_softc *sc) USB_BUS_UNLOCK(&sc->sc_bus); } -void +static void at91dci_suspend(struct at91dci_softc *sc) { - return; + /* TODO */ } -void +static void at91dci_resume(struct at91dci_softc *sc) { - return; + /* TODO */ } static void @@ -2306,6 +2306,26 @@ at91dci_ep_init(struct usb_device *udev, } } +static void +at91dci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state) +{ + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(bus); + + switch (state) { + case USB_HW_POWER_SUSPEND: + at91dci_suspend(sc); + break; + case USB_HW_POWER_SHUTDOWN: + at91dci_uninit(sc); + break; + case USB_HW_POWER_RESUME: + at91dci_resume(sc); + break; + default: + break; + } +} + struct usb_bus_methods at91dci_bus_methods = { .endpoint_init = &at91dci_ep_init, @@ -2316,4 +2336,5 @@ struct usb_bus_methods at91dci_bus_metho .clear_stall = &at91dci_clear_stall, .roothub_exec = &at91dci_roothub_exec, .xfer_poll = &at91dci_do_poll, + .set_hw_power_sleep = &at91dci_set_hw_power_sleep, }; Modified: head/sys/dev/usb/controller/at91dci.h ============================================================================== --- head/sys/dev/usb/controller/at91dci.h Tue Dec 13 23:49:32 2011 (r228482) +++ head/sys/dev/usb/controller/at91dci.h Wed Dec 14 00:28:54 2011 (r228483) @@ -235,8 +235,6 @@ struct at91dci_softc { usb_error_t at91dci_init(struct at91dci_softc *sc); void at91dci_uninit(struct at91dci_softc *sc); -void at91dci_suspend(struct at91dci_softc *sc); -void at91dci_resume(struct at91dci_softc *sc); void at91dci_interrupt(struct at91dci_softc *sc); void at91dci_vbus_interrupt(struct at91dci_softc *sc, uint8_t is_on); Modified: head/sys/dev/usb/controller/at91dci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/at91dci_atmelarm.c Tue Dec 13 23:49:32 2011 (r228482) +++ head/sys/dev/usb/controller/at91dci_atmelarm.c Wed Dec 14 00:28:54 2011 (r228483) @@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$"); static device_probe_t at91_udp_probe; static device_attach_t at91_udp_attach; static device_detach_t at91_udp_detach; -static device_shutdown_t at91_udp_shutdown; struct at91_udp_softc { struct at91dci_softc sc_dci; /* must be first */ @@ -324,35 +323,22 @@ at91_udp_detach(device_t dev) return (0); } -static int -at91_udp_shutdown(device_t dev) -{ - struct at91_udp_softc *sc = device_get_softc(dev); - int err; - - err = bus_generic_shutdown(dev); - if (err) - return (err); - - at91dci_uninit(&sc->sc_dci); - - return (0); -} - static device_method_t at91_udp_methods[] = { /* Device interface */ DEVMETHOD(device_probe, at91_udp_probe), DEVMETHOD(device_attach, at91_udp_attach), DEVMETHOD(device_detach, at91_udp_detach), - DEVMETHOD(device_shutdown, at91_udp_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD_END }; static driver_t at91_udp_driver = { - "at91_udp", - at91_udp_methods, - sizeof(struct at91_udp_softc), + .name = "at91_udp", + .methods = at91_udp_methods, + .size = sizeof(struct at91_udp_softc), }; static devclass_t at91_udp_devclass; Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Tue Dec 13 23:49:32 2011 (r228482) +++ head/sys/dev/usb/controller/atmegadci.c Wed Dec 14 00:28:54 2011 (r228483) @@ -1352,16 +1352,16 @@ atmegadci_uninit(struct atmegadci_softc USB_BUS_UNLOCK(&sc->sc_bus); } -void +static void atmegadci_suspend(struct atmegadci_softc *sc) { - return; + /* TODO */ } -void +static void atmegadci_resume(struct atmegadci_softc *sc) { - return; + /* TODO */ } static void @@ -2126,6 +2126,26 @@ atmegadci_ep_init(struct usb_device *ude } } +static void +atmegadci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state) +{ + struct atmegadci_softc *sc = ATMEGA_BUS2SC(bus); + + switch (state) { + case USB_HW_POWER_SUSPEND: + atmegadci_suspend(sc); + break; + case USB_HW_POWER_SHUTDOWN: + atmegadci_uninit(sc); + break; + case USB_HW_POWER_RESUME: + atmegadci_resume(sc); + break; + default: + break; + } +} + struct usb_bus_methods atmegadci_bus_methods = { .endpoint_init = &atmegadci_ep_init, @@ -2136,4 +2156,5 @@ struct usb_bus_methods atmegadci_bus_met .clear_stall = &atmegadci_clear_stall, .roothub_exec = &atmegadci_roothub_exec, .xfer_poll = &atmegadci_do_poll, + .set_hw_power_sleep = &atmegadci_set_hw_power_sleep, }; Modified: head/sys/dev/usb/controller/atmegadci.h ============================================================================== --- head/sys/dev/usb/controller/atmegadci.h Tue Dec 13 23:49:32 2011 (r228482) +++ head/sys/dev/usb/controller/atmegadci.h Wed Dec 14 00:28:54 2011 (r228483) @@ -278,8 +278,6 @@ struct atmegadci_softc { usb_error_t atmegadci_init(struct atmegadci_softc *sc); void atmegadci_uninit(struct atmegadci_softc *sc); -void atmegadci_suspend(struct atmegadci_softc *sc); -void atmegadci_resume(struct atmegadci_softc *sc); void atmegadci_interrupt(struct atmegadci_softc *sc); #endif /* _ATMEGADCI_H_ */ Modified: head/sys/dev/usb/controller/atmegadci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci_atmelarm.c Tue Dec 13 23:49:32 2011 (r228482) +++ head/sys/dev/usb/controller/atmegadci_atmelarm.c Wed Dec 14 00:28:54 2011 (r228483) @@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$"); static device_probe_t atmegadci_probe; static device_attach_t atmegadci_attach; static device_detach_t atmegadci_detach; -static device_shutdown_t atmegadci_shutdown; struct atmegadci_super_softc { struct atmegadci_softc sc_otg; /* must be first */ @@ -193,35 +192,22 @@ atmegadci_detach(device_t dev) return (0); } -static int -atmegadci_shutdown(device_t dev) -{ - struct atmegadci_super_softc *sc = device_get_softc(dev); - int err; - - err = bus_generic_shutdown(dev); - if (err) - return (err); - - atmegadci_uninit(&sc->sc_otg); - - return (0); -} - static device_method_t atmegadci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, atmegadci_probe), DEVMETHOD(device_attach, atmegadci_attach), DEVMETHOD(device_detach, atmegadci_detach), - DEVMETHOD(device_shutdown, atmegadci_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD_END }; static driver_t atmegadci_driver = { - "atmegadci", - atmegadci_methods, - sizeof(struct atmegadci_super_softc), + .name = "atmegadci", + .methods = atmegadci_methods, + .size = sizeof(struct atmegadci_super_softc), }; static devclass_t atmegadci_devclass; Modified: head/sys/dev/usb/controller/avr32dci.c ============================================================================== --- head/sys/dev/usb/controller/avr32dci.c Tue Dec 13 23:49:32 2011 (r228482) +++ head/sys/dev/usb/controller/avr32dci.c Wed Dec 14 00:28:54 2011 (r228483) @@ -265,7 +265,7 @@ avr32dci_set_address(struct avr32dci_sof { DPRINTFN(5, "addr=%d\n", addr); - avr32dci_mod_ctrl(sc, AVR32_UDADDR_ADDEN | addr, 0); + avr32dci_mod_ctrl(sc, AVR32_CTRL_DEV_FADDR_EN | addr, 0); } static uint8_t @@ -501,7 +501,7 @@ repeat: } /* allocate FIFO bank */ - AVR32_WRITE_4(sc, AVR32_EPTCLRSTA(td->ep_no), AVR32_EPTSTA_TX_BK_RDY); + AVR32_WRITE_4(sc, AVR32_EPTCTL(td->ep_no), AVR32_EPTCTL_TX_PK_RDY); /* check remainder */ if (td->remainder == 0) { @@ -754,7 +754,7 @@ avr32dci_setup_standard_chain(struct usb uint8_t need_sync; DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n", - xfer->address, UE_GET_ADDR(xfer->endpoint), + xfer->address, UE_GET_ADDR(xfer->endpointno), xfer->sumlen, usbd_get_speed(xfer->xroot->udev)); temp.max_frame_size = xfer->max_frame_size; @@ -773,7 +773,7 @@ avr32dci_setup_standard_chain(struct usb temp.did_stall = !xfer->flags_int.control_stall; sc = AVR32_BUS2SC(xfer->xroot->bus); - ep_no = (xfer->endpoint & UE_ADDR); + ep_no = (xfer->endpointno & UE_ADDR); /* check if we should prepend a setup message */ @@ -798,7 +798,7 @@ avr32dci_setup_standard_chain(struct usb } if (x != xfer->nframes) { - if (xfer->endpoint & UE_DIR_IN) { + if (xfer->endpointno & UE_DIR_IN) { temp.func = &avr32dci_data_tx; need_sync = 1; } else { @@ -872,7 +872,7 @@ avr32dci_setup_standard_chain(struct usb * Send a DATA1 message and invert the current * endpoint direction. */ - if (xfer->endpoint & UE_DIR_IN) { + if (xfer->endpointno & UE_DIR_IN) { temp.func = &avr32dci_data_rx; need_sync = 0; } else { @@ -913,7 +913,8 @@ avr32dci_start_standard_chain(struct usb /* poll one time - will turn on interrupts */ if (avr32dci_xfer_do_fifo(xfer)) { - uint8_t ep_no = xfer->endpoint & UE_ADDR_MASK; + uint8_t ep_no = xfer->endpointno & UE_ADDR; + struct avr32dci_softc *sc = AVR32_BUS2SC(xfer->xroot->bus); avr32dci_mod_ien(sc, AVR32_INT_EPT_INT(ep_no), 0); @@ -1012,7 +1013,7 @@ avr32dci_standard_done(struct usb_xfer * usb_error_t err = 0; DPRINTFN(13, "xfer=%p pipe=%p transfer done\n", - xfer, xfer->pipe); + xfer, xfer->endpoint); /* reset scanner */ @@ -1064,10 +1065,10 @@ avr32dci_device_done(struct usb_xfer *xf USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); DPRINTFN(9, "xfer=%p, pipe=%p, error=%d\n", - xfer, xfer->pipe, error); + xfer, xfer->endpoint, error); if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) { - ep_no = (xfer->endpoint & UE_ADDR); + ep_no = (xfer->endpointno & UE_ADDR); /* disable endpoint interrupt */ avr32dci_mod_ien(sc, 0, AVR32_INT_EPT_INT(ep_no)); @@ -1080,7 +1081,7 @@ avr32dci_device_done(struct usb_xfer *xf static void avr32dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, - struct usb_endpoint *ep, uint8_t *did_stall) + struct usb_endpoint *pipe, uint8_t *did_stall) { struct avr32dci_softc *sc; uint8_t ep_no; @@ -1166,7 +1167,7 @@ avr32dci_clear_stall_sub(struct avr32dci } static void -avr32dci_clear_stall(struct usb_device *udev, struct usb_endpoint *ep) +avr32dci_clear_stall(struct usb_device *udev, struct usb_endpoint *pipe) { struct avr32dci_softc *sc; struct usb_endpoint_descriptor *ed; @@ -1226,8 +1227,7 @@ avr32dci_init(struct avr32dci_softc *sc) AVR32_INT_ENDRESET, 0); /* reset all endpoints */ -/**INDENT** Warning@1207: Extra ) */ - AVR32_WRITE_4(sc, AVR32_EPTRST, (1 << AVR32_EP_MAX) - 1)); + AVR32_WRITE_4(sc, AVR32_EPTRST, (1 << AVR32_EP_MAX) - 1); /* disable all endpoints */ for (n = 0; n != AVR32_EP_MAX; n++) { @@ -1262,8 +1262,7 @@ avr32dci_uninit(struct avr32dci_softc *s avr32dci_mod_ien(sc, 0, 0xFFFFFFFF); /* reset all endpoints */ -/**INDENT** Warning@1242: Extra ) */ - AVR32_WRITE_4(sc, AVR32_EPTRST, (1 << AVR32_EP_MAX) - 1)); + AVR32_WRITE_4(sc, AVR32_EPTRST, (1 << AVR32_EP_MAX) - 1); /* disable all endpoints */ for (n = 0; n != AVR32_EP_MAX; n++) { @@ -1284,16 +1283,16 @@ avr32dci_uninit(struct avr32dci_softc *s USB_BUS_UNLOCK(&sc->sc_bus); } -void +static void avr32dci_suspend(struct avr32dci_softc *sc) { - return; + /* TODO */ } -void +static void avr32dci_resume(struct avr32dci_softc *sc) { - return; + /* TODO */ } static void @@ -1369,10 +1368,10 @@ avr32dci_device_isoc_fs_enter(struct usb uint8_t ep_no; DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", - xfer, xfer->pipe->isoc_next, xfer->nframes); + xfer, xfer->endpoint->isoc_next, xfer->nframes); /* get the current frame index */ - ep_no = xfer->endpoint & UE_ADDR_MASK; + ep_no = xfer->endpointno & UE_ADDR; nframes = (AVR32_READ_4(sc, AVR32_FNUM) / 8); nframes &= AVR32_FRAME_MASK; @@ -1381,9 +1380,9 @@ avr32dci_device_isoc_fs_enter(struct usb * check if the frame index is within the window where the frames * will be inserted */ - temp = (nframes - xfer->pipe->isoc_next) & AVR32_FRAME_MASK; + temp = (nframes - xfer->endpoint->isoc_next) & AVR32_FRAME_MASK; - if ((xfer->pipe->is_synced == 0) || + if ((xfer->endpoint->is_synced == 0) || (temp < xfer->nframes)) { /* * If there is data underflow or the pipe queue is @@ -1391,15 +1390,15 @@ avr32dci_device_isoc_fs_enter(struct usb * of the current frame position. Else two isochronous * transfers might overlap. */ - xfer->pipe->isoc_next = (nframes + 3) & AVR32_FRAME_MASK; - xfer->pipe->is_synced = 1; - DPRINTFN(3, "start next=%d\n", xfer->pipe->isoc_next); + xfer->endpoint->isoc_next = (nframes + 3) & AVR32_FRAME_MASK; + xfer->endpoint->is_synced = 1; + DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); } /* * compute how many milliseconds the insertion is ahead of the * current frame position: */ - temp = (xfer->pipe->isoc_next - nframes) & AVR32_FRAME_MASK; + temp = (xfer->endpoint->isoc_next - nframes) & AVR32_FRAME_MASK; /* * pre-compute when the isochronous transfer will be finished: @@ -1409,7 +1408,7 @@ avr32dci_device_isoc_fs_enter(struct usb xfer->nframes; /* compute frame number for next insertion */ - xfer->pipe->isoc_next += xfer->nframes; + xfer->endpoint->isoc_next += xfer->nframes; /* setup TDs */ avr32dci_setup_standard_chain(xfer); @@ -1832,7 +1831,7 @@ tr_handle_clear_port_feature: AVR32_WRITE_4(sc, AVR32_EPTCLRSTA(0), AVR32_EPTSTA_FRCESTALL); /* configure */ - AVR32_WRITE_4(sc, AVR32_EPTCFG(0), AVR32_EPTCFG_TYPE_CONTROL | + AVR32_WRITE_4(sc, AVR32_EPTCFG(0), AVR32_EPTCFG_TYPE_CTRL | AVR32_EPTCFG_NBANK(1) | AVR32_EPTCFG_EPSIZE(6)); temp = AVR32_READ_4(sc, AVR32_EPTCFG(0)); @@ -1974,7 +1973,7 @@ avr32dci_xfer_setup(struct usb_setup_par /* * compute maximum number of TDs */ - if ((xfer->pipe->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) { + if ((xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) { ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + 1 /* SYNC 2 */ ; @@ -1997,7 +1996,7 @@ avr32dci_xfer_setup(struct usb_setup_par /* * get profile stuff */ - ep_no = xfer->endpoint & UE_ADDR; + ep_no = xfer->endpointno & UE_ADDR; avr32dci_get_hw_ep_profile(parm->udev, &pf, ep_no); if (pf == NULL) { @@ -2045,7 +2044,7 @@ avr32dci_xfer_unsetup(struct usb_xfer *x static void avr32dci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, - struct usb_endpoint *ep) + struct usb_endpoint *pipe) { struct avr32dci_softc *sc = AVR32_BUS2SC(udev->bus); @@ -2072,6 +2071,26 @@ avr32dci_ep_init(struct usb_device *udev } } +static void +avr32dci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state) +{ + struct avr32dci_softc *sc = AVR32_BUS2SC(bus); + + switch (state) { + case USB_HW_POWER_SUSPEND: + avr32dci_suspend(sc); + break; + case USB_HW_POWER_SHUTDOWN: + avr32dci_uninit(sc); + break; + case USB_HW_POWER_RESUME: + avr32dci_resume(sc); + break; + default: + break; + } +} + struct usb_bus_methods avr32dci_bus_methods = { .endpoint_init = &avr32dci_ep_init, @@ -2082,4 +2101,5 @@ struct usb_bus_methods avr32dci_bus_meth .clear_stall = &avr32dci_clear_stall, .roothub_exec = &avr32dci_roothub_exec, .xfer_poll = &avr32dci_do_poll, + .set_hw_power_sleep = &avr32dci_set_hw_power_sleep, }; Modified: head/sys/dev/usb/controller/avr32dci.h ============================================================================== --- head/sys/dev/usb/controller/avr32dci.h Tue Dec 13 23:49:32 2011 (r228482) +++ head/sys/dev/usb/controller/avr32dci.h Wed Dec 14 00:28:54 2011 (r228483) @@ -166,6 +166,7 @@ struct avr32dci_td { uint32_t offset; uint32_t remainder; uint16_t max_packet_size; + uint8_t bank_shift; uint8_t error:1; uint8_t alt_next:1; uint8_t short_pkt:1; @@ -246,8 +247,6 @@ struct avr32dci_softc { usb_error_t avr32dci_init(struct avr32dci_softc *sc); void avr32dci_uninit(struct avr32dci_softc *sc); -void avr32dci_suspend(struct avr32dci_softc *sc); -void avr32dci_resume(struct avr32dci_softc *sc); void avr32dci_interrupt(struct avr32dci_softc *sc); void avr32dci_vbus_interrupt(struct avr32dci_softc *sc, uint8_t is_on); Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Tue Dec 13 23:49:32 2011 (r228482) +++ head/sys/dev/usb/controller/ehci.c Wed Dec 14 00:28:54 2011 (r228483) @@ -188,7 +188,7 @@ ehci_reset(ehci_softc_t *sc) EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET); for (i = 0; i < 100; i++) { - usb_pause_mtx(NULL, hz / 1000); + usb_pause_mtx(NULL, hz / 128); hcr = EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_HCRESET; if (!hcr) { if (sc->sc_flags & (EHCI_SCFLG_SETMODE | EHCI_SCFLG_BIGEMMIO)) { @@ -212,7 +212,7 @@ ehci_reset(ehci_softc_t *sc) return (0); } } - device_printf(sc->sc_bus.bdev, "reset timeout\n"); + device_printf(sc->sc_bus.bdev, "Reset timeout\n"); return (USB_ERR_IOERROR); } @@ -224,7 +224,7 @@ ehci_hcreset(ehci_softc_t *sc) EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */ for (i = 0; i < 100; i++) { - usb_pause_mtx(NULL, hz / 1000); + usb_pause_mtx(NULL, hz / 128); hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; if (hcr) break; @@ -237,7 +237,60 @@ ehci_hcreset(ehci_softc_t *sc) */ device_printf(sc->sc_bus.bdev, "stop timeout\n"); - return ehci_reset(sc); + return (ehci_reset(sc)); +} + +static int +ehci_init_sub(struct ehci_softc *sc) +{ + struct usb_page_search buf_res; + uint32_t cparams; + uint32_t hcr; + uint8_t i; + + cparams = EREAD4(sc, EHCI_HCCPARAMS); + + DPRINTF("cparams=0x%x\n", cparams); + + if (EHCI_HCC_64BIT(cparams)) { + DPRINTF("HCC uses 64-bit structures\n"); + + /* MUST clear segment register if 64 bit capable */ + EWRITE4(sc, EHCI_CTRLDSSEGMENT, 0); + } + + usbd_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res); + EOWRITE4(sc, EHCI_PERIODICLISTBASE, buf_res.physaddr); + + usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res); + EOWRITE4(sc, EHCI_ASYNCLISTADDR, buf_res.physaddr | EHCI_LINK_QH); + + /* enable interrupts */ + EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); + + /* turn on controller */ + EOWRITE4(sc, EHCI_USBCMD, + EHCI_CMD_ITC_1 | /* 1 microframes interrupt delay */ + (EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_FLS_M) | + EHCI_CMD_ASE | + EHCI_CMD_PSE | + EHCI_CMD_RS); + + /* Take over port ownership */ + EOWRITE4(sc, EHCI_CONFIGFLAG, EHCI_CONF_CF); + + for (i = 0; i < 100; i++) { + usb_pause_mtx(NULL, hz / 128); + hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; + if (!hcr) { + break; + } + } + if (hcr) { + device_printf(sc->sc_bus.bdev, "Run timeout\n"); + return (USB_ERR_IOERROR); + } + return (USB_ERR_NORMAL_COMPLETION); } usb_error_t @@ -246,8 +299,6 @@ ehci_init(ehci_softc_t *sc) struct usb_page_search buf_res; uint32_t version; uint32_t sparams; - uint32_t cparams; - uint32_t hcr; uint16_t i; uint16_t x; uint16_t y; @@ -279,15 +330,6 @@ ehci_init(ehci_softc_t *sc) DPRINTF("sparams=0x%x\n", sparams); sc->sc_noport = EHCI_HCS_N_PORTS(sparams); - cparams = EREAD4(sc, EHCI_HCCPARAMS); - DPRINTF("cparams=0x%x\n", cparams); - - if (EHCI_HCC_64BIT(cparams)) { - DPRINTF("HCC uses 64-bit structures\n"); - - /* MUST clear segment register if 64 bit capable */ - EWRITE4(sc, EHCI_CTRLDSSEGMENT, 0); - } sc->sc_bus.usbrev = USB_REV_2_0; /* Reset the controller */ @@ -464,9 +506,6 @@ ehci_init(ehci_softc_t *sc) [i & (EHCI_VIRTUAL_FRAMELIST_COUNT - 1)]->itd_self; } } - /* setup sync list pointer */ - EOWRITE4(sc, EHCI_PERIODICLISTBASE, buf_res.physaddr); - usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res); if (1) { @@ -511,35 +550,8 @@ ehci_init(ehci_softc_t *sc) } #endif - /* setup async list pointer */ - EOWRITE4(sc, EHCI_ASYNCLISTADDR, buf_res.physaddr | EHCI_LINK_QH); - - - /* enable interrupts */ - EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); - - /* turn on controller */ - EOWRITE4(sc, EHCI_USBCMD, - EHCI_CMD_ITC_1 | /* 1 microframes interrupt delay */ - (EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_FLS_M) | - EHCI_CMD_ASE | - EHCI_CMD_PSE | - EHCI_CMD_RS); - - /* Take over port ownership */ - EOWRITE4(sc, EHCI_CONFIGFLAG, EHCI_CONF_CF); - - for (i = 0; i < 100; i++) { - usb_pause_mtx(NULL, hz / 1000); - hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; - if (!hcr) { - break; - } - } - if (hcr) { - device_printf(sc->sc_bus.bdev, "run timeout\n"); - return (USB_ERR_IOERROR); - } + /* finial setup */ + err = ehci_init_sub(sc); if (!err) { /* catch any lost interrupts */ @@ -573,137 +585,28 @@ ehci_detach(ehci_softc_t *sc) usb_callout_drain(&sc->sc_tmo_poll); } -void +static void ehci_suspend(ehci_softc_t *sc) { - uint32_t cmd; - uint32_t hcr; - uint8_t i; - - USB_BUS_LOCK(&sc->sc_bus); - - for (i = 1; i <= sc->sc_noport; i++) { - cmd = EOREAD4(sc, EHCI_PORTSC(i)); - if (((cmd & EHCI_PS_PO) == 0) && - ((cmd & EHCI_PS_PE) == EHCI_PS_PE)) { - EOWRITE4(sc, EHCI_PORTSC(i), - cmd | EHCI_PS_SUSP); - } - } - - sc->sc_cmd = EOREAD4(sc, EHCI_USBCMD); - - cmd = sc->sc_cmd & ~(EHCI_CMD_ASE | EHCI_CMD_PSE); - EOWRITE4(sc, EHCI_USBCMD, cmd); - - for (i = 0; i < 100; i++) { - hcr = EOREAD4(sc, EHCI_USBSTS) & - (EHCI_STS_ASS | EHCI_STS_PSS); - - if (hcr == 0) { - break; - } - usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000); - } - - if (hcr != 0) { - device_printf(sc->sc_bus.bdev, "reset timeout\n"); - } - cmd &= ~EHCI_CMD_RS; - EOWRITE4(sc, EHCI_USBCMD, cmd); - - for (i = 0; i < 100; i++) { - hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; - if (hcr == EHCI_STS_HCH) { - break; - } - usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000); - } + DPRINTF("stopping the HC\n"); - if (hcr != EHCI_STS_HCH) { - device_printf(sc->sc_bus.bdev, - "config timeout\n"); - } - USB_BUS_UNLOCK(&sc->sc_bus); + /* reset HC */ + ehci_hcreset(sc); } -void +static void ehci_resume(ehci_softc_t *sc) { - struct usb_page_search buf_res; - uint32_t cmd; - uint32_t hcr; - uint8_t i; - - USB_BUS_LOCK(&sc->sc_bus); + /* reset HC */ + ehci_hcreset(sc); - /* restore things in case the bios doesn't */ - EOWRITE4(sc, EHCI_CTRLDSSEGMENT, 0); - - usbd_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res); - EOWRITE4(sc, EHCI_PERIODICLISTBASE, buf_res.physaddr); - - usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res); - EOWRITE4(sc, EHCI_ASYNCLISTADDR, buf_res.physaddr | EHCI_LINK_QH); - - EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); - - hcr = 0; - for (i = 1; i <= sc->sc_noport; i++) { - cmd = EOREAD4(sc, EHCI_PORTSC(i)); - if (((cmd & EHCI_PS_PO) == 0) && - ((cmd & EHCI_PS_SUSP) == EHCI_PS_SUSP)) { - EOWRITE4(sc, EHCI_PORTSC(i), - cmd | EHCI_PS_FPR); - hcr = 1; - } - } - - if (hcr) { - usb_pause_mtx(&sc->sc_bus.bus_mtx, - USB_MS_TO_TICKS(USB_RESUME_WAIT)); - - for (i = 1; i <= sc->sc_noport; i++) { - cmd = EOREAD4(sc, EHCI_PORTSC(i)); - if (((cmd & EHCI_PS_PO) == 0) && - ((cmd & EHCI_PS_SUSP) == EHCI_PS_SUSP)) { - EOWRITE4(sc, EHCI_PORTSC(i), - cmd & ~EHCI_PS_FPR); - } - } - } - EOWRITE4(sc, EHCI_USBCMD, sc->sc_cmd); - - for (i = 0; i < 100; i++) { - hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; - if (hcr != EHCI_STS_HCH) { - break; - } - usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000); - } - if (hcr == EHCI_STS_HCH) { - device_printf(sc->sc_bus.bdev, "config timeout\n"); - } - - USB_BUS_UNLOCK(&sc->sc_bus); - - usb_pause_mtx(NULL, - USB_MS_TO_TICKS(USB_RESUME_WAIT)); + /* setup HC */ + ehci_init_sub(sc); /* catch any lost interrupts */ ehci_do_poll(&sc->sc_bus); } -void -ehci_shutdown(ehci_softc_t *sc) -{ - DPRINTF("stopping the HC\n"); - - if (ehci_hcreset(sc)) { - DPRINTF("reset failed!\n"); - } -} - #ifdef USB_DEBUG static void ehci_dump_regs(ehci_softc_t *sc) @@ -3908,8 +3811,24 @@ ehci_device_suspend(struct usb_device *u } USB_BUS_UNLOCK(udev->bus); +} - return; +static void +ehci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state) +{ + struct ehci_softc *sc = EHCI_BUS2SC(bus); + + switch (state) { + case USB_HW_POWER_SUSPEND: + case USB_HW_POWER_SHUTDOWN: + ehci_suspend(sc); + break; + case USB_HW_POWER_RESUME: + ehci_resume(sc); + break; + default: + break; + } } static void @@ -3955,6 +3874,7 @@ struct usb_bus_methods ehci_bus_methods .device_resume = ehci_device_resume, .device_suspend = ehci_device_suspend, .set_hw_power = ehci_set_hw_power, + .set_hw_power_sleep = ehci_set_hw_power_sleep, .roothub_exec = ehci_roothub_exec, .xfer_poll = ehci_do_poll, }; Modified: head/sys/dev/usb/controller/ehci.h ============================================================================== --- head/sys/dev/usb/controller/ehci.h Tue Dec 13 23:49:32 2011 (r228482) +++ head/sys/dev/usb/controller/ehci.h Wed Dec 14 00:28:54 2011 (r228483) @@ -333,8 +333,6 @@ typedef struct ehci_softc { uint32_t sc_terminate_self; /* TD short packet termination pointer */ uint32_t sc_eintrs; - uint32_t sc_cmd; /* shadow of cmd register during - * suspend */ uint16_t sc_intr_stat[EHCI_VIRTUAL_FRAMELIST_COUNT]; uint16_t sc_id_vendor; /* vendor ID for root hub */ @@ -445,9 +443,6 @@ usb_bus_mem_cb_t ehci_iterate_hw_softc; usb_error_t ehci_reset(ehci_softc_t *sc); usb_error_t ehci_init(ehci_softc_t *sc); void ehci_detach(struct ehci_softc *sc); -void ehci_suspend(struct ehci_softc *sc); -void ehci_resume(struct ehci_softc *sc); -void ehci_shutdown(ehci_softc_t *sc); void ehci_interrupt(ehci_softc_t *sc); #endif /* _EHCI_H_ */ Modified: head/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- head/sys/dev/usb/controller/ehci_ixp4xx.c Tue Dec 13 23:49:32 2011 (r228482) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 00:48:21 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12B931065675; Wed, 14 Dec 2011 00:48:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 019108FC16; Wed, 14 Dec 2011 00:48:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBE0mKpA074684; Wed, 14 Dec 2011 00:48:20 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBE0mKhS074681; Wed, 14 Dec 2011 00:48:20 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201112140048.pBE0mKhS074681@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 14 Dec 2011 00:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228484 - head/sys/dev/sound/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 00:48:21 -0000 Author: hselasky Date: Wed Dec 14 00:48:20 2011 New Revision: 228484 URL: http://svn.freebsd.org/changeset/base/228484 Log: Stop USB audio transfers early so that any audio applications will time out and close opened /dev/dspX.Y device(s), if any. This is a workaround because we cannot unregister PCM devices while the audio character device is in use. Add a missing inclusion guard. MFC after: 1 weeks Modified: head/sys/dev/sound/usb/uaudio.c head/sys/dev/sound/usb/uaudio.h Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Wed Dec 14 00:28:54 2011 (r228483) +++ head/sys/dev/sound/usb/uaudio.c Wed Dec 14 00:48:20 2011 (r228484) @@ -765,7 +765,15 @@ uaudio_detach(device_t dev) { struct uaudio_softc *sc = device_get_softc(dev); - if (bus_generic_detach(dev)) { + /* + * Stop USB transfers early so that any audio applications + * will time out and close opened /dev/dspX.Y device(s), if + * any. + */ + uaudio_chan_stop(&sc->sc_play_chan); + uaudio_chan_stop(&sc->sc_rec_chan); + + if (bus_generic_detach(dev) != 0) { DPRINTF("detach failed!\n"); } sbuf_delete(&sc->sc_sndstat); Modified: head/sys/dev/sound/usb/uaudio.h ============================================================================== --- head/sys/dev/sound/usb/uaudio.h Wed Dec 14 00:28:54 2011 (r228483) +++ head/sys/dev/sound/usb/uaudio.h Wed Dec 14 00:48:20 2011 (r228484) @@ -27,6 +27,9 @@ /* prototypes from "uaudio.c" used by "uaudio_pcm.c" */ +#ifndef _UAUDIO_H_ +#define _UAUDIO_H_ + struct uaudio_chan; struct uaudio_softc; struct snd_dbuf; @@ -63,3 +66,5 @@ extern uint32_t uaudio_mixer_setrecsrc(s int uaudio_get_vendor(device_t dev); int uaudio_get_product(device_t dev); int uaudio_get_release(device_t dev); + +#endif /* _UAUDIO_H_ */ From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 01:03:07 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE35F106564A; Wed, 14 Dec 2011 01:03:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD0298FC12; Wed, 14 Dec 2011 01:03:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBE137MI075162; Wed, 14 Dec 2011 01:03:07 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBE137go075160; Wed, 14 Dec 2011 01:03:07 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201112140103.pBE137go075160@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 14 Dec 2011 01:03:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228485 - head/sys/dev/sound/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 01:03:07 -0000 Author: hselasky Date: Wed Dec 14 01:03:07 2011 New Revision: 228485 URL: http://svn.freebsd.org/changeset/base/228485 Log: Use usbd_transfer_unsetup() instead of usbd_transfer_stop() so that we don't have to worry about locking. MFC after: 1 weeks Modified: head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Wed Dec 14 00:48:20 2011 (r228484) +++ head/sys/dev/sound/usb/uaudio.c Wed Dec 14 01:03:07 2011 (r228485) @@ -770,8 +770,10 @@ uaudio_detach(device_t dev) * will time out and close opened /dev/dspX.Y device(s), if * any. */ - uaudio_chan_stop(&sc->sc_play_chan); - uaudio_chan_stop(&sc->sc_rec_chan); + if (sc->sc_play_chan.valid) + usbd_transfer_unsetup(sc->sc_play_chan.xfer, UAUDIO_NCHANBUFS); + if (sc->sc_rec_chan.valid) + usbd_transfer_unsetup(sc->sc_rec_chan.xfer, UAUDIO_NCHANBUFS); if (bus_generic_detach(dev) != 0) { DPRINTF("detach failed!\n"); From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 01:46:42 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F30D41065793; Wed, 14 Dec 2011 01:46:41 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from mail34.syd.optusnet.com.au (mail34.syd.optusnet.com.au [211.29.133.218]) by mx1.freebsd.org (Postfix) with ESMTP id 7B1F78FC08; Wed, 14 Dec 2011 01:46:41 +0000 (UTC) Received: from server.vk2pj.dyndns.org (c220-239-116-103.belrs4.nsw.optusnet.com.au [220.239.116.103]) by mail34.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pBE1kcCw029225 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 14 Dec 2011 12:46:39 +1100 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.5/8.14.4) with ESMTP id pBE1kbfR030500; Wed, 14 Dec 2011 12:46:37 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.5/8.14.4/Submit) id pBE1kb23030499; Wed, 14 Dec 2011 12:46:37 +1100 (EST) (envelope-from peter) Date: Wed, 14 Dec 2011 12:46:37 +1100 From: Peter Jeremy To: "Bjoern A. Zeeb" Message-ID: <20111214014637.GA30470@server.vk2pj.dyndns.org> References: <201106281157.p5SBvP5g048097@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/04w6evG8XlLl3ft" Content-Disposition: inline In-Reply-To: <201106281157.p5SBvP5g048097@svn.freebsd.org> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r223637 - in head: . contrib/pf/authpf contrib/pf/ftp-proxy contrib/pf/man contrib/pf/pfctl contrib/pf/pflogd sbin/pflogd sys/conf sys/contrib/altq/altq sys/contrib/pf/net sys/modules s... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 01:46:42 -0000 --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2011-Jun-28 11:57:25 +0000, "Bjoern A. Zeeb" wrote: >Author: bz >Date: Tue Jun 28 11:57:25 2011 >New Revision: 223637 >URL: http://svn.freebsd.org/changeset/base/223637 > >Log: > Update packet filter (pf) code to OpenBSD 4.5. This is very belated but I've just found the following preprocessor conditionals in sys/contrib/pf/net/pfvar.h as a result of this commit (covering lines 214..282): #ifdef __FreeBSD__ =2E.. #ifdef __FreeBSD__ =2E.. #else =2E.. #endif /* __FreeBSD__ */ =2E.. #endif /* __FreeBSD__ */ Was there a mismerge here? --=20 Peter Jeremy --/04w6evG8XlLl3ft Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7n//0ACgkQ/opHv/APuIemCACgh9jG2AMCfYPCa7YpMIa9KKCo nEQAoLXoVgjrEVUP1595zOx2nmBVGGnz =kfHx -----END PGP SIGNATURE----- --/04w6evG8XlLl3ft-- From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 02:31:32 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8C03106564A; Wed, 14 Dec 2011 02:31:32 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97CBA8FC17; Wed, 14 Dec 2011 02:31:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBE2VWjD077897; Wed, 14 Dec 2011 02:31:32 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBE2VWxK077895; Wed, 14 Dec 2011 02:31:32 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201112140231.pBE2VWxK077895@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 14 Dec 2011 02:31:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228487 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 02:31:32 -0000 Author: obrien Date: Wed Dec 14 02:31:32 2011 New Revision: 228487 URL: http://svn.freebsd.org/changeset/base/228487 Log: Match other formatting. Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Wed Dec 14 01:19:37 2011 (r228486) +++ head/sys/kern/kern_shutdown.c Wed Dec 14 02:31:32 2011 (r228487) @@ -103,8 +103,8 @@ int debugger_on_panic = 0; int debugger_on_panic = 1; #endif SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, - CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_TUN, &debugger_on_panic, 0, - "Run debugger on kernel panic"); + CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_TUN, + &debugger_on_panic, 0, "Run debugger on kernel panic"); TUNABLE_INT("debug.debugger_on_panic", &debugger_on_panic); #ifdef KDB_TRACE @@ -113,8 +113,8 @@ static int trace_on_panic = 1; static int trace_on_panic = 0; #endif SYSCTL_INT(_debug, OID_AUTO, trace_on_panic, - CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_TUN, &trace_on_panic, 0, - "Print stack trace on kernel panic"); + CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_TUN, + &trace_on_panic, 0, "Print stack trace on kernel panic"); TUNABLE_INT("debug.trace_on_panic", &trace_on_panic); #endif /* KDB */ From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 03:26:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB6C9106564A; Wed, 14 Dec 2011 03:26:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 43F9C8FC1F; Wed, 14 Dec 2011 03:26:04 +0000 (UTC) Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pBE3Q1JL024399 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 14 Dec 2011 14:26:02 +1100 Date: Wed, 14 Dec 2011 14:26:01 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Stefan Farfeleder In-Reply-To: <20111213144539.GB1587@mole.fafoe.narf.at> Message-ID: <20111214140737.J1950@besplex.bde.org> References: <201112131406.pBDE61bc053693@svn.freebsd.org> <20111213144539.GB1587@mole.fafoe.narf.at> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ed Schouten Subject: Re: svn commit: r228471 - in head/sys: boot/arm/at91/libat91 dev/cm dev/de dev/fdc dev/pccard dev/spibus dev/xen/netback pc98/cbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 03:26:05 -0000 On Tue, 13 Dec 2011, Stefan Farfeleder wrote: >> Log: >> Replace `inline static' by `static inline'. >> >> If I interpret the C standard correctly, the storage specifier should be >> placed before the inline keyword. While at it, replace __inline by >> inline in the files affected. > > No, declaration-specifier is defined recursively - any order is allowed. > Still I think having a consistent order is a good idea. And using inline instead of __inline breaks C90 compilers. Unline const and signed, inline is new in C99, and there are still usable C90 compilers (e.g., c89, gcc -std=c89 and old(?) versions of TenDRA) which will break if it is spelled inline. C90 compilers should also break if it is spelled __inline, but it is easier to annul if is spelled __inline, and already supports this. c89 and gcc -std=c89 apparently are not C compilers (even with -pedantic), since they accept __inline. They don't accept inline. The support in for annuling __inline works automatically for TenDRA-4.20040902 -Ysystem (-Ysystem makes it use the system headers). When __inline is attached to static, annuling it doesn't change the semantics. Annuling it is not so safe for extern inline, but might work for at least individual source files. I mainly use TenDRA for its portability checks and better diagnostics of standards violations. Support for C90 in headers and no C99 code in the files being checked is enough for this. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 05:34:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81FEB106564A; Wed, 14 Dec 2011 05:34:24 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 710558FC13; Wed, 14 Dec 2011 05:34:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBE5YODA083966; Wed, 14 Dec 2011 05:34:24 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBE5YOFC083964; Wed, 14 Dec 2011 05:34:24 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201112140534.pBE5YOFC083964@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 14 Dec 2011 05:34:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228491 - head/sys/dev/cxgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 05:34:24 -0000 Author: np Date: Wed Dec 14 05:34:23 2011 New Revision: 228491 URL: http://svn.freebsd.org/changeset/base/228491 Log: Do not clobber the ingress queue's congestion setting. MFC after: 1 month Modified: head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Wed Dec 14 04:12:13 2011 (r228490) +++ head/sys/dev/cxgbe/t4_sge.c Wed Dec 14 05:34:23 2011 (r228491) @@ -1187,7 +1187,7 @@ alloc_iq_fl(struct port_info *pi, struct } fl->needed = fl->cap; - c.iqns_to_fl0congen = + c.iqns_to_fl0congen |= htobe32(V_FW_IQ_CMD_FL0HOSTFCMODE(X_HOSTFCMODE_NONE) | F_FW_IQ_CMD_FL0FETCHRO | F_FW_IQ_CMD_FL0DATARO | F_FW_IQ_CMD_FL0PADEN); From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 06:26:19 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FD85106566B; Wed, 14 Dec 2011 06:26:19 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id 3C48F8FC16; Wed, 14 Dec 2011 06:26:19 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id 3A4002A28CF1; Wed, 14 Dec 2011 07:26:18 +0100 (CET) Date: Wed, 14 Dec 2011 07:26:18 +0100 From: Ed Schouten To: Bruce Evans Message-ID: <20111214062618.GK1771@hoeg.nl> References: <201112131406.pBDE61bc053693@svn.freebsd.org> <20111213144539.GB1587@mole.fafoe.narf.at> <20111214140737.J1950@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+HmK7y6O+lKZIGkr" Content-Disposition: inline In-Reply-To: <20111214140737.J1950@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Stefan Farfeleder , src-committers@freebsd.org Subject: Re: svn commit: r228471 - in head/sys: boot/arm/at91/libat91 dev/cm dev/de dev/fdc dev/pccard dev/spibus dev/xen/netback pc98/cbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 06:26:19 -0000 --+HmK7y6O+lKZIGkr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Bruce, * Bruce Evans , 20111214 04:26: > And using inline instead of __inline breaks C90 compilers. Unline const > and signed, inline is new in C99, and there are still usable C90 compilers > (e.g., c89, gcc -std=3Dc89 and old(?) versions of TenDRA) which will break > if it is spelled inline. C90 compilers should also break if it is spelled > __inline, but it is easier to annul if is spelled __inline, and > already supports this. But the point is that we switched to C99 and haven't looked back since. There is no harm in using C99 in the kernel. The only places where we need to use __inline, is in header files that provide public APIs. --=20 Ed Schouten WWW: http://80386.nl/ --+HmK7y6O+lKZIGkr Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iQIcBAEBAgAGBQJO6EGKAAoJEG5e2P40kaK7kw4P/ircnSSbqkAzLdrkogCgQ/Xu 7Zp+5Zpkf1Safhn2vfq0uHUrbP6G4t7KIL0dB6amBogVigCaA0TBrvluxtBk7sWc GxKi1G7P00OqsTZxfz93VZ1KB8nwK3R7gz/OZPlixKTkdr2FlRNVXVWLtOknyAGD SsqQiUxD1U6UFTk9pndA9URTq+ls08ynDy5G21zFLmIXn8ASvgLWz2vBhvqsazA3 ME/sXxMupu1Fl72pDgSMPWKyzEQdEc37fklad7Bwuzh/fqXULkaCGc9ZQh38r1WP rHmI1hKJHnpQLprgF9MYk3KbQvgS6lQlERhjh9u66DxZOtJ3rdxgovpXw0RMLldI 6EJdkdfDHGJNskcz6gUVNfUBnlZtrr+Q9abw22q+IscjOnIjh2JRo5Fh4pBhlqy1 9E3qJonfumLQUajHDMufOxtV5QKmkVSuyoYTKtDD2pPQEnLpqJTG19POueaE28xR Vt88OVURhQ+hRp2vXSC9jJ1b9x3ngZbAQFPkFx1URIccu3EEI0O6C9NgvmJZjKgn fqUM3i0yKbuOZhd2RsHSU9JSHpMsfsDWiL2yJX5azN5YwO27SiyI2Efi/atrMU9Z F4CAdOWvZQ3eMPNqv9sX7ia8dtDNG/7alxumS42PSFYo84ShgUBNlLuYDEmPKxj9 NLPQ0UDwJ6LVuTqgBbLV =YLPq -----END PGP SIGNATURE----- --+HmK7y6O+lKZIGkr-- From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 08:35:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5485B106566B; Wed, 14 Dec 2011 08:35:09 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 438D18FC15; Wed, 14 Dec 2011 08:35:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBE8Z9nH089505; Wed, 14 Dec 2011 08:35:09 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBE8Z9Ke089503; Wed, 14 Dec 2011 08:35:09 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201112140835.pBE8Z9Ke089503@svn.freebsd.org> From: Ruslan Ermilov Date: Wed, 14 Dec 2011 08:35:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228492 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 08:35:09 -0000 Author: ru Date: Wed Dec 14 08:35:08 2011 New Revision: 228492 URL: http://svn.freebsd.org/changeset/base/228492 Log: Clean up includes; the prototype for getosreldate() has moved to in r183390. Modified: head/lib/libc/gen/getosreldate.c Modified: head/lib/libc/gen/getosreldate.c ============================================================================== --- head/lib/libc/gen/getosreldate.c Wed Dec 14 05:34:23 2011 (r228491) +++ head/lib/libc/gen/getosreldate.c Wed Dec 14 08:35:08 2011 (r228492) @@ -33,12 +33,11 @@ static char sccsid[] = "@(#)gethostid.c #include __FBSDID("$FreeBSD$"); -#include +#include #include -#include -#include -#include +#include +#include int getosreldate(void) From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 08:44:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BCC4106564A; Wed, 14 Dec 2011 08:44:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A4868FC08; Wed, 14 Dec 2011 08:44:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBE8iHmq089803; Wed, 14 Dec 2011 08:44:17 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBE8iH87089801; Wed, 14 Dec 2011 08:44:17 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201112140844.pBE8iH87089801@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 14 Dec 2011 08:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228493 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 08:44:17 -0000 Author: hselasky Date: Wed Dec 14 08:44:16 2011 New Revision: 228493 URL: http://svn.freebsd.org/changeset/base/228493 Log: Fix definition of XHCI port power bit. Reported by: Kohji Okuno MFC after: 3 days Modified: head/sys/dev/usb/controller/xhcireg.h Modified: head/sys/dev/usb/controller/xhcireg.h ============================================================================== --- head/sys/dev/usb/controller/xhcireg.h Wed Dec 14 08:35:08 2011 (r228492) +++ head/sys/dev/usb/controller/xhcireg.h Wed Dec 14 08:44:16 2011 (r228493) @@ -115,7 +115,7 @@ #define XHCI_PS_PR 0x00000010 /* RW - port reset */ #define XHCI_PS_PLS_GET(x) (((x) >> 5) & 0xF) /* RW - port link state */ #define XHCI_PS_PLS_SET(x) (((x) & 0xF) << 5) /* RW - port link state */ -#define XHCI_PS_PP 0x00000100 /* RW - port power */ +#define XHCI_PS_PP 0x00000200 /* RW - port power */ #define XHCI_PS_SPEED_GET(x) (((x) >> 10) & 0xF) /* RO - port speed */ #define XHCI_PS_PIC_GET(x) (((x) >> 14) & 0x3) /* RW - port indicator */ #define XHCI_PS_PIC_SET(x) (((x) & 0x3) << 14) /* RW - port indicator */ From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 08:52:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1829D106564A; Wed, 14 Dec 2011 08:52:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E09C98FC12; Wed, 14 Dec 2011 08:52:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBE8qRG9090086; Wed, 14 Dec 2011 08:52:27 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBE8qReF090084; Wed, 14 Dec 2011 08:52:27 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201112140852.pBE8qReF090084@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 14 Dec 2011 08:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228494 - head/sys/dev/usb/wlan X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 08:52:28 -0000 Author: hselasky Date: Wed Dec 14 08:52:27 2011 New Revision: 228494 URL: http://svn.freebsd.org/changeset/base/228494 Log: Fix for random USB transfer time out. Submitted by: PseudoCylon MFC after: 3 days Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Wed Dec 14 08:44:16 2011 (r228493) +++ head/sys/dev/usb/wlan/if_run.c Wed Dec 14 08:52:27 2011 (r228494) @@ -2720,7 +2720,6 @@ run_bulk_tx_callbackN(struct usb_xfer *x struct run_endpoint_queue *pq = &sc->sc_epq[index]; struct mbuf *m; usb_frlength_t size; - unsigned int len; int actlen; int sumlen; @@ -2783,13 +2782,10 @@ tr_setup: ieee80211_radiotap_tx(vap, m); } - /* align end on a 4-bytes boundary */ - len = (size + IEEE80211_CRC_LEN + m->m_pkthdr.len + 3) & ~3; + DPRINTFN(11, "sending frame len=%u @ index %d\n", + m->m_pkthdr.len, index); - DPRINTFN(11, "sending frame len=%u xferlen=%u @ index %d\n", - m->m_pkthdr.len, len, index); - - usbd_xfer_set_frame_len(xfer, 0, len); + usbd_xfer_set_frame_len(xfer, 0, size + m->m_pkthdr.len); usbd_xfer_set_priv(xfer, data); usbd_transfer_submit(xfer); @@ -2878,6 +2874,7 @@ run_bulk_tx_callback5(struct usb_xfer *x static void run_set_tx_desc(struct run_softc *sc, struct run_tx_data *data) { + static const uint8_t ztail[16]; struct mbuf *m = data->m; struct ieee80211com *ic = sc->sc_ifp->if_l2com; struct ieee80211vap *vap = data->ni->ni_vap; @@ -2934,6 +2931,13 @@ run_set_tx_desc(struct run_softc *sc, st if (vap->iv_opmode != IEEE80211_M_STA && !IEEE80211_QOS_HAS_SEQ(wh)) txwi->xflags |= RT2860_TX_NSEQ; + + /* + * Align end on a 4-byte boundary, pad 8 bytes (CRC + 4-byte padding), + * and be sure to zero those trailing bytes. + */ + m_append(m, ((m->m_pkthdr.len + 3) & ~3) - m->m_pkthdr.len + 8, + (c_caddr_t)ztail); } /* This function must be called locked */ From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 09:09:37 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C58C11065676; Wed, 14 Dec 2011 09:09:37 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B478F8FC1A; Wed, 14 Dec 2011 09:09:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBE99bvH090648; Wed, 14 Dec 2011 09:09:37 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBE99bS3090646; Wed, 14 Dec 2011 09:09:37 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112140909.pBE99bS3090646@svn.freebsd.org> From: Ed Schouten Date: Wed, 14 Dec 2011 09:09:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228495 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 09:09:37 -0000 Author: ed Date: Wed Dec 14 09:09:37 2011 New Revision: 228495 URL: http://svn.freebsd.org/changeset/base/228495 Log: Slightly alter the C1X definitions in in cdefs.h: - Add _Alignas(). Unfortunately this macro is only partially functional. The C1X standard will allow both an integer and a type name to be passed to this macro, while this macro only allows an integer. To be portable, one must use _Alignas(_Alignof(double)) to use type names. - Don't do _Static_assert() when __COUNTER__ is not supported. We'd better keep this implementation robust and allow it to be used in header files, without mysteriously breaking older compilers. Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Wed Dec 14 08:52:27 2011 (r228494) +++ head/sys/sys/cdefs.h Wed Dec 14 09:09:37 2011 (r228495) @@ -222,6 +222,7 @@ * Keywords added in C1X. */ #if defined(__cplusplus) && __cplusplus >= 201103L +#define _Alignas(e) alignas(e) #define _Alignof(e) alignof(e) #define _Noreturn [[noreturn]] #define _Static_assert(e, s) static_assert(e, s) @@ -231,21 +232,23 @@ #else /* Not supported. Implement them manually. */ #ifdef __GNUC__ +#define _Alignas(e) __attribute__((__aligned__(e))) #define _Alignof(e) __alignof__(e) #define _Noreturn __attribute__((__noreturn__)) #define _Thread_local __thread #else +#define _Alignas(e) #define _Alignof(e) __offsetof(struct { char __a; e __b; }, __b) #define _Noreturn #define _Thread_local #endif #ifdef __COUNTER__ #define _Static_assert(e, s) __Static_assert(e, __COUNTER__) -#else -#define _Static_assert(e, s) __Static_assert(e, __LINE__) -#endif #define __Static_assert(e, c) ___Static_assert(e, c) #define ___Static_assert(e, c) typedef char __assert ## c[(e) ? 1 : -1] +#else +#define _Static_assert(e, s) +#endif #endif #if __GNUC_PREREQ__(2, 96) From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 12:34:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 223BE106564A; Wed, 14 Dec 2011 12:34:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11A258FC15; Wed, 14 Dec 2011 12:34:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBECY2cP098630; Wed, 14 Dec 2011 12:34:02 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBECY24V098628; Wed, 14 Dec 2011 12:34:02 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201112141234.pBECY24V098628@svn.freebsd.org> From: John Baldwin Date: Wed, 14 Dec 2011 12:34:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228496 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 12:34:03 -0000 Author: jhb Date: Wed Dec 14 12:34:02 2011 New Revision: 228496 URL: http://svn.freebsd.org/changeset/base/228496 Log: Implement BUS_ADD_CHILD() for the isab(4) driver. It already calls bus_generic_probe() and bus_generic_attach() to handle drivers that add new children via identify methods. MFC after: 1 week Modified: head/sys/dev/pci/isa_pci.c Modified: head/sys/dev/pci/isa_pci.c ============================================================================== --- head/sys/dev/pci/isa_pci.c Wed Dec 14 09:09:37 2011 (r228495) +++ head/sys/dev/pci/isa_pci.c Wed Dec 14 12:34:02 2011 (r228496) @@ -67,6 +67,7 @@ static device_method_t isab_methods[] = DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ + DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_alloc_resource, isab_pci_alloc_resource), DEVMETHOD(bus_release_resource, isab_pci_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 12:42:40 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29D2F1065670; Wed, 14 Dec 2011 12:42:40 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from ainaz.pair.com (ainaz.pair.com [209.68.2.66]) by mx1.freebsd.org (Postfix) with ESMTP id 04FD98FC12; Wed, 14 Dec 2011 12:42:39 +0000 (UTC) Received: from 123.0.128.10.in-addr.arpa.noptr.antlabs.com (unknown [118.97.46.125]) by ainaz.pair.com (Postfix) with ESMTPSA id 7970F3F417; Wed, 14 Dec 2011 07:24:19 -0500 (EST) Date: Wed, 14 Dec 2011 20:24:22 +0800 (CIT) From: Gerald Pfeifer To: Kostik Belousov In-Reply-To: <20111212110826.GM50300@deviant.kiev.zoral.com.ua> Message-ID: References: <201112121103.pBCB3FuT097580@svn.freebsd.org> <20111212110826.GM50300@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: svn-src-head@freebsd.org, toolchain@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 12:42:40 -0000 On Mon, 12 Dec 2011, Kostik Belousov wrote: > Does anybody on toolchain@ know how to submit the gas change to > maintainers for inclusion into mainline, or better, can submit it > himself ? I assume that no copyright assignment is required for this > trivial flip of settings. I would just send to binutils@sourceware.org. And indeed, the patch is sufficiently small not to require copyright assignment or disclaimer or the like from what I can tell. Gerald From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 13:12:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4627D1065678; Wed, 14 Dec 2011 13:12:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 351668FC08; Wed, 14 Dec 2011 13:12:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBEDCu5b099825; Wed, 14 Dec 2011 13:12:56 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBEDCtM9099822; Wed, 14 Dec 2011 13:12:55 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201112141312.pBEDCtM9099822@svn.freebsd.org> From: Alexander Motin Date: Wed, 14 Dec 2011 13:12:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228497 - in head/sys/dev/ata: . chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 13:12:56 -0000 Author: mav Date: Wed Dec 14 13:12:55 2011 New Revision: 228497 URL: http://svn.freebsd.org/changeset/base/228497 Log: Add PCI IDs for the Intel ICH9M SATA controllers. MFC after: 2 weeks Modified: head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-intel.c Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Wed Dec 14 12:34:02 2011 (r228496) +++ head/sys/dev/ata/ata-pci.h Wed Dec 14 13:12:55 2011 (r228497) @@ -193,6 +193,10 @@ struct ata_pci_controller { #define ATA_I82801IB_AH4 0x29238086 #define ATA_I82801IB_R1 0x29258086 #define ATA_I82801IB_S2 0x29268086 +#define ATA_I82801IBM_S1 0x29288086 +#define ATA_I82801IBM_AH 0x29298086 +#define ATA_I82801IBM_R1 0x292a8086 +#define ATA_I82801IBM_S2 0x292d8086 #define ATA_I82801JIB_S1 0x3a208086 #define ATA_I82801JIB_AH 0x3a228086 #define ATA_I82801JIB_R1 0x3a258086 Modified: head/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-intel.c Wed Dec 14 12:34:02 2011 (r228496) +++ head/sys/dev/ata/chipsets/ata-intel.c Wed Dec 14 13:12:55 2011 (r228497) @@ -157,6 +157,10 @@ ata_intel_probe(device_t dev) { ATA_I82801IB_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_AH6, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, + { ATA_I82801IBM_S1, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9M" }, + { ATA_I82801IBM_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9M" }, + { ATA_I82801IBM_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9M" }, + { ATA_I82801IBM_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9M" }, { ATA_I82801JIB_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 13:25:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10FE3106564A; Wed, 14 Dec 2011 13:25:01 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F224F8FC1C; Wed, 14 Dec 2011 13:25:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBEDP0JV000332; Wed, 14 Dec 2011 13:25:00 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBEDP0OX000330; Wed, 14 Dec 2011 13:25:00 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112141325.pBEDP0OX000330@svn.freebsd.org> From: Eitan Adler Date: Wed, 14 Dec 2011 13:25:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228498 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 13:25:01 -0000 Author: eadler (ports committer) Date: Wed Dec 14 13:25:00 2011 New Revision: 228498 URL: http://svn.freebsd.org/changeset/base/228498 Log: - The previous commit (r228449) accidentally moved the vm.stats.vm.* sysctls to vm.stats.sys. Move them back. Noticed by: pho Reviewed by: bde (earlier version) Approved by: bz MFC after: 1 week Pointy hat to: me Modified: head/sys/vm/vm_meter.c Modified: head/sys/vm/vm_meter.c ============================================================================== --- head/sys/vm/vm_meter.c Wed Dec 14 13:12:55 2011 (r228497) +++ head/sys/vm/vm_meter.c Wed Dec 14 13:25:00 2011 (r228498) @@ -270,59 +270,62 @@ static SYSCTL_NODE(_vm_stats, OID_AUTO, "VM meter vm stats"); SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats"); -#define VM_STATS_SYS(var, descr) SYSCTL_PROC(_vm_stats_sys, OID_AUTO, var, \ - (CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_MPSAFE), &cnt.v_swtch, 0, vcnt, \ - "IU", descr); +#define VM_STATS(parent, var, descr) \ + SYSCTL_PROC(parent, OID_AUTO, var, \ + CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_MPSAFE, &cnt.var, 0, vcnt, \ + "IU", descr) +#define VM_STATS_VM(var, descr) VM_STATS(_vm_stats_vm, var, descr) +#define VM_STATS_SYS(var, descr) VM_STATS(_vm_stats_sys, var, descr) VM_STATS_SYS(v_swtch, "Context switches"); VM_STATS_SYS(v_trap, "Traps"); VM_STATS_SYS(v_syscall, "System calls"); VM_STATS_SYS(v_intr, "Device interrupts"); VM_STATS_SYS(v_soft, "Software interrupts"); -VM_STATS_SYS(v_vm_faults, "Address memory faults"); -VM_STATS_SYS(v_cow_faults, "Copy-on-write faults"); -VM_STATS_SYS(v_cow_optim, "Optimized COW faults") -VM_STATS_SYS(v_zfod, "Pages zero-filled on demand") -VM_STATS_SYS(v_ozfod, "Optimized zero fill pages") -VM_STATS_SYS(v_swapin, "Swap pager pageins") -VM_STATS_SYS(v_swapout, "Swap pager pageouts") -VM_STATS_SYS(v_swappgsin, "Swap pages swapped in") -VM_STATS_SYS(v_swappgsout, "Swap pages swapped out") -VM_STATS_SYS(v_vnodein, "Vnode pager pageins") -VM_STATS_SYS(v_vnodeout, "Vnode pager pageouts") -VM_STATS_SYS(v_vnodepgsin, "Vnode pages paged in") -VM_STATS_SYS(v_vnodepgsout, "Vnode pages paged out") -VM_STATS_SYS(v_intrans, "In transit page faults") -VM_STATS_SYS(v_reactivated, "Pages reactivated from free list") -VM_STATS_SYS(v_pdwakeups, "Pagedaemon wakeups") -VM_STATS_SYS(v_pdpages, "Pages analyzed by pagedaemon") -VM_STATS_SYS(v_tcached, "Total pages cached") -VM_STATS_SYS(v_dfree, "Pages freed by pagedaemon") -VM_STATS_SYS(v_pfree, "Pages freed by exiting processes") -VM_STATS_SYS(v_tfree, "Total pages freed") -VM_STATS_SYS(v_page_size, "Page size in bytes") -VM_STATS_SYS(v_page_count, "Total number of pages in system") -VM_STATS_SYS(v_free_reserved, "Pages reserved for deadlock") -VM_STATS_SYS(v_free_target, "Pages desired free") -VM_STATS_SYS(v_free_min, "Minimum low-free-pages threshold") -VM_STATS_SYS(v_free_count, "Free pages") -VM_STATS_SYS(v_wire_count, "Wired pages") -VM_STATS_SYS(v_active_count, "Active pages") -VM_STATS_SYS(v_inactive_target, "Desired inactive pages") -VM_STATS_SYS(v_inactive_count, "Inactive pages") -VM_STATS_SYS(v_cache_count, "Pages on cache queue") -VM_STATS_SYS(v_cache_min, "Min pages on cache queue") -VM_STATS_SYS(v_cache_max, "Max pages on cached queue") -VM_STATS_SYS(v_pageout_free_min, "Min pages reserved for kernel") -VM_STATS_SYS(v_interrupt_free_min, "Reserved pages for interrupt code") -VM_STATS_SYS(v_forks, "Number of fork() calls") -VM_STATS_SYS(v_vforks, "Number of vfork() calls") -VM_STATS_SYS(v_rforks, "Number of rfork() calls") -VM_STATS_SYS(v_kthreads, "Number of fork() calls by kernel") -VM_STATS_SYS(v_forkpages, "VM pages affected by fork()") -VM_STATS_SYS(v_vforkpages, "VM pages affected by vfork()") -VM_STATS_SYS(v_rforkpages, "VM pages affected by rfork()") -VM_STATS_SYS(v_kthreadpages, "VM pages affected by fork() by kernel") +VM_STATS_VM(v_vm_faults, "Address memory faults"); +VM_STATS_VM(v_cow_faults, "Copy-on-write faults"); +VM_STATS_VM(v_cow_optim, "Optimized COW faults"); +VM_STATS_VM(v_zfod, "Pages zero-filled on demand"); +VM_STATS_VM(v_ozfod, "Optimized zero fill pages"); +VM_STATS_VM(v_swapin, "Swap pager pageins"); +VM_STATS_VM(v_swapout, "Swap pager pageouts"); +VM_STATS_VM(v_swappgsin, "Swap pages swapped in"); +VM_STATS_VM(v_swappgsout, "Swap pages swapped out"); +VM_STATS_VM(v_vnodein, "Vnode pager pageins"); +VM_STATS_VM(v_vnodeout, "Vnode pager pageouts"); +VM_STATS_VM(v_vnodepgsin, "Vnode pages paged in"); +VM_STATS_VM(v_vnodepgsout, "Vnode pages paged out"); +VM_STATS_VM(v_intrans, "In transit page faults"); +VM_STATS_VM(v_reactivated, "Pages reactivated from free list"); +VM_STATS_VM(v_pdwakeups, "Pagedaemon wakeups"); +VM_STATS_VM(v_pdpages, "Pages analyzed by pagedaemon"); +VM_STATS_VM(v_tcached, "Total pages cached"); +VM_STATS_VM(v_dfree, "Pages freed by pagedaemon"); +VM_STATS_VM(v_pfree, "Pages freed by exiting processes"); +VM_STATS_VM(v_tfree, "Total pages freed"); +VM_STATS_VM(v_page_size, "Page size in bytes"); +VM_STATS_VM(v_page_count, "Total number of pages in system"); +VM_STATS_VM(v_free_reserved, "Pages reserved for deadlock"); +VM_STATS_VM(v_free_target, "Pages desired free"); +VM_STATS_VM(v_free_min, "Minimum low-free-pages threshold"); +VM_STATS_VM(v_free_count, "Free pages"); +VM_STATS_VM(v_wire_count, "Wired pages"); +VM_STATS_VM(v_active_count, "Active pages"); +VM_STATS_VM(v_inactive_target, "Desired inactive pages"); +VM_STATS_VM(v_inactive_count, "Inactive pages"); +VM_STATS_VM(v_cache_count, "Pages on cache queue"); +VM_STATS_VM(v_cache_min, "Min pages on cache queue"); +VM_STATS_VM(v_cache_max, "Max pages on cached queue"); +VM_STATS_VM(v_pageout_free_min, "Min pages reserved for kernel"); +VM_STATS_VM(v_interrupt_free_min, "Reserved pages for interrupt code"); +VM_STATS_VM(v_forks, "Number of fork() calls"); +VM_STATS_VM(v_vforks, "Number of vfork() calls"); +VM_STATS_VM(v_rforks, "Number of rfork() calls"); +VM_STATS_VM(v_kthreads, "Number of fork() calls by kernel"); +VM_STATS_VM(v_forkpages, "VM pages affected by fork()"); +VM_STATS_VM(v_vforkpages, "VM pages affected by vfork()"); +VM_STATS_VM(v_rforkpages, "VM pages affected by rfork()"); +VM_STATS_VM(v_kthreadpages, "VM pages affected by fork() by kernel"); SYSCTL_INT(_vm_stats_misc, OID_AUTO, zero_page_count, CTLFLAG_RD, &vm_page_zero_count, 0, "Number of zero-ed free pages"); From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 13:30:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6075C1065673; Wed, 14 Dec 2011 13:30:12 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 359538FC08; Wed, 14 Dec 2011 13:30:11 +0000 (UTC) Received: by lahl5 with SMTP id l5so426062lah.13 for ; Wed, 14 Dec 2011 05:30:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=dltrinXFEAWL69vKGtqFaNgH2xQjA6bpuZF76H/tYU0=; b=BK5a3qbxRWEmPkEWJ+ECx1EG5VJtmWAbNsERiCa7uAr2gXZsb5cya6nCIOIxNicZZp 3xY+DRMos/8peoZ2V7waLs3higloRRjUEOD/s+7BtCMhg8WpUr+xoS7tMRvAeSrm3Pio LdoWdMmzY3U8Mn68NU5BudDMHKN0heoOzxBRI= Received: by 10.152.103.71 with SMTP id fu7mr2168953lab.31.1323869410159; Wed, 14 Dec 2011 05:30:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.23.68 with HTTP; Wed, 14 Dec 2011 05:29:39 -0800 (PST) In-Reply-To: References: <4ee7a8c6.8e72e50a.3ab3.028bSMTPIN_ADDED@mx.google.com> From: Eitan Adler Date: Wed, 14 Dec 2011 08:29:39 -0500 Message-ID: To: Ivan Klymenko Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: r228377 to r228473 top not working X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 13:30:12 -0000 On Tue, Dec 13, 2011 at 2:43 PM, Eitan Adler wrote: > On Tue, Dec 13, 2011 at 2:34 PM, Ivan Klymenko wrote: >> Hi all! >> I have uname -a >> FreeBSD nonamehost 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r228473M: Tue De= c 13 20:09:45 EET 2011 =C2=A0 =C2=A0 ivan@nonamehost:/usr/obj/usr/src/sys/m= k9 =C2=A0amd64 >> After update source code from r228377 to r228473 "top" stopped working >> >> # top >> top: sysctl(vm.stats.vm.v_active_count...) failed: No such file or direc= tory >> # >> >> There are some ideas? > > Mea Culpa. I am currently testing a patch to fix this. Fixed in r228498 - sorry for taking so long. --=20 Eitan Adler From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 13:54:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E60F6106564A; Wed, 14 Dec 2011 13:54:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id A38658FC18; Wed, 14 Dec 2011 13:54:20 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:3cf8:b464:1fa8:24c] (unknown [IPv6:2001:7b8:3a7:0:3cf8:b464:1fa8:24c]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id BAB355C37; Wed, 14 Dec 2011 14:54:19 +0100 (CET) Message-ID: <4EE8AA8E.40004@FreeBSD.org> Date: Wed, 14 Dec 2011 14:54:22 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111130 Thunderbird/9.0 MIME-Version: 1.0 To: Gerald Pfeifer References: <201112121103.pBCB3FuT097580@svn.freebsd.org> <20111212110826.GM50300@deviant.kiev.zoral.com.ua> In-Reply-To: X-Enigmail-Version: 1.3.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Kostik Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, toolchain@freebsd.org Subject: Re: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 13:54:21 -0000 On 2011-12-14 13:24, Gerald Pfeifer wrote: > On Mon, 12 Dec 2011, Kostik Belousov wrote: >> Does anybody on toolchain@ know how to submit the gas change to >> maintainers for inclusion into mainline, or better, can submit it >> himself ? I assume that no copyright assignment is required for this >> trivial flip of settings. > > I would just send to binutils@sourceware.org. And indeed, the > patch is sufficiently small not to require copyright assignment > or disclaimer or the like from what I can tell. See the thread starting here: http://cygwin.com/ml/binutils/2011-12/msg00144.html From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 14:52:51 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 453E3106567B; Wed, 14 Dec 2011 14:52:51 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32E628FC1B; Wed, 14 Dec 2011 14:52:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBEEqppO003072; Wed, 14 Dec 2011 14:52:51 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBEEqo2f003070; Wed, 14 Dec 2011 14:52:50 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112141452.pBEEqo2f003070@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 14 Dec 2011 14:52:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228499 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 14:52:51 -0000 Author: glebius Date: Wed Dec 14 14:52:50 2011 New Revision: 228499 URL: http://svn.freebsd.org/changeset/base/228499 Log: Update this page to describe modern interfaces. Modified: head/share/man/man9/rtalloc.9 Modified: head/share/man/man9/rtalloc.9 ============================================================================== --- head/share/man/man9/rtalloc.9 Wed Dec 14 13:25:00 2011 (r228498) +++ head/share/man/man9/rtalloc.9 Wed Dec 14 14:52:50 2011 (r228499) @@ -28,160 +28,163 @@ .\" .\" $FreeBSD$ .\" -.Dd December 11, 2008 +.Dd December 14, 2011 .Dt RTALLOC 9 .Os .Sh NAME -.Nm rtalloc , -.Nm rtalloc_ign , -.Nm rtalloc1 , -.Nm rtfree +.Nm rtalloc1_fib , +.Nm rtalloc_ign_fib , +.Nm rtalloc_fib .Nd look up a route in the kernel routing table .Sh SYNOPSIS .In sys/types.h .In sys/socket.h .In net/route.h -.Ft void -.Fn rtalloc "struct route *ro" -.Ft void -.Fn rtalloc_ign "struct route *ro" "u_long flags" .Ft "struct rtentry *" -.Fn rtalloc1 "struct sockaddr *sa" "int report" "u_long flags" +.Fn rtalloc1_fib "struct sockaddr *dst" "int report" "u_long flags" "u_int fibnum" .Ft void -.Fn rtfree "struct rt_entry *rt" +.Fn rtalloc_fib "struct route *ro" "u_int fibnum" +.Ft void +.Fn rtalloc_ign_fib "struct route *ro" "u_long flags" "u_int fibnum" +.Fn RTFREE_LOCKED "struct rt_entry *rt" .Fn RTFREE "struct rt_entry *rt" .Fn RT_LOCK "struct rt_entry *rt" .Fn RT_UNLOCK "struct rt_entry *rt" .Fn RT_ADDREF "struct rt_entry *rt" .Fn RT_REMREF "struct rt_entry *rt" +.Ft void +.Fn rtfree "struct rt_entry *rt" +.Ft "struct rtentry *" +.Fn rtalloc1 "struct sockaddr *dst" "int report" "u_long flags" +.Ft void +.Fn rtalloc "struct route *ro" +.Ft void +.Fn rtalloc_ign "struct route *ro" "u_long flags" +.Pp +.Cd options RADIX_MPATH .Sh DESCRIPTION The kernel uses a radix tree structure to manage routes for the networking subsystem. +If compiled with +.Cd options RADIX_MPATH +kernel may maintain several independent forwarding information databases (FIBs). The .Fn rtalloc -family of routines is used by protocols to query this structure for a +family of routines is used by protocols to query these structures for a route corresponding to a particular end-node address, and to cause certain protocol\- and interface-specific actions to take place. -.\" XXX - -mdoc should contain a standard request for getting em and -.\" en dashes. .Pp -.Dv RTF_PRCLONING -flag is obsolete and thus ignored by facility. -If the -.Dv RTF_XRESOLVE -flag is set, then the -.Dv RTM_RESOLVE -message is sent instead on the -.Xr route 4 -socket interface, requesting that an external program resolve the -address in question and modify the route appropriately. -.Pp -The default interface is -.Fn rtalloc . -Its only argument is +The +.Fn rtalloc1_fib +function is the most general form of +.Fn rtalloc , +and all of the other forms are implemented as calls to it. +It takes a +.Fa "struct sockaddr *" +directly as the +.Fa dst +argument. +The second argument, +.Fa report , +controls whether the routing sockets are notified when a lookup fails. +The third argument, +.Fa flags , +is a combination of +the following values: +.Bl -item -offset indent +.It +.Dv RTF_RNH_LOCKED +indicates that the radix tree lock is already held +.El +.Pp +The last argument +.Fa fibnum +specifies number of forwarding information database (FIB) on which +the lookup should be performed. +In case of success the +.Fn rtalloc1_fib +function returns a pointer to a locked +.Vt "struct rtentry" +with an additional reference. +.Pp +The +.Fn rtalloc_fib +is the most simple variant. +Its main argument is .Fa ro , a pointer to a -.Dq Li "struct route" , +.Fa "struct route" , which is defined as follows: .Bd -literal -offset indent struct route { - struct sockaddr ro_dst; struct rtentry *ro_rt; + struct llentry *ro_lle; + struct sockaddr ro_dst; }; .Ed .Pp Thus, this function can only be used for address families which are smaller than the default -.Dq Li "struct sockaddr" . +.Ft "struct sockaddr" . Before calling -.Fn rtalloc +.Fn rtalloc_fib for the first time, callers should ensure that unused bits of the structure are set to zero. +The second argument +.Fa fibnum +is FIB number. +In case of success of the +.Fn rtalloc_fib +the +.Fa ro_rt +points to a valid and unlocked +.Xr rtentry 9 , +which has an additional reference put on it, freeing which is +responsibility of the caller. On subsequent calls, -.Fn rtalloc +.Fn rtalloc_fib returns without performing a lookup if .Fa ro->ro_rt is non-null and the .Dv RTF_UP -flag is set in the route's -.Li rt_flags +flag is set in the rtentry's +.Fa rt_flags field. .Pp The -.Fn rtalloc_ign -interface can be used when the caller does not want to receive -the returned -.Fa rtentry -locked. -The -.Fa ro -argument is the same as -.Fn rtalloc , -but there is additionally a +.Fn rtalloc_ign_fib +function is the same as the +.Fn rtalloc_fib , +but there is additional .Fa flags -argument, which is now only used to pass -.Dv RTF_RNH_LOCKED -indicating that the radix tree lock is already held. -Both -.Fn rtalloc -and -.Fn rtalloc_ign -functions return a pointer to an unlocked -.Vt "struct rtentry" . -.Pp -The -.Fn rtalloc1 -function is the most general form of -.Fn rtalloc -(and both of the other forms are implemented as calls to rtalloc1). -It does not use the -.Dq Li "struct route" , -and is therefore suitable for address families which require more -space than is in a traditional -.Dq Li "struct sockaddr" . -Instead, it takes a -.Dq Li "struct sockaddr *" -directly as the -.Fa sa -argument. -The second argument, -.Fa report , -controls whether the lower layers are notified when a lookup fails. -The third argument, -.Fa flags , -is a set of flags to ignore, as in -.Fn rtalloc_ign . -The -.Fn rtalloc1 -function returns a pointer to a locked -.Vt "struct rtentry" . +argument, which is same as in +.Fn rtalloc1_fib . .Pp The -.Fn rtfree -function frees a locked route entry, e.g., a previously allocated by -.Fn rtalloc1 . +.Fn RTFREE_LOCKED +macro is used to unref and possibly free a locked routing entry +with one our reference, for example previously allocated by +.Fn rtalloc1_fib . .Pp The .Fn RTFREE -macro is used to free unlocked route entries, previously allocated by -.Fn rtalloc +macro is used to unref and possibly free an unlocked route entries with +one our reference, for example previously allocated by +.Fn rtalloc_fib or -.Fn rtalloc_ign . -The -.Fn RTFREE -macro decrements the reference count on the routing table entry (see below), -and frees it if the reference count has reached zero. +.Fn rtalloc_ign_fib . .Pp -The preferred usage is allocating a route using -.Fn rtalloc -or -.Fn rtalloc_ign -and freeing using -.Fn RTFREE . +Both +.Fn RTFREE_LOCKED +and +.Fn RTFREE +macros decrement the reference count on the routing table entry, +and proceed with actual freeing if the reference count has reached zero. .Pp The .Fn RT_LOCK macro is used to lock a routing table entry. +.Pp The .Fn RT_UNLOCK macro is used to unlock a routing table entry. @@ -189,20 +192,53 @@ macro is used to unlock a routing table The .Fn RT_ADDREF macro increments the reference count on a previously locked route entry. +It should be used whenever a reference to an +.Xr rtentry 9 +is going to be stored outside the routing table. +.Pp The .Fn RT_REMREF macro decrements the reference count on a previously locked route entry. -.Sh RETURN VALUES +Its usage is contrary to +.Fn RT_ADDREF . +.Pp The -.Fn rtalloc , -.Fn rtalloc_ign -and .Fn rtfree -functions do not return a value. +function does the actual free of the routing table entry, and shouldn't +be called directly by facilities, that just perform routing table lookups. +.Sh LEGACY INTERFACE +Prior to introduction of multiple routing tables functions did not +require the +.Fa "u_int fibnum" +argument. +Legacy +.Fn rtalloc1 , +.Fn rtalloc +and +.Fn rtalloc_ign +functions are kept for compatibility, and are equivalent to +calling new interface with +.Fa fibnum +argument equal to +.Va 0 , +which implies default forwarding table. +.Sh RETURN VALUES The -.Fn rtalloc1 -function returns a pointer to a routing-table entry if it succeeds, +.Fn rtalloc1_fib +function returns a pointer to a locked routing-table entry if it succeeds, otherwise a null pointer. +The +.Fn rtalloc_fib +and +.Fn rtalloc_ign_fib +functions do not return a value, but they fill in the +.Fa *ro_rt +member of the +.Fa *ro +argument with a pointer to an unlocked routing-table entry if they +succeed, otherwise a null pointer. +In a case of success all functions put a reference on the +routing-table entry, freeing of which is responsibility of the caller. Lack of a route should in most cases be translated to the .Xr errno 2 @@ -213,7 +249,7 @@ value .Xr rtentry 9 .Sh HISTORY The -.Nm +.Nm rtalloc facility first appeared in .Bx 4.2 , although with much different internals. @@ -227,14 +263,11 @@ first appeared in .Fx 2.0 . Routing table locking was introduced in .Fx 5.2 . +Multiple routing tables were introduced in +.Fx 8.0 . .Sh AUTHORS -This manual page was written by -.An Garrett Wollman , -as were the changes to implement -.Dv RTF_PRCLONING -and the -.Fn rtalloc_ign -function and the -.Fa flags -argument to -.Fn rtalloc1 . +The original version of this manual page was written by +.An -nosplit +.An "Garrett Wollman" . +It was significantly updated by +.An "Gleb Smirnoff" . From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 14:55:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 711C8106566B; Wed, 14 Dec 2011 14:55:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6047C8FC0A; Wed, 14 Dec 2011 14:55:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBEEtKbV003196; Wed, 14 Dec 2011 14:55:20 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBEEtKMc003194; Wed, 14 Dec 2011 14:55:20 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112141455.pBEEtKMc003194@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 14 Dec 2011 14:55:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228500 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 14:55:20 -0000 Author: glebius Date: Wed Dec 14 14:55:19 2011 New Revision: 228500 URL: http://svn.freebsd.org/changeset/base/228500 Log: More MLINKS for rtalloc.9 Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Wed Dec 14 14:52:50 2011 (r228499) +++ head/share/man/man9/Makefile Wed Dec 14 14:55:19 2011 (r228500) @@ -1023,8 +1023,12 @@ MLINKS+=rmlock.9 rm_destroy.9 \ rmlock.9 rm_wunlock.9 MLINKS+=rtalloc.9 rtalloc1.9 \ rtalloc.9 rtalloc_ign.9 \ + rtalloc.9 RTFREE_LOCKED.9 \ rtalloc.9 RTFREE.9 \ - rtalloc.9 rtfree.9 + rtalloc.9 rtfree.9 \ + rtalloc.9 rtalloc1_fib.9 \ + rtalloc.9 rtalloc_ign_fib.9 \ + rtalloc.9 rtalloc_fib.9 MLINKS+=runqueue.9 choosethread.9 \ runqueue.9 procrunnable.9 \ runqueue.9 remrunqueue.9 \ From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 15:19:04 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0202A1065676; Wed, 14 Dec 2011 15:19:04 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id 7C6DF8FC0A; Wed, 14 Dec 2011 15:19:03 +0000 (UTC) Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pBEFIxBe012953 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 15 Dec 2011 02:19:01 +1100 Date: Thu, 15 Dec 2011 02:18:59 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Schouten In-Reply-To: <201112140909.pBE99bS3090646@svn.freebsd.org> Message-ID: <20111214234615.B3839@besplex.bde.org> References: <201112140909.pBE99bS3090646@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228495 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 15:19:04 -0000 On Wed, 14 Dec 2011, Ed Schouten wrote: > Log: > Slightly alter the C1X definitions in in cdefs.h: > > - Add _Alignas(). Unfortunately this macro is only partially functional. > The C1X standard will allow both an integer and a type name to be > passed to this macro, while this macro only allows an integer. To be > portable, one must use _Alignas(_Alignof(double)) to use type names. This is still quite broken. > - Don't do _Static_assert() when __COUNTER__ is not supported. We'd > better keep this implementation robust and allow it to be used in > header files, without mysteriously breaking older compilers. Not sure about this. > Modified: head/sys/sys/cdefs.h > ============================================================================== > --- head/sys/sys/cdefs.h Wed Dec 14 08:52:27 2011 (r228494) > +++ head/sys/sys/cdefs.h Wed Dec 14 09:09:37 2011 (r228495) > @@ -222,6 +222,7 @@ > * Keywords added in C1X. > */ > #if defined(__cplusplus) && __cplusplus >= 201103L > +#define _Alignas(e) alignas(e) > #define _Alignof(e) alignof(e) > #define _Noreturn [[noreturn]] > #define _Static_assert(e, s) static_assert(e, s) > @@ -231,21 +232,23 @@ > #else > /* Not supported. Implement them manually. */ > #ifdef __GNUC__ > +#define _Alignas(e) __attribute__((__aligned__(e))) This breaks versions of gcc that don't have __attribute__ or __aligned__. Elsewhere in the same file, use of __attribute__ is restricted starting with the condition: #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && \ !defined(__INTEL_COMPILER) (this actually gives the starting point for 2 attributes, with many necessary and unnecessary convolutions -- see below). and use of __aligned__ is carefully restricted by the condition #if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER) (now it starts with gcc-2.7 where the above starts with gcc-2.5, since __aligned__ apparently wasn't in the original set of attributes). The other places give a definition of __aligned() that can almost be used here. There is a bogus one for lint and a duplicate one for __INTEL_COMPILER. But there is none for !__GNUC_PREREQ__(2, 7) && !__INTEL_COMPILER. That is, all cases where the compiler is either gcc-before-2.6, or non-gcc other than lint and icc, are already broken. > #define _Alignof(e) __alignof__(e) This one mainly has a style bug. __alignof__ would be be spelled __alignof if this were FreeBSD code. gcc has accepted all of alignof(), __alignof() and __alignof__() for a long time. I checked this for some gccs back to gcc-2.95.4. It might even work for gcc-1. FreeBSD uses the extra trailing underscores for __attribute__(()) and individual attributes because unlike for __alignof() and __typeof(), gcc used to require them and changing this now would give style bugs. gcc-4.2.1 accepts the __aligned__ attribute, but gcc-3.3.3 doesn't. I don't know when __attribute(()) started working. I checked it for some gccs back to gcc-2.95.4, and all accepted it. > #define _Noreturn __attribute__((__noreturn__)) Elsewhere in this file, the __noreturn__ attribute is handled like the __aligned__ attribute, but more carefully, with many style bugs but no bugs as far as I can see: - For lint, the macro that uses it (__dead2) is bogusly defined as nothing. I thought that lint bogusly defines __GNUC__, but can't find this now. Lint should not define __GNUC__ since it only supports a tiny subsets of gcc features like __attribute__(), even with -g. If lint defined __GNUC__, then the extra ifdef for it would be be justified for some of the macros including __dead2/_Noreturn, since __dead2 has no semantic effect so it is safe to make it null for compilers that don't support it. If lint doesn't define __GNUC__ then for __dead2 and now hopefully for _Noreturn, an extra ifdef is not needed since lint is given a null definition in the section for nondescript non-gcc compilers. - For non-gcc, or gcc < 2.5, and not icc, __dead2 is defined as nothing under the condition: #if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER) - For gcc-2.5 and gcc-2.6, and icc, __attribute__((__noreturn__)) is used to define __dead2 under the condition: #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && \ !defined(__INTEL_COMPILER) Note the style bug in this condition (it doesn't use GNUC_PREREQ()). - For gcc >= 2.7, the definition of __dead2 is duplicated under the condition: #if __GNUC_PREREQ(2, 7) - For icc, the definition of __dead2 is duplicated yet again, under the condition: #if defined(__INTEL_COMPILER) Note the style bug in this (defined() when ifdef would do). There are 2 other definitions under the gcc-2.5, gcc-2.6, or icc ifdef. Only the one for __unused belongs there, since its attribute is new in gcc-2.7. The others should be define without duplication for gcc >= 2.5. Under the the gcc >= 2.7 and separate icc condition, there are definitions to use 7 attributes. All of these have style bugs or worse: - __noreturn__ attribute. Shouldn't be duplicated. - __const__ attribute. Shouldn't be duplicated. - __unused__ attribute. May actually be correct. - __used__ attribute. Doesn't belong here, since it is much newer than gcc-2.7. It is in gcc-3.3.3 but not in gcc-3.2.2. - __packed__ attribute. Not defined for older gcc. - __aligned__ attribute. Not defined for older gcc. - __section attribute. Not defined for older gcc. These definitions have lots more of bugs: - random order - all duplicated verbatim for icc. > #define _Thread_local __thread This has similar problems. __thread doesn't work for at least gcc-2.95.4 and gcc-3.2.2, but works (compiles at least) for gcc-3.3.3. > #else > +#define _Alignas(e) > #define _Alignof(e) __offsetof(struct { char __a; e __b; }, __b) > #define _Noreturn > #define _Thread_local > #endif _Alignas() can be defined in terms of __align() for all cases without repeating the ifdefs, after fixing old bugs for __align(). _Noreturn can't be handled so simply. Its use has syntactic differences. I have already complained about using it in breaking portability in a critical header. All these messy ifdefs here are just obfuscations if they don't work for . After writing the above and running some more tests, the limits of the breakage are clearer: - the __noreturn__ attribute is apparently new in gcc-2.5. Before that, the old __pure macro presumably worked. __pure was implemented as __volatile, and has the same syntax as C1x _Noreturn (it must be before the function name). - the __noreturn__ attribute (and presumably other attributes) is a syntax errors if it is used before a function name (presumably the same for before a variable name) in gcc-2.95.4. It works before a function name in gcc-3.2.2. Thus to work with all compilers that it used to work with, must either use only __dead2 after function names like it used to, or if it wants to use _Noreturn then it must use both _Noreturn before function names (to support newer compilers) and __dead2 after function names (to support older compilers), and _Noreturn must be more carefully ifdefed here. There are the following compilers and ranges of compilers: - not gcc and not icc and not clang: both macros null - icc: hopefully like newer gcc - clang: hopefully like newer gcc - gcc-1: like gcc-2.early - gcc-2.early: define __dead2 as null; define _Noreturn as either __volatile (to bring back the special support for gcc-1 that I deprecated in 1996 and removed in 1998) or define _Noreturn as null (to preserve the removal, so that gcc-2.early is treated as a nondescript compiler). _Noreturn restores the syntax differences that made the gcc-2.early support touch much more than . Now we have the syntax differences in another way, so restoring the gcc-2.early support only takes 1 line. - gcc-2.5 through gcc-3.2.2 or a little earlier: must define _Noreturn as null, and to restore functionality in , restore the uses of __dead2 there. Don't forget to fix the new style bugs there (see the 4.4BSD version for normal style with directives before function names). - post gcc-3.2.2: can define _Noreturn as non-null and __dead2 as null, or vice versa, or both non-null. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 15:19:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 374401065680; Wed, 14 Dec 2011 15:19:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24C988FC1C; Wed, 14 Dec 2011 15:19:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBEFJeax004006; Wed, 14 Dec 2011 15:19:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBEFJe5i003999; Wed, 14 Dec 2011 15:19:40 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201112141519.pBEFJe5i003999@svn.freebsd.org> From: Alexander Motin Date: Wed, 14 Dec 2011 15:19:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228501 - in head/share/man: man4 man7 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 15:19:41 -0000 Author: mav Date: Wed Dec 14 15:19:40 2011 New Revision: 228501 URL: http://svn.freebsd.org/changeset/base/228501 Log: After several suggestions from people, move eventtimers page from 7 to 4. Added: head/share/man/man4/eventtimers.4 - copied unchanged from r228500, head/share/man/man7/eventtimers.7 Deleted: head/share/man/man7/eventtimers.7 Modified: head/share/man/man4/Makefile head/share/man/man4/atrtc.4 head/share/man/man4/attimer.4 head/share/man/man4/hpet.4 head/share/man/man7/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Dec 14 14:55:19 2011 (r228500) +++ head/share/man/man4/Makefile Wed Dec 14 15:19:40 2011 (r228501) @@ -116,6 +116,7 @@ MAN= aac.4 \ epair.4 \ esp.4 \ et.4 \ + eventtimers.4 \ exca.4 \ faith.4 \ fatm.4 \ Modified: head/share/man/man4/atrtc.4 ============================================================================== --- head/share/man/man4/atrtc.4 Wed Dec 14 14:55:19 2011 (r228500) +++ head/share/man/man4/atrtc.4 Wed Dec 14 15:19:40 2011 (r228501) @@ -53,4 +53,4 @@ Event timer provided by the driver is ir .Sh SEE ALSO .Xr attimer 4 , .Xr hpet 4 , -.Xr eventtimers 7 +.Xr eventtimers 4 Modified: head/share/man/man4/attimer.4 ============================================================================== --- head/share/man/man4/attimer.4 Wed Dec 14 14:55:19 2011 (r228500) +++ head/share/man/man4/attimer.4 Wed Dec 14 15:19:40 2011 (r228501) @@ -72,4 +72,4 @@ Event timer provided by the driver is ir .Sh SEE ALSO .Xr atrtc 4 , .Xr hpet 4 , -.Xr eventtimers 7 +.Xr eventtimers 4 Copied: head/share/man/man4/eventtimers.4 (from r228500, head/share/man/man7/eventtimers.7) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/eventtimers.4 Wed Dec 14 15:19:40 2011 (r228501, copy of r228500, head/share/man/man7/eventtimers.7) @@ -0,0 +1,133 @@ +.\" Copyright (c) 2010 Alexander Motin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd September 15, 2010 +.Dt EVENTTIMERS 4 +.Os +.Sh NAME +.Nm eventtimers +.Nd kernel event timers subsystem +.Sh SYNOPSIS +Kernel uses several types of time-related devices, such as: real time clocks, +time counters and event timers. +Real time clocks responsible for tracking real world time, mostly when system +is down. +Time counters are responsible for generation of monotonically increasing +timestamps for precise uptime tracking purposes, when system is running. +Event timers are responsible for generating interrupts at specified time or +periodically, to run different time-based events. +This page is about the last. +.Sh DESCRIPTION +Kernel uses time-based events for many different purposes: scheduling, +statistics, time keeping, profiling and many other things, based on +.Xr callout 9 +mechanism. +These purposes now grouped into three main callbacks: +.Bl -tag +.It hardclock() +.Xr callout 9 +and timekeeping events entry. Called with frequency defined by hz variable, +usually 1000Hz. +.It statclock() +statistics and scheduler events entry. Called with frequency about 128Hz. +.It profclock() +profiler events entry. When enabled, called with frequency about 8KHz. +.El +Different platforms provide different kinds of timer hardware. +The goal of the event timers subsystem is to provide unified way to control +that hardware, and to use it, supplying kernel with all required time-based +events. +.Pp +Each driver implementing event timers, registers them at the subsystem. +It is possible to see the list of present event timers, like this, via +.Va kern.eventtimer +sysctl: +.Bd -literal +kern.eventtimer.choice: HPET(550) LAPIC(400) i8254(100) RTC(0) +kern.eventtimer.et.LAPIC.flags: 15 +kern.eventtimer.et.LAPIC.frequency: 0 +kern.eventtimer.et.LAPIC.quality: 400 +kern.eventtimer.et.i8254.flags: 1 +kern.eventtimer.et.i8254.frequency: 1193182 +kern.eventtimer.et.i8254.quality: 100 +kern.eventtimer.et.RTC.flags: 17 +kern.eventtimer.et.RTC.frequency: 32768 +kern.eventtimer.et.RTC.quality: 0 +kern.eventtimer.et.HPET.flags: 7 +kern.eventtimer.et.HPET.frequency: 14318180 +kern.eventtimer.et.HPET.quality: 550 +.Ed +, where: +.Bl -tag +.It Va kern.eventtimer.et. Ns Ar X Ns Va .flags +bitmask, defining event timer capabilities: +.Bl -tag -compact +.It 1 +periodic mode supported, +.It 2 +one-shot mode supported, +.It 4 +timer is per-CPU, +.It 8 +timer may stop when CPU goes to sleep state, +.It 16 +timer supports only power-of-2 divisors. +.El +.It Va kern.eventtimer.et. Ns Ar X Ns Va .frequency +timer base frequency, +.It Va kern.eventtimer.et. Ns Ar X Ns Va .quality +integral value, defining how good is this timer, comparing to others. +.El +.Pp +Timers management code of the kernel chooses one timer from that list. +Current choice can be read and affected via +.Va kern.eventtimer.timer +tunable/sysctl. +Several other tunables/sysctls are affecting how exactly this timer is used: +.Bl -tag +.It Va kern.eventtimer.periodic +allows to choose periodic and one-shot operation mode. +In periodic mode, periodic interrupts from timer hardware are taken as the +only source of time for time events. +One-shot mode instead uses currently selected time counter to precisely +schedule all needed events and programs event timer to generate interrupt +exactly in specified time. +Default value depends of chosen timer capabilities, but one-shot mode is +preferred, until other is forced by user or hardware. +.It Va kern.eventtimer.singlemul +in periodic mode specifies how much times higher timer frequency should be, +to not strictly alias hardclock() and statclock() events. Default values are +1, 2 or 4, depending on configured HZ value. +.It Va kern.eventtimer.idletick +makes each CPU to receive every timer interrupt independently of whether they +busy or not. By default this options is disabled. If chosen timer is per-CPU +and runs in periodic mode, this option has no effect - all interrupts are +always generating. +.El +.Sh SEE ALSO +.Xr attimer 4 , +.Xr atrtc 4 , +.Xr hpet 4 Modified: head/share/man/man4/hpet.4 ============================================================================== --- head/share/man/man4/hpet.4 Wed Dec 14 14:55:19 2011 (r228500) +++ head/share/man/man4/hpet.4 Wed Dec 14 15:19:40 2011 (r228501) @@ -96,7 +96,7 @@ of these comparators has own unsharable .Xr acpi 4 , .Xr atrtc 4 , .Xr attimer 4 , -.Xr eventtimers 7 +.Xr eventtimers 4 .Sh HISTORY The .Nm Modified: head/share/man/man7/Makefile ============================================================================== --- head/share/man/man7/Makefile Wed Dec 14 14:55:19 2011 (r228500) +++ head/share/man/man7/Makefile Wed Dec 14 15:19:40 2011 (r228501) @@ -10,7 +10,6 @@ MAN= adding_user.7 \ c99.7 \ development.7 \ environ.7 \ - eventtimers.7 \ ffs.7 \ firewall.7 \ hier.7 \ From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 15:39:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18E6D1065672; Wed, 14 Dec 2011 15:39:52 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 074CD8FC17; Wed, 14 Dec 2011 15:39:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBEFdp9i004655; Wed, 14 Dec 2011 15:39:51 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBEFdp1c004652; Wed, 14 Dec 2011 15:39:51 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201112141539.pBEFdp1c004652@svn.freebsd.org> From: Fabien Thomas Date: Wed, 14 Dec 2011 15:39:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228502 - head/sys/dev/viawd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 15:39:52 -0000 Author: fabient Date: Wed Dec 14 15:39:51 2011 New Revision: 228502 URL: http://svn.freebsd.org/changeset/base/228502 Log: Rework the attachement to probe directly on isab(4). Depend on r228496. Requested by: jhb MFC after: 1 month Modified: head/sys/dev/viawd/viawd.c head/sys/dev/viawd/viawd.h Modified: head/sys/dev/viawd/viawd.c ============================================================================== --- head/sys/dev/viawd/viawd.c Wed Dec 14 15:19:40 2011 (r228501) +++ head/sys/dev/viawd/viawd.c Wed Dec 14 15:39:51 2011 (r228502) @@ -42,10 +42,9 @@ __FBSDID("$FreeBSD$"); #include "viawd.h" -#define viawd_read_wd_4(sc, off) \ - bus_space_read_4((sc)->wd_bst, (sc)->wd_bsh, (off)) -#define viawd_write_wd_4(sc, off, val) \ - bus_space_write_4((sc)->wd_bst, (sc)->wd_bsh, (off), (val)) +#define viawd_read_4(sc, off) bus_read_4((sc)->wd_res, (off)) +#define viawd_write_4(sc, off, val) \ + bus_write_4((sc)->wd_res, (off), (val)) static struct viawd_device viawd_devices[] = { { DEVICEID_VT8251, "VIA VT8251 watchdog timer" }, @@ -58,37 +57,17 @@ static struct viawd_device viawd_devices static devclass_t viawd_devclass; -static device_t -viawd_find(struct viawd_device **id_p) -{ - struct viawd_device *id; - device_t sb_dev = NULL; - - /* Look for a supported VIA south bridge. */ - for (id = viawd_devices; id->desc != NULL; ++id) - if ((sb_dev = pci_find_device(VENDORID_VIA, id->device)) != NULL) - break; - - if (sb_dev == NULL) - return (NULL); - - if (id_p != NULL) - *id_p = id; - - return (sb_dev); -} - static void viawd_tmr_state(struct viawd_softc *sc, int enable) { uint32_t reg; - reg = viawd_read_wd_4(sc, VIAWD_MEM_CTRL); + reg = viawd_read_4(sc, VIAWD_MEM_CTRL); if (enable) reg |= VIAWD_MEM_CTRL_TRIGGER | VIAWD_MEM_CTRL_ENABLE; else reg &= ~VIAWD_MEM_CTRL_ENABLE; - viawd_write_wd_4(sc, VIAWD_MEM_CTRL, reg); + viawd_write_4(sc, VIAWD_MEM_CTRL, reg); } static void @@ -101,7 +80,7 @@ viawd_tmr_set(struct viawd_softc *sc, un else if (timeout > VIAWD_MEM_COUNT_MAX) timeout = VIAWD_MEM_COUNT_MAX; - viawd_write_wd_4(sc, VIAWD_MEM_COUNT, timeout); + viawd_write_4(sc, VIAWD_MEM_COUNT, timeout); sc->timeout = timeout; } @@ -127,35 +106,40 @@ viawd_event(void *arg, unsigned int cmd, viawd_tmr_state(sc, 0); } -static void -viawd_identify(driver_t *driver, device_t parent) +/* Look for a supported VIA south bridge. */ +static struct viawd_device * +viawd_find(device_t dev) { - device_t dev; - device_t sb_dev; - struct viawd_device *id_p; + struct viawd_device *id; - sb_dev = viawd_find(&id_p); - if (sb_dev == NULL) - return; + if (pci_get_vendor(dev) != VENDORID_VIA) + return (NULL); + for (id = viawd_devices; id->desc != NULL; id++) + if (pci_get_device(dev) == id->device) + return (id); + return (NULL); +} - /* Good, add child to bus. */ - if ((dev = device_find_child(parent, driver->name, 0)) == NULL) - dev = BUS_ADD_CHILD(parent, 0, driver->name, 0); +static void +viawd_identify(driver_t *driver, device_t parent) +{ - if (dev == NULL) + if (viawd_find(parent) == NULL) return; - device_set_desc_copy(dev, id_p->desc); + if (device_find_child(parent, driver->name, -1) == NULL) + BUS_ADD_CHILD(parent, 0, driver->name, 0); } static int viawd_probe(device_t dev) { + struct viawd_device *id; - /* Do not claim some ISA PnP device by accident. */ - if (isa_get_logicalid(dev) != 0) - return (ENXIO); - return (0); + id = viawd_find(device_get_parent(dev)); + KASSERT(id != NULL, ("parent should be a valid VIA SB")); + device_set_desc(dev, id->desc); + return (BUS_PROBE_GENERIC); } static int @@ -163,13 +147,12 @@ viawd_attach(device_t dev) { device_t sb_dev; struct viawd_softc *sc; - struct viawd_device *id_p; uint32_t pmbase, reg; sc = device_get_softc(dev); sc->dev = dev; - sb_dev = viawd_find(&id_p); + sb_dev = device_get_parent(dev); if (sb_dev == NULL) { device_printf(dev, "Can not find watchdog device.\n"); goto fail; @@ -193,16 +176,14 @@ viawd_attach(device_t dev) device_printf(dev, "Unable to map watchdog memory\n"); goto fail; } - sc->wd_bst = rman_get_bustag(sc->wd_res); - sc->wd_bsh = rman_get_bushandle(sc->wd_res); /* Check if watchdog fired last boot. */ - reg = viawd_read_wd_4(sc, VIAWD_MEM_CTRL); + reg = viawd_read_4(sc, VIAWD_MEM_CTRL); if (reg & VIAWD_MEM_CTRL_FIRED) { device_printf(dev, "ERROR: watchdog rebooted the system\n"); /* Reset bit state. */ - viawd_write_wd_4(sc, VIAWD_MEM_CTRL, reg); + viawd_write_4(sc, VIAWD_MEM_CTRL, reg); } /* Register the watchdog event handler. */ @@ -233,7 +214,7 @@ viawd_detach(device_t dev) * Do not stop the watchdog on shutdown if active but bump the * timer to avoid spurious reset. */ - reg = viawd_read_wd_4(sc, VIAWD_MEM_CTRL); + reg = viawd_read_4(sc, VIAWD_MEM_CTRL); if (reg & VIAWD_MEM_CTRL_ENABLE) { viawd_tmr_set(sc, VIAWD_TIMEOUT_SHUTDOWN); viawd_tmr_state(sc, 1); @@ -264,23 +245,4 @@ static driver_t viawd_driver = { sizeof(struct viawd_softc), }; -static int -viawd_modevent(module_t mode, int type, void *data) -{ - int error = 0; - - switch (type) { - case MOD_LOAD: - printf("viawd module loaded\n"); - break; - case MOD_UNLOAD: - printf("viawd module unloaded\n"); - break; - case MOD_SHUTDOWN: - printf("viawd module shutting down\n"); - break; - } - return (error); -} - -DRIVER_MODULE(viawd, isa, viawd_driver, viawd_devclass, viawd_modevent, NULL); +DRIVER_MODULE(viawd, isab, viawd_driver, viawd_devclass, NULL, NULL); Modified: head/sys/dev/viawd/viawd.h ============================================================================== --- head/sys/dev/viawd/viawd.h Wed Dec 14 15:19:40 2011 (r228501) +++ head/sys/dev/viawd/viawd.h Wed Dec 14 15:39:51 2011 (r228502) @@ -40,8 +40,6 @@ struct viawd_softc { int wd_rid; struct resource *wd_res; - bus_space_tag_t wd_bst; - bus_space_handle_t wd_bsh; eventhandler_tag ev_tag; unsigned int timeout; From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 16:41:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DF781065670; Wed, 14 Dec 2011 16:41:44 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 051E18FC0C; Wed, 14 Dec 2011 16:41:44 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 01EB246B42; Wed, 14 Dec 2011 11:41:43 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 5973DB963; Wed, 14 Dec 2011 11:41:42 -0500 (EST) From: John Baldwin To: Fabien Thomas Date: Wed, 14 Dec 2011 11:19:15 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201112141539.pBEFdp1c004652@svn.freebsd.org> In-Reply-To: <201112141539.pBEFdp1c004652@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201112141119.15733.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 14 Dec 2011 11:41:42 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228502 - head/sys/dev/viawd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 16:41:44 -0000 On Wednesday, December 14, 2011 10:39:51 am Fabien Thomas wrote: > Author: fabient > Date: Wed Dec 14 15:39:51 2011 > New Revision: 228502 > URL: http://svn.freebsd.org/changeset/base/228502 > > Log: > Rework the attachement to probe directly on isab(4). > Depend on r228496. > > Requested by: jhb > MFC after: 1 month Thanks! -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 16:47:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC5F91065670; Wed, 14 Dec 2011 16:47:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A03F8FC08; Wed, 14 Dec 2011 16:47:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBEGlrQf006782; Wed, 14 Dec 2011 16:47:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBEGlrLl006778; Wed, 14 Dec 2011 16:47:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112141647.pBEGlrLl006778@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 14 Dec 2011 16:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228503 - in head/libexec/rtld-elf: . amd64 i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 16:47:53 -0000 Author: kib Date: Wed Dec 14 16:47:53 2011 New Revision: 228503 URL: http://svn.freebsd.org/changeset/base/228503 Log: _rtld_bind() read-locks the bind lock, and possible plt resolution from the dispatcher would also acquire bind lock in read mode, which is the supported operation. plt is explicitely designed to allow safe multithreaded updates, so the shared lock do not cause problems. The error in r228435 is that it allows read lock acquisition after the write lock for the bind block. If we dlopened the shared object that contains IRELATIVE or jump slot which target is STT_GNU_IFUNC, then possible recursive plt resolve from the dispatcher would cause it. Postpone the resolution for irelative/ifunc right before initializers are called, and drop bind lock around calls to dispatcher. Use initlist to iterate over the objects instead of the ->next, due to drop of the bind lock in iteration. For i386/reloc.c:reloc_iresolve(), fix calculation of the dispatch function address for dso, by taking into account possible non-zero relocbase. MFC after: 3 weeks Modified: head/libexec/rtld-elf/amd64/reloc.c head/libexec/rtld-elf/i386/reloc.c head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/amd64/reloc.c ============================================================================== --- head/libexec/rtld-elf/amd64/reloc.c Wed Dec 14 15:39:51 2011 (r228502) +++ head/libexec/rtld-elf/amd64/reloc.c Wed Dec 14 16:47:53 2011 (r228503) @@ -413,6 +413,8 @@ reloc_iresolve(Obj_Entry *obj, RtldLockS const Elf_Rela *relalim; const Elf_Rela *rela; + if (!obj->irelative) + return (0); relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); for (rela = obj->pltrela; rela < relalim; rela++) { Elf_Addr *where, target, *ptr; @@ -424,11 +426,14 @@ reloc_iresolve(Obj_Entry *obj, RtldLockS case R_X86_64_IRELATIVE: ptr = (Elf_Addr *)(obj->relocbase + rela->r_addend); where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + lock_release(rtld_bind_lock, lockstate); target = ((Elf_Addr (*)(void))ptr)(); + wlock_acquire(rtld_bind_lock, lockstate); *where = target; break; } } + obj->irelative = false; return (0); } @@ -455,13 +460,15 @@ reloc_gnu_ifunc(Obj_Entry *obj, RtldLock return (-1); if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) continue; + lock_release(rtld_bind_lock, lockstate); target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); + wlock_acquire(rtld_bind_lock, lockstate); reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); break; } } obj->gnu_ifunc = false; - return 0; + return (0); } void Modified: head/libexec/rtld-elf/i386/reloc.c ============================================================================== --- head/libexec/rtld-elf/i386/reloc.c Wed Dec 14 15:39:51 2011 (r228502) +++ head/libexec/rtld-elf/i386/reloc.c Wed Dec 14 16:47:53 2011 (r228503) @@ -371,16 +371,21 @@ reloc_iresolve(Obj_Entry *obj, RtldLockS const Elf_Rel *rel; Elf_Addr *where, target; + if (!obj->irelative) + return (0); rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); for (rel = obj->pltrel; rel < rellim; rel++) { switch (ELF_R_TYPE(rel->r_info)) { case R_386_IRELATIVE: where = (Elf_Addr *)(obj->relocbase + rel->r_offset); - target = ((Elf_Addr (*)(void))(*where))(); + lock_release(rtld_bind_lock, lockstate); + target = ((Elf_Addr (*)(void))(obj->relocbase + *where))(); + wlock_acquire(rtld_bind_lock, lockstate); *where = target; break; } } + obj->irelative = false; return (0); } @@ -407,7 +412,9 @@ reloc_gnu_ifunc(Obj_Entry *obj, RtldLock return (-1); if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) continue; + lock_release(rtld_bind_lock, lockstate); target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); + wlock_acquire(rtld_bind_lock, lockstate); reloc_jmpslot(where, target, defobj, obj, rel); break; } Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Wed Dec 14 15:39:51 2011 (r228502) +++ head/libexec/rtld-elf/rtld.c Wed Dec 14 16:47:53 2011 (r228503) @@ -116,6 +116,8 @@ static void objlist_push_tail(Objlist *, static void objlist_remove(Objlist *, Obj_Entry *); static void *path_enumerate(const char *, path_enum_proc, void *); static int relocate_objects(Obj_Entry *, bool, Obj_Entry *, RtldLockState *); +static int resolve_objects_ifunc(Obj_Entry *first, bool bind_now, + RtldLockState *lockstate); static int rtld_dirname(const char *, char *); static int rtld_dirname_abs(const char *, char *); static void rtld_exit(void); @@ -513,6 +515,10 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ ld_bind_now != NULL && *ld_bind_now != '\0', &obj_rtld, NULL) == -1) die(); + if (resolve_objects_ifunc(obj_main, + ld_bind_now != NULL && *ld_bind_now != '\0', NULL) == -1) + die(); + dbg("doing copy relocations"); if (do_copy_relocations(obj_main) == -1) die(); @@ -1978,25 +1984,53 @@ relocate_objects(Obj_Entry *first, bool obj->version = RTLD_VERSION; } - /* - * The handling of R_MACHINE_IRELATIVE relocations and jumpslots - * referencing STT_GNU_IFUNC symbols is postponed till the other - * relocations are done. The indirect functions specified as - * ifunc are allowed to call other symbols, so we need to have - * objects relocated before asking for resolution from indirects. - * - * The R_MACHINE_IRELATIVE slots are resolved in greedy fashion, - * instead of the usual lazy handling of PLT slots. It is - * consistent with how GNU does it. - */ - for (obj = first; obj != NULL; obj = obj->next) { + return (0); +} + +/* + * The handling of R_MACHINE_IRELATIVE relocations and jumpslots + * referencing STT_GNU_IFUNC symbols is postponed till the other + * relocations are done. The indirect functions specified as + * ifunc are allowed to call other symbols, so we need to have + * objects relocated before asking for resolution from indirects. + * + * The R_MACHINE_IRELATIVE slots are resolved in greedy fashion, + * instead of the usual lazy handling of PLT slots. It is + * consistent with how GNU does it. + */ +static int +resolve_object_ifunc(Obj_Entry *obj, bool bind_now, RtldLockState *lockstate) +{ if (obj->irelative && reloc_iresolve(obj, lockstate) == -1) - return (-1); + return (-1); if ((obj->bind_now || bind_now) && obj->gnu_ifunc && - reloc_gnu_ifunc(obj, lockstate) == -1) - return (-1); - } - return 0; + reloc_gnu_ifunc(obj, lockstate) == -1) + return (-1); + return (0); +} + +static int +resolve_objects_ifunc(Obj_Entry *first, bool bind_now, RtldLockState *lockstate) +{ + Obj_Entry *obj; + + for (obj = first; obj != NULL; obj = obj->next) { + if (resolve_object_ifunc(obj, bind_now, lockstate) == -1) + return (-1); + } + return (0); +} + +static int +initlist_objects_ifunc(Objlist *list, bool bind_now, RtldLockState *lockstate) +{ + Objlist_Entry *elm; + + STAILQ_FOREACH(elm, list, link) { + if (resolve_object_ifunc(elm->obj, bind_now, lockstate) == -1) + return (-1); + } + return (0); } /* @@ -2201,6 +2235,16 @@ dlopen(const char *name, int mode) mode & (RTLD_MODEMASK | RTLD_GLOBAL))); } +static void +dlopen_cleanup(Obj_Entry *obj) +{ + + obj->dl_refcount--; + unref_dag(obj); + if (obj->refcount == 0) + unload_object(obj); +} + static Obj_Entry * dlopen_object(const char *name, Obj_Entry *refobj, int lo_flags, int mode) { @@ -2239,10 +2283,7 @@ dlopen_object(const char *name, Obj_Entr goto trace; if (result == -1 || (relocate_objects(obj, (mode & RTLD_MODEMASK) == RTLD_NOW, &obj_rtld, &lockstate)) == -1) { - obj->dl_refcount--; - unref_dag(obj); - if (obj->refcount == 0) - unload_object(obj); + dlopen_cleanup(obj); obj = NULL; } else { /* Make list of init functions to call. */ @@ -2276,6 +2317,14 @@ dlopen_object(const char *name, Obj_Entr map_stacks_exec(&lockstate); + if (initlist_objects_ifunc(&initlist, (mode & RTLD_MODEMASK) == RTLD_NOW, + &lockstate) == -1) { + objlist_clear(&initlist); + dlopen_cleanup(obj); + lock_release(rtld_bind_lock, &lockstate); + return (NULL); + } + /* Call the init functions. */ objlist_call_init(&initlist, &lockstate); objlist_clear(&initlist); From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 16:59:25 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC2B11065677; Wed, 14 Dec 2011 16:59:25 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from fsm2.ukr.net (fsm2.ukr.net [195.214.192.121]) by mx1.freebsd.org (Postfix) with ESMTP id 5AA058FC13; Wed, 14 Dec 2011 16:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=fRL/VfCanhBA65HvuJ644JHxHqqdCA1wNKS4A02smvk=; b=gZ20VopwilRrso84dbiE8nXpgOk8xZgLSaf+4A245Ft1wcG8oSOCu14yoHby9yGqfC3KoL8iJjSrBvLba7stVO+rrbP48fav7LVdcWnpKmM96HomiHAKSjomXOI2WkV7KHBUlsWDtZazSZtlx/QObPLDeOo+XHVNS3YuKMhiKPY=; Received: from [178.137.138.140] (helo=nonamehost.) by fsm2.ukr.net with esmtpsa ID 1RasAt-000Aty-C7 ; Wed, 14 Dec 2011 18:59:23 +0200 Date: Wed, 14 Dec 2011 18:59:22 +0200 From: Ivan Klymenko To: Eitan Adler Message-ID: <20111214185922.6805683e@nonamehost.> In-Reply-To: References: <4ee7a8c6.8e72e50a.3ab3.028bSMTPIN_ADDED@mx.google.com> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: r228377 to r228473 top not working X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 16:59:25 -0000 =D0=92 Wed, 14 Dec 2011 08:29:39 -0500 Eitan Adler =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > On Tue, Dec 13, 2011 at 2:43 PM, Eitan Adler > wrote: > > On Tue, Dec 13, 2011 at 2:34 PM, Ivan Klymenko > > wrote: > >> Hi all! > >> I have uname -a > >> FreeBSD nonamehost 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r228473M: > >> Tue Dec 13 20:09:45 EET 2011 > >> ivan@nonamehost:/usr/obj/usr/src/sys/mk9 =C2=A0amd64 After update > >> source code from r228377 to r228473 "top" stopped working > >> > >> # top > >> top: sysctl(vm.stats.vm.v_active_count...) failed: No such file or > >> directory # > >> > >> There are some ideas? > > > > Mea Culpa. I am currently testing a patch to fix this. >=20 > Fixed in r228498 - sorry for taking so long. >=20 >=20 Thank you! It works! From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 16:59:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11E9C1065675; Wed, 14 Dec 2011 16:59:59 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from fsm1.ukr.net (fsm1.ukr.net [195.214.192.120]) by mx1.freebsd.org (Postfix) with ESMTP id 3C7F38FC1D; Wed, 14 Dec 2011 16:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=X4gPo746gZw+x27b9dh6wYAR+ChXxbt2+msJViBS7hI=; b=SEet77kK7f7l3JSMnUbw9nGm+HmSz+37ACY1+MLMI4+/My4cSM3m2Kapt6B1F7CRGWVHaWXyiw0PxjrBVBuMoOV7l8wHrNIedYtGMhAItg/KEv5zkAWiFVzYhDHr2lRp6ZNRx+uHjI3M8XLJENpcyQcLUoVMkKPZtisaGrB0W2U=; Received: from [178.137.138.140] (helo=nonamehost.) by fsm1.ukr.net with esmtpsa ID 1RasBQ-00080k-SQ ; Wed, 14 Dec 2011 18:59:57 +0200 Date: Wed, 14 Dec 2011 18:59:56 +0200 From: Ivan Klymenko To: Eitan Adler Message-ID: <20111214185956.3837f456@nonamehost.> In-Reply-To: <201112141325.pBEDP0OX000330@svn.freebsd.org> References: <201112141325.pBEDP0OX000330@svn.freebsd.org> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228498 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 16:59:59 -0000 =D0=92 Wed, 14 Dec 2011 13:25:00 +0000 (UTC) Eitan Adler =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > Author: eadler (ports committer) > Date: Wed Dec 14 13:25:00 2011 > New Revision: 228498 > URL: http://svn.freebsd.org/changeset/base/228498 >=20 > Log: > - The previous commit (r228449) accidentally moved the > vm.stats.vm.* sysctls to vm.stats.sys. Move them back. > =20 > Noticed by: pho > Reviewed by: bde (earlier version) > Approved by: bz > MFC after: 1 week > Pointy hat to: me >=20 > Modified: > head/sys/vm/vm_meter.c >=20 > Modified: head/sys/vm/vm_meter.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/vm/vm_meter.c Wed Dec 14 13:12:55 2011 > (r228497) +++ head/sys/vm/vm_meter.c Wed Dec 14 13:25:00 > 2011 (r228498) @@ -270,59 +270,62 @@ static > SYSCTL_NODE(_vm_stats, OID_AUTO, "VM meter vm stats"); > SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc > stats");=20 > -#define VM_STATS_SYS(var, descr) SYSCTL_PROC(_vm_stats_sys, > OID_AUTO, var, \ > - (CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_MPSAFE), &cnt.v_swtch, 0, > vcnt, \ > - "IU", descr); > +#define VM_STATS(parent, var, descr) \ > + SYSCTL_PROC(parent, OID_AUTO, var, \ > + CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_MPSAFE, &cnt.var, 0, > vcnt, \ > + "IU", descr) > +#define VM_STATS_VM(var, descr) > VM_STATS(_vm_stats_vm, var, descr) +#define VM_STATS_SYS(var, > descr) VM_STATS(_vm_stats_sys, var, descr)=20 > VM_STATS_SYS(v_swtch, "Context switches"); > VM_STATS_SYS(v_trap, "Traps"); > VM_STATS_SYS(v_syscall, "System calls"); > VM_STATS_SYS(v_intr, "Device interrupts"); > VM_STATS_SYS(v_soft, "Software interrupts"); > -VM_STATS_SYS(v_vm_faults, "Address memory faults"); > -VM_STATS_SYS(v_cow_faults, "Copy-on-write faults"); > -VM_STATS_SYS(v_cow_optim, "Optimized COW faults") > -VM_STATS_SYS(v_zfod, "Pages zero-filled on demand") > -VM_STATS_SYS(v_ozfod, "Optimized zero fill pages") > -VM_STATS_SYS(v_swapin, "Swap pager pageins") > -VM_STATS_SYS(v_swapout, "Swap pager pageouts") > -VM_STATS_SYS(v_swappgsin, "Swap pages swapped in") > -VM_STATS_SYS(v_swappgsout, "Swap pages swapped out") > -VM_STATS_SYS(v_vnodein, "Vnode pager pageins") > -VM_STATS_SYS(v_vnodeout, "Vnode pager pageouts") > -VM_STATS_SYS(v_vnodepgsin, "Vnode pages paged in") > -VM_STATS_SYS(v_vnodepgsout, "Vnode pages paged out") > -VM_STATS_SYS(v_intrans, "In transit page faults") > -VM_STATS_SYS(v_reactivated, "Pages reactivated from free list") > -VM_STATS_SYS(v_pdwakeups, "Pagedaemon wakeups") > -VM_STATS_SYS(v_pdpages, "Pages analyzed by pagedaemon") > -VM_STATS_SYS(v_tcached, "Total pages cached") > -VM_STATS_SYS(v_dfree, "Pages freed by pagedaemon") > -VM_STATS_SYS(v_pfree, "Pages freed by exiting processes") > -VM_STATS_SYS(v_tfree, "Total pages freed") > -VM_STATS_SYS(v_page_size, "Page size in bytes") > -VM_STATS_SYS(v_page_count, "Total number of pages in system") > -VM_STATS_SYS(v_free_reserved, "Pages reserved for deadlock") > -VM_STATS_SYS(v_free_target, "Pages desired free") > -VM_STATS_SYS(v_free_min, "Minimum low-free-pages threshold") > -VM_STATS_SYS(v_free_count, "Free pages") > -VM_STATS_SYS(v_wire_count, "Wired pages") > -VM_STATS_SYS(v_active_count, "Active pages") > -VM_STATS_SYS(v_inactive_target, "Desired inactive pages") > -VM_STATS_SYS(v_inactive_count, "Inactive pages") > -VM_STATS_SYS(v_cache_count, "Pages on cache queue") > -VM_STATS_SYS(v_cache_min, "Min pages on cache queue") > -VM_STATS_SYS(v_cache_max, "Max pages on cached queue") > -VM_STATS_SYS(v_pageout_free_min, "Min pages reserved for kernel") > -VM_STATS_SYS(v_interrupt_free_min, "Reserved pages for interrupt > code") -VM_STATS_SYS(v_forks, "Number of fork() calls") > -VM_STATS_SYS(v_vforks, "Number of vfork() calls") > -VM_STATS_SYS(v_rforks, "Number of rfork() calls") > -VM_STATS_SYS(v_kthreads, "Number of fork() calls by kernel") > -VM_STATS_SYS(v_forkpages, "VM pages affected by fork()") > -VM_STATS_SYS(v_vforkpages, "VM pages affected by vfork()") > -VM_STATS_SYS(v_rforkpages, "VM pages affected by rfork()") > -VM_STATS_SYS(v_kthreadpages, "VM pages affected by fork() by kernel") > +VM_STATS_VM(v_vm_faults, "Address memory faults"); > +VM_STATS_VM(v_cow_faults, "Copy-on-write faults"); > +VM_STATS_VM(v_cow_optim, "Optimized COW faults"); > +VM_STATS_VM(v_zfod, "Pages zero-filled on demand"); > +VM_STATS_VM(v_ozfod, "Optimized zero fill pages"); > +VM_STATS_VM(v_swapin, "Swap pager pageins"); > +VM_STATS_VM(v_swapout, "Swap pager pageouts"); > +VM_STATS_VM(v_swappgsin, "Swap pages swapped in"); > +VM_STATS_VM(v_swappgsout, "Swap pages swapped out"); > +VM_STATS_VM(v_vnodein, "Vnode pager pageins"); > +VM_STATS_VM(v_vnodeout, "Vnode pager pageouts"); > +VM_STATS_VM(v_vnodepgsin, "Vnode pages paged in"); > +VM_STATS_VM(v_vnodepgsout, "Vnode pages paged out"); > +VM_STATS_VM(v_intrans, "In transit page faults"); > +VM_STATS_VM(v_reactivated, "Pages reactivated from free list"); > +VM_STATS_VM(v_pdwakeups, "Pagedaemon wakeups"); > +VM_STATS_VM(v_pdpages, "Pages analyzed by pagedaemon"); > +VM_STATS_VM(v_tcached, "Total pages cached"); > +VM_STATS_VM(v_dfree, "Pages freed by pagedaemon"); > +VM_STATS_VM(v_pfree, "Pages freed by exiting processes"); > +VM_STATS_VM(v_tfree, "Total pages freed"); > +VM_STATS_VM(v_page_size, "Page size in bytes"); > +VM_STATS_VM(v_page_count, "Total number of pages in system"); > +VM_STATS_VM(v_free_reserved, "Pages reserved for deadlock"); > +VM_STATS_VM(v_free_target, "Pages desired free"); > +VM_STATS_VM(v_free_min, "Minimum low-free-pages threshold"); > +VM_STATS_VM(v_free_count, "Free pages"); > +VM_STATS_VM(v_wire_count, "Wired pages"); > +VM_STATS_VM(v_active_count, "Active pages"); > +VM_STATS_VM(v_inactive_target, "Desired inactive pages"); > +VM_STATS_VM(v_inactive_count, "Inactive pages"); > +VM_STATS_VM(v_cache_count, "Pages on cache queue"); > +VM_STATS_VM(v_cache_min, "Min pages on cache queue"); > +VM_STATS_VM(v_cache_max, "Max pages on cached queue"); > +VM_STATS_VM(v_pageout_free_min, "Min pages reserved for kernel"); > +VM_STATS_VM(v_interrupt_free_min, "Reserved pages for interrupt > code"); +VM_STATS_VM(v_forks, "Number of fork() calls"); > +VM_STATS_VM(v_vforks, "Number of vfork() calls"); > +VM_STATS_VM(v_rforks, "Number of rfork() calls"); > +VM_STATS_VM(v_kthreads, "Number of fork() calls by kernel"); > +VM_STATS_VM(v_forkpages, "VM pages affected by fork()"); > +VM_STATS_VM(v_vforkpages, "VM pages affected by vfork()"); > +VM_STATS_VM(v_rforkpages, "VM pages affected by rfork()"); > +VM_STATS_VM(v_kthreadpages, "VM pages affected by fork() by kernel"); > =20 > SYSCTL_INT(_vm_stats_misc, OID_AUTO, zero_page_count, CTLFLAG_RD, > &vm_page_zero_count, 0, "Number of zero-ed free pages"); Thank you! It works! From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 17:13:00 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24FE5106566B; Wed, 14 Dec 2011 17:13:00 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 142E28FC0C; Wed, 14 Dec 2011 17:13:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBEHCxdQ007583; Wed, 14 Dec 2011 17:12:59 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBEHCxJ1007581; Wed, 14 Dec 2011 17:12:59 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201112141712.pBEHCxJ1007581@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 14 Dec 2011 17:12:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228504 - head/sys/arm/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 17:13:00 -0000 Author: raj Date: Wed Dec 14 17:12:59 2011 New Revision: 228504 URL: http://svn.freebsd.org/changeset/base/228504 Log: Make *intr{cnt,names} on ARM reside in data section, similar to other arches. sintrnames and sintrcnt are initialized with non-zero values, which were discarded by the .bss directive, so consumers like "vmstat -i" were not getting correct data. Submitted by: Lukasz Plachno Obtained from: Semihalf MFC after: 1 month Modified: head/sys/arm/arm/irq_dispatch.S Modified: head/sys/arm/arm/irq_dispatch.S ============================================================================== --- head/sys/arm/arm/irq_dispatch.S Wed Dec 14 16:47:53 2011 (r228503) +++ head/sys/arm/arm/irq_dispatch.S Wed Dec 14 17:12:59 2011 (r228504) @@ -98,10 +98,9 @@ ASENTRY_NP(irq_entry) PULLFRAMEFROMSVCANDEXIT movs pc, lr /* Exit */ - .bss + .data .align 0 - .global _C_LABEL(intrnames), _C_LABEL(sintrnames) .global _C_LABEL(intrcnt), _C_LABEL(sintrcnt) _C_LABEL(intrnames): From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 19:48:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 197DD1065673; Wed, 14 Dec 2011 19:48:22 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08AFC8FC12; Wed, 14 Dec 2011 19:48:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBEJmLMu012311; Wed, 14 Dec 2011 19:48:21 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBEJmLmg012309; Wed, 14 Dec 2011 19:48:21 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201112141948.pBEJmLmg012309@svn.freebsd.org> From: Joel Dahl Date: Wed, 14 Dec 2011 19:48:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228505 - head/share/man/man8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 19:48:22 -0000 Author: joel (doc committer) Date: Wed Dec 14 19:48:21 2011 New Revision: 228505 URL: http://svn.freebsd.org/changeset/base/228505 Log: Add SEE ALSO. Modified: head/share/man/man8/yp.8 Modified: head/share/man/man8/yp.8 ============================================================================== --- head/share/man/man8/yp.8 Wed Dec 14 17:12:59 2011 (r228504) +++ head/share/man/man8/yp.8 Wed Dec 14 19:48:21 2011 (r228505) @@ -28,7 +28,7 @@ .\" from: @(#)yp.8 1.0 (deraadt) 4/26/93 .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd December 14, 2011 .Dt YP 8 .Os .Sh NAME @@ -519,6 +519,20 @@ a v1 and v2 server. .Xr ypserv 8 manual page for a detailed description of these special features and flags.) +.Sh SEE ALSO +.Xr domainname 1 , +.Xr ypcat 1 , +.Xr ypmatch 1 , +.Xr ypwhich 1 , +.Xr nsswitch.conf 5 , +.Xr yp_mkdb 8 , +.Xr ypbind 8 , +.Xr ypinit 8 , +.Xr yppoll 8 , +.Xr yppush 8 , +.Xr ypserv 8 , +.Xr ypset 8 , +.Xr ypxfr 8 .Sh HISTORY The .Nm YP From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 22:04:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58361106564A; Wed, 14 Dec 2011 22:04:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3BCB88FC12; Wed, 14 Dec 2011 22:04:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBEM4FRt016571; Wed, 14 Dec 2011 22:04:15 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBEM4FfZ016569; Wed, 14 Dec 2011 22:04:15 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201112142204.pBEM4FfZ016569@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 14 Dec 2011 22:04:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228507 - head/sys/fs/ext2fs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 22:04:15 -0000 Author: pfg Date: Wed Dec 14 22:04:14 2011 New Revision: 228507 URL: http://svn.freebsd.org/changeset/base/228507 Log: Merge ext2_readwrite.c into ext2_vnops.c as done in UFS in r101729. This removes the obfuscations mentioned in ext2_readwrite and places the clustering funtion in a location similar to other UFS-based implementations. No performance or functional changeses are expected from this move. PR: kern/159232 Suggested by: bde Approved by: jhb (mentor) MFC after: 2 weeks Deleted: head/sys/fs/ext2fs/ext2_readwrite.c Modified: head/sys/fs/ext2fs/ext2_vnops.c Modified: head/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vnops.c Wed Dec 14 20:57:41 2011 (r228506) +++ head/sys/fs/ext2fs/ext2_vnops.c Wed Dec 14 22:04:14 2011 (r228507) @@ -64,9 +64,13 @@ #include #include +#include +#include #include #include +#include "opt_directio.h" + #include #include @@ -159,8 +163,6 @@ struct vop_vector ext2_fifoops = { .vop_vptofh = ext2_vptofh, }; -#include - /* * A virgin directory (no blushing please). * Note that the type and namlen fields are reversed relative to ext2. @@ -1675,3 +1677,328 @@ bad: vput(tvp); return (error); } + +/* + * Vnode op for reading. + */ +static int +ext2_read(ap) + struct vop_read_args /* { + struct vnode *a_vp; + struct uio *a_uio; + int a_ioflag; + struct ucred *a_cred; + } */ *ap; +{ + struct vnode *vp; + struct inode *ip; + struct uio *uio; + struct m_ext2fs *fs; + struct buf *bp; + daddr_t lbn, nextlbn; + off_t bytesinfile; + long size, xfersize, blkoffset; + int error, orig_resid, seqcount; + int ioflag; + + vp = ap->a_vp; + uio = ap->a_uio; + ioflag = ap->a_ioflag; + + seqcount = ap->a_ioflag >> IO_SEQSHIFT; + ip = VTOI(vp); + +#ifdef INVARIANTS + if (uio->uio_rw != UIO_READ) + panic("%s: mode", "ext2_read"); + + if (vp->v_type == VLNK) { + if ((int)ip->i_size < vp->v_mount->mnt_maxsymlinklen) + panic("%s: short symlink", "ext2_read"); + } else if (vp->v_type != VREG && vp->v_type != VDIR) + panic("%s: type %d", "ext2_read", vp->v_type); +#endif + orig_resid = uio->uio_resid; + KASSERT(orig_resid >= 0, ("ext2_read: uio->uio_resid < 0")); + if (orig_resid == 0) + return (0); + KASSERT(uio->uio_offset >= 0, ("ext2_read: uio->uio_offset < 0")); + fs = ip->i_e2fs; + if (uio->uio_offset < ip->i_size && + uio->uio_offset >= fs->e2fs_maxfilesize) + return (EOVERFLOW); + + for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) { + if ((bytesinfile = ip->i_size - uio->uio_offset) <= 0) + break; + lbn = lblkno(fs, uio->uio_offset); + nextlbn = lbn + 1; + size = blksize(fs, ip, lbn); + blkoffset = blkoff(fs, uio->uio_offset); + + xfersize = fs->e2fs_fsize - blkoffset; + if (uio->uio_resid < xfersize) + xfersize = uio->uio_resid; + if (bytesinfile < xfersize) + xfersize = bytesinfile; + + if (lblktosize(fs, nextlbn) >= ip->i_size) + error = bread(vp, lbn, size, NOCRED, &bp); + else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) + error = cluster_read(vp, ip->i_size, lbn, size, + NOCRED, blkoffset + uio->uio_resid, seqcount, &bp); + else if (seqcount > 1) { + int nextsize = blksize(fs, ip, nextlbn); + error = breadn(vp, lbn, + size, &nextlbn, &nextsize, 1, NOCRED, &bp); + } else + error = bread(vp, lbn, size, NOCRED, &bp); + if (error) { + brelse(bp); + bp = NULL; + break; + } + + /* + * If IO_DIRECT then set B_DIRECT for the buffer. This + * will cause us to attempt to release the buffer later on + * and will cause the buffer cache to attempt to free the + * underlying pages. + */ + if (ioflag & IO_DIRECT) + bp->b_flags |= B_DIRECT; + + /* + * We should only get non-zero b_resid when an I/O error + * has occurred, which should cause us to break above. + * However, if the short read did not cause an error, + * then we want to ensure that we do not uiomove bad + * or uninitialized data. + */ + size -= bp->b_resid; + if (size < xfersize) { + if (size == 0) + break; + xfersize = size; + } + error = uiomove((char *)bp->b_data + blkoffset, + (int)xfersize, uio); + if (error) + break; + + if (ioflag & (IO_VMIO|IO_DIRECT)) { + /* + * If it's VMIO or direct I/O, then we don't + * need the buf, mark it available for + * freeing. If it's non-direct VMIO, the VM has + * the data. + */ + bp->b_flags |= B_RELBUF; + brelse(bp); + } else { + /* + * Otherwise let whoever + * made the request take care of + * freeing it. We just queue + * it onto another list. + */ + bqrelse(bp); + } + } + + /* + * This can only happen in the case of an error + * because the loop above resets bp to NULL on each iteration + * and on normal completion has not set a new value into it. + * so it must have come from a 'break' statement + */ + if (bp != NULL) { + if (ioflag & (IO_VMIO|IO_DIRECT)) { + bp->b_flags |= B_RELBUF; + brelse(bp); + } else { + bqrelse(bp); + } + } + + if ((error == 0 || uio->uio_resid != orig_resid) && + (vp->v_mount->mnt_flag & MNT_NOATIME) == 0) + ip->i_flag |= IN_ACCESS; + return (error); +} + +/* + * Vnode op for writing. + */ +static int +ext2_write(ap) + struct vop_write_args /* { + struct vnode *a_vp; + struct uio *a_uio; + int a_ioflag; + struct ucred *a_cred; + } */ *ap; +{ + struct vnode *vp; + struct uio *uio; + struct inode *ip; + struct m_ext2fs *fs; + struct buf *bp; + daddr_t lbn; + off_t osize; + int blkoffset, error, flags, ioflag, resid, size, seqcount, xfersize; + + ioflag = ap->a_ioflag; + uio = ap->a_uio; + vp = ap->a_vp; + + seqcount = ioflag >> IO_SEQSHIFT; + ip = VTOI(vp); + +#ifdef INVARIANTS + if (uio->uio_rw != UIO_WRITE) + panic("%s: mode", "ext2_write"); +#endif + + switch (vp->v_type) { + case VREG: + if (ioflag & IO_APPEND) + uio->uio_offset = ip->i_size; + if ((ip->i_flags & APPEND) && uio->uio_offset != ip->i_size) + return (EPERM); + /* FALLTHROUGH */ + case VLNK: + break; + case VDIR: + /* XXX differs from ffs -- this is called from ext2_mkdir(). */ + if ((ioflag & IO_SYNC) == 0) + panic("ext2_write: nonsync dir write"); + break; + default: + panic("ext2_write: type %p %d (%jd,%jd)", (void *)vp, + vp->v_type, (intmax_t)uio->uio_offset, + (intmax_t)uio->uio_resid); + } + + KASSERT(uio->uio_resid >= 0, ("ext2_write: uio->uio_resid < 0")); + KASSERT(uio->uio_offset >= 0, ("ext2_write: uio->uio_offset < 0")); + fs = ip->i_e2fs; + if ((uoff_t)uio->uio_offset + uio->uio_resid > fs->e2fs_maxfilesize) + return (EFBIG); + /* + * Maybe this should be above the vnode op call, but so long as + * file servers have no limits, I don't think it matters. + */ + if (vn_rlimit_fsize(vp, uio, uio->uio_td)) + return (EFBIG); + + resid = uio->uio_resid; + osize = ip->i_size; + if (seqcount > BA_SEQMAX) + flags = BA_SEQMAX << BA_SEQSHIFT; + else + flags = seqcount << BA_SEQSHIFT; + if ((ioflag & IO_SYNC) && !DOINGASYNC(vp)) + flags |= IO_SYNC; + + for (error = 0; uio->uio_resid > 0;) { + lbn = lblkno(fs, uio->uio_offset); + blkoffset = blkoff(fs, uio->uio_offset); + xfersize = fs->e2fs_fsize - blkoffset; + if (uio->uio_resid < xfersize) + xfersize = uio->uio_resid; + if (uio->uio_offset + xfersize > ip->i_size) + vnode_pager_setsize(vp, uio->uio_offset + xfersize); + + /* + * We must perform a read-before-write if the transfer size + * does not cover the entire buffer. + */ + if (fs->e2fs_bsize > xfersize) + flags |= BA_CLRBUF; + else + flags &= ~BA_CLRBUF; + error = ext2_balloc(ip, lbn, blkoffset + xfersize, + ap->a_cred, &bp, flags); + if (error != 0) + break; + + /* + * If the buffer is not valid and we did not clear garbage + * out above, we have to do so here even though the write + * covers the entire buffer in order to avoid a mmap()/write + * race where another process may see the garbage prior to + * the uiomove() for a write replacing it. + */ + if ((bp->b_flags & B_CACHE) == 0 && fs->e2fs_bsize <= xfersize) + vfs_bio_clrbuf(bp); + if ((ioflag & (IO_SYNC|IO_INVAL)) == (IO_SYNC|IO_INVAL)) + bp->b_flags |= B_NOCACHE; + if (uio->uio_offset + xfersize > ip->i_size) + ip->i_size = uio->uio_offset + xfersize; + size = blksize(fs, ip, lbn) - bp->b_resid; + if (size < xfersize) + xfersize = size; + + error = + uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio); + if (ioflag & (IO_VMIO|IO_DIRECT)) { + bp->b_flags |= B_RELBUF; + } + + /* + * If IO_SYNC each buffer is written synchronously. Otherwise + * if we have a severe page deficiency write the buffer + * asynchronously. Otherwise try to cluster, and if that + * doesn't do it then either do an async write (if O_DIRECT), + * or a delayed write (if not). + */ + if (ioflag & IO_SYNC) { + (void)bwrite(bp); + } else if (vm_page_count_severe() || + buf_dirty_count_severe() || + (ioflag & IO_ASYNC)) { + bp->b_flags |= B_CLUSTEROK; + bawrite(bp); + } else if (xfersize + blkoffset == fs->e2fs_fsize) { + if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) { + bp->b_flags |= B_CLUSTEROK; + cluster_write(vp, bp, ip->i_size, seqcount); + } else { + bawrite(bp); + } + } else if (ioflag & IO_DIRECT) { + bp->b_flags |= B_CLUSTEROK; + bawrite(bp); + } else { + bp->b_flags |= B_CLUSTEROK; + bdwrite(bp); + } + if (error || xfersize == 0) + break; + } + /* + * If we successfully wrote any data, and we are not the superuser + * we clear the setuid and setgid bits as a precaution against + * tampering. + */ + if ((ip->i_mode & (ISUID | ISGID)) && resid > uio->uio_resid && + ap->a_cred) { + if (priv_check_cred(ap->a_cred, PRIV_VFS_RETAINSUGID, 0)) + ip->i_mode &= ~(ISUID | ISGID); + } + if (error) { + if (ioflag & IO_UNIT) { + (void)ext2_truncate(vp, osize, + ioflag & IO_SYNC, ap->a_cred, uio->uio_td); + uio->uio_offset -= resid - uio->uio_resid; + uio->uio_resid = resid; + } + } + if (uio->uio_resid != resid) { + ip->i_flag |= IN_CHANGE | IN_UPDATE; + if (ioflag & IO_SYNC) + error = ext2_update(vp, 1); + } + return (error); +} From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 22:14:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8DBF106564A; Wed, 14 Dec 2011 22:14:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D71B8FC08; Wed, 14 Dec 2011 22:14:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBEME5kW016891; Wed, 14 Dec 2011 22:14:05 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBEME5oL016889; Wed, 14 Dec 2011 22:14:05 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201112142214.pBEME5oL016889@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 14 Dec 2011 22:14:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228508 - head/sys/dev/usb/wlan X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 22:14:05 -0000 Author: hselasky Date: Wed Dec 14 22:14:05 2011 New Revision: 228508 URL: http://svn.freebsd.org/changeset/base/228508 Log: Improve fix for random USB transfer time out. Suggested by: YougHyeon MFC after: 3 days Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Wed Dec 14 22:04:14 2011 (r228507) +++ head/sys/dev/usb/wlan/if_run.c Wed Dec 14 22:14:05 2011 (r228508) @@ -2749,7 +2749,8 @@ tr_setup: STAILQ_REMOVE_HEAD(&pq->tx_qh, next); m = data->m; - if (m->m_pkthdr.len > RUN_MAX_TXSZ) { + if ((m->m_pkthdr.len + + sizeof(data->desc) + 3 + 8) > RUN_MAX_TXSZ) { DPRINTF("data overflow, %u bytes\n", m->m_pkthdr.len); @@ -2764,6 +2765,14 @@ tr_setup: size = sizeof(data->desc); usbd_copy_in(pc, 0, &data->desc, size); usbd_m_copy_in(pc, size, m, 0, m->m_pkthdr.len); + size += m->m_pkthdr.len; + /* + * Align end on a 4-byte boundary, pad 8 bytes (CRC + + * 4-byte padding), and be sure to zero those trailing + * bytes: + */ + usbd_frame_zero(pc, size, ((-size) & 3) + 8); + size += ((-size) & 3) + 8; vap = data->ni->ni_vap; if (ieee80211_radiotap_active_vap(vap)) { @@ -2782,10 +2791,10 @@ tr_setup: ieee80211_radiotap_tx(vap, m); } - DPRINTFN(11, "sending frame len=%u @ index %d\n", - m->m_pkthdr.len, index); + DPRINTFN(11, "sending frame len=%u/%u @ index %d\n", + m->m_pkthdr.len, size, index); - usbd_xfer_set_frame_len(xfer, 0, size + m->m_pkthdr.len); + usbd_xfer_set_frame_len(xfer, 0, size); usbd_xfer_set_priv(xfer, data); usbd_transfer_submit(xfer); @@ -2874,7 +2883,6 @@ run_bulk_tx_callback5(struct usb_xfer *x static void run_set_tx_desc(struct run_softc *sc, struct run_tx_data *data) { - static const uint8_t ztail[16]; struct mbuf *m = data->m; struct ieee80211com *ic = sc->sc_ifp->if_l2com; struct ieee80211vap *vap = data->ni->ni_vap; @@ -2931,13 +2939,6 @@ run_set_tx_desc(struct run_softc *sc, st if (vap->iv_opmode != IEEE80211_M_STA && !IEEE80211_QOS_HAS_SEQ(wh)) txwi->xflags |= RT2860_TX_NSEQ; - - /* - * Align end on a 4-byte boundary, pad 8 bytes (CRC + 4-byte padding), - * and be sure to zero those trailing bytes. - */ - m_append(m, ((m->m_pkthdr.len + 3) & ~3) - m->m_pkthdr.len + 8, - (c_caddr_t)ztail); } /* This function must be called locked */ From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 22:22:19 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AADF6106566B; Wed, 14 Dec 2011 22:22:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FA0D8FC13; Wed, 14 Dec 2011 22:22:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBEMMJmj017249; Wed, 14 Dec 2011 22:22:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBEMMJ1U017244; Wed, 14 Dec 2011 22:22:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201112142222.pBEMMJ1U017244@svn.freebsd.org> From: John Baldwin Date: Wed, 14 Dec 2011 22:22:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228509 - in head: share/man/man9 sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 22:22:19 -0000 Author: jhb Date: Wed Dec 14 22:22:19 2011 New Revision: 228509 URL: http://svn.freebsd.org/changeset/base/228509 Log: Add a helper API to allow in-kernel code to map portions of shared memory objects created by shm_open(2) into the kernel's address space. This provides a convenient way for creating shared memory buffers between userland and the kernel without requiring custom character devices. Added: head/share/man/man9/shm_map.9 (contents, props changed) Modified: head/share/man/man9/Makefile head/sys/kern/uipc_shm.c head/sys/sys/mman.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Wed Dec 14 22:14:05 2011 (r228508) +++ head/share/man/man9/Makefile Wed Dec 14 22:22:19 2011 (r228509) @@ -234,6 +234,7 @@ MAN= accept_filter.9 \ sema.9 \ sf_buf.9 \ sglist.9 \ + shm_map.9 \ signal.9 \ sleep.9 \ sleepqueue.9 \ @@ -1111,6 +1112,7 @@ MLINKS+=sglist.9 sglist_alloc.9 \ sglist.9 sglist_reset.9 \ sglist.9 sglist_slice.9 \ sglist.9 sglist_split.9 +MLINKS+=shm_map.9 shm_unmap.9 MLINKS+=signal.9 cursig.9 \ signal.9 execsigs.9 \ signal.9 issignal.9 \ Added: head/share/man/man9/shm_map.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/shm_map.9 Wed Dec 14 22:22:19 2011 (r228509) @@ -0,0 +1,187 @@ +.\" +.\" Copyright (c) 2011 Advanced Computing Technologies LLC +.\" Written by: John H. Baldwin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 14, 2011 +.Dt SHM_MAP 9 +.Os +.Sh NAME +.Nm shm_map , +.Nm shm_unmap +.Nd map shared memory objects into the kernel's address space +.Sh SYNOPSIS +.In sys/types.h +.In sys/mman.h +.Ft int +.Fn shm_map "struct file *fp" "size_t size" "off_t offset" "void **memp" +.Ft int +.Fn shm_unmap "struct file *fp" "void *mem" "size_t size" +.Sh DESCRIPTION +The +.Nm shm_map +and +.Nm shm_unmap +functions provide an API for mapping shared memory objects into the kernel. +Shared memory objects are created by +.Xr shm_open 2 . +These objects can then be passed into the kernel via file descriptors. +.Pp +A shared memory object cannot be shrunk while it is mapped into the kernel. +This is to avoid invalidating any pages that may be wired into the kernel's +address space. +Shared memory objects can still be grown while mapped into the kernel. +.Pp +To simplify the accounting needed to enforce the above requirement, +callers of this API are required to unmap the entire region mapped by +.Nm shm_map +when calling +.Nm shm_unmap . +Unmapping only a portion of the region is not permitted. +.Pp +The +.Nm shm_map +function locates the shared memory object associated with the open file +.Fa fp . +It maps the region of that object described by +.Fa offset +and +.Fa size +into the kernel's address space. +If it succeeds, +.Fa *memp +will be set to the start of the mapping. +All pages for the range will be wired into memory upon successful return. +.Pp +The +.Nm shm_unmap +function unmaps a region previously mapped by +.Nm shm_map . +The +.Fa mem +argument should match the value previously returned in +.Fa *memp , +and the +.Fa size +argument should match the value passed to +.Nm shm_map . +.Pp +Note that +.Nm shm_map +will not hold an extra reference on the open file +.Fa fp +for the lifetime of the mapping. +Instead, +the calling code is required to do this if it wishes to use +.Nm shm_unmap +on the region in the future. +.Sh RETURN VALUES +The +.Nm shm_map +and +.Nm shm_unmap +functions return zero on success or an error on failure. +.Sh EXAMPLES +The following function accepts a file descriptor for a shared memory +object. +It maps the first sixteen kilobytes of the object into the kernel, +performs some work on that address, +and then unmaps the address before returning. +.Bd -literal +int +shm_example(int fd) +{ + struct file *fp; + void *mem; + int error; + + error = fget(curthread, fd, CAP_MMAP, &fp) + if (error) + return (error); + error = shm_map(fp, 16384, 0, &mem); + if (error) { + fdrop(fp, curthread); + return (error); + } + + /* Do something with 'mem'. */ + + error = shm_unmap(fp, mem, 16384); + fdrop(fp, curthread); + return (error); +} +.Ed +.Sh ERRORS +The +.Nm shm_map +function returns the following errors on failure: +.Bl -tag -width Er +.It Bq Er EINVAL +The open file +.Fa fp +is not a shared memory object. +.It Bq Er EINVAL +The requested region described by +.Fa offset +and +.Fa size +extends beyond the end of the shared memory object. +.It Bq Er ENOMEM +Insufficient address space was available. +.It Bq Er EACCES +The shared memory object could not be mapped due to a protection error. +.It Bq Er EINVAL +The shared memory object could not be mapped due to some other VM error. +.El +.Pp +The +.Nm shm_unmap +function returns the following errors on failure: +.Bl -tag -width Er +.It Bq Er EINVAL +The open file +.Fa fp +is not a shared memory object. +.It Bq Er EINVAL +The address range described by +.Fa mem +and +.Fa size +is not a valid address range. +.It Bq Er EINVAL +The address range described by +.Fa mem +and +.Fa size +is not backed by the shared memory object associated with the open file +.Fa fp , +or the address range does not cover the entire mapping of the object. +.El +.Sh SEE ALSO +.Xr shm_open 2 +.Sh HISTORY +This API was first introduced in +.Fx 10.0 . Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Wed Dec 14 22:14:05 2011 (r228508) +++ head/sys/kern/uipc_shm.c Wed Dec 14 22:22:19 2011 (r228509) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -265,6 +266,14 @@ shm_dotruncate(struct shmfd *shmfd, off_ /* Are we shrinking? If so, trim the end. */ if (length < shmfd->shm_size) { + /* + * Disallow any requests to shrink the size if this + * object is mapped into the kernel. + */ + if (shmfd->shm_kmappings > 0) { + VM_OBJECT_UNLOCK(object); + return (EBUSY); + } delta = ptoa(object->size - nobjsize); /* Toss in memory pages. */ @@ -725,3 +734,113 @@ out: mtx_unlock(&shm_timestamp_lock); return (error); } + +/* + * Helper routines to allow the backing object of a shared memory file + * descriptor to be mapped in the kernel. + */ +int +shm_map(struct file *fp, size_t size, off_t offset, void **memp) +{ + struct shmfd *shmfd; + vm_offset_t kva, ofs; + vm_object_t obj; + int rv; + + if (fp->f_type != DTYPE_SHM) + return (EINVAL); + shmfd = fp->f_data; + obj = shmfd->shm_object; + VM_OBJECT_LOCK(obj); + /* + * XXXRW: This validation is probably insufficient, and subject to + * sign errors. It should be fixed. + */ + if (offset >= shmfd->shm_size || + offset + size > round_page(shmfd->shm_size)) { + VM_OBJECT_UNLOCK(obj); + return (EINVAL); + } + + shmfd->shm_kmappings++; + vm_object_reference_locked(obj); + VM_OBJECT_UNLOCK(obj); + + /* Map the object into the kernel_map and wire it. */ + kva = vm_map_min(kernel_map); + ofs = offset & PAGE_MASK; + offset = trunc_page(offset); + size = round_page(size + ofs); + rv = vm_map_find(kernel_map, obj, offset, &kva, size, + VMFS_ALIGNED_SPACE, VM_PROT_READ | VM_PROT_WRITE, + VM_PROT_READ | VM_PROT_WRITE, 0); + if (rv == KERN_SUCCESS) { + rv = vm_map_wire(kernel_map, kva, kva + size, + VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); + if (rv == KERN_SUCCESS) { + *memp = (void *)(kva + ofs); + return (0); + } + vm_map_remove(kernel_map, kva, kva + size); + } else + vm_object_deallocate(obj); + + /* On failure, drop our mapping reference. */ + VM_OBJECT_LOCK(obj); + shmfd->shm_kmappings--; + VM_OBJECT_UNLOCK(obj); + + switch (rv) { + case KERN_INVALID_ADDRESS: + case KERN_NO_SPACE: + return (ENOMEM); + case KERN_PROTECTION_FAILURE: + return (EACCES); + default: + return (EINVAL); + } +} + +/* + * We require the caller to unmap the entire entry. This allows us to + * safely decrement shm_kmappings when a mapping is removed. + */ +int +shm_unmap(struct file *fp, void *mem, size_t size) +{ + struct shmfd *shmfd; + vm_map_entry_t entry; + vm_offset_t kva, ofs; + vm_object_t obj; + vm_pindex_t pindex; + vm_prot_t prot; + boolean_t wired; + vm_map_t map; + int rv; + + if (fp->f_type != DTYPE_SHM) + return (EINVAL); + shmfd = fp->f_data; + kva = (vm_offset_t)mem; + ofs = kva & PAGE_MASK; + kva = trunc_page(kva); + size = round_page(size + ofs); + map = kernel_map; + rv = vm_map_lookup(&map, kva, VM_PROT_READ | VM_PROT_WRITE, &entry, + &obj, &pindex, &prot, &wired); + if (rv != KERN_SUCCESS) + return (EINVAL); + if (entry->start != kva || entry->end != kva + size) { + vm_map_lookup_done(map, entry); + return (EINVAL); + } + vm_map_lookup_done(map, entry); + if (obj != shmfd->shm_object) + return (EINVAL); + vm_map_remove(map, kva, kva + size); + VM_OBJECT_LOCK(obj); + KASSERT(shmfd->shm_kmappings > 0, ("shm_unmap: object not mapped")); + shmfd->shm_kmappings--; + VM_OBJECT_UNLOCK(obj); + return (0); +} Modified: head/sys/sys/mman.h ============================================================================== --- head/sys/sys/mman.h Wed Dec 14 22:14:05 2011 (r228508) +++ head/sys/sys/mman.h Wed Dec 14 22:22:19 2011 (r228509) @@ -181,6 +181,8 @@ typedef __size_t size_t; #ifdef _KERNEL #include +struct file; + struct shmfd { size_t shm_size; vm_object_t shm_object; @@ -188,6 +190,7 @@ struct shmfd { uid_t shm_uid; gid_t shm_gid; mode_t shm_mode; + int shm_kmappings; /* * Values maintained solely to make this a better-behaved file @@ -203,6 +206,8 @@ struct shmfd { int shm_mmap(struct shmfd *shmfd, vm_size_t objsize, vm_ooffset_t foff, vm_object_t *obj); +int shm_map(struct file *fp, size_t size, off_t offset, void **memp); +int shm_unmap(struct file *fp, void *mem, size_t size); #else /* !_KERNEL */ From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 22:26:40 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30CA01065672; Wed, 14 Dec 2011 22:26:40 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1FE208FC08; Wed, 14 Dec 2011 22:26:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBEMQe98017405; Wed, 14 Dec 2011 22:26:40 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBEMQeU3017403; Wed, 14 Dec 2011 22:26:40 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201112142226.pBEMQeU3017403@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 14 Dec 2011 22:26:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228510 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 22:26:40 -0000 Author: jilles Date: Wed Dec 14 22:26:39 2011 New Revision: 228510 URL: http://svn.freebsd.org/changeset/base/228510 Log: Fix select/poll/kqueue for write on reverse direction before first write. The reverse direction of a pipe is lazily allocated on the first write in that direction (because pipes are usually used in one direction only). A special case is needed to ensure the pipe appears writable before the first write because there are 0 bytes of pending data in 0 bytes of buffer space at that point, leaving 0 bytes of data that can be written with the normal code. Note that the first write returns [ENOMEM] if kern.ipc.maxpipekva is exceeded and does not block or return [EAGAIN], so selecting true for write is correct even in that case. PR: kern/93685 Submitted by: gianni MFC after: 2 weeks Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Wed Dec 14 22:22:19 2011 (r228509) +++ head/sys/kern/sys_pipe.c Wed Dec 14 22:26:39 2011 (r228510) @@ -1349,7 +1349,8 @@ pipe_poll(fp, events, active_cred, td) if (wpipe->pipe_present != PIPE_ACTIVE || (wpipe->pipe_state & PIPE_EOF) || (((wpipe->pipe_state & PIPE_DIRECTW) == 0) && - (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) >= PIPE_BUF)) + ((wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) >= PIPE_BUF || + wpipe->pipe_buffer.size == 0))) revents |= events & (POLLOUT | POLLWRNORM); if ((events & POLLINIGNEOF) == 0) { @@ -1660,7 +1661,8 @@ filt_pipewrite(struct knote *kn, long hi PIPE_UNLOCK(rpipe); return (1); } - kn->kn_data = wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt; + kn->kn_data = (wpipe->pipe_buffer.size > 0) ? + (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) : PIPE_BUF; if (wpipe->pipe_state & PIPE_DIRECTW) kn->kn_data = 0; From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 23:22:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C71C106564A; Wed, 14 Dec 2011 23:22:41 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C3658FC12; Wed, 14 Dec 2011 23:22:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBENMfLn019205; Wed, 14 Dec 2011 23:22:41 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBENMfDR019203; Wed, 14 Dec 2011 23:22:41 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201112142322.pBENMfDR019203@svn.freebsd.org> From: Xin LI Date: Wed, 14 Dec 2011 23:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228511 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 23:22:41 -0000 Author: delphij Date: Wed Dec 14 23:22:40 2011 New Revision: 228511 URL: http://svn.freebsd.org/changeset/base/228511 Log: Reflect the move of eventtimers(7) to eventtimers(4). Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Dec 14 22:26:39 2011 (r228510) +++ head/ObsoleteFiles.inc Wed Dec 14 23:22:40 2011 (r228511) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20111214: eventtimers(7) moved to eventtimers(4) +OLD_FILES+=usr/share/man/man7/eventtimers.7.gz # 20111125: amd(4) removed OLD_FILES+=usr/share/man/man4/amd.4.gz # 20111125: libodialog removed From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 23:26:49 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C8871065670; Wed, 14 Dec 2011 23:26:49 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0193E8FC0A; Wed, 14 Dec 2011 23:26:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBENQmdt019366; Wed, 14 Dec 2011 23:26:48 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBENQmDF019365; Wed, 14 Dec 2011 23:26:48 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201112142326.pBENQmDF019365@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 14 Dec 2011 23:26:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228512 - head/tools/regression/pipe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 23:26:49 -0000 Author: jilles Date: Wed Dec 14 23:26:48 2011 New Revision: 228512 URL: http://svn.freebsd.org/changeset/base/228512 Log: Add a test for r228510. Added: head/tools/regression/pipe/pipe-reverse2.c (contents, props changed) Added: head/tools/regression/pipe/pipe-reverse2.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/pipe/pipe-reverse2.c Wed Dec 14 23:26:48 2011 (r228512) @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 2010 Jilles Tjoelker + * 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$ + */ + +#include + +#include +#include +#include + +/* + * Check that pipes can be selected for writing in the reverse direction. + */ +int +main(int argc, char *argv[]) +{ + int pip[2]; + fd_set set; + int n; + + if (pipe(pip) == -1) + err(1, "FAIL: pipe"); + + FD_ZERO(&set); + FD_SET(pip[0], &set); + n = select(pip[1] + 1, NULL, &set, NULL, &(struct timeval){ 0, 0 }); + if (n != 1) + errx(1, "FAIL: select initial reverse direction"); + + n = write(pip[0], "x", 1); + if (n != 1) + err(1, "FAIL: write reverse direction"); + + FD_ZERO(&set); + FD_SET(pip[0], &set); + n = select(pip[1] + 1, NULL, &set, NULL, &(struct timeval){ 0, 0 }); + if (n != 1) + errx(1, "FAIL: select reverse direction after write"); + + printf("PASS\n"); + + return (0); +} From owner-svn-src-all@FreeBSD.ORG Wed Dec 14 23:57:48 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 641A5106564A; Wed, 14 Dec 2011 23:57:48 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A1668FC0A; Wed, 14 Dec 2011 23:57:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBENvlVQ020339; Wed, 14 Dec 2011 23:57:47 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBENvlIu020337; Wed, 14 Dec 2011 23:57:47 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112142357.pBENvlIu020337@svn.freebsd.org> From: Alan Cox Date: Wed, 14 Dec 2011 23:57:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228513 - head/sys/i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 14 Dec 2011 23:57:48 -0000 Author: alc Date: Wed Dec 14 23:57:47 2011 New Revision: 228513 URL: http://svn.freebsd.org/changeset/base/228513 Log: Create large page mappings in pmap_map(). MFC after: 6 weeks Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed Dec 14 23:26:48 2011 (r228512) +++ head/sys/i386/i386/pmap.c Wed Dec 14 23:57:47 2011 (r228513) @@ -1450,12 +1450,40 @@ vm_offset_t pmap_map(vm_offset_t *virt, vm_paddr_t start, vm_paddr_t end, int prot) { vm_offset_t va, sva; + vm_paddr_t superpage_offset; + pd_entry_t newpde; - va = sva = *virt; + va = *virt; + /* + * Does the physical address range's size and alignment permit at + * least one superpage mapping to be created? + */ + superpage_offset = start & PDRMASK; + if ((end - start) - ((NBPDR - superpage_offset) & PDRMASK) >= NBPDR) { + /* + * Increase the starting virtual address so that its alignment + * does not preclude the use of superpage mappings. + */ + if ((va & PDRMASK) < superpage_offset) + va = (va & ~PDRMASK) + superpage_offset; + else if ((va & PDRMASK) > superpage_offset) + va = ((va + PDRMASK) & ~PDRMASK) + superpage_offset; + } + sva = va; while (start < end) { - pmap_kenter(va, start); - va += PAGE_SIZE; - start += PAGE_SIZE; + if ((start & PDRMASK) == 0 && end - start >= NBPDR && + pseflag) { + KASSERT((va & PDRMASK) == 0, + ("pmap_map: misaligned va %#x", va)); + newpde = start | PG_PS | pgeflag | PG_RW | PG_V; + pmap_kenter_pde(va, newpde); + va += NBPDR; + start += NBPDR; + } else { + pmap_kenter(va, start); + va += PAGE_SIZE; + start += PAGE_SIZE; + } } pmap_invalidate_range(kernel_pmap, sva, va); *virt = va; From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 00:52:30 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5A4D106564A; Thu, 15 Dec 2011 00:52:30 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8AA168FC0A; Thu, 15 Dec 2011 00:52:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBF0qUoK022056; Thu, 15 Dec 2011 00:52:30 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBF0qUA5022051; Thu, 15 Dec 2011 00:52:30 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201112150052.pBF0qUA5022051@svn.freebsd.org> From: Adrian Chadd Date: Thu, 15 Dec 2011 00:52:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228514 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 00:52:30 -0000 Author: adrian Date: Thu Dec 15 00:52:30 2011 New Revision: 228514 URL: http://svn.freebsd.org/changeset/base/228514 Log: Modify the ACL code slightly to support a few nifty things: * Call it before sending probe responses, so the ACL code has the chance to reject sending them. * Pass the whole frame to the ACL code now, rather than just the destination MAC - that way the ACL module can look at the frame contents to determine what the response should be. This is part of some uncommitted work to support band steering. Sponsored by: Hobnob, Inc. Modified: head/sys/net80211/ieee80211_acl.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_proto.h Modified: head/sys/net80211/ieee80211_acl.c ============================================================================== --- head/sys/net80211/ieee80211_acl.c Wed Dec 14 23:57:47 2011 (r228513) +++ head/sys/net80211/ieee80211_acl.c Thu Dec 15 00:52:30 2011 (r228514) @@ -152,7 +152,8 @@ _acl_free(struct aclstate *as, struct ac } static int -acl_check(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) +acl_check(struct ieee80211vap *vap, const struct ieee80211_frame *wh, + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct aclstate *as = vap->iv_as; Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Wed Dec 14 23:57:47 2011 (r228513) +++ head/sys/net80211/ieee80211_hostap.c Thu Dec 15 00:52:30 2011 (r228514) @@ -1795,6 +1795,16 @@ hostap_recv_mgmt(struct ieee80211_node * return; } /* + * Consult the ACL policy module if setup. + */ + if (vap->iv_acl != NULL && + !vap->iv_acl->iac_check(vap, wh, wh->i_addr2)) { + IEEE80211_DISCARD(vap, IEEE80211_MSG_ACL, + wh, NULL, "%s", "disallowed by ACL"); + vap->iv_stats.is_rx_acl++; + return; + } + /* * prreq frame format * [tlv] ssid * [tlv] supported rates @@ -1874,7 +1884,7 @@ hostap_recv_mgmt(struct ieee80211_node * * Consult the ACL policy module if setup. */ if (vap->iv_acl != NULL && - !vap->iv_acl->iac_check(vap, wh->i_addr2)) { + !vap->iv_acl->iac_check(vap, wh, wh->i_addr2)) { IEEE80211_DISCARD(vap, IEEE80211_MSG_ACL, wh, NULL, "%s", "disallowed by ACL"); vap->iv_stats.is_rx_acl++; Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Wed Dec 14 23:57:47 2011 (r228513) +++ head/sys/net80211/ieee80211_mesh.c Thu Dec 15 00:52:30 2011 (r228514) @@ -1120,7 +1120,8 @@ mesh_input(struct ieee80211_node *ni, st * * NB: this check is also done upon peering link initiation. */ - if (vap->iv_acl != NULL && !vap->iv_acl->iac_check(vap, wh->i_addr2)) { + if (vap->iv_acl != NULL && + !vap->iv_acl->iac_check(vap, wh, wh->i_addr2)) { IEEE80211_DISCARD(vap, IEEE80211_MSG_ACL, wh, NULL, "%s", "disallowed by ACL"); vap->iv_stats.is_rx_acl++; @@ -1379,7 +1380,7 @@ mesh_recv_mgmt(struct ieee80211_node *ni * Peer only based on the current ACL policy. */ if (vap->iv_acl != NULL && - !vap->iv_acl->iac_check(vap, wh->i_addr2)) { + !vap->iv_acl->iac_check(vap, wh, wh->i_addr2)) { IEEE80211_DISCARD(vap, IEEE80211_MSG_ACL, wh, NULL, "%s", "disallowed by ACL"); vap->iv_stats.is_rx_acl++; Modified: head/sys/net80211/ieee80211_proto.h ============================================================================== --- head/sys/net80211/ieee80211_proto.h Wed Dec 14 23:57:47 2011 (r228513) +++ head/sys/net80211/ieee80211_proto.h Thu Dec 15 00:52:30 2011 (r228514) @@ -215,6 +215,7 @@ struct ieee80211_aclator { int (*iac_attach)(struct ieee80211vap *); void (*iac_detach)(struct ieee80211vap *); int (*iac_check)(struct ieee80211vap *, + const struct ieee80211_frame *wh, const uint8_t mac[IEEE80211_ADDR_LEN]); int (*iac_add)(struct ieee80211vap *, const uint8_t mac[IEEE80211_ADDR_LEN]); From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 00:54:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79AEC1065670; Thu, 15 Dec 2011 00:54:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 695378FC0A; Thu, 15 Dec 2011 00:54:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBF0sBB0022142; Thu, 15 Dec 2011 00:54:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBF0sBTo022140; Thu, 15 Dec 2011 00:54:11 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201112150054.pBF0sBTo022140@svn.freebsd.org> From: Adrian Chadd Date: Thu, 15 Dec 2011 00:54:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228515 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 00:54:11 -0000 Author: adrian Date: Thu Dec 15 00:54:11 2011 New Revision: 228515 URL: http://svn.freebsd.org/changeset/base/228515 Log: Use the correct RF version probe routine. Obtained from: Atheros Sponsored by: Hobnob, Inc. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Thu Dec 15 00:52:30 2011 (r228514) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Thu Dec 15 00:54:11 2011 (r228515) @@ -339,7 +339,7 @@ ar5416Attach(uint16_t devid, HAL_SOFTC s OS_REG_WRITE(ah, AR_PHY(0), 0x00000007); /* Read Radio Chip Rev Extract */ - AH_PRIVATE(ah)->ah_analog5GhzRev = ar5212GetRadioRev(ah); + AH_PRIVATE(ah)->ah_analog5GhzRev = ar5416GetRadioRev(ah); switch (AH_PRIVATE(ah)->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR) { case AR_RAD5122_SREV_MAJOR: /* Fowl: 5G/2x2 */ case AR_RAD2122_SREV_MAJOR: /* Fowl: 2+5G/2x2 */ From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 00:55:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 370A51065673; Thu, 15 Dec 2011 00:55:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26A9D8FC16; Thu, 15 Dec 2011 00:55:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBF0tS3b022228; Thu, 15 Dec 2011 00:55:28 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBF0tRIo022226; Thu, 15 Dec 2011 00:55:28 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201112150055.pBF0tRIo022226@svn.freebsd.org> From: Adrian Chadd Date: Thu, 15 Dec 2011 00:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228516 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 00:55:28 -0000 Author: adrian Date: Thu Dec 15 00:55:27 2011 New Revision: 228516 URL: http://svn.freebsd.org/changeset/base/228516 Log: Print out the radio RF version at startup, so I can better see which RF frontend versions people have when they submit problem reports. Sponsored by: Hobnob, Inc. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Thu Dec 15 00:54:11 2011 (r228515) +++ head/sys/dev/ath/if_ath.c Thu Dec 15 00:55:27 2011 (r228516) @@ -6218,6 +6218,8 @@ ath_announce(struct ath_softc *sc) if_printf(ifp, "AR%s mac %d.%d RF%s phy %d.%d\n", ath_hal_mac_name(ah), ah->ah_macVersion, ah->ah_macRev, ath_hal_rf_name(ah), ah->ah_phyRev >> 4, ah->ah_phyRev & 0xf); + if_printf(ifp, "2GHz radio: 0x%.4x; 5GHz radio: 0x%.4x\n", + ah->ah_analog2GhzRev, ah->ah_analog5GhzRev); if (bootverbose) { int i; for (i = 0; i <= WME_AC_VO; i++) { From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 00:59:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B869106568A; Thu, 15 Dec 2011 00:59:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A69C8FC0A; Thu, 15 Dec 2011 00:59:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBF0xBSU022371; Thu, 15 Dec 2011 00:59:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBF0xBCE022366; Thu, 15 Dec 2011 00:59:11 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201112150059.pBF0xBCE022366@svn.freebsd.org> From: Adrian Chadd Date: Thu, 15 Dec 2011 00:59:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228517 - in head/sys/dev/ath/ath_hal: ar5416 ar9002 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 00:59:12 -0000 Author: adrian Date: Thu Dec 15 00:59:11 2011 New Revision: 228517 URL: http://svn.freebsd.org/changeset/base/228517 Log: Add the 11n chipset RF frontends to the linker set, even though they're not attached this way. The AR5212 based NICs have a variety of RF frontends, so there's a linker set which the AR5212 attach routine calls. The same framework is used for the AR5416 and later but as there's a fixed RF frontend for each 11n NIC, it is just directly attached. However in the case of compiling a cut down HAL (eg _just_ AR9130 WMAC support), the linker set ends up being empty and this causes the compile to fail. So this is just a workaround for that - it means those users who wish an 11n only HAL can compile the 11n chipsets and RF frontend they need, and just "ath_ar5212" for the AR5212/AR5416 common code, and it'll just work. Sponsored by: Hobnob, Inc. Modified: head/sys/dev/ath/ath_hal/ar5416/ar2133.c head/sys/dev/ath/ath_hal/ar9002/ar9280.c head/sys/dev/ath/ath_hal/ar9002/ar9285.c head/sys/dev/ath/ath_hal/ar9002/ar9287.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar2133.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar2133.c Thu Dec 15 00:55:27 2011 (r228516) +++ head/sys/dev/ath/ath_hal/ar5416/ar2133.c Thu Dec 15 00:59:11 2011 (r228517) @@ -549,3 +549,11 @@ ar2133RfAttach(struct ath_hal *ah, HAL_S return AH_TRUE; } + +static HAL_BOOL +ar2133Probe(struct ath_hal *ah) +{ + return (AR_SREV_OWL(ah) || AR_SREV_HOWL(ah) || AR_SREV_SOWL(ah)); +} + +AH_RF(RF2133, ar2133Probe, ar2133RfAttach); Modified: head/sys/dev/ath/ath_hal/ar9002/ar9280.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9280.c Thu Dec 15 00:55:27 2011 (r228516) +++ head/sys/dev/ath/ath_hal/ar9002/ar9280.c Thu Dec 15 00:59:11 2011 (r228517) @@ -384,3 +384,11 @@ ar9280RfAttach(struct ath_hal *ah, HAL_S return AH_TRUE; } + +static HAL_BOOL +ar9280RfProbe(struct ath_hal *ah) +{ + return (AR_SREV_MERLIN(ah)); +} + +AH_RF(RF9280, ar9280RfProbe, ar9280RfAttach); Modified: head/sys/dev/ath/ath_hal/ar9002/ar9285.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9285.c Thu Dec 15 00:55:27 2011 (r228516) +++ head/sys/dev/ath/ath_hal/ar9002/ar9285.c Thu Dec 15 00:59:11 2011 (r228517) @@ -77,3 +77,11 @@ ar9285RfAttach(struct ath_hal *ah, HAL_S return AH_TRUE; } + +static HAL_BOOL +ar9285RfProbe(struct ath_hal *ah) +{ + return (AR_SREV_KITE(ah)); +} + +AH_RF(RF9285, ar9285RfProbe, ar9285RfAttach); Modified: head/sys/dev/ath/ath_hal/ar9002/ar9287.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar9002/ar9287.c Thu Dec 15 00:55:27 2011 (r228516) +++ head/sys/dev/ath/ath_hal/ar9002/ar9287.c Thu Dec 15 00:59:11 2011 (r228517) @@ -390,3 +390,11 @@ ar9287RfAttach(struct ath_hal *ah, HAL_S return AH_TRUE; } + +static HAL_BOOL +ar9287RfProbe(struct ath_hal *ah) +{ + return (AR_SREV_KIWI(ah)); +} + +AH_RF(RF9287, ar9287RfProbe, ar9287RfAttach); From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 01:03:49 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99AF8106566C; Thu, 15 Dec 2011 01:03:49 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7EE328FC12; Thu, 15 Dec 2011 01:03:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBF13nex022579; Thu, 15 Dec 2011 01:03:49 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBF13n6o022577; Thu, 15 Dec 2011 01:03:49 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201112150103.pBF13n6o022577@svn.freebsd.org> From: Adrian Chadd Date: Thu, 15 Dec 2011 01:03:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228518 - head/sys/mips/atheros X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 01:03:49 -0000 Author: adrian Date: Thu Dec 15 01:03:49 2011 New Revision: 228518 URL: http://svn.freebsd.org/changeset/base/228518 Log: Re-jiggle the GPIO code a little to remove the hard-coded AR71xx GPIO config and function mask setup. * "gpiomask" now specifies which GPIO pins to enable, for devices to bind to. * "function_set" allows bits in the function register to be set at GPIO setup. * "function_clear" allows bits in the function register to be cleared at GPIO setup. The function_set/function_clear bits allow for individual GPIO pins to either drive a GPIO line or an alternate function - eg USB, JTAG, etc. This allows for things like CS1/CS2 be enabled for those boards w/ >1 SPI device connected, or disabling JTAG for the AR7240 (which is apparently needed ..) I've verified this on the AR71xx. Modified: head/sys/mips/atheros/ar71xx_gpio.c Modified: head/sys/mips/atheros/ar71xx_gpio.c ============================================================================== --- head/sys/mips/atheros/ar71xx_gpio.c Thu Dec 15 00:59:11 2011 (r228517) +++ head/sys/mips/atheros/ar71xx_gpio.c Thu Dec 15 01:03:49 2011 (r228518) @@ -54,18 +54,6 @@ __FBSDID("$FreeBSD$"); #define DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT) -struct ar71xx_gpio_pin { - const char *name; - int pin; - int flags; -}; - -static struct ar71xx_gpio_pin ar71xx_gpio_pins[] = { - { "RFled", 2, GPIO_PIN_OUTPUT}, - { "SW4", 8, GPIO_PIN_INPUT}, - { NULL, 0, 0}, -}; - /* * Helpers */ @@ -353,8 +341,9 @@ ar71xx_gpio_attach(device_t dev) { struct ar71xx_gpio_softc *sc = device_get_softc(dev); int error = 0; - struct ar71xx_gpio_pin *pinp; - int i; + int i, j, maxpin; + int mask; + int old = 0; KASSERT((device_get_unit(dev) == 0), ("ar71xx_gpio: Only one gpio module supported")); @@ -388,25 +377,49 @@ ar71xx_gpio_attach(device_t dev) } sc->dev = dev; - ar71xx_gpio_function_enable(sc, GPIO_FUNC_SPI_CS1_EN); - ar71xx_gpio_function_enable(sc, GPIO_FUNC_SPI_CS2_EN); + + /* Enable function bits that are required */ + if (resource_int_value(device_get_name(dev), device_get_unit(dev), + "function_set", &mask) == 0) { + device_printf(dev, "function_set: 0x%x\n", mask); + ar71xx_gpio_function_enable(sc, mask); + old = 1; + } + /* Disable function bits that are required */ + if (resource_int_value(device_get_name(dev), device_get_unit(dev), + "function_clear", &mask) == 0) { + device_printf(dev, "function_clear: 0x%x\n", mask); + ar71xx_gpio_function_disable(sc, mask); + old = 1; + } + /* Handle previous behaviour */ + if (old == 0) { + ar71xx_gpio_function_enable(sc, GPIO_FUNC_SPI_CS1_EN); + ar71xx_gpio_function_enable(sc, GPIO_FUNC_SPI_CS2_EN); + } + /* Configure all pins as input */ /* disable interrupts for all pins */ GPIO_WRITE(sc, AR71XX_GPIO_INT_MASK, 0); - pinp = ar71xx_gpio_pins; - i = 0; - while (pinp->name) { - strncpy(sc->gpio_pins[i].gp_name, pinp->name, GPIOMAXNAME); - sc->gpio_pins[i].gp_pin = pinp->pin; + + /* Initialise all pins specified in the mask, up to the pin count */ + (void) ar71xx_gpio_pin_max(dev, &maxpin); + if (resource_int_value(device_get_name(dev), device_get_unit(dev), + "pinmask", &mask) != 0) + mask = 0; + device_printf(dev, "gpio pinmask=0x%x\n", mask); + for (i = 0, j = 0; j < maxpin; j++) { + if ((mask & (1 << j)) == 0) + continue; + snprintf(sc->gpio_pins[i].gp_name, GPIOMAXNAME, + "pin %d", j); + sc->gpio_pins[i].gp_pin = j; sc->gpio_pins[i].gp_caps = DEFAULT_CAPS; sc->gpio_pins[i].gp_flags = 0; - ar71xx_gpio_pin_configure(sc, &sc->gpio_pins[i], pinp->flags); - pinp++; + ar71xx_gpio_pin_configure(sc, &sc->gpio_pins[i], DEFAULT_CAPS); i++; } - sc->gpio_npins = i; - device_add_child(dev, "gpioc", device_get_unit(dev)); device_add_child(dev, "gpiobus", device_get_unit(dev)); return (bus_generic_attach(dev)); From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 01:05:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94577106564A; Thu, 15 Dec 2011 01:05:38 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83B088FC1D; Thu, 15 Dec 2011 01:05:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBF15cF9022673; Thu, 15 Dec 2011 01:05:38 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBF15cYJ022669; Thu, 15 Dec 2011 01:05:38 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201112150105.pBF15cYJ022669@svn.freebsd.org> From: Adrian Chadd Date: Thu, 15 Dec 2011 01:05:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228519 - head/sys/mips/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 01:05:38 -0000 Author: adrian Date: Thu Dec 15 01:05:38 2011 New Revision: 228519 URL: http://svn.freebsd.org/changeset/base/228519 Log: * Add in the gpio/gpioled drivers into AR91XX_BASE. * Add in a default GPIO section for AR91XX_BASE.hints, which doesn't define the GPIO function masks or any GPIO pines. * Add in the GPIO line definitions for LEDs and GPIO pins for the TP-WR1043nd. I've verified the LEDs work fine using gpioset. Modified: head/sys/mips/conf/AR91XX_BASE head/sys/mips/conf/AR91XX_BASE.hints head/sys/mips/conf/TP-WN1043ND.hints Modified: head/sys/mips/conf/AR91XX_BASE ============================================================================== --- head/sys/mips/conf/AR91XX_BASE Thu Dec 15 01:03:49 2011 (r228518) +++ head/sys/mips/conf/AR91XX_BASE Thu Dec 15 01:05:38 2011 (r228519) @@ -109,3 +109,5 @@ device md device bpf device random device if_bridge +device gpio +device gpioled Modified: head/sys/mips/conf/AR91XX_BASE.hints ============================================================================== --- head/sys/mips/conf/AR91XX_BASE.hints Thu Dec 15 01:03:49 2011 (r228518) +++ head/sys/mips/conf/AR91XX_BASE.hints Thu Dec 15 01:05:38 2011 (r228519) @@ -51,3 +51,9 @@ hint.mx25l.0.cs=0 # Watchdog hint.ar71xx_wdog.0.at="nexus0" + +# The GPIO function and pin mask is configured per-board +hint.gpio.0.at="apb0" +hint.gpio.0.maddr=0x18040000 +hint.gpio.0.msize=0x1000 +hint.gpio.0.irq=2 Modified: head/sys/mips/conf/TP-WN1043ND.hints ============================================================================== --- head/sys/mips/conf/TP-WN1043ND.hints Thu Dec 15 01:03:49 2011 (r228518) +++ head/sys/mips/conf/TP-WN1043ND.hints Thu Dec 15 01:05:38 2011 (r228519) @@ -75,3 +75,44 @@ hint.map.4.start=0x007f0000 hint.map.4.end=0x00800000 hint.map.4.name="art" hint.map.4.readonly=1 + +# GPIO specific configuration block + +# Don't flip on anything that isn't already enabled. +# This includes leaving the SPI CS1/CS2 pins as GPIO pins as they're +# not used here. +hint.gpio.0.function_set=0x00000000 +hint.gpio.0.function_clear=0x00000000 + +# These are the GPIO LEDs and buttons which can be software controlled. +hint.gpio.0.pinmask=0x001c02ae + +# pin 1 - USB (LED) +# pin 2 - System (LED) +# Pin 3 - Reset (input) +# Pin 5 - QSS (LED) +# Pin 7 - QSS Button (input) +# Pin 8 - wired into the chip reset line +# Pin 9 - WLAN +# Pin 10 - UART TX (not GPIO) +# Pin 13 - UART RX (not GPIO) +# Pin 18 - RTL8366RB switch data line +# Pin 19 - RTL8366RB switch clock line +# Pin 20 - "GPIO20" + +# LEDs are configured separately and driven by the LED device +hint.gpioled.0.at="gpiobus0" +hint.gpioled.0.name="usb" +hint.gpioled.0.pins=0x0002 + +hint.gpioled.1.at="gpiobus0" +hint.gpioled.1.name="system" +hint.gpioled.1.pins=0x0004 + +hint.gpioled.2.at="gpiobus0" +hint.gpioled.2.name="qss" +hint.gpioled.2.pins=0x0020 + +hint.gpioled.3.at="gpiobus0" +hint.gpioled.3.name="wlan" +hint.gpioled.3.pins=0x0200 From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 02:26:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F59B1065670; Thu, 15 Dec 2011 02:26:54 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 252D98FC13; Thu, 15 Dec 2011 02:26:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBF2QsKd025118; Thu, 15 Dec 2011 02:26:54 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBF2QsKW025116; Thu, 15 Dec 2011 02:26:54 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201112150226.pBF2QsKW025116@svn.freebsd.org> From: Xin LI Date: Thu, 15 Dec 2011 02:26:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228520 - head/sys/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 02:26:54 -0000 Author: delphij Date: Thu Dec 15 02:26:53 2011 New Revision: 228520 URL: http://svn.freebsd.org/changeset/base/228520 Log: Honor NFSv3 commit call (RFC 1813, Section 3.3.21) where when count is 0, the full length from offset is being flushed. Note that for now VOP_FSYNC does not support offset and length parameters so we still do the same full VOP_FSYNC. This issue was reported at FreeNAS support site as FreeNAS ticket #1096. Submitted by: "ceckerle" Prodded by: gcooper Reviewed by: rmacklem MFC after: 2 weeks Modified: head/sys/nfsserver/nfs_serv.c Modified: head/sys/nfsserver/nfs_serv.c ============================================================================== --- head/sys/nfsserver/nfs_serv.c Thu Dec 15 01:05:38 2011 (r228519) +++ head/sys/nfsserver/nfs_serv.c Thu Dec 15 02:26:53 2011 (r228520) @@ -3454,7 +3454,12 @@ nfsrv_commit(struct nfsrv_descript *nfsd } for_ret = VOP_GETATTR(vp, &bfor, cred); - if (cnt > MAX_COMMIT_COUNT) { + /* + * RFC 1813 3.3.21: if count is 0, a flush from offset to the end of file + * is done. At this time VOP_FSYNC does not accept offset and byte count + * parameters so call VOP_FSYNC the whole file for now. + */ + if (cnt == 0 || cnt > MAX_COMMIT_COUNT) { /* * Give up and do the whole thing */ From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 03:13:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14C14106566B; Thu, 15 Dec 2011 03:13:24 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03DB38FC14; Thu, 15 Dec 2011 03:13:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBF3DNtO026881; Thu, 15 Dec 2011 03:13:23 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBF3DNWk026878; Thu, 15 Dec 2011 03:13:23 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201112150313.pBF3DNWk026878@svn.freebsd.org> From: Max Khon Date: Thu, 15 Dec 2011 03:13:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228521 - head/usr.bin/make X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 03:13:24 -0000 Author: fjoe Date: Thu Dec 15 03:13:23 2011 New Revision: 228521 URL: http://svn.freebsd.org/changeset/base/228521 Log: job make: if stdout is a tty create a pty when running a command. Modified: head/usr.bin/make/Makefile head/usr.bin/make/job.c Modified: head/usr.bin/make/Makefile ============================================================================== --- head/usr.bin/make/Makefile Thu Dec 15 02:26:53 2011 (r228520) +++ head/usr.bin/make/Makefile Thu Dec 15 03:13:23 2011 (r228521) @@ -7,6 +7,8 @@ CFLAGS+=-I${.CURDIR} SRCS= arch.c buf.c cond.c dir.c for.c hash.c hash_tables.c job.c \ lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c \ util.c var.c +DPADD= ${LIBUTIL} +LDADD= -lutil NO_SHARED?= YES Modified: head/usr.bin/make/job.c ============================================================================== --- head/usr.bin/make/job.c Thu Dec 15 02:26:53 2011 (r228520) +++ head/usr.bin/make/job.c Thu Dec 15 03:13:23 2011 (r228521) @@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1798,8 +1799,13 @@ JobStart(GNode *gn, int flags, Job *prev if (usePipes) { int fd[2]; - if (pipe(fd) == -1) - Punt("Cannot create pipe: %s", strerror(errno)); + if (isatty(1)) { + if (openpty(fd + 1, fd + 0, NULL, NULL, NULL) == -1) + Punt("Cannot open pty: %s", strerror(errno)); + } else { + if (pipe(fd) == -1) + Punt("Cannot create pipe: %s", strerror(errno)); + } job->inPipe = fd[0]; job->outPipe = fd[1]; fcntl(job->inPipe, F_SETFD, 1); From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 05:07:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6D1F106564A; Thu, 15 Dec 2011 05:07:17 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 944538FC0A; Thu, 15 Dec 2011 05:07:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBF57HAI030341; Thu, 15 Dec 2011 05:07:17 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBF57HMn030333; Thu, 15 Dec 2011 05:07:17 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112150507.pBF57HMn030333@svn.freebsd.org> From: Alan Cox Date: Thu, 15 Dec 2011 05:07:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228522 - in head/sys: arm/arm dev/ti i386/xen ia64/ia64 powerpc/aim sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 05:07:17 -0000 Author: alc Date: Thu Dec 15 05:07:16 2011 New Revision: 228522 URL: http://svn.freebsd.org/changeset/base/228522 Log: Eliminate vestiges of page coloring. Modified: head/sys/arm/arm/vm_machdep.c head/sys/dev/ti/if_ti.c head/sys/i386/xen/mp_machdep.c head/sys/ia64/ia64/uma_machdep.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/uma_machdep.c head/sys/sparc64/sparc64/vm_machdep.c Modified: head/sys/arm/arm/vm_machdep.c ============================================================================== --- head/sys/arm/arm/vm_machdep.c Thu Dec 15 03:13:23 2011 (r228521) +++ head/sys/arm/arm/vm_machdep.c Thu Dec 15 05:07:16 2011 (r228522) @@ -617,7 +617,6 @@ uma_small_alloc(uma_zone_t zone, int byt void *ret; struct arm_small_page *sp; TAILQ_HEAD(,arm_small_page) *head; - static vm_pindex_t color; vm_page_t m; *flags = UMA_SLAB_PRIV; @@ -650,8 +649,7 @@ uma_small_alloc(uma_zone_t zone, int byt if (wait & M_ZERO) pflags |= VM_ALLOC_ZERO; for (;;) { - m = vm_page_alloc(NULL, color++, - pflags | VM_ALLOC_NOOBJ); + m = vm_page_alloc(NULL, 0, pflags | VM_ALLOC_NOOBJ); if (m == NULL) { if (wait & M_NOWAIT) return (NULL); Modified: head/sys/dev/ti/if_ti.c ============================================================================== --- head/sys/dev/ti/if_ti.c Thu Dec 15 03:13:23 2011 (r228521) +++ head/sys/dev/ti/if_ti.c Thu Dec 15 05:07:16 2011 (r228522) @@ -1562,7 +1562,6 @@ ti_newbuf_jumbo(struct ti_softc *sc, int struct mbuf *m[3] = {NULL, NULL, NULL}; struct ti_rx_desc_ext *r; vm_page_t frame; - static int color; /* 1 extra buf to make nobufs easy*/ struct sf_buf *sf[3] = {NULL, NULL, NULL}; int i; @@ -1605,7 +1604,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int "failed -- packet dropped!\n"); goto nobufs; } - frame = vm_page_alloc(NULL, color++, + frame = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); if (frame == NULL) { Modified: head/sys/i386/xen/mp_machdep.c ============================================================================== --- head/sys/i386/xen/mp_machdep.c Thu Dec 15 03:13:23 2011 (r228521) +++ head/sys/i386/xen/mp_machdep.c Thu Dec 15 05:07:16 2011 (r228522) @@ -815,7 +815,6 @@ cpu_initialize_context(unsigned int cpu) vm_offset_t boot_stack; vm_offset_t newPTD; vm_paddr_t ma[NPGPTD]; - static int color; int i; /* @@ -825,7 +824,7 @@ cpu_initialize_context(unsigned int cpu) * */ for (i = 0; i < NPGPTD + 2; i++) { - m[i] = vm_page_alloc(NULL, color++, + m[i] = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO); Modified: head/sys/ia64/ia64/uma_machdep.c ============================================================================== --- head/sys/ia64/ia64/uma_machdep.c Thu Dec 15 03:13:23 2011 (r228521) +++ head/sys/ia64/ia64/uma_machdep.c Thu Dec 15 05:07:16 2011 (r228522) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); void * uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { - static vm_pindex_t color; void *va; vm_page_t m; int pflags; @@ -55,7 +54,7 @@ uma_small_alloc(uma_zone_t zone, int byt pflags |= VM_ALLOC_ZERO; for (;;) { - m = vm_page_alloc(NULL, color++, pflags | VM_ALLOC_NOOBJ); + m = vm_page_alloc(NULL, 0, pflags | VM_ALLOC_NOOBJ); if (m == NULL) { if (wait & M_NOWAIT) return (NULL); Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Thu Dec 15 03:13:23 2011 (r228521) +++ head/sys/powerpc/aim/mmu_oea64.c Thu Dec 15 05:07:16 2011 (r228522) @@ -1402,7 +1402,6 @@ moea64_uma_page_alloc(uma_zone_t zone, i * kmem allocation routines, calling kmem for a new address here * can lead to multiply locking non-recursive mutexes. */ - static vm_pindex_t color; vm_offset_t va; vm_page_t m; @@ -1422,7 +1421,7 @@ moea64_uma_page_alloc(uma_zone_t zone, i pflags |= VM_ALLOC_ZERO; for (;;) { - m = vm_page_alloc(NULL, color++, pflags | VM_ALLOC_NOOBJ); + m = vm_page_alloc(NULL, 0, pflags | VM_ALLOC_NOOBJ); if (m == NULL) { if (wait & M_NOWAIT) return (NULL); Modified: head/sys/powerpc/aim/uma_machdep.c ============================================================================== --- head/sys/powerpc/aim/uma_machdep.c Thu Dec 15 03:13:23 2011 (r228521) +++ head/sys/powerpc/aim/uma_machdep.c Thu Dec 15 05:07:16 2011 (r228522) @@ -51,7 +51,6 @@ SYSCTL_INT(_hw, OID_AUTO, uma_mdpages, C void * uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { - static vm_pindex_t color; void *va; vm_page_t m; int pflags; @@ -65,7 +64,7 @@ uma_small_alloc(uma_zone_t zone, int byt pflags |= VM_ALLOC_ZERO; for (;;) { - m = vm_page_alloc(NULL, color++, pflags | VM_ALLOC_NOOBJ); + m = vm_page_alloc(NULL, 0, pflags | VM_ALLOC_NOOBJ); if (m == NULL) { if (wait & M_NOWAIT) return (NULL); Modified: head/sys/sparc64/sparc64/vm_machdep.c ============================================================================== --- head/sys/sparc64/sparc64/vm_machdep.c Thu Dec 15 03:13:23 2011 (r228521) +++ head/sys/sparc64/sparc64/vm_machdep.c Thu Dec 15 05:07:16 2011 (r228522) @@ -493,7 +493,6 @@ swi_vm(void *v) void * uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { - static vm_pindex_t color; vm_paddr_t pa; vm_page_t m; int pflags; @@ -512,7 +511,7 @@ uma_small_alloc(uma_zone_t zone, int byt pflags |= VM_ALLOC_ZERO; for (;;) { - m = vm_page_alloc(NULL, color++, pflags | VM_ALLOC_NOOBJ); + m = vm_page_alloc(NULL, 0, pflags | VM_ALLOC_NOOBJ); if (m == NULL) { if (wait & M_NOWAIT) return (NULL); From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 06:01:06 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8768106566B; Thu, 15 Dec 2011 06:01:06 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D68E48FC12; Thu, 15 Dec 2011 06:01:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBF616XS032059; Thu, 15 Dec 2011 06:01:06 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBF616TW032053; Thu, 15 Dec 2011 06:01:06 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201112150601.pBF616TW032053@svn.freebsd.org> From: Max Khon Date: Thu, 15 Dec 2011 06:01:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228523 - head/tools/regression/usr.bin/make/execution/joberr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 06:01:07 -0000 Author: fjoe Date: Thu Dec 15 06:01:06 2011 New Revision: 228523 URL: http://svn.freebsd.org/changeset/base/228523 Log: Add job error output test. make(1) with openpty() currently fails this test: there's a race condition and error output is sometimes lost. Added: head/tools/regression/usr.bin/make/execution/joberr/ head/tools/regression/usr.bin/make/execution/joberr/Makefile (contents, props changed) head/tools/regression/usr.bin/make/execution/joberr/expected.status.1 (contents, props changed) head/tools/regression/usr.bin/make/execution/joberr/expected.stderr.1 (contents, props changed) head/tools/regression/usr.bin/make/execution/joberr/expected.stdout.1 (contents, props changed) head/tools/regression/usr.bin/make/execution/joberr/test.t (contents, props changed) Added: head/tools/regression/usr.bin/make/execution/joberr/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/make/execution/joberr/Makefile Thu Dec 15 06:01:06 2011 (r228523) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +check-jobherr: +.for _t in 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 + @-${MAKE} -f ${MAKEFILE} -j2 do-$@ +.endfor + +do-check-joberr: + @echo "Error: build failed" + @exit 1 Added: head/tools/regression/usr.bin/make/execution/joberr/expected.status.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/make/execution/joberr/expected.status.1 Thu Dec 15 06:01:06 2011 (r228523) @@ -0,0 +1 @@ +0 Added: head/tools/regression/usr.bin/make/execution/joberr/expected.stderr.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/make/execution/joberr/expected.stderr.1 Thu Dec 15 06:01:06 2011 (r228523) @@ -0,0 +1,30 @@ +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error +1 error Added: head/tools/regression/usr.bin/make/execution/joberr/expected.stdout.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/make/execution/joberr/expected.stdout.1 Thu Dec 15 06:01:06 2011 (r228523) @@ -0,0 +1,90 @@ +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +Error: build failed +*** Error code 1 +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) +*** Error code 2 (ignored) Added: head/tools/regression/usr.bin/make/execution/joberr/test.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/make/execution/joberr/test.t Thu Dec 15 06:01:06 2011 (r228523) @@ -0,0 +1,15 @@ +#!/bin/sh + +# $FreeBSD$ + +cd `dirname $0` +. ../../common.sh + +# Description +DESC="Test job make error output" + +# Run +TEST_N=1 +TEST_1= + +eval_cmd $* From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 06:12:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 229D3106566B; Thu, 15 Dec 2011 06:12:44 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 111848FC16; Thu, 15 Dec 2011 06:12:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBF6ChBR032428; Thu, 15 Dec 2011 06:12:43 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBF6Chug032427; Thu, 15 Dec 2011 06:12:43 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201112150612.pBF6Chug032427@svn.freebsd.org> From: Max Khon Date: Thu, 15 Dec 2011 06:12:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228524 - head/tools/regression/usr.bin/make/execution/joberr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 06:12:44 -0000 Author: fjoe Date: Thu Dec 15 06:12:43 2011 New Revision: 228524 URL: http://svn.freebsd.org/changeset/base/228524 Log: Fix last-minute typo. Modified: head/tools/regression/usr.bin/make/execution/joberr/Makefile Modified: head/tools/regression/usr.bin/make/execution/joberr/Makefile ============================================================================== --- head/tools/regression/usr.bin/make/execution/joberr/Makefile Thu Dec 15 06:01:06 2011 (r228523) +++ head/tools/regression/usr.bin/make/execution/joberr/Makefile Thu Dec 15 06:12:43 2011 (r228524) @@ -1,6 +1,6 @@ # $FreeBSD$ -check-jobherr: +check-joberr: .for _t in 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 @-${MAKE} -f ${MAKEFILE} -j2 do-$@ .endfor From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 06:25:19 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B12601065675; Thu, 15 Dec 2011 06:25:19 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A01658FC18; Thu, 15 Dec 2011 06:25:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBF6PJYZ032868; Thu, 15 Dec 2011 06:25:19 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBF6PJHg032865; Thu, 15 Dec 2011 06:25:19 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201112150625.pBF6PJHg032865@svn.freebsd.org> From: Max Khon Date: Thu, 15 Dec 2011 06:25:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228525 - head/usr.bin/make X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 06:25:19 -0000 Author: fjoe Date: Thu Dec 15 06:25:19 2011 New Revision: 228525 URL: http://svn.freebsd.org/changeset/base/228525 Log: Revert r228521: sometimes job output is lost (see tools/regression/usr.bin/make/execution/joberr test). openpty(fd + 0, fd + 1,...) version does not have this problem but it sometimes enters an infinite sleep in "ttywait" state in tty_drain() when make(1) closes slave pty. Modified: head/usr.bin/make/Makefile head/usr.bin/make/job.c Modified: head/usr.bin/make/Makefile ============================================================================== --- head/usr.bin/make/Makefile Thu Dec 15 06:12:43 2011 (r228524) +++ head/usr.bin/make/Makefile Thu Dec 15 06:25:19 2011 (r228525) @@ -7,8 +7,6 @@ CFLAGS+=-I${.CURDIR} SRCS= arch.c buf.c cond.c dir.c for.c hash.c hash_tables.c job.c \ lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c \ util.c var.c -DPADD= ${LIBUTIL} -LDADD= -lutil NO_SHARED?= YES Modified: head/usr.bin/make/job.c ============================================================================== --- head/usr.bin/make/job.c Thu Dec 15 06:12:43 2011 (r228524) +++ head/usr.bin/make/job.c Thu Dec 15 06:25:19 2011 (r228525) @@ -115,7 +115,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -1799,13 +1798,8 @@ JobStart(GNode *gn, int flags, Job *prev if (usePipes) { int fd[2]; - if (isatty(1)) { - if (openpty(fd + 1, fd + 0, NULL, NULL, NULL) == -1) - Punt("Cannot open pty: %s", strerror(errno)); - } else { - if (pipe(fd) == -1) - Punt("Cannot create pipe: %s", strerror(errno)); - } + if (pipe(fd) == -1) + Punt("Cannot create pipe: %s", strerror(errno)); job->inPipe = fd[0]; job->outPipe = fd[1]; fcntl(job->inPipe, F_SETFD, 1); From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 06:29:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C497A106566B; Thu, 15 Dec 2011 06:29:14 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 989F38FC1C; Thu, 15 Dec 2011 06:29:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBF6TEOv033014; Thu, 15 Dec 2011 06:29:14 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBF6TEgb033009; Thu, 15 Dec 2011 06:29:14 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201112150629.pBF6TEgb033009@svn.freebsd.org> From: Kevin Lo Date: Thu, 15 Dec 2011 06:29:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228526 - in head/sys: dev/bxe dev/esp dev/twa xen/xenstore X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 06:29:14 -0000 Author: kevlo Date: Thu Dec 15 06:29:13 2011 New Revision: 228526 URL: http://svn.freebsd.org/changeset/base/228526 Log: s/timout/timeout Modified: head/sys/dev/bxe/bxe_reg.h head/sys/dev/esp/ncr53c9x.c head/sys/dev/twa/tw_osl.h head/sys/xen/xenstore/xenstore.c Modified: head/sys/dev/bxe/bxe_reg.h ============================================================================== --- head/sys/dev/bxe/bxe_reg.h Thu Dec 15 06:25:19 2011 (r228525) +++ head/sys/dev/bxe/bxe_reg.h Thu Dec 15 06:29:13 2011 (r228526) @@ -1594,7 +1594,7 @@ /* * [RW 1] Setting this bit enables a timer in the GRC block to timeout an * access that does not finish within - * ~misc_registers_grc_timout_val.grc_timeout_val cycles. When this bit is + * ~misc_registers_grc_timeout_val.grc_timeout_val cycles. When this bit is * cleared; this timeout is disabled. If this timeout occurs; the GRC shall * assert it attention output. */ Modified: head/sys/dev/esp/ncr53c9x.c ============================================================================== --- head/sys/dev/esp/ncr53c9x.c Thu Dec 15 06:25:19 2011 (r228525) +++ head/sys/dev/esp/ncr53c9x.c Thu Dec 15 06:29:13 2011 (r228526) @@ -316,7 +316,7 @@ ncr53c9x_attach(struct ncr53c9x_softc *s * The recommended timeout is 250ms. This register is loaded * with a value calculated as follows, from the docs: * - * (timout period) x (CLK frequency) + * (timeout period) x (CLK frequency) * reg = ------------------------------------- * 8192 x (Clock Conversion Factor) * Modified: head/sys/dev/twa/tw_osl.h ============================================================================== --- head/sys/dev/twa/tw_osl.h Thu Dec 15 06:25:19 2011 (r228525) +++ head/sys/dev/twa/tw_osl.h Thu Dec 15 06:29:13 2011 (r228526) @@ -153,7 +153,7 @@ struct twa_softc { struct mtx sim_lock_handle;/* sim lock shared with cam */ struct mtx *sim_lock;/* ptr to sim lock */ - struct callout watchdog_callout[2]; /* For command timout */ + struct callout watchdog_callout[2]; /* For command timeout */ TW_UINT32 watchdog_index; #ifdef TW_OSL_DEBUG Modified: head/sys/xen/xenstore/xenstore.c ============================================================================== --- head/sys/xen/xenstore/xenstore.c Thu Dec 15 06:25:19 2011 (r228525) +++ head/sys/xen/xenstore/xenstore.c Thu Dec 15 06:29:13 2011 (r228526) @@ -559,7 +559,7 @@ xs_read_store(void *tdata, unsigned len) * when msleep returns. */ error = msleep(xen_store, &xs.ring_lock, PCATCH|PDROP, - "xbread", /*timout*/0); + "xbread", /*timeout*/0); if (error && error != EWOULDBLOCK) return (error); continue; From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 08:26:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E3841065673; Thu, 15 Dec 2011 08:26:05 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 789E58FC16; Thu, 15 Dec 2011 08:26:04 +0000 (UTC) Received: by lahl5 with SMTP id l5so1153467lah.13 for ; Thu, 15 Dec 2011 00:26:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.135.195 with SMTP id pu3mr1614265lab.17.1323936168228; Thu, 15 Dec 2011 00:02:48 -0800 (PST) Sender: bschmidt@techwires.net Received: by 10.152.136.75 with HTTP; Thu, 15 Dec 2011 00:02:48 -0800 (PST) X-Originating-IP: [79.140.39.245] In-Reply-To: <201112150052.pBF0qUA5022051@svn.freebsd.org> References: <201112150052.pBF0qUA5022051@svn.freebsd.org> Date: Thu, 15 Dec 2011 09:02:48 +0100 X-Google-Sender-Auth: y4KUWmZmD2G4OizYPFFp8isfBX0 Message-ID: From: Bernhard Schmidt To: Adrian Chadd Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228514 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 08:26:05 -0000 On Thu, Dec 15, 2011 at 01:52, Adrian Chadd wrote: > Author: adrian > Date: Thu Dec 15 00:52:30 2011 > New Revision: 228514 > URL: http://svn.freebsd.org/changeset/base/228514 > > Log: > =A0Modify the ACL code slightly to support a few nifty things: > > =A0* Call it before sending probe responses, so the ACL code has the > =A0 =A0chance to reject sending them. > > =A0* Pass the whole frame to the ACL code now, rather than just the > =A0 =A0destination MAC - that way the ACL module can look at the frame > =A0 =A0contents to determine what the response should be. > > =A0This is part of some uncommitted work to support band steering. > > =A0Sponsored by: Hobnob, Inc. > > Modified: > =A0head/sys/net80211/ieee80211_acl.c > =A0head/sys/net80211/ieee80211_hostap.c > =A0head/sys/net80211/ieee80211_mesh.c > =A0head/sys/net80211/ieee80211_proto.h > > Modified: head/sys/net80211/ieee80211_acl.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/net80211/ieee80211_acl.c =A0 Wed Dec 14 23:57:47 2011 =A0 = =A0 =A0 =A0(r228513) > +++ head/sys/net80211/ieee80211_acl.c =A0 Thu Dec 15 00:52:30 2011 =A0 = =A0 =A0 =A0(r228514) > @@ -152,7 +152,8 @@ _acl_free(struct aclstate *as, struct ac > =A0} > > =A0static int > -acl_check(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN= ]) > +acl_check(struct ieee80211vap *vap, const struct ieee80211_frame *wh, > + =A0 =A0const uint8_t mac[IEEE80211_ADDR_LEN]) > =A0{ Why didn't you remove the mac argument? It is assign from wh->i_addr2 anyways, seems rather too redundant to me. --=20 Bernhard From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 09:10:04 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFAF7106566C; Thu, 15 Dec 2011 09:10:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 660808FC17; Thu, 15 Dec 2011 09:10:02 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pBF99lA9084901 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 15 Dec 2011 11:09:47 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pBF99lX9047684; Thu, 15 Dec 2011 11:09:47 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pBF99lAt047683; Thu, 15 Dec 2011 11:09:47 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 15 Dec 2011 11:09:47 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20111215090947.GK50300@deviant.kiev.zoral.com.ua> References: <201112142222.pBEMMJ1U017244@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="a/561OsMvuio6Y2Q" Content-Disposition: inline In-Reply-To: <201112142222.pBEMMJ1U017244@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228509 - in head: share/man/man9 sys/kern sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 09:10:04 -0000 --a/561OsMvuio6Y2Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > + switch (rv) { > + case KERN_INVALID_ADDRESS: > + case KERN_NO_SPACE: > + return (ENOMEM); > + case KERN_PROTECTION_FAILURE: > + return (EACCES); > + default: > + return (EINVAL); > + } You can replace this fragment with the call to vm_mmap_to_errno(). --a/561OsMvuio6Y2Q Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7puVsACgkQC3+MBN1Mb4jHbQCg4wYT+l4wlSCF5679EGYV8ahh 740An1lLRMMzI+M3S2tH6/FSNxtmI1FM =R0Du -----END PGP SIGNATURE----- --a/561OsMvuio6Y2Q-- From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 09:35:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5939106564A; Thu, 15 Dec 2011 09:35:03 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 3CDE68FC08; Thu, 15 Dec 2011 09:35:02 +0000 (UTC) Received: by vbbfr13 with SMTP id fr13so2210718vbb.13 for ; Thu, 15 Dec 2011 01:35:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=P9J1j/cdruQ8uAPIdzJ767PnP0f7sYAXZEM7aA5fRgU=; b=LRSuUiS7sdw4lo9SLJ9FQrEVslUlmSSkQj2pp8ODDNosA8W+MfXuoBQbOjyVa/v3WX ruRWzNmLyMi6f9j0FC8Gy83FbeEiAJ+BagkJX4RmVeKwJlb0/Em49xBylIblf3NsOHaL vEbUqKGQ7u2W7j93JZVExFl04Fm/fPRN27QXw= MIME-Version: 1.0 Received: by 10.52.65.129 with SMTP id x1mr2131022vds.11.1323941702422; Thu, 15 Dec 2011 01:35:02 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.52.26.50 with HTTP; Thu, 15 Dec 2011 01:35:02 -0800 (PST) In-Reply-To: References: <201112150052.pBF0qUA5022051@svn.freebsd.org> Date: Thu, 15 Dec 2011 01:35:02 -0800 X-Google-Sender-Auth: 5EuBYxwu5bOFvFJQdUELsZ5cucM Message-ID: From: Adrian Chadd To: Bernhard Schmidt Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228514 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 09:35:04 -0000 On 15 December 2011 00:02, Bernhard Schmidt wrote: > Why didn't you remove the mac argument? It is assign from wh->i_addr2 > anyways, seems rather too redundant to me. Because the semantics for that right now are "check that MAC", so it's the callers responsibility to determine which MAC in the header is the relevant one to check against. They're all addr2 though, and I haven't yet thought of a reason it could be addr1 or addr3 (or addr4, for that matter); I just decided to leave it this way so the semantics of "the caller dictates which MAC in the frame is the relevant one to check against" as-is. If you think that's me being a bit overly anal about it, then sure, please go ahead and turf it. :) Personally, I'd like to add an enum field (and then remove the MAC) - the enum field would indicate to acl_check() _which_ ACL is being checked - ie, probe request, association request, and any other frame check request. That way it's precisely clear what the ACL check is for. But again, that's just me being overly picky. :) So in short: if you're happy removing it, remove it. :) Adrian From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 10:16:02 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E8B51065673; Thu, 15 Dec 2011 10:16:02 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 7BC2D8FC0C; Thu, 15 Dec 2011 10:16:00 +0000 (UTC) Received: by lahl5 with SMTP id l5so1196407lah.13 for ; Thu, 15 Dec 2011 02:16:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.105.84 with SMTP id gk20mr2031544lab.10.1323944159938; Thu, 15 Dec 2011 02:15:59 -0800 (PST) Sender: bschmidt@techwires.net Received: by 10.152.136.75 with HTTP; Thu, 15 Dec 2011 02:15:59 -0800 (PST) X-Originating-IP: [79.140.39.245] In-Reply-To: References: <201112150052.pBF0qUA5022051@svn.freebsd.org> Date: Thu, 15 Dec 2011 11:15:59 +0100 X-Google-Sender-Auth: AmZBlmGIeQt5xKcAySr4s7C2rnU Message-ID: From: Bernhard Schmidt To: Adrian Chadd Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228514 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 10:16:02 -0000 On Thu, Dec 15, 2011 at 10:35, Adrian Chadd wrote: > On 15 December 2011 00:02, Bernhard Schmidt wrote: > >> Why didn't you remove the mac argument? It is assign from wh->i_addr2 >> anyways, seems rather too redundant to me. > > Because the semantics for that right now are "check that MAC", so it's > the callers responsibility to determine which MAC in the header is the > relevant one to check against. > > They're all addr2 though, and I haven't yet thought of a reason it > could be addr1 or addr3 (or addr4, for that matter); I just decided to > leave it this way so the semantics of "the caller dictates which MAC > in the frame is the relevant one to check against" as-is. And no one else has found a reason to do so in the last 7 years that code exists :) > If you think that's me being a bit overly anal about it, then sure, > please go ahead and turf it. :) > > Personally, I'd like to add an enum field (and then remove the MAC) - > the enum field would indicate to acl_check() _which_ ACL is being > checked - ie, probe request, association request, and any other frame > check request. That way it's precisely clear what the ACL check is > for. But again, that's just me being overly picky. :) Well, no. The ACL stuff was designed to have one module for each usage and not one for everything. Following your example you would have one for assoc frames/probe frames (whatever the desired behavior is), .. and the already existing one for macs. Well, just this piece isn't that optimal yet: /* XXX just one for now */ static const struct ieee80211_aclator *acl = NULL; So, my point is, I'd like to keep the functionality of the wlan_acl(4) module as it is, matching wh->i_addr2 with the list of given macs only. If you (or someone) else have some different functionality in mind, add a new acl module which replaces the current one using ieee80211_aclator_register() and do whatever you want in there. > So in short: if you're happy removing it, remove it. :) I agree on passing the frame as an argument to iac_check() and obtain the mac from there, that definitely is required for more advanced ACLs. Passing both tough, is imho not required and redundant, so, yes I think I'm going to remove it. -- Bernhard From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 11:15:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7A48106568E; Thu, 15 Dec 2011 11:15:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6CC38FC25; Thu, 15 Dec 2011 11:15:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFBFNPx045122; Thu, 15 Dec 2011 11:15:23 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFBFNjb045120; Thu, 15 Dec 2011 11:15:23 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112151115.pBFBFNjb045120@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 15 Dec 2011 11:15:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228527 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 11:15:23 -0000 Author: glebius Date: Thu Dec 15 11:15:23 2011 New Revision: 228527 URL: http://svn.freebsd.org/changeset/base/228527 Log: Add RADIX_MPATH to LINT. Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Dec 15 06:29:13 2011 (r228526) +++ head/sys/conf/NOTES Thu Dec 15 11:15:23 2011 (r228527) @@ -916,6 +916,8 @@ device lagg # for sockets with the SO_DEBUG option set, which can then be examined # using the trpt(8) utility. # +# RADIX_MPATH provides support for multiple forwarding tables. +# options MROUTING # Multicast routing options IPFIREWALL #firewall options IPFIREWALL_VERBOSE #enable logging to syslogd(8) @@ -930,6 +932,7 @@ options IPFILTER_LOOKUP #ipfilter pool options IPFILTER_DEFAULT_BLOCK #block all packets by default options IPSTEALTH #support for stealth forwarding options TCPDEBUG +options RADIX_MPATH # The MBUF_STRESS_TEST option enables options which create # various random failures / extreme cases related to mbuf From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 11:16:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D36D21065673; Thu, 15 Dec 2011 11:16:41 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C05FF8FC17; Thu, 15 Dec 2011 11:16:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFBGf2S045198; Thu, 15 Dec 2011 11:16:41 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFBGfjY045196; Thu, 15 Dec 2011 11:16:41 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201112151116.pBFBGfjY045196@svn.freebsd.org> From: David Chisnall Date: Thu, 15 Dec 2011 11:16:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228528 - head/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 11:16:41 -0000 Author: theraven Date: Thu Dec 15 11:16:41 2011 New Revision: 228528 URL: http://svn.freebsd.org/changeset/base/228528 Log: Small style(9) improvements. Approved by: dim (mentor) Modified: head/lib/libc/stdlib/quick_exit.c Modified: head/lib/libc/stdlib/quick_exit.c ============================================================================== --- head/lib/libc/stdlib/quick_exit.c Thu Dec 15 11:15:23 2011 (r228527) +++ head/lib/libc/stdlib/quick_exit.c Thu Dec 15 11:16:41 2011 (r228528) @@ -51,10 +51,12 @@ static struct quick_exit_handler *handle int at_quick_exit(void (*func)(void)) { - struct quick_exit_handler *h = malloc(sizeof(struct quick_exit_handler)); + struct quick_exit_handler *h; + + h = malloc(sizeof(*h)); if (NULL == h) - return 1; + return (1); h->cleanup = func; pthread_mutex_lock(&atexit_mutex); h->next = handlers; From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 11:21:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48BC4106564A; Thu, 15 Dec 2011 11:21:57 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37BE38FC1F; Thu, 15 Dec 2011 11:21:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFBLvro045391; Thu, 15 Dec 2011 11:21:57 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFBLv6H045389; Thu, 15 Dec 2011 11:21:57 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201112151121.pBFBLv6H045389@svn.freebsd.org> From: David Chisnall Date: Thu, 15 Dec 2011 11:21:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228529 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 11:21:57 -0000 Author: theraven Date: Thu Dec 15 11:21:56 2011 New Revision: 228529 URL: http://svn.freebsd.org/changeset/base/228529 Log: Add a pointless and superfluous GNUism that people at a certain large data aggregation and advertising company seem to believe is standard. Approved by: dim (mentor) Modified: head/sys/sys/stdint.h Modified: head/sys/sys/stdint.h ============================================================================== --- head/sys/sys/stdint.h Thu Dec 15 11:16:41 2011 (r228528) +++ head/sys/sys/stdint.h Thu Dec 15 11:21:56 2011 (r228529) @@ -64,4 +64,11 @@ typedef __uintmax_t uintmax_t; #define _UINTMAX_T_DECLARED #endif +/* GNU and Darwin define this and people seem to think it's portable */ +#if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX) +#define __WORDSIZE 64 +#else +#define __WORDSIZE 32 +#endif + #endif /* !_SYS_STDINT_H_ */ From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 12:14:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4D96106566B; Thu, 15 Dec 2011 12:14:15 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D38B78FC08; Thu, 15 Dec 2011 12:14:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFCEFLa047051; Thu, 15 Dec 2011 12:14:15 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFCEFo6047048; Thu, 15 Dec 2011 12:14:15 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201112151214.pBFCEFo6047048@svn.freebsd.org> From: Rafal Jaworowski Date: Thu, 15 Dec 2011 12:14:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228530 - in head/sys/arm: arm include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 12:14:16 -0000 Author: raj Date: Thu Dec 15 12:14:15 2011 New Revision: 228530 URL: http://svn.freebsd.org/changeset/base/228530 Log: ARM pmap fixes: - Write Buffers have to be drained after write to Page Table even if caches are in write-through mode. - Make sure to sync PTE in pmap_zero_page_generic(). Submitted by: Michal Mazur Reviewed by: cognet Obtained from: Semihalf MFC after: 1 month Modified: head/sys/arm/arm/pmap.c head/sys/arm/include/pmap.h Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Thu Dec 15 11:21:56 2011 (r228529) +++ head/sys/arm/arm/pmap.c Thu Dec 15 12:14:15 2011 (r228530) @@ -4039,6 +4039,7 @@ pmap_zero_page_generic(vm_paddr_t phys, * order to work without corruption when write-allocate is enabled. */ *cdst_pte = L2_S_PROTO | phys | L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE); + PTE_SYNC(cdst_pte); cpu_tlb_flushD_SE(cdstp); cpu_cpwait(); if (off || size != PAGE_SIZE) Modified: head/sys/arm/include/pmap.h ============================================================================== --- head/sys/arm/include/pmap.h Thu Dec 15 11:21:56 2011 (r228529) +++ head/sys/arm/include/pmap.h Thu Dec 15 12:14:15 2011 (r228530) @@ -382,7 +382,8 @@ do { \ if (PMAP_NEEDS_PTE_SYNC) { \ cpu_dcache_wb_range((vm_offset_t)(pte), sizeof(pt_entry_t));\ cpu_l2cache_wb_range((vm_offset_t)(pte), sizeof(pt_entry_t));\ - }\ + } else \ + cpu_drain_writebuf(); \ } while (/*CONSTCOND*/0) #define PTE_SYNC_RANGE(pte, cnt) \ @@ -392,7 +393,8 @@ do { \ (cnt) << 2); /* * sizeof(pt_entry_t) */ \ cpu_l2cache_wb_range((vm_offset_t)(pte), \ (cnt) << 2); /* * sizeof(pt_entry_t) */ \ - } \ + } else \ + cpu_drain_writebuf(); \ } while (/*CONSTCOND*/0) extern pt_entry_t pte_l1_s_cache_mode; From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 12:20:49 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B6301065672; Thu, 15 Dec 2011 12:20:49 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id 9ECED8FC1A; Thu, 15 Dec 2011 12:20:48 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id AE0BF2A28CD6; Thu, 15 Dec 2011 13:20:47 +0100 (CET) Date: Thu, 15 Dec 2011 13:20:47 +0100 From: Ed Schouten To: Bruce Evans Message-ID: <20111215122047.GN1771@hoeg.nl> References: <201112140909.pBE99bS3090646@svn.freebsd.org> <20111214234615.B3839@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xTKfHyrFnSV9DG3y" Content-Disposition: inline In-Reply-To: <20111214234615.B3839@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228495 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 12:20:49 -0000 --xTKfHyrFnSV9DG3y Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Bruce, After reading through your email, I think it's best to fix things using the following patch. Essentially it does the following: - It makes sure __alignof() is always present, by defining it as a macro for GCC < 2.95. - All the C1X macros can now be implemented using the ones we already had (__dead2, etc). This means we don't need to repeat all the compiler version specific checks. - While there, add struct __hack to the _Static_assert, as it always requires a semicolon. Thanks for your feedback. | Index: sys/sys/cdefs.h | =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D | --- sys/sys/cdefs.h (revision 228504) | +++ sys/sys/cdefs.h (working copy) | @@ -230,27 +230,24 @@ | #elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L | /* Do nothing. They are language keywords. */ | #else | -/* Not supported. Implement them manually. */ | -#ifdef __GNUC__ | -#define _Alignas(e) __attribute__((__aligned__(e))) | -#define _Alignof(e) __alignof__(e) | -#define _Noreturn __attribute__((__noreturn__)) | +/* Not supported. Implement them using our versions. */ | +#define _Alignas(e) __aligned(e) | +#define _Alignof(e) __alignof(e) | +#define _Noreturn __dead2 | #define _Thread_local __thread | -#else | -#define _Alignas(e) | -#define _Alignof(e) __offsetof(struct { char __a; e __b; }, __b) | -#define _Noreturn | -#define _Thread_local | -#endif | #ifdef __COUNTER__ | #define _Static_assert(e, s) __Static_assert(e, __COUNTER__) | #define __Static_assert(e, c) ___Static_assert(e, c) | #define ___Static_assert(e, c) typedef char __assert ## c[(e) ? 1 : -1] | #else | -#define _Static_assert(e, s) | +#define _Static_assert(e, s) struct __hack | #endif | #endif | =20 | +#if !__GNUC_PREREQ__(2, 95) | +#define __alignof(x) __offsetof(struct { char __a; e __b; }, __b) | +#endif | + | #if __GNUC_PREREQ__(2, 96) | #define __malloc_like __attribute__((__malloc__)) | #define __pure __attribute__((__pure__)) --=20 Ed Schouten WWW: http://80386.nl/ --xTKfHyrFnSV9DG3y Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iQIcBAEBAgAGBQJO6eYfAAoJEG5e2P40kaK7hM0P/1Nl06aivaqmH7u54AWA48hN cRfNqL3ExyeB00ayAgrFoD3IOJ6txoufsWvqOlvGRQh5Alf9GDDdJ6DOQ94K4mu1 IuDbT6lkKmitlwvFSRD5lC7UqORtvU7GTelVXuq4N2onwFCe79FQc5tsME89bBVx o49f0ODsOiAMwRwFgD9GPkHB2J1tOhWjEvdj0P+otrtrcl4aHNdhYUxpVP9kM3iA xHwy2Z1utn7ufFutd5/8xZvyPs7kSzs0OC0wAdSFYbEWl/mIpEkCj60RXiTkurfx hVM9OmWLGtKfkK6yC6mls9gsTPbhL2KC0IO5KjplwjZknTHnBpHdMLG2AeyWrpmi OebgPK4Pwjf+X+nNlBb9ttkvANF9XIcMZVzaVqg7Y8SlUDQPDgHB8MrlGvZoZu9i XRmrW0B4ntqfcVfcjotWiKvJrdCv5eYhCK6cbA4CEoatzua8GgI6TeYQGLRG3oWh s9azf/5Wv3XW8asppNj3O9JjJ/db8rBoekmI4mBFC/UXvsLFgjkKRfYHUFyJggJu f1s1q51pMqtqzPUWB37R1iVxfZTrQAe/sitybSukXN/k2u0k3/x47OGHqJ/anUvR 8ZuASDEZ+opI97tTt1cIbFXmhj9QJGlAE27TLWwyh9JNehRArL0HMLtU8nrZuNR1 gxUoZofFurRXr3Z8Yz0V =AIeb -----END PGP SIGNATURE----- --xTKfHyrFnSV9DG3y-- From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 12:35:04 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D312106564A; Thu, 15 Dec 2011 12:35:04 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 586858FC0A; Thu, 15 Dec 2011 12:35:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFCZ4F2047736; Thu, 15 Dec 2011 12:35:04 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFCZ4kD047735; Thu, 15 Dec 2011 12:35:04 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201112151235.pBFCZ4kD047735@svn.freebsd.org> From: Michael Tuexen Date: Thu, 15 Dec 2011 12:35:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228531 - head/lib/libc/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 12:35:04 -0000 Author: tuexen Date: Thu Dec 15 12:35:03 2011 New Revision: 228531 URL: http://svn.freebsd.org/changeset/base/228531 Log: Fix a bug where sctp_sendmdg() uses uninitialized memory. MFC after: 3 days. Modified: head/lib/libc/net/sctp_sys_calls.c Modified: head/lib/libc/net/sctp_sys_calls.c ============================================================================== --- head/lib/libc/net/sctp_sys_calls.c Thu Dec 15 12:14:15 2011 (r228530) +++ head/lib/libc/net/sctp_sys_calls.c Thu Dec 15 12:35:03 2011 (r228531) @@ -563,6 +563,7 @@ sctp_sendmsg(int s, #ifdef SYS_sctp_generic_sendmsg struct sctp_sndrcvinfo sinfo; + memset(&sinfo, 0, sizeof(struct sctp_sndrcvinfo)); sinfo.sinfo_ppid = ppid; sinfo.sinfo_flags = flags; sinfo.sinfo_stream = stream_no; From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 12:49:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F2B3106564A; Thu, 15 Dec 2011 12:49:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E2968FC1D; Thu, 15 Dec 2011 12:49:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFCnBXG048242; Thu, 15 Dec 2011 12:49:11 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFCnBR2048240; Thu, 15 Dec 2011 12:49:11 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112151249.pBFCnBR2048240@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 15 Dec 2011 12:49:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228532 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 12:49:11 -0000 Author: glebius Date: Thu Dec 15 12:49:10 2011 New Revision: 228532 URL: http://svn.freebsd.org/changeset/base/228532 Log: Simplify rtrequest(RTM_ADD): ifa can't be NULL after rt_getifa_fib(). Modified: head/sys/net/route.c Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Thu Dec 15 12:35:03 2011 (r228531) +++ head/sys/net/route.c Thu Dec 15 12:49:10 2011 (r228532) @@ -1128,8 +1128,7 @@ rtrequest1_fib(int req, struct rt_addrin ifa = info->rti_ifa; rt = uma_zalloc(V_rtzone, M_NOWAIT | M_ZERO); if (rt == NULL) { - if (ifa != NULL) - ifa_free(ifa); + ifa_free(ifa); senderr(ENOBUFS); } RT_LOCK_INIT(rt); @@ -1142,8 +1141,7 @@ rtrequest1_fib(int req, struct rt_addrin RT_LOCK(rt); if ((error = rt_setgate(rt, dst, gateway)) != 0) { RT_LOCK_DESTROY(rt); - if (ifa != NULL) - ifa_free(ifa); + ifa_free(ifa); uma_zfree(V_rtzone, rt); senderr(error); } @@ -1174,9 +1172,7 @@ rtrequest1_fib(int req, struct rt_addrin /* do not permit exactly the same dst/mask/gw pair */ if (rn_mpath_capable(rnh) && rt_mpath_conflict(rnh, rt, netmask)) { - if (rt->rt_ifa) { - ifa_free(rt->rt_ifa); - } + ifa_free(rt->rt_ifa); Free(rt_key(rt)); RT_LOCK_DESTROY(rt); uma_zfree(V_rtzone, rt); @@ -1241,8 +1237,7 @@ rtrequest1_fib(int req, struct rt_addrin * then un-make it (this should be a function) */ if (rn == NULL) { - if (rt->rt_ifa) - ifa_free(rt->rt_ifa); + ifa_free(rt->rt_ifa); Free(rt_key(rt)); RT_LOCK_DESTROY(rt); uma_zfree(V_rtzone, rt); From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 14:12:45 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74A651065676; Thu, 15 Dec 2011 14:12:45 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 0F9638FC0C; Thu, 15 Dec 2011 14:12:44 +0000 (UTC) Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pBFECGva032176 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 16 Dec 2011 01:12:38 +1100 Date: Fri, 16 Dec 2011 01:12:16 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Schouten In-Reply-To: <20111215122047.GN1771@hoeg.nl> Message-ID: <20111216000117.R2632@besplex.bde.org> References: <201112140909.pBE99bS3090646@svn.freebsd.org> <20111214234615.B3839@besplex.bde.org> <20111215122047.GN1771@hoeg.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans Subject: Re: svn commit: r228495 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 14:12:45 -0000 On Thu, 15 Dec 2011, Ed Schouten wrote: > Hello Bruce, > > After reading through your email, I think it's best to fix things using > the following patch. Essentially it does the following: > > - It makes sure __alignof() is always present, by defining it as a macro > for GCC < 2.95. I tested this with a K&R compiler. It worked (since it is similar to the fallback for offsetof() which always worked) after fixing 2 bugs that prevented the fallback working with any compiler. >From your patch (quoted below): > | +#if !__GNUC_PREREQ__(2, 95) > | +#define __alignof(x) __offsetof(struct { char __a; e __b; }, __b) > | +#endif The 2 bugs are: 1. Even __offsetof() is broken in the fallback case (that's all cases where it uses a struct like the above and doesn't use a gccish builtin). This is because __offsetof() uses size_t, but size_t is not necessarily in declared. offsetof() in , etc. works because size_t is necessarily declared there. BTW, the ifdef for __offsetof in is bogus since is always included so __offsetof is always defined. __size_t could be used, but that would give lots of pollution for cdefs.h, and the file that declares __size_t, namely is broken in fallback cases: - recently broken for K&R since it now uses signed instead of __signed - broken for longer for K&R and C90 since it uses long long. In working versions, the __int64_t declarations were hacked for 32-bit machines on to make them compile (but not work). Non-hacked versions should simply not declare the 64-bit types if the compiler doesn't support them. 2. The macro parameter x is now mispelled, so it is never used, and the non-misspelled macro parameter e gives a syntax error when it is used in the macro body. Test program: % #include % % typedef unsigned size_t; /* XXX */ % % #define __alignof(e) __offsetof(struct { char __a; e __b; }, __b) % % int c = __alignof(char); % int s = __alignof(short); % int i = __alignof(int); % int l = __alignof(long); % int f = __alignof(float); % int d = __alignof(double); Fixes: 1. Just a hack to make __offsetof() work. I don't know a good way to declare __size_t. Of course, size_t should not be used. 2. Change the spelling back to e. I prefer x, but all the other definitions use e. > - All the C1X macros can now be implemented using the ones we already > had (__dead2, etc). This means we don't need to repeat all the > compiler version specific checks. > - While there, add struct __hack to the _Static_assert, as it always > requires a semicolon. Good. > | Index: sys/sys/cdefs.h > | =================================================================== > | --- sys/sys/cdefs.h (revision 228504) > | +++ sys/sys/cdefs.h (working copy) > | @@ -230,27 +230,24 @@ > | #elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L > | /* Do nothing. They are language keywords. */ > | #else > | -/* Not supported. Implement them manually. */ > | -#ifdef __GNUC__ > | -#define _Alignas(e) __attribute__((__aligned__(e))) > | -#define _Alignof(e) __alignof__(e) > | -#define _Noreturn __attribute__((__noreturn__)) > | +/* Not supported. Implement them using our versions. */ It may be worth emphasizing that in some cases, "our version" doesn't exist, and that this is intentional (we omit the definition when none is possible, and this results in __aligned() sometimes not being defined and __thread never being defined). > | +#define _Alignas(e) __aligned(e) > | +#define _Alignof(e) __alignof(e) I prefer to always spell the parameter as x. Most older macros in this file, and CTASSERT() in another file, spell their parameters (x, y, ...). > | +#define _Noreturn __dead2 > | #define _Thread_local __thread > | -#else > | -#define _Alignas(e) > | -#define _Alignof(e) __offsetof(struct { char __a; e __b; }, __b) > | -#define _Noreturn > | -#define _Thread_local > | -#endif > | #ifdef __COUNTER__ > | #define _Static_assert(e, s) __Static_assert(e, __COUNTER__) > | #define __Static_assert(e, c) ___Static_assert(e, c) > | #define ___Static_assert(e, c) typedef char __assert ## c[(e) ? 1 : -1] > | #else > | -#define _Static_assert(e, s) > | +#define _Static_assert(e, s) struct __hack CTASSERT() has regressed for compilers that don't support __COUNTER__, since it uses this. Previously: - CTASSERT() never worked for K&R compilers, since it uses C90 token pasting - CTASSERT() worked for all C90 and later compilers. > | #endif > | #endif > | > | +#if !__GNUC_PREREQ__(2, 95) > | +#define __alignof(x) __offsetof(struct { char __a; e __b; }, __b) > | +#endif Needs the spelling fix. > | + > | #if __GNUC_PREREQ__(2, 96) > | #define __malloc_like __attribute__((__malloc__)) > | #define __pure __attribute__((__pure__)) Check the sorting of the new macros, especially __alignof(). I think the ordering should be mostly on the gcc and standards version, not on the order in which the macros were added to cdefs.h. You sorted the 2.95 ifdef before a 2.96 ifdef, but this 2.96 ifdef is especially disordered according to my rule. Even if the order is "logical" instead of historical, it makes more sense to define basic macros like __alignof() before using them. Bruce From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 14:44:45 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 785381065677; Thu, 15 Dec 2011 14:44:45 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id B5A758FC14; Thu, 15 Dec 2011 14:44:44 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id D18842A28CE3; Thu, 15 Dec 2011 15:44:43 +0100 (CET) Date: Thu, 15 Dec 2011 15:44:43 +0100 From: Ed Schouten To: Bruce Evans Message-ID: <20111215144443.GQ1771@hoeg.nl> References: <201112140909.pBE99bS3090646@svn.freebsd.org> <20111214234615.B3839@besplex.bde.org> <20111215122047.GN1771@hoeg.nl> <20111216000117.R2632@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Tcb1KvpfnM4LxW2s" Content-Disposition: inline In-Reply-To: <20111216000117.R2632@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228495 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 14:44:45 -0000 --Tcb1KvpfnM4LxW2s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Bruce, * Bruce Evans , 20111215 15:12: > The 2 bugs are: > 1. Even __offsetof() is broken in the fallback case (that's all cases > where it uses a struct like the above and doesn't use a gccish builtin= ). > This is because __offsetof() uses size_t, but size_t is not necessarily > in declared. offsetof() in , etc. works because size_t is > necessarily declared there. BTW, the ifdef for __offsetof in > is bogus since is always included so > __offsetof is always defined. >=20 > __size_t could be used, but that would give lots of pollution for > cdefs.h, and the file that declares __size_t, namely > is broken in fallback cases: > - recently broken for K&R since it now uses signed instead of __signed > - broken for longer for K&R and C90 since it uses long long. In worki= ng > versions, the __int64_t declarations were hacked for 32-bit machines > on to make them compile (but not work). Non-hacked versions should > simply not declare the 64-bit types if the compiler doesn't support > them. Well, the dependency is circular, as depends on as well, so that's not a real solution. This is a bit blunt, but maybe we should simply use "unsigned long" there, under the assumption that on all architectures we support it is equal in size, and if not likely big enough to store the result. > CTASSERT() has regressed for compilers that don't support __COUNTER__, > since it uses this. Previously: > - CTASSERT() never worked for K&R compilers, since it uses C90 token past= ing > - CTASSERT() worked for all C90 and later compilers. Yes. I am considering merging back the __COUNTER__ fix to FreeBSD 9 after it has been released, so it shouldn't be too bad. Basically we have to make a trade-off: - Make it possible to use CTASSERT() and _Static_assert() in more places throughout the tree (headers), or - support CTASSERT() and _Static_assert() for non-default compilers that are older than GCC 4.3. I suspect that if people switch to non-default compilers to build FreeBSD sources, they aren't doing it because they want to use an older version of GCC. > Check the sorting of the new macros, especially __alignof(). I think > the ordering should be mostly on the gcc and standards version, not on > the order in which the macros were added to cdefs.h. You sorted the 2.95 > ifdef before a 2.96 ifdef, but this 2.96 ifdef is especially disordered > according to my rule. Even if the order is "logical" instead of historic= al, > it makes more sense to define basic macros like __alignof() before using > them. I've placed it right above the C1X block now. %%% Index: sys/sys/cdefs.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/sys/cdefs.h (revision 228530) +++ sys/sys/cdefs.h (working copy) @@ -218,6 +218,10 @@ #endif #endif =20 +#if !__GNUC_PREREQ__(2, 95) +#define __alignof(x) __offsetof(struct { char __a; x __b; }, __b) +#endif + /* * Keywords added in C1X. */ @@ -230,24 +234,17 @@ #elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L /* Do nothing. They are language keywords. */ #else -/* Not supported. Implement them manually. */ -#ifdef __GNUC__ -#define _Alignas(e) __attribute__((__aligned__(e))) -#define _Alignof(e) __alignof__(e) -#define _Noreturn __attribute__((__noreturn__)) +/* Not supported. Implement them using our versions. */ +#define _Alignas(x) __aligned(x) +#define _Alignof(x) __alignof(x) +#define _Noreturn __dead2 #define _Thread_local __thread -#else -#define _Alignas(e) -#define _Alignof(e) __offsetof(struct { char __a; e __b; }, __b) -#define _Noreturn -#define _Thread_local -#endif #ifdef __COUNTER__ -#define _Static_assert(e, s) __Static_assert(e, __COUNTER__) -#define __Static_assert(e, c) ___Static_assert(e, c) -#define ___Static_assert(e, c) typedef char __assert ## c[(e) ? 1 : -1] +#define _Static_assert(x, y) __Static_assert(x, __COUNTER__) +#define __Static_assert(x, y) ___Static_assert(x, y) +#define ___Static_assert(x, y) typedef char __assert ## c[(x) ? 1 : -1] #else -#define _Static_assert(e, s) +#define _Static_assert(x, y) struct __hack #endif #endif =20 %%% --=20 Ed Schouten WWW: http://80386.nl/ --Tcb1KvpfnM4LxW2s Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iQIcBAEBAgAGBQJO6gfbAAoJEG5e2P40kaK7lZAQAIGUkZcXQooERo/IIcHo8Rgd E6NO5Al4h4DT0gj2JLnetyffaTUQSe4Zpz1iZ3lXpNDepVeFg3zM7H2x18dpnCBx oEsPIQOyW5NIQCq9J9kuYzBSDz1w08j65yAtBnaTqxgsb4ybbFcuAg17NzxHPl40 NCcjfNgiPJTSlQXaqmSv1oRmQ1yKQWJjnp/BFaW6ZsKK5OsYLjMYF29mW2sgpGfE Q8x3EXdBUo3lruaYo5QMubtFaGUP+ylN/Uwo0phckAKaBJ0Hi+L3IsMLmM2WHxal MSepf8IgxJh4NM875Lz9AVA39uDbxm0QU87UbOeFQT0VoMxfCmkY6RIIhz+vXtPw Kn2ngnDozCGhpF7QuJ0OuM6euez+SKyxZSCfHGJNJT9RDn9mD+twQerm6uWXDope Iqdf4+FmSd0fHxTfnWdczKmWAbP96ZSc08pQeKkLA9aQtkGl8laHGKxp/nVACrZp peSR2N/dpYiqajk1WtvEX+5EN/LQLT5ErVM8BqSbS05kmVTvpQxUUI93N1JeYwxg x2dSPGRuV8K7fcqXQ3QwQFxjRTxpNb6wtMj+db2Oh/ePT05DtJxKkK53UmXH3yPa 8LV/bXK8wIK9Opgtd4Q3iVpk21aqDmrgkSRlN+P5zU8rv7xuW8kXsLB5NEOirMQe 3yfhVlWoljhGh0YSbrIW =Dafc -----END PGP SIGNATURE----- --Tcb1KvpfnM4LxW2s-- From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 14:56:46 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC502106566C; Thu, 15 Dec 2011 14:56:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C366B8FC12; Thu, 15 Dec 2011 14:56:46 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 7A2FF46B43; Thu, 15 Dec 2011 09:56:46 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 0C83CB94F; Thu, 15 Dec 2011 09:56:46 -0500 (EST) From: John Baldwin To: Xin LI Date: Thu, 15 Dec 2011 08:23:02 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201112150226.pBF2QsKW025116@svn.freebsd.org> In-Reply-To: <201112150226.pBF2QsKW025116@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201112150823.03016.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 15 Dec 2011 09:56:46 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228520 - head/sys/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 14:56:47 -0000 On Wednesday, December 14, 2011 9:26:54 pm Xin LI wrote: > Author: delphij > Date: Thu Dec 15 02:26:53 2011 > New Revision: 228520 > URL: http://svn.freebsd.org/changeset/base/228520 > > Log: > Honor NFSv3 commit call (RFC 1813, Section 3.3.21) where when count is 0, > the full length from offset is being flushed. Note that for now VOP_FSYNC > does not support offset and length parameters so we still do the same full > VOP_FSYNC. This issue was reported at FreeNAS support site as FreeNAS > ticket #1096. > > Submitted by: "ceckerle" > Prodded by: gcooper > Reviewed by: rmacklem > MFC after: 2 weeks This is part of the patch in the PR that had NFS write clustering as well (kern/118126). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 15:17:19 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4E1F1065672; Thu, 15 Dec 2011 15:17:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D37508FC14; Thu, 15 Dec 2011 15:17:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFFHJiW054405; Thu, 15 Dec 2011 15:17:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFFHJ5N054402; Thu, 15 Dec 2011 15:17:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201112151517.pBFFHJ5N054402@svn.freebsd.org> From: John Baldwin Date: Thu, 15 Dec 2011 15:17:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228533 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 15:17:20 -0000 Author: jhb Date: Thu Dec 15 15:17:19 2011 New Revision: 228533 URL: http://svn.freebsd.org/changeset/base/228533 Log: Use vm_mmap_to_errno(). Submitted by: kib Modified: head/sys/kern/uipc_shm.c Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Thu Dec 15 12:49:10 2011 (r228532) +++ head/sys/kern/uipc_shm.c Thu Dec 15 15:17:19 2011 (r228533) @@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -790,15 +791,7 @@ shm_map(struct file *fp, size_t size, of shmfd->shm_kmappings--; VM_OBJECT_UNLOCK(obj); - switch (rv) { - case KERN_INVALID_ADDRESS: - case KERN_NO_SPACE: - return (ENOMEM); - case KERN_PROTECTION_FAILURE: - return (EACCES); - default: - return (EINVAL); - } + return (vm_mmap_to_errno(rv)); } /* From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 16:39:48 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A95391065676; Thu, 15 Dec 2011 16:39:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97AB08FC25; Thu, 15 Dec 2011 16:39:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFGdmdV058119; Thu, 15 Dec 2011 16:39:48 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFGdmdq058117; Thu, 15 Dec 2011 16:39:48 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201112151639.pBFGdmdq058117@svn.freebsd.org> From: John Baldwin Date: Thu, 15 Dec 2011 16:39:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228534 - stable/8/usr.sbin/mfiutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 16:39:48 -0000 Author: jhb Date: Thu Dec 15 16:39:48 2011 New Revision: 228534 URL: http://svn.freebsd.org/changeset/base/228534 Log: MFC 225168: If a drive is not part of the array (i.e. missing) we need to print the new line after the pd state information as well, so move it to the outside of the block. Modified: stable/8/usr.sbin/mfiutil/mfi_show.c Directory Properties: stable/8/usr.sbin/mfiutil/ (props changed) Modified: stable/8/usr.sbin/mfiutil/mfi_show.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_show.c Thu Dec 15 15:17:19 2011 (r228533) +++ stable/8/usr.sbin/mfiutil/mfi_show.c Thu Dec 15 16:39:48 2011 (r228534) @@ -335,8 +335,8 @@ show_config(int ac, char **av) mfi_pdstate(ar->pd[j].fw_state)); else print_pd(&pinfo, -1); - printf("\n"); } + printf("\n"); } p += config->array_size; } From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 17:54:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A19101065672; Thu, 15 Dec 2011 17:54:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 76D5A8FC12; Thu, 15 Dec 2011 17:54:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFHsOl3060925; Thu, 15 Dec 2011 17:54:24 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFHsOGL060922; Thu, 15 Dec 2011 17:54:24 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112151754.pBFHsOGL060922@svn.freebsd.org> From: Alan Cox Date: Thu, 15 Dec 2011 17:54:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228535 - head/sys/i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 17:54:24 -0000 Author: alc Date: Thu Dec 15 17:54:23 2011 New Revision: 228535 URL: http://svn.freebsd.org/changeset/base/228535 Log: Simplify the implementation of the identity mapping in start_all_aps(). Since mpboot.s enables processor support for PG_PS before enabling paging, there is no reason that the identity must use 4 KB page mappings. Discussed with: jhb Modified: head/sys/i386/i386/locore.s head/sys/i386/i386/mp_machdep.c Modified: head/sys/i386/i386/locore.s ============================================================================== --- head/sys/i386/i386/locore.s Thu Dec 15 16:39:48 2011 (r228534) +++ head/sys/i386/i386/locore.s Thu Dec 15 17:54:23 2011 (r228535) @@ -775,8 +775,7 @@ no_kernend: * if we've enabled PSE above, we'll just switch the corresponding kernel * PDEs before we turn on paging. * - * XXX: We waste some pages here in the PSE case! DON'T BLINDLY REMOVE - * THIS! SMP needs the page table to be there to map the kernel P==V. + * XXX: We waste some pages here in the PSE case! */ xorl %eax, %eax movl R(KERNend),%ecx Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Thu Dec 15 16:39:48 2011 (r228534) +++ head/sys/i386/i386/mp_machdep.c Thu Dec 15 17:54:23 2011 (r228535) @@ -145,9 +145,6 @@ static int bootAP; void *bootstacks[MAXCPU]; static void *dpcpu; -/* Hotwire a 0->4MB V==P mapping */ -extern pt_entry_t *KPTphys; - struct pcb stoppcbs[MAXCPU]; /* Variables needed for SMP tlb shootdown. */ @@ -931,7 +928,6 @@ start_all_aps(void) #ifndef PC98 u_char mpbiosreason; #endif - uintptr_t kptbase; u_int32_t mpbioswarmvec; int apic_id, cpu, i; @@ -949,11 +945,8 @@ start_all_aps(void) /* set up temporary P==V mapping for AP boot */ /* XXX this is a hack, we should boot the AP on its own stack/PTD */ - - kptbase = (uintptr_t)(void *)KPTphys; for (i = TMPMAP_START; i < NKPT; i++) - PTD[i] = (pd_entry_t)(PG_V | PG_RW | - ((kptbase + i * PAGE_SIZE) & PG_FRAME)); + PTD[i] = PTD[KPTDI + i]; invltlb(); /* start each AP */ From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 19:12:10 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 397C8106564A; Thu, 15 Dec 2011 19:12:10 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id D3A248FC1C; Thu, 15 Dec 2011 19:12:09 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.5/8.14.2) with ESMTP id pBFJC78p006730; Thu, 15 Dec 2011 14:12:07 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.5/8.14.2/Submit) id pBFJC6Bs006729; Thu, 15 Dec 2011 14:12:06 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Thu, 15 Dec 2011 14:12:06 -0500 From: David Schultz To: Ed Schouten Message-ID: <20111215191206.GA6569@zim.MIT.EDU> Mail-Followup-To: Ed Schouten , Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201112140909.pBE99bS3090646@svn.freebsd.org> <20111214234615.B3839@besplex.bde.org> <20111215122047.GN1771@hoeg.nl> <20111216000117.R2632@besplex.bde.org> <20111215144443.GQ1771@hoeg.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111215144443.GQ1771@hoeg.nl> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Bruce Evans Subject: Re: svn commit: r228495 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 19:12:10 -0000 On Thu, Dec 15, 2011, Ed Schouten wrote: > Hello Bruce, > > * Bruce Evans , 20111215 15:12: > > - recently broken for K&R since it now uses signed instead of __signed > > - broken for longer for K&R and C90 since it uses long long. In working > > versions, the __int64_t declarations were hacked for 32-bit machines > > on to make them compile (but not work). Non-hacked versions should > > simply not declare the 64-bit types if the compiler doesn't support > > them. > > Well, the dependency is circular, as depends on > as well, so that's not a real solution. > > This is a bit blunt, but maybe we should simply use "unsigned long" > there, under the assumption that on all architectures we support it is > equal in size, and if not likely big enough to store the result. > > > CTASSERT() has regressed for compilers that don't support __COUNTER__, > > since it uses this. Previously: > > - CTASSERT() never worked for K&R compilers, since it uses C90 token pasting > > - CTASSERT() worked for all C90 and later compilers. > > Yes. I am considering merging back the __COUNTER__ fix to FreeBSD 9 > after it has been released, so it shouldn't be too bad. Basically we > have to make a trade-off: > > - Make it possible to use CTASSERT() and _Static_assert() in more places > throughout the tree (headers), or > - support CTASSERT() and _Static_assert() for non-default compilers that > are older than GCC 4.3. > > I suspect that if people switch to non-default compilers to build > FreeBSD sources, they aren't doing it because they want to use an older > version of GCC. It's useful to have standard headers that don't blow up in C90 mode, but my sense is that we ought to be beyond caring about K&R C compilers. (FWIW, my first C compiler was a pre-ANSI compiler from the 80's, and it still supported the features at issue here.) From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 19:42:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DDAA106564A; Thu, 15 Dec 2011 19:42:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 126338FC18; Thu, 15 Dec 2011 19:42:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFJgPV4067326; Thu, 15 Dec 2011 19:42:25 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFJgPPk067323; Thu, 15 Dec 2011 19:42:25 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112151942.pBFJgPPk067323@svn.freebsd.org> From: Dimitry Andric Date: Thu, 15 Dec 2011 19:42:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228536 - in head/lib/libthr/arch: amd64/include i386/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 19:42:26 -0000 Author: dim Date: Thu Dec 15 19:42:25 2011 New Revision: 228536 URL: http://svn.freebsd.org/changeset/base/228536 Log: The TCB_GET32() and TCB_GET64() macros in the i386 and amd64-specific versions of pthread_md.h have a special case of dereferencing a null pointer. Clang warns about this with: In file included from lib/libthr/arch/i386/i386/pthread_md.c:36: lib/libthr/arch/i386/include/pthread_md.h:96:10: error: indirection of non-volatile null pointer will be deleted, not trap [-Werror,-Wnull-dereference] return (TCB_GET32(tcb_self)); ^~~~~~~~~~~~~~~~~~~ lib/libthr/arch/i386/include/pthread_md.h:73:13: note: expanded from: : "m" (*(u_int *)(__tcb_offset(name)))); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ lib/libthr/arch/i386/include/pthread_md.h:96:10: note: consider using __builtin_trap() or qualifying pointer with 'volatile' Since this indirection is done relative to the fs or gs segment, to retrieve thread-specific data, it is an exception to the rule. Therefore, add a volatile qualifier to tell the compiler we really want to dereference a zero address. MFC after: 1 week Modified: head/lib/libthr/arch/amd64/include/pthread_md.h head/lib/libthr/arch/i386/include/pthread_md.h Modified: head/lib/libthr/arch/amd64/include/pthread_md.h ============================================================================== --- head/lib/libthr/arch/amd64/include/pthread_md.h Thu Dec 15 17:54:23 2011 (r228535) +++ head/lib/libthr/arch/amd64/include/pthread_md.h Thu Dec 15 19:42:25 2011 (r228536) @@ -71,7 +71,7 @@ struct tcb { u_long __i; \ __asm __volatile("movq %%fs:%1, %0" \ : "=r" (__i) \ - : "m" (*(u_long *)(__tcb_offset(name)))); \ + : "m" (*(volatile u_long *)(__tcb_offset(name)))); \ __result = (__tcb_type(name))__i; \ \ __result; \ Modified: head/lib/libthr/arch/i386/include/pthread_md.h ============================================================================== --- head/lib/libthr/arch/i386/include/pthread_md.h Thu Dec 15 17:54:23 2011 (r228535) +++ head/lib/libthr/arch/i386/include/pthread_md.h Thu Dec 15 19:42:25 2011 (r228536) @@ -70,7 +70,7 @@ struct tcb { u_int __i; \ __asm __volatile("movl %%gs:%1, %0" \ : "=r" (__i) \ - : "m" (*(u_int *)(__tcb_offset(name)))); \ + : "m" (*(volatile u_int *)(__tcb_offset(name)))); \ __result = (__tcb_type(name))__i; \ \ __result; \ From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 20:10:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9D36106566C; Thu, 15 Dec 2011 20:10:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 992398FC14; Thu, 15 Dec 2011 20:10:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFKACE8068911; Thu, 15 Dec 2011 20:10:12 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFKAC48068909; Thu, 15 Dec 2011 20:10:12 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112152010.pBFKAC48068909@svn.freebsd.org> From: Dimitry Andric Date: Thu, 15 Dec 2011 20:10:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228537 - head/lib/libc/resolv X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 20:10:12 -0000 Author: dim Date: Thu Dec 15 20:10:12 2011 New Revision: 228537 URL: http://svn.freebsd.org/changeset/base/228537 Log: Remove meaningless self-assignment in res_send.c, otherwise clang will warn about it. I guess this was originally done to silence a bogus warning by an older version of gcc, but I could not reproduce it with any version of gcc that I have access to. MFC after: 1 week Modified: head/lib/libc/resolv/res_send.c Modified: head/lib/libc/resolv/res_send.c ============================================================================== --- head/lib/libc/resolv/res_send.c Thu Dec 15 19:42:25 2011 (r228536) +++ head/lib/libc/resolv/res_send.c Thu Dec 15 20:10:12 2011 (r228537) @@ -1102,8 +1102,6 @@ Aerror(const res_state statp, FILE *file char hbuf[NI_MAXHOST]; char sbuf[NI_MAXSERV]; - alen = alen; - if ((statp->options & RES_DEBUG) != 0U) { if (getnameinfo(address, alen, hbuf, sizeof(hbuf), sbuf, sizeof(sbuf), niflags)) { From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 20:27:37 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 212E9106566B; Thu, 15 Dec 2011 20:27:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1076A8FC08; Thu, 15 Dec 2011 20:27:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFKRauC069469; Thu, 15 Dec 2011 20:27:36 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFKRaKM069467; Thu, 15 Dec 2011 20:27:36 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112152027.pBFKRaKM069467@svn.freebsd.org> From: Dimitry Andric Date: Thu, 15 Dec 2011 20:27:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228538 - head/lib/libc/rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 20:27:37 -0000 Author: dim Date: Thu Dec 15 20:27:36 2011 New Revision: 228538 URL: http://svn.freebsd.org/changeset/base/228538 Log: In lib/libc/rpc/crypt_client.c, fix a clang warning about an implicit conversion between enum desdir/desmode from include/rpc/des.h, and enum desdir/desmode from include/rpcsvc/crypt.x. These are actually different enums, with different value names, but by accident the integer representation of the enum values happened to be the same. MFC after: 1 week Modified: head/lib/libc/rpc/crypt_client.c Modified: head/lib/libc/rpc/crypt_client.c ============================================================================== --- head/lib/libc/rpc/crypt_client.c Thu Dec 15 20:10:12 2011 (r228537) +++ head/lib/libc/rpc/crypt_client.c Thu Dec 15 20:27:36 2011 (r228538) @@ -75,8 +75,8 @@ _des_crypt_call(buf, len, dparms) des_crypt_1_arg.desbuf.desbuf_len = len; des_crypt_1_arg.desbuf.desbuf_val = buf; - des_crypt_1_arg.des_dir = dparms->des_dir; - des_crypt_1_arg.des_mode = dparms->des_mode; + des_crypt_1_arg.des_dir = (dparms->des_dir == ENCRYPT) ? ENCRYPT_DES : DECRYPT_DES; + des_crypt_1_arg.des_mode = (dparms->des_mode == CBC) ? CBC_DES : ECB_DES; bcopy(dparms->des_ivec, des_crypt_1_arg.des_ivec, 8); bcopy(dparms->des_key, des_crypt_1_arg.des_key, 8); From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 20:31:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE707106564A; Thu, 15 Dec 2011 20:31:18 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ACA1A8FC0A; Thu, 15 Dec 2011 20:31:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFKVIck069626; Thu, 15 Dec 2011 20:31:18 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFKVIY9069620; Thu, 15 Dec 2011 20:31:18 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201112152031.pBFKVIY9069620@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 15 Dec 2011 20:31:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228539 - head/sys/fs/ext2fs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 20:31:18 -0000 Author: pfg Date: Thu Dec 15 20:31:18 2011 New Revision: 228539 URL: http://svn.freebsd.org/changeset/base/228539 Log: Bring in reallocblk to ext2fs. The feature has been standard for a while in UFS as a means to reduce fragmentation, therefore maintaining consistent performance with filesystem aging. This is also very similar to what ext4 calls "delayed allocation". In his 2010 GSoC, Zheng Liu ported and benchmarked the missing FANCY_REALLOC code to find more consistent performance improvements than with the preallocation approach. PR: 159233 Author: Zheng Liu Sponsored by: Google Inc. Approved by: jhb (mentor) MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_alloc.c head/sys/fs/ext2fs/ext2_extern.h head/sys/fs/ext2fs/ext2_subr.c head/sys/fs/ext2fs/ext2_vfsops.c head/sys/fs/ext2fs/ext2fs.h Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Thu Dec 15 20:27:36 2011 (r228538) +++ head/sys/fs/ext2fs/ext2_alloc.c Thu Dec 15 20:31:18 2011 (r228539) @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -52,6 +53,7 @@ #include static daddr_t ext2_alloccg(struct inode *, int, daddr_t, int); +static daddr_t ext2_clusteralloc(struct inode *, int, daddr_t, int); static u_long ext2_dirpref(struct inode *); static void ext2_fserr(struct m_ext2fs *, uid_t, char *); static u_long ext2_hashalloc(struct inode *, int, long, int, @@ -59,9 +61,6 @@ static u_long ext2_hashalloc(struct inod int)); static daddr_t ext2_nodealloccg(struct inode *, int, daddr_t, int); static daddr_t ext2_mapsearch(struct m_ext2fs *, char *, daddr_t); -#ifdef FANCY_REALLOC -static int ext2_reallocblks(struct vop_reallocblks_args *); -#endif /* * Allocate a block in the file system. @@ -113,20 +112,20 @@ ext2_alloc(ip, lbn, bpref, size, cred, b if (bpref >= fs->e2fs->e2fs_bcount) bpref = 0; if (bpref == 0) - cg = ino_to_cg(fs, ip->i_number); - else - cg = dtog(fs, bpref); - bno = (daddr_t)ext2_hashalloc(ip, cg, bpref, fs->e2fs_bsize, - ext2_alloccg); - if (bno > 0) { + cg = ino_to_cg(fs, ip->i_number); + else + cg = dtog(fs, bpref); + bno = (daddr_t)ext2_hashalloc(ip, cg, bpref, fs->e2fs_bsize, + ext2_alloccg); + if (bno > 0) { /* set next_alloc fields as done in block_getblk */ ip->i_next_alloc_block = lbn; ip->i_next_alloc_goal = bno; - ip->i_blocks += btodb(fs->e2fs_bsize); - ip->i_flag |= IN_CHANGE | IN_UPDATE; - *bnp = bno; - return (0); + ip->i_blocks += btodb(fs->e2fs_bsize); + ip->i_flag |= IN_CHANGE | IN_UPDATE; + *bnp = bno; + return (0); } nospace: EXT2_UNLOCK(ump); @@ -150,7 +149,6 @@ nospace: * the previous block allocation will be used. */ -#ifdef FANCY_REALLOC static SYSCTL_NODE(_vfs, OID_AUTO, ext2fs, CTLFLAG_RW, 0, "EXT2FS filesystem"); static int doasyncfree = 1; @@ -159,7 +157,6 @@ SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doasyn static int doreallocblks = 1; SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doreallocblks, CTLFLAG_RW, &doreallocblks, 0, ""); -#endif int ext2_reallocblks(ap) @@ -168,11 +165,6 @@ ext2_reallocblks(ap) struct cluster_save *a_buflist; } */ *ap; { -#ifndef FANCY_REALLOC -/* printf("ext2_reallocblks not implemented\n"); */ -return ENOSPC; -#else - struct m_ext2fs *fs; struct inode *ip; struct vnode *vp; @@ -184,14 +176,17 @@ return ENOSPC; int32_t start_lbn, end_lbn, soff, newblk, blkno; int i, len, start_lvl, end_lvl, pref, ssize; + if (doreallocblks == 0) + return (ENOSPC); + vp = ap->a_vp; ip = VTOI(vp); fs = ip->i_e2fs; ump = ip->i_ump; -#ifdef UNKLAR - if (fs->fs_contigsumsize <= 0) + + if (fs->e2fs_contigsumsize <= 0) return (ENOSPC); -#endif + buflist = ap->a_buflist; len = buflist->bs_nchildren; start_lbn = buflist->bs_children[0]->b_lblkno; @@ -228,11 +223,6 @@ return ENOSPC; soff = idp->in_off; } /* - * Find the preferred location for the cluster. - */ - EXT2_LOCK(ump); - pref = ext2_blkpref(ip, start_lbn, soff, sbap, 0); - /* * If the block range spans two block maps, get the second map. */ if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) { @@ -243,13 +233,16 @@ return ENOSPC; panic("ext2_reallocblk: start == end"); #endif ssize = len - (idp->in_off + 1); - if (bread(vp, idp->in_lbn, (int)fs->e2fs_bsize, NOCRED, &ebp)){ - EXT2_UNLOCK(ump); + if (bread(vp, idp->in_lbn, (int)fs->e2fs_bsize, NOCRED, &ebp)) goto fail; - } ebap = (int32_t *)ebp->b_data; } /* + * Find the preferred location for the cluster. + */ + EXT2_LOCK(ump); + pref = ext2_blkpref(ip, start_lbn, soff, sbap, 0); + /* * Search the block map looking for an allocation of the desired size. */ if ((newblk = (int32_t)ext2_hashalloc(ip, dtog(fs, pref), pref, @@ -264,15 +257,23 @@ return ENOSPC; * block pointers in the inode and indirect blocks associated * with the file. */ +#ifdef DEBUG + printf("realloc: ino %d, lbns %jd-%jd\n\told:", ip->i_number, + (intmax_t)start_lbn, (intmax_t)end_lbn); +#endif /* DEBUG */ blkno = newblk; for (bap = &sbap[soff], i = 0; i < len; i++, blkno += fs->e2fs_fpb) { - if (i == ssize) + if (i == ssize) { bap = ebap; soff = -i; + } #ifdef DIAGNOSTIC if (buflist->bs_children[i]->b_blkno != fsbtodb(fs, *bap)) panic("ext2_reallocblks: alloc mismatch"); #endif +#ifdef DEBUG + printf(" %d,", *bap); +#endif /* DEBUG */ *bap++ = blkno; } /* @@ -308,11 +309,20 @@ return ENOSPC; /* * Last, free the old blocks and assign the new blocks to the buffers. */ +#ifdef DEBUG + printf("\n\tnew:"); +#endif /* DEBUG */ for (blkno = newblk, i = 0; i < len; i++, blkno += fs->e2fs_fpb) { ext2_blkfree(ip, dbtofsb(fs, buflist->bs_children[i]->b_blkno), fs->e2fs_bsize); buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno); - } +#ifdef DEBUG + printf(" %d,", blkno); +#endif /* DEBUG */ + } +#ifdef DEBUG + printf("\n"); +#endif /* DEBUG */ return (0); fail: @@ -321,8 +331,6 @@ fail: if (sbap != &ip->i_db[0]) brelse(sbp); return (ENOSPC); - -#endif /* FANCY_REALLOC */ } /* @@ -747,6 +755,7 @@ gotit: #endif setbit(bbp, bno); EXT2_LOCK(ump); + ext2_clusteracct(fs, bbp, cg, bno, -1); fs->e2fs->e2fs_fbcount--; fs->e2fs_gd[cg].ext2bgd_nbfree--; fs->e2fs_fmod = 1; @@ -756,6 +765,116 @@ gotit: } /* + * Determine whether a cluster can be allocated. + */ +static daddr_t +ext2_clusteralloc(struct inode *ip, int cg, daddr_t bpref, int len) +{ + struct m_ext2fs *fs; + struct ext2mount *ump; + struct buf *bp; + char *bbp; + int bit, error, got, i, loc, run; + int32_t *lp; + daddr_t bno; + + fs = ip->i_e2fs; + ump = ip->i_ump; + + if (fs->e2fs_maxcluster[cg] < len) + return (0); + + EXT2_UNLOCK(ump); + error = bread(ip->i_devvp, + fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap), + (int)fs->e2fs_bsize, NOCRED, &bp); + if (error) + goto fail_lock; + + bbp = (char *)bp->b_data; + bp->b_xflags |= BX_BKGRDWRITE; + + EXT2_LOCK(ump); + /* + * Check to see if a cluster of the needed size (or bigger) is + * available in this cylinder group. + */ + lp = &fs->e2fs_clustersum[cg].cs_sum[len]; + for (i = len; i <= fs->e2fs_contigsumsize; i++) + if (*lp++ > 0) + break; + if (i > fs->e2fs_contigsumsize) { + /* + * Update the cluster summary information to reflect + * the true maximum-sized cluster so that future cluster + * allocation requests can avoid reading the bitmap only + * to find no cluster. + */ + lp = &fs->e2fs_clustersum[cg].cs_sum[len - 1]; + for (i = len - 1; i > 0; i--) + if (*lp-- > 0) + break; + fs->e2fs_maxcluster[cg] = i; + goto fail; + } + EXT2_UNLOCK(ump); + + /* Search the bitmap to find a big enough cluster like in FFS. */ + if (dtog(fs, bpref) != cg) + bpref = 0; + if (bpref != 0) + bpref = dtogd(fs, bpref); + loc = bpref / NBBY; + bit = 1 << (bpref % NBBY); + for (run = 0, got = bpref; got < fs->e2fs->e2fs_fpg; got++) { + if ((bbp[loc] & bit) != 0) + run = 0; + else { + run++; + if (run == len) + break; + } + if ((got & (NBBY - 1)) != (NBBY - 1)) + bit <<= 1; + else { + loc++; + bit = 1; + } + } + + if (got >= fs->e2fs->e2fs_fpg) + goto fail_lock; + + /* Allocate the cluster that we found. */ + for (i = 1; i < len; i++) + if (!isclr(bbp, got - run + i)) + panic("ext2_clusteralloc: map mismatch"); + + bno = got - run + 1; + if (bno >= fs->e2fs->e2fs_fpg) + panic("ext2_clusteralloc: allocated out of group"); + + EXT2_LOCK(ump); + for (i = 0; i < len; i += fs->e2fs_fpb) { + setbit(bbp, bno + i); + ext2_clusteracct(fs, bbp, cg, bno + i, -1); + fs->e2fs->e2fs_fbcount--; + fs->e2fs_gd[cg].ext2bgd_nbfree--; + } + fs->e2fs_fmod = 1; + EXT2_UNLOCK(ump); + + bdwrite(bp); + return (cg * fs->e2fs->e2fs_fpg + fs->e2fs->e2fs_first_dblock + bno); + +fail_lock: + EXT2_LOCK(ump); +fail: + brelse(bp); + return (0); +} + +/* * Determine whether an inode can be allocated. * * Check to see if an inode is available, and if it is, @@ -877,6 +996,7 @@ ext2_blkfree(ip, bno, size) } clrbit(bbp, bno); EXT2_LOCK(ump); + ext2_clusteracct(fs, bbp, cg, bno, 1); fs->e2fs->e2fs_fbcount++; fs->e2fs_gd[cg].ext2bgd_nbfree++; fs->e2fs_fmod = 1; Modified: head/sys/fs/ext2fs/ext2_extern.h ============================================================================== --- head/sys/fs/ext2fs/ext2_extern.h Thu Dec 15 20:27:36 2011 (r228538) +++ head/sys/fs/ext2fs/ext2_extern.h Thu Dec 15 20:31:18 2011 (r228539) @@ -55,12 +55,13 @@ void ext2_blkfree(struct inode *, int32_ int32_t ext2_blkpref(struct inode *, int32_t, int, int32_t *, int32_t); int ext2_bmap(struct vop_bmap_args *); int ext2_bmaparray(struct vnode *, int32_t, int32_t *, int *, int *); +void ext2_clusteracct(struct m_ext2fs *, char *, int, daddr_t, int); void ext2_dirbad(struct inode *ip, doff_t offset, char *how); void ext2_ei2i(struct ext2fs_dinode *, struct inode *); int ext2_getlbns(struct vnode *, int32_t, struct indir *, int *); void ext2_i2ei(struct inode *, struct ext2fs_dinode *); +int ext2_reallocblks(struct vop_reallocblks_args *); void ext2_itimes(struct vnode *vp); -int ext2_reallocblks(struct vop_reallocblks_args *); int ext2_reclaim(struct vop_reclaim_args *); void ext2_setblock(struct m_ext2fs *, u_char *, int32_t); int ext2_truncate(struct vnode *, off_t, int, struct ucred *, struct thread *); Modified: head/sys/fs/ext2fs/ext2_subr.c ============================================================================== --- head/sys/fs/ext2fs/ext2_subr.c Thu Dec 15 20:27:36 2011 (r228538) +++ head/sys/fs/ext2fs/ext2_subr.c Thu Dec 15 20:31:18 2011 (r228539) @@ -120,3 +120,107 @@ ext2_checkoverlap(bp, ip) } } #endif /* KDB */ + +/* + * Update the cluster map because of an allocation of free like ffs. + * + * Cnt == 1 means free; cnt == -1 means allocating. + */ +void +ext2_clusteracct(struct m_ext2fs *fs, char *bbp, int cg, daddr_t bno, int cnt) +{ + int32_t *sump = fs->e2fs_clustersum[cg].cs_sum; + int32_t *lp; + int back, bit, end, forw, i, loc, start; + + /* Initialize the cluster summary array. */ + if (fs->e2fs_clustersum[cg].cs_init == 0) { + int run = 0; + bit = 1; + loc = 0; + + for (i = 0; i < fs->e2fs->e2fs_fpg; i++) { + if ((bbp[loc] & bit) == 0) + run++; + else if (run != 0) { + if (run > fs->e2fs_contigsumsize) + run = fs->e2fs_contigsumsize; + sump[run]++; + run = 0; + } + if ((i & (NBBY - 1)) != (NBBY - 1)) + bit <<= 1; + else { + loc++; + bit = 1; + } + } + if (run != 0) { + if (run > fs->e2fs_contigsumsize) + run = fs->e2fs_contigsumsize; + sump[run]++; + } + fs->e2fs_clustersum[cg].cs_init = 1; + } + + if (fs->e2fs_contigsumsize <= 0) + return; + + /* Find the size of the cluster going forward. */ + start = bno + 1; + end = start + fs->e2fs_contigsumsize; + if (end > fs->e2fs->e2fs_fpg) + end = fs->e2fs->e2fs_fpg; + loc = start / NBBY; + bit = 1 << (start % NBBY); + for (i = start; i < end; i++) { + if ((bbp[loc] & bit) != 0) + break; + if ((i & (NBBY - 1)) != (NBBY - 1)) + bit <<= 1; + else { + loc++; + bit = 1; + } + } + forw = i - start; + + /* Find the size of the cluster going backward. */ + start = bno - 1; + end = start - fs->e2fs_contigsumsize; + if (end < 0) + end = -1; + loc = start / NBBY; + bit = 1 << (start % NBBY); + for (i = start; i > end; i--) { + if ((bbp[loc] & bit) != 0) + break; + if ((i & (NBBY - 1)) != 0) + bit >>= 1; + else { + loc--; + bit = 1 << (NBBY - 1); + } + } + back = start - i; + + /* + * Account for old cluster and the possibly new forward and + * back clusters. + */ + i = back + forw + 1; + if (i > fs->e2fs_contigsumsize) + i = fs->e2fs_contigsumsize; + sump[i] += cnt; + if (back > 0) + sump[back] -= cnt; + if (forw > 0) + sump[forw] -= cnt; + + /* Update cluster summary information. */ + lp = &sump[fs->e2fs_contigsumsize]; + for (i = fs->e2fs_contigsumsize; i > 0; i--) + if (*lp-- > 0) + break; + fs->e2fs_maxcluster[cg] = i; +} Modified: head/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vfsops.c Thu Dec 15 20:27:36 2011 (r228538) +++ head/sys/fs/ext2fs/ext2_vfsops.c Thu Dec 15 20:31:18 2011 (r228539) @@ -405,7 +405,7 @@ compute_sb_data(struct vnode *devvp, str * Things to do to update the mount: * 1) invalidate all cached meta-data. * 2) re-read superblock from disk. - * 3) re-read summary information from disk. + * 3) invalidate all cluster summary information. * 4) invalidate all inactive vnodes. * 5) invalidate all cached file data. * 6) re-read inode data for all active vnodes. @@ -419,7 +419,9 @@ ext2_reload(struct mount *mp, struct thr struct buf *bp; struct ext2fs *es; struct m_ext2fs *fs; - int error; + struct csum *sump; + int error, i; + int32_t *lp; if ((mp->mnt_flag & MNT_RDONLY) == 0) return (EINVAL); @@ -456,6 +458,19 @@ ext2_reload(struct mount *mp, struct thr #endif brelse(bp); + /* + * Step 3: invalidate all cluster summary information. + */ + if (fs->e2fs_contigsumsize > 0) { + lp = fs->e2fs_maxcluster; + sump = fs->e2fs_clustersum; + for (i = 0; i < fs->e2fs_gcount; i++, sump++) { + *lp++ = fs->e2fs_contigsumsize; + sump->cs_init = 0; + bzero(sump->cs_sum, fs->e2fs_contigsumsize + 1); + } + } + loop: MNT_ILOCK(mp); MNT_VNODE_FOREACH(vp, mp, mvp) { @@ -511,8 +526,11 @@ ext2_mountfs(struct vnode *devvp, struct struct cdev *dev = devvp->v_rdev; struct g_consumer *cp; struct bufobj *bo; + struct csum *sump; int error; int ronly; + int i, size; + int32_t *lp; ronly = vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0); /* XXX: use VOP_ACESS to check FS perms */ @@ -582,6 +600,33 @@ ext2_mountfs(struct vnode *devvp, struct if ((error = compute_sb_data(devvp, ump->um_e2fs->e2fs, ump->um_e2fs))) goto out; + /* + * Calculate the maximum contiguous blocks and size of cluster summary + * array. In FFS this is done by newfs; however the superblock in + * ext2fs doesn't have these variables so we just can calculate + * them here. + */ + ump->um_e2fs->e2fs_maxcontig = MAX(1, MAXPHYS / ump->um_e2fs->e2fs_bsize); + if (ump->um_e2fs->e2fs_maxcontig > 0) + ump->um_e2fs->e2fs_contigsumsize = + MIN(ump->um_e2fs->e2fs_maxcontig, EXT2_MAXCONTIG); + else + ump->um_e2fs->e2fs_contigsumsize = 0; + if (ump->um_e2fs->e2fs_contigsumsize > 0) { + size = ump->um_e2fs->e2fs_gcount * sizeof(int32_t); + ump->um_e2fs->e2fs_maxcluster = malloc(size, M_EXT2MNT, M_WAITOK); + size = ump->um_e2fs->e2fs_gcount * sizeof(struct csum); + ump->um_e2fs->e2fs_clustersum = malloc(size, M_EXT2MNT, M_WAITOK); + lp = ump->um_e2fs->e2fs_maxcluster; + sump = ump->um_e2fs->e2fs_clustersum; + for (i = 0; i < ump->um_e2fs->e2fs_gcount; i++, sump++) { + *lp++ = ump->um_e2fs->e2fs_contigsumsize; + sump->cs_init = 0; + sump->cs_sum = malloc((ump->um_e2fs->e2fs_contigsumsize + 1) * + sizeof(int32_t), M_EXT2MNT, M_WAITOK | M_ZERO); + } + } + brelse(bp); bp = NULL; fs = ump->um_e2fs; @@ -656,7 +701,8 @@ ext2_unmount(struct mount *mp, int mntfl { struct ext2mount *ump; struct m_ext2fs *fs; - int error, flags, ronly; + struct csum *sump; + int error, flags, i, ronly; flags = 0; if (mntflags & MNT_FORCE) { @@ -681,6 +727,11 @@ ext2_unmount(struct mount *mp, int mntfl g_topology_unlock(); PICKUP_GIANT(); vrele(ump->um_devvp); + sump = fs->e2fs_clustersum; + for (i = 0; i < fs->e2fs_gcount; i++, sump++) + free(sump->cs_sum, M_EXT2MNT); + free(fs->e2fs_clustersum, M_EXT2MNT); + free(fs->e2fs_maxcluster, M_EXT2MNT); free(fs->e2fs_gd, M_EXT2MNT); free(fs->e2fs_contigdirs, M_EXT2MNT); free(fs->e2fs, M_EXT2MNT); Modified: head/sys/fs/ext2fs/ext2fs.h ============================================================================== --- head/sys/fs/ext2fs/ext2fs.h Thu Dec 15 20:27:36 2011 (r228538) +++ head/sys/fs/ext2fs/ext2fs.h Thu Dec 15 20:31:18 2011 (r228539) @@ -45,6 +45,16 @@ #define EXT2_LINK_MAX 32000 /* + * A summary of contiguous blocks of various sizes is maintained + * in each cylinder group. Normally this is set by the initial + * value of fs_maxcontig. + * + * XXX:FS_MAXCONTIG is set to 16 to conserve space. Here we set + * EXT2_MAXCONTIG to 32 for better performance. + */ +#define EXT2_MAXCONTIG 32 + +/* * Constants relative to the data blocks */ #define EXT2_NDIR_BLOCKS 12 @@ -151,6 +161,10 @@ struct m_ext2fs { char e2fs_wasvalid; /* valid at mount time */ off_t e2fs_maxfilesize; struct ext2_gd *e2fs_gd; /* Group Descriptors */ + int32_t e2fs_maxcontig; /* max number of contiguous blks */ + int32_t e2fs_contigsumsize; /* size of cluster summary array */ + int32_t *e2fs_maxcluster; /* max cluster in each cyl group */ + struct csum *e2fs_clustersum; /* cluster summary in each cyl group */ }; /* @@ -253,6 +267,13 @@ struct ext2_gd { uint32_t reserved2[3]; }; +/* cluster summary information */ + +struct csum { + int8_t cs_init; /* cluster summary has been initialized */ + int32_t *cs_sum; /* cluster summary array */ +}; + /* EXT2FS metadatas are stored in little-endian byte order. These macros * helps reading these metadatas */ From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 20:40:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D714106564A; Thu, 15 Dec 2011 20:40:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6CD1B8FC12; Thu, 15 Dec 2011 20:40:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFKeBdt069925; Thu, 15 Dec 2011 20:40:11 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFKeBOF069923; Thu, 15 Dec 2011 20:40:11 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112152040.pBFKeBOF069923@svn.freebsd.org> From: Dimitry Andric Date: Thu, 15 Dec 2011 20:40:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228540 - head/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 20:40:11 -0000 Author: dim Date: Thu Dec 15 20:40:11 2011 New Revision: 228540 URL: http://svn.freebsd.org/changeset/base/228540 Log: Since clang does not support the tls_model attribute used in malloc.c yet (see LLVM PR 9788), and warns about it, rub it out for now. When clang grows support for this attribute, I will revert this again. MFC after: 1 week Modified: head/lib/libc/stdlib/malloc.c Modified: head/lib/libc/stdlib/malloc.c ============================================================================== --- head/lib/libc/stdlib/malloc.c Thu Dec 15 20:31:18 2011 (r228539) +++ head/lib/libc/stdlib/malloc.c Thu Dec 15 20:40:11 2011 (r228540) @@ -219,7 +219,11 @@ __FBSDID("$FreeBSD$"); # define LG_QUANTUM 4 # define LG_SIZEOF_PTR 2 # define CPU_SPINWAIT __asm__ volatile("pause") -# define TLS_MODEL __attribute__((tls_model("initial-exec"))) +# ifdef __clang__ +# define TLS_MODEL /* clang does not support tls_model yet */ +# else +# define TLS_MODEL __attribute__((tls_model("initial-exec"))) +# endif #endif #ifdef __ia64__ # define LG_QUANTUM 4 @@ -240,7 +244,11 @@ __FBSDID("$FreeBSD$"); # define LG_QUANTUM 4 # define LG_SIZEOF_PTR 3 # define CPU_SPINWAIT __asm__ volatile("pause") -# define TLS_MODEL __attribute__((tls_model("initial-exec"))) +# ifdef __clang__ +# define TLS_MODEL /* clang does not support tls_model yet */ +# else +# define TLS_MODEL __attribute__((tls_model("initial-exec"))) +# endif #endif #ifdef __arm__ # define LG_QUANTUM 3 From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 21:06:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CE68106564A; Thu, 15 Dec 2011 21:06:38 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C10A8FC08; Thu, 15 Dec 2011 21:06:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFL6bDU070817; Thu, 15 Dec 2011 21:06:37 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFL6boF070815; Thu, 15 Dec 2011 21:06:37 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201112152106.pBFL6boF070815@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 15 Dec 2011 21:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228541 - head/etc/rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 21:06:38 -0000 Author: pjd Date: Thu Dec 15 21:06:37 2011 New Revision: 228541 URL: http://svn.freebsd.org/changeset/base/228541 Log: - Put one file into one line. This makes keeping local changes and merging with FreeBSD easier for vendors. - For optional files use variables starting with underscore. Both changes make rc.d/Makefile look similar to sys/modules/Makefile. Reviewed by: dim Modified: head/etc/rc.d/Makefile Modified: head/etc/rc.d/Makefile ============================================================================== --- head/etc/rc.d/Makefile Thu Dec 15 20:40:11 2011 (r228540) +++ head/etc/rc.d/Makefile Thu Dec 15 21:06:37 2011 (r228541) @@ -2,64 +2,179 @@ .include -FILES= DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \ - abi accounting addswap adjkerntz amd \ - apm apmd archdep atm1 atm2 atm3 auditd \ - bgfsck bluetooth bootparams bridge bsnmpd bthidd \ - ccd cleanvar cleartmp cron \ - ddb defaultroute devd devfs dhclient \ - dmesg dumpon \ +FILES= DAEMON \ + FILESYSTEMS \ + LOGIN \ + NETWORKING \ + SERVERS \ + abi \ + accounting \ + addswap \ + adjkerntz \ + amd \ + apm \ + apmd \ + archdep \ + atm1 \ + atm2 \ + atm3 \ + auditd \ + bgfsck \ + bluetooth \ + bootparams \ + bridge \ + bsnmpd \ + bthidd \ + ccd \ + cleanvar \ + cleartmp \ + cron \ + ddb \ + defaultroute \ + devd \ + devfs \ + dhclient \ + dmesg \ + dumpon \ encswap \ - faith fsck ftp-proxy ftpd \ - gbde geli geli2 gptboot gssd \ - hastd hcsecd \ - hostapd hostid hostid_save hostname \ - inetd initrandom \ - ip6addrctl ipfilter ipfs ipfw ipmon \ - ipnat ipsec \ + faith \ + fsck \ + ftp-proxy \ + ftpd \ + gbde \ + geli \ + geli2 \ + gptboot \ + gssd \ + hastd \ + hcsecd \ + hostapd \ + hostid \ + hostid_save \ + hostname \ + inetd \ + initrandom \ + ip6addrctl \ + ipfilter \ + ipfs \ + ipfw \ + ipmon \ + ipnat \ + ipsec \ + ${_ipxrouted} \ jail \ - kadmind kerberos keyserv kld kldxref kpasswdd \ - ldconfig local localpkg lockd lpd \ - mixer motd mountcritlocal mountcritremote mountlate \ - mdconfig mdconfig2 mountd moused mroute6d mrouted msgs \ - named natd netif netoptions netwait \ - newsyslog nfsclient nfscbd nfsd \ - nfsuserd nisdomain nsswitch ntpd ntpdate \ + kadmind \ + kerberos \ + keyserv \ + kld \ + kldxref \ + kpasswdd \ + ldconfig \ + local \ + localpkg \ + lockd \ + lpd \ + mixer \ + motd \ + mountcritlocal \ + mountcritremote \ + mountlate \ + mdconfig \ + mdconfig2 \ + mountd \ + moused \ + mroute6d \ + mrouted \ + msgs \ + named \ + natd \ + netif \ + netoptions \ + netwait \ + newsyslog \ + nfsclient \ + nfscbd \ + nfsd \ + nfsuserd \ + nisdomain \ + ${_nscd} \ + nsswitch \ + ntpd \ + ntpdate \ + ${_opensm} \ othermta \ - pf pflog pfsync \ - powerd power_profile ppp pppoed pwcheck \ + pf \ + pflog \ + pfsync \ + powerd \ + power_profile \ + ppp \ + pppoed \ + pwcheck \ quota \ - random rarpd rctl resolv rfcomm_pppd_server root \ - route6d routed routing rpcbind rtadvd rtsold rwho \ - savecore sdpd securelevel sendmail \ - serial sppp statd static_arp static_ndp stf swap1 \ - syscons sysctl syslogd \ - timed tmp \ + random \ + rarpd \ + rctl \ + resolv \ + rfcomm_pppd_server \ + root \ + route6d \ + routed \ + routing \ + rpcbind \ + rtadvd \ + rtsold \ + rwho \ + savecore \ + sdpd \ + securelevel \ + sendmail \ + serial \ + sppp \ + ${_sshd} \ + statd \ + static_arp \ + static_ndp \ + stf \ + swap1 \ + syscons \ + sysctl \ + syslogd \ + timed \ + tmp \ + ${_ubthidhci} \ ugidfw \ - var virecover \ - watchdogd wpa_supplicant \ - ypbind yppasswdd ypserv \ - ypset ypupdated ypxfrd \ - zfs zvol + var \ + virecover \ + watchdogd \ + wpa_supplicant \ + ypbind \ + yppasswdd \ + ypserv \ + ypset \ + ypupdated \ + ypxfrd \ + zfs \ + zvol .if ${MK_IPX} != "no" -FILES+= ipxrouted +_ipxrouted= ipxrouted .endif .if ${MK_OFED} != "no" -FILES+= opensm +_opensm= opensm .endif .if ${MK_OPENSSH} != "no" -FILES+= sshd +_sshd= sshd .endif .if ${MK_NS_CACHING} != "no" -FILES+= nscd +_nscd= nscd .endif .if ${MK_BLUETOOTH} != "no" -FILES+= ubthidhci +_ubthidhci= ubthidhci .endif FILESDIR= /etc/rc.d From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 21:33:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 4F0AC106564A; Thu, 15 Dec 2011 21:33:12 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 8021014EDA9; Thu, 15 Dec 2011 21:33:01 +0000 (UTC) Message-ID: <4EEA678D.8030708@FreeBSD.org> Date: Thu, 15 Dec 2011 13:33:01 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111110 Thunderbird/8.0 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201112152106.pBFL6boF070815@svn.freebsd.org> In-Reply-To: <201112152106.pBFL6boF070815@svn.freebsd.org> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228541 - head/etc/rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 21:33:12 -0000 On 12/15/2011 13:06, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Thu Dec 15 21:06:37 2011 > New Revision: 228541 > URL: http://svn.freebsd.org/changeset/base/228541 > > Log: > - Put one file into one line. This makes keeping local changes and merging > with FreeBSD easier for vendors. > - For optional files use variables starting with underscore. Thanks! I've had this on my "to do" list for a long time and have never been able to get to it. Doug -- [^L] Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 22:01:35 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2DB8106564A; Thu, 15 Dec 2011 22:01:34 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9324D8FC15; Thu, 15 Dec 2011 22:01:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFM1YT6072479; Thu, 15 Dec 2011 22:01:34 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFM1YW1072477; Thu, 15 Dec 2011 22:01:34 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201112152201.pBFM1YW1072477@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 15 Dec 2011 22:01:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228542 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 22:01:35 -0000 Author: pjd Date: Thu Dec 15 22:01:34 2011 New Revision: 228542 URL: http://svn.freebsd.org/changeset/base/228542 Log: Remove redundant setting of the error variable. Found by: Clang Static Analyzer MFC after: 1 week Modified: head/sbin/hastd/control.c Modified: head/sbin/hastd/control.c ============================================================================== --- head/sbin/hastd/control.c Thu Dec 15 21:06:37 2011 (r228541) +++ head/sbin/hastd/control.c Thu Dec 15 22:01:34 2011 (r228542) @@ -312,7 +312,6 @@ control_handle(struct hastd_config *cfg) cmd = nv_get_uint8(nvin, "cmd"); if (cmd == 0) { pjdlog_error("Control header is missing 'cmd' field."); - error = EHAST_INVALID; goto close; } @@ -320,7 +319,6 @@ control_handle(struct hastd_config *cfg) nvout = nv_alloc(); if (nvout == NULL) { pjdlog_error("Unable to allocate header for control response."); - error = EHAST_NOMEMORY; goto close; } From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 22:03:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4FF751065673; Thu, 15 Dec 2011 22:03:18 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24BE08FC08; Thu, 15 Dec 2011 22:03:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFM3Iot072566; Thu, 15 Dec 2011 22:03:18 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFM3IO5072564; Thu, 15 Dec 2011 22:03:18 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201112152203.pBFM3IO5072564@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 15 Dec 2011 22:03:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228543 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 22:03:18 -0000 Author: pjd Date: Thu Dec 15 22:03:17 2011 New Revision: 228543 URL: http://svn.freebsd.org/changeset/base/228543 Log: Simplify code by changing functions types from int to avoid, as the functions always return 0. Found by: Clang Static Analyzer MFC after: 1 week Modified: head/sbin/hastd/hast_checksum.c Modified: head/sbin/hastd/hast_checksum.c ============================================================================== --- head/sbin/hastd/hast_checksum.c Thu Dec 15 22:01:34 2011 (r228542) +++ head/sbin/hastd/hast_checksum.c Thu Dec 15 22:03:17 2011 (r228543) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #define MAX_HASH_SIZE 4 #endif -static int +static void hast_crc32_checksum(const unsigned char *data, size_t size, unsigned char *hash, size_t *hsizep) { @@ -58,12 +58,10 @@ hast_crc32_checksum(const unsigned char /* XXXPJD: Do we have to use htole32() on crc first? */ bcopy(&crc, hash, sizeof(crc)); *hsizep = sizeof(crc); - - return (0); } #ifdef HAVE_CRYPTO -static int +static void hast_sha256_checksum(const unsigned char *data, size_t size, unsigned char *hash, size_t *hsizep) { @@ -73,8 +71,6 @@ hast_sha256_checksum(const unsigned char SHA256_Update(&ctx, data, size); SHA256_Final(hash, &ctx); *hsizep = SHA256_DIGEST_LENGTH; - - return (0); } #endif /* HAVE_CRYPTO */ @@ -99,25 +95,21 @@ checksum_send(const struct hast_resource { unsigned char hash[MAX_HASH_SIZE]; size_t hsize; - int ret; switch (res->hr_checksum) { case HAST_CHECKSUM_NONE: return (0); case HAST_CHECKSUM_CRC32: - ret = hast_crc32_checksum(*datap, *sizep, hash, &hsize); + hast_crc32_checksum(*datap, *sizep, hash, &hsize); break; #ifdef HAVE_CRYPTO case HAST_CHECKSUM_SHA256: - ret = hast_sha256_checksum(*datap, *sizep, hash, &hsize); + hast_sha256_checksum(*datap, *sizep, hash, &hsize); break; #endif default: PJDLOG_ABORT("Invalid checksum: %d.", res->hr_checksum); } - - if (ret != 0) - return (ret); nv_add_string(nv, checksum_name(res->hr_checksum), "checksum"); nv_add_uint8_array(nv, hash, hsize, "hash"); if (nv_error(nv) != 0) { @@ -135,7 +127,6 @@ checksum_recv(const struct hast_resource const unsigned char *rhash; size_t chsize, rhsize; const char *algo; - int ret; algo = nv_get_string(nv, "checksum"); if (algo == NULL) @@ -146,10 +137,10 @@ checksum_recv(const struct hast_resource return (-1); /* Hash not found. */ } if (strcmp(algo, "crc32") == 0) - ret = hast_crc32_checksum(*datap, *sizep, chash, &chsize); + hast_crc32_checksum(*datap, *sizep, chash, &chsize); #ifdef HAVE_CRYPTO else if (strcmp(algo, "sha256") == 0) - ret = hast_sha256_checksum(*datap, *sizep, chash, &chsize); + hast_sha256_checksum(*datap, *sizep, chash, &chsize); #endif else { pjdlog_error("Unknown checksum algorithm '%s'.", algo); From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 22:05:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58379106566C; Thu, 15 Dec 2011 22:05:24 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4785C8FC12; Thu, 15 Dec 2011 22:05:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFM5OH7072672; Thu, 15 Dec 2011 22:05:24 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFM5ONS072670; Thu, 15 Dec 2011 22:05:24 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201112152205.pBFM5ONS072670@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 15 Dec 2011 22:05:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228544 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 22:05:24 -0000 Author: pjd Date: Thu Dec 15 22:05:23 2011 New Revision: 228544 URL: http://svn.freebsd.org/changeset/base/228544 Log: Remove redundant assignment. Found by: Clang Static Analyzer MFC after: 1 week Modified: head/sbin/hastd/secondary.c Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Thu Dec 15 22:03:17 2011 (r228543) +++ head/sbin/hastd/secondary.c Thu Dec 15 22:05:23 2011 (r228544) @@ -199,8 +199,6 @@ init_remote(struct hast_resource *res, s pjdlog_errno(LOG_WARNING, "Unable to set connection direction"); #endif - map = NULL; - mapsize = 0; nvout = nv_alloc(); nv_add_int64(nvout, (int64_t)res->hr_datasize, "datasize"); nv_add_int32(nvout, (int32_t)res->hr_extentsize, "extentsize"); From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 22:07:36 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C44371065670; Thu, 15 Dec 2011 22:07:36 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B24988FC12; Thu, 15 Dec 2011 22:07:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFM7ava072769; Thu, 15 Dec 2011 22:07:36 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFM7anT072765; Thu, 15 Dec 2011 22:07:36 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201112152207.pBFM7anT072765@svn.freebsd.org> From: Baptiste Daroussin Date: Thu, 15 Dec 2011 22:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228545 - head/lib/libutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 22:07:37 -0000 Author: bapt (ports committer) Date: Thu Dec 15 22:07:36 2011 New Revision: 228545 URL: http://svn.freebsd.org/changeset/base/228545 Log: Modify pw_copy: - if pw is NULL and oldpw is not NULL then the oldpw is deleted - if pw->pw_name != oldpw->pw_name but pw->pw_uid == oldpw->pw_uid then it renames the user add new gr_* functions so now gr_util API is similar to pw_util API, this allow to manipulate groups in a safe way. Reviewed by: des Approved by: des MFC after: 1 month Modified: head/lib/libutil/gr_util.c head/lib/libutil/libutil.h head/lib/libutil/pw_util.c Modified: head/lib/libutil/gr_util.c ============================================================================== --- head/lib/libutil/gr_util.c Thu Dec 15 22:05:23 2011 (r228544) +++ head/lib/libutil/gr_util.c Thu Dec 15 22:07:36 2011 (r228545) @@ -28,23 +28,319 @@ __FBSDID("$FreeBSD$"); #include +#include +#include +#include +#include +#include #include #include #include +#include #include #include #include #include +#include struct group_storage { struct group gr; char *members[]; }; +static int lockfd = -1; +static char group_dir[PATH_MAX]; +static char group_file[PATH_MAX]; +static char tempname[PATH_MAX]; +static int initialized; + static const char group_line_format[] = "%s:%s:%ju:"; /* + * Initialize statics + */ +int +gr_init(const char *dir, const char *group) +{ + if (dir == NULL) { + strcpy(group_dir, _PATH_ETC); + } else { + if (strlen(dir) >= sizeof(group_dir)) { + errno = ENAMETOOLONG; + return (-1); + } + strcpy(group_dir, dir); + } + + if (group == NULL) { + if (dir == NULL) { + strcpy(group_file, _PATH_GROUP); + } else if (snprintf(group_file, sizeof(group_file), "%s/group", + group_dir) > (int)sizeof(group_file)) { + errno = ENAMETOOLONG; + return (-1); + } + } else { + if (strlen(group) >= sizeof(group_file)) { + errno = ENAMETOOLONG; + return (-1); + } + strcpy(group_file, group); + } + initialized = 1; + return (0); +} + +/* + * Lock the group file + */ +int +gr_lock(void) +{ + if (*group_file == '\0') + return (-1); + + for (;;) { + struct stat st; + + lockfd = open(group_file, O_RDONLY, 0); + if (lockfd < 0 || fcntl(lockfd, F_SETFD, 1) == -1) + err(1, "%s", group_file); + if (flock(lockfd, LOCK_EX|LOCK_NB) == -1) { + if (errno == EWOULDBLOCK) { + errx(1, "the group file is busy"); + } else { + err(1, "could not lock the group file: "); + } + } + if (fstat(lockfd, &st) == -1) + err(1, "fstat() failed: "); + if (st.st_nlink != 0) + break; + close(lockfd); + lockfd = -1; + } + return (lockfd); +} + +/* + * Create and open a presmuably safe temp file for editing group data + */ +int +gr_tmp(int mfd) +{ + char buf[8192]; + ssize_t nr; + const char *p; + int tfd; + + if (*group_file == '\0') + return (-1); + if ((p = strrchr(group_file, '/'))) + ++p; + else + p = group_file; + if (snprintf(tempname, sizeof(tempname), "%.*sgroup.XXXXXX", + (int)(p - group_file), group_file) >= (int)sizeof(tempname)) { + errno = ENAMETOOLONG; + return (-1); + } + if ((tfd = mkstemp(tempname)) == -1) + return (-1); + if (mfd != -1) { + while ((nr = read(mfd, buf, sizeof(buf))) > 0) + if (write(tfd, buf, (size_t)nr) != nr) + break; + if (nr != 0) { + unlink(tempname); + *tempname = '\0'; + close(tfd); + return (-1); + } + } + return (tfd); +} + +/* + * Copy the group file from one descriptor to another, replacing, deleting + * or adding a single record on the way. + */ +int +gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr) +{ + char buf[8192], *end, *line, *p, *q, *r, t; + struct group *fgr; + const struct group *sgr; + size_t len; + int eof, readlen; + + sgr = gr; + if (gr == NULL) { + line = NULL; + if (old_gr == NULL) + return (-1); + sgr = old_gr; + } else if ((line = gr_make(gr)) == NULL) + return (-1); + + eof = 0; + len = 0; + p = q = end = buf; + for (;;) { + /* find the end of the current line */ + for (p = q; q < end && *q != '\0'; ++q) + if (*q == '\n') + break; + + /* if we don't have a complete line, fill up the buffer */ + if (q >= end) { + if (eof) + break; + if ((size_t)(q - p) >= sizeof(buf)) { + warnx("group line too long"); + errno = EINVAL; /* hack */ + goto err; + } + if (p < end) { + q = memmove(buf, p, end -p); + end -= p - buf; + } else { + p = q = end = buf; + } + readlen = read(ffd, end, sizeof(buf) - (end -buf)); + if (readlen == -1) + goto err; + else + len = (size_t)readlen; + if (len == 0 && p == buf) + break; + end += len; + len = end - buf; + if (len < (ssize_t)sizeof(buf)) { + eof = 1; + if (len > 0 && buf[len -1] != '\n') + ++len, *end++ = '\n'; + } + continue; + } + + /* is it a blank line or a comment? */ + for (r = p; r < q && isspace(*r); ++r) + /* nothing */; + if (r == q || *r == '#') { + /* yep */ + if (write(tfd, p, q -p + 1) != q - p + 1) + goto err; + ++q; + continue; + } + + /* is it the one we're looking for? */ + + t = *q; + *q = '\0'; + + fgr = gr_scan(r); + + /* fgr is either a struct group for the current line, + * or NULL if the line is malformed. + */ + + *q = t; + if (fgr == NULL || fgr->gr_gid != sgr->gr_gid) { + /* nope */ + if (fgr != NULL) + free(fgr); + if (write(tfd, p, q - p + 1) != q - p + 1) + goto err; + ++q; + continue; + } + if (old_gr && !gr_equal(fgr, old_gr)) { + warnx("entry inconsistent"); + free(fgr); + errno = EINVAL; /* hack */ + goto err; + } + free(fgr); + + /* it is, replace or remove it */ + if (line != NULL) { + len = strlen(line); + if (write(tfd, line, len) != (int) len) + goto err; + } else { + /* when removed, avoid the \n */ + q++; + } + /* we're done, just copy the rest over */ + for (;;) { + if (write(tfd, q, end - q) != end - q) + goto err; + q = buf; + readlen = read(ffd, buf, sizeof(buf)); + if (readlen == 0) + break; + else + len = (size_t)readlen; + if (readlen == -1) + goto err; + end = buf + len; + } + goto done; + } + + /* if we got here, we didn't find the old entry */ + if (line == NULL) { + errno = ENOENT; + goto err; + } + len = strlen(line); + if ((size_t)write(tfd, line, len) != len || + write(tfd, "\n", 1) != 1) + goto err; + done: + if (line != NULL) + free(line); + return (0); + err: + if (line != NULL) + free(line); + return (-1); +} + +/* + * Regenerate the group file + */ +int +gr_mkdb(void) +{ + return (rename(tempname, group_file)); +} + +/* + * Clean up. Preserver errno for the caller's convenience. + */ +void +gr_fini(void) +{ + int serrno; + + if (!initialized) + return; + initialized = 0; + serrno = errno; + if (*tempname != '\0') { + unlink(tempname); + *tempname = '\0'; + } + if (lockfd != -1) + close(lockfd); + errno = serrno; +} + +/* * Compares two struct group's. */ int Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Thu Dec 15 22:05:23 2011 (r228544) +++ head/lib/libutil/libutil.h Thu Dec 15 22:07:36 2011 (r228545) @@ -152,9 +152,15 @@ int pw_tmp(int _mfd); #endif #ifdef _GRP_H_ +int gr_copy(int __ffd, int _tfd, const struct group *_gr, struct group *_old_gr); +struct group *gr_dup(const struct group *gr); int gr_equal(const struct group *gr1, const struct group *gr2); +void gr_fini(void); +int gr_init(const char *_dir, const char *_master); +int gr_lock(void); char *gr_make(const struct group *gr); -struct group *gr_dup(const struct group *gr); +int gr_mkdb(void); +int gr_tmp(int _mdf); struct group *gr_scan(const char *line); #endif Modified: head/lib/libutil/pw_util.c ============================================================================== --- head/lib/libutil/pw_util.c Thu Dec 15 22:05:23 2011 (r228544) +++ head/lib/libutil/pw_util.c Thu Dec 15 22:07:36 2011 (r228545) @@ -410,18 +410,25 @@ pw_make(const struct passwd *pw) } /* - * Copy password file from one descriptor to another, replacing or adding - * a single record on the way. + * Copy password file from one descriptor to another, replacing, deleting + * or adding a single record on the way. */ int pw_copy(int ffd, int tfd, const struct passwd *pw, struct passwd *old_pw) { char buf[8192], *end, *line, *p, *q, *r, t; struct passwd *fpw; + const struct passwd *spw; size_t len; int eof, readlen; - if ((line = pw_make(pw)) == NULL) + spw = pw; + if (pw == NULL) { + line = NULL; + if (old_pw == NULL) + return (-1); + spw = old_pw; + } else if ((line = pw_make(pw)) == NULL) return (-1); eof = 0; @@ -489,7 +496,7 @@ pw_copy(int ffd, int tfd, const struct p */ *q = t; - if (fpw == NULL || strcmp(fpw->pw_name, pw->pw_name) != 0) { + if (fpw == NULL || fpw->pw_uid != spw->pw_uid) { /* nope */ if (fpw != NULL) free(fpw); @@ -506,11 +513,15 @@ pw_copy(int ffd, int tfd, const struct p } free(fpw); - /* it is, replace it */ - len = strlen(line); - if (write(tfd, line, len) != (int)len) - goto err; - + /* it is, replace or remove it */ + if (line != NULL) { + len = strlen(line); + if (write(tfd, line, len) != (int)len) + goto err; + } else { + /* when removed, avoid the \n */ + q++; + } /* we're done, just copy the rest over */ for (;;) { if (write(tfd, q, end - q) != end - q) @@ -528,16 +539,22 @@ pw_copy(int ffd, int tfd, const struct p goto done; } - /* if we got here, we have a new entry */ + /* if we got here, we didn't find the old entry */ + if (line == NULL) { + errno = ENOENT; + goto err; + } len = strlen(line); if ((size_t)write(tfd, line, len) != len || write(tfd, "\n", 1) != 1) goto err; done: - free(line); + if (line != NULL) + free(line); return (0); err: - free(line); + if (line != NULL) + free(line); return (-1); } From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 22:08:08 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FAAE1065677; Thu, 15 Dec 2011 22:08:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F1BE8FC18; Thu, 15 Dec 2011 22:08:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFM88Hk072824; Thu, 15 Dec 2011 22:08:08 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFM88hK072822; Thu, 15 Dec 2011 22:08:08 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112152208.pBFM88hK072822@svn.freebsd.org> From: Dimitry Andric Date: Thu, 15 Dec 2011 22:08:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228546 - head/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 22:08:08 -0000 Author: dim Date: Thu Dec 15 22:08:08 2011 New Revision: 228546 URL: http://svn.freebsd.org/changeset/base/228546 Log: Clang has more warnings enabled by default, and when using -Wall, so if WARNS is set to low values, some of them have to be disabled explicitly. MFC after: 1 week Modified: head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Thu Dec 15 22:07:36 2011 (r228545) +++ head/share/mk/bsd.sys.mk Thu Dec 15 22:08:08 2011 (r228546) @@ -57,6 +57,19 @@ CWARNFLAGS += -Wchar-subscripts -Winline CWARNFLAGS += -Wno-uninitialized . endif CWARNFLAGS += -Wno-pointer-sign +# Clang has more warnings enabled by default, and when using -Wall, so if WARNS +# is set to low values, these have to be disabled explicitly. +. if ${CC:T:Mclang} == "clang" +. if ${WARNS} <= 3 +CWARNFLAGS += -Wno-tautological-compare -Wno-unused-value +. endif +. if ${WARNS} <= 2 +CWARNFLAGS += -Wno-switch-enum +. endif +. if ${WARNS} <= 1 +CWARNFLAGS += -Wno-parentheses +. endif +. endif . endif . if defined(FORMAT_AUDIT) From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 22:10:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F49E1065670; Thu, 15 Dec 2011 22:10:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E3D78FC19; Thu, 15 Dec 2011 22:10:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFMARI9072928; Thu, 15 Dec 2011 22:10:27 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFMARRE072926; Thu, 15 Dec 2011 22:10:27 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112152210.pBFMARRE072926@svn.freebsd.org> From: Dimitry Andric Date: Thu, 15 Dec 2011 22:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228547 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 22:10:27 -0000 Author: dim Date: Thu Dec 15 22:10:27 2011 New Revision: 228547 URL: http://svn.freebsd.org/changeset/base/228547 Log: Cast away a clang alignment warning in drti.c's fixsymbol() function. This code only runs on i386 and amd64, so there should be no problems if buf + sec->dofs_offset is not aligned (which is unlikely anyway). MFC after: 1 week Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c Thu Dec 15 22:08:08 2011 (r228546) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c Thu Dec 15 22:10:27 2011 (r228547) @@ -102,7 +102,7 @@ fixsymbol(Elf *e, Elf_Data *data, size_t int ndx; while (gelf_getsym(data, j++, &sym) != NULL) { - prb = (dof_probe_t *)(buf + sec->dofs_offset); + prb = (dof_probe_t *)(void *)(buf + sec->dofs_offset); for (ndx = nprobes; ndx; ndx--, prb += 1) { funcname = dofstrtab + prb->dofpr_func; From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 22:34:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6E54106566C; Thu, 15 Dec 2011 22:34:22 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 249898FC08; Thu, 15 Dec 2011 22:34:21 +0000 (UTC) Received: by vbbfr13 with SMTP id fr13so3241484vbb.13 for ; Thu, 15 Dec 2011 14:34:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=2rsdKyArgk9xMsJgE43FT5vvtX6umx5AFy5W+Awfbbc=; b=vy1aaHhW8XNVqLzUqXjpdiqZFT0PyK8NG50nl8MJ3JgO866/hPNtwgpO/7CRIMmqYF MOC1YSCJ4oXpzwJjKuF4XDvaqFRa2YhowQl41lyQhzu1aYZyz0htgZDWWi1wvHJ8YAC+ Xp2YopmLuK7DWvk9BEAV8coQSrOcgA+ttVgFA= MIME-Version: 1.0 Received: by 10.52.175.9 with SMTP id bw9mr4525702vdc.130.1323988461366; Thu, 15 Dec 2011 14:34:21 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.52.26.50 with HTTP; Thu, 15 Dec 2011 14:34:21 -0800 (PST) In-Reply-To: References: <201112150052.pBF0qUA5022051@svn.freebsd.org> Date: Thu, 15 Dec 2011 14:34:21 -0800 X-Google-Sender-Auth: N2qTH2hE-9JJhwpyaJcBiCT4IyA Message-ID: From: Adrian Chadd To: Bernhard Schmidt Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228514 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 22:34:22 -0000 On 15 December 2011 02:15, Bernhard Schmidt wrote: >> So in short: if you're happy removing it, remove it. :) > > I agree on passing the frame as an argument to iac_check() and obtain > the mac from there, that definitely is required for more advanced > ACLs. Passing both tough, is imho not required and redundant, so, yes > I think I'm going to remove it. Go for it. ;) Adrian From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 22:37:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B70EB106564A; Thu, 15 Dec 2011 22:37:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5B718FC15; Thu, 15 Dec 2011 22:37:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFMbX48073841; Thu, 15 Dec 2011 22:37:33 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFMbX6J073839; Thu, 15 Dec 2011 22:37:33 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112152237.pBFMbX6J073839@svn.freebsd.org> From: Dimitry Andric Date: Thu, 15 Dec 2011 22:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228548 - head/cddl/contrib/opensolaris/lib/libdtrace/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 22:37:33 -0000 Author: dim Date: Thu Dec 15 22:37:33 2011 New Revision: 228548 URL: http://svn.freebsd.org/changeset/base/228548 Log: In cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c, use the correct printf format for an unsigned long. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c Thu Dec 15 22:10:27 2011 (r228547) +++ head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c Thu Dec 15 22:37:33 2011 (r228548) @@ -436,7 +436,7 @@ dt_pid_create_glob_offset_probes(struct char name[sizeof (i) * 2 + 1]; for (i = 0; i < end; i += size) { - (void) snprintf(name, sizeof (name), "%x", i); + (void) snprintf(name, sizeof (name), "%lx", i); if (gmatch(name, pattern)) ftp->ftps_offs[ftp->ftps_noffs++] = i; From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 22:46:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 270801065672; Thu, 15 Dec 2011 22:46:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15C758FC17; Thu, 15 Dec 2011 22:46:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFMk4vl074138; Thu, 15 Dec 2011 22:46:04 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFMk4eS074136; Thu, 15 Dec 2011 22:46:04 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112152246.pBFMk4eS074136@svn.freebsd.org> From: Dimitry Andric Date: Thu, 15 Dec 2011 22:46:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228549 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 22:46:05 -0000 Author: dim Date: Thu Dec 15 22:46:04 2011 New Revision: 228549 URL: http://svn.freebsd.org/changeset/base/228549 Log: In cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c, use the correct printf format for a key_t (aka long). MFC after: 1 week Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Thu Dec 15 22:37:33 2011 (r228548) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Thu Dec 15 22:46:04 2011 (r228549) @@ -1106,7 +1106,7 @@ process_obj(dtrace_hdl_t *dtp, const cha static const char dt_prefix[] = "__dtrace"; static const char dt_enabled[] = "enabled"; static const char dt_symprefix[] = "$dtrace"; - static const char dt_symfmt[] = "%s%d.%s"; + static const char dt_symfmt[] = "%s%ld.%s"; int fd, i, ndx, eprobe, mod = 0; Elf *elf = NULL; GElf_Ehdr ehdr; From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 23:06:46 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86DD41065673; Thu, 15 Dec 2011 23:06:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75A078FC17; Thu, 15 Dec 2011 23:06:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFN6k8R074779; Thu, 15 Dec 2011 23:06:46 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFN6k8Z074777; Thu, 15 Dec 2011 23:06:46 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112152306.pBFN6k8Z074777@svn.freebsd.org> From: Dimitry Andric Date: Thu, 15 Dec 2011 23:06:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228550 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 23:06:46 -0000 Author: dim Date: Thu Dec 15 23:06:46 2011 New Revision: 228550 URL: http://svn.freebsd.org/changeset/base/228550 Log: In cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c, the dt_popc() function assumes that either _ILP32 or _LP64 is defined, otherwise it has no suitable implementation. However, the _ILP32 and _LP64 macros come from isa_defs.h, which is not included in this file. Add the include now, to get the macros defined. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c Thu Dec 15 22:46:04 2011 (r228549) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c Thu Dec 15 23:06:46 2011 (r228550) @@ -27,6 +27,7 @@ #if defined(sun) #include #endif +#include #include #include From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 23:13:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6EFB106566B; Thu, 15 Dec 2011 23:13:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C66298FC0A; Thu, 15 Dec 2011 23:13:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFNDvjO075024; Thu, 15 Dec 2011 23:13:57 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFNDved075022; Thu, 15 Dec 2011 23:13:57 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112152313.pBFNDved075022@svn.freebsd.org> From: Dimitry Andric Date: Thu, 15 Dec 2011 23:13:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228551 - head/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 23:13:57 -0000 Author: dim Date: Thu Dec 15 23:13:57 2011 New Revision: 228551 URL: http://svn.freebsd.org/changeset/base/228551 Log: Disable one more clang warning when WARNS <= 3. MFC after: 1 week Modified: head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Thu Dec 15 23:06:46 2011 (r228550) +++ head/share/mk/bsd.sys.mk Thu Dec 15 23:13:57 2011 (r228551) @@ -61,7 +61,8 @@ CWARNFLAGS += -Wno-pointer-sign # is set to low values, these have to be disabled explicitly. . if ${CC:T:Mclang} == "clang" . if ${WARNS} <= 3 -CWARNFLAGS += -Wno-tautological-compare -Wno-unused-value +CWARNFLAGS += -Wno-tautological-compare -Wno-unused-value\ + -Wno-parentheses-equality . endif . if ${WARNS} <= 2 CWARNFLAGS += -Wno-switch-enum From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 23:22:25 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34FC7106566B; Thu, 15 Dec 2011 23:22:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 243A28FC08; Thu, 15 Dec 2011 23:22:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFNMPrv075428; Thu, 15 Dec 2011 23:22:25 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFNMPTe075426; Thu, 15 Dec 2011 23:22:25 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112152322.pBFNMPTe075426@svn.freebsd.org> From: Dimitry Andric Date: Thu, 15 Dec 2011 23:22:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228552 - head/lib/libipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 23:22:25 -0000 Author: dim Date: Thu Dec 15 23:22:24 2011 New Revision: 228552 URL: http://svn.freebsd.org/changeset/base/228552 Log: Define YY_NO_INPUT in lib/libipsec/policy_token.l, so lex's input() function does not get defined needlessly. MFC after: 1 week Modified: head/lib/libipsec/policy_token.l Modified: head/lib/libipsec/policy_token.l ============================================================================== --- head/lib/libipsec/policy_token.l Thu Dec 15 23:13:57 2011 (r228551) +++ head/lib/libipsec/policy_token.l Thu Dec 15 23:22:24 2011 (r228552) @@ -48,6 +48,7 @@ #include "y.tab.h" #define yylval __libipsecyylval /* XXX */ +#define YY_NO_INPUT int yylex(void); %} From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 23:28:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7E41106566C; Thu, 15 Dec 2011 23:28:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A72EB8FC13; Thu, 15 Dec 2011 23:28:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFNSHRl075627; Thu, 15 Dec 2011 23:28:17 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFNSH2v075625; Thu, 15 Dec 2011 23:28:17 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112152328.pBFNSH2v075625@svn.freebsd.org> From: Dimitry Andric Date: Thu, 15 Dec 2011 23:28:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228553 - head/contrib/file X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 23:28:17 -0000 Author: dim Date: Thu Dec 15 23:28:17 2011 New Revision: 228553 URL: http://svn.freebsd.org/changeset/base/228553 Log: In contrib/file/softmagic.c, fix a potential format string security problem. (This fix has already been applied upstream, but we do not have the latest version of file in the tree at the moment.) MFC after: 1 week Modified: head/contrib/file/softmagic.c Modified: head/contrib/file/softmagic.c ============================================================================== --- head/contrib/file/softmagic.c Thu Dec 15 23:22:24 2011 (r228552) +++ head/contrib/file/softmagic.c Thu Dec 15 23:28:17 2011 (r228553) @@ -1582,7 +1582,7 @@ mget(struct magic_set *ms, const unsigne case FILE_INDIRECT: if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && - file_printf(ms, m->desc) == -1) + file_printf(ms, "%s", m->desc) == -1) return -1; if (nbytes < offset) return 0; From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 23:29:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id ED9ED1065676; Thu, 15 Dec 2011 23:29:56 +0000 (UTC) Date: Thu, 15 Dec 2011 23:29:56 +0000 From: Alexander Best To: Dimitry Andric Message-ID: <20111215232956.GA10341@freebsd.org> References: <201112152322.pBFNMPTe075426@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112152322.pBFNMPTe075426@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228552 - head/lib/libipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 23:29:57 -0000 On Thu Dec 15 11, Dimitry Andric wrote: > Author: dim > Date: Thu Dec 15 23:22:24 2011 > New Revision: 228552 > URL: http://svn.freebsd.org/changeset/base/228552 > > Log: > Define YY_NO_INPUT in lib/libipsec/policy_token.l, so lex's input() > function does not get defined needlessly. could such a minimal change also fix the following cases: >>> stage 2.3: build tools -------------------------------------------------------------- cd /usr/obj/usr/subversion-src/sys/ARUNDEL; MAKESRCPATH=/usr/subversion-src/sys/dev/aic7xxx/aicasm make SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -f /usr/subversion-src/sys/dev/aic7xxx/aicasm/Makefile Warning: Object directory not changed from original /usr/obj/usr/subversion-src/sys/ARUNDEL clang -O2 -pipe -nostdinc -I/usr/include -I. -I/usr/subversion-src/sys/dev/aic7xxx/aicasm -DSTRIP_FBSDID -std=gnu99 -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -c /usr/subversion-src/sys/dev/aic7xxx/aicasm/aicasm.c clang -O2 -pipe -nostdinc -I/usr/include -I. -I/usr/subversion-src/sys/dev/aic7xxx/aicasm -DSTRIP_FBSDID -std=gnu99 -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -c /usr/subversion-src/sys/dev/aic7xxx/aicasm/aicasm_symbol.c clang -O2 -pipe -nostdinc -I/usr/include -I. -I/usr/subversion-src/sys/dev/aic7xxx/aicasm -DSTRIP_FBSDID -std=gnu99 -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -c aicasm_gram.c clang -O2 -pipe -nostdinc -I/usr/include -I. -I/usr/subversion-src/sys/dev/aic7xxx/aicasm -DSTRIP_FBSDID -std=gnu99 -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -c aicasm_macro_gram.c clang -O2 -pipe -nostdinc -I/usr/include -I. -I/usr/subversion-src/sys/dev/aic7xxx/aicasm -DSTRIP_FBSDID -std=gnu99 -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -c aicasm_scan.c /usr/subversion-src/sys/dev/aic7xxx/aicasm/aicasm_scan.l:843:12: warning: function 'input' is not needed and will not be emitted [-Wunneeded-internal-declaration] static int input(void) ^ 1 warning generated. lex -t -Pmm /usr/subversion-src/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l > aicasm_macro_scan.c clang -O2 -pipe -nostdinc -I/usr/include -I. -I/usr/subversion-src/sys/dev/aic7xxx/aicasm -DSTRIP_FBSDID -std=gnu99 -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -c aicasm_macro_scan.c /usr/subversion-src/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l:545:12: warning: function 'input' is not needed and will not be emitted [-Wunneeded-internal-declaration] static int input(void) ^ 1 warning generated. clang -O2 -pipe -nostdinc -I/usr/include -I. -I/usr/subversion-src/sys/dev/aic7xxx/aicasm -DSTRIP_FBSDID -std=gnu99 -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wno-pointer-sign -o aicasm aicasm.o aicasm_symbol.o aicasm_gram.o aicasm_macro_gram.o aicasm_scan.o aicasm_macro_scan.o -ll clang: warning: argument unused during compilation: '-nostdinc' clang: warning: argument unused during compilation: '-std=gnu99' ? cheers. alex > > MFC after: 1 week > > Modified: > head/lib/libipsec/policy_token.l > > Modified: head/lib/libipsec/policy_token.l > ============================================================================== > --- head/lib/libipsec/policy_token.l Thu Dec 15 23:13:57 2011 (r228551) > +++ head/lib/libipsec/policy_token.l Thu Dec 15 23:22:24 2011 (r228552) > @@ -48,6 +48,7 @@ > > #include "y.tab.h" > #define yylval __libipsecyylval /* XXX */ > +#define YY_NO_INPUT > > int yylex(void); > %} From owner-svn-src-all@FreeBSD.ORG Thu Dec 15 23:47:36 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9B06106564A; Thu, 15 Dec 2011 23:47:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97C9E8FC12; Thu, 15 Dec 2011 23:47:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBFNlaup076236; Thu, 15 Dec 2011 23:47:36 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBFNlasR076234; Thu, 15 Dec 2011 23:47:36 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112152347.pBFNlasR076234@svn.freebsd.org> From: Dimitry Andric Date: Thu, 15 Dec 2011 23:47:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228554 - head/sys/contrib/ngatm/netnatm/msg X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 15 Dec 2011 23:47:36 -0000 Author: dim Date: Thu Dec 15 23:47:36 2011 New Revision: 228554 URL: http://svn.freebsd.org/changeset/base/228554 Log: In sys/contrib/ngatm/netnatm/msg/uni_ie.c, use a more appropriate way to tell the compiler some parameters are purposefully unused. MFC after: 1 week Modified: head/sys/contrib/ngatm/netnatm/msg/uni_ie.c Modified: head/sys/contrib/ngatm/netnatm/msg/uni_ie.c ============================================================================== --- head/sys/contrib/ngatm/netnatm/msg/uni_ie.c Thu Dec 15 23:28:17 2011 (r228553) +++ head/sys/contrib/ngatm/netnatm/msg/uni_ie.c Thu Dec 15 23:47:36 2011 (r228554) @@ -47,6 +47,8 @@ #include #include +#define UNUSED(_p) do { (void)(_p); } while (0) + /* * Define internal functions. */ @@ -1321,7 +1323,7 @@ check_cause(struct uni_ie_cause *ie, str return (-1); } if (ie->h.present & UNI_CAUSE_PARAM_P) { - cx = cx; + UNUSED(cx); } return (0); @@ -1656,7 +1658,7 @@ DEF_IE_PRINT(itu, callstate) DEF_IE_CHECK(itu, callstate) { - cx = cx; + UNUSED(cx); switch(ie->state) { default: @@ -1742,7 +1744,7 @@ DEF_IE_PRINT(itu, facility) DEF_IE_CHECK(itu, facility) { - cx = cx; + UNUSED(cx); if(ie->len > UNI_FACILITY_MAXAPDU) return -1; @@ -1811,7 +1813,7 @@ DEF_IE_PRINT(itu, notify) DEF_IE_CHECK(itu, notify) { - cx = cx; + UNUSED(cx); if(ie->len > UNI_NOTIFY_MAXLEN) return -1; @@ -1904,7 +1906,7 @@ DEF_IE_PRINT(net, eetd) DEF_IE_CHECK(itu, eetd) { - cx = cx; + UNUSED(cx); if (!(ie->h.present & UNI_EETD_CUM_P)) return (-1); @@ -2298,7 +2300,7 @@ DEF_IE_PRINT(itu, called) DEF_IE_CHECK(itu, called) { - cx = cx; + UNUSED(cx); if (check_addr(&ie->addr)) return (-1); @@ -2345,7 +2347,7 @@ DEF_IE_PRINT(itu, calledsub) DEF_IE_CHECK(itu, calledsub) { - cx = cx; + UNUSED(cx); if(check_subaddr(&ie->addr)) return -1; @@ -2396,7 +2398,7 @@ DEF_IE_PRINT(itu, calling) DEF_IE_CHECK(itu, calling) { - cx = cx; + UNUSED(cx); if(check_addr(&ie->addr)) return -1; @@ -2459,7 +2461,7 @@ DEF_IE_PRINT(itu, callingsub) DEF_IE_CHECK(itu, callingsub) { - cx = cx; + UNUSED(cx); if(check_subaddr(&ie->addr)) return -1; @@ -2510,7 +2512,7 @@ DEF_IE_PRINT(itu, conned) DEF_IE_CHECK(itu, conned) { - cx = cx; + UNUSED(cx); if(check_addr(&ie->addr)) return -1; @@ -2573,7 +2575,7 @@ DEF_IE_PRINT(itu, connedsub) DEF_IE_CHECK(itu, connedsub) { - cx = cx; + UNUSED(cx); if(check_subaddr(&ie->addr)) return -1; @@ -2627,7 +2629,7 @@ DEF_IE_PRINT(itu, epref) DEF_IE_CHECK(itu, epref) { - cx = cx; + UNUSED(cx); if(ie->epref >= (2<<15)) return -1; @@ -2702,7 +2704,7 @@ DEF_IE_PRINT(itu, epstate) DEF_IE_CHECK(itu, epstate) { - cx = cx; + UNUSED(cx); switch(ie->state) { default: @@ -2895,7 +2897,7 @@ DEF_IE_PRINT(itu, aal) DEF_IE_CHECK(itu, aal) { - cx = cx; + UNUSED(cx); if(ie->type == UNI_AAL_0) { ; @@ -3784,7 +3786,7 @@ DEF_IE_CHECK(itu, mintraffic) { u_int abr; u_int xbr; - cx = cx; + UNUSED(cx); abr = ie->h.present & (UNI_MINTRAFFIC_FABR1_P|UNI_MINTRAFFIC_BABR1_P); xbr = ie->h.present & (UNI_MINTRAFFIC_FPCR0_P|UNI_MINTRAFFIC_BPCR0_P| @@ -3869,7 +3871,7 @@ DEF_IE_PRINT(net, mdcr) DEF_IE_CHECK(net, mdcr) { - cx = cx; + UNUSED(cx); if ((ie->origin != UNI_MDCR_ORIGIN_USER && ie->origin != UNI_MDCR_ORIGIN_NET) || @@ -3965,7 +3967,7 @@ DEF_IE_PRINT(itu, connid) DEF_IE_CHECK(itu, connid) { - cx = cx; + UNUSED(cx); switch(ie->type) { default: return -1; @@ -4075,7 +4077,7 @@ DEF_IE_PRINT(net, qos) DEF_IE_CHECK(itu, qos) { - cx = cx; + UNUSED(cx); switch(ie->fwd) { default: @@ -4096,7 +4098,7 @@ DEF_IE_CHECK(itu, qos) DEF_IE_CHECK(net, qos) { - cx = cx; + UNUSED(cx); switch(ie->fwd) { default: @@ -4205,7 +4207,7 @@ DEF_IE_PRINT(itu, bhli) DEF_IE_CHECK(itu, bhli) { - cx = cx; + UNUSED(cx); switch(ie->type) { default: @@ -4357,7 +4359,7 @@ DEF_IE_PRINT(itu, bearer) #define QTYPE0(C) ((UNI_BEARER_##C << 8) | (1 << 16)) DEF_IE_CHECK(itu, bearer) { - cx = cx; + UNUSED(cx); switch((ie->bclass << 8) | ((ie->h.present & UNI_BEARER_ATC_P) == 0 @@ -4656,7 +4658,7 @@ DEF_IE_PRINT(itu, blli) DEF_IE_CHECK(itu, blli) { - cx = cx; + UNUSED(cx); /* if(ie->h.present & UNI_BLLI_L1_P) ; @@ -5171,7 +5173,7 @@ DEF_IE_PRINT(itu, lshift) DEF_IE_CHECK(itu, lshift) { - cx = cx; ie = ie; + UNUSED(cx); UNUSED(ie); return -1; } @@ -5212,7 +5214,7 @@ DEF_IE_PRINT(itu, nlshift) DEF_IE_CHECK(itu, nlshift) { - cx = cx; ie = ie; + UNUSED(cx); UNUSED(ie); return -1; } @@ -5261,7 +5263,7 @@ DEF_IE_PRINT(itu, scompl) DEF_IE_CHECK(itu, scompl) { - ie = ie; cx = cx; + UNUSED(ie); UNUSED(cx); return 0; } @@ -5398,7 +5400,7 @@ DEF_IE_CHECK(itu, tns) { u_int i; - cx = cx; + UNUSED(cx); if(ie->len == 0 || ie->len > UNI_TNS_MAXLEN) return -1; @@ -5466,7 +5468,7 @@ DEF_IE_PRINT(itu, restart) DEF_IE_CHECK(itu, restart) { - cx = cx; + UNUSED(cx); switch(ie->rclass) { default: @@ -5535,7 +5537,7 @@ DEF_IE_PRINT(itu, uu) DEF_IE_CHECK(itu, uu) { - cx = cx; + UNUSED(cx); if(ie->len > UNI_UU_MAXLEN) return -1; @@ -5754,8 +5756,8 @@ DEF_IE_PRINT(net, abradd) DEF_IE_CHECK(net, abradd) { - cx = cx; - ie = ie; + UNUSED(cx); + UNUSED(ie); return 0; } @@ -6015,7 +6017,7 @@ DEF_IE_PRINT(itu, report) DEF_IE_CHECK(itu, report) { - cx = cx; + UNUSED(cx); switch(ie->report) { @@ -6098,7 +6100,7 @@ DEF_IE_PRINT(net, called_soft) DEF_IE_CHECK(net, calling_soft) { - cx = cx; + UNUSED(cx); if(ie->vpi >= 1 << 12) return -1; @@ -6107,7 +6109,7 @@ DEF_IE_CHECK(net, calling_soft) DEF_IE_CHECK(net, called_soft) { - cx = cx; + UNUSED(cx); switch(ie->sel) { @@ -6357,7 +6359,7 @@ DEF_IE_PRINT(net, crankback) DEF_IE_CHECK(net, crankback) { - cx = cx; + UNUSED(cx); if(ie->level > 104) return -1; @@ -6595,7 +6597,7 @@ DEF_IE_CHECK(net, dtl) { u_int i; - cx = cx; + UNUSED(cx); if(ie->ptr % UNI_DTL_LOGNP_SIZE != 0) return -1; @@ -6703,7 +6705,7 @@ DEF_IE_PRINT(net, lij_callid) DEF_IE_CHECK(net, lij_callid) { - cx = cx; + UNUSED(cx); switch(ie->type) { @@ -6761,7 +6763,7 @@ DEF_IE_PRINT(net, lij_param) DEF_IE_CHECK(net, lij_param) { - cx = cx; + UNUSED(cx); switch(ie->screen) { @@ -6809,7 +6811,7 @@ DEF_IE_PRINT(net, lij_seqno) DEF_IE_CHECK(net, lij_seqno) { - cx = cx; ie = ie; + UNUSED(cx); UNUSED(ie); return 0; } @@ -6888,7 +6890,7 @@ DEF_IE_PRINT(net, cscope) DEF_IE_CHECK(net, cscope) { - cx = cx; + UNUSED(cx); switch(ie->type) { @@ -7018,7 +7020,7 @@ DEF_IE_PRINT(net, exqos) DEF_IE_CHECK(net, exqos) { - cx = cx; + UNUSED(cx); switch(ie->origin) { case UNI_EXQOS_USER: @@ -7130,7 +7132,7 @@ DEF_IE_PRINT(itu, unrec) DEF_IE_CHECK(itu, unrec) { - cx = cx; + UNUSED(cx); if (ie->len > sizeof(ie->data)) return (-1); From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 00:01:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A86F106566B; Fri, 16 Dec 2011 00:01:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09F838FC0A; Fri, 16 Dec 2011 00:01:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBG01JSX076705; Fri, 16 Dec 2011 00:01:19 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBG01J4v076703; Fri, 16 Dec 2011 00:01:19 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112160001.pBG01J4v076703@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 00:01:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228555 - head/lib/libipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 00:01:20 -0000 Author: dim Date: Fri Dec 16 00:01:19 2011 New Revision: 228555 URL: http://svn.freebsd.org/changeset/base/228555 Log: In lib/libipsec/policy_token.l, use lex's standard "%option noinput" instead of hand-defining the YY_NO_INPUT macro. MFC after: 1 week Modified: head/lib/libipsec/policy_token.l Modified: head/lib/libipsec/policy_token.l ============================================================================== --- head/lib/libipsec/policy_token.l Thu Dec 15 23:47:36 2011 (r228554) +++ head/lib/libipsec/policy_token.l Fri Dec 16 00:01:19 2011 (r228555) @@ -48,13 +48,13 @@ #include "y.tab.h" #define yylval __libipsecyylval /* XXX */ -#define YY_NO_INPUT int yylex(void); %} %option noyywrap %option nounput +%option noinput /* common section */ nl \n From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 00:04:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 058D5106564A; Fri, 16 Dec 2011 00:04:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8C348FC17; Fri, 16 Dec 2011 00:04:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBG04Sqi076829; Fri, 16 Dec 2011 00:04:28 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBG04SXc076826; Fri, 16 Dec 2011 00:04:28 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112160004.pBG04SXc076826@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 00:04:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228556 - head/sys/dev/aic7xxx/aicasm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 00:04:29 -0000 Author: dim Date: Fri Dec 16 00:04:28 2011 New Revision: 228556 URL: http://svn.freebsd.org/changeset/base/228556 Log: Add "%option noinput" to aicasm_scan.l and aicasm_macro_scan.l, so no unneeded input functions will be emitted. Spotted by: arundel MFC after: 1 week Modified: head/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l head/sys/dev/aic7xxx/aicasm/aicasm_scan.l Modified: head/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l ============================================================================== --- head/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l Fri Dec 16 00:01:19 2011 (r228555) +++ head/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l Fri Dec 16 00:04:28 2011 (r228556) @@ -66,6 +66,8 @@ static char msgbuf[255]; extern int mmlex(void); %} +%option noinput + WORD [A-Za-z_][-A-Za-z_0-9]* SPACE [ \t]+ MCARG [^(), \t]+ Modified: head/sys/dev/aic7xxx/aicasm/aicasm_scan.l ============================================================================== --- head/sys/dev/aic7xxx/aicasm/aicasm_scan.l Fri Dec 16 00:01:19 2011 (r228555) +++ head/sys/dev/aic7xxx/aicasm/aicasm_scan.l Fri Dec 16 00:04:28 2011 (r228556) @@ -72,6 +72,8 @@ extern void mm_switch_to_buffer(YY_BUFFE extern void mm_delete_buffer(YY_BUFFER_STATE); %} +%option noinput + PATH ([/]*[-A-Za-z0-9_.])+ WORD [A-Za-z_][-A-Za-z_0-9]* SPACE [ \t]+ From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 00:13:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 952C4106564A; Fri, 16 Dec 2011 00:13:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8487C8FC17; Fri, 16 Dec 2011 00:13:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBG0DhDg077213; Fri, 16 Dec 2011 00:13:43 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBG0Dhat077210; Fri, 16 Dec 2011 00:13:43 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112160013.pBG0Dhat077210@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 00:13:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228557 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 00:13:43 -0000 Author: dim Date: Fri Dec 16 00:13:43 2011 New Revision: 228557 URL: http://svn.freebsd.org/changeset/base/228557 Log: In lib/libpmc/libpmc.c, struct pmc_cputype_map's pm_cputype field should be of type 'enum pmc_cputype', not 'enum pmc_class'. MFC after: 1 week Modified: head/lib/libpmc/libpmc.c Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Fri Dec 16 00:04:28 2011 (r228556) +++ head/lib/libpmc/libpmc.c Fri Dec 16 00:13:43 2011 (r228557) @@ -289,7 +289,7 @@ static const char * pmc_class_names[] = }; struct pmc_cputype_map { - enum pmc_class pm_cputype; + enum pmc_cputype pm_cputype; const char *pm_name; }; From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 00:39:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F609106566C; Fri, 16 Dec 2011 00:39:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E9BA8FC14; Fri, 16 Dec 2011 00:39:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBG0dieO078000; Fri, 16 Dec 2011 00:39:44 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBG0diAt077998; Fri, 16 Dec 2011 00:39:44 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112160039.pBG0diAt077998@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 00:39:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228558 - head/lib/libsm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 00:39:45 -0000 Author: dim Date: Fri Dec 16 00:39:44 2011 New Revision: 228558 URL: http://svn.freebsd.org/changeset/base/228558 Log: Unfortunately, clang gives a warning about sendmail code that cannot be turned off yet. Since this is contrib code, and we don't really care about the warnings, just turn make them non-fatal for now. MFC after: 1 week Modified: head/lib/libsm/Makefile Modified: head/lib/libsm/Makefile ============================================================================== --- head/lib/libsm/Makefile Fri Dec 16 00:13:43 2011 (r228557) +++ head/lib/libsm/Makefile Fri Dec 16 00:39:44 2011 (r228558) @@ -18,6 +18,13 @@ CFLAGS+=${SENDMAIL_CFLAGS} WARNS?= 2 +.if ${CC:T:Mclang} == "clang" +# Unfortunately, clang gives a warning about sendmail code that cannot +# be turned off yet. Since this is contrib code, and we don't really +# care about the warnings, just turn make them non-fatal for now. +NO_WERROR= +.endif + LIB= sm SRCS+= sm_os.h From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 00:48:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 893AF106566B; Fri, 16 Dec 2011 00:48:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 784618FC0A; Fri, 16 Dec 2011 00:48:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBG0mrtD078298; Fri, 16 Dec 2011 00:48:53 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBG0mrGK078296; Fri, 16 Dec 2011 00:48:53 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112160048.pBG0mrGK078296@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 00:48:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228559 - head/contrib/telnet/libtelnet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 00:48:53 -0000 Author: dim Date: Fri Dec 16 00:48:53 2011 New Revision: 228559 URL: http://svn.freebsd.org/changeset/base/228559 Log: In contrib/telnet/libtelnet/sra.c, use the correct number of bytes to zero the password buffer. MFC after: 1 week Modified: head/contrib/telnet/libtelnet/sra.c Modified: head/contrib/telnet/libtelnet/sra.c ============================================================================== --- head/contrib/telnet/libtelnet/sra.c Fri Dec 16 00:39:44 2011 (r228558) +++ head/contrib/telnet/libtelnet/sra.c Fri Dec 16 00:48:53 2011 (r228559) @@ -303,7 +303,7 @@ sra_reply(Authenticator *ap, unsigned ch goto enc_user; } /* encode password */ - memset(pass,0,sizeof(pass)); + memset(pass,0,256); telnet_gets("Password: ",pass,255,0); pk_encode(pass,xpass,&ck); /* send it off */ From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 00:58:42 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DF7C106566B; Fri, 16 Dec 2011 00:58:42 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0CE498FC08; Fri, 16 Dec 2011 00:58:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBG0wf7W078620; Fri, 16 Dec 2011 00:58:41 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBG0wfBm078618; Fri, 16 Dec 2011 00:58:41 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201112160058.pBG0wfBm078618@svn.freebsd.org> From: Rick Macklem Date: Fri, 16 Dec 2011 00:58:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228560 - head/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 00:58:42 -0000 Author: rmacklem Date: Fri Dec 16 00:58:41 2011 New Revision: 228560 URL: http://svn.freebsd.org/changeset/base/228560 Log: Patch the new NFS server in a manner analagous to r228520 for the old NFS server, so that it correctly handles a count == 0 argument for Commit. PR: kern/118126 MFC after: 2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdport.c Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Fri Dec 16 00:48:53 2011 (r228559) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Fri Dec 16 00:58:41 2011 (r228560) @@ -1254,7 +1254,13 @@ nfsvno_fsync(struct vnode *vp, u_int64_t { int error = 0; - if (cnt > MAX_COMMIT_COUNT) { + /* + * RFC 1813 3.3.21: if count is 0, a flush from offset to the end of + * file is done. At this time VOP_FSYNC does not accept offset and + * byte count parameters so call VOP_FSYNC the whole file for now. + * The same is true for NFSv4: RFC 3530 Sec. 14.2.3. + */ + if (cnt == 0 || cnt > MAX_COMMIT_COUNT) { /* * Give up and do the whole thing */ From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 02:09:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E1EF106564A; Fri, 16 Dec 2011 02:09:52 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 203BF8FC0A; Fri, 16 Dec 2011 02:09:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBG29q20080767; Fri, 16 Dec 2011 02:09:52 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBG29q5h080761; Fri, 16 Dec 2011 02:09:52 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201112160209.pBG29q5h080761@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 16 Dec 2011 02:09:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228561 - in head: share/man/man4 sys/dev/cxgbe sys/dev/cxgbe/common sys/dev/cxgbe/firmware sys/modules/cxgbe sys/modules/cxgbe/firmware tools/tools/cxgbetool X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 02:09:52 -0000 Author: np Date: Fri Dec 16 02:09:51 2011 New Revision: 228561 URL: http://svn.freebsd.org/changeset/base/228561 Log: Many updates to cxgbe(4) - Device configuration via plain text config file. Also able to operate when not attached to the chip as the master driver. - Generic "work request" queue that serves as the base for both ctrl and ofld tx queues. - Generic interrupt handler routine that can process any event on any kind of ingress queue (via a dispatch table). - A couple of new driver ioctls. cxgbetool can now install a firmware to the card ("loadfw" command) and can read the card's memory ("memdump" and "tcb" commands). - Lots of assorted information within dev.t4nex.X.misc.* This is primarily for debugging and won't show up in sysctl -a. - Code to manage the L2 tables on the chip. - Updates to cxgbe(4) man page to go with the tunables that have changed. - Updates to the shared code in common/ - Updates to the driver-firmware interface (now at fw 1.4.16.0) MFC after: 1 month Added: head/sys/dev/cxgbe/firmware/ head/sys/dev/cxgbe/firmware/t4fw_cfg.txt (contents, props changed) head/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt (contents, props changed) head/sys/dev/cxgbe/firmware/t4fw_interface.h - copied, changed from r228535, head/sys/dev/cxgbe/common/t4fw_interface.h head/sys/modules/cxgbe/firmware/ head/sys/modules/cxgbe/firmware/Makefile (contents, props changed) Deleted: head/sys/dev/cxgbe/common/t4fw_interface.h Modified: head/share/man/man4/cxgbe.4 head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/common/t4_hw.h head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/osdep.h head/sys/dev/cxgbe/t4_ioctl.h head/sys/dev/cxgbe/t4_l2t.c head/sys/dev/cxgbe/t4_l2t.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c head/sys/modules/cxgbe/Makefile head/tools/tools/cxgbetool/cxgbetool.c Modified: head/share/man/man4/cxgbe.4 ============================================================================== --- head/share/man/man4/cxgbe.4 Fri Dec 16 00:58:41 2011 (r228560) +++ head/share/man/man4/cxgbe.4 Fri Dec 16 02:09:51 2011 (r228561) @@ -99,18 +99,29 @@ Tunables can be set at the prompt before booting the kernel or stored in .Xr loader.conf 5 . .Bl -tag -width indent -.It Va hw.cxgbe.max_ntxq_10G_port -The maximum number of tx queues to use for a 10Gb port. -The default value is 8. -.It Va hw.cxgbe.max_nrxq_10G_port -The maximum number of rx queues to use for a 10Gb port. -The default value is 8. -.It Va hw.cxgbe.max_ntxq_1G_port -The maximum number of tx queues to use for a 1Gb port. -The default value is 2. -.It Va hw.cxgbe.max_nrxq_1G_port -The maximum number of rx queues to use for a 1Gb port. -The default value is 2. +.It Va hw.cxgbe.ntxq10g +The number of tx queues to use for a 10Gb port. The default is 16 or the number +of CPU cores in the system, whichever is less. +.It Va hw.cxgbe.nrxq10g +The number of rx queues to use for a 10Gb port. The default is 8 or the number +of CPU cores in the system, whichever is less. +.It Va hw.cxgbe.ntxq1g +The number of tx queues to use for a 1Gb port. The default is 4 or the number +of CPU cores in the system, whichever is less. +.It Va hw.cxgbe.nrxq1g +The number of rx queues to use for a 1Gb port. The default is 2 or the number +of CPU cores in the system, whichever is less. +.It Va hw.cxgbe.nofldtxq10g +The number of TOE tx queues to use for a 10Gb port. The default is 8 or the +number of CPU cores in the system, whichever is less. +.It Va hw.cxgbe.nofldrxq10g +The number of TOE rx queues to use for a 10Gb port. The default is 2 or the +number of CPU cores in the system, whichever is less. +.It Va hw.cxgbe.nofldtxq1g +The number of TOE tx queues to use for a 1Gb port. The default is 2 or the +number of CPU cores in the system, whichever is less. +.It Va hw.cxgbe.nofldrxq1g +The number of TOE rx queues to use for a 1Gb port. The default is 1. .It Va hw.cxgbe.holdoff_timer_idx_10G .It Va hw.cxgbe.holdoff_timer_idx_1G The timer index value to use to delay interrupts. @@ -119,6 +130,8 @@ by default (all values are in microsecon value from this list. The default value is 1 for both 10Gb and 1Gb ports, which means the timer value is 5us. +Different cxgbe interfaces can be assigned different values at any time via the +dev.cxgbe.X.holdoff_tmr_idx sysctl. .It Va hw.cxgbe.holdoff_pktc_idx_10G .It Va hw.cxgbe.holdoff_pktc_idx_1G The packet-count index value to use to delay interrupts. @@ -127,6 +140,11 @@ and the index selects a value from this The default value is 2 for both 10Gb and 1Gb ports, which means 16 packets (or the holdoff timer going off) before an interrupt is generated. +-1 disables packet counting. +Different cxgbe interfaces can be assigned different values via the +dev.cxgbe.X.holdoff_pktc_idx sysctl. +This sysctl works only when the interface has never been marked up (as done by +ifconfig up). .It Va hw.cxgbe.qsize_txq The size, in number of entries, of the descriptor ring used for a tx queue. @@ -134,10 +152,46 @@ A buf_ring of the same size is also allo software queuing. See .Xr ifnet 9 . The default value is 1024. +Different cxgbe interfaces can be assigned different values via the +dev.cxgbe.X.qsize_txq sysctl. +This sysctl works only when the interface has never been marked up (as done by +ifconfig up). .It Va hw.cxgbe.qsize_rxq The size, in number of entries, of the descriptor ring used for an rx queue. The default value is 1024. +Different cxgbe interfaces can be assigned different values via the +dev.cxgbe.X.qsize_rxq sysctl. +This sysctl works only when the interface has never been marked up (as done by +ifconfig up). +.It Va hw.cxgbe.interrupt_types +The interrupt types that the driver is allowed to use. +Bit 0 represents INTx (line interrupts), bit 1 MSI, bit 2 MSI-X. +The default is 7 (all allowed). +The driver will select the best possible type out of the allowed types by +itself. +.It Va hw.cxgbe.config_file +Select a pre-packaged device configuration file. +A configuration file contains a recipe for partitioning and configuring the +hardware resources on the card. +This tunable is for specialized applications only and should not be used in +normal operation. +The configuration profile currently in use is available in the dev.t4nex.X.cf +and dev.t4nex.X.cfcsum sysctls. +.It Va hw.cxgbe.linkcaps_allowed +.It Va hw.cxgbe.niccaps_allowed +.It Va hw.cxgbe.toecaps_allowed +.It Va hw.cxgbe.rdmacaps_allowed +.It Va hw.cxgbe.iscsicaps_allowed +.It Va hw.cxgbe.fcoecaps_allowed +Disallowing capabilities provides a hint to the driver and firmware to not +reserve hardware resources for that feature. +Each of these is a bit field with a bit for each sub-capability within the +capability. +This tunable is for specialized applications only and should not be used in +normal operation. +The capabilities for which hardware resources have been reserved are listed in +dev.t4nex.X.*caps sysctls. .El .Sh SUPPORT For general information and support, Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Fri Dec 16 00:58:41 2011 (r228560) +++ head/sys/dev/cxgbe/adapter.h Fri Dec 16 02:09:51 2011 (r228561) @@ -31,6 +31,7 @@ #ifndef __T4_ADAPTER_H__ #define __T4_ADAPTER_H__ +#include #include #include #include @@ -46,8 +47,9 @@ #include #include "offload.h" -#include "common/t4fw_interface.h" +#include "firmware/t4fw_interface.h" +#define T4_CFGNAME "t4fw_cfg" #define T4_FWNAME "t4fw" MALLOC_DECLARE(M_CXGBE); @@ -110,25 +112,21 @@ enum { FW_IQ_QSIZE = 256, FW_IQ_ESIZE = 64, /* At least 64 mandated by the firmware spec */ - INTR_IQ_QSIZE = 64, - INTR_IQ_ESIZE = 64, /* Handles some CPLs too, do not reduce */ - - CTRL_EQ_QSIZE = 128, - CTRL_EQ_ESIZE = 64, - RX_IQ_QSIZE = 1024, RX_IQ_ESIZE = 64, /* At least 64 so CPL_RX_PKT will fit */ - RX_FL_ESIZE = 64, /* 8 64bit addresses */ + EQ_ESIZE = 64, /* All egress queues use this entry size */ + RX_FL_ESIZE = EQ_ESIZE, /* 8 64bit addresses */ #if MJUMPAGESIZE != MCLBYTES FL_BUF_SIZES = 4, /* cluster, jumbop, jumbo9k, jumbo16k */ #else FL_BUF_SIZES = 3, /* cluster, jumbo9k, jumbo16k */ #endif + CTRL_EQ_QSIZE = 128, + TX_EQ_QSIZE = 1024, - TX_EQ_ESIZE = 64, TX_SGL_SEGS = 36, TX_WR_FLITS = SGE_MAX_WR_LEN / 8 }; @@ -144,13 +142,16 @@ enum { /* adapter flags */ FULL_INIT_DONE = (1 << 0), FW_OK = (1 << 1), - INTR_SHARED = (1 << 2), /* one set of intrq's for all ports */ + INTR_DIRECT = (1 << 2), /* direct interrupts for everything */ + MASTER_PF = (1 << 3), + ADAP_SYSCTL_CTX = (1 << 4), CXGBE_BUSY = (1 << 9), /* port flags */ DOOMED = (1 << 0), - VI_ENABLED = (1 << 1), + PORT_INIT_DONE = (1 << 1), + PORT_SYSCTL_CTX = (1 << 2), }; #define IS_DOOMED(pi) (pi->flags & DOOMED) @@ -186,6 +187,12 @@ struct port_info { int first_txq; /* index of first tx queue */ int nrxq; /* # of rx queues */ int first_rxq; /* index of first rx queue */ +#ifndef TCP_OFFLOAD_DISABLE + int nofldtxq; /* # of offload tx queues */ + int first_ofld_txq; /* index of first offload tx queue */ + int nofldrxq; /* # of offload rx queues */ + int first_ofld_rxq; /* index of first offload rx queue */ +#endif int tmr_idx; int pktc_idx; int qsize_rxq; @@ -194,11 +201,8 @@ struct port_info { struct link_config link_cfg; struct port_stats stats; - struct taskqueue *tq; struct callout tick; - struct sysctl_ctx_list ctx; /* lives from ifconfig up to down */ - struct sysctl_oid *oid_rxq; - struct sysctl_oid *oid_txq; + struct sysctl_ctx_list ctx; /* from ifconfig up to driver detach */ uint8_t hw_addr[ETHER_ADDR_LEN]; /* factory MAC address, won't change */ }; @@ -222,17 +226,26 @@ struct tx_map { bus_dmamap_t map; }; +/* DMA maps used for tx */ +struct tx_maps { + struct tx_map *maps; + uint32_t map_total; /* # of DMA maps */ + uint32_t map_pidx; /* next map to be used */ + uint32_t map_cidx; /* reclaimed up to this index */ + uint32_t map_avail; /* # of available maps */ +}; + struct tx_sdesc { uint8_t desc_used; /* # of hardware descriptors used by the WR */ uint8_t credits; /* NIC txq: # of frames sent out in the WR */ }; -typedef void (iq_intr_handler_t)(void *); - enum { /* iq flags */ - IQ_ALLOCATED = (1 << 1), /* firmware resources allocated */ - IQ_STARTED = (1 << 2), /* started */ + IQ_ALLOCATED = (1 << 0), /* firmware resources allocated */ + IQ_HAS_FL = (1 << 1), /* iq associated with a freelist */ + IQ_INTR = (1 << 2), /* iq takes direct interrupt */ + IQ_LRO_ENABLED = (1 << 3), /* iq is an eth rxq with LRO enabled */ /* iq state */ IQS_DISABLED = 0, @@ -252,26 +265,35 @@ struct sge_iq { uint16_t abs_id; /* absolute SGE id for the iq */ int8_t intr_pktc_idx; /* packet count threshold index */ int8_t pad0; - iq_intr_handler_t *handler; __be64 *desc; /* KVA of descriptor ring */ - volatile uint32_t state; + volatile int state; struct adapter *adapter; const __be64 *cdesc; /* current descriptor */ uint8_t gen; /* generation bit */ uint8_t intr_params; /* interrupt holdoff parameters */ - uint8_t intr_next; /* holdoff for next interrupt */ + uint8_t intr_next; /* XXX: holdoff for next interrupt */ uint8_t esize; /* size (bytes) of each entry in the queue */ uint16_t qsize; /* size (# of entries) of the queue */ uint16_t cidx; /* consumer index */ - uint16_t cntxt_id; /* SGE context id for the iq */ + uint16_t cntxt_id; /* SGE context id for the iq */ + + STAILQ_ENTRY(sge_iq) link; }; enum { + EQ_CTRL = 1, + EQ_ETH = 2, +#ifndef TCP_OFFLOAD_DISABLE + EQ_OFLD = 3, +#endif + /* eq flags */ - EQ_ALLOCATED = (1 << 1), /* firmware resources allocated */ - EQ_STARTED = (1 << 2), /* started */ - EQ_CRFLUSHED = (1 << 3), /* expecting an update from SGE */ + EQ_TYPEMASK = 7, /* 3 lsbits hold the type */ + EQ_ALLOCATED = (1 << 3), /* firmware resources allocated */ + EQ_DOOMED = (1 << 4), /* about to be destroyed */ + EQ_CRFLUSHED = (1 << 5), /* expecting an update from SGE */ + EQ_STALLED = (1 << 6), /* out of hw descriptors or dmamaps */ }; /* @@ -281,10 +303,11 @@ enum { * consumes them) but it's special enough to have its own struct (see sge_fl). */ struct sge_eq { + unsigned int flags; /* MUST be first */ + unsigned int cntxt_id; /* SGE context id for the eq */ bus_dma_tag_t desc_tag; bus_dmamap_t desc_map; char lockname[16]; - unsigned int flags; struct mtx eq_lock; struct tx_desc *desc; /* KVA of descriptor ring */ @@ -297,9 +320,24 @@ struct sge_eq { uint16_t pidx; /* producer idx (desc idx) */ uint16_t pending; /* # of descriptors used since last doorbell */ uint16_t iqid; /* iq that gets egr_update for the eq */ - unsigned int cntxt_id; /* SGE context id for the eq */ + uint8_t tx_chan; /* tx channel used by the eq */ + struct task tx_task; + struct callout tx_callout; + + /* stats */ + + uint32_t egr_update; /* # of SGE_EGR_UPDATE notifications for eq */ + uint32_t unstalled; /* recovered from stall */ +}; + +enum { + FL_STARVING = (1 << 0), /* on the adapter's list of starving fl's */ + FL_DOOMED = (1 << 1), /* about to be destroyed */ }; +#define FL_RUNNING_LOW(fl) (fl->cap - fl->needed <= fl->lowat) +#define FL_NOT_RUNNING_LOW(fl) (fl->cap - fl->needed >= 2 * fl->lowat) + struct sge_fl { bus_dma_tag_t desc_tag; bus_dmamap_t desc_map; @@ -307,6 +345,7 @@ struct sge_fl { uint8_t tag_idx; struct mtx fl_lock; char lockname[16]; + int flags; __be64 *desc; /* KVA of descriptor ring, ptr to addresses */ bus_addr_t ba; /* bus address of descriptor ring */ @@ -317,8 +356,10 @@ struct sge_fl { uint32_t cidx; /* consumer idx (buffer idx, NOT hw desc idx) */ uint32_t pidx; /* producer idx (buffer idx, NOT hw desc idx) */ uint32_t needed; /* # of buffers needed to fill up fl. */ + uint32_t lowat; /* # of buffers <= this means fl needs help */ uint32_t pending; /* # of bufs allocated since last doorbell */ unsigned int dmamap_failed; + TAILQ_ENTRY(sge_fl) link; /* All starving freelists */ }; /* txq: SGE egress queue + what's needed for Ethernet NIC */ @@ -330,14 +371,8 @@ struct sge_txq { struct buf_ring *br; /* tx buffer ring */ struct tx_sdesc *sdesc; /* KVA of software descriptor ring */ struct mbuf *m; /* held up due to temporary resource shortage */ - struct task resume_tx; - /* DMA maps used for tx */ - struct tx_map *maps; - uint32_t map_total; /* # of DMA maps */ - uint32_t map_pidx; /* next map to be used */ - uint32_t map_cidx; /* reclaimed up to this index */ - uint32_t map_avail; /* # of available maps */ + struct tx_maps txmaps; /* stats for common events first */ @@ -354,20 +389,14 @@ struct sge_txq { uint32_t no_dmamap; /* no DMA map to load the mbuf */ uint32_t no_desc; /* out of hardware descriptors */ - uint32_t egr_update; /* # of SGE_EGR_UPDATE notifications for txq */ } __aligned(CACHE_LINE_SIZE); -enum { - RXQ_LRO_ENABLED = (1 << 0) -}; - /* rxq: SGE ingress queue + SGE free list + miscellaneous items */ struct sge_rxq { struct sge_iq iq; /* MUST be first */ - struct sge_fl fl; + struct sge_fl fl; /* MUST follow iq */ struct ifnet *ifp; /* the interface this rxq belongs to */ - unsigned int flags; #ifdef INET struct lro_ctrl lro; /* LRO state */ #endif @@ -381,12 +410,28 @@ struct sge_rxq { } __aligned(CACHE_LINE_SIZE); -/* ctrlq: SGE egress queue + stats for control queue */ -struct sge_ctrlq { +#ifndef TCP_OFFLOAD_DISABLE +/* ofld_rxq: SGE ingress queue + SGE free list + miscellaneous items */ +struct sge_ofld_rxq { + struct sge_iq iq; /* MUST be first */ + struct sge_fl fl; /* MUST follow iq */ +} __aligned(CACHE_LINE_SIZE); +#endif + +/* + * wrq: SGE egress queue that is given prebuilt work requests. Both the control + * and offload tx queues are of this type. + */ +struct sge_wrq { struct sge_eq eq; /* MUST be first */ + struct adapter *adapter; + struct mbuf *head; /* held up due to lack of descriptors */ + struct mbuf *tail; /* valid only if head is valid */ + /* stats for common events first */ + uint64_t tx_wrs; /* # of tx work requests */ /* stats for not-that-common events */ @@ -394,20 +439,28 @@ struct sge_ctrlq { } __aligned(CACHE_LINE_SIZE); struct sge { - uint16_t timer_val[SGE_NTIMERS]; - uint8_t counter_val[SGE_NCOUNTERS]; + int timer_val[SGE_NTIMERS]; + int counter_val[SGE_NCOUNTERS]; int fl_starve_threshold; - int nrxq; /* total rx queues (all ports and the rest) */ - int ntxq; /* total tx queues (all ports and the rest) */ - int niq; /* total ingress queues */ - int neq; /* total egress queues */ + int nrxq; /* total # of Ethernet rx queues */ + int ntxq; /* total # of Ethernet tx tx queues */ +#ifndef TCP_OFFLOAD_DISABLE + int nofldrxq; /* total # of TOE rx queues */ + int nofldtxq; /* total # of TOE tx queues */ +#endif + int niq; /* total # of ingress queues */ + int neq; /* total # of egress queues */ struct sge_iq fwq; /* Firmware event queue */ - struct sge_ctrlq *ctrlq;/* Control queues */ - struct sge_iq *intrq; /* Interrupt queues */ + struct sge_wrq mgmtq; /* Management queue (control queue) */ + struct sge_wrq *ctrlq; /* Control queues */ struct sge_txq *txq; /* NIC tx queues */ struct sge_rxq *rxq; /* NIC rx queues */ +#ifndef TCP_OFFLOAD_DISABLE + struct sge_wrq *ofld_txq; /* TOE tx queues */ + struct sge_ofld_rxq *ofld_rxq; /* TOE rx queues */ +#endif uint16_t iq_start; int eq_start; @@ -415,7 +468,12 @@ struct sge { struct sge_eq **eqmap; /* eq->cntxt_id to eq mapping */ }; +struct rss_header; +typedef int (*cpl_handler_t)(struct sge_iq *, const struct rss_header *, + struct mbuf *); + struct adapter { + SLIST_ENTRY(adapter) link; device_t dev; struct cdev *cdev; @@ -444,27 +502,47 @@ struct adapter { struct sge sge; + struct taskqueue *tq[NCHAN]; /* taskqueues that flush data out */ struct port_info *port[MAX_NPORTS]; uint8_t chan_map[NCHAN]; + uint32_t filter_mode; +#ifndef TCP_OFFLOAD_DISABLE + struct uld_softc tom; + struct tom_tunables tt; +#endif struct l2t_data *l2t; /* L2 table */ struct tid_info tids; - int registered_device_map; int open_device_map; +#ifndef TCP_OFFLOAD_DISABLE + int offload_map; +#endif int flags; char fw_version[32]; + unsigned int cfcsum; struct adapter_params params; struct t4_virt_res vres; - struct sysctl_ctx_list ctx; /* from first_port_up to last_port_down */ - struct sysctl_oid *oid_fwq; - struct sysctl_oid *oid_ctrlq; - struct sysctl_oid *oid_intrq; + uint16_t linkcaps; + uint16_t niccaps; + uint16_t toecaps; + uint16_t rdmacaps; + uint16_t iscsicaps; + uint16_t fcoecaps; + + struct sysctl_ctx_list ctx; /* from adapter_full_init to full_uninit */ struct mtx sc_lock; char lockname[16]; + + /* Starving free lists */ + struct mtx sfl_lock; /* same cache-line as sc_lock? but that's ok */ + TAILQ_HEAD(, sge_fl) sfl; + struct callout sfl_callout; + + cpl_handler_t cpl_handler[256] __aligned(CACHE_LINE_SIZE); }; #define ADAPTER_LOCK(sc) mtx_lock(&(sc)->sc_lock) @@ -506,11 +584,15 @@ struct adapter { #define for_each_rxq(pi, iter, rxq) \ rxq = &pi->adapter->sge.rxq[pi->first_rxq]; \ for (iter = 0; iter < pi->nrxq; ++iter, ++rxq) +#define for_each_ofld_txq(pi, iter, ofld_txq) \ + ofld_txq = &pi->adapter->sge.ofld_txq[pi->first_ofld_txq]; \ + for (iter = 0; iter < pi->nofldtxq; ++iter, ++ofld_txq) +#define for_each_ofld_rxq(pi, iter, ofld_rxq) \ + ofld_rxq = &pi->adapter->sge.ofld_rxq[pi->first_ofld_rxq]; \ + for (iter = 0; iter < pi->nofldrxq; ++iter, ++ofld_rxq) /* One for errors, one for firmware events */ #define T4_EXTRA_INTR 2 -#define NINTRQ(sc) ((sc)->intr_count > T4_EXTRA_INTR ? \ - (sc)->intr_count - T4_EXTRA_INTR : 1) static inline uint32_t t4_read_reg(struct adapter *sc, uint32_t reg) @@ -589,29 +671,52 @@ static inline bool is_10G_port(const str return ((pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G) != 0); } +static inline int tx_resume_threshold(struct sge_eq *eq) +{ + return (eq->qsize / 4); +} + /* t4_main.c */ -void cxgbe_txq_start(void *, int); +void t4_tx_task(void *, int); +void t4_tx_callout(void *); int t4_os_find_pci_capability(struct adapter *, int); int t4_os_pci_save_state(struct adapter *); int t4_os_pci_restore_state(struct adapter *); void t4_os_portmod_changed(const struct adapter *, int); void t4_os_link_changed(struct adapter *, int, int); +void t4_iterate(void (*)(struct adapter *, void *), void *); +int t4_register_cpl_handler(struct adapter *, int, cpl_handler_t); /* t4_sge.c */ void t4_sge_modload(void); -void t4_sge_init(struct adapter *); +int t4_sge_init(struct adapter *); int t4_create_dma_tag(struct adapter *); int t4_destroy_dma_tag(struct adapter *); int t4_setup_adapter_queues(struct adapter *); int t4_teardown_adapter_queues(struct adapter *); -int t4_setup_eth_queues(struct port_info *); -int t4_teardown_eth_queues(struct port_info *); +int t4_setup_port_queues(struct port_info *); +int t4_teardown_port_queues(struct port_info *); +int t4_alloc_tx_maps(struct tx_maps *, bus_dma_tag_t, int, int); +void t4_free_tx_maps(struct tx_maps *, bus_dma_tag_t); void t4_intr_all(void *); void t4_intr(void *); void t4_intr_err(void *); void t4_intr_evt(void *); int t4_mgmt_tx(struct adapter *, struct mbuf *); +int t4_wrq_tx_locked(struct adapter *, struct sge_wrq *, struct mbuf *); int t4_eth_tx(struct ifnet *, struct sge_txq *, struct mbuf *); void t4_update_fl_bufsize(struct ifnet *); +int can_resume_tx(struct sge_eq *); + +static inline int t4_wrq_tx(struct adapter *sc, struct sge_wrq *wrq, struct mbuf *m) +{ + int rc; + + TXQ_LOCK(wrq); + rc = t4_wrq_tx_locked(sc, wrq, m); + TXQ_UNLOCK(wrq); + return (rc); +} + #endif Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Fri Dec 16 00:58:41 2011 (r228560) +++ head/sys/dev/cxgbe/common/common.h Fri Dec 16 02:09:51 2011 (r228561) @@ -42,6 +42,15 @@ enum { enum { MEM_EDC0, MEM_EDC1, MEM_MC }; +enum { + MEMWIN0_APERTURE = 2048, + MEMWIN0_BASE = 0x1b800, + MEMWIN1_APERTURE = 32768, + MEMWIN1_BASE = 0x28000, + MEMWIN2_APERTURE = 65536, + MEMWIN2_BASE = 0x30000, +}; + enum dev_master { MASTER_CANT, MASTER_MAY, MASTER_MUST }; enum dev_state { DEV_STATE_UNINIT, DEV_STATE_INIT, DEV_STATE_ERR }; @@ -53,8 +62,8 @@ enum { }; #define FW_VERSION_MAJOR 1 -#define FW_VERSION_MINOR 3 -#define FW_VERSION_MICRO 10 +#define FW_VERSION_MINOR 4 +#define FW_VERSION_MICRO 16 struct port_stats { u64 tx_octets; /* total # of octets in good frames */ @@ -190,7 +199,6 @@ struct tp_proxy_stats { struct tp_cpl_stats { u32 req[4]; u32 rsp[4]; - u32 tx_err[4]; }; struct tp_rdma_stats { @@ -214,9 +222,9 @@ struct vpd_params { }; struct pci_params { - unsigned int vpd_cap_addr; - unsigned char speed; - unsigned char width; + unsigned int vpd_cap_addr; + unsigned short speed; + unsigned short width; }; /* @@ -239,20 +247,20 @@ struct adapter_params { unsigned int fw_vers; unsigned int tp_vers; - u8 api_vers[7]; unsigned short mtus[NMTUS]; unsigned short a_wnd[NCCTRL_WIN]; unsigned short b_wnd[NCCTRL_WIN]; - unsigned int mc_size; /* MC memory size */ - unsigned int nfilters; /* size of filter region */ + unsigned int mc_size; /* MC memory size */ + unsigned int nfilters; /* size of filter region */ unsigned int cim_la_size; - unsigned int nports; /* # of ethernet ports */ + /* Used as int in sysctls, do not reduce size */ + unsigned int nports; /* # of ethernet ports */ unsigned int portvec; - unsigned int rev; /* chip revision */ + unsigned int rev; /* chip revision */ unsigned int offload; unsigned int ofldq_wr_cred; @@ -366,6 +374,9 @@ int t4_seeprom_wp(struct adapter *adapte int t4_read_flash(struct adapter *adapter, unsigned int addr, unsigned int nwords, u32 *data, int byte_oriented); int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); +int t4_load_boot(struct adapter *adap, const u8 *boot_data, + unsigned int boot_addr, unsigned int size); +unsigned int t4_flash_cfg_addr(struct adapter *adapter); int t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size); int t4_get_fw_version(struct adapter *adapter, u32 *vers); int t4_get_tp_version(struct adapter *adapter, u32 *vers); @@ -460,8 +471,8 @@ int t4_wol_pat_enable(struct adapter *ad int t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox, enum dev_master master, enum dev_state *state); int t4_fw_bye(struct adapter *adap, unsigned int mbox); -int t4_early_init(struct adapter *adap, unsigned int mbox); int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset); +int t4_fw_initialize(struct adapter *adap, unsigned int mbox); int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int nparams, const u32 *params, u32 *val); Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Fri Dec 16 00:58:41 2011 (r228560) +++ head/sys/dev/cxgbe/common/t4_hw.c Fri Dec 16 02:09:51 2011 (r228561) @@ -30,10 +30,10 @@ __FBSDID("$FreeBSD$"); #include "common.h" #include "t4_regs.h" #include "t4_regs_values.h" -#include "t4fw_interface.h" +#include "firmware/t4fw_interface.h" #undef msleep -#define msleep(x) DELAY((x) * 1000) +#define msleep(x) pause("t4hw", (x) * hz / 1000) /** * t4_wait_op_done_val - wait until an operation is completed @@ -187,7 +187,7 @@ int t4_wr_mbox_meat(struct adapter *adap * off to larger delays to a maximum retry delay. */ static const int delay[] = { - 1, 1, 3, 5, 10, 10, 20, 50, 100, 200 + 1, 1, 3, 5, 10, 10, 20, 50, 100 }; u32 v; @@ -625,17 +625,6 @@ enum { SF_RD_DATA_FAST = 0xb, /* read flash */ SF_RD_ID = 0x9f, /* read ID */ SF_ERASE_SECTOR = 0xd8, /* erase sector */ - - FW_START_SEC = 8, /* first flash sector for FW */ - FW_END_SEC = 15, /* last flash sector for FW */ - FW_IMG_START = FW_START_SEC * SF_SEC_SIZE, - FW_MAX_SIZE = (FW_END_SEC - FW_START_SEC + 1) * SF_SEC_SIZE, - - FLASH_CFG_MAX_SIZE = 0x10000 , /* max size of the flash config file */ - FLASH_CFG_OFFSET = 0x1f0000, - FLASH_CFG_START_SEC = FLASH_CFG_OFFSET / SF_SEC_SIZE, - FPGA_FLASH_CFG_OFFSET = 0xf0000 , /* if FPGA mode, then cfg file is at 1MB - 64KB */ - FPGA_FLASH_CFG_START_SEC = FPGA_FLASH_CFG_OFFSET / SF_SEC_SIZE, }; /** @@ -763,12 +752,15 @@ int t4_read_flash(struct adapter *adapte * @addr: the start address to write * @n: length of data to write in bytes * @data: the data to write + * @byte_oriented: whether to store data as bytes or as words * * Writes up to a page of data (256 bytes) to the serial flash starting * at the given address. All the data must be written to the same page. + * If @byte_oriented is set the write data is stored as byte stream + * (i.e. matches what on disk), otherwise in big-endian. */ static int t4_write_flash(struct adapter *adapter, unsigned int addr, - unsigned int n, const u8 *data) + unsigned int n, const u8 *data, int byte_oriented) { int ret; u32 buf[SF_PAGE_SIZE / 4]; @@ -788,6 +780,9 @@ static int t4_write_flash(struct adapter for (val = 0, i = 0; i < c; ++i) val = (val << 8) + *data++; + if (!byte_oriented) + val = htonl(val); + ret = sf1_write(adapter, c, c != left, 1, val); if (ret) goto unlock; @@ -799,7 +794,8 @@ static int t4_write_flash(struct adapter t4_write_reg(adapter, A_SF_OP, 0); /* unlock SF */ /* Read the page to verify the write succeeded */ - ret = t4_read_flash(adapter, addr & ~0xff, ARRAY_SIZE(buf), buf, 1); + ret = t4_read_flash(adapter, addr & ~0xff, ARRAY_SIZE(buf), buf, + byte_oriented); if (ret) return ret; @@ -825,7 +821,7 @@ unlock: int t4_get_fw_version(struct adapter *adapter, u32 *vers) { return t4_read_flash(adapter, - FW_IMG_START + offsetof(struct fw_hdr, fw_ver), 1, + FLASH_FW_START + offsetof(struct fw_hdr, fw_ver), 1, vers, 0); } @@ -838,7 +834,7 @@ int t4_get_fw_version(struct adapter *ad */ int t4_get_tp_version(struct adapter *adapter, u32 *vers) { - return t4_read_flash(adapter, FW_IMG_START + offsetof(struct fw_hdr, + return t4_read_flash(adapter, FLASH_FW_START + offsetof(struct fw_hdr, tp_microcode_ver), 1, vers, 0); } @@ -854,24 +850,17 @@ int t4_get_tp_version(struct adapter *ad */ int t4_check_fw_version(struct adapter *adapter) { - u32 api_vers[2]; int ret, major, minor, micro; ret = t4_get_fw_version(adapter, &adapter->params.fw_vers); if (!ret) ret = t4_get_tp_version(adapter, &adapter->params.tp_vers); - if (!ret) - ret = t4_read_flash(adapter, - FW_IMG_START + offsetof(struct fw_hdr, intfver_nic), - 2, api_vers, 1); if (ret) return ret; major = G_FW_HDR_FW_VER_MAJOR(adapter->params.fw_vers); minor = G_FW_HDR_FW_VER_MINOR(adapter->params.fw_vers); micro = G_FW_HDR_FW_VER_MICRO(adapter->params.fw_vers); - memcpy(adapter->params.api_vers, api_vers, - sizeof(adapter->params.api_vers)); if (major != FW_VERSION_MAJOR) { /* major mismatch - fail */ CH_ERR(adapter, "card FW has major version %u, driver wants " @@ -914,6 +903,21 @@ static int t4_flash_erase_sectors(struct } /** + * t4_flash_cfg_addr - return the address of the flash configuration file + * @adapter: the adapter + * + * Return the address within the flash where the Firmware Configuration + * File is stored. + */ +unsigned int t4_flash_cfg_addr(struct adapter *adapter) +{ + if (adapter->params.sf_size == 0x100000) + return FLASH_FPGA_CFG_START; + else + return FLASH_CFG_START; +} + +/** * t4_load_cfg - download config file * @adap: the adapter * @cfg_data: the cfg text file to write @@ -928,17 +932,8 @@ int t4_load_cfg(struct adapter *adap, co unsigned int flash_cfg_start_sec; unsigned int sf_sec_size = adap->params.sf_size / adap->params.sf_nsec; - if (adap->params.sf_size == 0x100000) { - addr = FPGA_FLASH_CFG_OFFSET; - flash_cfg_start_sec = FPGA_FLASH_CFG_START_SEC; - } else { - addr = FLASH_CFG_OFFSET; - flash_cfg_start_sec = FLASH_CFG_START_SEC; - } - if (!size) { - CH_ERR(adap, "cfg file has no data\n"); - return -EINVAL; - } + addr = t4_flash_cfg_addr(adap); + flash_cfg_start_sec = addr / SF_SEC_SIZE; if (size > FLASH_CFG_MAX_SIZE) { CH_ERR(adap, "cfg file too large, max is %u bytes\n", @@ -950,7 +945,11 @@ int t4_load_cfg(struct adapter *adap, co sf_sec_size); ret = t4_flash_erase_sectors(adap, flash_cfg_start_sec, flash_cfg_start_sec + i - 1); - if (ret) + /* + * If size == 0 then we're simply erasing the FLASH sectors associated + * with the on-adapter Firmware Configuration File. + */ + if (ret || size == 0) goto out; /* this will write to the flash up to SF_PAGE_SIZE at a time */ @@ -959,7 +958,7 @@ int t4_load_cfg(struct adapter *adap, co n = size - i; else n = SF_PAGE_SIZE; - ret = t4_write_flash(adap, addr, n, cfg_data); + ret = t4_write_flash(adap, addr, n, cfg_data, 1); if (ret) goto out; @@ -969,7 +968,8 @@ int t4_load_cfg(struct adapter *adap, co out: if (ret) - CH_ERR(adap, "config file download failed %d\n", ret); + CH_ERR(adap, "config file %s failed %d\n", + (size == 0 ? "clear" : "download"), ret); return ret; } @@ -1004,9 +1004,9 @@ int t4_load_fw(struct adapter *adap, con CH_ERR(adap, "FW image size differs from size in FW header\n"); return -EINVAL; } - if (size > FW_MAX_SIZE) { + if (size > FLASH_FW_MAX_SIZE) { CH_ERR(adap, "FW image too large, max is %u bytes\n", - FW_MAX_SIZE); + FLASH_FW_MAX_SIZE); return -EFBIG; } @@ -1020,7 +1020,8 @@ int t4_load_fw(struct adapter *adap, con } i = DIV_ROUND_UP(size, sf_sec_size); /* # of sectors spanned */ - ret = t4_flash_erase_sectors(adap, FW_START_SEC, FW_START_SEC + i - 1); + ret = t4_flash_erase_sectors(adap, FLASH_FW_START_SEC, + FLASH_FW_START_SEC + i - 1); if (ret) goto out; @@ -1031,28 +1032,110 @@ int t4_load_fw(struct adapter *adap, con */ memcpy(first_page, fw_data, SF_PAGE_SIZE); ((struct fw_hdr *)first_page)->fw_ver = htonl(0xffffffff); - ret = t4_write_flash(adap, FW_IMG_START, SF_PAGE_SIZE, first_page); + ret = t4_write_flash(adap, FLASH_FW_START, SF_PAGE_SIZE, first_page, 1); if (ret) goto out; - addr = FW_IMG_START; + addr = FLASH_FW_START; for (size -= SF_PAGE_SIZE; size; size -= SF_PAGE_SIZE) { addr += SF_PAGE_SIZE; fw_data += SF_PAGE_SIZE; - ret = t4_write_flash(adap, addr, SF_PAGE_SIZE, fw_data); + ret = t4_write_flash(adap, addr, SF_PAGE_SIZE, fw_data, 1); if (ret) goto out; } ret = t4_write_flash(adap, - FW_IMG_START + offsetof(struct fw_hdr, fw_ver), - sizeof(hdr->fw_ver), (const u8 *)&hdr->fw_ver); + FLASH_FW_START + offsetof(struct fw_hdr, fw_ver), + sizeof(hdr->fw_ver), (const u8 *)&hdr->fw_ver, 1); out: if (ret) CH_ERR(adap, "firmware download failed, error %d\n", ret); return ret; } +/* BIOS boot header */ +typedef struct boot_header_s { + u8 signature[2]; /* signature */ + u8 length; /* image length (include header) */ + u8 offset[4]; /* initialization vector */ + u8 reserved[19]; /* reserved */ + u8 exheader[2]; /* offset to expansion header */ +} boot_header_t; + +enum { + BOOT_FLASH_BOOT_ADDR = 0x0,/* start address of boot image in flash */ + BOOT_SIGNATURE = 0xaa55, /* signature of BIOS boot ROM */ + BOOT_SIZE_INC = 512, /* image size measured in 512B chunks */ + BOOT_MIN_SIZE = sizeof(boot_header_t), /* at least basic header */ + BOOT_MAX_SIZE = 1024*BOOT_SIZE_INC /* 1 byte * length increment */ +}; + +/* + * t4_load_boot - download boot flash + * @adapter: the adapter + * @boot_data: the boot image to write + * @size: image size + * + * Write the supplied boot image to the card's serial flash. + * The boot image has the following sections: a 28-byte header and the + * boot image. + */ +int t4_load_boot(struct adapter *adap, const u8 *boot_data, + unsigned int boot_addr, unsigned int size) +{ + int ret, addr; + unsigned int i; + unsigned int boot_sector = boot_addr * 1024; + unsigned int sf_sec_size = adap->params.sf_size / adap->params.sf_nsec; + + /* + * Perform some primitive sanity testing to avoid accidentally + * writing garbage over the boot sectors. We ought to check for + * more but it's not worth it for now ... + */ + if (size < BOOT_MIN_SIZE || size > BOOT_MAX_SIZE) { + CH_ERR(adap, "boot image too small/large\n"); + return -EFBIG; + } + + /* + * Make sure the boot image does not encroach on the firmware region + */ + if ((boot_sector + size) >> 16 > FLASH_FW_START_SEC) { + CH_ERR(adap, "boot image encroaching on firmware region\n"); + return -EFBIG; + } + + i = DIV_ROUND_UP(size, sf_sec_size); /* # of sectors spanned */ + ret = t4_flash_erase_sectors(adap, boot_sector >> 16, + (boot_sector >> 16) + i - 1); + if (ret) + goto out; + + /* + * Skip over the first SF_PAGE_SIZE worth of data and write it after + * we finish copying the rest of the boot image. This will ensure + * that the BIOS boot header will only be written if the boot image + * was written in full. + */ + addr = boot_sector; + for (size -= SF_PAGE_SIZE; size; size -= SF_PAGE_SIZE) { + addr += SF_PAGE_SIZE; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 02:58:55 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 278DE106566B; Fri, 16 Dec 2011 02:58:55 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from mail27.syd.optusnet.com.au (mail27.syd.optusnet.com.au [211.29.133.168]) by mx1.freebsd.org (Postfix) with ESMTP id A7CD68FC19; Fri, 16 Dec 2011 02:58:54 +0000 (UTC) Received: from server.vk2pj.dyndns.org (c220-239-116-103.belrs4.nsw.optusnet.com.au [220.239.116.103]) by mail27.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pBG2wqEu004278 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 16 Dec 2011 13:58:53 +1100 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.5/8.14.4) with ESMTP id pBG2wpqL079599; Fri, 16 Dec 2011 13:58:51 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.5/8.14.4/Submit) id pBG2wpE2079598; Fri, 16 Dec 2011 13:58:51 +1100 (EST) (envelope-from peter) Date: Fri, 16 Dec 2011 13:58:51 +1100 From: Peter Jeremy To: "Bjoern A. Zeeb" Message-ID: <20111216025851.GA79528@server.vk2pj.dyndns.org> References: <201106281157.p5SBvP5g048097@svn.freebsd.org> <20111214014637.GA30470@server.vk2pj.dyndns.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SLDf9lqlvOQaIe6s" Content-Disposition: inline In-Reply-To: <20111214014637.GA30470@server.vk2pj.dyndns.org> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r223637 - in head: . contrib/pf/authpf contrib/pf/ftp-proxy contrib/pf/man contrib/pf/pfctl contrib/pf/pflogd sbin/pflogd sys/conf sys/contrib/altq/altq sys/contrib/pf/net sys/modules s... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 02:58:55 -0000 --SLDf9lqlvOQaIe6s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2011-Jun-28 11:57:25 +0000, "Bjoern A. Zeeb" wrote: >Author: bz >Date: Tue Jun 28 11:57:25 2011 >New Revision: 223637 >URL: http://svn.freebsd.org/changeset/base/223637 > >Log: > Update packet filter (pf) code to OpenBSD 4.5. Further to my mail last Wednesday, I've found nested "#ifdef __FreeBSD__" conditionals in pf_ioctl.c as well - it looks like conditional code was added to support network stack virtualisation without noting that the code was already protectd by a "#ifdef __FreeBSD__". And cross-checking the $OpenBSD$ tags in the FreeBSD repo against the OpenBSD CVSweb throws up consistent off-by-one errors - as an example, src/sys/contrib/pf/net/if_pfsync.h in FreeBSD 9.0 states "$OpenBSD: if_pfsync.h,v 1.35 2008/06/29 08:42:15 mcbride Exp $" but the actual content matches if_pfsync.h v1.36 in OpenBSD CVSweb. Is it possible that the pf code was checked out of an OpenBSD repo without the correct $OpenBSD$ tag expansion? This caused me a degree of confusion whilst trying to correlate the FreeBSD code with the OpenBSD code to try and update bin/124825 --=20 Peter Jeremy --SLDf9lqlvOQaIe6s Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7qs+sACgkQ/opHv/APuIcIQACgsjqOcBa+XsH9CgLqudwxWHA1 GRsAnjZPG1qnyrZ/2KXnPQykcAU7y2J4 =RFxA -----END PGP SIGNATURE----- --SLDf9lqlvOQaIe6s-- From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 06:37:28 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDAA8106564A; Fri, 16 Dec 2011 06:37:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 3D0638FC16; Fri, 16 Dec 2011 06:37:28 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id pBG6bNd6031913; Fri, 16 Dec 2011 10:37:23 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id pBG6bNnm031912; Fri, 16 Dec 2011 10:37:23 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 16 Dec 2011 10:37:23 +0400 From: Gleb Smirnoff To: Peter Jeremy Message-ID: <20111216063723.GD67033@FreeBSD.org> References: <201106281157.p5SBvP5g048097@svn.freebsd.org> <20111214014637.GA30470@server.vk2pj.dyndns.org> <20111216025851.GA79528@server.vk2pj.dyndns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20111216025851.GA79528@server.vk2pj.dyndns.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, "Bjoern A. Zeeb" , src-committers@FreeBSD.org Subject: Re: svn commit: r223637 - in head: . contrib/pf/authpf contrib/pf/ftp-proxy contrib/pf/man contrib/pf/pfctl contrib/pf/pflogd sbin/pflogd sys/conf sys/contrib/altq/altq sys/contrib/pf/net sys/modules s... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 06:37:28 -0000 Peter, On Fri, Dec 16, 2011 at 01:58:51PM +1100, Peter Jeremy wrote: P> On 2011-Jun-28 11:57:25 +0000, "Bjoern A. Zeeb" wrote: P> >Author: bz P> >Date: Tue Jun 28 11:57:25 2011 P> >New Revision: 223637 P> >URL: http://svn.freebsd.org/changeset/base/223637 P> > P> >Log: P> > Update packet filter (pf) code to OpenBSD 4.5. P> P> Further to my mail last Wednesday, I've found nested "#ifdef __FreeBSD__" P> conditionals in pf_ioctl.c as well - it looks like conditional code was P> added to support network stack virtualisation without noting that the P> code was already protectd by a "#ifdef __FreeBSD__". P> P> And cross-checking the $OpenBSD$ tags in the FreeBSD repo against the P> OpenBSD CVSweb throws up consistent off-by-one errors - as an example, P> src/sys/contrib/pf/net/if_pfsync.h in FreeBSD 9.0 states P> "$OpenBSD: if_pfsync.h,v 1.35 2008/06/29 08:42:15 mcbride Exp $" P> but the actual content matches if_pfsync.h v1.36 in OpenBSD CVSweb. P> Is it possible that the pf code was checked out of an OpenBSD repo P> without the correct $OpenBSD$ tag expansion? P> P> This caused me a degree of confusion whilst trying to correlate the P> FreeBSD code with the OpenBSD code to try and update bin/124825 Particular changes were picked from OpenBSD after the r223637, to make pfsync(4) function properly. For example: http://svnweb.freebsd.org/base?view=revision&revision=226663 -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 08:22:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6897A106564A; Fri, 16 Dec 2011 08:22:24 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 574248FC13; Fri, 16 Dec 2011 08:22:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBG8MOWO092849; Fri, 16 Dec 2011 08:22:24 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBG8MODA092847; Fri, 16 Dec 2011 08:22:24 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112160822.pBG8MODA092847@svn.freebsd.org> From: Ed Schouten Date: Fri, 16 Dec 2011 08:22:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228562 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 08:22:24 -0000 Author: ed Date: Fri Dec 16 08:22:23 2011 New Revision: 228562 URL: http://svn.freebsd.org/changeset/base/228562 Log: Process a lot of feedback from bde@ on : - Add __alignof() for non-GCC and GCC < 2.95. - Simply implement the C1X keywords on top of the existing __macros. - Add struct __hack to _Static_assert to require consumers to add a semicolon. - Add an extra underscore to __assert_ to allow it to be combined with locally defined versions of CTASSERT in the tree. - Add proper casts to __offsetof() to make it work for cases where sizeof(size_t) != sizeof(uintptr_t). - Globally replace size_t and uintptr_t by __size_t and __uintptr_t. This removes the dependency on / . Practically any header file ends up including somehow. - Change argument names of macros to match with the rest of the file. MFC after: 3 months Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Fri Dec 16 02:09:51 2011 (r228561) +++ head/sys/sys/cdefs.h Fri Dec 16 08:22:23 2011 (r228562) @@ -218,6 +218,10 @@ #endif #endif +#if !__GNUC_PREREQ__(2, 95) +#define __alignof(x) __offsetof(struct { char __a; x __b; }, __b) +#endif + /* * Keywords added in C1X. */ @@ -230,24 +234,17 @@ #elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L /* Do nothing. They are language keywords. */ #else -/* Not supported. Implement them manually. */ -#ifdef __GNUC__ -#define _Alignas(e) __attribute__((__aligned__(e))) -#define _Alignof(e) __alignof__(e) -#define _Noreturn __attribute__((__noreturn__)) +/* Not supported. Implement them using our versions. */ +#define _Alignas(x) __aligned(x) +#define _Alignof(x) __alignof(x) +#define _Noreturn __dead2 #define _Thread_local __thread -#else -#define _Alignas(e) -#define _Alignof(e) __offsetof(struct { char __a; e __b; }, __b) -#define _Noreturn -#define _Thread_local -#endif #ifdef __COUNTER__ -#define _Static_assert(e, s) __Static_assert(e, __COUNTER__) -#define __Static_assert(e, c) ___Static_assert(e, c) -#define ___Static_assert(e, c) typedef char __assert ## c[(e) ? 1 : -1] +#define _Static_assert(x, y) __Static_assert(x, __COUNTER__) +#define __Static_assert(x, y) ___Static_assert(x, y) +#define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] #else -#define _Static_assert(e, s) +#define _Static_assert(x, y) struct __hack #endif #endif @@ -363,10 +360,11 @@ #define __offsetof(type, field) __builtin_offsetof(type, field) #else #ifndef __cplusplus -#define __offsetof(type, field) ((size_t)(&((type *)0)->field)) +#define __offsetof(type, field) \ + ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->member)) #else #define __offsetof(type, field) \ - (__offsetof__ (reinterpret_cast \ + (__offsetof__ (reinterpret_cast <__size_t> \ (&reinterpret_cast \ (static_cast (0)->field)))) #endif @@ -495,15 +493,15 @@ #endif #ifndef __DECONST -#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) +#define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var)) #endif #ifndef __DEVOLATILE -#define __DEVOLATILE(type, var) ((type)(uintptr_t)(volatile void *)(var)) +#define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var)) #endif #ifndef __DEQUALIFY -#define __DEQUALIFY(type, var) ((type)(uintptr_t)(const volatile void *)(var)) +#define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var)) #endif /*- From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 08:27:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62C8B106564A; Fri, 16 Dec 2011 08:27:05 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 51CC88FC0A; Fri, 16 Dec 2011 08:27:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBG8R5LU093170; Fri, 16 Dec 2011 08:27:05 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBG8R5VS093168; Fri, 16 Dec 2011 08:27:05 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112160827.pBG8R5VS093168@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 16 Dec 2011 08:27:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228563 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 08:27:05 -0000 Author: glebius Date: Fri Dec 16 08:27:04 2011 New Revision: 228563 URL: http://svn.freebsd.org/changeset/base/228563 Log: Fix my braino in description of RADIX_MPATH. Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Fri Dec 16 08:22:23 2011 (r228562) +++ head/sys/conf/NOTES Fri Dec 16 08:27:04 2011 (r228563) @@ -916,7 +916,7 @@ device lagg # for sockets with the SO_DEBUG option set, which can then be examined # using the trpt(8) utility. # -# RADIX_MPATH provides support for multiple forwarding tables. +# RADIX_MPATH provides support for equal-cost multi-path routing. # options MROUTING # Multicast routing options IPFIREWALL #firewall From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 09:13:35 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C052106566B; Fri, 16 Dec 2011 09:13:35 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id CE3508FC13; Fri, 16 Dec 2011 09:13:34 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 6509B25D37D1; Fri, 16 Dec 2011 09:13:33 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 623D5BD71C7; Fri, 16 Dec 2011 09:13:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id EMm0v+uRE6Sx; Fri, 16 Dec 2011 09:13:31 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 587D9BD71C6; Fri, 16 Dec 2011 09:13:31 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <20111216025851.GA79528@server.vk2pj.dyndns.org> Date: Fri, 16 Dec 2011 09:13:30 +0000 Content-Transfer-Encoding: 7bit Message-Id: References: <201106281157.p5SBvP5g048097@svn.freebsd.org> <20111214014637.GA30470@server.vk2pj.dyndns.org> <20111216025851.GA79528@server.vk2pj.dyndns.org> To: Peter Jeremy X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r223637 - in head: . contrib/pf/authpf contrib/pf/ftp-proxy contrib/pf/man contrib/pf/pfctl contrib/pf/pflogd sbin/pflogd sys/conf sys/contrib/altq/altq sys/contrib/pf/net sys/modules s... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 09:13:35 -0000 On 16. Dec 2011, at 02:58 , Peter Jeremy wrote: > On 2011-Jun-28 11:57:25 +0000, "Bjoern A. Zeeb" wrote: >> Author: bz >> Date: Tue Jun 28 11:57:25 2011 >> New Revision: 223637 >> URL: http://svn.freebsd.org/changeset/base/223637 >> >> Log: >> Update packet filter (pf) code to OpenBSD 4.5. > > Further to my mail last Wednesday, I've found nested "#ifdef __FreeBSD__" > conditionals in pf_ioctl.c as well - it looks like conditional code was > added to support network stack virtualisation without noting that the > code was already protectd by a "#ifdef __FreeBSD__". I have run unifdef on the code before but didn't want to do a sweeping commit before 9.0 was handled. The virtualization #ifdefs should go anyway from the middle of the code and be done with the #define so that Open could easily pick it up if we'd be at the same level. Expect that this will be dealt with eventually. -- Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 09:33:32 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 774BB106564A; Fri, 16 Dec 2011 09:33:32 +0000 (UTC) (envelope-from tijl@coosemans.org) Received: from mailrelay007.isp.belgacom.be (mailrelay007.isp.belgacom.be [195.238.6.173]) by mx1.freebsd.org (Postfix) with ESMTP id 698D08FC15; Fri, 16 Dec 2011 09:33:30 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EAMML605bsSQU/2dsb2JhbABDhQymR4EGgXIBAQUjBC8jEAsUBCoCAjkeBogPBqcWkWGDeYZ1gRYEpyI Received: from 20.36-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.36.20]) by relay.skynet.be with ESMTP; 16 Dec 2011 10:23:23 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id pBG9NMAO002625; Fri, 16 Dec 2011 10:23:22 +0100 (CET) (envelope-from tijl@coosemans.org) From: Tijl Coosemans To: Ed Schouten Date: Fri, 16 Dec 2011 10:23:13 +0100 User-Agent: KMail/1.13.7 (FreeBSD/9.0-RC2; KDE/4.7.3; i386; ; ) References: <201112160822.pBG8MODA092847@svn.freebsd.org> In-Reply-To: <201112160822.pBG8MODA092847@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart11035629.YiQgftS358"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201112161023.20013.tijl@coosemans.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228562 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 09:33:32 -0000 --nextPart11035629.YiQgftS358 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Friday 16 December 2011 09:22:24 Ed Schouten wrote: > Author: ed > Date: Fri Dec 16 08:22:23 2011 > New Revision: 228562 > URL: http://svn.freebsd.org/changeset/base/228562 >=20 > Log: > Process a lot of feedback from bde@ on : > =20 > - Add __alignof() for non-GCC and GCC < 2.95. > - Simply implement the C1X keywords on top of the existing __macros. > - Add struct __hack to _Static_assert to require consumers to add a > semicolon. > - Add an extra underscore to __assert_ to allow it to be combined with > locally defined versions of CTASSERT in the tree. > - Add proper casts to __offsetof() to make it work for cases where > sizeof(size_t) !=3D sizeof(uintptr_t). > - Globally replace size_t and uintptr_t by __size_t and __uintptr_t. > This removes the dependency on / . Practically > any header file ends up including somehow. > - Change argument names of macros to match with the rest of the file. > =20 > MFC after: 3 months >=20 > Modified: > head/sys/sys/cdefs.h >=20 > Modified: head/sys/sys/cdefs.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/cdefs.h Fri Dec 16 02:09:51 2011 (r228561) > +++ head/sys/sys/cdefs.h Fri Dec 16 08:22:23 2011 (r228562) > @@ -363,10 +360,11 @@ > #define __offsetof(type, field) __builtin_offsetof(type, field) > #else > #ifndef __cplusplus > -#define __offsetof(type, field) ((size_t)(&((type *)0)->field)) > +#define __offsetof(type, field) \ > + ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->member)) s/member/field/ > #else > #define __offsetof(type, field) \ > - (__offsetof__ (reinterpret_cast \ > + (__offsetof__ (reinterpret_cast <__size_t> \ > (&reinterpret_cast \ > (static_cast (0)->field)))) > #endif --nextPart11035629.YiQgftS358 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EABEIAAYFAk7rDgcACgkQfoCS2CCgtisaiwD6AkKrIEWAoDWVgFfob6VS4Zvy sKJTTmW0dzg5Uyawl28A/jaY6lmEIv97hz3dQPMRiZfztppaS+DOQbAThQUOEpRB =bNE0 -----END PGP SIGNATURE----- --nextPart11035629.YiQgftS358-- From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 09:56:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53C5D106564A; Fri, 16 Dec 2011 09:56:23 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 42EDA8FC12; Fri, 16 Dec 2011 09:56:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBG9uNDi097255; Fri, 16 Dec 2011 09:56:23 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBG9uNxL097253; Fri, 16 Dec 2011 09:56:23 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112160956.pBG9uNxL097253@svn.freebsd.org> From: Ed Schouten Date: Fri, 16 Dec 2011 09:56:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228564 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 09:56:23 -0000 Author: ed Date: Fri Dec 16 09:56:22 2011 New Revision: 228564 URL: http://svn.freebsd.org/changeset/base/228564 Log: Fix typo in macro. I copied this macro directly from Bruce's email, as I assumed it was awesome already. Reported by: tijl@ Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Fri Dec 16 08:27:04 2011 (r228563) +++ head/sys/sys/cdefs.h Fri Dec 16 09:56:22 2011 (r228564) @@ -361,7 +361,7 @@ #else #ifndef __cplusplus #define __offsetof(type, field) \ - ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->member)) + ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field)) #else #define __offsetof(type, field) \ (__offsetof__ (reinterpret_cast <__size_t> \ From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 10:14:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B88B0106566C; Fri, 16 Dec 2011 10:14:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A78628FC18; Fri, 16 Dec 2011 10:14:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGAEfZc099234; Fri, 16 Dec 2011 10:14:41 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGAEfbm099232; Fri, 16 Dec 2011 10:14:41 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112161014.pBGAEfbm099232@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 16 Dec 2011 10:14:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228565 - head/sbin/devd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 10:14:41 -0000 Author: glebius Date: Fri Dec 16 10:14:41 2011 New Revision: 228565 URL: http://svn.freebsd.org/changeset/base/228565 Log: Xref re_format(7). Modified: head/sbin/devd/devd.8 Modified: head/sbin/devd/devd.8 ============================================================================== --- head/sbin/devd/devd.8 Fri Dec 16 09:56:22 2011 (r228564) +++ head/sbin/devd/devd.8 Fri Dec 16 10:14:41 2011 (r228565) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 2005 +.Dd December 16, 2011 .Dt DEVD 8 .Os .Sh NAME @@ -142,6 +142,7 @@ to communicate with its clients. .El .Sh SEE ALSO .Xr devctl 4 , -.Xr devd.conf 5 +.Xr devd.conf 5 , +.Xr re_format 7 .Sh AUTHORS .An M. Warner Losh From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 10:21:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC33F1065672; Fri, 16 Dec 2011 10:21:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AE4A8FC15; Fri, 16 Dec 2011 10:21:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGAL1tm099676; Fri, 16 Dec 2011 10:21:01 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGAL1ak099673; Fri, 16 Dec 2011 10:21:01 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112161021.pBGAL1ak099673@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 16 Dec 2011 10:21:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228566 - head/sbin/devd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 10:21:01 -0000 Author: glebius Date: Fri Dec 16 10:21:01 2011 New Revision: 228566 URL: http://svn.freebsd.org/changeset/base/228566 Log: Xref re_format(7) in devd.conf(5), not in devd(8). Pointy hat to: glebius Modified: head/sbin/devd/devd.8 head/sbin/devd/devd.conf.5 Modified: head/sbin/devd/devd.8 ============================================================================== --- head/sbin/devd/devd.8 Fri Dec 16 10:14:41 2011 (r228565) +++ head/sbin/devd/devd.8 Fri Dec 16 10:21:01 2011 (r228566) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 16, 2011 +.Dd November 24, 2005 .Dt DEVD 8 .Os .Sh NAME @@ -142,7 +142,6 @@ to communicate with its clients. .El .Sh SEE ALSO .Xr devctl 4 , -.Xr devd.conf 5 , -.Xr re_format 7 +.Xr devd.conf 5 .Sh AUTHORS .An M. Warner Losh Modified: head/sbin/devd/devd.conf.5 ============================================================================== --- head/sbin/devd/devd.conf.5 Fri Dec 16 10:14:41 2011 (r228565) +++ head/sbin/devd/devd.conf.5 Fri Dec 16 10:21:01 2011 (r228566) @@ -41,7 +41,7 @@ .\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS .\" SOFTWARE. .\" -.Dd October 25, 2011 +.Dd December 16, 2011 .Dt DEVD.CONF 5 .Os .Sh NAME @@ -542,4 +542,5 @@ has many additional examples. .Sh SEE ALSO .Xr coretemp 4 , .Xr devfs 5 , -.Xr devd 8 +.Xr devd 8 , +.Xr re_format 7 From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 10:56:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BED4106566C; Fri, 16 Dec 2011 10:56:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30D6F8FC1C; Fri, 16 Dec 2011 10:56:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGAuHS7001920; Fri, 16 Dec 2011 10:56:17 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGAuGrk001917; Fri, 16 Dec 2011 10:56:16 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112161056.pBGAuGrk001917@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 16 Dec 2011 10:56:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228567 - in head/sys: sys vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 10:56:17 -0000 Author: kib Date: Fri Dec 16 10:56:16 2011 New Revision: 228567 URL: http://svn.freebsd.org/changeset/base/228567 Log: Move kstack_cache_entry into the private header, and make the stack cache list header accessible outside vm_glue.c. MFC after: 1 week Added: head/sys/sys/_kstack_cache.h (contents, props changed) Modified: head/sys/vm/vm_glue.c Added: head/sys/sys/_kstack_cache.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/_kstack_cache.h Fri Dec 16 10:56:16 2011 (r228567) @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2009 Konstantin Belousov + * + * 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS__KSTACK_CACHE_H +#define _SYS__KSTACK_CACHE_H + +struct kstack_cache_entry { + struct vm_object *ksobj; + struct kstack_cache_entry *next_ks_entry; +}; + +extern struct kstack_cache_entry *kstack_cache; + +#endif + + Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Fri Dec 16 10:21:01 2011 (r228566) +++ head/sys/vm/vm_glue.c Fri Dec 16 10:56:16 2011 (r228567) @@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include - +#include #include #include #include @@ -331,12 +331,7 @@ vm_sync_icache(vm_map_t map, vm_offset_t pmap_sync_icache(map->pmap, va, sz); } -struct kstack_cache_entry { - vm_object_t ksobj; - struct kstack_cache_entry *next_ks_entry; -}; - -static struct kstack_cache_entry *kstack_cache; +struct kstack_cache_entry *kstack_cache; static int kstack_cache_size = 128; static int kstacks; static struct mtx kstack_cache_mtx; From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 11:42:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB64E1065670; Fri, 16 Dec 2011 11:42:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA96B8FC15; Fri, 16 Dec 2011 11:42:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGBgoFX004860; Fri, 16 Dec 2011 11:42:50 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGBgoSB004858; Fri, 16 Dec 2011 11:42:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112161142.pBGBgoSB004858@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 16 Dec 2011 11:42:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228568 - head/sys/ddb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 11:42:51 -0000 Author: kib Date: Fri Dec 16 11:42:50 2011 New Revision: 228568 URL: http://svn.freebsd.org/changeset/base/228568 Log: Show the thread kernel stack base address for 'show threads'. Discussed with: pho MFC after: 1 week Modified: head/sys/ddb/db_thread.c Modified: head/sys/ddb/db_thread.c ============================================================================== --- head/sys/ddb/db_thread.c Fri Dec 16 10:56:16 2011 (r228567) +++ head/sys/ddb/db_thread.c Fri Dec 16 11:42:50 2011 (r228568) @@ -94,7 +94,8 @@ db_show_threads(db_expr_t addr, boolean_ thr = kdb_thr_first(); while (!db_pager_quit && thr != NULL) { - db_printf(" %6ld (%p) ", (long)thr->td_tid, thr); + db_printf(" %6ld (%p) (stack %p) ", (long)thr->td_tid, thr, + (void *)thr->td_kstack); prev_jb = kdb_jmpbuf(jb); if (setjmp(jb) == 0) { if (db_trace_thread(thr, 1) != 0) From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 11:44:21 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A628106564A; Fri, 16 Dec 2011 11:44:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F2868FC16; Fri, 16 Dec 2011 11:44:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGBiK9I005002; Fri, 16 Dec 2011 11:44:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGBiKKO004998; Fri, 16 Dec 2011 11:44:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112161144.pBGBiKKO004998@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 16 Dec 2011 11:44:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228569 - head/sys/ddb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 11:44:21 -0000 Author: kib Date: Fri Dec 16 11:44:20 2011 New Revision: 228569 URL: http://svn.freebsd.org/changeset/base/228569 Log: Add 'findstack' ddb command to search either the thread kernel stack or cached stack containing the specified kernel virtual address. Discussed with: pho MFC after: 1 week Modified: head/sys/ddb/db_command.c head/sys/ddb/db_ps.c head/sys/ddb/ddb.h Modified: head/sys/ddb/db_command.c ============================================================================== --- head/sys/ddb/db_command.c Fri Dec 16 11:42:50 2011 (r228568) +++ head/sys/ddb/db_command.c Fri Dec 16 11:44:20 2011 (r228569) @@ -140,6 +140,7 @@ static struct command db_cmds[] = { { "unscript", db_unscript_cmd, CS_OWN, 0 }, { "capture", db_capture_cmd, CS_OWN, 0 }, { "textdump", db_textdump_cmd, CS_OWN, 0 }, + { "findstack", db_findstack_cmd, 0, 0 }, }; struct command_table db_cmd_table = LIST_HEAD_INITIALIZER(db_cmd_table); Modified: head/sys/ddb/db_ps.c ============================================================================== --- head/sys/ddb/db_ps.c Fri Dec 16 11:42:50 2011 (r228568) +++ head/sys/ddb/db_ps.c Fri Dec 16 11:44:20 2011 (r228569) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -429,3 +430,39 @@ DB_SHOW_COMMAND(proc, db_show_proc) break; } } + +void +db_findstack_cmd(db_expr_t addr, boolean_t have_addr, + db_expr_t dummy3 __unused, char *dummy4 __unused) +{ + struct proc *p; + struct thread *td; + struct kstack_cache_entry *ks_ce; + vm_offset_t saddr; + + if (have_addr) + saddr = addr; + else { + db_printf("Usage: findstack
\n"); + return; + } + + for (p = LIST_FIRST(&allproc); p != NULL; p = LIST_NEXT(p, p_list)) { + FOREACH_THREAD_IN_PROC(p, td) { + if (td->td_kstack <= saddr && saddr < td->td_kstack + + PAGE_SIZE * td->td_kstack_pages) { + db_printf("Thread %p\n", td); + return; + } + } + } + + for (ks_ce = kstack_cache; ks_ce != NULL; + ks_ce = ks_ce->next_ks_entry) { + if ((vm_offset_t)ks_ce <= saddr && saddr < (vm_offset_t)ks_ce + + PAGE_SIZE * KSTACK_PAGES) { + db_printf("Cached stack %p\n", ks_ce); + return; + } + } +} Modified: head/sys/ddb/ddb.h ============================================================================== --- head/sys/ddb/ddb.h Fri Dec 16 11:42:50 2011 (r228568) +++ head/sys/ddb/ddb.h Fri Dec 16 11:44:20 2011 (r228569) @@ -226,6 +226,7 @@ db_cmdfcn_t db_delete_cmd; db_cmdfcn_t db_deletehwatch_cmd; db_cmdfcn_t db_deletewatch_cmd; db_cmdfcn_t db_examine_cmd; +db_cmdfcn_t db_findstack_cmd; db_cmdfcn_t db_hwatchpoint_cmd; db_cmdfcn_t db_listbreak_cmd; db_cmdfcn_t db_scripts_cmd; From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 11:52:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EEA4D1065676; Fri, 16 Dec 2011 11:52:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD8CD8FC16; Fri, 16 Dec 2011 11:52:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGBqXvD005525; Fri, 16 Dec 2011 11:52:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGBqXG1005523; Fri, 16 Dec 2011 11:52:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112161152.pBGBqXG1005523@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 16 Dec 2011 11:52:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228570 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 11:52:34 -0000 Author: kib Date: Fri Dec 16 11:52:33 2011 New Revision: 228570 URL: http://svn.freebsd.org/changeset/base/228570 Log: Document 'findstack'. MFC after: 1 week Modified: head/share/man/man4/ddb.4 Modified: head/share/man/man4/ddb.4 ============================================================================== --- head/share/man/man4/ddb.4 Fri Dec 16 11:44:20 2011 (r228569) +++ head/share/man/man4/ddb.4 Fri Dec 16 11:52:33 2011 (r228570) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 5, 2010 +.Dd December 16, 2011 .Dt DDB 4 .Os .Sh NAME @@ -523,6 +523,16 @@ The optional argument limits the search. .\" .Pp +.It Xo +.Ic findstack +.Ar addr +.Xc +Prints the thread address for a thread kernel-mode stack of which contains the +specified address. +If the thread is not found, search the thread stack cache and prints the +cached stack address. +Otherwise, prints nothing. +.Pp .It Ic show Cm all procs Ns Op Li / Ns Cm m .It Ic ps Ns Op Li / Ns Cm m Display all process information. From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 12:16:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47DAA1065673; Fri, 16 Dec 2011 12:16:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 337B18FC0A; Fri, 16 Dec 2011 12:16:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGCGvqK006346; Fri, 16 Dec 2011 12:16:57 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGCGu8B006328; Fri, 16 Dec 2011 12:16:56 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112161216.pBGCGu8B006328@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 16 Dec 2011 12:16:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228571 - in head: . lib/libc/net sbin/ifconfig share/man/man4 sys/net sys/netinet sys/netinet6 sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 12:16:57 -0000 Author: glebius Date: Fri Dec 16 12:16:56 2011 New Revision: 228571 URL: http://svn.freebsd.org/changeset/base/228571 Log: A major overhaul of the CARP implementation. The ip_carp.c was started from scratch, copying needed functionality from the old implemenation on demand, with a thorough review of all code. The main change is that interface layer has been removed from the CARP. Now redundant addresses are configured exactly on the interfaces, they run on. The CARP configuration itself is, as before, configured and read via SIOCSVH/SIOCGVH ioctls. A new prefix created with SIOCAIFADDR or SIOCAIFADDR_IN6 may now be configured to a particular virtual host id, which makes the prefix redundant. ifconfig(8) semantics has been changed too: now one doesn't need to clone carpXX interface, he/she should directly configure a vhid on a Ethernet interface. To supply vhid data from the kernel to an application the getifaddrs(8) function had been changed to pass ifam_data with each address. [1] The new implementation definitely closes all PRs related to carp(4) being an interface, and may close several others. It also allows to run a single redundant IP per interface. Big thanks to Bjoern Zeeb for his help with inet6 part of patch, for idea on using ifam_data and for several rounds of reviewing! PR: kern/117000, kern/126945, kern/126714, kern/120130, kern/117448 Reviewed by: bz Submitted by: bz [1] Modified: head/UPDATING head/lib/libc/net/getifaddrs.c head/sbin/ifconfig/af_inet.c head/sbin/ifconfig/af_inet6.c head/sbin/ifconfig/ifcarp.c head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/ifconfig.c head/sbin/ifconfig/ifconfig.h head/share/man/man4/carp.4 head/sys/net/if.c head/sys/net/if.h head/sys/net/if_ethersubr.c head/sys/net/if_types.h head/sys/net/if_var.h head/sys/net/rtsock.c head/sys/netinet/if_ether.c head/sys/netinet/if_ether.h head/sys/netinet/in.c head/sys/netinet/in_var.h head/sys/netinet/ip_carp.c head/sys/netinet/ip_carp.h head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_var.h head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c head/sys/sys/param.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Dec 16 11:52:33 2011 (r228570) +++ head/UPDATING Fri Dec 16 12:16:56 2011 (r228571) @@ -22,6 +22,17 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20111215: + The carp(4) facility has been changed significantly. Configuration + of the CARP protocol via ifconfig(8) has changed, as well as format + of CARP events submitted to devd(8) has changed. See manual pages + for more information. The arpbalance feature of carp(4) is currently + not supported anymore. + + Size of struct in_aliasreq, struct in6_aliasreq has changed. User + utilities using SIOCAIFADDR, SIOCAIFADDR_IN6, e.g. ifconfig(8), + need to be recompiled. + 20111122: The acpi_wmi(4) status device /dev/wmistat has been renamed to /dev/wmistat0. Modified: head/lib/libc/net/getifaddrs.c ============================================================================== --- head/lib/libc/net/getifaddrs.c Fri Dec 16 11:52:33 2011 (r228570) +++ head/lib/libc/net/getifaddrs.c Fri Dec 16 12:16:56 2011 (r228571) @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); #define HAVE_IFM_DATA #endif -#if _BSDI_VERSION >= 199802 +#if (_BSDI_VERSION >= 199802) || (__FreeBSD_version >= 1000003) /* ifam_data is very specific to recent versions of bsdi */ #define HAVE_IFAM_DATA #endif Modified: head/sbin/ifconfig/af_inet.c ============================================================================== --- head/sbin/ifconfig/af_inet.c Fri Dec 16 11:52:33 2011 (r228570) +++ head/sbin/ifconfig/af_inet.c Fri Dec 16 12:16:56 2011 (r228571) @@ -84,8 +84,11 @@ in_status(int s __unused, const struct i if (ifa->ifa_flags & IFF_BROADCAST) { sin = (struct sockaddr_in *)ifa->ifa_broadaddr; if (sin != NULL && sin->sin_addr.s_addr != 0) - printf("broadcast %s", inet_ntoa(sin->sin_addr)); + printf("broadcast %s ", inet_ntoa(sin->sin_addr)); } + + print_vhid(ifa, " "); + putchar('\n'); } Modified: head/sbin/ifconfig/af_inet6.c ============================================================================== --- head/sbin/ifconfig/af_inet6.c Fri Dec 16 11:52:33 2011 (r228570) +++ head/sbin/ifconfig/af_inet6.c Fri Dec 16 12:16:56 2011 (r228571) @@ -307,6 +307,8 @@ in6_status(int s __unused, const struct printf("infty "); } + print_vhid(ifa, " "); + putchar('\n'); } Modified: head/sbin/ifconfig/ifcarp.c ============================================================================== --- head/sbin/ifconfig/ifcarp.c Fri Dec 16 11:52:33 2011 (r228570) +++ head/sbin/ifconfig/ifcarp.c Fri Dec 16 12:16:56 2011 (r228571) @@ -35,10 +35,11 @@ #include #include -#include #include +#include +#include +#include #include -#include #include #include @@ -52,127 +53,153 @@ static const char *carp_states[] = { CARP_STATES }; -void carp_status(int s); -void setcarp_advbase(const char *,int, int, const struct afswtch *rafp); -void setcarp_advskew(const char *, int, int, const struct afswtch *rafp); -void setcarp_passwd(const char *, int, int, const struct afswtch *rafp); -void setcarp_vhid(const char *, int, int, const struct afswtch *rafp); +static void carp_status(int s); +static void setcarp_vhid(const char *, int, int, const struct afswtch *rafp); +static void setcarp_callback(int, void *); +static void setcarp_advbase(const char *,int, int, const struct afswtch *rafp); +static void setcarp_advskew(const char *, int, int, const struct afswtch *rafp); +static void setcarp_passwd(const char *, int, int, const struct afswtch *rafp); + +static int carpr_vhid = -1; +static int carpr_advskew = -1; +static int carpr_advbase = -1; +static int carpr_state = -1; +static unsigned char const *carpr_key; -void +static void carp_status(int s) { - const char *state; - struct carpreq carpr; + struct carpreq carpr[CARP_MAXVHID]; + int i; - memset((char *)&carpr, 0, sizeof(struct carpreq)); + bzero(carpr, sizeof(struct carpreq) * CARP_MAXVHID); + carpr[0].carpr_count = CARP_MAXVHID; ifr.ifr_data = (caddr_t)&carpr; if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1) return; - if (carpr.carpr_vhid > 0) { - if (carpr.carpr_state > CARP_MAXSTATE) - state = ""; + for (i = 0; i < carpr[0].carpr_count; i++) { + printf("\tcarp: %s vhid %d advbase %d advskew %d", + carp_states[carpr[i].carpr_state], carpr[i].carpr_vhid, + carpr[i].carpr_advbase, carpr[i].carpr_advskew); + if (printkeys && carpr[i].carpr_key[0] != '\0') + printf(" key \"%s\"\n", carpr[i].carpr_key); else - state = carp_states[carpr.carpr_state]; - - printf("\tcarp: %s vhid %d advbase %d advskew %d\n", - state, carpr.carpr_vhid, carpr.carpr_advbase, - carpr.carpr_advskew); + printf("\n"); } - - return; - } -void -setcarp_passwd(const char *val, int d, int s, const struct afswtch *afp) +static void +setcarp_vhid(const char *val, int d, int s, const struct afswtch *afp) { - struct carpreq carpr; - memset((char *)&carpr, 0, sizeof(struct carpreq)); - ifr.ifr_data = (caddr_t)&carpr; + carpr_vhid = atoi(val); - if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1) - err(1, "SIOCGVH"); - - memset(carpr.carpr_key, 0, sizeof(carpr.carpr_key)); - /* XXX Should hash the password into the key here, perhaps? */ - strlcpy(carpr.carpr_key, val, CARP_KEY_LEN); - - if (ioctl(s, SIOCSVH, (caddr_t)&ifr) == -1) - err(1, "SIOCSVH"); + if (carpr_vhid <= 0 || carpr_vhid > CARP_MAXVHID) + errx(1, "vhid must be greater than 0 and less than %u", + CARP_MAXVHID); + + switch (afp->af_af) { +#ifdef INET + case AF_INET: + { + struct in_aliasreq *ifra; + + ifra = (struct in_aliasreq *)afp->af_addreq; + ifra->ifra_vhid = carpr_vhid; + break; + } +#endif +#ifdef INET6 + case AF_INET6: + { + struct in6_aliasreq *ifra; + + ifra = (struct in6_aliasreq *)afp->af_addreq; + ifra->ifra_vhid = carpr_vhid; + break; + } +#endif + default: + errx(1, "%s doesn't support carp(4)", afp->af_name); + } - return; + callback_register(setcarp_callback, NULL); } -void -setcarp_vhid(const char *val, int d, int s, const struct afswtch *afp) +static void +setcarp_callback(int s, void *arg __unused) { - int vhid; struct carpreq carpr; - vhid = atoi(val); - - if (vhid <= 0) - errx(1, "vhid must be greater than 0"); - - memset((char *)&carpr, 0, sizeof(struct carpreq)); + bzero(&carpr, sizeof(struct carpreq)); + carpr.carpr_vhid = carpr_vhid; + carpr.carpr_count = 1; ifr.ifr_data = (caddr_t)&carpr; - if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1) + if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1 && errno != ENOENT) err(1, "SIOCGVH"); - carpr.carpr_vhid = vhid; + if (carpr_key != NULL) + /* XXX Should hash the password into the key here? */ + strlcpy(carpr.carpr_key, carpr_key, CARP_KEY_LEN); + if (carpr_advskew > -1) + carpr.carpr_advskew = carpr_advskew; + if (carpr_advbase > -1) + carpr.carpr_advbase = carpr_advbase; + if (carpr_state > -1) + carpr.carpr_state = carpr_state; if (ioctl(s, SIOCSVH, (caddr_t)&ifr) == -1) err(1, "SIOCSVH"); - - return; } -void -setcarp_advskew(const char *val, int d, int s, const struct afswtch *afp) +static void +setcarp_passwd(const char *val, int d, int s, const struct afswtch *afp) { - int advskew; - struct carpreq carpr; - advskew = atoi(val); + if (carpr_vhid == -1) + errx(1, "passwd requires vhid"); - memset((char *)&carpr, 0, sizeof(struct carpreq)); - ifr.ifr_data = (caddr_t)&carpr; + carpr_key = val; +} - if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1) - err(1, "SIOCGVH"); +static void +setcarp_advskew(const char *val, int d, int s, const struct afswtch *afp) +{ - carpr.carpr_advskew = advskew; + if (carpr_vhid == -1) + errx(1, "advskew requires vhid"); - if (ioctl(s, SIOCSVH, (caddr_t)&ifr) == -1) - err(1, "SIOCSVH"); - - return; + carpr_advskew = atoi(val); } -void +static void setcarp_advbase(const char *val, int d, int s, const struct afswtch *afp) { - int advbase; - struct carpreq carpr; - advbase = atoi(val); + if (carpr_vhid == -1) + errx(1, "advbase requires vhid"); - memset((char *)&carpr, 0, sizeof(struct carpreq)); - ifr.ifr_data = (caddr_t)&carpr; + carpr_advbase = atoi(val); +} - if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1) - err(1, "SIOCGVH"); +static void +setcarp_state(const char *val, int d, int s, const struct afswtch *afp) +{ + int i; - carpr.carpr_advbase = advbase; + if (carpr_vhid == -1) + errx(1, "state requires vhid"); - if (ioctl(s, SIOCSVH, (caddr_t)&ifr) == -1) - err(1, "SIOCSVH"); + for (i = 0; i <= CARP_MAXSTATE; i++) + if (strcasecmp(carp_states[i], val) == 0) { + carpr_state = i; + return; + } - return; + errx(1, "unknown state"); } static struct cmd carp_cmds[] = { @@ -180,6 +207,7 @@ static struct cmd carp_cmds[] = { DEF_CMD_ARG("advskew", setcarp_advskew), DEF_CMD_ARG("pass", setcarp_passwd), DEF_CMD_ARG("vhid", setcarp_vhid), + DEF_CMD_ARG("state", setcarp_state), }; static struct afswtch af_carp = { .af_name = "af_carp", Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Fri Dec 16 11:52:33 2011 (r228570) +++ head/sbin/ifconfig/ifconfig.8 Fri Dec 16 12:16:56 2011 (r228571) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd November 12, 2011 +.Dd December 16, 2011 .Dt IFCONFIG 8 .Os .Sh NAME @@ -2445,16 +2445,36 @@ The argument is useless and hence deprecated. .El .Pp -The following parameters are specific to +The following parameters are used to configure .Xr carp 4 -interfaces: +protocol on an interface: .Bl -tag -width indent +.It Cm vhid Ar n +Set the virtual host ID. +This is a required setting to initiate +.Xr carp 4 . +If the virtual host ID doesn't exist yet, it is created and attached to the +interface, otherwise configuration of an existing vhid is adjusted. +If the +.Cm vhid +keyword is supplied along with an +.Dq inet6 +or +.Dq inet +address, then this address is configured to be run under control of the +specified vhid. +Whenever a last address that refers to a particular vhid is removed from an +interface, the vhid is automatically removed from interface and destroyed. +Any other configuration parameters for the +.Xr carp 4 +protocol should be supplied along with the +.Cm vhid +keyword. +Acceptable values for vhid are 1 to 255. .It Cm advbase Ar seconds Specifies the base of the advertisement interval in seconds. The acceptable values are 1 to 255. The default value is 1. -.\" The default value is -.\" .Dv CARP_DFLTINTV . .It Cm advskew Ar interval Specifies the skew to add to the base advertisement interval to make one host advertise slower than another host. @@ -2464,10 +2484,8 @@ The default value is 0. .It Cm pass Ar phrase Set the authentication key to .Ar phrase . -.It Cm vhid Ar n -Set the virtual host ID. -This is a required setting. -Acceptable values are 1 to 255. +.It Cm state Ar MASTER|BACKUP +Forcibly change state of a given vhid. .El .Pp The @@ -2530,8 +2548,9 @@ The .Fl k flag causes keying information for the interface, if available, to be printed. -For example, the values of 802.11 WEP keys will be printed, if accessible to -the current user. +For example, the values of 802.11 WEP keys and +.Xr carp 4 +passphrases will be printed, if accessible to the current user. This information is not printed by default, as it may be considered sensitive. .Pp @@ -2593,6 +2612,11 @@ as a synonym for the canonical form of t .Fl alias : .Dl # ifconfig em0 inet6 2001:db8:bdbd::123/48 delete .Pp +Configure a single CARP redundant address on igb0, and then switch it +to be master: +.Dl # ifconfig igb0 vhid 1 10.0.0.1/24 pass foobar +.Dl # ifconfig igb0 vhid 1 state master +.Pp Configure the interface .Li xl0 , to use 100baseTX, full duplex Ethernet media options: Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Fri Dec 16 11:52:33 2011 (r228570) +++ head/sbin/ifconfig/ifconfig.c Fri Dec 16 12:16:56 2011 (r228571) @@ -1078,6 +1078,21 @@ printb(const char *s, unsigned v, const } void +print_vhid(const struct ifaddrs *ifa, const char *s) +{ + struct if_data *ifd; + + if (ifa->ifa_data == NULL) + return; + + ifd = ifa->ifa_data; + if (ifd->ifi_vhid == 0) + return; + + printf("vhid %d ", ifd->ifi_vhid); +} + +void ifmaybeload(const char *name) { #define MOD_PREFIX_LEN 3 /* "if_" */ Modified: head/sbin/ifconfig/ifconfig.h ============================================================================== --- head/sbin/ifconfig/ifconfig.h Fri Dec 16 11:52:33 2011 (r228570) +++ head/sbin/ifconfig/ifconfig.h Fri Dec 16 12:16:56 2011 (r228571) @@ -148,3 +148,6 @@ void clone_setdefcallback(const char *, * operations on ifmedia can avoid cmd line ordering confusion. */ struct ifmediareq *ifmedia_getstate(int s); + +void print_vhid(const struct ifaddrs *, const char *); + Modified: head/share/man/man4/carp.4 ============================================================================== --- head/share/man/man4/carp.4 Fri Dec 16 11:52:33 2011 (r228570) +++ head/share/man/man4/carp.4 Fri Dec 16 12:16:56 2011 (r228571) @@ -1,6 +1,7 @@ .\" $OpenBSD: carp.4,v 1.16 2004/12/07 23:41:35 jmc Exp $ .\" .\" Copyright (c) 2003, Ryan McBride. All rights reserved. +.\" Copyright (c) 2011, Gleb Smirnoff .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -25,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 15, 2011 +.Dd December 16, 2011 .Dt CARP 4 .Os .Sh NAME @@ -34,33 +35,17 @@ .Sh SYNOPSIS .Cd "device carp" .Sh DESCRIPTION -The -.Nm -interface is a pseudo-device that implements and controls the -CARP protocol. -CARP allows multiple hosts on the same local network to share a set of IP addresses. +The CARP allows multiple hosts on the same local network to share a set of +IPv4 and/or IPv6 addresses. Its primary purpose is to ensure that these -addresses are always available, but in some configurations -.Nm -can also provide load balancing functionality. -.Pp -A -.Nm -interface can be created at runtime using the -.Nm ifconfig Li carp Ns Ar N Cm create -command or by configuring -it via -.Va cloned_interfaces -in the -.Pa /etc/rc.conf -file. +addresses are always available. .Pp To use .Nm , -the administrator needs to configure at minimum a common virtual host ID (VHID) -and virtual host IP address on each machine which is to take part in the virtual -group. -Additional parameters can also be set on a per-interface basis: +the administrator needs to configure at minimum a common virtual host ID +(vhid) and attach at least one IP address to this vhid on each machine which +is to take part in the virtual group. +Additional parameters can also be set on a per-vhid basis: .Cm advbase and .Cm advskew , @@ -93,9 +78,20 @@ or through the .Dv SIOCSVH .Xr ioctl 2 . .Pp +CARP virtual hosts can be configured on multicast capable interfaces: Ethernet, +layer 2 VLAN, FDDI and Token Ring. +An arbitrary number of virtual host IDs can be configured on an interface. +An arbitrary number of IPv4 or IPv6 addresses can be attached to a particular +vhid. +It is important that all hosts participating in a vhid have the same list +of prefixes configured on the vhid, since all prefixes are included in the +cryptographic checksum supplied in each advertisement. +Multiple vhids running on one interface participate in master/backup +elections independently. +.Pp Additionally, there are a number of global parameters which can be set using .Xr sysctl 8 : -.Bl -tag -width ".Va net.inet.carp.arpbalance" +.Bl -tag -width ".Va net.inet.carp.preempt" .It Va net.inet.carp.allow Accept incoming .Nm @@ -125,9 +121,6 @@ Values above 1 enable logging of bad .Nm packets. Default value is 1. -.It Va net.inet.carp.arpbalance -Balance local traffic using ARP (see below). -Disabled by default. .It Va net.inet.carp.suppress_preempt A read only value showing the status of preemption suppression. Preemption can be suppressed if link on an interface is down @@ -138,36 +131,36 @@ Value of 0 means that preemption is not problems are detected. Every problem increments suppression counter. .El -.Sh ARP level load balancing -The -.Nm -has limited abilities for load balancing the incoming connections -between hosts in Ethernet network. -For load balancing operation, one needs several CARP interfaces that -are configured to the same IP address, but to a different VHIDs. -Once an ARP request is received, the CARP protocol will use a hashing -function against the source IP address in the ARP request to determine -which VHID should this request belong to. -If the corresponding CARP interface is in master state, the ARP request -will be replied, otherwise it will be ignored. -See the -.Sx EXAMPLES -section for a practical example of load balancing. -.Pp -The ARP load balancing has some limitations. -First, ARP balancing only works on the local network segment. -It cannot balance traffic that crosses a router, because the -router itself will always be balanced to the same virtual host. -Second, ARP load balancing can lead to asymmetric routing -of incoming and outgoing traffic, and thus combining it with -.Xr pfsync 4 -is dangerous, because this creates a race condition between -balanced routers and a host they are serving. -Imagine an incoming packet creating state on the first router, being -forwarded to its destination, and destination replying faster -than the state information is packed and synced with the second router. -If the reply would be load balanced to second router, it will be -dropped due to no state. +.\".Sh ARP level load balancing +.\"The +.\".Nm +.\"has limited abilities for load balancing the incoming connections +.\"between hosts in Ethernet network. +.\"For load balancing operation, one needs several CARP interfaces that +.\"are configured to the same IP address, but to a different vhids. +.\"Once an ARP request is received, the CARP protocol will use a hashing +.\"function against the source IP address in the ARP request to determine +.\"which vhid should this request belong to. +.\"If the corresponding CARP interface is in master state, the ARP request +.\"will be replied, otherwise it will be ignored. +.\"See the +.\".Sx EXAMPLES +.\"section for a practical example of load balancing. +.\".Pp +.\"The ARP load balancing has some limitations. +.\"First, ARP balancing only works on the local network segment. +.\"It cannot balance traffic that crosses a router, because the +.\"router itself will always be balanced to the same virtual host. +.\"Second, ARP load balancing can lead to asymmetric routing +.\"of incoming and outgoing traffic, and thus combining it with +.\".Xr pfsync 4 +.\"is dangerous, because this creates a race condition between +.\"balanced routers and a host they are serving. +.\"Imagine an incoming packet creating state on the first router, being +.\"forwarded to its destination, and destination replying faster +.\"than the state information is packed and synced with the second router. +.\"If the reply would be load balanced to second router, it will be +.\"dropped due to no state. .Sh STATE CHANGE NOTIFICATIONS Sometimes it is useful to get notified about .Nm @@ -175,13 +168,10 @@ status change events. This can be accomplished by using .Xr devd 8 hooks. -Master/slave events are signalled as -.Nm -interface -.Dv LINK_UP -or -.Dv LINK_DOWN -event. +Master/slave events are signalled under system +.Dv CARP . +Subsystem specifies vhid and name of interface, where event occured. +Type of the message displays new state of vhid. Please see .Xr devd.conf 5 and @@ -197,23 +187,19 @@ Enable it on both host A and B: .Pp .Dl sysctl net.inet.carp.preempt=1 .Pp -Assume that host A is the preferred master and 192.168.1.x/24 is -configured on one physical interface and 192.168.2.y/24 on another. +Assume that host A is the preferred master and we are running the +192.168.1.0/24 prefix on em0 and 192.168.2.0/24 on em1. This is the setup for host A: .Bd -literal -offset indent -ifconfig carp0 create -ifconfig carp0 vhid 1 pass mekmitasdigoat 192.168.1.1/24 -ifconfig carp1 create -ifconfig carp1 vhid 2 pass mekmitasdigoat 192.168.2.1/24 +ifconfig em0 vhid 1 pass mekmitasdigoat 192.168.1.1/24 +ifconfig em1 vhid 2 pass mekmitasdigoat 192.168.2.1/24 .Ed .Pp The setup for host B is identical, but it has a higher .Cm advskew : .Bd -literal -offset indent -ifconfig carp0 create -ifconfig carp0 vhid 1 advskew 100 pass mekmitasdigoat 192.168.1.1/24 -ifconfig carp1 create -ifconfig carp1 vhid 2 advskew 100 pass mekmitasdigoat 192.168.2.1/24 +ifconfig em0 vhid 1 advskew 100 pass mekmitasdigoat 192.168.1.1/24 +ifconfig em1 vhid 2 advskew 100 pass mekmitasdigoat 192.168.2.1/24 .Ed .Pp Because of the preempt option, when one of the physical interfaces of @@ -224,67 +210,60 @@ is adjusted to 240 on all its interfaces. This will cause host B to preempt on both interfaces instead of just the failed one. -.Pp -In order to set up an ARP balanced virtual host, it is necessary to configure -one virtual host for each physical host which would respond to ARP requests -and thus handle the traffic. -In the following example, two virtual hosts are configured on two hosts to -provide balancing and failover for the IP address 192.168.1.10. -.Pp -First the -.Nm -interfaces on host A are configured. -The -.Cm advskew -of 100 on the second virtual host means that its advertisements will be sent -out slightly less frequently. -.Bd -literal -offset indent -ifconfig carp0 create -ifconfig carp0 vhid 1 pass mekmitasdigoat 192.168.1.10/24 -ifconfig carp1 create -ifconfig carp1 vhid 2 advskew 100 pass mekmitasdigoat 192.168.1.10/24 -.Ed -.Pp -The configuration for host B is identical, except the -.Cm advskew -is on virtual host 1 rather than virtual host 2. -.Bd -literal -offset indent -ifconfig carp0 create -ifconfig carp0 vhid 1 advskew 100 pass mekmitasdigoat 192.168.1.10/24 -ifconfig carp1 create -ifconfig carp1 vhid 2 pass mekmitasdigoat 192.168.1.10/24 -.Ed -.Pp -Finally, the ARP balancing feature must be enabled on both hosts: -.Pp -.Dl sysctl net.inet.carp.arpbalance=1 -.Pp -When the hosts receive an ARP request for 192.168.1.10, the source IP address -of the request is used to compute which virtual host should answer the request. -The host which is master of the selected virtual host will reply to the -request, the other(s) will ignore it. -.Pp -This way, locally connected systems will receive different ARP replies and -subsequent IP traffic will be balanced among the hosts. -If one of the hosts fails, the other will take over the virtual MAC address, -and begin answering ARP requests on its behalf. +.\".Pp +.\"In order to set up an ARP balanced virtual host, it is necessary to configure +.\"one virtual host for each physical host which would respond to ARP requests +.\"and thus handle the traffic. +.\"In the following example, two virtual hosts are configured on two hosts to +.\"provide balancing and failover for the IP address 192.168.1.10. +.\".Pp +.\"First the +.\".Nm +.\"interfaces on host A are configured. +.\"The +.\".Cm advskew +.\"of 100 on the second virtual host means that its advertisements will be sent +.\"out slightly less frequently. +.\".Bd -literal -offset indent +.\"ifconfig carp0 create +.\"ifconfig carp0 vhid 1 pass mekmitasdigoat 192.168.1.10/24 +.\"ifconfig carp1 create +.\"ifconfig carp1 vhid 2 advskew 100 pass mekmitasdigoat 192.168.1.10/24 +.\".Ed +.\".Pp +.\"The configuration for host B is identical, except the +.\".Cm advskew +.\"is on virtual host 1 rather than virtual host 2. +.\".Bd -literal -offset indent +.\"ifconfig carp0 create +.\"ifconfig carp0 vhid 1 advskew 100 pass mekmitasdigoat 192.168.1.10/24 +.\"ifconfig carp1 create +.\"ifconfig carp1 vhid 2 pass mekmitasdigoat 192.168.1.10/24 +.\".Ed +.\".Pp +.\"Finally, the ARP balancing feature must be enabled on both hosts: +.\".Pp +.\".Dl sysctl net.inet.carp.arpbalance=1 +.\".Pp +.\"When the hosts receive an ARP request for 192.168.1.10, the source IP address +.\"of the request is used to compute which virtual host should answer the request. +.\"The host which is master of the selected virtual host will reply to the +.\"request, the other(s) will ignore it. +.\".Pp +.\"This way, locally connected systems will receive different ARP replies and +.\"subsequent IP traffic will be balanced among the hosts. +.\"If one of the hosts fails, the other will take over the virtual MAC address, +.\"and begin answering ARP requests on its behalf. .Pp Processing of .Nm -status change events can be set up by using the following devd.conf rules: +status change events can be set up by using the following devd.conf rule: .Bd -literal -offset indent notify 0 { - match "system" "IFNET"; - match "type" "LINK_UP"; - match "subsystem" "carp*"; - action "/root/carpcontrol.sh $type $subsystem"; -}; - -notify 0 { - match "system" "IFNET"; - match "type" "LINK_DOWN"; - match "subsystem" "carp*"; - action "/root/carpcontrol.sh $type $subsystem"; + match "system" "CARP"; + match "subsystem" "[0-9]+@"; + match "type" "(MASTER|BACKUP)"; + action "/root/carpcontrol.sh $subsystem $type"; }; .Ed .Sh SEE ALSO @@ -303,3 +282,8 @@ The .Nm device was imported into .Fx 5.4 . +In +.Fx 10 +the +.Nm +was significantly rewritten, and is no longer a pseudo-interface. Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Fri Dec 16 11:52:33 2011 (r228570) +++ head/sys/net/if.c Fri Dec 16 12:16:56 2011 (r228571) @@ -130,17 +130,19 @@ void (*lagg_linkstate_p)(struct ifnet *i /* These are external hooks for CARP. */ void (*carp_linkstate_p)(struct ifnet *ifp); #if defined(INET) || defined(INET6) -struct ifnet *(*carp_forus_p)(struct ifnet *ifp, u_char *dhost); +int (*carp_forus_p)(struct ifnet *ifp, u_char *dhost); int (*carp_output_p)(struct ifnet *ifp, struct mbuf *m, - struct sockaddr *sa, struct rtentry *rt); + struct sockaddr *sa); +int (*carp_ioctl_p)(struct ifreq *, u_long, struct thread *); +int (*carp_attach_p)(struct ifaddr *, int); +void (*carp_detach_p)(struct ifaddr *); #endif #ifdef INET -int (*carp_iamatch_p)(struct ifnet *, struct in_ifaddr *, struct in_addr *, - u_int8_t **); +int (*carp_iamatch_p)(struct ifaddr *, uint8_t **); #endif #ifdef INET6 struct ifaddr *(*carp_iamatch6_p)(struct ifnet *ifp, struct in6_addr *taddr6); -caddr_t (*carp_macmatch6_p)(struct ifnet *ifp, struct mbuf *m, +caddr_t (*carp_macmatch6_p)(struct ifnet *ifp, struct mbuf *m, const struct in6_addr *taddr); #endif @@ -2506,6 +2508,16 @@ ifioctl(struct socket *so, u_long cmd, c error = if_getgroupmembers((struct ifgroupreq *)data); CURVNET_RESTORE(); return (error); +#if defined(INET) || defined(INET6) + case SIOCSVH: + case SIOCGVH: + if (carp_ioctl_p == NULL) + error = EPROTONOSUPPORT; + else + error = (*carp_ioctl_p)(ifr, cmd, td); + CURVNET_RESTORE(); + return (error); +#endif } ifp = ifunit_ref(ifr->ifr_name); Modified: head/sys/net/if.h ============================================================================== --- head/sys/net/if.h Fri Dec 16 11:52:33 2011 (r228570) +++ head/sys/net/if.h Fri Dec 16 12:16:56 2011 (r228571) @@ -85,7 +85,7 @@ struct if_data { u_char ifi_addrlen; /* media address length */ u_char ifi_hdrlen; /* media header length */ u_char ifi_link_state; /* current link state */ - u_char ifi_spare_char1; /* spare byte */ + u_char ifi_vhid; /* carp vhid */ u_char ifi_spare_char2; /* spare byte */ u_char ifi_datalen; /* length of this data struct */ u_long ifi_mtu; /* maximum transmission unit */ @@ -267,6 +267,8 @@ struct ifa_msghdr { int ifam_flags; /* value of ifa_flags */ u_short ifam_index; /* index for associated ifp */ int ifam_metric; /* value of ifa_metric */ + struct if_data ifam_data;/* statistics and other data about if or + * address */ }; /* @@ -357,6 +359,7 @@ struct ifaliasreq { struct sockaddr ifra_addr; struct sockaddr ifra_broadaddr; struct sockaddr ifra_mask; + int ifra_vhid; }; struct ifmediareq { Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Fri Dec 16 11:52:33 2011 (r228570) +++ head/sys/net/if_ethersubr.c Fri Dec 16 12:16:56 2011 (r228571) @@ -397,7 +397,7 @@ ether_output(struct ifnet *ifp, struct m #if defined(INET) || defined(INET6) if (ifp->if_carp && - (error = (*carp_output_p)(ifp, m, dst, NULL))) + (error = (*carp_output_p)(ifp, m, dst))) goto bad; #endif Modified: head/sys/net/if_types.h ============================================================================== --- head/sys/net/if_types.h Fri Dec 16 11:52:33 2011 (r228570) +++ head/sys/net/if_types.h Fri Dec 16 12:16:56 2011 (r228571) @@ -250,6 +250,5 @@ #define IFT_ENC 0xf4 #define IFT_PFLOG 0xf6 #define IFT_PFSYNC 0xf7 -#define IFT_CARP 0xf8 /* Common Address Redundancy Protocol */ #define IFT_IPXIP 0xf9 /* IPX over IP tunneling; no longer used. */ #endif /* !_NET_IF_TYPES_H_ */ Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Fri Dec 16 11:52:33 2011 (r228570) +++ head/sys/net/if_var.h Fri Dec 16 12:16:56 2011 (r228571) @@ -69,6 +69,7 @@ struct rt_addrinfo; struct socket; struct ether_header; struct carp_if; +struct carp_softc; struct ifvlantrunk; struct route; struct vnet; @@ -729,6 +730,7 @@ struct ifaddr { struct sockaddr *ifa_netmask; /* used to determine subnet */ struct if_data if_data; /* not all members are meaningful */ struct ifnet *ifa_ifp; /* back-pointer to interface */ + struct carp_softc *ifa_carp; /* pointer to CARP data */ TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ (int, struct rtentry *, struct rt_addrinfo *); Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Fri Dec 16 11:52:33 2011 (r228570) +++ head/sys/net/rtsock.c Fri Dec 16 12:16:56 2011 (r228571) @@ -63,6 +63,7 @@ #include #include +#include #ifdef INET6 #include #endif @@ -83,7 +84,7 @@ struct if_data32 { uint8_t ifi_addrlen; uint8_t ifi_hdrlen; uint8_t ifi_link_state; - uint8_t ifi_spare_char1; + uint8_t ifi_vhid; uint8_t ifi_spare_char2; uint8_t ifi_datalen; uint32_t ifi_mtu; @@ -122,6 +123,9 @@ MALLOC_DEFINE(M_RTABLE, "routetbl", "rou static struct sockaddr route_src = { 2, PF_ROUTE, }; static struct sockaddr sa_zero = { sizeof(sa_zero), AF_INET, }; +/* These are external hooks for CARP. */ +int (*carp_get_vhid_p)(struct ifaddr *); + /* * Used by rtsock/raw_input callback code to decide whether to filter the update * notification to a socket bound to a particular FIB. @@ -1508,6 +1512,7 @@ copy_ifdata32(struct if_data *src, struc CP(*src, *dst, ifi_addrlen); CP(*src, *dst, ifi_hdrlen); CP(*src, *dst, ifi_link_state); + CP(*src, *dst, ifi_vhid); dst->ifi_datalen = sizeof(struct if_data32); CP(*src, *dst, ifi_mtu); CP(*src, *dst, ifi_metric); @@ -1559,6 +1564,9 @@ sysctl_iflist(int af, struct walkarg *w) ifm32->ifm_flags = ifp->if_flags | ifp->if_drv_flags; copy_ifdata32(&ifp->if_data, &ifm32->ifm_data); + if (carp_get_vhid_p != NULL) + ifm32->ifm_data.ifi_vhid = + (*carp_get_vhid_p)(ifa); ifm32->ifm_addrs = info.rti_addrs; error = SYSCTL_OUT(w->w_req, (caddr_t)ifm32, len); @@ -1569,6 +1577,9 @@ sysctl_iflist(int af, struct walkarg *w) ifm->ifm_index = ifp->if_index; ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags; ifm->ifm_data = ifp->if_data; + if (carp_get_vhid_p != NULL) + ifm->ifm_data.ifi_vhid = + (*carp_get_vhid_p)(ifa); ifm->ifm_addrs = info.rti_addrs; error = SYSCTL_OUT(w->w_req, (caddr_t)ifm, len); #ifdef COMPAT_FREEBSD32 @@ -1595,6 +1606,9 @@ sysctl_iflist(int af, struct walkarg *w) ifam->ifam_flags = ifa->ifa_flags; ifam->ifam_metric = ifa->ifa_metric; ifam->ifam_addrs = info.rti_addrs; + if (carp_get_vhid_p != NULL) + ifam->ifam_data.ifi_vhid = + (*carp_get_vhid_p)(ifa); error = SYSCTL_OUT(w->w_req, w->w_tmem, len); if (error) goto done; Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Fri Dec 16 11:52:33 2011 (r228570) +++ head/sys/netinet/if_ether.c Fri Dec 16 12:16:56 2011 (r228571) @@ -139,8 +139,6 @@ static const struct netisr_handler arp_n }; #ifdef AF_INET -void arp_ifscrub(struct ifnet *ifp, uint32_t addr); - /* * called by in_ifscrub to remove entry from the table when * the interface goes away @@ -516,7 +514,7 @@ in_arpinput(struct mbuf *m) int op, flags; int req_len; int bridged = 0, is_bridge = 0; - int carp_match = 0; + int carped; struct sockaddr_in sin; sin.sin_len = sizeof(struct sockaddr_in); sin.sin_family = AF_INET; @@ -561,24 +559,14 @@ in_arpinput(struct mbuf *m) * For a bridge, we want to check the address irrespective * of the receive interface. (This will change slightly * when we have clusters of interfaces). - * If the interface does not match, but the recieving interface - * is part of carp, we call carp_iamatch to see if this is a - * request for the virtual host ip. - * XXX: This is really ugly! */ IN_IFADDR_RLOCK(); LIST_FOREACH(ia, INADDR_HASH(itaddr.s_addr), ia_hash) { if (((bridged && ia->ia_ifp->if_bridge == ifp->if_bridge) || ia->ia_ifp == ifp) && - itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { - ifa_ref(&ia->ia_ifa); - IN_IFADDR_RUNLOCK(); - goto match; - } - if (ifp->if_carp != NULL && - (*carp_iamatch_p)(ifp, ia, &isaddr, &enaddr) && - itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { - carp_match = 1; + itaddr.s_addr == ia->ia_addr.sin_addr.s_addr && + (ia->ia_ifa.ifa_carp == NULL || + (*carp_iamatch_p)(&ia->ia_ifa, &enaddr))) { ifa_ref(&ia->ia_ifa); IN_IFADDR_RUNLOCK(); goto match; @@ -643,6 +631,7 @@ in_arpinput(struct mbuf *m) match: if (!enaddr) enaddr = (u_int8_t *)IF_LLADDR(ifp); + carped = (ia->ia_ifa.ifa_carp != NULL); myaddr = ia->ia_addr.sin_addr; ifa_free(&ia->ia_ifa); if (!bcmp(ar_sha(ah), enaddr, ifp->if_addrlen)) @@ -659,9 +648,9 @@ match: * case we suppress the warning to avoid false positive complaints of * potential misconfiguration. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 12:42:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4941F106566C; Fri, 16 Dec 2011 12:42:03 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 381E98FC15; Fri, 16 Dec 2011 12:42:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGCg3CI007131; Fri, 16 Dec 2011 12:42:03 GMT (envelope-from se@svn.freebsd.org) Received: (from se@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGCg3Ph007129; Fri, 16 Dec 2011 12:42:03 GMT (envelope-from se@svn.freebsd.org) Message-Id: <201112161242.pBGCg3Ph007129@svn.freebsd.org> From: Stefan Esser Date: Fri, 16 Dec 2011 12:42:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228572 - head/sys/dev/drm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 12:42:03 -0000 Author: se Date: Fri Dec 16 12:42:02 2011 New Revision: 228572 URL: http://svn.freebsd.org/changeset/base/228572 Log: Fix format string Z --> z, since the former is a deprecated and (in FreeBSD) unsupported form of the latter. This change has been reviewed and accepted in the -hackers list. Submitted by: Alexander Best Reviewed by: David Schulz Modified: head/sys/dev/drm/mga_drv.h Modified: head/sys/dev/drm/mga_drv.h ============================================================================== --- head/sys/dev/drm/mga_drv.h Fri Dec 16 12:16:56 2011 (r228571) +++ head/sys/dev/drm/mga_drv.h Fri Dec 16 12:42:02 2011 (r228572) @@ -288,7 +288,7 @@ do { \ do { \ if ( MGA_VERBOSE ) { \ DRM_INFO( "BEGIN_DMA( %d )\n", (n) ); \ - DRM_INFO( " space=0x%x req=0x%Zx\n", \ + DRM_INFO( " space=0x%x req=0x%zx\n", \ dev_priv->prim.space, (n) * DMA_BLOCK_SIZE ); \ } \ prim = dev_priv->prim.start; \ @@ -338,7 +338,7 @@ do { \ #define DMA_WRITE( offset, val ) \ do { \ if ( MGA_VERBOSE ) { \ - DRM_INFO( " DMA_WRITE( 0x%08x ) at 0x%04Zx\n", \ + DRM_INFO( " DMA_WRITE( 0x%08x ) at 0x%04zx\n", \ (u32)(val), write + (offset) * sizeof(u32) ); \ } \ *(volatile u32 *)(prim + write + (offset) * sizeof(u32)) = val; \ From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 12:53:16 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 004E5106564A; Fri, 16 Dec 2011 12:53:15 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E283A8FC08; Fri, 16 Dec 2011 12:53:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGCrFeg007555; Fri, 16 Dec 2011 12:53:15 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGCrF5C007553; Fri, 16 Dec 2011 12:53:15 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201112161253.pBGCrF5C007553@svn.freebsd.org> From: Peter Holm Date: Fri, 16 Dec 2011 12:53:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228573 - in stable/8/sys: conf kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 12:53:16 -0000 Author: pho Date: Fri Dec 16 12:53:15 2011 New Revision: 228573 URL: http://svn.freebsd.org/changeset/base/228573 Log: MFC: r228360 Move cpu_set_upcall(newtd, td) up before the first call of thread_free(newtd). This to avoid a possible page fault in cpu_thread_clean() as seen on amd64 with syscall fuzzing. Modified: stable/8/sys/kern/kern_thr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_thr.c ============================================================================== --- stable/8/sys/kern/kern_thr.c Fri Dec 16 12:42:02 2011 (r228572) +++ stable/8/sys/kern/kern_thr.c Fri Dec 16 12:53:15 2011 (r228573) @@ -188,6 +188,8 @@ create_thread(struct thread *td, mcontex if (newtd == NULL) return (ENOMEM); + cpu_set_upcall(newtd, td); + /* * Try the copyout as soon as we allocate the td so we don't * have to tear things down in a failure case below. @@ -215,8 +217,6 @@ create_thread(struct thread *td, mcontex newtd->td_proc = td->td_proc; newtd->td_ucred = crhold(td->td_ucred); - cpu_set_upcall(newtd, td); - if (ctx != NULL) { /* old way to set user context */ error = set_mcontext(newtd, ctx); if (error != 0) { From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 13:30:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC0B8106566C; Fri, 16 Dec 2011 13:30:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA6D88FC14; Fri, 16 Dec 2011 13:30:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGDUHA6008719; Fri, 16 Dec 2011 13:30:17 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGDUH5W008716; Fri, 16 Dec 2011 13:30:17 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112161330.pBGDUH5W008716@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 16 Dec 2011 13:30:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228574 - in head: sbin/ifconfig sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 13:30:17 -0000 Author: glebius Date: Fri Dec 16 13:30:17 2011 New Revision: 228574 URL: http://svn.freebsd.org/changeset/base/228574 Log: Since size of struct in_aliasreq has just been changed in r228571, and thus ifconfig(8) needs recompile, it is a good chance to make parameter checks on SIOCAIFADDR arguments more strict. Modified: head/sbin/ifconfig/af_inet.c head/sys/netinet/in.c Modified: head/sbin/ifconfig/af_inet.c ============================================================================== --- head/sbin/ifconfig/af_inet.c Fri Dec 16 12:53:15 2011 (r228573) +++ head/sbin/ifconfig/af_inet.c Fri Dec 16 13:30:17 2011 (r228574) @@ -126,6 +126,7 @@ in_getaddr(const char *s, int which) *p = '/'; errx(1, "%s: bad value (width %s)", s, errstr); } + min->sin_family = AF_INET; min->sin_len = sizeof(*min); min->sin_addr.s_addr = htonl(~((1LL << (32 - masklen)) - 1) & 0xffffffff); Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Fri Dec 16 12:53:15 2011 (r228573) +++ head/sys/netinet/in.c Fri Dec 16 13:30:17 2011 (r228574) @@ -253,16 +253,10 @@ in_control(struct socket *so, u_long cmd sizeof(struct sockaddr_in) || ifra->ifra_broadaddr.sin_family != AF_INET)) return (EINVAL); -#if 0 - /* - * ifconfig(8) historically doesn't set af_family for mask - * for unknown reason. - */ if (ifra->ifra_mask.sin_len != 0 && (ifra->ifra_mask.sin_len != sizeof(struct sockaddr_in) || ifra->ifra_mask.sin_family != AF_INET)) return (EINVAL); -#endif break; case SIOCSIFADDR: case SIOCSIFBRDADDR: From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 14:19:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21994106564A; Fri, 16 Dec 2011 14:19:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FE588FC0A; Fri, 16 Dec 2011 14:19:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGEJkUR010242; Fri, 16 Dec 2011 14:19:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGEJkhH010240; Fri, 16 Dec 2011 14:19:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201112161419.pBGEJkhH010240@svn.freebsd.org> From: Alexander Motin Date: Fri, 16 Dec 2011 14:19:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228575 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 14:19:47 -0000 Author: mav Date: Fri Dec 16 14:19:46 2011 New Revision: 228575 URL: http://svn.freebsd.org/changeset/base/228575 Log: Some formatting fixes. Submitted by: ru Modified: head/share/man/man4/eventtimers.4 Modified: head/share/man/man4/eventtimers.4 ============================================================================== --- head/share/man/man4/eventtimers.4 Fri Dec 16 13:30:17 2011 (r228574) +++ head/share/man/man4/eventtimers.4 Fri Dec 16 14:19:46 2011 (r228575) @@ -46,16 +46,22 @@ statistics, time keeping, profiling and .Xr callout 9 mechanism. These purposes now grouped into three main callbacks: -.Bl -tag -.It hardclock() +.Bl -tag -width ".Fn hardclock" +.It Fn hardclock .Xr callout 9 -and timekeeping events entry. Called with frequency defined by hz variable, +and timekeeping events entry. +Called with frequency defined by +.Va hz +variable, usually 1000Hz. -.It statclock() -statistics and scheduler events entry. Called with frequency about 128Hz. -.It profclock() -profiler events entry. When enabled, called with frequency about 8KHz. +.It Fn statclock +statistics and scheduler events entry. +Called with frequency about 128Hz. +.It Fn profclock +profiler events entry. +When enabled, called with frequency about 8KHz. .El +.Pp Different platforms provide different kinds of timer hardware. The goal of the event timers subsystem is to provide unified way to control that hardware, and to use it, supplying kernel with all required time-based @@ -80,11 +86,13 @@ kern.eventtimer.et.HPET.flags: 7 kern.eventtimer.et.HPET.frequency: 14318180 kern.eventtimer.et.HPET.quality: 550 .Ed -, where: -.Bl -tag +.Pp +where: +.Bl -inset .It Va kern.eventtimer.et. Ns Ar X Ns Va .flags +is a bitmask, defining event timer capabilities: -.Bl -tag -compact +.Bl -tag -offset indent -width indent -compact .It 1 periodic mode supported, .It 2 @@ -97,8 +105,10 @@ timer may stop when CPU goes to sleep st timer supports only power-of-2 divisors. .El .It Va kern.eventtimer.et. Ns Ar X Ns Va .frequency +is a timer base frequency, .It Va kern.eventtimer.et. Ns Ar X Ns Va .quality +is an integral value, defining how good is this timer, comparing to others. .El .Pp @@ -107,7 +117,7 @@ Current choice can be read and affected .Va kern.eventtimer.timer tunable/sysctl. Several other tunables/sysctls are affecting how exactly this timer is used: -.Bl -tag +.Bl -inset .It Va kern.eventtimer.periodic allows to choose periodic and one-shot operation mode. In periodic mode, periodic interrupts from timer hardware are taken as the @@ -119,15 +129,22 @@ Default value depends of chosen timer ca preferred, until other is forced by user or hardware. .It Va kern.eventtimer.singlemul in periodic mode specifies how much times higher timer frequency should be, -to not strictly alias hardclock() and statclock() events. Default values are +to not strictly alias +.Fn hardclock +and +.Fn statclock +events. +Default values are 1, 2 or 4, depending on configured HZ value. .It Va kern.eventtimer.idletick makes each CPU to receive every timer interrupt independently of whether they -busy or not. By default this options is disabled. If chosen timer is per-CPU +busy or not. +By default this options is disabled. +If chosen timer is per-CPU and runs in periodic mode, this option has no effect - all interrupts are always generating. .El .Sh SEE ALSO -.Xr attimer 4 , .Xr atrtc 4 , +.Xr attimer 4 , .Xr hpet 4 From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 14:28:35 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30491106566B; Fri, 16 Dec 2011 14:28:35 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DC278FC16; Fri, 16 Dec 2011 14:28:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGESYUg010581; Fri, 16 Dec 2011 14:28:34 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGESYhn010576; Fri, 16 Dec 2011 14:28:34 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112161428.pBGESYhn010576@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 16 Dec 2011 14:28:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228576 - in head: . sys/boot/forth sys/modules sys/modules/carp sys/modules/if_carp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 14:28:35 -0000 Author: glebius Date: Fri Dec 16 14:28:34 2011 New Revision: 228576 URL: http://svn.freebsd.org/changeset/base/228576 Log: - Rename if_carp.ko to carp.ko. - carp.ko depends on sha1.c Added: head/sys/modules/carp/ - copied from r228573, head/sys/modules/if_carp/ Deleted: head/sys/modules/if_carp/ Modified: head/ObsoleteFiles.inc head/sys/boot/forth/loader.conf head/sys/modules/Makefile head/sys/modules/carp/Makefile Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Fri Dec 16 14:19:46 2011 (r228575) +++ head/ObsoleteFiles.inc Fri Dec 16 14:28:34 2011 (r228576) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20111216: carp(4) module renamed +OLD_FILES+=boot/kernel/if_carp.ko # 20111214: eventtimers(7) moved to eventtimers(4) OLD_FILES+=usr/share/man/man7/eventtimers.7.gz # 20111125: amd(4) removed Modified: head/sys/boot/forth/loader.conf ============================================================================== --- head/sys/boot/forth/loader.conf Fri Dec 16 14:19:46 2011 (r228575) +++ head/sys/boot/forth/loader.conf Fri Dec 16 14:28:34 2011 (r228576) @@ -260,6 +260,7 @@ pf_load="NO" # packet filter bridgestp_load="NO" # if_bridge(4) support miibus_load="NO" # miibus support, needed for some drivers +carp_load="NO" # carp(4) protocol if_ae_load="NO" # Attansic/Atheros L2 FastEthernet if_age_load="NO" # Attansic/Atheros L1 Gigabit Ethernet if_alc_load="NO" # Atheros AR8131/AR8132 Ethernet @@ -275,7 +276,6 @@ if_bridge_load="NO" # if_bridge(4) devi if_bwi_load="NO" # Broadcom BCM53xx IEEE 802.11b/g wireness NICs if_bwn_load="NO" # Broadcom BCM43xx IEEE 802.11 wireless NICs if_bxe_load="NO" # Broadcom NetXtreme II 10Gb Ethernet -if_carp_load="NO" # carp(4) devices if_cas_load="NO" # Sun Cassini/Cassini+ and NS DP83065 Saturn if_cm_load="NO" # SMC (90c26, 90c56, 90c66) if_cs_load="NO" # Crystal Semiconductor CS8920 Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Fri Dec 16 14:19:46 2011 (r228575) +++ head/sys/modules/Makefile Fri Dec 16 14:28:34 2011 (r228576) @@ -50,6 +50,7 @@ SUBDIR= ${_3dfx} \ ${_canbepm} \ ${_canbus} \ ${_cardbus} \ + ${_carp} \ cas \ ${_cbb} \ cc \ @@ -117,7 +118,6 @@ SUBDIR= ${_3dfx} \ ${_ida} \ ${_ie} \ if_bridge \ - ${_if_carp} \ if_disc \ if_edsc \ if_ef \ @@ -374,7 +374,7 @@ _if_gre= if_gre .if (${MK_INET_SUPPORT} != "no" || ${MK_INET6_SUPPORT} != "no") || \ defined(ALL_MODULES) -_if_carp= if_carp +_carp= carp .endif .if ${MK_IPFILTER} != "no" || defined(ALL_MODULES) Modified: head/sys/modules/carp/Makefile ============================================================================== --- head/sys/modules/if_carp/Makefile Fri Dec 16 12:53:15 2011 (r228573) +++ head/sys/modules/carp/Makefile Fri Dec 16 14:28:34 2011 (r228576) @@ -1,12 +1,14 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../netinet +.PATH: ${.CURDIR}/../../crypto .include -KMOD= if_carp -SRCS= ip_carp.c -SRCS+= opt_carp.h opt_bpf.h opt_inet.h opt_inet6.h vnode_if.h +KMOD= carp +SRCS= ip_carp.c sha1.c +SRCS+= device_if.h bus_if.h vnode_if.h +SRCS+= opt_carp.h opt_bpf.h opt_inet.h opt_inet6.h opt_ofed.h .if !defined(KERNBUILDDIR) .if ${MK_INET_SUPPORT} != "no" From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 14:30:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5428A106566C; Fri, 16 Dec 2011 14:30:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 41E1C8FC16; Fri, 16 Dec 2011 14:30:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGEUxrj010717; Fri, 16 Dec 2011 14:30:59 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGEUxbb010714; Fri, 16 Dec 2011 14:30:59 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112161430.pBGEUxbb010714@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 16 Dec 2011 14:30:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228577 - head/sbin/ifconfig X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 14:30:59 -0000 Author: glebius Date: Fri Dec 16 14:30:58 2011 New Revision: 228577 URL: http://svn.freebsd.org/changeset/base/228577 Log: Rename ifcarp.c to carp.c Added: head/sbin/ifconfig/carp.c - copied unchanged from r228576, head/sbin/ifconfig/ifcarp.c Deleted: head/sbin/ifconfig/ifcarp.c Modified: head/sbin/ifconfig/Makefile Modified: head/sbin/ifconfig/Makefile ============================================================================== --- head/sbin/ifconfig/Makefile Fri Dec 16 14:28:34 2011 (r228576) +++ head/sbin/ifconfig/Makefile Fri Dec 16 14:30:58 2011 (r228577) @@ -38,7 +38,7 @@ SRCS+= ifieee80211.c regdomain.c # SIOC[ DPADD+= ${LIBBSDXML} ${LIBJAIL} ${LIBSBUF} LDADD+= -lbsdxml -ljail -lsbuf -SRCS+= ifcarp.c # SIOC[GS]VH support +SRCS+= carp.c # SIOC[GS]VH support SRCS+= ifgroup.c # ... SRCS+= ifpfsync.c # pfsync(4) support Copied: head/sbin/ifconfig/carp.c (from r228576, head/sbin/ifconfig/ifcarp.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ifconfig/carp.c Fri Dec 16 14:30:58 2011 (r228577, copy of r228576, head/sbin/ifconfig/ifcarp.c) @@ -0,0 +1,228 @@ +/* $FreeBSD$ */ +/* from $OpenBSD: ifconfig.c,v 1.82 2003/10/19 05:43:35 mcbride Exp $ */ + +/* + * Copyright (c) 2002 Michael Shalayeff. All rights reserved. + * Copyright (c) 2003 Ryan McBride. 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 ``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 HIS RELATIVES BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ifconfig.h" + +static const char *carp_states[] = { CARP_STATES }; + +static void carp_status(int s); +static void setcarp_vhid(const char *, int, int, const struct afswtch *rafp); +static void setcarp_callback(int, void *); +static void setcarp_advbase(const char *,int, int, const struct afswtch *rafp); +static void setcarp_advskew(const char *, int, int, const struct afswtch *rafp); +static void setcarp_passwd(const char *, int, int, const struct afswtch *rafp); + +static int carpr_vhid = -1; +static int carpr_advskew = -1; +static int carpr_advbase = -1; +static int carpr_state = -1; +static unsigned char const *carpr_key; + +static void +carp_status(int s) +{ + struct carpreq carpr[CARP_MAXVHID]; + int i; + + bzero(carpr, sizeof(struct carpreq) * CARP_MAXVHID); + carpr[0].carpr_count = CARP_MAXVHID; + ifr.ifr_data = (caddr_t)&carpr; + + if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1) + return; + + for (i = 0; i < carpr[0].carpr_count; i++) { + printf("\tcarp: %s vhid %d advbase %d advskew %d", + carp_states[carpr[i].carpr_state], carpr[i].carpr_vhid, + carpr[i].carpr_advbase, carpr[i].carpr_advskew); + if (printkeys && carpr[i].carpr_key[0] != '\0') + printf(" key \"%s\"\n", carpr[i].carpr_key); + else + printf("\n"); + } +} + +static void +setcarp_vhid(const char *val, int d, int s, const struct afswtch *afp) +{ + + carpr_vhid = atoi(val); + + if (carpr_vhid <= 0 || carpr_vhid > CARP_MAXVHID) + errx(1, "vhid must be greater than 0 and less than %u", + CARP_MAXVHID); + + switch (afp->af_af) { +#ifdef INET + case AF_INET: + { + struct in_aliasreq *ifra; + + ifra = (struct in_aliasreq *)afp->af_addreq; + ifra->ifra_vhid = carpr_vhid; + break; + } +#endif +#ifdef INET6 + case AF_INET6: + { + struct in6_aliasreq *ifra; + + ifra = (struct in6_aliasreq *)afp->af_addreq; + ifra->ifra_vhid = carpr_vhid; + break; + } +#endif + default: + errx(1, "%s doesn't support carp(4)", afp->af_name); + } + + callback_register(setcarp_callback, NULL); +} + +static void +setcarp_callback(int s, void *arg __unused) +{ + struct carpreq carpr; + + bzero(&carpr, sizeof(struct carpreq)); + carpr.carpr_vhid = carpr_vhid; + carpr.carpr_count = 1; + ifr.ifr_data = (caddr_t)&carpr; + + if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1 && errno != ENOENT) + err(1, "SIOCGVH"); + + if (carpr_key != NULL) + /* XXX Should hash the password into the key here? */ + strlcpy(carpr.carpr_key, carpr_key, CARP_KEY_LEN); + if (carpr_advskew > -1) + carpr.carpr_advskew = carpr_advskew; + if (carpr_advbase > -1) + carpr.carpr_advbase = carpr_advbase; + if (carpr_state > -1) + carpr.carpr_state = carpr_state; + + if (ioctl(s, SIOCSVH, (caddr_t)&ifr) == -1) + err(1, "SIOCSVH"); +} + +static void +setcarp_passwd(const char *val, int d, int s, const struct afswtch *afp) +{ + + if (carpr_vhid == -1) + errx(1, "passwd requires vhid"); + + carpr_key = val; +} + +static void +setcarp_advskew(const char *val, int d, int s, const struct afswtch *afp) +{ + + if (carpr_vhid == -1) + errx(1, "advskew requires vhid"); + + carpr_advskew = atoi(val); +} + +static void +setcarp_advbase(const char *val, int d, int s, const struct afswtch *afp) +{ + + if (carpr_vhid == -1) + errx(1, "advbase requires vhid"); + + carpr_advbase = atoi(val); +} + +static void +setcarp_state(const char *val, int d, int s, const struct afswtch *afp) +{ + int i; + + if (carpr_vhid == -1) + errx(1, "state requires vhid"); + + for (i = 0; i <= CARP_MAXSTATE; i++) + if (strcasecmp(carp_states[i], val) == 0) { + carpr_state = i; + return; + } + + errx(1, "unknown state"); +} + +static struct cmd carp_cmds[] = { + DEF_CMD_ARG("advbase", setcarp_advbase), + DEF_CMD_ARG("advskew", setcarp_advskew), + DEF_CMD_ARG("pass", setcarp_passwd), + DEF_CMD_ARG("vhid", setcarp_vhid), + DEF_CMD_ARG("state", setcarp_state), +}; +static struct afswtch af_carp = { + .af_name = "af_carp", + .af_af = AF_UNSPEC, + .af_other_status = carp_status, +}; + +static __constructor void +carp_ctor(void) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + int i; + + for (i = 0; i < N(carp_cmds); i++) + cmd_register(&carp_cmds[i]); + af_register(&af_carp); +#undef N +} From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 15:00:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D2D01065786; Fri, 16 Dec 2011 15:00:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BF848FC1A; Fri, 16 Dec 2011 15:00:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGF0uOk012302; Fri, 16 Dec 2011 15:00:56 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGF0uST012300; Fri, 16 Dec 2011 15:00:56 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112161500.pBGF0uST012300@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 15:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228578 - head/lib/libthread_db X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 15:00:57 -0000 Author: dim Date: Fri Dec 16 15:00:56 2011 New Revision: 228578 URL: http://svn.freebsd.org/changeset/base/228578 Log: In lib/libthread_db/arch/i386/libpthread_md.c, clang gives two incorrect warnings about alignment, so turn -Wcast-align off for now. MFC after: 1 week Modified: head/lib/libthread_db/Makefile Modified: head/lib/libthread_db/Makefile ============================================================================== --- head/lib/libthread_db/Makefile Fri Dec 16 14:30:58 2011 (r228577) +++ head/lib/libthread_db/Makefile Fri Dec 16 15:00:56 2011 (r228578) @@ -16,4 +16,10 @@ SYM_MAPS+=${.CURDIR}/Symbol.map SYMBOL_MAPS=${SYM_MAPS} VERSION_DEF=${.CURDIR}/../libc/Versions.def +.if ${CC:T:Mclang} == "clang" +# Unfortunately, clang gives an incorrect warning about alignment in +# arch/i386/libpthread_md.c, so turn that off for now. +NO_WCAST_ALIGN= +.endif + .include From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 15:04:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C85A2106564A; Fri, 16 Dec 2011 15:04:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B662F8FC0C; Fri, 16 Dec 2011 15:04:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGF4lG6012543; Fri, 16 Dec 2011 15:04:47 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGF4lYp012541; Fri, 16 Dec 2011 15:04:47 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112161504.pBGF4lYp012541@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 15:04:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228579 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 15:04:47 -0000 Author: dim Date: Fri Dec 16 15:04:47 2011 New Revision: 228579 URL: http://svn.freebsd.org/changeset/base/228579 Log: In cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c, some uint64_t values are snprintf'd using %llx. On amd64, uint64_t is typedef'd as unsigned long, so cast the values to u_longlong_t, as is done similarly in the rest of the file. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Fri Dec 16 15:00:56 2011 (r228578) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c Fri Dec 16 15:04:47 2011 (r228579) @@ -873,7 +873,7 @@ dt_print_stack(dtrace_hdl_t *dtp, FILE * if (pc > sym.st_value) { (void) snprintf(c, sizeof (c), "%s`%s+0x%llx", dts.dts_object, dts.dts_name, - pc - sym.st_value); + (u_longlong_t)(pc - sym.st_value)); } else { (void) snprintf(c, sizeof (c), "%s`%s", dts.dts_object, dts.dts_name); @@ -886,9 +886,10 @@ dt_print_stack(dtrace_hdl_t *dtp, FILE * */ if (dtrace_lookup_by_addr(dtp, pc, NULL, &dts) == 0) { (void) snprintf(c, sizeof (c), "%s`0x%llx", - dts.dts_object, pc); + dts.dts_object, (u_longlong_t)pc); } else { - (void) snprintf(c, sizeof (c), "0x%llx", pc); + (void) snprintf(c, sizeof (c), "0x%llx", + (u_longlong_t)pc); } } From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 15:12:42 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B68D1106566B; Fri, 16 Dec 2011 15:12:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A4A958FC12; Fri, 16 Dec 2011 15:12:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGFCglg013002; Fri, 16 Dec 2011 15:12:42 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGFCgm0013000; Fri, 16 Dec 2011 15:12:42 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112161512.pBGFCgm0013000@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 15:12:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228580 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 15:12:42 -0000 Author: dim Date: Fri Dec 16 15:12:42 2011 New Revision: 228580 URL: http://svn.freebsd.org/changeset/base/228580 Log: In cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c, some uint64_t values are snprintf'd using %llx. On amd64, uint64_t is typedef'd as unsigned long, so cast the values to u_longlong_t, as is done similarly in the rest of the file. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c Fri Dec 16 15:04:47 2011 (r228579) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c Fri Dec 16 15:12:42 2011 (r228580) @@ -335,7 +335,8 @@ dt_handle_cpudrop(dtrace_hdl_t *dtp, pro } (void) snprintf(s, size, "%llu %sdrop%s on CPU %d\n", - howmany, what == DTRACEDROP_PRINCIPAL ? "" : "aggregation ", + (u_longlong_t)howmany, + what == DTRACEDROP_PRINCIPAL ? "" : "aggregation ", howmany > 1 ? "s" : "", cpu); if (dtp->dt_drophdlr == NULL) @@ -427,7 +428,8 @@ dt_handle_status(dtrace_hdl_t *dtp, dtra size = sizeof (str); } - (void) snprintf(s, size, "%llu %s%s%s\n", nval - oval, + (void) snprintf(s, size, "%llu %s%s%s\n", + (u_longlong_t)(nval - oval), _dt_droptab[i].dtdrt_str, (nval - oval > 1) ? "s" : "", _dt_droptab[i].dtdrt_msg != NULL ? _dt_droptab[i].dtdrt_msg : ""); From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 15:38:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 357F8106564A; Fri, 16 Dec 2011 15:38:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 243A78FC16; Fri, 16 Dec 2011 15:38:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGFcBqY013852; Fri, 16 Dec 2011 15:38:11 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGFcBCQ013850; Fri, 16 Dec 2011 15:38:11 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112161538.pBGFcBCQ013850@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 15:38:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228581 - head/libexec/bootpd/bootpgw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 15:38:12 -0000 Author: dim Date: Fri Dec 16 15:38:11 2011 New Revision: 228581 URL: http://svn.freebsd.org/changeset/base/228581 Log: In libexec/bootpd/bootpgw/bootpgw.c, add a cast for the remaining minutes of activity, to avoid a warning on platforms where time_t is a 32-bit integer. MFC after: 1 week Modified: head/libexec/bootpd/bootpgw/bootpgw.c Modified: head/libexec/bootpd/bootpgw/bootpgw.c ============================================================================== --- head/libexec/bootpd/bootpgw/bootpgw.c Fri Dec 16 15:12:42 2011 (r228580) +++ head/libexec/bootpd/bootpgw/bootpgw.c Fri Dec 16 15:38:11 2011 (r228581) @@ -452,7 +452,7 @@ main(argc, argv) } if (!(readfds & (1 << s))) { report(LOG_INFO, "exiting after %ld minutes of inactivity", - actualtimeout.tv_sec / 60); + (long)(actualtimeout.tv_sec / 60)); exit(0); } ra_len = sizeof(recv_addr); From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 15:44:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E171B1065672; Fri, 16 Dec 2011 15:44:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D04A28FC0C; Fri, 16 Dec 2011 15:44:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGFiCCv014077; Fri, 16 Dec 2011 15:44:12 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGFiCXR014075; Fri, 16 Dec 2011 15:44:12 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112161544.pBGFiCXR014075@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 15:44:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228582 - head/libexec/getty X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 15:44:13 -0000 Author: dim Date: Fri Dec 16 15:44:12 2011 New Revision: 228582 URL: http://svn.freebsd.org/changeset/base/228582 Log: In libexec/getty/chat.c, replace && with & in chat_send(). The intent is to test if the CHATDEBUG_SEND bit is set in the chat_debug global. MFC after: 1 week Modified: head/libexec/getty/chat.c Modified: head/libexec/getty/chat.c ============================================================================== --- head/libexec/getty/chat.c Fri Dec 16 15:38:11 2011 (r228581) +++ head/libexec/getty/chat.c Fri Dec 16 15:44:12 2011 (r228582) @@ -388,7 +388,7 @@ chat_send(char const *str) { int r = 0; - if (chat_debug && CHATDEBUG_SEND) + if (chat_debug & CHATDEBUG_SEND) syslog(LOG_DEBUG, "chat_send '%s'", cleanstr(str, strlen(str))); if (*str) { From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 15:47:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A72C3106564A; Fri, 16 Dec 2011 15:47:44 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94BEB8FC1A; Fri, 16 Dec 2011 15:47:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGFli27014228; Fri, 16 Dec 2011 15:47:44 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGFliEn014218; Fri, 16 Dec 2011 15:47:44 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201112161547.pBGFliEn014218@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Fri, 16 Dec 2011 15:47:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228583 - head/sys/fs/ext2fs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 15:47:44 -0000 Author: pfg Date: Fri Dec 16 15:47:43 2011 New Revision: 228583 URL: http://svn.freebsd.org/changeset/base/228583 Log: Style cleanups by jh@. Fix a comment from the previous commit. Use M_ZERO instead of bzero() in ext2_vfsops.c Add include guards from PR. PR: 162564 Approved by: jhb (mentor) MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_alloc.c head/sys/fs/ext2fs/ext2_balloc.c head/sys/fs/ext2fs/ext2_bmap.c head/sys/fs/ext2fs/ext2_inode.c head/sys/fs/ext2fs/ext2_lookup.c head/sys/fs/ext2fs/ext2_vfsops.c head/sys/fs/ext2fs/ext2_vnops.c head/sys/fs/ext2fs/ext2fs.h head/sys/fs/ext2fs/fs.h Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Fri Dec 16 15:44:12 2011 (r228582) +++ head/sys/fs/ext2fs/ext2_alloc.c Fri Dec 16 15:47:43 2011 (r228583) @@ -364,7 +364,7 @@ ext2_valloc(pvp, mode, cred, vpp) * ext2_dirpref else obtain it using ino_to_cg. The preferred inode is * always the next inode. */ - if((mode & IFMT) == IFDIR) { + if ((mode & IFMT) == IFDIR) { cg = ext2_dirpref(pip); if (fs->e2fs_contigdirs[cg] < 255) fs->e2fs_contigdirs[cg]++; @@ -557,13 +557,13 @@ ext2_blkpref(ip, lbn, indx, bap, blocknr /* if the next block is actually what we thought it is, then set the goal to what we thought it should be */ - if(ip->i_next_alloc_block == lbn && ip->i_next_alloc_goal != 0) + if (ip->i_next_alloc_block == lbn && ip->i_next_alloc_goal != 0) return ip->i_next_alloc_goal; /* now check whether we were provided with an array that basically tells us previous blocks to which we want to stay closeby */ - if(bap) + if (bap) for (tmp = indx - 1; tmp >= 0; tmp--) if (bap[tmp]) return bap[tmp]; Modified: head/sys/fs/ext2fs/ext2_balloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_balloc.c Fri Dec 16 15:44:12 2011 (r228582) +++ head/sys/fs/ext2fs/ext2_balloc.c Fri Dec 16 15:47:43 2011 (r228583) @@ -156,7 +156,7 @@ ext2_balloc(ip, lbn, size, cred, bpp, fl */ pref = 0; if ((error = ext2_getlbns(vp, lbn, indirs, &num)) != 0) - return(error); + return (error); #ifdef DIAGNOSTIC if (num < 1) panic ("ext2_balloc: ext2_getlbns returned indirect block"); Modified: head/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- head/sys/fs/ext2fs/ext2_bmap.c Fri Dec 16 15:44:12 2011 (r228582) +++ head/sys/fs/ext2fs/ext2_bmap.c Fri Dec 16 15:47:43 2011 (r228583) @@ -215,7 +215,7 @@ ext2_bmaparray(vp, bn, bnp, runp, runb) ++bn, ++*runp); bn = ap->in_off; if (runb && bn) { - for(--bn; bn >= 0 && *runb < maxrun && + for (--bn; bn >= 0 && *runb < maxrun && is_sequential(ump, ((int32_t *)bp->b_data)[bn], ((int32_t *)bp->b_data)[bn+1]); --bn, ++*runb); Modified: head/sys/fs/ext2fs/ext2_inode.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode.c Fri Dec 16 15:44:12 2011 (r228582) +++ head/sys/fs/ext2fs/ext2_inode.c Fri Dec 16 15:47:43 2011 (r228583) @@ -229,7 +229,7 @@ ext2_truncate(vp, length, flags, cred, t * will be returned to the free list. lastiblock values are also * normalized to -1 for calls to ext2_indirtrunc below. */ - bcopy((caddr_t)&oip->i_db[0], (caddr_t)oldblks, sizeof oldblks); + bcopy((caddr_t)&oip->i_db[0], (caddr_t)oldblks, sizeof(oldblks)); for (level = TRIPLE; level >= SINGLE; level--) if (lastiblock[level] < 0) { oip->i_ib[level] = 0; @@ -246,8 +246,8 @@ ext2_truncate(vp, length, flags, cred, t * Note that we save the new block configuration so we can check it * when we are done. */ - bcopy((caddr_t)&oip->i_db[0], (caddr_t)newblks, sizeof newblks); - bcopy((caddr_t)oldblks, (caddr_t)&oip->i_db[0], sizeof oldblks); + bcopy((caddr_t)&oip->i_db[0], (caddr_t)newblks, sizeof(newblks)); + bcopy((caddr_t)oldblks, (caddr_t)&oip->i_db[0], sizeof(oldblks)); oip->i_size = osize; error = vtruncbuf(ovp, cred, td, length, (int)fs->e2fs_bsize); if (error && (allerror == 0)) @@ -418,7 +418,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, le copy = malloc(fs->e2fs_bsize, M_TEMP, M_WAITOK); bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->e2fs_bsize); bzero((caddr_t)&bap[last + 1], - (u_int)(NINDIR(fs) - (last + 1)) * sizeof (int32_t)); + (u_int)(NINDIR(fs) - (last + 1)) * sizeof(int32_t)); if (last == -1) bp->b_flags |= B_INVAL; error = bwrite(bp); Modified: head/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- head/sys/fs/ext2fs/ext2_lookup.c Fri Dec 16 15:44:12 2011 (r228582) +++ head/sys/fs/ext2fs/ext2_lookup.c Fri Dec 16 15:47:43 2011 (r228583) @@ -1002,7 +1002,7 @@ ext2_dirempty(ip, parentino, cred) struct dirtemplate dbuf; struct ext2fs_direct_2 *dp = (struct ext2fs_direct_2 *)&dbuf; int error, count, namlen; -#define MINDIRSIZ (sizeof (struct dirtemplate) / 2) +#define MINDIRSIZ (sizeof(struct dirtemplate) / 2) for (off = 0; off < ip->i_size; off += dp->e2d_reclen) { error = vn_rdwr(UIO_READ, ITOV(ip), (caddr_t)dp, MINDIRSIZ, @@ -1070,7 +1070,7 @@ ext2_checkpath(source, target, cred) break; } error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf, - sizeof (struct dirtemplate), (off_t)0, UIO_SYSSPACE, + sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, NULL, NULL); if (error != 0) Modified: head/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vfsops.c Fri Dec 16 15:44:12 2011 (r228582) +++ head/sys/fs/ext2fs/ext2_vfsops.c Fri Dec 16 15:47:43 2011 (r228583) @@ -349,7 +349,7 @@ compute_sb_data(struct vnode *devvp, str } fs->e2fs_ipb = fs->e2fs_bsize / EXT2_INODE_SIZE(fs); fs->e2fs_itpg = fs->e2fs_ipg /fs->e2fs_ipb; - fs->e2fs_descpb = fs->e2fs_bsize / sizeof (struct ext2_gd); + fs->e2fs_descpb = fs->e2fs_bsize / sizeof(struct ext2_gd); /* s_resuid / s_resgid ? */ fs->e2fs_gcount = (es->e2fs_bcount - es->e2fs_first_dblock + EXT2_BLOCKS_PER_GROUP(fs) - 1) / EXT2_BLOCKS_PER_GROUP(fs); @@ -583,8 +583,7 @@ ext2_mountfs(struct vnode *devvp, struct goto out; } } - ump = malloc(sizeof *ump, M_EXT2MNT, M_WAITOK); - bzero((caddr_t)ump, sizeof *ump); + ump = malloc(sizeof(*ump), M_EXT2MNT, M_WAITOK | M_ZERO); /* * I don't know whether this is the right strategy. Note that @@ -602,8 +601,8 @@ ext2_mountfs(struct vnode *devvp, struct /* * Calculate the maximum contiguous blocks and size of cluster summary - * array. In FFS this is done by newfs; however the superblock in - * ext2fs doesn't have these variables so we just can calculate + * array. In FFS this is done by newfs; however, the superblock + * in ext2fs doesn't have these variables, so we can calculate * them here. */ ump->um_e2fs->e2fs_maxcontig = MAX(1, MAXPHYS / ump->um_e2fs->e2fs_bsize); @@ -978,7 +977,7 @@ ext2_vget(struct mount *mp, ino_t ino, i */ if(S_ISDIR(ip->i_mode) || S_ISREG(ip->i_mode)) { used_blocks = (ip->i_size+fs->e2fs_bsize-1) / fs->e2fs_bsize; - for(i = used_blocks; i < EXT2_NDIR_BLOCKS; i++) + for (i = used_blocks; i < EXT2_NDIR_BLOCKS; i++) ip->i_db[i] = 0; } /* Modified: head/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- head/sys/fs/ext2fs/ext2_vnops.c Fri Dec 16 15:44:12 2011 (r228582) +++ head/sys/fs/ext2fs/ext2_vnops.c Fri Dec 16 15:47:43 2011 (r228583) @@ -1080,7 +1080,7 @@ abortit: dp->i_nlink--; dp->i_flag |= IN_CHANGE; error = vn_rdwr(UIO_READ, fvp, (caddr_t)&dirbuf, - sizeof (struct dirtemplate), (off_t)0, + sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK, tcnp->cn_cred, NOCRED, NULL, NULL); if (error == 0) { @@ -1095,7 +1095,7 @@ abortit: dirbuf.dotdot_ino = newparent; (void) vn_rdwr(UIO_WRITE, fvp, (caddr_t)&dirbuf, - sizeof (struct dirtemplate), + sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_SYNC | IO_NOMACCHECK, tcnp->cn_cred, @@ -1233,7 +1233,7 @@ ext2_mkdir(ap) #define DIRBLKSIZ VTOI(dvp)->i_e2fs->e2fs_bsize dirtemplate.dotdot_reclen = DIRBLKSIZ - 12; error = vn_rdwr(UIO_WRITE, tvp, (caddr_t)&dirtemplate, - sizeof (dirtemplate), (off_t)0, UIO_SYSSPACE, + sizeof(dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_SYNC | IO_NOMACCHECK, cnp->cn_cred, NOCRED, NULL, NULL); if (error) { Modified: head/sys/fs/ext2fs/ext2fs.h ============================================================================== --- head/sys/fs/ext2fs/ext2fs.h Fri Dec 16 15:44:12 2011 (r228582) +++ head/sys/fs/ext2fs/ext2fs.h Fri Dec 16 15:47:43 2011 (r228583) @@ -34,8 +34,8 @@ * */ -#ifndef _FS_EXT2FS_EXT2_FS_H_ -#define _FS_EXT2FS_EXT2_FS_H_ +#ifndef _FS_EXT2FS_EXT2FS_H_ +#define _FS_EXT2FS_EXT2FS_H_ #include @@ -62,7 +62,7 @@ #define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1) #define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1) #define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1) -#define EXT2_MAXSYMLINKLEN (EXT2_N_BLOCKS * sizeof (uint32_t)) +#define EXT2_MAXSYMLINKLEN (EXT2_N_BLOCKS * sizeof(uint32_t)) /* * The path name on which the file system is mounted is maintained @@ -292,7 +292,7 @@ struct csum { #else # define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->e2fs_log_bsize) #endif -#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (uint32_t)) +#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(uint32_t)) #if defined(_KERNEL) # define EXT2_BLOCK_SIZE_BITS(s) ((s)->e2fs_blocksize_bits) #else @@ -332,7 +332,7 @@ struct csum { # define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits) #else # define EXT2_BLOCKS_PER_GROUP(s) ((s)->e2fs_bpg) -# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_gd)) +# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(struct ext2_gd)) #endif Modified: head/sys/fs/ext2fs/fs.h ============================================================================== --- head/sys/fs/ext2fs/fs.h Fri Dec 16 15:44:12 2011 (r228582) +++ head/sys/fs/ext2fs/fs.h Fri Dec 16 15:47:43 2011 (r228583) @@ -36,6 +36,9 @@ * $FreeBSD$ */ +#ifndef _FS_EXT2FS_FS_H_ +#define _FS_EXT2FS_FS_H_ + /* * Each disk drive contains some number of file systems. * A file system consists of a number of cylinder groups. @@ -149,4 +152,4 @@ extern int inside[], around[]; extern u_char *fragtbl[]; - +#endif /* !_FS_EXT2FS_FS_H_ */ From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 15:55:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1B66106566B; Fri, 16 Dec 2011 15:55:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E04A78FC1B; Fri, 16 Dec 2011 15:55:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGFthVA014571; Fri, 16 Dec 2011 15:55:43 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGFthQQ014569; Fri, 16 Dec 2011 15:55:43 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112161555.pBGFthQQ014569@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 15:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228584 - head/libexec/bootpd/tools/bootptest X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 15:55:44 -0000 Author: dim Date: Fri Dec 16 15:55:43 2011 New Revision: 228584 URL: http://svn.freebsd.org/changeset/base/228584 Log: In libexec/bootpd/tools/bootptest/print-bootp.c, use the correct printf length modifier for the difference between two pointers. MFC after: 1 week Modified: head/libexec/bootpd/tools/bootptest/print-bootp.c Modified: head/libexec/bootpd/tools/bootptest/print-bootp.c ============================================================================== --- head/libexec/bootpd/tools/bootptest/print-bootp.c Fri Dec 16 15:47:43 2011 (r228583) +++ head/libexec/bootpd/tools/bootptest/print-bootp.c Fri Dec 16 15:55:43 2011 (r228584) @@ -310,7 +310,7 @@ rfc1048_print(bp, length) len = *bp++; if (bp + len > ep) { /* truncated option */ - printf(" |(%d>%d)", len, ep - bp); + printf(" |(%d>%td)", len, ep - bp); return; } /* Print the option value(s). */ From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 15:58:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7A301065676; Fri, 16 Dec 2011 15:58:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D657D8FC1F; Fri, 16 Dec 2011 15:58:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGFwcQd014774; Fri, 16 Dec 2011 15:58:38 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGFwcJb014772; Fri, 16 Dec 2011 15:58:38 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112161558.pBGFwcJb014772@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 15:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228585 - head/libexec/mail.local X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 15:58:39 -0000 Author: dim Date: Fri Dec 16 15:58:38 2011 New Revision: 228585 URL: http://svn.freebsd.org/changeset/base/228585 Log: Unfortunately, clang gives warnings about sendmail code that cannot be turned off yet. Since this is contrib code, and we don't really care about the warnings, just turn make them non-fatal for now. MFC after: 1 week Modified: head/libexec/mail.local/Makefile Modified: head/libexec/mail.local/Makefile ============================================================================== --- head/libexec/mail.local/Makefile Fri Dec 16 15:55:43 2011 (r228584) +++ head/libexec/mail.local/Makefile Fri Dec 16 15:58:38 2011 (r228585) @@ -12,6 +12,13 @@ CFLAGS+=-I${SENDMAIL_DIR}/include -I. WARNS?= 2 WFORMAT=0 +.if ${CC:T:Mclang} == "clang" +# Unfortunately, clang gives warnings about sendmail code that cannot +# be turned off yet. Since this is contrib code, and we don't really +# care about the warnings, just turn make them non-fatal for now. +NO_WERROR= +.endif + LIBSMDIR= ${.OBJDIR}/../../lib/libsm LIBSM= ${LIBSMDIR}/libsm.a From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 16:07:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C35781065670; Fri, 16 Dec 2011 16:07:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1FCE8FC13; Fri, 16 Dec 2011 16:07:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGG7dgW015347; Fri, 16 Dec 2011 16:07:39 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGG7dGs015345; Fri, 16 Dec 2011 16:07:39 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112161607.pBGG7dGs015345@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 16:07:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228586 - head/libexec/pppoed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 16:07:39 -0000 Author: dim Date: Fri Dec 16 16:07:39 2011 New Revision: 228586 URL: http://svn.freebsd.org/changeset/base/228586 Log: In libexec/pppoed/pppoed.c, use the correct printf length modifier for a size_t. MFC after: 1 week Modified: head/libexec/pppoed/pppoed.c Modified: head/libexec/pppoed/pppoed.c ============================================================================== --- head/libexec/pppoed/pppoed.c Fri Dec 16 15:58:38 2011 (r228585) +++ head/libexec/pppoed/pppoed.c Fri Dec 16 16:07:39 2011 (r228586) @@ -570,8 +570,8 @@ main(int argc, char *argv[]) } exec = (char *)alloca(sizeof DEFAULT_EXEC_PREFIX + strlen(label)); if (exec == NULL) { - fprintf(stderr, "%s: Cannot allocate %d bytes\n", prog, - (int)(sizeof DEFAULT_EXEC_PREFIX) + strlen(label)); + fprintf(stderr, "%s: Cannot allocate %zu bytes\n", prog, + sizeof DEFAULT_EXEC_PREFIX + strlen(label)); return EX_OSERR; } strcpy(exec, DEFAULT_EXEC_PREFIX); From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 16:29:51 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E94541065670; Fri, 16 Dec 2011 16:29:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D80128FC12; Fri, 16 Dec 2011 16:29:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGGTpQN016716; Fri, 16 Dec 2011 16:29:51 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGGTprj016714; Fri, 16 Dec 2011 16:29:51 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112161629.pBGGTprj016714@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 16:29:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228587 - head/libexec/rbootd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 16:29:52 -0000 Author: dim Date: Fri Dec 16 16:29:51 2011 New Revision: 228587 URL: http://svn.freebsd.org/changeset/base/228587 Log: In libexec/rbootd/utils.c, use the correct printf length modifiers for u_int32_t and size_t. MFC after: 1 week Modified: head/libexec/rbootd/utils.c Modified: head/libexec/rbootd/utils.c ============================================================================== --- head/libexec/rbootd/utils.c Fri Dec 16 16:07:39 2011 (r228586) +++ head/libexec/rbootd/utils.c Fri Dec 16 16:29:51 2011 (r228587) @@ -82,8 +82,8 @@ static const char rcsid[] = void DispPkt(RMPCONN *rconn, int direct) { - static const char BootFmt[] = "\t\tRetCode:%u SeqNo:%lx SessID:%x Vers:%u"; - static const char ReadFmt[] = "\t\tRetCode:%u Offset:%lx SessID:%x\n"; + static const char BootFmt[] = "\t\tRetCode:%u SeqNo:%x SessID:%x Vers:%u"; + static const char ReadFmt[] = "\t\tRetCode:%u Offset:%x SessID:%x\n"; struct tm *tmp; struct rmp_packet *rmp; @@ -166,7 +166,7 @@ DispPkt(RMPCONN *rconn, int direct) GETWORD(rmp->r_rrpl.rmp_offset, t); (void) fprintf(DbgFp, ReadFmt, rmp->r_rrpl.rmp_retcode, t, ntohs(rmp->r_rrpl.rmp_session)); - (void) fprintf(DbgFp, "\t\tNoOfBytesSent: %d\n", + (void) fprintf(DbgFp, "\t\tNoOfBytesSent: %zu\n", rconn->rmplen - RMPREADSIZE(0)); break; case RMP_BOOT_DONE: /* boot complete */ From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 16:32:08 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A41091065670; Fri, 16 Dec 2011 16:32:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92CE88FC18; Fri, 16 Dec 2011 16:32:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGGW8K3016888; Fri, 16 Dec 2011 16:32:08 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGGW85h016886; Fri, 16 Dec 2011 16:32:08 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112161632.pBGGW85h016886@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 16:32:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228588 - head/libexec/smrsh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 16:32:08 -0000 Author: dim Date: Fri Dec 16 16:32:08 2011 New Revision: 228588 URL: http://svn.freebsd.org/changeset/base/228588 Log: Unfortunately, clang gives warnings about sendmail code that cannot be turned off yet. Since this is contrib code, and we don't really care about the warnings, just turn make them non-fatal for now. MFC after: 1 week Modified: head/libexec/smrsh/Makefile Modified: head/libexec/smrsh/Makefile ============================================================================== --- head/libexec/smrsh/Makefile Fri Dec 16 16:29:51 2011 (r228587) +++ head/libexec/smrsh/Makefile Fri Dec 16 16:32:08 2011 (r228588) @@ -17,6 +17,13 @@ LDADD= ${LIBSM} WARNS?= 2 +.if ${CC:T:Mclang} == "clang" +# Unfortunately, clang gives warnings about sendmail code that cannot +# be turned off yet. Since this is contrib code, and we don't really +# care about the warnings, just turn make them non-fatal for now. +NO_WERROR= +.endif + SRCS+= sm_os.h CLEANFILES+=sm_os.h From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 16:53:55 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6D8AC106566B; Fri, 16 Dec 2011 16:53:55 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C1F68FC16; Fri, 16 Dec 2011 16:53:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGGrtUO018199; Fri, 16 Dec 2011 16:53:55 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGGrtXk018197; Fri, 16 Dec 2011 16:53:55 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112161653.pBGGrtXk018197@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 16:53:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228589 - head/contrib/telnet/telnetd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 16:53:55 -0000 Author: dim Date: Fri Dec 16 16:53:54 2011 New Revision: 228589 URL: http://svn.freebsd.org/changeset/base/228589 Log: In contrib/telnet/telnetd/utility.c, fix a few warnings about format strings not being literals. MFC after: 1 week Modified: head/contrib/telnet/telnetd/utility.c Modified: head/contrib/telnet/telnetd/utility.c ============================================================================== --- head/contrib/telnet/telnetd/utility.c Fri Dec 16 16:32:08 2011 (r228588) +++ head/contrib/telnet/telnetd/utility.c Fri Dec 16 16:53:54 2011 (r228589) @@ -847,22 +847,22 @@ printsub(char direction, unsigned char * for (i = 2; i < length; i++ ) { switch (pointer[i]) { case NEW_ENV_VAR: - output_data("\" VAR " + noquote); + output_data("%s", "\" VAR " + noquote); noquote = 2; break; case NEW_ENV_VALUE: - output_data("\" VALUE " + noquote); + output_data("%s", "\" VALUE " + noquote); noquote = 2; break; case ENV_ESC: - output_data("\" ESC " + noquote); + output_data("%s", "\" ESC " + noquote); noquote = 2; break; case ENV_USERVAR: - output_data("\" USERVAR " + noquote); + output_data("%s", "\" USERVAR " + noquote); noquote = 2; break; From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 17:02:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B33B31065670; Fri, 16 Dec 2011 17:02:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8703E8FC08; Fri, 16 Dec 2011 17:02:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGH2Q8M018743; Fri, 16 Dec 2011 17:02:26 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGH2QRB018739; Fri, 16 Dec 2011 17:02:26 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112161702.pBGH2QRB018739@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 17:02:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228590 - in head: lib/libsm libexec/mail.local libexec/smrsh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 17:02:26 -0000 Author: dim Date: Fri Dec 16 17:02:25 2011 New Revision: 228590 URL: http://svn.freebsd.org/changeset/base/228590 Log: Fix typos in the comments about clang warnings in several sendmail-related Makefiles. Spotted by: arundel MFC after: 1 week Modified: head/lib/libsm/Makefile head/libexec/mail.local/Makefile head/libexec/smrsh/Makefile Modified: head/lib/libsm/Makefile ============================================================================== --- head/lib/libsm/Makefile Fri Dec 16 16:53:54 2011 (r228589) +++ head/lib/libsm/Makefile Fri Dec 16 17:02:25 2011 (r228590) @@ -19,9 +19,9 @@ CFLAGS+=${SENDMAIL_CFLAGS} WARNS?= 2 .if ${CC:T:Mclang} == "clang" -# Unfortunately, clang gives a warning about sendmail code that cannot +# Unfortunately, clang gives warnings about sendmail code that cannot # be turned off yet. Since this is contrib code, and we don't really -# care about the warnings, just turn make them non-fatal for now. +# care about the warnings, just make them non-fatal for now. NO_WERROR= .endif Modified: head/libexec/mail.local/Makefile ============================================================================== --- head/libexec/mail.local/Makefile Fri Dec 16 16:53:54 2011 (r228589) +++ head/libexec/mail.local/Makefile Fri Dec 16 17:02:25 2011 (r228590) @@ -15,7 +15,7 @@ WFORMAT=0 .if ${CC:T:Mclang} == "clang" # Unfortunately, clang gives warnings about sendmail code that cannot # be turned off yet. Since this is contrib code, and we don't really -# care about the warnings, just turn make them non-fatal for now. +# care about the warnings, just make them non-fatal for now. NO_WERROR= .endif Modified: head/libexec/smrsh/Makefile ============================================================================== --- head/libexec/smrsh/Makefile Fri Dec 16 16:53:54 2011 (r228589) +++ head/libexec/smrsh/Makefile Fri Dec 16 17:02:25 2011 (r228590) @@ -20,7 +20,7 @@ WARNS?= 2 .if ${CC:T:Mclang} == "clang" # Unfortunately, clang gives warnings about sendmail code that cannot # be turned off yet. Since this is contrib code, and we don't really -# care about the warnings, just turn make them non-fatal for now. +# care about the warnings, just make them non-fatal for now. NO_WERROR= .endif From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 17:08:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1E2B106564A; Fri, 16 Dec 2011 17:08:18 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id 266D78FC17; Fri, 16 Dec 2011 17:08:17 +0000 (UTC) Received: by ghrr19 with SMTP id r19so3508256ghr.13 for ; Fri, 16 Dec 2011 09:08:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=NhsdEhdlgSSt3vJG6DcQCCrW2j2+1nl/q9OmQqugI4A=; b=Wvtp710jSAfnxsuHq/+6C09GbjL3ZqaYXgMyxZZrFFA7PyfAYtitXhhNf8J5k5H2IC jwmJp/eHQE333+z1KBJs08xq5xT11zfBbaqiXIDbV7eZKe3Amr7501cTW9faNmERh0g9 jUgj1rA7YLA8/hMyS67gJfsTMU9mojHpbVJ5Y= MIME-Version: 1.0 Received: by 10.101.92.12 with SMTP id u12mr4047035anl.7.1324055297264; Fri, 16 Dec 2011 09:08:17 -0800 (PST) Received: by 10.236.110.40 with HTTP; Fri, 16 Dec 2011 09:08:17 -0800 (PST) In-Reply-To: <201112161216.pBGCGu8B006328@svn.freebsd.org> References: <201112161216.pBGCGu8B006328@svn.freebsd.org> Date: Fri, 16 Dec 2011 12:08:17 -0500 Message-ID: From: Ben Kaduk To: Gleb Smirnoff Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228571 - in head: . lib/libc/net sbin/ifconfig share/man/man4 sys/net sys/netinet sys/netinet6 sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 17:08:18 -0000 On 12/16/11, Gleb Smirnoff wrote: > Author: glebius > Date: Fri Dec 16 12:16:56 2011 > New Revision: 228571 > URL: http://svn.freebsd.org/changeset/base/228571 > > Log: > A major overhaul of the CARP implementation. The ip_carp.c was started > from scratch, copying needed functionality from the old implemenation > on demand, with a thorough review of all code. The main change is that > interface layer has been removed from the CARP. Now redundant addresses > are configured exactly on the interfaces, they run on. > > The CARP configuration itself is, as before, configured and read via > SIOCSVH/SIOCGVH ioctls. A new prefix created with SIOCAIFADDR or > SIOCAIFADDR_IN6 may now be configured to a particular virtual host id, > which makes the prefix redundant. > > ifconfig(8) semantics has been changed too: now one doesn't need > to clone carpXX interface, he/she should directly configure a vhid > on a Ethernet interface. > > To supply vhid data from the kernel to an application the getifaddrs(8) > function had been changed to pass ifam_data with each address. [1] > > The new implementation definitely closes all PRs related to carp(4) > being an interface, and may close several others. It also allows > to run a single redundant IP per interface. > > Big thanks to Bjoern Zeeb for his help with inet6 part of patch, for > idea on using ifam_data and for several rounds of reviewing! > > PR: kern/117000, kern/126945, kern/126714, kern/120130, kern/117448 > Reviewed by: bz > Submitted by: bz [1] > > Modified: > head/UPDATING > head/lib/libc/net/getifaddrs.c > head/sbin/ifconfig/af_inet.c > head/sbin/ifconfig/af_inet6.c > head/sbin/ifconfig/ifcarp.c > head/sbin/ifconfig/ifconfig.8 > head/sbin/ifconfig/ifconfig.c > head/sbin/ifconfig/ifconfig.h > head/share/man/man4/carp.4 > head/sys/net/if.c > head/sys/net/if.h > head/sys/net/if_ethersubr.c > head/sys/net/if_types.h > head/sys/net/if_var.h > head/sys/net/rtsock.c > head/sys/netinet/if_ether.c > head/sys/netinet/if_ether.h > head/sys/netinet/in.c > head/sys/netinet/in_var.h > head/sys/netinet/ip_carp.c > head/sys/netinet/ip_carp.h > head/sys/netinet6/in6.c > head/sys/netinet6/in6_ifattach.c > head/sys/netinet6/in6_var.h > head/sys/netinet6/nd6.c > head/sys/netinet6/nd6_nbr.c > head/sys/sys/param.h > > Modified: head/UPDATING > ============================================================================== ============================== > --- head/share/man/man4/carp.4 Fri Dec 16 11:52:33 2011 (r228570) > +++ head/share/man/man4/carp.4 Fri Dec 16 12:16:56 2011 (r228571) > @@ -1,6 +1,7 @@ > .\" $OpenBSD: carp.4,v 1.16 2004/12/07 23:41:35 jmc Exp $ > .\" > .\" Copyright (c) 2003, Ryan McBride. All rights reserved. > +.\" Copyright (c) 2011, Gleb Smirnoff > .\" > .\" Redistribution and use in source and binary forms, with or without > .\" modification, are permitted provided that the following conditions > @@ -138,36 +131,36 @@ Value of 0 means that preemption is not > problems are detected. > Every problem increments suppression counter. > .El > -.Sh ARP level load balancing > -The > -.Nm > -has limited abilities for load balancing the incoming connections > -between hosts in Ethernet network. > -For load balancing operation, one needs several CARP interfaces that > -are configured to the same IP address, but to a different VHIDs. > -Once an ARP request is received, the CARP protocol will use a hashing > -function against the source IP address in the ARP request to determine > -which VHID should this request belong to. > -If the corresponding CARP interface is in master state, the ARP request > -will be replied, otherwise it will be ignored. > -See the > -.Sx EXAMPLES > -section for a practical example of load balancing. > -.Pp > -The ARP load balancing has some limitations. > -First, ARP balancing only works on the local network segment. > -It cannot balance traffic that crosses a router, because the > -router itself will always be balanced to the same virtual host. > -Second, ARP load balancing can lead to asymmetric routing > -of incoming and outgoing traffic, and thus combining it with > -.Xr pfsync 4 > -is dangerous, because this creates a race condition between > -balanced routers and a host they are serving. > -Imagine an incoming packet creating state on the first router, being > -forwarded to its destination, and destination replying faster > -than the state information is packed and synced with the second router. > -If the reply would be load balanced to second router, it will be > -dropped due to no state. > +.\".Sh ARP level load balancing > +.\"The > +.\".Nm > +.\"has limited abilities for load balancing the incoming connections > +.\"between hosts in Ethernet network. > +.\"For load balancing operation, one needs several CARP interfaces that > +.\"are configured to the same IP address, but to a different vhids. > +.\"Once an ARP request is received, the CARP protocol will use a hashing > +.\"function against the source IP address in the ARP request to determine > +.\"which vhid should this request belong to. > +.\"If the corresponding CARP interface is in master state, the ARP request > +.\"will be replied, otherwise it will be ignored. > +.\"See the > +.\".Sx EXAMPLES > +.\"section for a practical example of load balancing. > +.\".Pp > +.\"The ARP load balancing has some limitations. > +.\"First, ARP balancing only works on the local network segment. > +.\"It cannot balance traffic that crosses a router, because the > +.\"router itself will always be balanced to the same virtual host. > +.\"Second, ARP load balancing can lead to asymmetric routing > +.\"of incoming and outgoing traffic, and thus combining it with > +.\".Xr pfsync 4 > +.\"is dangerous, because this creates a race condition between > +.\"balanced routers and a host they are serving. > +.\"Imagine an incoming packet creating state on the first router, being > +.\"forwarded to its destination, and destination replying faster > +.\"than the state information is packed and synced with the second router. > +.\"If the reply would be load balanced to second router, it will be > +.\"dropped due to no state. > .Sh STATE CHANGE NOTIFICATIONS > Sometimes it is useful to get notified about > .Nm Hi Gleb, Perhaps the man page portions that were commented out should just be removed entirely? -Ben Kaduk From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 19:39:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A17B106566B; Fri, 16 Dec 2011 19:39:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5EE928FC08; Fri, 16 Dec 2011 19:39:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGJdo2n024020; Fri, 16 Dec 2011 19:39:50 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGJdomr024015; Fri, 16 Dec 2011 19:39:50 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112161939.pBGJdomr024015@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 19:39:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228592 - head/libexec/ypxfr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 19:39:50 -0000 Author: dim Date: Fri Dec 16 19:39:49 2011 New Revision: 228592 URL: http://svn.freebsd.org/changeset/base/228592 Log: Attempt to fix the numerous incompatible enum conversions in libexec/ypxfr in the least disruptive way. MFC after: 1 week Modified: head/libexec/ypxfr/yp_dbwrite.c head/libexec/ypxfr/ypxfr_extern.h head/libexec/ypxfr/ypxfr_getmap.c head/libexec/ypxfr/ypxfr_main.c Modified: head/libexec/ypxfr/yp_dbwrite.c ============================================================================== --- head/libexec/ypxfr/yp_dbwrite.c Fri Dec 16 19:38:31 2011 (r228591) +++ head/libexec/ypxfr/yp_dbwrite.c Fri Dec 16 19:39:49 2011 (r228592) @@ -58,10 +58,10 @@ yp_open_db_rw(const char *domain, const char buf[1025]; - yp_errno = YP_TRUE; + yp_errno = YPXFR_SUCC; if (map[0] == '.' || strchr(map, '/')) { - yp_errno = YP_BADARGS; + yp_errno = YPXFR_BADARGS; return (NULL); } @@ -73,13 +73,13 @@ yp_open_db_rw(const char *domain, const if (dbp == NULL) { switch (errno) { case ENOENT: - yp_errno = YP_NOMAP; + yp_errno = YPXFR_NOMAP; break; case EFTYPE: - yp_errno = YP_BADDB; + yp_errno = YPXFR_MADDR; break; default: - yp_errno = YP_YPERR; + yp_errno = YPXFR_YPERR; break; } } Modified: head/libexec/ypxfr/ypxfr_extern.h ============================================================================== --- head/libexec/ypxfr/ypxfr_extern.h Fri Dec 16 19:38:31 2011 (r228591) +++ head/libexec/ypxfr/ypxfr_extern.h Fri Dec 16 19:39:49 2011 (r228592) @@ -46,7 +46,7 @@ extern BTREEINFO openinfo_b; extern char *yp_dir; extern int debug; -extern enum ypstat yp_errno; +extern ypxfrstat yp_errno; extern void yp_error(const char *, ...); extern int _yp_check(char **); extern const char *ypxfrerr_string(ypxfrstat); Modified: head/libexec/ypxfr/ypxfr_getmap.c ============================================================================== --- head/libexec/ypxfr/ypxfr_getmap.c Fri Dec 16 19:38:31 2011 (r228591) +++ head/libexec/ypxfr/ypxfr_getmap.c Fri Dec 16 19:39:49 2011 (r228592) @@ -46,7 +46,6 @@ extern bool_t xdr_ypresp_all_seq(XDR *, int (*ypresp_allfn)(); void *ypresp_data; extern DB *specdbp; -extern enum ypstat yp_errno; /* * This is largely the same as yp_all() except we do the transfer Modified: head/libexec/ypxfr/ypxfr_main.c ============================================================================== --- head/libexec/ypxfr/ypxfr_main.c Fri Dec 16 19:38:31 2011 (r228591) +++ head/libexec/ypxfr/ypxfr_main.c Fri Dec 16 19:39:49 2011 (r228592) @@ -88,7 +88,7 @@ ypxfr_exit(ypxfrstat retval, char *temp) exit(1); } - ypxfr_resp.status = retval; + ypxfr_resp.status = (yppush_status)retval; if (yppushproc_xfrresp_1(&ypxfr_resp, clnt) == NULL) { yp_error("%s", clnt_sperror(clnt, "callback failed")); From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 20:10:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D5BE106566B; Fri, 16 Dec 2011 20:10:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 285D88FC08; Fri, 16 Dec 2011 20:10:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGKA1Tq024946; Fri, 16 Dec 2011 20:10:01 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGKA1mW024944; Fri, 16 Dec 2011 20:10:01 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201112162010.pBGKA1mW024944@svn.freebsd.org> From: John Baldwin Date: Fri, 16 Dec 2011 20:10:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228593 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 20:10:01 -0000 Author: jhb Date: Fri Dec 16 20:10:00 2011 New Revision: 228593 URL: http://svn.freebsd.org/changeset/base/228593 Log: Fire a kevent if necessary after seeking on a regular file. This fixes a case where a kevent would not fire on a regular file if an application read to EOF and then seeked backwards into the file. Reviewed by: kib MFC after: 2 weeks Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Fri Dec 16 19:39:49 2011 (r228592) +++ head/sys/kern/vfs_syscalls.c Fri Dec 16 20:10:00 2011 (r228593) @@ -2050,6 +2050,7 @@ sys_lseek(td, uap) if (error != 0) goto drop; fp->f_offset = offset; + VFS_KNOTE_UNLOCKED(vp, 0); *(off_t *)(td->td_retval) = fp->f_offset; drop: fdrop(fp, td); From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 20:38:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4099106566B; Fri, 16 Dec 2011 20:38:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D28828FC17; Fri, 16 Dec 2011 20:38:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGKcM0S025864; Fri, 16 Dec 2011 20:38:22 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGKcMXW025862; Fri, 16 Dec 2011 20:38:22 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201112162038.pBGKcMXW025862@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 16 Dec 2011 20:38:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228594 - head/tools/tools/cxgbetool X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 20:38:23 -0000 Author: np Date: Fri Dec 16 20:38:22 2011 New Revision: 228594 URL: http://svn.freebsd.org/changeset/base/228594 Log: Catch up with new driver ioctls in cxgbe. MFC after: 1 month Modified: head/tools/tools/cxgbetool/cxgbetool.c Modified: head/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- head/tools/tools/cxgbetool/cxgbetool.c Fri Dec 16 20:10:00 2011 (r228593) +++ head/tools/tools/cxgbetool/cxgbetool.c Fri Dec 16 20:38:22 2011 (r228594) @@ -30,14 +30,17 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include #include #include +#include #include #include +#include #include #include #include @@ -83,10 +86,13 @@ usage(FILE *fp) "\tfilter delete|clear delete a filter\n" "\tfilter list list all filters\n" "\tfilter mode [] ... get/set global filter mode\n" + "\tloadfw install firmware\n" + "\tmemdump dump a memory range\n" "\treg
[=] read/write register\n" "\treg64
[=] read/write 64 bit register\n" "\tregdump [] ... dump registers\n" "\tstdio interactive mode\n" + "\ttcb read TCB\n" ); } @@ -1353,6 +1359,169 @@ get_sge_context(int argc, const char *ar } static int +loadfw(int argc, const char *argv[]) +{ + int rc, fd; + struct t4_data data = {0}; + const char *fname = argv[0]; + struct stat st = {0}; + + if (argc != 1) { + warnx("loadfw: incorrect number of arguments."); + return (EINVAL); + } + + fd = open(fname, O_RDONLY); + if (fd < 0) { + warn("open(%s)", fname); + return (errno); + } + + if (fstat(fd, &st) < 0) { + warn("fstat"); + close(fd); + return (errno); + } + + data.len = st.st_size; + data.data = mmap(0, data.len, PROT_READ, 0, fd, 0); + if (data.data == MAP_FAILED) { + warn("mmap"); + close(fd); + return (errno); + } + + rc = doit(CHELSIO_T4_LOAD_FW, &data); + munmap(data.data, data.len); + close(fd); + return (rc); +} + +static int +read_mem(uint32_t addr, uint32_t len, void (*output)(uint32_t *, uint32_t)) +{ + int rc; + struct t4_mem_range mr; + + mr.addr = addr; + mr.len = len; + mr.data = malloc(mr.len); + + if (mr.data == 0) { + warn("read_mem: malloc"); + return (errno); + } + + rc = doit(CHELSIO_T4_GET_MEM, &mr); + if (rc != 0) + goto done; + + if (output) + (*output)(mr.data, mr.len); +done: + free(mr.data); + return (rc); +} + +/* + * Display memory as list of 'n' 4-byte values per line. + */ +static void +show_mem(uint32_t *buf, uint32_t len) +{ + const char *s; + int i, n = 8; + + while (len) { + for (i = 0; len && i < n; i++, buf++, len -= 4) { + s = i ? " " : ""; + printf("%s%08x", s, htonl(*buf)); + } + printf("\n"); + } +} + +static int +memdump(int argc, const char *argv[]) +{ + char *p; + long l; + uint32_t addr, len; + + if (argc != 2) { + warnx("incorrect number of arguments."); + return (EINVAL); + } + + p = str_to_number(argv[0], &l, NULL); + if (*p) { + warnx("invalid address \"%s\"", argv[0]); + return (EINVAL); + } + addr = l; + + p = str_to_number(argv[1], &l, NULL); + if (*p) { + warnx("memdump: invalid length \"%s\"", argv[1]); + return (EINVAL); + } + len = l; + + return (read_mem(addr, len, show_mem)); +} + +/* + * Display TCB as list of 'n' 4-byte values per line. + */ +static void +show_tcb(uint32_t *buf, uint32_t len) +{ + const char *s; + int i, n = 8; + + while (len) { + for (i = 0; len && i < n; i++, buf++, len -= 4) { + s = i ? " " : ""; + printf("%s%08x", s, htonl(*buf)); + } + printf("\n"); + } +} + +#define A_TP_CMM_TCB_BASE 0x7d10 +#define TCB_SIZE 128 +static int +read_tcb(int argc, const char *argv[]) +{ + char *p; + long l; + long long val; + unsigned int tid; + uint32_t addr; + int rc; + + if (argc != 1) { + warnx("incorrect number of arguments."); + return (EINVAL); + } + + p = str_to_number(argv[0], &l, NULL); + if (*p) { + warnx("invalid tid \"%s\"", argv[0]); + return (EINVAL); + } + tid = l; + + rc = read_reg(A_TP_CMM_TCB_BASE, 4, &val); + if (rc != 0) + return (rc); + + addr = val + tid * TCB_SIZE; + + return (read_mem(addr, TCB_SIZE, show_tcb)); +} + +static int run_cmd(int argc, const char *argv[]) { int rc = -1; @@ -1372,6 +1541,12 @@ run_cmd(int argc, const char *argv[]) rc = filter_cmd(argc, argv); else if (!strcmp(cmd, "context")) rc = get_sge_context(argc, argv); + else if (!strcmp(cmd, "loadfw")) + rc = loadfw(argc, argv); + else if (!strcmp(cmd, "memdump")) + rc = memdump(argc, argv); + else if (!strcmp(cmd, "tcb")) + rc = read_tcb(argc, argv); else { rc = EINVAL; warnx("invalid command \"%s\"", cmd); From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 21:12:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD707106566C; Fri, 16 Dec 2011 21:12:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 824A78FC08; Fri, 16 Dec 2011 21:12:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGLCNqA026934; Fri, 16 Dec 2011 21:12:23 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGLCNF2026931; Fri, 16 Dec 2011 21:12:23 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112162112.pBGLCNF2026931@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 21:12:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228595 - head/bin/ed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 21:12:23 -0000 Author: dim Date: Fri Dec 16 21:12:23 2011 New Revision: 228595 URL: http://svn.freebsd.org/changeset/base/228595 Log: Fix some obtuse fprintf tricks in bin/ed. MFC after: 1 week Modified: head/bin/ed/io.c head/bin/ed/main.c Modified: head/bin/ed/io.c ============================================================================== --- head/bin/ed/io.c Fri Dec 16 20:38:22 2011 (r228594) +++ head/bin/ed/io.c Fri Dec 16 21:12:23 2011 (r228595) @@ -53,7 +53,8 @@ read_file(char *fn, long n) errmsg = "cannot close input file"; return ERR; } - fprintf(stdout, !scripted ? "%lu\n" : "", size); + if (!scripted) + fprintf(stdout, "%lu\n", size); return current_addr - n; } @@ -161,7 +162,8 @@ write_file(char *fn, const char *mode, l errmsg = "cannot close output file"; return ERR; } - fprintf(stdout, !scripted ? "%lu\n" : "", size); + if (!scripted) + fprintf(stdout, "%lu\n", size); return n ? m - n + 1 : 0; } Modified: head/bin/ed/main.c ============================================================================== --- head/bin/ed/main.c Fri Dec 16 20:38:22 2011 (r228594) +++ head/bin/ed/main.c Fri Dec 16 21:12:23 2011 (r228595) @@ -192,9 +192,10 @@ top: fputs("?\n", stderr); errmsg = "warning: file modified"; if (!isatty(0)) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : - "", lineno, errmsg); + if (garrulous) + fprintf(stderr, + "script, line %d: %s\n", + lineno, errmsg); quit(2); } clearerr(stdin); @@ -225,27 +226,26 @@ top: fputs("?\n", stderr); /* give warning */ errmsg = "warning: file modified"; if (!isatty(0)) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : - "", lineno, errmsg); + if (garrulous) + fprintf(stderr, "script, line %d: %s\n", + lineno, errmsg); quit(2); } break; case FATAL: - if (!isatty(0)) - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : "", - lineno, errmsg); - else - fprintf(stderr, garrulous ? "%s\n" : "", - errmsg); + if (!isatty(0)) { + if (garrulous) + fprintf(stderr, "script, line %d: %s\n", + lineno, errmsg); + } else if (garrulous) + fprintf(stderr, "%s\n", errmsg); quit(3); default: fputs("?\n", stderr); if (!isatty(0)) { - fprintf(stderr, garrulous ? - "script, line %d: %s\n" : "", - lineno, errmsg); + if (garrulous) + fprintf(stderr, "script, line %d: %s\n", + lineno, errmsg); quit(2); } break; From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 21:24:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1105106566B; Fri, 16 Dec 2011 21:24:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B08D08FC0A; Fri, 16 Dec 2011 21:24:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGLOB5U027445; Fri, 16 Dec 2011 21:24:11 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGLOBEq027443; Fri, 16 Dec 2011 21:24:11 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112162124.pBGLOBEq027443@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 21:24:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228596 - head/games/factor X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 21:24:11 -0000 Author: dim Date: Fri Dec 16 21:24:11 2011 New Revision: 228596 URL: http://svn.freebsd.org/changeset/base/228596 Log: In games/factor/factor.c, fix a warning about a format string not being a literal. MFC after: 1 week Modified: head/games/factor/factor.c Modified: head/games/factor/factor.c ============================================================================== --- head/games/factor/factor.c Fri Dec 16 21:12:23 2011 (r228595) +++ head/games/factor/factor.c Fri Dec 16 21:24:11 2011 (r228596) @@ -322,7 +322,7 @@ BN_print_dec_fp(FILE *fp, const BIGNUM * buf = BN_bn2dec(num); if (buf == NULL) return; /* XXX do anything here? */ - fprintf(fp, buf); + fprintf(fp, "%s", buf); free(buf); } From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 21:29:46 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B635F106566B; Fri, 16 Dec 2011 21:29:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A52858FC13; Fri, 16 Dec 2011 21:29:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGLTkuG027643; Fri, 16 Dec 2011 21:29:46 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGLTkDa027641; Fri, 16 Dec 2011 21:29:46 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112162129.pBGLTkDa027641@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 21:29:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228597 - head/cddl/contrib/opensolaris/tools/ctf/cvt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 21:29:46 -0000 Author: dim Date: Fri Dec 16 21:29:46 2011 New Revision: 228597 URL: http://svn.freebsd.org/changeset/base/228597 Log: In cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c, a size_t is passed to fprintf as a field width. It should be an int instead, so cast it. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c Fri Dec 16 21:24:11 2011 (r228596) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c Fri Dec 16 21:29:46 2011 (r228597) @@ -228,7 +228,7 @@ usage(void) "\n" " Note: if -L labelenv is specified and labelenv is not set in\n" " the environment, a default value is used.\n", - progname, progname, strlen(progname), " ", + progname, progname, (int)strlen(progname), " ", progname, progname); } From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 21:48:10 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E4BC106566C; Fri, 16 Dec 2011 21:48:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D13B8FC1A; Fri, 16 Dec 2011 21:48:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGLm969028232; Fri, 16 Dec 2011 21:48:09 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGLm9V3028230; Fri, 16 Dec 2011 21:48:09 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112162148.pBGLm9V3028230@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 21:48:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228598 - head/cddl/contrib/opensolaris/cmd/dtrace X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 21:48:10 -0000 Author: dim Date: Fri Dec 16 21:48:09 2011 New Revision: 228598 URL: http://svn.freebsd.org/changeset/base/228598 Log: In cddl/contrib/opensolaris/cmd/dtrace/dtrace.c, fix some obtuse snprintf tricks. MFC after: 1 week Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Fri Dec 16 21:29:46 2011 (r228597) +++ head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Fri Dec 16 21:48:09 2011 (r228598) @@ -671,9 +671,12 @@ link_prog(dtrace_cmd_t *dcp) p[0] = '\0'; /* strip .d suffix */ (void) snprintf(dcp->dc_ofile, sizeof (dcp->dc_ofile), "%s.o", basename(dcp->dc_arg)); + } else if (g_cmdc > 1) { + (void) snprintf(dcp->dc_ofile, sizeof (dcp->dc_ofile), + "d.out.%td", dcp - g_cmdv); } else { (void) snprintf(dcp->dc_ofile, sizeof (dcp->dc_ofile), - g_cmdc > 1 ? "%s.%d" : "%s", "d.out", (int)(dcp - g_cmdv)); + "d.out"); } if (dtrace_program_link(g_dtp, dcp->dc_prog, DTRACE_D_PROBES, From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 21:57:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11CAA106564A; Fri, 16 Dec 2011 21:57:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAC918FC0A; Fri, 16 Dec 2011 21:57:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGLvi6t028563; Fri, 16 Dec 2011 21:57:44 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGLviCL028558; Fri, 16 Dec 2011 21:57:44 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112162157.pBGLviCL028558@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 21:57:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228599 - head/libexec/ypxfr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 21:57:45 -0000 Author: dim Date: Fri Dec 16 21:57:44 2011 New Revision: 228599 URL: http://svn.freebsd.org/changeset/base/228599 Log: Revert r228592, as the non-messy way of fixing ypxfr breaks other yp programs (e.g. usr.sbin/rpc.yppasswdd). Spotted by: np MFC after: 1 week Modified: head/libexec/ypxfr/yp_dbwrite.c head/libexec/ypxfr/ypxfr_extern.h head/libexec/ypxfr/ypxfr_getmap.c head/libexec/ypxfr/ypxfr_main.c Modified: head/libexec/ypxfr/yp_dbwrite.c ============================================================================== --- head/libexec/ypxfr/yp_dbwrite.c Fri Dec 16 21:48:09 2011 (r228598) +++ head/libexec/ypxfr/yp_dbwrite.c Fri Dec 16 21:57:44 2011 (r228599) @@ -58,10 +58,10 @@ yp_open_db_rw(const char *domain, const char buf[1025]; - yp_errno = YPXFR_SUCC; + yp_errno = YP_TRUE; if (map[0] == '.' || strchr(map, '/')) { - yp_errno = YPXFR_BADARGS; + yp_errno = YP_BADARGS; return (NULL); } @@ -73,13 +73,13 @@ yp_open_db_rw(const char *domain, const if (dbp == NULL) { switch (errno) { case ENOENT: - yp_errno = YPXFR_NOMAP; + yp_errno = YP_NOMAP; break; case EFTYPE: - yp_errno = YPXFR_MADDR; + yp_errno = YP_BADDB; break; default: - yp_errno = YPXFR_YPERR; + yp_errno = YP_YPERR; break; } } Modified: head/libexec/ypxfr/ypxfr_extern.h ============================================================================== --- head/libexec/ypxfr/ypxfr_extern.h Fri Dec 16 21:48:09 2011 (r228598) +++ head/libexec/ypxfr/ypxfr_extern.h Fri Dec 16 21:57:44 2011 (r228599) @@ -46,7 +46,7 @@ extern BTREEINFO openinfo_b; extern char *yp_dir; extern int debug; -extern ypxfrstat yp_errno; +extern enum ypstat yp_errno; extern void yp_error(const char *, ...); extern int _yp_check(char **); extern const char *ypxfrerr_string(ypxfrstat); Modified: head/libexec/ypxfr/ypxfr_getmap.c ============================================================================== --- head/libexec/ypxfr/ypxfr_getmap.c Fri Dec 16 21:48:09 2011 (r228598) +++ head/libexec/ypxfr/ypxfr_getmap.c Fri Dec 16 21:57:44 2011 (r228599) @@ -46,6 +46,7 @@ extern bool_t xdr_ypresp_all_seq(XDR *, int (*ypresp_allfn)(); void *ypresp_data; extern DB *specdbp; +extern enum ypstat yp_errno; /* * This is largely the same as yp_all() except we do the transfer Modified: head/libexec/ypxfr/ypxfr_main.c ============================================================================== --- head/libexec/ypxfr/ypxfr_main.c Fri Dec 16 21:48:09 2011 (r228598) +++ head/libexec/ypxfr/ypxfr_main.c Fri Dec 16 21:57:44 2011 (r228599) @@ -88,7 +88,7 @@ ypxfr_exit(ypxfrstat retval, char *temp) exit(1); } - ypxfr_resp.status = (yppush_status)retval; + ypxfr_resp.status = retval; if (yppushproc_xfrresp_1(&ypxfr_resp, clnt) == NULL) { yp_error("%s", clnt_sperror(clnt, "callback failed")); From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 22:05:10 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C115F106566C; Fri, 16 Dec 2011 22:05:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B02B18FC0C; Fri, 16 Dec 2011 22:05:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGM5ApQ028844; Fri, 16 Dec 2011 22:05:10 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGM5AFF028840; Fri, 16 Dec 2011 22:05:10 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112162205.pBGM5AFF028840@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 22:05:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228600 - head/libexec/ypxfr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 22:05:10 -0000 Author: dim Date: Fri Dec 16 22:05:10 2011 New Revision: 228600 URL: http://svn.freebsd.org/changeset/base/228600 Log: Fix the incompatible enum conversions in libexec/ypxfr in another, more messy way, so as to not disrupt other yp programs: just add casts to convert the incompatible enums, as the numerical values are the same (either by accident, design, or the phase of the moon at that time). MFC after: 1 week Modified: head/libexec/ypxfr/ypxfr_getmap.c head/libexec/ypxfr/ypxfr_main.c head/libexec/ypxfr/ypxfr_misc.c Modified: head/libexec/ypxfr/ypxfr_getmap.c ============================================================================== --- head/libexec/ypxfr/ypxfr_getmap.c Fri Dec 16 21:57:44 2011 (r228599) +++ head/libexec/ypxfr/ypxfr_getmap.c Fri Dec 16 22:05:10 2011 (r228600) @@ -73,7 +73,7 @@ ypxfr_get_map(char *map, char *domain, c if ((clnt = clnt_create(host, YPPROG, YPVERS, "tcp")) == NULL) { yp_error("%s", clnt_spcreateerror("failed to \ create tcp handle")); - yp_errno = YPXFR_YPERR; + yp_errno = (enum ypstat)YPXFR_YPERR; return(1); } @@ -91,7 +91,7 @@ create tcp handle")); return(0); if (status != YP_TRUE) { - yp_errno = YPXFR_YPERR; + yp_errno = (enum ypstat)YPXFR_YPERR; return(1); } Modified: head/libexec/ypxfr/ypxfr_main.c ============================================================================== --- head/libexec/ypxfr/ypxfr_main.c Fri Dec 16 21:57:44 2011 (r228599) +++ head/libexec/ypxfr/ypxfr_main.c Fri Dec 16 22:05:10 2011 (r228600) @@ -88,7 +88,7 @@ ypxfr_exit(ypxfrstat retval, char *temp) exit(1); } - ypxfr_resp.status = retval; + ypxfr_resp.status = (yppush_status)retval; if (yppushproc_xfrresp_1(&ypxfr_resp, clnt) == NULL) { yp_error("%s", clnt_sperror(clnt, "callback failed")); @@ -329,7 +329,7 @@ the local domain name isn't set"); ypxfr_use_yplib)) == NULL) { yp_error("failed to find master of %s in domain %s: %s", ypxfr_mapname, ypxfr_source_domain, - ypxfrerr_string(yp_errno)); + ypxfrerr_string((ypxfrstat)yp_errno)); ypxfr_exit(YPXFR_MADDR,NULL); } } @@ -358,7 +358,8 @@ the local domain name isn't set"); ypxfr_master, 0)) == 0) { yp_error("failed to get order number of %s: %s", ypxfr_mapname, yp_errno == YPXFR_SUCC ? - "map has order 0" : ypxfrerr_string(yp_errno)); + "map has order 0" : + ypxfrerr_string((ypxfrstat)yp_errno)); ypxfr_exit(YPXFR_YPERR,NULL); } @@ -533,7 +534,8 @@ leave: ypxfr_master, 0)) == 0) { yp_error("failed to get order number of %s: %s", ypxfr_mapname, yp_errno == YPXFR_SUCC ? - "map has order 0" : ypxfrerr_string(yp_errno)); + "map has order 0" : + ypxfrerr_string((ypxfrstat)yp_errno)); ypxfr_exit(YPXFR_YPERR,ypxfr_temp_map); } Modified: head/libexec/ypxfr/ypxfr_misc.c ============================================================================== --- head/libexec/ypxfr/ypxfr_misc.c Fri Dec 16 21:57:44 2011 (r228599) +++ head/libexec/ypxfr/ypxfr_misc.c Fri Dec 16 22:05:10 2011 (r228600) @@ -130,14 +130,14 @@ ypxfr_get_master(char *domain, char *map if ((res = yp_master(domain, map, &master))) { switch (res) { case YPERR_DOMAIN: - yp_errno = YPXFR_NODOM; + yp_errno = (enum ypstat)YPXFR_NODOM; break; case YPERR_MAP: - yp_errno = YPXFR_NOMAP; + yp_errno = (enum ypstat)YPXFR_NOMAP; break; case YPERR_YPERR: default: - yp_errno = YPXFR_YPERR; + yp_errno = (enum ypstat)YPXFR_YPERR; break; } return(NULL); @@ -154,7 +154,7 @@ ypxfr_get_master(char *domain, char *map if ((clnt = clnt_create(source,YPPROG,YPVERS,"udp")) == NULL) { yp_error("%s",clnt_spcreateerror("failed to \ create udp handle to ypserv")); - yp_errno = YPXFR_RPC; + yp_errno = (enum ypstat)YPXFR_RPC; return(NULL); } @@ -164,21 +164,21 @@ create udp handle to ypserv")); yp_error("%s",clnt_sperror(clnt,"YPPROC_MASTER \ failed")); clnt_destroy(clnt); - yp_errno = YPXFR_RPC; + yp_errno = (enum ypstat)YPXFR_RPC; return(NULL); } clnt_destroy(clnt); if (resp->stat != YP_TRUE) { switch (resp->stat) { case YP_NODOM: - yp_errno = YPXFR_NODOM; + yp_errno = (enum ypstat)YPXFR_NODOM; break; case YP_NOMAP: - yp_errno = YPXFR_NOMAP; + yp_errno = (enum ypstat)YPXFR_NOMAP; break; case YP_YPERR: default: - yp_errno = YPXFR_YPERR; + yp_errno = (enum ypstat)YPXFR_YPERR; break; } return(NULL); @@ -198,14 +198,14 @@ ypxfr_get_order(char *domain, char *map, if ((res = yp_order(domain, map, &order))) { switch (res) { case YPERR_DOMAIN: - yp_errno = YPXFR_NODOM; + yp_errno = (enum ypstat)YPXFR_NODOM; break; case YPERR_MAP: - yp_errno = YPXFR_NOMAP; + yp_errno = (enum ypstat)YPXFR_NOMAP; break; case YPERR_YPERR: default: - yp_errno = YPXFR_YPERR; + yp_errno = (enum ypstat)YPXFR_YPERR; break; } return(0); @@ -219,7 +219,7 @@ ypxfr_get_order(char *domain, char *map, if ((clnt = clnt_create(source,YPPROG,YPVERS,"udp")) == NULL) { yp_error("%s",clnt_spcreateerror("couldn't create \ udp handle to ypserv")); - yp_errno = YPXFR_RPC; + yp_errno = (enum ypstat)YPXFR_RPC; return(0); } req.map = map; @@ -228,21 +228,21 @@ udp handle to ypserv")); yp_error("%s", clnt_sperror(clnt, "YPPROC_ORDER \ failed")); clnt_destroy(clnt); - yp_errno = YPXFR_RPC; + yp_errno = (enum ypstat)YPXFR_RPC; return(0); } clnt_destroy(clnt); if (resp->stat != YP_TRUE) { switch (resp->stat) { case YP_NODOM: - yp_errno = YPXFR_NODOM; + yp_errno = (enum ypstat)YPXFR_NODOM; break; case YP_NOMAP: - yp_errno = YPXFR_NOMAP; + yp_errno = (enum ypstat)YPXFR_NOMAP; break; case YP_YPERR: default: - yp_errno = YPXFR_YPERR; + yp_errno = (enum ypstat)YPXFR_YPERR; break; } return(0); From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 22:19:13 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8B84106566C; Fri, 16 Dec 2011 22:19:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E2278FC18; Fri, 16 Dec 2011 22:19:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGMJDnE029280; Fri, 16 Dec 2011 22:19:13 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGMJDoB029278; Fri, 16 Dec 2011 22:19:13 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112162219.pBGMJDoB029278@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 22:19:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228601 - head/gnu/usr.bin/binutils/libbinutils X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 22:19:13 -0000 Author: dim Date: Fri Dec 16 22:19:13 2011 New Revision: 228601 URL: http://svn.freebsd.org/changeset/base/228601 Log: Define YY_NO_INPUT when building libbinutils, to prevent warnings about unused input() functions emitted by lex. MFC after: 1 week Modified: head/gnu/usr.bin/binutils/libbinutils/Makefile Modified: head/gnu/usr.bin/binutils/libbinutils/Makefile ============================================================================== --- head/gnu/usr.bin/binutils/libbinutils/Makefile Fri Dec 16 22:05:10 2011 (r228600) +++ head/gnu/usr.bin/binutils/libbinutils/Makefile Fri Dec 16 22:19:13 2011 (r228601) @@ -25,6 +25,7 @@ SRCS+= arlex.l \ CFLAGS+= -DTARGET=\"${TARGET_TUPLE}\" CFLAGS+= -DBFD_VERSION_STRING=\"${VERSION}\" CFLAGS+= -D_GNU_SOURCE +CFLAGS+= -DYY_NO_INPUT CFLAGS+= -I${SRCDIR}/binutils CFLAGS+= -I${SRCDIR}/bfd INTERNALLIB= From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 22:35:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FF6B106566C; Fri, 16 Dec 2011 22:35:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34E338FC12; Fri, 16 Dec 2011 22:35:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGMZKxF029889; Fri, 16 Dec 2011 22:35:20 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGMZK2k029887; Fri, 16 Dec 2011 22:35:20 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112162235.pBGMZK2k029887@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 22:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228602 - head/sbin/camcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 22:35:20 -0000 Author: dim Date: Fri Dec 16 22:35:19 2011 New Revision: 228602 URL: http://svn.freebsd.org/changeset/base/228602 Log: In sbin/camcontrol/camcontrol.c, fix a few warnings about format strings not being literals. MFC after: 1 week Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Fri Dec 16 22:19:13 2011 (r228601) +++ head/sbin/camcontrol/camcontrol.c Fri Dec 16 22:35:19 2011 (r228602) @@ -2506,7 +2506,7 @@ scsicmd(struct cam_device *device, int a if (((retval = cam_send_ccb(device, ccb)) < 0) || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { - const char *warnstr = "error sending command"; + const char warnstr[] = "error sending command"; if (retval < 0) warn(warnstr); @@ -4449,7 +4449,7 @@ smpcmd(struct cam_device *device, int ar if (((retval = cam_send_ccb(device, ccb)) < 0) || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { - const char *warnstr = "error sending command"; + const char warnstr[] = "error sending command"; if (retval < 0) warn(warnstr); @@ -4567,7 +4567,7 @@ try_long: if (((retval = cam_send_ccb(device, ccb)) < 0) || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { - const char *warnstr = "error sending command"; + const char warnstr[] = "error sending command"; if (retval < 0) warn(warnstr); @@ -4872,7 +4872,7 @@ smpphycontrol(struct cam_device *device, if (((retval = cam_send_ccb(device, ccb)) < 0) || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { - const char *warnstr = "error sending command"; + const char warnstr[] = "error sending command"; if (retval < 0) warn(warnstr); @@ -4954,7 +4954,7 @@ smpmaninfo(struct cam_device *device, in if (((retval = cam_send_ccb(device, ccb)) < 0) || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { - const char *warnstr = "error sending command"; + const char warnstr[] = "error sending command"; if (retval < 0) warn(warnstr); @@ -5351,7 +5351,7 @@ smpphylist(struct cam_device *device, in if (((retval = cam_send_ccb(device, ccb)) < 0) || ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) { - const char *warnstr = "error sending command"; + const char warnstr[] = "error sending command"; if (retval < 0) warn(warnstr); @@ -5431,7 +5431,7 @@ smpphylist(struct cam_device *device, in if (((retval = cam_send_ccb(device, ccb)) < 0) || (((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) && (disresponse->function_result != SMP_FR_PHY_VACANT))) { - const char *warnstr = "error sending command"; + const char warnstr[] = "error sending command"; if (retval < 0) warn(warnstr); From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 23:09:31 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5AA3106566B; Fri, 16 Dec 2011 23:09:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B4DE78FC14; Fri, 16 Dec 2011 23:09:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGN9V3i031033; Fri, 16 Dec 2011 23:09:31 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGN9VUI031031; Fri, 16 Dec 2011 23:09:31 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112162309.pBGN9VUI031031@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 23:09:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228603 - head/sbin/fsdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 23:09:31 -0000 Author: dim Date: Fri Dec 16 23:09:31 2011 New Revision: 228603 URL: http://svn.freebsd.org/changeset/base/228603 Log: In sbin/fsdb/fsdbutil.c, work around a clang false positive with printf format warnings and conditional operators. (See LLVM PR 11313 for more information.) MFC after: 1 week Modified: head/sbin/fsdb/fsdbutil.c Modified: head/sbin/fsdb/fsdbutil.c ============================================================================== --- head/sbin/fsdb/fsdbutil.c Fri Dec 16 22:35:19 2011 (r228602) +++ head/sbin/fsdb/fsdbutil.c Fri Dec 16 23:09:31 2011 (r228603) @@ -193,8 +193,9 @@ printstat(const char *cp, ino_t inum, un blocks = DIP(dp, di_blocks); gen = DIP(dp, di_gen); - printf("LINKCNT=%hd FLAGS=%#x BLKCNT=%jx GEN=%jx\n", DIP(dp, di_nlink), - DIP(dp, di_flags), (intmax_t)blocks, (intmax_t)gen); + printf("LINKCNT=%hd FLAGS=%#x BLKCNT=%jx GEN=%jx\n", + (short)DIP(dp, di_nlink), DIP(dp, di_flags), (intmax_t)blocks, + (intmax_t)gen); } From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 23:15:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1468D106566B; Fri, 16 Dec 2011 23:15:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 03AC08FC14; Fri, 16 Dec 2011 23:15:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGNFBTu031276; Fri, 16 Dec 2011 23:15:11 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGNFBrJ031274; Fri, 16 Dec 2011 23:15:11 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112162315.pBGNFBrJ031274@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 23:15:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228604 - head/contrib/gperf/src X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 23:15:12 -0000 Author: dim Date: Fri Dec 16 23:15:11 2011 New Revision: 228604 URL: http://svn.freebsd.org/changeset/base/228604 Log: In contrib/gperf/src/output.cc, use the correct printf length modifier for a ptrdiff_t. MFC after: 1 week Modified: head/contrib/gperf/src/output.cc Modified: head/contrib/gperf/src/output.cc ============================================================================== --- head/contrib/gperf/src/output.cc Fri Dec 16 23:09:31 2011 (r228603) +++ head/contrib/gperf/src/output.cc Fri Dec 16 23:15:11 2011 (r228604) @@ -1300,7 +1300,7 @@ Output::output_lookup_array () const if (option[DEBUG]) fprintf (stderr, - "dup_ptr[%d]: hash_value = %d, index = %d, count = %d\n", + "dup_ptr[%td]: hash_value = %d, index = %d, count = %d\n", dup_ptr - duplicates, dup_ptr->hash_value, dup_ptr->index, dup_ptr->count); From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 23:40:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46ED2106564A; Fri, 16 Dec 2011 23:40:57 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 35BB78FC0A; Fri, 16 Dec 2011 23:40:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGNevtD032530; Fri, 16 Dec 2011 23:40:57 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGNevbe032528; Fri, 16 Dec 2011 23:40:57 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201112162340.pBGNevbe032528@svn.freebsd.org> From: Nathan Whitehorn Date: Fri, 16 Dec 2011 23:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228605 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 23:40:57 -0000 Author: nwhitehorn Date: Fri Dec 16 23:40:56 2011 New Revision: 228605 URL: http://svn.freebsd.org/changeset/base/228605 Log: Zero BSS on start, in case the ELF loader that started the kernel did not do this for us. This can happen on some embedded systems. Submitted by: rpaulo Modified: head/sys/powerpc/aim/locore32.S Modified: head/sys/powerpc/aim/locore32.S ============================================================================== --- head/sys/powerpc/aim/locore32.S Fri Dec 16 23:15:11 2011 (r228604) +++ head/sys/powerpc/aim/locore32.S Fri Dec 16 23:40:56 2011 (r228605) @@ -128,6 +128,17 @@ __start: sync isync + /* Zero bss, in case we were started by something unhelpful */ + li 0,0 + lis 8,_edata@ha + addi 8,8,_edata@l + lis 9,_end@ha + addi 9,9,_end@l +2: stw 0,0(8) + addi 8,8,4 + cmplw 8,9 + blt 2b + /* Save the argument pointer and length */ mr 20,6 mr 21,7 From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 23:42:25 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD525106564A; Fri, 16 Dec 2011 23:42:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CCBFC8FC12; Fri, 16 Dec 2011 23:42:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGNgPYB032610; Fri, 16 Dec 2011 23:42:25 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGNgPil032608; Fri, 16 Dec 2011 23:42:25 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112162342.pBGNgPil032608@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 23:42:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228606 - head/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 23:42:26 -0000 Author: dim Date: Fri Dec 16 23:42:25 2011 New Revision: 228606 URL: http://svn.freebsd.org/changeset/base/228606 Log: Add a NO_WARRAY_BOUNDS setting to bsd.sys.mk, only applicable to clang, to selectively work around warnings in programs that don't use flexible array members, but instead define arrays of length 1 at the end of the struct, and then access those beyond their declared bounds. MFC after: 1 week Modified: head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Fri Dec 16 23:40:56 2011 (r228605) +++ head/share/mk/bsd.sys.mk Fri Dec 16 23:42:25 2011 (r228606) @@ -70,6 +70,9 @@ CWARNFLAGS += -Wno-switch-enum . if ${WARNS} <= 1 CWARNFLAGS += -Wno-parentheses . endif +. if defined(NO_WARRAY_BOUNDS) +CWARNFLAGS += -Wno-array-bounds +. endif . endif . endif From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 23:43:58 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBB6F106566C; Fri, 16 Dec 2011 23:43:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90DB58FC14; Fri, 16 Dec 2011 23:43:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGNhw0c032691; Fri, 16 Dec 2011 23:43:58 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGNhwFV032689; Fri, 16 Dec 2011 23:43:58 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112162343.pBGNhwFV032689@svn.freebsd.org> From: Dimitry Andric Date: Fri, 16 Dec 2011 23:43:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228607 - head/sbin/routed/rtquery X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 23:43:58 -0000 Author: dim Date: Fri Dec 16 23:43:58 2011 New Revision: 228607 URL: http://svn.freebsd.org/changeset/base/228607 Log: Use NO_WARRAY_BOUNDS for sbin/routed/rtquery. MFC after: 1 week Modified: head/sbin/routed/rtquery/Makefile Modified: head/sbin/routed/rtquery/Makefile ============================================================================== --- head/sbin/routed/rtquery/Makefile Fri Dec 16 23:42:25 2011 (r228606) +++ head/sbin/routed/rtquery/Makefile Fri Dec 16 23:43:58 2011 (r228607) @@ -7,5 +7,6 @@ MAN= rtquery.8 LDADD= -lmd DPADD= ${LIBMD} WARNS?= 3 +NO_WARRAY_BOUNDS= .include From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 23:44:16 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91EC9106564A; Fri, 16 Dec 2011 23:44:16 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E8CA8FC15; Fri, 16 Dec 2011 23:44:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGNiGmw032764; Fri, 16 Dec 2011 23:44:16 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGNiGbN032761; Fri, 16 Dec 2011 23:44:16 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201112162344.pBGNiGbN032761@svn.freebsd.org> From: Doug Barton Date: Fri, 16 Dec 2011 23:44:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228608 - stable/7/usr.sbin/tzsetup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 23:44:16 -0000 Author: dougb Date: Fri Dec 16 23:44:16 2011 New Revision: 228608 URL: http://svn.freebsd.org/changeset/base/228608 Log: MFC: r179530 - Replace rcsid with __FBSDID. - Remove paths.h and embed it in the source. - Remove stale alpha support. - Clean up compiler warnings and fix style(9) bugs. Not MFC'ed by: jkim MFC: r195339 Add a new options (-s) that, when specified, skips the question about adjusting the clock to UTC. That avoids to write on /etc/wall_cmos_clock which is useful in some cases (example: host user in a jail). Not MFC'ed by: attilio MFC: r198254 When tzsetup is run as non-root and the "CMOS clock question on UTC" is answered as No, it would abort without properly ending the dialog session. Not MFC'ed by: edwin MFC: r198267 Instead of having to know which timezone was picked last time, you now can run "tzsetup -r" which will reinstall the last choice. This data is recorded in /var/db/zoneinfo. Not MFC'ed by: edwin MFC: r198350 - Add support for chrooted installs. - Add examples to the man-page. Not MFC'ed by: edwin MFC: r208830 When there is a problem with writing, also bail out. Not MFC'ed by: edwin MFC: r208831 Add comment that this value is unused. It is obvious that it isn't used, but both clang and Coverity talk about it. Not MFC'ed by: edwin MFC: r209190 Use literal format strings. Found by clang. Not MFC'ed by: emaste MFC: r210243 Fix support for chrooted installs. Not MFC'ed by: nork While mentored by: imp MFC: r220172 Add a menu entry for UTC in the main menu. Not MFC'ed by: edwin MFC: r222139 - add missing options and arguments to program's usage() and sync it with manpage's SYNOPSIS - generally clean up a manpage's formatting Not MFC'ed by: ru MFC: r227011 If the user is moving from any other time zone to UTC we need to delete any old /var/db/zoneinfo file that may exist so that tzsetup -r does the right thing. Deleted: stable/7/usr.sbin/tzsetup/paths.h Modified: stable/7/usr.sbin/tzsetup/tzsetup.8 stable/7/usr.sbin/tzsetup/tzsetup.c Directory Properties: stable/7/usr.sbin/tzsetup/ (props changed) Modified: stable/7/usr.sbin/tzsetup/tzsetup.8 ============================================================================== --- stable/7/usr.sbin/tzsetup/tzsetup.8 Fri Dec 16 23:43:58 2011 (r228607) +++ stable/7/usr.sbin/tzsetup/tzsetup.8 Fri Dec 16 23:44:16 2011 (r228608) @@ -23,7 +23,8 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd September 05, 2009 +.\" +.Dd October 21, 2009 .Dt TZSETUP 8 .Os .Sh NAME @@ -31,8 +32,9 @@ .Nd set local timezone .Sh SYNOPSIS .Nm -.Op Fl ns -.Op Ar default +.Op Fl nrs +.Op Fl C Ar chroot_directory +.Op Ar zoneinfo_file | zoneinfo_name .Sh DESCRIPTION The .Nm @@ -49,17 +51,27 @@ the hardware clock does not keep .Pp The following option is available: .Bl -tag -offset indent -width Fl +.It Fl C Ar chroot_directory +Open all files and directories relative to +.Ar chroot_directory . .It Fl n Do not create or copy files. +.It Fl r +Reinstall the zoneinfo file installed last time. +The name is obtained from +.Pa /var/db/zoneinfo . .It Fl s Skip the initial question about adjusting the clock if not set to .Tn UTC . .El .Pp -It is possible to short-circuit the menu system by specifying a -.Ar default -on the command line; this is intended mainly for pre-configured -installation scripts. +It is possible to short-circuit the menu system by specifying the +location of a +.Ar zoneinfo_file +or the name of the +.Ar zoneinfo_name +on the command line; this is intended mainly for pre-configured installation +scripts or people who know which zoneinfo they want to install. .Sh TIMEZONE DATABASE The contents of the timezone database are indexed by .Pa /usr/share/zoneinfo/zone.tab . @@ -91,12 +103,12 @@ The source code to the database contains many additional comments and documentation references for the historically minded. .Sh FILES -.Bl -tag -width /usr/share/zoneinfo/zone.tab -compact +.Bl -tag -width ".Pa /usr/share/zoneinfo/zone.tab" -compact .It Pa /etc/localtime current time zone file .It Pa /etc/wall_cmos_clock see -.Xr adjkerntz 8 . +.Xr adjkerntz 8 .It Pa /usr/share/misc/iso3166 mapping of .Tn ISO @@ -105,7 +117,27 @@ mapping of directory for zoneinfo files .It Pa /usr/share/zoneinfo/zone.tab mapping of timezone file to country and location +.It Pa /var/db/zoneinfo +saved name of the timezone file installed last .El +.Sh EXAMPLES +Normal usage, to select the right zoneinfo file via the dialog-based +user interface: +.Dl tzsetup +.Pp +Install the file +.Pa /usr/share/zoneinfo/Australia/Sydney : +.Dl "tzsetup /usr/share/zoneinfo/Australia/Sydney" +.Pp +Install the zoneinfo file for Australia/Sydney, assumed to be located +in +.Pa /usr/share/zoneinfo : +.Dl "tzsetup Australia/Sydney" +.Pp +After a reinstall of the zoneinfo files, you can reinstall the +latest installed zoneinfo file (as specified in +.Pa /var/db/zoneinfo ) : +.Dl "tzsetup -r" .Sh SEE ALSO .Xr date 1 , .Xr adjtime 2 , Modified: stable/7/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- stable/7/usr.sbin/tzsetup/tzsetup.c Fri Dec 16 23:43:58 2011 (r228607) +++ stable/7/usr.sbin/tzsetup/tzsetup.c Fri Dec 16 23:44:16 2011 (r228608) @@ -12,7 +12,7 @@ * no representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. - * + * * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF @@ -32,12 +32,9 @@ * files provided in newer tzdata releases. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); -#include #include #include #include @@ -48,112 +45,145 @@ static const char rcsid[] = #include #include +#include #include #include -#include "paths.h" +#define _PATH_ZONETAB "/usr/share/zoneinfo/zone.tab" +#define _PATH_ISO3166 "/usr/share/misc/iso3166" +#define _PATH_ZONEINFO "/usr/share/zoneinfo" +#define _PATH_LOCALTIME "/etc/localtime" +#define _PATH_DB "/var/db/zoneinfo" +#define _PATH_WALL_CMOS_CLOCK "/etc/wall_cmos_clock" + +static char path_zonetab[MAXPATHLEN], path_iso3166[MAXPATHLEN], + path_zoneinfo[MAXPATHLEN], path_localtime[MAXPATHLEN], + path_db[MAXPATHLEN], path_wall_cmos_clock[MAXPATHLEN]; static int reallydoit = 1; - -static int continent_country_menu(dialogMenuItem *); -static int set_zone_multi(dialogMenuItem *); -static int set_zone_whole_country(dialogMenuItem *); -static int set_zone_menu(dialogMenuItem *); +static int reinstall = 0; +static int usedialog = 1; +static char *chrootenv = NULL; + +static void usage(void); +static int confirm_zone(const char *filename); +static int continent_country_menu(dialogMenuItem *); +static int install_zoneinfo_file(const char *zoneinfo_file); +static int set_zone_multi(dialogMenuItem *); +static int set_zone_whole_country(dialogMenuItem *); +static int set_zone_menu(dialogMenuItem *); +static int set_zone_utc(void); struct continent { dialogMenuItem *menu; - int nitems; - int ch; - int sc; + int nitems; + int ch; + int sc; }; -static struct continent africa, america, antarctica, arctic, asia, atlantic; -static struct continent australia, europe, indian, pacific; +static struct continent africa, america, antarctica, arctic, asia, atlantic; +static struct continent australia, europe, indian, pacific, utc; static struct continent_names { - char *name; + const char *name; struct continent *continent; } continent_names[] = { - { "Africa", &africa }, { "America", &america }, - { "Antarctica", &antarctica }, { "Arctic", &arctic }, - { "Asia", &asia }, - { "Atlantic", &atlantic }, { "Australia", &australia }, - { "Europe", &europe }, { "Indian", &indian }, { "Pacific", &pacific } + { "Africa", &africa }, + { "America", &america }, + { "Antarctica", &antarctica }, + { "Arctic", &arctic }, + { "Asia", &asia }, + { "Atlantic", &atlantic }, + { "Australia", &australia }, + { "Europe", &europe }, + { "Indian", &indian }, + { "Pacific", &pacific }, + { "UTC", &utc } }; -static dialogMenuItem continents[] = { - { "1", "Africa", 0, continent_country_menu, 0, &africa }, - { "2", "America -- North and South", 0, continent_country_menu, 0, - &america }, - { "3", "Antarctica", 0, continent_country_menu, 0, &antarctica }, - { "4", "Arctic Ocean", 0, continent_country_menu, 0, &arctic }, - { "5", "Asia", 0, continent_country_menu, 0, &asia }, - { "6", "Atlantic Ocean", 0, continent_country_menu, 0, &atlantic }, - { "7", "Australia", 0, continent_country_menu, 0, &australia }, - { "8", "Europe", 0, continent_country_menu, 0, &europe }, - { "9", "Indian Ocean", 0, continent_country_menu, 0, &indian }, - { "0", "Pacific Ocean", 0, continent_country_menu, 0, &pacific } +static struct continent_items { + char prompt[2]; + char title[30]; +} continent_items[] = { + { "1", "Africa" }, + { "2", "America -- North and South" }, + { "3", "Antarctica" }, + { "4", "Arctic Ocean" }, + { "5", "Asia" }, + { "6", "Atlantic Ocean" }, + { "7", "Australia" }, + { "8", "Europe" }, + { "9", "Indian Ocean" }, + { "0", "Pacific Ocean" }, + { "a", "UTC" } }; -#define NCONTINENTS (int)((sizeof continents)/(sizeof continents[0])) -#define OCEANP(x) ((x) == 3 || (x) == 5 || (x) == 8 || (x) == 9) + +#define NCONTINENTS \ + (int)((sizeof(continent_items)) / (sizeof(continent_items[0]))) +static dialogMenuItem continents[NCONTINENTS]; + +#define OCEANP(x) ((x) == 3 || (x) == 5 || (x) == 8 || (x) == 9) static int continent_country_menu(dialogMenuItem *continent) { - int rv; + char title[64], prompt[64]; struct continent *contp = continent->data; - char title[256]; - int isocean = OCEANP(continent - continents); - int menulen; + int isocean = OCEANP(continent - continents); + int menulen; + int rv; + + if (strcmp(continent->title, "UTC") == 0) + return set_zone_utc(); /* Short cut -- if there's only one country, don't post a menu. */ if (contp->nitems == 1) return (contp->menu[0].fire(&contp->menu[0])); /* It's amazing how much good grammar really matters... */ - if (!isocean) - snprintf(title, sizeof title, "Countries in %s", - continent->title); - else - snprintf(title, sizeof title, "Islands and groups in the %s", - continent->title); + if (!isocean) { + snprintf(title, sizeof(title), "Countries in %s", + continent->title); + snprintf(prompt, sizeof(prompt), "Select a country or region"); + } else { + snprintf(title, sizeof(title), "Islands and groups in the %s", + continent->title); + snprintf(prompt, sizeof(prompt), "Select an island or group"); + } menulen = contp->nitems < 16 ? contp->nitems : 16; - rv = dialog_menu(title, (isocean ? "Select an island or group" - : "Select a country or region"), -1, -1, menulen, - -contp->nitems, contp->menu, 0, &contp->ch, - &contp->sc); + rv = dialog_menu(title, prompt, -1, -1, menulen, -contp->nitems, + contp->menu, 0, &contp->ch, &contp->sc); if (rv == 0) - return DITEM_LEAVE_MENU; - return DITEM_RECREATE; + return (DITEM_LEAVE_MENU); + return (DITEM_RECREATE); } static struct continent * find_continent(const char *name) { - int i; + int i; - for (i = 0; i < NCONTINENTS; i++) { + for (i = 0; i < NCONTINENTS; i++) if (strcmp(name, continent_names[i].name) == 0) - return continent_names[i].continent; - } - return 0; + return (continent_names[i].continent); + return (0); } struct country { - char *name; - char *tlc; - int nzones; - char *filename; /* use iff nzones < 0 */ - struct continent *continent; /* use iff nzones < 0 */ - TAILQ_HEAD(, zone) zones; /* use iff nzones > 0 */ - dialogMenuItem *submenu; /* use iff nzones > 0 */ + char *name; + char *tlc; + int nzones; + char *filename; /* use iff nzones < 0 */ + struct continent *continent; /* use iff nzones < 0 */ + TAILQ_HEAD(, zone) zones; /* use iff nzones > 0 */ + dialogMenuItem *submenu; /* use iff nzones > 0 */ }; struct zone { TAILQ_ENTRY(zone) link; - char *descr; - char *filename; + char *descr; + char *filename; struct continent *continent; }; @@ -162,9 +192,10 @@ struct zone { * of the two-letter variety, so we just size this array to suit. * Beats worrying about dynamic allocation. */ -#define NCOUNTRIES (26*26) +#define NCOUNTRIES (26 * 26) static struct country countries[NCOUNTRIES]; -#define CODE2INT(s) ((s[0] - 'A') * 26 + (s[1] - 'A')) + +#define CODE2INT(s) ((s[0] - 'A') * 26 + (s[1] - 'A')) /* * Read the ISO 3166 country code database in _PATH_ISO3166 @@ -173,21 +204,21 @@ static struct country countries[NCOUNTRI static void read_iso3166_table(void) { - FILE *fp; - char *s, *t, *name; - size_t len; - int lineno; - struct country *cp; + FILE *fp; + struct country *cp; + size_t len; + char *s, *t, *name; + int lineno; - fp = fopen(_PATH_ISO3166, "r"); + fp = fopen(path_iso3166, "r"); if (!fp) - err(1, _PATH_ISO3166); + err(1, "%s", path_iso3166); lineno = 0; while ((s = fgetln(fp, &len)) != 0) { lineno++; if (s[len - 1] != '\n') - errx(1, _PATH_ISO3166 ":%d: invalid format", lineno); + errx(1, "%s:%d: invalid format", path_iso3166, lineno); s[len - 1] = '\0'; if (s[0] == '#' || strspn(s, " \t") == len - 1) continue; @@ -195,26 +226,25 @@ read_iso3166_table(void) /* Isolate the two-letter code. */ t = strsep(&s, "\t"); if (t == 0 || strlen(t) != 2) - errx(1, _PATH_ISO3166 ":%d: invalid format", lineno); + errx(1, "%s:%d: invalid format", path_iso3166, lineno); if (t[0] < 'A' || t[0] > 'Z' || t[1] < 'A' || t[1] > 'Z') - errx(1, _PATH_ISO3166 ":%d: invalid code `%s'", - lineno, t); + errx(1, "%s:%d: invalid code `%s'", path_iso3166, + lineno, t); /* Now skip past the three-letter and numeric codes. */ - name = strsep(&s, "\t"); /* 3-let */ + name = strsep(&s, "\t"); /* 3-let */ if (name == 0 || strlen(name) != 3) - errx(1, _PATH_ISO3166 ":%d: invalid format", lineno); - name = strsep(&s, "\t"); /* numeric */ + errx(1, "%s:%d: invalid format", path_iso3166, lineno); + name = strsep(&s, "\t"); /* numeric */ if (name == 0 || strlen(name) != 3) - errx(1, _PATH_ISO3166 ":%d: invalid format", lineno); + errx(1, "%s:%d: invalid format", path_iso3166, lineno); name = s; cp = &countries[CODE2INT(t)]; if (cp->name) - errx(1, _PATH_ISO3166 - ":%d: country code `%s' multiply defined: %s", - lineno, t, cp->name); + errx(1, "%s:%d: country code `%s' multiply defined: %s", + path_iso3166, lineno, t, cp->name); cp->name = strdup(name); if (cp->name == NULL) errx(1, "malloc failed"); @@ -228,28 +258,28 @@ read_iso3166_table(void) static void add_zone_to_country(int lineno, const char *tlc, const char *descr, - const char *file, struct continent *cont) + const char *file, struct continent *cont) { - struct zone *zp; - struct country *cp; + struct zone *zp; + struct country *cp; if (tlc[0] < 'A' || tlc[0] > 'Z' || tlc[1] < 'A' || tlc[1] > 'Z') - errx(1, _PATH_ZONETAB ":%d: country code `%s' invalid", - lineno, tlc); + errx(1, "%s:%d: country code `%s' invalid", path_zonetab, + lineno, tlc); cp = &countries[CODE2INT(tlc)]; if (cp->name == 0) - errx(1, _PATH_ZONETAB ":%d: country code `%s' unknown", - lineno, tlc); + errx(1, "%s:%d: country code `%s' unknown", path_zonetab, + lineno, tlc); if (descr) { if (cp->nzones < 0) - errx(1, _PATH_ZONETAB - ":%d: conflicting zone definition", lineno); + errx(1, "%s:%d: conflicting zone definition", + path_zonetab, lineno); - zp = malloc(sizeof *zp); + zp = malloc(sizeof(*zp)); if (zp == 0) - errx(1, "malloc(%lu)", (unsigned long)sizeof *zp); + errx(1, "malloc(%zu)", sizeof(*zp)); if (cp->nzones == 0) TAILQ_INIT(&cp->zones); @@ -265,11 +295,11 @@ add_zone_to_country(int lineno, const ch cp->nzones++; } else { if (cp->nzones > 0) - errx(1, _PATH_ZONETAB - ":%d: zone must have description", lineno); + errx(1, "%s:%d: zone must have description", + path_zonetab, lineno); if (cp->nzones < 0) - errx(1, _PATH_ZONETAB - ":%d: zone multiply defined", lineno); + errx(1, "%s:%d: zone multiply defined", + path_zonetab, lineno); cp->nzones = -1; cp->filename = strdup(file); if (cp->filename == NULL) @@ -289,13 +319,13 @@ compare_countries(const void *xa, const const struct country *a = xa, *b = xb; if (a->name == 0 && b->name == 0) - return 0; + return (0); if (a->name == 0 && b->name != 0) - return 1; + return (1); if (b->name == 0) - return -1; + return (-1); - return strcmp(a->name, b->name); + return (strcmp(a->name, b->name)); } /* @@ -305,51 +335,51 @@ compare_countries(const void *xa, const static void sort_countries(void) { - qsort(countries, NCOUNTRIES, sizeof countries[0], compare_countries); + + qsort(countries, NCOUNTRIES, sizeof(countries[0]), compare_countries); } static void read_zones(void) { - FILE *fp; - char *line; - size_t len; - int lineno; - char *tlc, *coord, *file, *descr, *p; - char contbuf[16]; + char contbuf[16]; + FILE *fp; struct continent *cont; + size_t len; + char *line, *tlc, *coord, *file, *descr, *p; + int lineno; - fp = fopen(_PATH_ZONETAB, "r"); + fp = fopen(path_zonetab, "r"); if (!fp) - err(1, _PATH_ZONETAB); + err(1, "%s", path_zonetab); lineno = 0; while ((line = fgetln(fp, &len)) != 0) { lineno++; if (line[len - 1] != '\n') - errx(1, _PATH_ZONETAB ":%d: invalid format", lineno); + errx(1, "%s:%d: invalid format", path_zonetab, lineno); line[len - 1] = '\0'; if (line[0] == '#') continue; tlc = strsep(&line, "\t"); if (strlen(tlc) != 2) - errx(1, _PATH_ZONETAB ":%d: invalid country code `%s'", - lineno, tlc); - coord = strsep(&line, "\t"); + errx(1, "%s:%d: invalid country code `%s'", + path_zonetab, lineno, tlc); + coord = strsep(&line, "\t"); /* Unused */ file = strsep(&line, "\t"); p = strchr(file, '/'); if (p == 0) - errx(1, _PATH_ZONETAB ":%d: invalid zone name `%s'", - lineno, file); + errx(1, "%s:%d: invalid zone name `%s'", path_zonetab, + lineno, file); contbuf[0] = '\0'; strncat(contbuf, file, p - file); cont = find_continent(contbuf); if (!cont) - errx(1, _PATH_ZONETAB ":%d: invalid region `%s'", - lineno, contbuf); + errx(1, "%s:%d: invalid region `%s'", path_zonetab, + lineno, contbuf); - descr = (line && *line) ? line : 0; + descr = (line != NULL && *line != '\0') ? line : NULL; add_zone_to_country(lineno, tlc, descr, file, cont); } @@ -359,11 +389,11 @@ read_zones(void) static void make_menus(void) { - struct country *cp; - struct zone *zp, *zp2; + struct country *cp; + struct zone *zp, *zp2; struct continent *cont; - dialogMenuItem *dmi; - int i; + dialogMenuItem *dmi; + int i; /* * First, count up all the countries in each continent/ocean. @@ -380,8 +410,8 @@ make_menus(void) TAILQ_FOREACH(zp, &cp->zones, link) { cont = zp->continent; for (zp2 = TAILQ_FIRST(&cp->zones); - zp2->continent != cont; - zp2 = TAILQ_NEXT(zp2, link)) + zp2->continent != cont; + zp2 = TAILQ_NEXT(zp2, link)) ; if (zp2 == zp) zp->continent->nitems++; @@ -390,17 +420,22 @@ make_menus(void) } /* - * Now allocate memory for the country menus. We set - * nitems back to zero so that we can use it for counting - * again when we actually build the menus. + * Now allocate memory for the country menus and initialize + * continent menus. We set nitems back to zero so that we can + * use it for counting again when we actually build the menus. */ + memset(continents, 0, sizeof(continents)); for (i = 0; i < NCONTINENTS; i++) { continent_names[i].continent->menu = - malloc(sizeof(dialogMenuItem) * - continent_names[i].continent->nitems); + malloc(sizeof(dialogMenuItem) * + continent_names[i].continent->nitems); if (continent_names[i].continent->menu == 0) errx(1, "malloc for continent menu"); continent_names[i].continent->nitems = 0; + continents[i].prompt = continent_items[i].prompt; + continents[i].title = continent_items[i].title; + continents[i].fire = continent_country_menu; + continents[i].data = continent_names[i].continent; } /* @@ -413,25 +448,23 @@ make_menus(void) continue; if (cp->nzones < 0) { dmi = &cp->continent->menu[cp->continent->nitems]; - memset(dmi, 0, sizeof *dmi); - asprintf(&dmi->prompt, "%d", - ++cp->continent->nitems); + memset(dmi, 0, sizeof(*dmi)); + asprintf(&dmi->prompt, "%d", ++cp->continent->nitems); dmi->title = cp->name; dmi->checked = 0; dmi->fire = set_zone_whole_country; dmi->selected = 0; dmi->data = cp; } else { - cp->submenu = malloc(cp->nzones * sizeof *dmi); + cp->submenu = malloc(cp->nzones * sizeof(*dmi)); if (cp->submenu == 0) errx(1, "malloc for submenu"); cp->nzones = 0; TAILQ_FOREACH(zp, &cp->zones, link) { cont = zp->continent; dmi = &cp->submenu[cp->nzones]; - memset(dmi, 0, sizeof *dmi); - asprintf(&dmi->prompt, "%d", - ++cp->nzones); + memset(dmi, 0, sizeof(*dmi)); + asprintf(&dmi->prompt, "%d", ++cp->nzones); dmi->title = zp->descr; dmi->checked = 0; dmi->fire = set_zone_multi; @@ -439,14 +472,14 @@ make_menus(void) dmi->data = zp; for (zp2 = TAILQ_FIRST(&cp->zones); - zp2->continent != cont; - zp2 = TAILQ_NEXT(zp2, link)) + zp2->continent != cont; + zp2 = TAILQ_NEXT(zp2, link)) ; if (zp2 != zp) continue; dmi = &cont->menu[cont->nitems]; - memset(dmi, 0, sizeof *dmi); + memset(dmi, 0, sizeof(*dmi)); asprintf(&dmi->prompt, "%d", ++cont->nitems); dmi->title = cp->name; dmi->checked = 0; @@ -461,202 +494,288 @@ make_menus(void) static int set_zone_menu(dialogMenuItem *dmi) { - int rv; - char buf[256]; - struct country *cp = dmi->data; - int menulen; - - snprintf(buf, sizeof buf, "%s Time Zones", cp->name); + char title[64], prompt[64]; + struct country *cp = dmi->data; + int menulen; + int rv; + + snprintf(title, sizeof(title), "%s Time Zones", cp->name); + snprintf(prompt, sizeof(prompt), + "Select a zone which observes the same time as your locality."); menulen = cp->nzones < 16 ? cp->nzones : 16; - rv = dialog_menu(buf, "Select a zone which observes the same time as " - "your locality.", -1, -1, menulen, -cp->nzones, - cp->submenu, 0, 0, 0); + rv = dialog_menu(title, prompt, -1, -1, menulen, -cp->nzones, + cp->submenu, 0, 0, 0); if (rv != 0) - return DITEM_RECREATE; - return DITEM_LEAVE_MENU; + return (DITEM_RECREATE); + return (DITEM_LEAVE_MENU); +} + +int +set_zone_utc(void) +{ + if (!confirm_zone(NULL)) + return (DITEM_FAILURE | DITEM_RECREATE); + + return (install_zoneinfo_file(NULL)); } static int -install_zone_file(const char *filename) +install_zoneinfo_file(const char *zoneinfo_file) { - struct stat sb; - int fd1, fd2; - int copymode; - char *msg; - ssize_t len; - char buf[1024]; + char buf[1024]; + char title[64], prompt[64]; + struct stat sb; + ssize_t len; + int fd1, fd2, copymode; - if (lstat(_PATH_LOCALTIME, &sb) < 0) + if (lstat(path_localtime, &sb) < 0) { /* Nothing there yet... */ copymode = 1; - else if(S_ISLNK(sb.st_mode)) + } else if (S_ISLNK(sb.st_mode)) copymode = 0; else copymode = 1; #ifdef VERBOSE if (copymode) - asprintf(&msg, "Copying %s to " _PATH_LOCALTIME, filename); + snprintf(prompt, sizeof(prompt), + "Copying %s to %s", zoneinfo_file, path_localtime); else - asprintf(&msg, "Creating symbolic link " _PATH_LOCALTIME - " to %s", filename); - - dialog_notify(msg); - free(msg); + snprintf(prompt, sizeof(prompt), + "Creating symbolic link %s to %s", + path_localtime, + zoneinfo_file == NULL ? "(UTC)" : zoneinfo_file); + if (usedialog) + dialog_notify(prompt); + else + fprintf(stderr, "%s\n", prompt); #endif if (reallydoit) { + if (zoneinfo_file == NULL) { + if (unlink(path_localtime) < 0 && errno != ENOENT) { + snprintf(title, sizeof(title), "Error"); + snprintf(prompt, sizeof(prompt), + "Could not delete %s: %s", path_localtime, + strerror(errno)); + if (usedialog) + dialog_mesgbox(title, prompt, 8, 72); + else + fprintf(stderr, "%s\n", prompt); + + return (DITEM_FAILURE | DITEM_RECREATE); + } + if (unlink(path_db) < 0 && errno != ENOENT) { + snprintf(title, sizeof(title), "Error"); + snprintf(prompt, sizeof(prompt), + "Could not delete %s: %s", path_db, + strerror(errno)); + if (usedialog) + dialog_mesgbox(title, prompt, 8, 72); + else + fprintf(stderr, "%s\n", prompt); + + return (DITEM_FAILURE | DITEM_RECREATE); + } + return (DITEM_LEAVE_MENU); + } + if (copymode) { - fd1 = open(filename, O_RDONLY, 0); + fd1 = open(zoneinfo_file, O_RDONLY, 0); if (fd1 < 0) { - asprintf(&msg, "Could not open %s: %s", - filename, strerror(errno)); - dialog_mesgbox("Error", msg, 8, 72); - free(msg); - return DITEM_FAILURE | DITEM_RECREATE; + snprintf(title, sizeof(title), "Error"); + snprintf(prompt, sizeof(prompt), + "Could not open %s: %s", zoneinfo_file, + strerror(errno)); + if (usedialog) + dialog_mesgbox(title, prompt, 8, 72); + else + fprintf(stderr, "%s\n", prompt); + return (DITEM_FAILURE | DITEM_RECREATE); } - unlink(_PATH_LOCALTIME); - fd2 = open(_PATH_LOCALTIME, - O_CREAT|O_EXCL|O_WRONLY, - S_IRUSR|S_IRGRP|S_IROTH); + unlink(path_localtime); + fd2 = open(path_localtime, O_CREAT | O_EXCL | O_WRONLY, + S_IRUSR | S_IRGRP | S_IROTH); if (fd2 < 0) { - asprintf(&msg, "Could not open " - _PATH_LOCALTIME ": %s", - strerror(errno)); - dialog_mesgbox("Error", msg, 8, 72); - free(msg); - return DITEM_FAILURE | DITEM_RECREATE; + snprintf(title, sizeof(title), "Error"); + snprintf(prompt, sizeof(prompt), + "Could not open %s: %s", + path_localtime, strerror(errno)); + if (usedialog) + dialog_mesgbox(title, prompt, 8, 72); + else + fprintf(stderr, "%s\n", prompt); + return (DITEM_FAILURE | DITEM_RECREATE); } - while ((len = read(fd1, buf, sizeof buf)) > 0) - len = write(fd2, buf, len); + while ((len = read(fd1, buf, sizeof(buf))) > 0) + if ((len = write(fd2, buf, len)) < 0) + break; if (len == -1) { - asprintf(&msg, "Error copying %s to " - _PATH_LOCALTIME ": %s", - filename, strerror(errno)); - dialog_mesgbox("Error", msg, 8, 72); - free(msg); + snprintf(title, sizeof(title), "Error"); + snprintf(prompt, sizeof(prompt), + "Error copying %s to %s %s", zoneinfo_file, + path_localtime, strerror(errno)); + if (usedialog) + dialog_mesgbox(title, prompt, 8, 72); + else + fprintf(stderr, "%s\n", prompt); /* Better to leave none than a corrupt one. */ - unlink(_PATH_LOCALTIME); - return DITEM_FAILURE | DITEM_RECREATE; + unlink(path_localtime); + return (DITEM_FAILURE | DITEM_RECREATE); } close(fd1); close(fd2); } else { - if (access(filename, R_OK) != 0) { - asprintf(&msg, "Cannot access %s: %s", - filename, strerror(errno)); - dialog_mesgbox("Error", msg, 8, 72); - free(msg); - return DITEM_FAILURE | DITEM_RECREATE; - } - unlink(_PATH_LOCALTIME); - if (symlink(filename, _PATH_LOCALTIME) < 0) { - asprintf(&msg, "Cannot create symbolic link " - _PATH_LOCALTIME " to %s: %s", - filename, strerror(errno)); - dialog_mesgbox("Error", msg, 8, 72); - free(msg); - return DITEM_FAILURE | DITEM_RECREATE; + if (access(zoneinfo_file, R_OK) != 0) { + snprintf(title, sizeof(title), "Error"); + snprintf(prompt, sizeof(prompt), + "Cannot access %s: %s", zoneinfo_file, + strerror(errno)); + if (usedialog) + dialog_mesgbox(title, prompt, 8, 72); + else + fprintf(stderr, "%s\n", prompt); + return (DITEM_FAILURE | DITEM_RECREATE); + } + unlink(path_localtime); + if (symlink(zoneinfo_file, path_localtime) < 0) { + snprintf(title, sizeof(title), "Error"); + snprintf(prompt, sizeof(prompt), + "Cannot create symbolic link %s to %s: %s", + path_localtime, zoneinfo_file, + strerror(errno)); + if (usedialog) + dialog_mesgbox(title, prompt, 8, 72); + else + fprintf(stderr, "%s\n", prompt); + return (DITEM_FAILURE | DITEM_RECREATE); } } } #ifdef VERBOSE + snprintf(title, sizeof(title), "Done"); if (copymode) - asprintf(&msg, "Copied timezone file from %s to " - _PATH_LOCALTIME, filename); + snprintf(prompt, sizeof(prompt), + "Copied timezone file from %s to %s", zoneinfo_file, + path_localtime); else - asprintf(&msg, "Created symbolic link from " _PATH_LOCALTIME - " to %s", filename); - - dialog_mesgbox("Done", msg, 8, 72); - free(msg); + snprintf(prompt, sizeof(prompt), + "Created symbolic link from %s to %s", zoneinfo_file, + path_localtime); + if (usedialog) + dialog_mesgbox(title, prompt, 8, 72); + else + fprintf(stderr, "%s\n", prompt); #endif - return DITEM_LEAVE_MENU; + + return (DITEM_LEAVE_MENU); +} + +static int +install_zoneinfo(const char *zoneinfo) +{ + int rv; + FILE *f; + char path_zoneinfo_file[MAXPATHLEN]; + + sprintf(path_zoneinfo_file, "%s/%s", path_zoneinfo, zoneinfo); + rv = install_zoneinfo_file(path_zoneinfo_file); + + /* Save knowledge for later */ + if ((f = fopen(path_db, "w")) != NULL) { + fprintf(f, "%s\n", zoneinfo); + fclose(f); + } + + return (rv); } static int confirm_zone(const char *filename) { - char *msg; - struct tm *tm; - time_t t = time(0); - int rv; + char title[64], prompt[64]; + time_t t = time(0); + struct tm *tm; + int rv; - setenv("TZ", filename, 1); + setenv("TZ", filename == NULL ? "" : filename, 1); tzset(); tm = localtime(&t); - asprintf(&msg, "Does the abbreviation `%s' look reasonable?", - tm->tm_zone); - rv = !dialog_yesno("Confirmation", msg, 5, 72); - free(msg); - return rv; + snprintf(title, sizeof(title), "Confirmation"); + snprintf(prompt, sizeof(prompt), + "Does the abbreviation `%s' look reasonable?", tm->tm_zone); + rv = !dialog_yesno(title, prompt, 5, 72); + return (rv); } static int set_zone_multi(dialogMenuItem *dmi) { - char *fn; - struct zone *zp = dmi->data; - int rv; + struct zone *zp = dmi->data; + int rv; if (!confirm_zone(zp->filename)) - return DITEM_FAILURE | DITEM_RECREATE; + return (DITEM_FAILURE | DITEM_RECREATE); - asprintf(&fn, "%s/%s", _PATH_ZONEINFO, zp->filename); - rv = install_zone_file(fn); - free(fn); - return rv; + rv = install_zoneinfo(zp->filename); + return (rv); } static int set_zone_whole_country(dialogMenuItem *dmi) { - char *fn; - struct country *cp = dmi->data; - int rv; + struct country *cp = dmi->data; + int rv; if (!confirm_zone(cp->filename)) - return DITEM_FAILURE | DITEM_RECREATE; + return (DITEM_FAILURE | DITEM_RECREATE); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Dec 16 23:46:06 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4539F106566B; Fri, 16 Dec 2011 23:46:06 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33B778FC16; Fri, 16 Dec 2011 23:46:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBGNk6io032923; Fri, 16 Dec 2011 23:46:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBGNk6gw032921; Fri, 16 Dec 2011 23:46:06 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201112162346.pBGNk6gw032921@svn.freebsd.org> From: Nathan Whitehorn Date: Fri, 16 Dec 2011 23:46:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228609 - head/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 16 Dec 2011 23:46:06 -0000 Author: nwhitehorn Date: Fri Dec 16 23:46:05 2011 New Revision: 228609 URL: http://svn.freebsd.org/changeset/base/228609 Log: Allow this to work on embedded systems without Open Firmware by making lack of a /chosen non-fatal, and manually removing memory in use by the kernel from the physical memory map. Submitted by: rpaulo Modified: head/sys/powerpc/aim/mmu_oea.c Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Fri Dec 16 23:44:16 2011 (r228608) +++ head/sys/powerpc/aim/mmu_oea.c Fri Dec 16 23:46:05 2011 (r228609) @@ -153,6 +153,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "mmu_if.h" @@ -759,6 +760,38 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k phys_avail_count++; physsz += regions[i].mr_size; } + + /* Check for overlap with the kernel and exception vectors */ + for (j = 0; j < 2*phys_avail_count; j+=2) { + if (phys_avail[j] < EXC_LAST) + phys_avail[j] += EXC_LAST; + + if (kernelstart >= phys_avail[j] && + kernelstart < phys_avail[j+1]) { + if (kernelend < phys_avail[j+1]) { + phys_avail[2*phys_avail_count] = + (kernelend & ~PAGE_MASK) + PAGE_SIZE; + phys_avail[2*phys_avail_count + 1] = + phys_avail[j+1]; + phys_avail_count++; + } + + phys_avail[j+1] = kernelstart & ~PAGE_MASK; + } + + if (kernelend >= phys_avail[j] && + kernelend < phys_avail[j+1]) { + if (kernelstart > phys_avail[j]) { + phys_avail[2*phys_avail_count] = phys_avail[j]; + phys_avail[2*phys_avail_count + 1] = + kernelstart & ~PAGE_MASK; + phys_avail_count++; + } + + phys_avail[j] = (kernelend & ~PAGE_MASK) + PAGE_SIZE; + } + } + physmem = btoc(physsz); /* @@ -829,44 +862,43 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k /* * Set up the Open Firmware mappings */ - if ((chosen = OF_finddevice("/chosen")) == -1) - panic("moea_bootstrap: can't find /chosen"); - OF_getprop(chosen, "mmu", &mmui, 4); - if ((mmu = OF_instance_to_package(mmui)) == -1) - panic("moea_bootstrap: can't get mmu package"); - if ((sz = OF_getproplen(mmu, "translations")) == -1) - panic("moea_bootstrap: can't get ofw translation count"); - translations = NULL; - for (i = 0; phys_avail[i] != 0; i += 2) { - if (phys_avail[i + 1] >= sz) { - translations = (struct ofw_map *)phys_avail[i]; - break; + chosen = OF_finddevice("/chosen"); + if (chosen != -1 && OF_getprop(chosen, "mmu", &mmui, 4) != -1 && + (mmu = OF_instance_to_package(mmui)) != -1 && + (sz = OF_getproplen(mmu, "translations")) != -1) { + translations = NULL; + for (i = 0; phys_avail[i] != 0; i += 2) { + if (phys_avail[i + 1] >= sz) { + translations = (struct ofw_map *)phys_avail[i]; + break; + } } - } - if (translations == NULL) - panic("moea_bootstrap: no space to copy translations"); - bzero(translations, sz); - if (OF_getprop(mmu, "translations", translations, sz) == -1) - panic("moea_bootstrap: can't get ofw translations"); - CTR0(KTR_PMAP, "moea_bootstrap: translations"); - sz /= sizeof(*translations); - qsort(translations, sz, sizeof (*translations), om_cmp); - for (i = 0; i < sz; i++) { - CTR3(KTR_PMAP, "translation: pa=%#x va=%#x len=%#x", - translations[i].om_pa, translations[i].om_va, - translations[i].om_len); + if (translations == NULL) + panic("moea_bootstrap: no space to copy translations"); + bzero(translations, sz); + if (OF_getprop(mmu, "translations", translations, sz) == -1) + panic("moea_bootstrap: can't get ofw translations"); + CTR0(KTR_PMAP, "moea_bootstrap: translations"); + sz /= sizeof(*translations); + qsort(translations, sz, sizeof (*translations), om_cmp); + for (i = 0; i < sz; i++) { + CTR3(KTR_PMAP, "translation: pa=%#x va=%#x len=%#x", + translations[i].om_pa, translations[i].om_va, + translations[i].om_len); - /* - * If the mapping is 1:1, let the RAM and device on-demand - * BAT tables take care of the translation. - */ - if (translations[i].om_va == translations[i].om_pa) - continue; + /* + * If the mapping is 1:1, let the RAM and device + * on-demand BAT tables take care of the translation. + */ + if (translations[i].om_va == translations[i].om_pa) + continue; - /* Enter the pages */ - for (off = 0; off < translations[i].om_len; off += PAGE_SIZE) - moea_kenter(mmup, translations[i].om_va + off, - translations[i].om_pa + off); + /* Enter the pages */ + for (off = 0; off < translations[i].om_len; + off += PAGE_SIZE) + moea_kenter(mmup, translations[i].om_va + off, + translations[i].om_pa + off); + } } /* From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 00:14:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 498BA1065670; Sat, 17 Dec 2011 00:14:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 38E568FC0C; Sat, 17 Dec 2011 00:14:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBH0Ef2a033910; Sat, 17 Dec 2011 00:14:41 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBH0EfGY033908; Sat, 17 Dec 2011 00:14:41 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112170014.pBH0EfGY033908@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 00:14:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228610 - head/sbin/gbde X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 00:14:41 -0000 Author: dim Date: Sat Dec 17 00:14:40 2011 New Revision: 228610 URL: http://svn.freebsd.org/changeset/base/228610 Log: Use NO_WCAST_ALIGN for sbin/gbde, this is more appropriate to fix the alignment warnings than using WARNS=3, and it also works for clang. MFC after: 1 week Modified: head/sbin/gbde/Makefile Modified: head/sbin/gbde/Makefile ============================================================================== --- head/sbin/gbde/Makefile Fri Dec 16 23:46:05 2011 (r228609) +++ head/sbin/gbde/Makefile Sat Dec 17 00:14:40 2011 (r228610) @@ -7,11 +7,9 @@ SRCS+= rijndael-api-fst.c SRCS+= sha2.c SRCS+= g_bde_lock.c -# rijndael-fst.c does evil casting things which results in warnings on -# 64 bit machines, the test-vectors check out however, so it works right. -.if ${MACHINE_CPUARCH} != "i386" -WARNS?= 3 -.endif +# rijndael-fst.c does evil casting things which can results in warnings, +# the test-vectors check out however, so it works right. +NO_WCAST_ALIGN= CFLAGS+= -I${.CURDIR}/../../sys .PATH: ${.CURDIR}/../../sys/geom/bde \ From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 00:26:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B488A1065677; Sat, 17 Dec 2011 00:26:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3FB68FC17; Sat, 17 Dec 2011 00:26:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBH0QjMX034419; Sat, 17 Dec 2011 00:26:45 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBH0QjGE034417; Sat, 17 Dec 2011 00:26:45 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112170026.pBH0QjGE034417@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 00:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228611 - head/sbin/atm/atmconfig X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 00:26:45 -0000 Author: dim Date: Sat Dec 17 00:26:45 2011 New Revision: 228611 URL: http://svn.freebsd.org/changeset/base/228611 Log: In sbin/atm/atmconfig/diag.c, fix a few warnings about format strings not being literals. MFC after: 1 week Modified: head/sbin/atm/atmconfig/diag.c Modified: head/sbin/atm/atmconfig/diag.c ============================================================================== --- head/sbin/atm/atmconfig/diag.c Sat Dec 17 00:14:40 2011 (r228610) +++ head/sbin/atm/atmconfig/diag.c Sat Dec 17 00:26:45 2011 (r228611) @@ -426,7 +426,7 @@ diag_loop(int argc, char *argv[], const for (i = 0; i < argc; i++) { TAILQ_FOREACH(aif, &diagif_list, link) { if (strcmp(argv[i], aif->ifname) == 0) { - heading(text); + heading("%s", text); (*func)(aif); break; } @@ -436,7 +436,7 @@ diag_loop(int argc, char *argv[], const } } else { TAILQ_FOREACH(aif, &diagif_list, link) { - heading(text); + heading("%s", text); (*func)(aif); } } @@ -992,7 +992,7 @@ diag_vcc_loop(void (*func)(const struct TAILQ_FOREACH(aif, &diagif_list, link) { diagif_fetch_vcc(aif, fd); if (aif->vtab->count != 0) { - heading(text); + heading("%s", text); (*func)(aif); } } @@ -1003,7 +1003,7 @@ diag_vcc_loop(void (*func)(const struct if (strcmp(aif->ifname, argv[optind]) == 0) { diagif_fetch_vcc(aif, fd); if (aif->vtab->count != 0) { - heading(text); + heading("%s", text); (*func)(aif); } break; From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 00:54:10 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47003106566C; Sat, 17 Dec 2011 00:54:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 367998FC0A; Sat, 17 Dec 2011 00:54:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBH0sANG035259; Sat, 17 Dec 2011 00:54:10 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBH0sAE2035257; Sat, 17 Dec 2011 00:54:10 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112170054.pBH0sAE2035257@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 00:54:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228612 - head/sbin/ipf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 00:54:10 -0000 Author: dim Date: Sat Dec 17 00:54:09 2011 New Revision: 228612 URL: http://svn.freebsd.org/changeset/base/228612 Log: Use both NO_WFORMAT and NO_WARRAY_BOUNDS for sbin/ipf, it would be too disruptive to actually fix all the warnings, and the code hasn't been maintained for several years. MFC after: 1 week Modified: head/sbin/ipf/Makefile.inc Modified: head/sbin/ipf/Makefile.inc ============================================================================== --- head/sbin/ipf/Makefile.inc Sat Dec 17 00:26:45 2011 (r228611) +++ head/sbin/ipf/Makefile.inc Sat Dec 17 00:54:09 2011 (r228612) @@ -1,6 +1,8 @@ # $FreeBSD$ WARNS?= 2 +NO_WFORMAT= +NO_WARRAY_BOUNDS= CFLAGS+= -I${.CURDIR}/../../../contrib/ipfilter CFLAGS+= -I${.CURDIR}/../../../contrib/ipfilter/tools From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 01:19:08 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41DE9106566B; Sat, 17 Dec 2011 01:19:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16CA68FC0C; Sat, 17 Dec 2011 01:19:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBH1J7AW036207; Sat, 17 Dec 2011 01:19:07 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBH1J7BV036204; Sat, 17 Dec 2011 01:19:07 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112170119.pBH1J7BV036204@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 01:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228614 - head/sbin/dhclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 01:19:08 -0000 Author: dim Date: Sat Dec 17 01:19:07 2011 New Revision: 228614 URL: http://svn.freebsd.org/changeset/base/228614 Log: In sbin/dhclient, work around warnings about the size argument to strlcpy appearing to be the size of the source buffer, instead of the destination. MFC after: 1 week Modified: head/sbin/dhclient/clparse.c head/sbin/dhclient/parse.c Modified: head/sbin/dhclient/clparse.c ============================================================================== --- head/sbin/dhclient/clparse.c Sat Dec 17 01:02:56 2011 (r228613) +++ head/sbin/dhclient/clparse.c Sat Dec 17 01:19:07 2011 (r228614) @@ -873,6 +873,7 @@ parse_string_list(FILE *cfile, struct st { int token; char *val; + size_t valsize; struct string_list *cur, *tmp; /* Find the last medium in the media list. */ @@ -890,10 +891,11 @@ parse_string_list(FILE *cfile, struct st return; } - tmp = new_string_list(strlen(val) + 1); + valsize = strlen(val) + 1; + tmp = new_string_list(valsize); if (tmp == NULL) error("no memory for string list entry."); - strlcpy(tmp->string, val, strlen(val) + 1); + strlcpy(tmp->string, val, valsize); tmp->next = NULL; /* Store this medium at the end of the media list. */ Modified: head/sbin/dhclient/parse.c ============================================================================== --- head/sbin/dhclient/parse.c Sat Dec 17 01:02:56 2011 (r228613) +++ head/sbin/dhclient/parse.c Sat Dec 17 01:19:07 2011 (r228614) @@ -116,6 +116,7 @@ char * parse_string(FILE *cfile) { char *val, *s; + size_t valsize; int token; token = next_token(&val, cfile); @@ -124,10 +125,11 @@ parse_string(FILE *cfile) skip_to_semi(cfile); return (NULL); } - s = malloc(strlen(val) + 1); + valsize = strlen(val) + 1; + s = malloc(valsize); if (!s) error("no memory for string %s.", val); - strlcpy(s, val, strlen(val) + 1); + strlcpy(s, val, valsize); if (!parse_semi(cfile)) return (NULL); @@ -242,6 +244,7 @@ parse_numeric_aggregate(FILE *cfile, uns unsigned char *bufp = buf, *s = NULL; int token, count = 0; char *val, *t; + size_t valsize; pair c = NULL; if (!bufp && *max) { @@ -288,10 +291,11 @@ parse_numeric_aggregate(FILE *cfile, uns convert_num(s, val, base, size); s += size / 8; } else { - t = malloc(strlen(val) + 1); + valsize = strlen(val) + 1; + t = malloc(valsize); if (!t) error("no temp space for number."); - strlcpy(t, val, strlen(val) + 1); + strlcpy(t, val, valsize); c = cons(t, c); } } while (++count != *max); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 01:29:46 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9B2F106564A; Sat, 17 Dec 2011 01:29:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98DFB8FC08; Sat, 17 Dec 2011 01:29:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBH1TksQ036622; Sat, 17 Dec 2011 01:29:46 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBH1TkWj036618; Sat, 17 Dec 2011 01:29:46 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112170129.pBH1TkWj036618@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 01:29:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228615 - head/sbin/dhclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 01:29:46 -0000 Author: dim Date: Sat Dec 17 01:29:46 2011 New Revision: 228615 URL: http://svn.freebsd.org/changeset/base/228615 Log: In sbin/dhclient, since we know the size of the source strings anyway, we might as well use memcpy; strlcpy is really unnecessary here. MFC after: 1 week Modified: head/sbin/dhclient/clparse.c head/sbin/dhclient/parse.c Modified: head/sbin/dhclient/clparse.c ============================================================================== --- head/sbin/dhclient/clparse.c Sat Dec 17 01:19:07 2011 (r228614) +++ head/sbin/dhclient/clparse.c Sat Dec 17 01:29:46 2011 (r228615) @@ -895,7 +895,7 @@ parse_string_list(FILE *cfile, struct st tmp = new_string_list(valsize); if (tmp == NULL) error("no memory for string list entry."); - strlcpy(tmp->string, val, valsize); + memcpy(tmp->string, val, valsize); tmp->next = NULL; /* Store this medium at the end of the media list. */ Modified: head/sbin/dhclient/parse.c ============================================================================== --- head/sbin/dhclient/parse.c Sat Dec 17 01:19:07 2011 (r228614) +++ head/sbin/dhclient/parse.c Sat Dec 17 01:29:46 2011 (r228615) @@ -129,7 +129,7 @@ parse_string(FILE *cfile) s = malloc(valsize); if (!s) error("no memory for string %s.", val); - strlcpy(s, val, valsize); + memcpy(s, val, valsize); if (!parse_semi(cfile)) return (NULL); @@ -295,7 +295,7 @@ parse_numeric_aggregate(FILE *cfile, uns t = malloc(valsize); if (!t) error("no temp space for number."); - strlcpy(t, val, valsize); + memcpy(t, val, valsize); c = cons(t, c); } } while (++count != *max); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 01:36:51 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EB19106564A; Sat, 17 Dec 2011 01:36:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E0AF8FC13; Sat, 17 Dec 2011 01:36:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBH1apS5036886; Sat, 17 Dec 2011 01:36:51 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBH1apEH036884; Sat, 17 Dec 2011 01:36:51 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112170136.pBH1apEH036884@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 01:36:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228616 - head/usr.bin/tar X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 01:36:51 -0000 Author: dim Date: Sat Dec 17 01:36:50 2011 New Revision: 228616 URL: http://svn.freebsd.org/changeset/base/228616 Log: In usr.bin/tar/tree.c, if you really want to poke to NULL, you must use volatile, otherwise the indirection will not be emitted. MFC after: 1 week Modified: head/usr.bin/tar/tree.c Modified: head/usr.bin/tar/tree.c ============================================================================== --- head/usr.bin/tar/tree.c Sat Dec 17 01:29:46 2011 (r228615) +++ head/usr.bin/tar/tree.c Sat Dec 17 01:36:50 2011 (r228616) @@ -315,7 +315,7 @@ tree_next(struct tree *t) const char *msg = "Unable to continue traversing" " directory hierarchy after a fatal error."; write(2, msg, strlen(msg)); - *(int *)0 = 1; /* Deliberate SEGV; NULL pointer dereference. */ + *(volatile int *)0 = 1; /* Deliberate SEGV; NULL pointer dereference. */ exit(1); /* In case the SEGV didn't work. */ } From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 01:51:13 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CF2D106564A; Sat, 17 Dec 2011 01:51:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C8AE8FC08; Sat, 17 Dec 2011 01:51:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBH1pDr4037347; Sat, 17 Dec 2011 01:51:13 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBH1pDhE037345; Sat, 17 Dec 2011 01:51:13 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112170151.pBH1pDhE037345@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 01:51:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228617 - head/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 01:51:13 -0000 Author: dim Date: Sat Dec 17 01:51:12 2011 New Revision: 228617 URL: http://svn.freebsd.org/changeset/base/228617 Log: Disable yet another clang warning when WARNS <= 3. MFC after: 1 week Modified: head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Sat Dec 17 01:36:50 2011 (r228616) +++ head/share/mk/bsd.sys.mk Sat Dec 17 01:51:12 2011 (r228617) @@ -62,7 +62,7 @@ CWARNFLAGS += -Wno-pointer-sign . if ${CC:T:Mclang} == "clang" . if ${WARNS} <= 3 CWARNFLAGS += -Wno-tautological-compare -Wno-unused-value\ - -Wno-parentheses-equality + -Wno-parentheses-equality -Wno-unused-function . endif . if ${WARNS} <= 2 CWARNFLAGS += -Wno-switch-enum From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 01:54:51 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63D32106566C; Sat, 17 Dec 2011 01:54:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 534B38FC08; Sat, 17 Dec 2011 01:54:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBH1sp6g037487; Sat, 17 Dec 2011 01:54:51 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBH1sphH037485; Sat, 17 Dec 2011 01:54:51 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112170154.pBH1sphH037485@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 01:54:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228618 - head/sbin/devd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 01:54:51 -0000 Author: dim Date: Sat Dec 17 01:54:51 2011 New Revision: 228618 URL: http://svn.freebsd.org/changeset/base/228618 Log: In sbin/devd/devd.h, 'event_proc' and 'eps' are declared as structs. In devd.hh, there are redeclared as classes. Fix the inconsistency. MFC after: 1 week Modified: head/sbin/devd/devd.hh Modified: head/sbin/devd/devd.hh ============================================================================== --- head/sbin/devd/devd.hh Sat Dec 17 01:51:12 2011 (r228617) +++ head/sbin/devd/devd.hh Sat Dec 17 01:54:51 2011 (r228618) @@ -65,7 +65,7 @@ private: * eps is short for event_proc_single. It is a single entry in an * event_proc. Each keyword needs its own subclass from eps. */ -class eps +struct eps { public: eps() {} @@ -126,7 +126,7 @@ private: std::string _cmd; }; -class event_proc +struct event_proc { public: event_proc(); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 02:23:30 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B85F9106566B; Sat, 17 Dec 2011 02:23:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7A6C8FC14; Sat, 17 Dec 2011 02:23:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBH2NUm9038400; Sat, 17 Dec 2011 02:23:30 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBH2NUlO038398; Sat, 17 Dec 2011 02:23:30 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112170223.pBH2NUlO038398@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 02:23:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228619 - head/usr.bin/mt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 02:23:30 -0000 Author: dim Date: Sat Dec 17 02:23:30 2011 New Revision: 228619 URL: http://svn.freebsd.org/changeset/base/228619 Log: In usr.bin/mt/mt.c, the c_code member of struct commands should really be an unsigned long, since it will contain values of ioctl request codes. On 64-bit arches, these will not fit into an int. MFC after: 1 week Modified: head/usr.bin/mt/mt.c Modified: head/usr.bin/mt/mt.c ============================================================================== --- head/usr.bin/mt/mt.c Sat Dec 17 01:54:51 2011 (r228618) +++ head/usr.bin/mt/mt.c Sat Dec 17 02:23:30 2011 (r228619) @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); static const struct commands { const char *c_name; - int c_code; + unsigned long c_code; int c_ronly; int c_flags; } com[] = { From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 03:17:39 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8A6F1065676; Sat, 17 Dec 2011 03:17:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 82AE98FC0C; Sat, 17 Dec 2011 03:17:38 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id pBH3Hbft039932; Sat, 17 Dec 2011 07:17:37 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id pBH3HbZq039931; Sat, 17 Dec 2011 07:17:37 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Sat, 17 Dec 2011 07:17:37 +0400 From: Gleb Smirnoff To: Ben Kaduk Message-ID: <20111217031737.GE67033@FreeBSD.org> References: <201112161216.pBGCGu8B006328@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228571 - in head: . lib/libc/net sbin/ifconfig share/man/man4 sys/net sys/netinet sys/netinet6 sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 03:17:39 -0000 Ben, On Fri, Dec 16, 2011 at 12:08:17PM -0500, Ben Kaduk wrote: B> Hi Gleb, B> B> Perhaps the man page portions that were commented out should just be B> removed entirely? They may be resurrected if arpbalancing is implemented again. -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 06:57:36 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F625106566B; Sat, 17 Dec 2011 06:57:36 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 741888FC08; Sat, 17 Dec 2011 06:57:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBH6vaw2047059; Sat, 17 Dec 2011 06:57:36 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBH6vaSt047057; Sat, 17 Dec 2011 06:57:36 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201112170657.pBH6vaSt047057@svn.freebsd.org> From: Ruslan Ermilov Date: Sat, 17 Dec 2011 06:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228620 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 06:57:36 -0000 Author: ru Date: Sat Dec 17 06:57:35 2011 New Revision: 228620 URL: http://svn.freebsd.org/changeset/base/228620 Log: Fixed some of markup. Reviewed by: jhb Modified: head/share/man/man9/shm_map.9 Modified: head/share/man/man9/shm_map.9 ============================================================================== --- head/share/man/man9/shm_map.9 Sat Dec 17 02:23:30 2011 (r228619) +++ head/share/man/man9/shm_map.9 Sat Dec 17 06:57:35 2011 (r228620) @@ -30,9 +30,8 @@ .Dt SHM_MAP 9 .Os .Sh NAME -.Nm shm_map , -.Nm shm_unmap -.Nd map shared memory objects into the kernel's address space +.Nm shm_map , shm_unmap +.Nd "map shared memory objects into the kernel's address space" .Sh SYNOPSIS .In sys/types.h .In sys/mman.h @@ -42,9 +41,9 @@ .Fn shm_unmap "struct file *fp" "void *mem" "size_t size" .Sh DESCRIPTION The -.Nm shm_map +.Fn shm_map and -.Nm shm_unmap +.Fn shm_unmap functions provide an API for mapping shared memory objects into the kernel. Shared memory objects are created by .Xr shm_open 2 . @@ -57,13 +56,13 @@ Shared memory objects can still be grown .Pp To simplify the accounting needed to enforce the above requirement, callers of this API are required to unmap the entire region mapped by -.Nm shm_map +.Fn shm_map when calling -.Nm shm_unmap . +.Fn shm_unmap . Unmapping only a portion of the region is not permitted. .Pp The -.Nm shm_map +.Fn shm_map function locates the shared memory object associated with the open file .Fa fp . It maps the region of that object described by @@ -77,9 +76,9 @@ will be set to the start of the mapping. All pages for the range will be wired into memory upon successful return. .Pp The -.Nm shm_unmap +.Fn shm_unmap function unmaps a region previously mapped by -.Nm shm_map . +.Fn shm_map . The .Fa mem argument should match the value previously returned in @@ -87,22 +86,22 @@ argument should match the value previous and the .Fa size argument should match the value passed to -.Nm shm_map . +.Fn shm_map . .Pp Note that -.Nm shm_map +.Fn shm_map will not hold an extra reference on the open file .Fa fp for the lifetime of the mapping. Instead, the calling code is required to do this if it wishes to use -.Nm shm_unmap +.Fn shm_unmap on the region in the future. .Sh RETURN VALUES The -.Nm shm_map +.Fn shm_map and -.Nm shm_unmap +.Fn shm_unmap functions return zero on success or an error on failure. .Sh EXAMPLES The following function accepts a file descriptor for a shared memory @@ -110,7 +109,7 @@ object. It maps the first sixteen kilobytes of the object into the kernel, performs some work on that address, and then unmaps the address before returning. -.Bd -literal +.Bd -literal -offset indent int shm_example(int fd) { @@ -118,7 +117,7 @@ shm_example(int fd) void *mem; int error; - error = fget(curthread, fd, CAP_MMAP, &fp) + error = fget(curthread, fd, CAP_MMAP, &fp); if (error) return (error); error = shm_map(fp, 16384, 0, &mem); @@ -136,7 +135,7 @@ shm_example(int fd) .Ed .Sh ERRORS The -.Nm shm_map +.Fn shm_map function returns the following errors on failure: .Bl -tag -width Er .It Bq Er EINVAL @@ -158,7 +157,7 @@ The shared memory object could not be ma .El .Pp The -.Nm shm_unmap +.Fn shm_unmap function returns the following errors on failure: .Bl -tag -width Er .It Bq Er EINVAL From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 08:34:13 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F7A7106564A; Sat, 17 Dec 2011 08:34:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 739238FC0C; Sat, 17 Dec 2011 08:34:11 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pBH8Xtvt013821 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 17 Dec 2011 10:33:55 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pBH8Xtex059673; Sat, 17 Dec 2011 10:33:55 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pBH8Xt8a059672; Sat, 17 Dec 2011 10:33:55 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 17 Dec 2011 10:33:55 +0200 From: Kostik Belousov To: Dimitry Andric Message-ID: <20111217083355.GZ50300@deviant.kiev.zoral.com.ua> References: <201112170136.pBH1apEH036884@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="lpp+eiGMS9nGU1lc" Content-Disposition: inline In-Reply-To: <201112170136.pBH1apEH036884@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228616 - head/usr.bin/tar X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 08:34:13 -0000 --lpp+eiGMS9nGU1lc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 17, 2011 at 01:36:51AM +0000, Dimitry Andric wrote: > Author: dim > Date: Sat Dec 17 01:36:50 2011 > New Revision: 228616 > URL: http://svn.freebsd.org/changeset/base/228616 >=20 > Log: > In usr.bin/tar/tree.c, if you really want to poke to NULL, you must use > volatile, otherwise the indirection will not be emitted. > =20 > MFC after: 1 week >=20 > Modified: > head/usr.bin/tar/tree.c >=20 > Modified: head/usr.bin/tar/tree.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.bin/tar/tree.c Sat Dec 17 01:29:46 2011 (r228615) > +++ head/usr.bin/tar/tree.c Sat Dec 17 01:36:50 2011 (r228616) > @@ -315,7 +315,7 @@ tree_next(struct tree *t) > const char *msg =3D "Unable to continue traversing" > " directory hierarchy after a fatal error."; > write(2, msg, strlen(msg)); > - *(int *)0 =3D 1; /* Deliberate SEGV; NULL pointer dereference. */ > + *(volatile int *)0 =3D 1; /* Deliberate SEGV; NULL pointer dereference= . */ > exit(1); /* In case the SEGV didn't work. */ > } > =20 Why this hack is used instead of abort(3) or abort2(2) ? --lpp+eiGMS9nGU1lc Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7sU/MACgkQC3+MBN1Mb4hqWwCfV1fv1gU4yVIFa/joVJoIAph3 HWgAmwWe73QJ40q9P+POHVzGMZTtYK0E =XdaY -----END PGP SIGNATURE----- --lpp+eiGMS9nGU1lc-- From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 10:23:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CB121065673; Sat, 17 Dec 2011 10:23:18 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 87F338FC0C; Sat, 17 Dec 2011 10:23:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHANIUn053343; Sat, 17 Dec 2011 10:23:18 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHANH9S053317; Sat, 17 Dec 2011 10:23:17 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201112171023.pBHANH9S053317@svn.freebsd.org> From: Bernhard Schmidt Date: Sat, 17 Dec 2011 10:23:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228621 - in head/sys: dev/an dev/ath dev/bwi dev/bwn dev/if_ndis dev/ipw dev/iwi dev/iwn dev/malo dev/mwl dev/ral dev/usb/wlan dev/wi dev/wpi net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 10:23:18 -0000 Author: bschmidt Date: Sat Dec 17 10:23:17 2011 New Revision: 228621 URL: http://svn.freebsd.org/changeset/base/228621 Log: Fix some net80211 enum nits: - ic_vap_create() uses an ieee80211_opmode argument - ieee80211_rate2media() takes an ieee80211_phymode argument - ieee80211_plcp2rate() takes an ieee80211_phytype argument - cast to enum ieee80211_protmode and ieee80211_roamingmode to silence compiler warnings Submitted by: arundel@ Modified: head/sys/dev/an/if_an.c head/sys/dev/ath/if_ath.c head/sys/dev/bwi/if_bwi.c head/sys/dev/bwn/if_bwn.c head/sys/dev/if_ndis/if_ndis.c head/sys/dev/ipw/if_ipw.c head/sys/dev/iwi/if_iwi.c head/sys/dev/iwn/if_iwn.c head/sys/dev/malo/if_malo.c head/sys/dev/mwl/if_mwl.c head/sys/dev/ral/rt2560.c head/sys/dev/ral/rt2661.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_uath.c head/sys/dev/usb/wlan/if_upgt.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_zyd.c head/sys/dev/wi/if_wi.c head/sys/dev/wpi/if_wpi.c head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_ioctl.c head/sys/net80211/ieee80211_var.h Modified: head/sys/dev/an/if_an.c ============================================================================== --- head/sys/dev/an/if_an.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/an/if_an.c Sat Dec 17 10:23:17 2011 (r228621) @@ -797,7 +797,7 @@ an_attach(struct an_softc *sc, int flags ADD(IFM_AUTO, IFM_IEEE80211_ADHOC); for (i = 0; i < nrate; i++) { r = sc->an_caps.an_rates[i]; - mword = ieee80211_rate2media(NULL, r, IEEE80211_T_DS); + mword = ieee80211_rate2media(NULL, r, IEEE80211_MODE_AUTO); if (mword == 0) continue; printf("%s%d%sMbps", (i != 0 ? " " : ""), @@ -3299,7 +3299,7 @@ an_media_status(struct ifnet *ifp, struc if (sc->an_config.an_opmode == AN_OPMODE_IBSS_ADHOC) imr->ifm_active |= IFM_IEEE80211_ADHOC; imr->ifm_active |= ieee80211_rate2media(NULL, - status.an_current_tx_rate, IEEE80211_T_DS); + status.an_current_tx_rate, IEEE80211_MODE_AUTO); imr->ifm_status = IFM_AVALID; if (status.an_opmode & AN_STATUS_OPMODE_ASSOCIATED) imr->ifm_status |= IFM_ACTIVE; Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/ath/if_ath.c Sat Dec 17 10:23:17 2011 (r228621) @@ -128,9 +128,9 @@ __FBSDID("$FreeBSD$"); CTASSERT(ATH_BCBUF <= 8); static struct ieee80211vap *ath_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void ath_vap_delete(struct ieee80211vap *); static void ath_init(void *); static void ath_stop_locked(struct ifnet *); @@ -885,16 +885,17 @@ assign_bslot(struct ath_softc *sc) } static struct ieee80211vap * -ath_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac0[IEEE80211_ADDR_LEN]) +ath_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac0[IEEE80211_ADDR_LEN]) { struct ath_softc *sc = ic->ic_ifp->if_softc; struct ath_vap *avp; struct ieee80211vap *vap; uint8_t mac[IEEE80211_ADDR_LEN]; - int ic_opmode, needbeacon, error; + int needbeacon, error; + enum ieee80211_opmode ic_opmode; avp = (struct ath_vap *) malloc(sizeof(struct ath_vap), M_80211_VAP, M_WAITOK | M_ZERO); Modified: head/sys/dev/bwi/if_bwi.c ============================================================================== --- head/sys/dev/bwi/if_bwi.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/bwi/if_bwi.c Sat Dec 17 10:23:17 2011 (r228621) @@ -96,9 +96,9 @@ struct bwi_myaddr_bssid { } __packed; static struct ieee80211vap *bwi_vap_create(struct ieee80211com *, - const char [IFNAMSIZ], int, int, int, - const uint8_t [IEEE80211_ADDR_LEN], - const uint8_t [IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void bwi_vap_delete(struct ieee80211vap *); static void bwi_init(void *); static int bwi_ioctl(struct ifnet *, u_long, caddr_t); @@ -118,7 +118,7 @@ static void bwi_calibrate(void *); static int bwi_calc_rssi(struct bwi_softc *, const struct bwi_rxbuf_hdr *); static int bwi_calc_noise(struct bwi_softc *); -static __inline uint8_t bwi_plcp2rate(uint32_t, enum ieee80211_phymode); +static __inline uint8_t bwi_plcp2rate(uint32_t, enum ieee80211_phytype); static void bwi_rx_radiotap(struct bwi_softc *, struct mbuf *, struct bwi_rxbuf_hdr *, const void *, int, int, int); @@ -591,10 +591,10 @@ bwi_detach(struct bwi_softc *sc) } static struct ieee80211vap * -bwi_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +bwi_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct bwi_vap *bvp; struct ieee80211vap *vap; @@ -2667,9 +2667,9 @@ bwi_rxeof(struct bwi_softc *sc, int end_ m_adj(m, sizeof(*hdr) + wh_ofs); if (htole16(hdr->rxh_flags1) & BWI_RXH_F1_OFDM) - rate = bwi_plcp2rate(plcp, IEEE80211_MODE_11G); + rate = bwi_plcp2rate(plcp, IEEE80211_T_OFDM); else - rate = bwi_plcp2rate(plcp, IEEE80211_MODE_11B); + rate = bwi_plcp2rate(plcp, IEEE80211_T_CCK); /* RX radio tap */ if (ieee80211_radiotap_active(ic)) @@ -3801,10 +3801,10 @@ bwi_calc_noise(struct bwi_softc *sc) } static __inline uint8_t -bwi_plcp2rate(const uint32_t plcp0, enum ieee80211_phymode phymode) +bwi_plcp2rate(const uint32_t plcp0, enum ieee80211_phytype type) { - uint32_t plcp = le32toh(plcp0) & IEEE80211_OFDM_PLCP_RATE_MASK; - return (ieee80211_plcp2rate(plcp, phymode)); + uint32_t plcp = le32toh(plcp0) & IEEE80211_OFDM_PLCP_RATE_MASK; + return (ieee80211_plcp2rate(plcp, type)); } static void Modified: head/sys/dev/bwn/if_bwn.c ============================================================================== --- head/sys/dev/bwn/if_bwn.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/bwn/if_bwn.c Sat Dec 17 10:23:17 2011 (r228621) @@ -193,8 +193,8 @@ static void bwn_scan_start(struct ieee80 static void bwn_scan_end(struct ieee80211com *); static void bwn_set_channel(struct ieee80211com *); static struct ieee80211vap *bwn_vap_create(struct ieee80211com *, - const char [IFNAMSIZ], int, int, - int, const uint8_t [IEEE80211_ADDR_LEN], + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN]); static void bwn_vap_delete(struct ieee80211vap *); static void bwn_stop(struct bwn_softc *, int); @@ -2927,10 +2927,10 @@ fail: } static struct ieee80211vap * -bwn_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac0[IEEE80211_ADDR_LEN]) +bwn_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac0[IEEE80211_ADDR_LEN]) { struct ifnet *ifp = ic->ic_ifp; struct bwn_softc *sc = ifp->if_softc; Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/if_ndis/if_ndis.c Sat Dec 17 10:23:17 2011 (r228621) @@ -150,9 +150,9 @@ static funcptr ndis_resettask_wrap; static funcptr ndis_inputtask_wrap; static struct ieee80211vap *ndis_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void ndis_vap_delete (struct ieee80211vap *); static void ndis_tick (void *); static void ndis_ticktask (device_object *, void *); @@ -973,10 +973,10 @@ fail: } static struct ieee80211vap * -ndis_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +ndis_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct ndis_vap *nvp; struct ieee80211vap *vap; Modified: head/sys/dev/ipw/if_ipw.c ============================================================================== --- head/sys/dev/ipw/if_ipw.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/ipw/if_ipw.c Sat Dec 17 10:23:17 2011 (r228621) @@ -108,9 +108,9 @@ static const struct ipw_ident ipw_ident_ }; static struct ieee80211vap *ipw_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void ipw_vap_delete(struct ieee80211vap *); static int ipw_dma_alloc(struct ipw_softc *); static void ipw_release(struct ipw_softc *); @@ -428,10 +428,10 @@ ipw_detach(device_t dev) } static struct ieee80211vap * -ipw_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +ipw_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct ifnet *ifp = ic->ic_ifp; struct ipw_softc *sc = ifp->if_softc; Modified: head/sys/dev/iwi/if_iwi.c ============================================================================== --- head/sys/dev/iwi/if_iwi.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/iwi/if_iwi.c Sat Dec 17 10:23:17 2011 (r228621) @@ -129,9 +129,9 @@ static const struct iwi_ident iwi_ident_ }; static struct ieee80211vap *iwi_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void iwi_vap_delete(struct ieee80211vap *); static void iwi_dma_map_addr(void *, bus_dma_segment_t *, int, int); static int iwi_alloc_cmd_ring(struct iwi_softc *, struct iwi_cmd_ring *, @@ -495,10 +495,10 @@ iwi_detach(device_t dev) } static struct ieee80211vap * -iwi_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +iwi_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct ifnet *ifp = ic->ic_ifp; struct iwi_softc *sc = ifp->if_softc; Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/iwn/if_iwn.c Sat Dec 17 10:23:17 2011 (r228621) @@ -116,9 +116,9 @@ static int iwn5000_attach(struct iwn_sof static void iwn_radiotap_attach(struct iwn_softc *); static void iwn_sysctlattach(struct iwn_softc *); static struct ieee80211vap *iwn_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void iwn_vap_delete(struct ieee80211vap *); static int iwn_detach(device_t); static int iwn_shutdown(device_t); @@ -845,8 +845,8 @@ iwn_sysctlattach(struct iwn_softc *sc) } static struct ieee80211vap * -iwn_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, +iwn_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t mac[IEEE80211_ADDR_LEN]) { Modified: head/sys/dev/malo/if_malo.c ============================================================================== --- head/sys/dev/malo/if_malo.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/malo/if_malo.c Sat Dec 17 10:23:17 2011 (r228621) @@ -125,10 +125,10 @@ enum { static MALLOC_DEFINE(M_MALODEV, "malodev", "malo driver dma buffers"); -static struct ieee80211vap *malo_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); +static struct ieee80211vap *malo_vap_create(struct ieee80211com *, + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void malo_vap_delete(struct ieee80211vap *); static int malo_dma_setup(struct malo_softc *); static int malo_setup_hwdma(struct malo_softc *); @@ -344,10 +344,10 @@ bad: } static struct ieee80211vap * -malo_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +malo_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct ifnet *ifp = ic->ic_ifp; struct malo_vap *mvp; Modified: head/sys/dev/mwl/if_mwl.c ============================================================================== --- head/sys/dev/mwl/if_mwl.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/mwl/if_mwl.c Sat Dec 17 10:23:17 2011 (r228621) @@ -83,9 +83,9 @@ __FBSDID("$FreeBSD$"); #define SM(v,x) (((v) << x##_S) & x) static struct ieee80211vap *mwl_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void mwl_vap_delete(struct ieee80211vap *); static int mwl_setupdma(struct mwl_softc *); static int mwl_hal_reset(struct mwl_softc *sc); @@ -601,10 +601,10 @@ reclaim_address(struct mwl_softc *sc, ui } static struct ieee80211vap * -mwl_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac0[IEEE80211_ADDR_LEN]) +mwl_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac0[IEEE80211_ADDR_LEN]) { struct ifnet *ifp = ic->ic_ifp; struct mwl_softc *sc = ifp->if_softc; Modified: head/sys/dev/ral/rt2560.c ============================================================================== --- head/sys/dev/ral/rt2560.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/ral/rt2560.c Sat Dec 17 10:23:17 2011 (r228621) @@ -85,9 +85,9 @@ __FBSDID("$FreeBSD$"); #endif static struct ieee80211vap *rt2560_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, + int, const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void rt2560_vap_delete(struct ieee80211vap *); static void rt2560_dma_map_addr(void *, bus_dma_segment_t *, int, int); @@ -373,10 +373,10 @@ rt2560_detach(void *xsc) } static struct ieee80211vap * -rt2560_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +rt2560_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct ifnet *ifp = ic->ic_ifp; struct rt2560_vap *rvp; Modified: head/sys/dev/ral/rt2661.c ============================================================================== --- head/sys/dev/ral/rt2661.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/ral/rt2661.c Sat Dec 17 10:23:17 2011 (r228621) @@ -82,9 +82,9 @@ __FBSDID("$FreeBSD$"); #endif static struct ieee80211vap *rt2661_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, + int, const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void rt2661_vap_delete(struct ieee80211vap *); static void rt2661_dma_map_addr(void *, bus_dma_segment_t *, int, int); @@ -368,10 +368,10 @@ rt2661_detach(void *xsc) } static struct ieee80211vap * -rt2661_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +rt2661_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct ifnet *ifp = ic->ic_ifp; struct rt2661_vap *rvp; Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/usb/wlan/if_rum.c Sat Dec 17 10:23:17 2011 (r228621) @@ -152,9 +152,9 @@ static usb_callback_t rum_bulk_write_cal static usb_error_t rum_do_request(struct rum_softc *sc, struct usb_device_request *req, void *data); static struct ieee80211vap *rum_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, + int, const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void rum_vap_delete(struct ieee80211vap *); static void rum_tx_free(struct rum_tx_data *, int); static void rum_setup_tx_list(struct rum_softc *); @@ -580,10 +580,10 @@ rum_do_request(struct rum_softc *sc, } static struct ieee80211vap * -rum_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +rum_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct rum_softc *sc = ic->ic_ifp->if_softc; struct rum_vap *rvp; Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/usb/wlan/if_run.c Sat Dec 17 10:23:17 2011 (r228621) @@ -315,9 +315,9 @@ static usb_callback_t run_bulk_tx_callba static void run_bulk_tx_callbackN(struct usb_xfer *xfer, usb_error_t error, unsigned int index); static struct ieee80211vap *run_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t - mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void run_vap_delete(struct ieee80211vap *); static void run_cmdq_cb(void *, int); static void run_setup_tx_list(struct run_softc *, @@ -748,8 +748,8 @@ run_detach(device_t self) } static struct ieee80211vap * -run_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, +run_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t mac[IEEE80211_ADDR_LEN]) { Modified: head/sys/dev/usb/wlan/if_uath.c ============================================================================== --- head/sys/dev/usb/wlan/if_uath.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/usb/wlan/if_uath.c Sat Dec 17 10:23:17 2011 (r228621) @@ -254,9 +254,9 @@ static const struct usb_config uath_usbc }; static struct ieee80211vap *uath_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void uath_vap_delete(struct ieee80211vap *); static int uath_alloc_cmd_list(struct uath_softc *, struct uath_cmd [], int, int); @@ -1065,10 +1065,10 @@ uath_free_tx_data_list(struct uath_softc } static struct ieee80211vap * -uath_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +uath_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct uath_vap *uvp; struct ieee80211vap *vap; Modified: head/sys/dev/usb/wlan/if_upgt.c ============================================================================== --- head/sys/dev/usb/wlan/if_upgt.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/usb/wlan/if_upgt.c Sat Dec 17 10:23:17 2011 (r228621) @@ -138,9 +138,9 @@ static void upgt_scan_start(struct ieee8 static void upgt_scan_end(struct ieee80211com *); static void upgt_set_channel(struct ieee80211com *); static struct ieee80211vap *upgt_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void upgt_vap_delete(struct ieee80211vap *); static void upgt_update_mcast(struct ifnet *); static uint8_t upgt_rx_rate(struct upgt_softc *, const int); @@ -1014,10 +1014,10 @@ upgt_set_chan(struct upgt_softc *sc, str } static struct ieee80211vap * -upgt_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +upgt_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct upgt_vap *uvp; struct ieee80211vap *vap; Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/usb/wlan/if_ural.c Sat Dec 17 10:23:17 2011 (r228621) @@ -131,9 +131,9 @@ static usb_callback_t ural_bulk_write_ca static usb_error_t ural_do_request(struct ural_softc *sc, struct usb_device_request *req, void *data); static struct ieee80211vap *ural_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, + int, const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void ural_vap_delete(struct ieee80211vap *); static void ural_tx_free(struct ural_tx_data *, int); static void ural_setup_tx_list(struct ural_softc *); @@ -568,10 +568,10 @@ ural_do_request(struct ural_softc *sc, } static struct ieee80211vap * -ural_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +ural_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct ural_softc *sc = ic->ic_ifp->if_softc; struct ural_vap *uvp; Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/usb/wlan/if_urtw.c Sat Dec 17 10:23:17 2011 (r228621) @@ -649,9 +649,9 @@ static const struct usb_config urtw_8187 }; static struct ieee80211vap *urtw_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, + int, const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void urtw_vap_delete(struct ieee80211vap *); static void urtw_init(void *); static void urtw_stop(struct ifnet *, int); @@ -993,10 +993,10 @@ urtw_free_data_list(struct urtw_softc *s } static struct ieee80211vap * -urtw_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +urtw_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct urtw_vap *uvp; struct ieee80211vap *vap; Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/usb/wlan/if_zyd.c Sat Dec 17 10:23:17 2011 (r228621) @@ -118,9 +118,9 @@ static usb_callback_t zyd_bulk_read_call static usb_callback_t zyd_bulk_write_callback; static struct ieee80211vap *zyd_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void zyd_vap_delete(struct ieee80211vap *); static void zyd_tx_free(struct zyd_tx_data *, int); static void zyd_setup_tx_list(struct zyd_softc *); @@ -456,10 +456,10 @@ zyd_detach(device_t dev) } static struct ieee80211vap * -zyd_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +zyd_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct zyd_vap *zvp; struct ieee80211vap *vap; Modified: head/sys/dev/wi/if_wi.c ============================================================================== --- head/sys/dev/wi/if_wi.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/wi/if_wi.c Sat Dec 17 10:23:17 2011 (r228621) @@ -108,10 +108,10 @@ __FBSDID("$FreeBSD$"); #include #include -static struct ieee80211vap *wi_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); +static struct ieee80211vap *wi_vap_create(struct ieee80211com *, + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void wi_vap_delete(struct ieee80211vap *vap); static void wi_stop_locked(struct wi_softc *sc, int disable); static void wi_start_locked(struct ifnet *); @@ -507,10 +507,10 @@ wi_detach(device_t dev) } static struct ieee80211vap * -wi_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +wi_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct wi_softc *sc = ic->ic_ifp->if_softc; struct wi_vap *wvp; Modified: head/sys/dev/wpi/if_wpi.c ============================================================================== --- head/sys/dev/wpi/if_wpi.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/dev/wpi/if_wpi.c Sat Dec 17 10:23:17 2011 (r228621) @@ -157,9 +157,9 @@ static const struct wpi_ident wpi_ident_ }; static struct ieee80211vap *wpi_vap_create(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, int opmode, - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); static void wpi_vap_delete(struct ieee80211vap *); static int wpi_dma_contig_alloc(struct wpi_softc *, struct wpi_dma_info *, void **, bus_size_t, bus_size_t, int); @@ -760,10 +760,10 @@ wpi_detach(device_t dev) } static struct ieee80211vap * -wpi_vap_create(struct ieee80211com *ic, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t mac[IEEE80211_ADDR_LEN]) +wpi_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct wpi_vap *wvp; struct ieee80211vap *vap; Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/net80211/ieee80211.c Sat Dec 17 10:23:17 2011 (r228621) @@ -384,9 +384,9 @@ default_reset(struct ieee80211vap *vap, */ int ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap, - const char name[IFNAMSIZ], int unit, int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t macaddr[IEEE80211_ADDR_LEN]) + const char name[IFNAMSIZ], int unit, enum ieee80211_opmode opmode, + int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t macaddr[IEEE80211_ADDR_LEN]) { struct ifnet *ifp; @@ -447,6 +447,8 @@ ieee80211_vap_setup(struct ieee80211com } break; #endif + default: + break; } /* auto-enable s/w beacon miss support */ if (flags & IEEE80211_CLONE_NOBEACONS) @@ -1008,7 +1010,8 @@ ieee80211_media_setup(struct ieee80211co struct ifmedia *media, int caps, int addsta, ifm_change_cb_t media_change, ifm_stat_cb_t media_stat) { - int i, j, mode, rate, maxrate, mword, r; + int i, j, rate, maxrate, mword, r; + enum ieee80211_phymode mode; const struct ieee80211_rateset *rs; struct ieee80211_rateset allrates; @@ -1137,7 +1140,8 @@ void ieee80211_announce(struct ieee80211com *ic) { struct ifnet *ifp = ic->ic_ifp; - int i, mode, rate, mword; + int i, rate, mword; + enum ieee80211_phymode mode; const struct ieee80211_rateset *rs; /* NB: skip AUTO since it has no rates */ Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/net80211/ieee80211_ht.c Sat Dec 17 10:23:17 2011 (r228621) @@ -307,7 +307,8 @@ ieee80211_ht_vdetach(struct ieee80211vap } static int -ht_getrate(struct ieee80211com *ic, int index, int mode, int ratetype) +ht_getrate(struct ieee80211com *ic, int index, enum ieee80211_phymode mode, + int ratetype) { int mword, rate; @@ -350,7 +351,7 @@ static struct printranges { }; static void -ht_rateprint(struct ieee80211com *ic, int mode, int ratetype) +ht_rateprint(struct ieee80211com *ic, enum ieee80211_phymode mode, int ratetype) { struct ifnet *ifp = ic->ic_ifp; int minrate, maxrate; @@ -379,7 +380,7 @@ ht_rateprint(struct ieee80211com *ic, in } static void -ht_announce(struct ieee80211com *ic, int mode) +ht_announce(struct ieee80211com *ic, enum ieee80211_phymode mode) { struct ifnet *ifp = ic->ic_ifp; const char *modestr = ieee80211_phymode_name[mode]; Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/net80211/ieee80211_ioctl.c Sat Dec 17 10:23:17 2011 (r228621) @@ -2737,7 +2737,7 @@ ieee80211_ioctl_set80211(struct ieee8021 case IEEE80211_IOC_PROTMODE: if (ireq->i_val > IEEE80211_PROT_RTSCTS) return EINVAL; - ic->ic_protmode = ireq->i_val; + ic->ic_protmode = (enum ieee80211_protmode)ireq->i_val; /* NB: if not operating in 11g this can wait */ if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan)) @@ -2756,7 +2756,7 @@ ieee80211_ioctl_set80211(struct ieee8021 if (!(IEEE80211_ROAMING_DEVICE <= ireq->i_val && ireq->i_val <= IEEE80211_ROAMING_MANUAL)) return EINVAL; - vap->iv_roaming = ireq->i_val; + vap->iv_roaming = (enum ieee80211_roamingmode)ireq->i_val; /* XXXX reset? */ break; case IEEE80211_IOC_PRIVACY: Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sat Dec 17 06:57:35 2011 (r228620) +++ head/sys/net80211/ieee80211_var.h Sat Dec 17 10:23:17 2011 (r228621) @@ -228,10 +228,10 @@ struct ieee80211com { /* virtual ap create/delete */ struct ieee80211vap* (*ic_vap_create)(struct ieee80211com *, - const char name[IFNAMSIZ], int unit, - int opmode, int flags, - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t macaddr[IEEE80211_ADDR_LEN]); + const char [IFNAMSIZ], int, + enum ieee80211_opmode, int, + const uint8_t [IEEE80211_ADDR_LEN], + const uint8_t [IEEE80211_ADDR_LEN]); void (*ic_vap_delete)(struct ieee80211vap *); /* operating mode attachment */ ieee80211vap_attach ic_vattach[IEEE80211_OPMODE_MAX]; @@ -662,7 +662,8 @@ void ieee80211_ifattach(struct ieee80211 const uint8_t macaddr[IEEE80211_ADDR_LEN]); void ieee80211_ifdetach(struct ieee80211com *); int ieee80211_vap_setup(struct ieee80211com *, struct ieee80211vap *, - const char name[IFNAMSIZ], int unit, int opmode, int flags, + const char name[IFNAMSIZ], int unit, + enum ieee80211_opmode opmode, int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t macaddr[IEEE80211_ADDR_LEN]); int ieee80211_vap_attach(struct ieee80211vap *, From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 10:32:31 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B21BD1065672; Sat, 17 Dec 2011 10:32:31 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A061A8FC0C; Sat, 17 Dec 2011 10:32:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHAWVLD053652; Sat, 17 Dec 2011 10:32:31 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHAWVbt053647; Sat, 17 Dec 2011 10:32:31 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201112171032.pBHAWVbt053647@svn.freebsd.org> From: Bernhard Schmidt Date: Sat, 17 Dec 2011 10:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228622 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 10:32:31 -0000 Author: bschmidt Date: Sat Dec 17 10:32:31 2011 New Revision: 228622 URL: http://svn.freebsd.org/changeset/base/228622 Log: Remove now redundant mac argument. Discussed with: adrian@ Modified: head/sys/net80211/ieee80211_acl.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_proto.h Modified: head/sys/net80211/ieee80211_acl.c ============================================================================== --- head/sys/net80211/ieee80211_acl.c Sat Dec 17 10:23:17 2011 (r228621) +++ head/sys/net80211/ieee80211_acl.c Sat Dec 17 10:32:31 2011 (r228622) @@ -152,8 +152,7 @@ _acl_free(struct aclstate *as, struct ac } static int -acl_check(struct ieee80211vap *vap, const struct ieee80211_frame *wh, - const uint8_t mac[IEEE80211_ADDR_LEN]) +acl_check(struct ieee80211vap *vap, const struct ieee80211_frame *wh) { struct aclstate *as = vap->iv_as; @@ -162,9 +161,9 @@ acl_check(struct ieee80211vap *vap, cons case ACL_POLICY_RADIUS: return 1; case ACL_POLICY_ALLOW: - return _find_acl(as, mac) != NULL; + return _find_acl(as, wh->i_addr2) != NULL; case ACL_POLICY_DENY: - return _find_acl(as, mac) == NULL; + return _find_acl(as, wh->i_addr2) == NULL; } return 0; /* should not happen */ } Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Sat Dec 17 10:23:17 2011 (r228621) +++ head/sys/net80211/ieee80211_hostap.c Sat Dec 17 10:32:31 2011 (r228622) @@ -1797,8 +1797,7 @@ hostap_recv_mgmt(struct ieee80211_node * /* * Consult the ACL policy module if setup. */ - if (vap->iv_acl != NULL && - !vap->iv_acl->iac_check(vap, wh, wh->i_addr2)) { + if (vap->iv_acl != NULL && !vap->iv_acl->iac_check(vap, wh)) { IEEE80211_DISCARD(vap, IEEE80211_MSG_ACL, wh, NULL, "%s", "disallowed by ACL"); vap->iv_stats.is_rx_acl++; @@ -1883,8 +1882,7 @@ hostap_recv_mgmt(struct ieee80211_node * /* * Consult the ACL policy module if setup. */ - if (vap->iv_acl != NULL && - !vap->iv_acl->iac_check(vap, wh, wh->i_addr2)) { + if (vap->iv_acl != NULL && !vap->iv_acl->iac_check(vap, wh)) { IEEE80211_DISCARD(vap, IEEE80211_MSG_ACL, wh, NULL, "%s", "disallowed by ACL"); vap->iv_stats.is_rx_acl++; Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Sat Dec 17 10:23:17 2011 (r228621) +++ head/sys/net80211/ieee80211_mesh.c Sat Dec 17 10:32:31 2011 (r228622) @@ -1120,8 +1120,7 @@ mesh_input(struct ieee80211_node *ni, st * * NB: this check is also done upon peering link initiation. */ - if (vap->iv_acl != NULL && - !vap->iv_acl->iac_check(vap, wh, wh->i_addr2)) { + if (vap->iv_acl != NULL && !vap->iv_acl->iac_check(vap, wh)) { IEEE80211_DISCARD(vap, IEEE80211_MSG_ACL, wh, NULL, "%s", "disallowed by ACL"); vap->iv_stats.is_rx_acl++; @@ -1379,8 +1378,7 @@ mesh_recv_mgmt(struct ieee80211_node *ni /* * Peer only based on the current ACL policy. */ - if (vap->iv_acl != NULL && - !vap->iv_acl->iac_check(vap, wh, wh->i_addr2)) { + if (vap->iv_acl != NULL && !vap->iv_acl->iac_check(vap, wh)) { IEEE80211_DISCARD(vap, IEEE80211_MSG_ACL, wh, NULL, "%s", "disallowed by ACL"); vap->iv_stats.is_rx_acl++; Modified: head/sys/net80211/ieee80211_proto.h ============================================================================== --- head/sys/net80211/ieee80211_proto.h Sat Dec 17 10:23:17 2011 (r228621) +++ head/sys/net80211/ieee80211_proto.h Sat Dec 17 10:32:31 2011 (r228622) @@ -215,8 +215,7 @@ struct ieee80211_aclator { int (*iac_attach)(struct ieee80211vap *); void (*iac_detach)(struct ieee80211vap *); int (*iac_check)(struct ieee80211vap *, - const struct ieee80211_frame *wh, - const uint8_t mac[IEEE80211_ADDR_LEN]); + const struct ieee80211_frame *wh); int (*iac_add)(struct ieee80211vap *, const uint8_t mac[IEEE80211_ADDR_LEN]); int (*iac_remove)(struct ieee80211vap *, From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 10:54:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 801741065672; Sat, 17 Dec 2011 10:54:05 +0000 (UTC) Date: Sat, 17 Dec 2011 10:54:05 +0000 From: Alexander Best To: Bernhard Schmidt Message-ID: <20111217105405.GA18782@freebsd.org> References: <201112171023.pBHANH9S053317@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112171023.pBHANH9S053317@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228621 - in head/sys: dev/an dev/ath dev/bwi dev/bwn dev/if_ndis dev/ipw dev/iwi dev/iwn dev/malo dev/mwl dev/ral dev/usb/wlan dev/wi dev/wpi net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 10:54:05 -0000 On Sat Dec 17 11, Bernhard Schmidt wrote: > Author: bschmidt > Date: Sat Dec 17 10:23:17 2011 > New Revision: 228621 > URL: http://svn.freebsd.org/changeset/base/228621 > > Log: > Fix some net80211 enum nits: > - ic_vap_create() uses an ieee80211_opmode argument > - ieee80211_rate2media() takes an ieee80211_phymode argument > - ieee80211_plcp2rate() takes an ieee80211_phytype argument > - cast to enum ieee80211_protmode and ieee80211_roamingmode to silence > compiler warnings > > Submitted by: arundel@ actually i merely submitted a problem report via kern/162475. ;) i didn't write a single patch. so all the credit goes to bernhard. :) > > Modified: > head/sys/dev/an/if_an.c > head/sys/dev/ath/if_ath.c > head/sys/dev/bwi/if_bwi.c > head/sys/dev/bwn/if_bwn.c > head/sys/dev/if_ndis/if_ndis.c > head/sys/dev/ipw/if_ipw.c > head/sys/dev/iwi/if_iwi.c > head/sys/dev/iwn/if_iwn.c > head/sys/dev/malo/if_malo.c > head/sys/dev/mwl/if_mwl.c > head/sys/dev/ral/rt2560.c > head/sys/dev/ral/rt2661.c > head/sys/dev/usb/wlan/if_rum.c > head/sys/dev/usb/wlan/if_run.c > head/sys/dev/usb/wlan/if_uath.c > head/sys/dev/usb/wlan/if_upgt.c > head/sys/dev/usb/wlan/if_ural.c > head/sys/dev/usb/wlan/if_urtw.c > head/sys/dev/usb/wlan/if_zyd.c > head/sys/dev/wi/if_wi.c > head/sys/dev/wpi/if_wpi.c > head/sys/net80211/ieee80211.c > head/sys/net80211/ieee80211_ht.c > head/sys/net80211/ieee80211_ioctl.c > head/sys/net80211/ieee80211_var.h > > Modified: head/sys/dev/an/if_an.c > ============================================================================== > --- head/sys/dev/an/if_an.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/an/if_an.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -797,7 +797,7 @@ an_attach(struct an_softc *sc, int flags > ADD(IFM_AUTO, IFM_IEEE80211_ADHOC); > for (i = 0; i < nrate; i++) { > r = sc->an_caps.an_rates[i]; > - mword = ieee80211_rate2media(NULL, r, IEEE80211_T_DS); > + mword = ieee80211_rate2media(NULL, r, IEEE80211_MODE_AUTO); > if (mword == 0) > continue; > printf("%s%d%sMbps", (i != 0 ? " " : ""), > @@ -3299,7 +3299,7 @@ an_media_status(struct ifnet *ifp, struc > if (sc->an_config.an_opmode == AN_OPMODE_IBSS_ADHOC) > imr->ifm_active |= IFM_IEEE80211_ADHOC; > imr->ifm_active |= ieee80211_rate2media(NULL, > - status.an_current_tx_rate, IEEE80211_T_DS); > + status.an_current_tx_rate, IEEE80211_MODE_AUTO); > imr->ifm_status = IFM_AVALID; > if (status.an_opmode & AN_STATUS_OPMODE_ASSOCIATED) > imr->ifm_status |= IFM_ACTIVE; > > Modified: head/sys/dev/ath/if_ath.c > ============================================================================== > --- head/sys/dev/ath/if_ath.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/ath/if_ath.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -128,9 +128,9 @@ __FBSDID("$FreeBSD$"); > CTASSERT(ATH_BCBUF <= 8); > > static struct ieee80211vap *ath_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, > - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void ath_vap_delete(struct ieee80211vap *); > static void ath_init(void *); > static void ath_stop_locked(struct ifnet *); > @@ -885,16 +885,17 @@ assign_bslot(struct ath_softc *sc) > } > > static struct ieee80211vap * > -ath_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac0[IEEE80211_ADDR_LEN]) > +ath_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac0[IEEE80211_ADDR_LEN]) > { > struct ath_softc *sc = ic->ic_ifp->if_softc; > struct ath_vap *avp; > struct ieee80211vap *vap; > uint8_t mac[IEEE80211_ADDR_LEN]; > - int ic_opmode, needbeacon, error; > + int needbeacon, error; > + enum ieee80211_opmode ic_opmode; > > avp = (struct ath_vap *) malloc(sizeof(struct ath_vap), > M_80211_VAP, M_WAITOK | M_ZERO); > > Modified: head/sys/dev/bwi/if_bwi.c > ============================================================================== > --- head/sys/dev/bwi/if_bwi.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/bwi/if_bwi.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -96,9 +96,9 @@ struct bwi_myaddr_bssid { > } __packed; > > static struct ieee80211vap *bwi_vap_create(struct ieee80211com *, > - const char [IFNAMSIZ], int, int, int, > - const uint8_t [IEEE80211_ADDR_LEN], > - const uint8_t [IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void bwi_vap_delete(struct ieee80211vap *); > static void bwi_init(void *); > static int bwi_ioctl(struct ifnet *, u_long, caddr_t); > @@ -118,7 +118,7 @@ static void bwi_calibrate(void *); > > static int bwi_calc_rssi(struct bwi_softc *, const struct bwi_rxbuf_hdr *); > static int bwi_calc_noise(struct bwi_softc *); > -static __inline uint8_t bwi_plcp2rate(uint32_t, enum ieee80211_phymode); > +static __inline uint8_t bwi_plcp2rate(uint32_t, enum ieee80211_phytype); > static void bwi_rx_radiotap(struct bwi_softc *, struct mbuf *, > struct bwi_rxbuf_hdr *, const void *, int, int, int); > > @@ -591,10 +591,10 @@ bwi_detach(struct bwi_softc *sc) > } > > static struct ieee80211vap * > -bwi_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +bwi_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct bwi_vap *bvp; > struct ieee80211vap *vap; > @@ -2667,9 +2667,9 @@ bwi_rxeof(struct bwi_softc *sc, int end_ > m_adj(m, sizeof(*hdr) + wh_ofs); > > if (htole16(hdr->rxh_flags1) & BWI_RXH_F1_OFDM) > - rate = bwi_plcp2rate(plcp, IEEE80211_MODE_11G); > + rate = bwi_plcp2rate(plcp, IEEE80211_T_OFDM); > else > - rate = bwi_plcp2rate(plcp, IEEE80211_MODE_11B); > + rate = bwi_plcp2rate(plcp, IEEE80211_T_CCK); > > /* RX radio tap */ > if (ieee80211_radiotap_active(ic)) > @@ -3801,10 +3801,10 @@ bwi_calc_noise(struct bwi_softc *sc) > } > > static __inline uint8_t > -bwi_plcp2rate(const uint32_t plcp0, enum ieee80211_phymode phymode) > +bwi_plcp2rate(const uint32_t plcp0, enum ieee80211_phytype type) > { > - uint32_t plcp = le32toh(plcp0) & IEEE80211_OFDM_PLCP_RATE_MASK; > - return (ieee80211_plcp2rate(plcp, phymode)); > + uint32_t plcp = le32toh(plcp0) & IEEE80211_OFDM_PLCP_RATE_MASK; > + return (ieee80211_plcp2rate(plcp, type)); > } > > static void > > Modified: head/sys/dev/bwn/if_bwn.c > ============================================================================== > --- head/sys/dev/bwn/if_bwn.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/bwn/if_bwn.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -193,8 +193,8 @@ static void bwn_scan_start(struct ieee80 > static void bwn_scan_end(struct ieee80211com *); > static void bwn_set_channel(struct ieee80211com *); > static struct ieee80211vap *bwn_vap_create(struct ieee80211com *, > - const char [IFNAMSIZ], int, int, > - int, const uint8_t [IEEE80211_ADDR_LEN], > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > const uint8_t [IEEE80211_ADDR_LEN]); > static void bwn_vap_delete(struct ieee80211vap *); > static void bwn_stop(struct bwn_softc *, int); > @@ -2927,10 +2927,10 @@ fail: > } > > static struct ieee80211vap * > -bwn_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac0[IEEE80211_ADDR_LEN]) > +bwn_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac0[IEEE80211_ADDR_LEN]) > { > struct ifnet *ifp = ic->ic_ifp; > struct bwn_softc *sc = ifp->if_softc; > > Modified: head/sys/dev/if_ndis/if_ndis.c > ============================================================================== > --- head/sys/dev/if_ndis/if_ndis.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/if_ndis/if_ndis.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -150,9 +150,9 @@ static funcptr ndis_resettask_wrap; > static funcptr ndis_inputtask_wrap; > > static struct ieee80211vap *ndis_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, > - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void ndis_vap_delete (struct ieee80211vap *); > static void ndis_tick (void *); > static void ndis_ticktask (device_object *, void *); > @@ -973,10 +973,10 @@ fail: > } > > static struct ieee80211vap * > -ndis_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +ndis_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct ndis_vap *nvp; > struct ieee80211vap *vap; > > Modified: head/sys/dev/ipw/if_ipw.c > ============================================================================== > --- head/sys/dev/ipw/if_ipw.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/ipw/if_ipw.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -108,9 +108,9 @@ static const struct ipw_ident ipw_ident_ > }; > > static struct ieee80211vap *ipw_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void ipw_vap_delete(struct ieee80211vap *); > static int ipw_dma_alloc(struct ipw_softc *); > static void ipw_release(struct ipw_softc *); > @@ -428,10 +428,10 @@ ipw_detach(device_t dev) > } > > static struct ieee80211vap * > -ipw_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +ipw_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct ifnet *ifp = ic->ic_ifp; > struct ipw_softc *sc = ifp->if_softc; > > Modified: head/sys/dev/iwi/if_iwi.c > ============================================================================== > --- head/sys/dev/iwi/if_iwi.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/iwi/if_iwi.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -129,9 +129,9 @@ static const struct iwi_ident iwi_ident_ > }; > > static struct ieee80211vap *iwi_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void iwi_vap_delete(struct ieee80211vap *); > static void iwi_dma_map_addr(void *, bus_dma_segment_t *, int, int); > static int iwi_alloc_cmd_ring(struct iwi_softc *, struct iwi_cmd_ring *, > @@ -495,10 +495,10 @@ iwi_detach(device_t dev) > } > > static struct ieee80211vap * > -iwi_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +iwi_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct ifnet *ifp = ic->ic_ifp; > struct iwi_softc *sc = ifp->if_softc; > > Modified: head/sys/dev/iwn/if_iwn.c > ============================================================================== > --- head/sys/dev/iwn/if_iwn.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/iwn/if_iwn.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -116,9 +116,9 @@ static int iwn5000_attach(struct iwn_sof > static void iwn_radiotap_attach(struct iwn_softc *); > static void iwn_sysctlattach(struct iwn_softc *); > static struct ieee80211vap *iwn_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, > - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void iwn_vap_delete(struct ieee80211vap *); > static int iwn_detach(device_t); > static int iwn_shutdown(device_t); > @@ -845,8 +845,8 @@ iwn_sysctlattach(struct iwn_softc *sc) > } > > static struct ieee80211vap * > -iwn_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > +iwn_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > const uint8_t bssid[IEEE80211_ADDR_LEN], > const uint8_t mac[IEEE80211_ADDR_LEN]) > { > > Modified: head/sys/dev/malo/if_malo.c > ============================================================================== > --- head/sys/dev/malo/if_malo.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/malo/if_malo.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -125,10 +125,10 @@ enum { > > static MALLOC_DEFINE(M_MALODEV, "malodev", "malo driver dma buffers"); > > -static struct ieee80211vap *malo_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > +static struct ieee80211vap *malo_vap_create(struct ieee80211com *, > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void malo_vap_delete(struct ieee80211vap *); > static int malo_dma_setup(struct malo_softc *); > static int malo_setup_hwdma(struct malo_softc *); > @@ -344,10 +344,10 @@ bad: > } > > static struct ieee80211vap * > -malo_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +malo_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct ifnet *ifp = ic->ic_ifp; > struct malo_vap *mvp; > > Modified: head/sys/dev/mwl/if_mwl.c > ============================================================================== > --- head/sys/dev/mwl/if_mwl.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/mwl/if_mwl.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -83,9 +83,9 @@ __FBSDID("$FreeBSD$"); > #define SM(v,x) (((v) << x##_S) & x) > > static struct ieee80211vap *mwl_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, > - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void mwl_vap_delete(struct ieee80211vap *); > static int mwl_setupdma(struct mwl_softc *); > static int mwl_hal_reset(struct mwl_softc *sc); > @@ -601,10 +601,10 @@ reclaim_address(struct mwl_softc *sc, ui > } > > static struct ieee80211vap * > -mwl_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac0[IEEE80211_ADDR_LEN]) > +mwl_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac0[IEEE80211_ADDR_LEN]) > { > struct ifnet *ifp = ic->ic_ifp; > struct mwl_softc *sc = ifp->if_softc; > > Modified: head/sys/dev/ral/rt2560.c > ============================================================================== > --- head/sys/dev/ral/rt2560.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/ral/rt2560.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -85,9 +85,9 @@ __FBSDID("$FreeBSD$"); > #endif > > static struct ieee80211vap *rt2560_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, > - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, > + int, const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void rt2560_vap_delete(struct ieee80211vap *); > static void rt2560_dma_map_addr(void *, bus_dma_segment_t *, int, > int); > @@ -373,10 +373,10 @@ rt2560_detach(void *xsc) > } > > static struct ieee80211vap * > -rt2560_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +rt2560_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct ifnet *ifp = ic->ic_ifp; > struct rt2560_vap *rvp; > > Modified: head/sys/dev/ral/rt2661.c > ============================================================================== > --- head/sys/dev/ral/rt2661.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/ral/rt2661.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -82,9 +82,9 @@ __FBSDID("$FreeBSD$"); > #endif > > static struct ieee80211vap *rt2661_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, > - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, > + int, const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void rt2661_vap_delete(struct ieee80211vap *); > static void rt2661_dma_map_addr(void *, bus_dma_segment_t *, int, > int); > @@ -368,10 +368,10 @@ rt2661_detach(void *xsc) > } > > static struct ieee80211vap * > -rt2661_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +rt2661_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct ifnet *ifp = ic->ic_ifp; > struct rt2661_vap *rvp; > > Modified: head/sys/dev/usb/wlan/if_rum.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_rum.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/usb/wlan/if_rum.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -152,9 +152,9 @@ static usb_callback_t rum_bulk_write_cal > static usb_error_t rum_do_request(struct rum_softc *sc, > struct usb_device_request *req, void *data); > static struct ieee80211vap *rum_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, > - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, > + int, const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void rum_vap_delete(struct ieee80211vap *); > static void rum_tx_free(struct rum_tx_data *, int); > static void rum_setup_tx_list(struct rum_softc *); > @@ -580,10 +580,10 @@ rum_do_request(struct rum_softc *sc, > } > > static struct ieee80211vap * > -rum_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +rum_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct rum_softc *sc = ic->ic_ifp->if_softc; > struct rum_vap *rvp; > > Modified: head/sys/dev/usb/wlan/if_run.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_run.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/usb/wlan/if_run.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -315,9 +315,9 @@ static usb_callback_t run_bulk_tx_callba > static void run_bulk_tx_callbackN(struct usb_xfer *xfer, > usb_error_t error, unsigned int index); > static struct ieee80211vap *run_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], const uint8_t > - mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void run_vap_delete(struct ieee80211vap *); > static void run_cmdq_cb(void *, int); > static void run_setup_tx_list(struct run_softc *, > @@ -748,8 +748,8 @@ run_detach(device_t self) > } > > static struct ieee80211vap * > -run_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > +run_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > const uint8_t bssid[IEEE80211_ADDR_LEN], > const uint8_t mac[IEEE80211_ADDR_LEN]) > { > > Modified: head/sys/dev/usb/wlan/if_uath.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_uath.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/usb/wlan/if_uath.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -254,9 +254,9 @@ static const struct usb_config uath_usbc > }; > > static struct ieee80211vap *uath_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, > - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void uath_vap_delete(struct ieee80211vap *); > static int uath_alloc_cmd_list(struct uath_softc *, struct uath_cmd [], > int, int); > @@ -1065,10 +1065,10 @@ uath_free_tx_data_list(struct uath_softc > } > > static struct ieee80211vap * > -uath_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +uath_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct uath_vap *uvp; > struct ieee80211vap *vap; > > Modified: head/sys/dev/usb/wlan/if_upgt.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_upgt.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/usb/wlan/if_upgt.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -138,9 +138,9 @@ static void upgt_scan_start(struct ieee8 > static void upgt_scan_end(struct ieee80211com *); > static void upgt_set_channel(struct ieee80211com *); > static struct ieee80211vap *upgt_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, > - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void upgt_vap_delete(struct ieee80211vap *); > static void upgt_update_mcast(struct ifnet *); > static uint8_t upgt_rx_rate(struct upgt_softc *, const int); > @@ -1014,10 +1014,10 @@ upgt_set_chan(struct upgt_softc *sc, str > } > > static struct ieee80211vap * > -upgt_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +upgt_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct upgt_vap *uvp; > struct ieee80211vap *vap; > > Modified: head/sys/dev/usb/wlan/if_ural.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_ural.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/usb/wlan/if_ural.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -131,9 +131,9 @@ static usb_callback_t ural_bulk_write_ca > static usb_error_t ural_do_request(struct ural_softc *sc, > struct usb_device_request *req, void *data); > static struct ieee80211vap *ural_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, > - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, > + int, const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void ural_vap_delete(struct ieee80211vap *); > static void ural_tx_free(struct ural_tx_data *, int); > static void ural_setup_tx_list(struct ural_softc *); > @@ -568,10 +568,10 @@ ural_do_request(struct ural_softc *sc, > } > > static struct ieee80211vap * > -ural_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +ural_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct ural_softc *sc = ic->ic_ifp->if_softc; > struct ural_vap *uvp; > > Modified: head/sys/dev/usb/wlan/if_urtw.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_urtw.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/usb/wlan/if_urtw.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -649,9 +649,9 @@ static const struct usb_config urtw_8187 > }; > > static struct ieee80211vap *urtw_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, > - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, > + int, const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void urtw_vap_delete(struct ieee80211vap *); > static void urtw_init(void *); > static void urtw_stop(struct ifnet *, int); > @@ -993,10 +993,10 @@ urtw_free_data_list(struct urtw_softc *s > } > > static struct ieee80211vap * > -urtw_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +urtw_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct urtw_vap *uvp; > struct ieee80211vap *vap; > > Modified: head/sys/dev/usb/wlan/if_zyd.c > ============================================================================== > --- head/sys/dev/usb/wlan/if_zyd.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/usb/wlan/if_zyd.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -118,9 +118,9 @@ static usb_callback_t zyd_bulk_read_call > static usb_callback_t zyd_bulk_write_callback; > > static struct ieee80211vap *zyd_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, > - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void zyd_vap_delete(struct ieee80211vap *); > static void zyd_tx_free(struct zyd_tx_data *, int); > static void zyd_setup_tx_list(struct zyd_softc *); > @@ -456,10 +456,10 @@ zyd_detach(device_t dev) > } > > static struct ieee80211vap * > -zyd_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +zyd_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct zyd_vap *zvp; > struct ieee80211vap *vap; > > Modified: head/sys/dev/wi/if_wi.c > ============================================================================== > --- head/sys/dev/wi/if_wi.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/wi/if_wi.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -108,10 +108,10 @@ __FBSDID("$FreeBSD$"); > #include > #include > > -static struct ieee80211vap *wi_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > +static struct ieee80211vap *wi_vap_create(struct ieee80211com *, > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void wi_vap_delete(struct ieee80211vap *vap); > static void wi_stop_locked(struct wi_softc *sc, int disable); > static void wi_start_locked(struct ifnet *); > @@ -507,10 +507,10 @@ wi_detach(device_t dev) > } > > static struct ieee80211vap * > -wi_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +wi_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct wi_softc *sc = ic->ic_ifp->if_softc; > struct wi_vap *wvp; > > Modified: head/sys/dev/wpi/if_wpi.c > ============================================================================== > --- head/sys/dev/wpi/if_wpi.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/dev/wpi/if_wpi.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -157,9 +157,9 @@ static const struct wpi_ident wpi_ident_ > }; > > static struct ieee80211vap *wpi_vap_create(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, int opmode, > - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > static void wpi_vap_delete(struct ieee80211vap *); > static int wpi_dma_contig_alloc(struct wpi_softc *, struct wpi_dma_info *, > void **, bus_size_t, bus_size_t, int); > @@ -760,10 +760,10 @@ wpi_detach(device_t dev) > } > > static struct ieee80211vap * > -wpi_vap_create(struct ieee80211com *ic, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t mac[IEEE80211_ADDR_LEN]) > +wpi_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > + const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct wpi_vap *wvp; > struct ieee80211vap *vap; > > Modified: head/sys/net80211/ieee80211.c > ============================================================================== > --- head/sys/net80211/ieee80211.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/net80211/ieee80211.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -384,9 +384,9 @@ default_reset(struct ieee80211vap *vap, > */ > int > ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t macaddr[IEEE80211_ADDR_LEN]) > + const char name[IFNAMSIZ], int unit, enum ieee80211_opmode opmode, > + int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], > + const uint8_t macaddr[IEEE80211_ADDR_LEN]) > { > struct ifnet *ifp; > > @@ -447,6 +447,8 @@ ieee80211_vap_setup(struct ieee80211com > } > break; > #endif > + default: > + break; > } > /* auto-enable s/w beacon miss support */ > if (flags & IEEE80211_CLONE_NOBEACONS) > @@ -1008,7 +1010,8 @@ ieee80211_media_setup(struct ieee80211co > struct ifmedia *media, int caps, int addsta, > ifm_change_cb_t media_change, ifm_stat_cb_t media_stat) > { > - int i, j, mode, rate, maxrate, mword, r; > + int i, j, rate, maxrate, mword, r; > + enum ieee80211_phymode mode; > const struct ieee80211_rateset *rs; > struct ieee80211_rateset allrates; > > @@ -1137,7 +1140,8 @@ void > ieee80211_announce(struct ieee80211com *ic) > { > struct ifnet *ifp = ic->ic_ifp; > - int i, mode, rate, mword; > + int i, rate, mword; > + enum ieee80211_phymode mode; > const struct ieee80211_rateset *rs; > > /* NB: skip AUTO since it has no rates */ > > Modified: head/sys/net80211/ieee80211_ht.c > ============================================================================== > --- head/sys/net80211/ieee80211_ht.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/net80211/ieee80211_ht.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -307,7 +307,8 @@ ieee80211_ht_vdetach(struct ieee80211vap > } > > static int > -ht_getrate(struct ieee80211com *ic, int index, int mode, int ratetype) > +ht_getrate(struct ieee80211com *ic, int index, enum ieee80211_phymode mode, > + int ratetype) > { > int mword, rate; > > @@ -350,7 +351,7 @@ static struct printranges { > }; > > static void > -ht_rateprint(struct ieee80211com *ic, int mode, int ratetype) > +ht_rateprint(struct ieee80211com *ic, enum ieee80211_phymode mode, int ratetype) > { > struct ifnet *ifp = ic->ic_ifp; > int minrate, maxrate; > @@ -379,7 +380,7 @@ ht_rateprint(struct ieee80211com *ic, in > } > > static void > -ht_announce(struct ieee80211com *ic, int mode) > +ht_announce(struct ieee80211com *ic, enum ieee80211_phymode mode) > { > struct ifnet *ifp = ic->ic_ifp; > const char *modestr = ieee80211_phymode_name[mode]; > > Modified: head/sys/net80211/ieee80211_ioctl.c > ============================================================================== > --- head/sys/net80211/ieee80211_ioctl.c Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/net80211/ieee80211_ioctl.c Sat Dec 17 10:23:17 2011 (r228621) > @@ -2737,7 +2737,7 @@ ieee80211_ioctl_set80211(struct ieee8021 > case IEEE80211_IOC_PROTMODE: > if (ireq->i_val > IEEE80211_PROT_RTSCTS) > return EINVAL; > - ic->ic_protmode = ireq->i_val; > + ic->ic_protmode = (enum ieee80211_protmode)ireq->i_val; > /* NB: if not operating in 11g this can wait */ > if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && > IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan)) > @@ -2756,7 +2756,7 @@ ieee80211_ioctl_set80211(struct ieee8021 > if (!(IEEE80211_ROAMING_DEVICE <= ireq->i_val && > ireq->i_val <= IEEE80211_ROAMING_MANUAL)) > return EINVAL; > - vap->iv_roaming = ireq->i_val; > + vap->iv_roaming = (enum ieee80211_roamingmode)ireq->i_val; > /* XXXX reset? */ > break; > case IEEE80211_IOC_PRIVACY: > > Modified: head/sys/net80211/ieee80211_var.h > ============================================================================== > --- head/sys/net80211/ieee80211_var.h Sat Dec 17 06:57:35 2011 (r228620) > +++ head/sys/net80211/ieee80211_var.h Sat Dec 17 10:23:17 2011 (r228621) > @@ -228,10 +228,10 @@ struct ieee80211com { > > /* virtual ap create/delete */ > struct ieee80211vap* (*ic_vap_create)(struct ieee80211com *, > - const char name[IFNAMSIZ], int unit, > - int opmode, int flags, > - const uint8_t bssid[IEEE80211_ADDR_LEN], > - const uint8_t macaddr[IEEE80211_ADDR_LEN]); > + const char [IFNAMSIZ], int, > + enum ieee80211_opmode, int, > + const uint8_t [IEEE80211_ADDR_LEN], > + const uint8_t [IEEE80211_ADDR_LEN]); > void (*ic_vap_delete)(struct ieee80211vap *); > /* operating mode attachment */ > ieee80211vap_attach ic_vattach[IEEE80211_OPMODE_MAX]; > @@ -662,7 +662,8 @@ void ieee80211_ifattach(struct ieee80211 > const uint8_t macaddr[IEEE80211_ADDR_LEN]); > void ieee80211_ifdetach(struct ieee80211com *); > int ieee80211_vap_setup(struct ieee80211com *, struct ieee80211vap *, > - const char name[IFNAMSIZ], int unit, int opmode, int flags, > + const char name[IFNAMSIZ], int unit, > + enum ieee80211_opmode opmode, int flags, > const uint8_t bssid[IEEE80211_ADDR_LEN], > const uint8_t macaddr[IEEE80211_ADDR_LEN]); > int ieee80211_vap_attach(struct ieee80211vap *, From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 11:06:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5344A106574B; Sat, 17 Dec 2011 11:06:23 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27A918FC20; Sat, 17 Dec 2011 11:06:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHB6NMB056564; Sat, 17 Dec 2011 11:06:23 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHB6MAu056562; Sat, 17 Dec 2011 11:06:22 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201112171106.pBHB6MAu056562@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 17 Dec 2011 11:06:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228623 - head/contrib/bsnmp/snmp_mibII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 11:06:23 -0000 Author: bz Date: Sat Dec 17 11:06:22 2011 New Revision: 228623 URL: http://svn.freebsd.org/changeset/base/228623 Log: Adter r228571 unbreak architectures with strict alignment rules by copying rather than casting. Modified: head/contrib/bsnmp/snmp_mibII/mibII.c Modified: head/contrib/bsnmp/snmp_mibII/mibII.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII.c Sat Dec 17 10:32:31 2011 (r228622) +++ head/contrib/bsnmp/snmp_mibII/mibII.c Sat Dec 17 11:06:22 2011 (r228623) @@ -941,7 +941,7 @@ handle_rtmsg(struct rt_msghdr *rtm) { struct sockaddr *addrs[RTAX_MAX]; struct if_msghdr *ifm; - struct ifa_msghdr *ifam; + struct ifa_msghdr ifam; struct ifma_msghdr *ifmam; #ifdef RTM_IFANNOUNCE struct if_announcemsghdr *ifan; @@ -961,17 +961,17 @@ handle_rtmsg(struct rt_msghdr *rtm) switch (rtm->rtm_type) { case RTM_NEWADDR: - ifam = (struct ifa_msghdr *)rtm; - mib_extract_addrs(ifam->ifam_addrs, (u_char *)(ifam + 1), addrs); + memcpy(&ifam, rtm, sizeof(ifam)); + mib_extract_addrs(ifam.ifam_addrs, (u_char *)(&ifam + 1), addrs); if (addrs[RTAX_IFA] == NULL || addrs[RTAX_NETMASK] == NULL) break; sa = (struct sockaddr_in *)(void *)addrs[RTAX_IFA]; if ((ifa = mib_find_ifa(sa->sin_addr)) == NULL) { /* unknown address */ - if ((ifp = mib_find_if_sys(ifam->ifam_index)) == NULL) { + if ((ifp = mib_find_if_sys(ifam.ifam_index)) == NULL) { syslog(LOG_WARNING, "RTM_NEWADDR for unknown " - "interface %u", ifam->ifam_index); + "interface %u", ifam.ifam_index); break; } if ((ifa = alloc_ifa(ifp->index, sa->sin_addr)) == NULL) @@ -988,8 +988,8 @@ handle_rtmsg(struct rt_msghdr *rtm) break; case RTM_DELADDR: - ifam = (struct ifa_msghdr *)rtm; - mib_extract_addrs(ifam->ifam_addrs, (u_char *)(ifam + 1), addrs); + memcpy(&ifam, rtm, sizeof(ifam)); + mib_extract_addrs(ifam.ifam_addrs, (u_char *)(&ifam + 1), addrs); if (addrs[RTAX_IFA] == NULL) break; From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 12:20:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 338B6106564A for ; Sat, 17 Dec 2011 12:20:09 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo-p00-ob6.rzone.de (mo-p00-ob6.rzone.de [IPv6:2a01:238:20a:202:53f0::1]) by mx1.freebsd.org (Postfix) with ESMTP id B77C78FC16 for ; Sat, 17 Dec 2011 12:20:08 +0000 (UTC) X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQv0cW+St/nW/auYssSp3kbaKtlgUyQ== X-RZG-CLASS-ID: mo00 Received: from britannica.bec.de (ip-2-207-69-227.web.vodafone.de [2.207.69.227]) by post.strato.de (mrclete mo13) (RZmta 26.15 DYNA|AUTH) with (DHE-RSA-AES128-SHA encrypted) ESMTPA id y04ce6nBH9cqnw for ; Sat, 17 Dec 2011 13:20:00 +0100 (MET) Received: by britannica.bec.de (sSMTP sendmail emulation); Sat, 17 Dec 2011 13:19:59 +0100 Date: Sat, 17 Dec 2011 13:19:59 +0100 From: Joerg Sonnenberger To: svn-src-all@freebsd.org Message-ID: <20111217121959.GB12193@britannica.bec.de> References: <201112170119.pBH1J7BV036204@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112170119.pBH1J7BV036204@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: svn commit: r228614 - head/sbin/dhclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 12:20:09 -0000 On Sat, Dec 17, 2011 at 01:19:07AM +0000, Dimitry Andric wrote: > Log: > In sbin/dhclient, work around warnings about the size argument to > strlcpy appearing to be the size of the source buffer, instead of the > destination. If you touch this and don't want to use strdup-like functions, at least make it a memcpy. strlcpy is very crappy from a performance PoV... Joerg From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 12:26:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE519106566B; Sat, 17 Dec 2011 12:26:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 7DFD78FC0C; Sat, 17 Dec 2011 12:26:50 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:34d8:b0a6:3463:89c2] (unknown [IPv6:2001:7b8:3a7:0:34d8:b0a6:3463:89c2]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 963215C37; Sat, 17 Dec 2011 13:26:49 +0100 (CET) Message-ID: <4EEC8A90.9000102@FreeBSD.org> Date: Sat, 17 Dec 2011 13:26:56 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111130 Thunderbird/9.0 MIME-Version: 1.0 To: Kostik Belousov References: <201112170136.pBH1apEH036884@svn.freebsd.org> <20111217083355.GZ50300@deviant.kiev.zoral.com.ua> In-Reply-To: <20111217083355.GZ50300@deviant.kiev.zoral.com.ua> X-Enigmail-Version: 1.3.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Tim Kientzle Subject: Re: svn commit: r228616 - head/usr.bin/tar X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 12:26:50 -0000 On 2011-12-17 09:33, Kostik Belousov wrote: >> const char *msg = "Unable to continue traversing" >> " directory hierarchy after a fatal error."; >> write(2, msg, strlen(msg)); >> - *(int *)0 = 1; /* Deliberate SEGV; NULL pointer dereference. */ >> + *(volatile int *)0 = 1; /* Deliberate SEGV; NULL pointer dereference. */ >> exit(1); /* In case the SEGV didn't work. */ >> } >> > Why this hack is used instead of abort(3) or abort2(2) ? No idea, but it seems to be done that way now in upstream: http://code.google.com/p/libarchive/source/browse/trunk/tar/tree.c#423 I didn't want to change the intent of the code at this time, just fix warnings. Maybe Tim will import another drop of libarchive soon. From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 12:52:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A242106566B; Sat, 17 Dec 2011 12:52:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 392AF8FC14; Sat, 17 Dec 2011 12:52:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHCqx3L059821; Sat, 17 Dec 2011 12:52:59 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHCqxAu059819; Sat, 17 Dec 2011 12:52:59 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171252.pBHCqxAu059819@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 12:52:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228624 - head/contrib/bzip2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 12:52:59 -0000 Author: dim Date: Sat Dec 17 12:52:58 2011 New Revision: 228624 URL: http://svn.freebsd.org/changeset/base/228624 Log: In contrib/bzip2/bzip2recover.c, use the correct printf length modifier for unsigned long long. MFC after: 1 week Modified: head/contrib/bzip2/bzip2recover.c Modified: head/contrib/bzip2/bzip2recover.c ============================================================================== --- head/contrib/bzip2/bzip2recover.c Sat Dec 17 11:06:22 2011 (r228623) +++ head/contrib/bzip2/bzip2recover.c Sat Dec 17 12:52:58 2011 (r228624) @@ -37,7 +37,7 @@ */ #ifdef __GNUC__ typedef unsigned long long int MaybeUInt64; -# define MaybeUInt64_FMT "%Lu" +# define MaybeUInt64_FMT "%llu" #else #ifdef _MSC_VER typedef unsigned __int64 MaybeUInt64; From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 13:14:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48E24106566B; Sat, 17 Dec 2011 13:14:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37D678FC1D; Sat, 17 Dec 2011 13:14:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHDEjgD060511; Sat, 17 Dec 2011 13:14:45 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHDEjtQ060509; Sat, 17 Dec 2011 13:14:45 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171314.pBHDEjtQ060509@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 13:14:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228625 - head/usr.bin/csup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 13:14:45 -0000 Author: dim Date: Sat Dec 17 13:14:44 2011 New Revision: 228625 URL: http://svn.freebsd.org/changeset/base/228625 Log: In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the shared secret, and use long long format to snprintf a time_t. MFC after: 1 week Modified: head/usr.bin/csup/auth.c Modified: head/usr.bin/csup/auth.c ============================================================================== --- head/usr.bin/csup/auth.c Sat Dec 17 12:52:58 2011 (r228624) +++ head/usr.bin/csup/auth.c Sat Dec 17 13:14:44 2011 (r228625) @@ -254,7 +254,7 @@ auth_makesecret(struct srvrecord *auth, MD5_Update(&md5, ":", 1); MD5_Update(&md5, auth->password, strlen(auth->password)); MD5_Final(md5sum, &md5); - memset(secret, 0, sizeof(secret)); + memset(secret, 0, MD5_CHARS_MAX); strcpy(secret, md5salt); auth_readablesum(md5sum, secret + strlen(md5salt)); } @@ -302,8 +302,9 @@ auth_makechallenge(struct config *config } gettimeofday(&tv, NULL); MD5_Init(&md5); - snprintf(buf, sizeof(buf), "%s:%ld:%ld:%ld:%d:%d", - inet_ntoa(laddr.sin_addr), tv.tv_sec, tv.tv_usec, random(), pid, ppid); + snprintf(buf, sizeof(buf), "%s:%lld:%ld:%ld:%d:%d", + inet_ntoa(laddr.sin_addr), (long long)tv.tv_sec, tv.tv_usec, + random(), pid, ppid); MD5_Update(&md5, buf, strlen(buf)); MD5_Final(md5sum, &md5); auth_readablesum(md5sum, challenge); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 13:52:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07FF1106564A; Sat, 17 Dec 2011 13:52:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5CC48FC08; Sat, 17 Dec 2011 13:52:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHDqrEx061687; Sat, 17 Dec 2011 13:52:53 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHDqr9l061685; Sat, 17 Dec 2011 13:52:53 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171352.pBHDqr9l061685@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 13:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228626 - head/usr.bin/csup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 13:52:54 -0000 Author: dim Date: Sat Dec 17 13:52:53 2011 New Revision: 228626 URL: http://svn.freebsd.org/changeset/base/228626 Log: In usr.bin/csup/proto.c, use the correct printf length modifier to print an off_t. MFC after: 1 week Modified: head/usr.bin/csup/proto.c Modified: head/usr.bin/csup/proto.c ============================================================================== --- head/usr.bin/csup/proto.c Sat Dec 17 13:14:44 2011 (r228625) +++ head/usr.bin/csup/proto.c Sat Dec 17 13:52:53 2011 (r228626) @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -751,7 +752,7 @@ proto_printf(struct stream *wr, const ch break; case 'O': off = va_arg(ap, off_t); - rv = stream_printf(wr, "%llu", off); + rv = stream_printf(wr, "%" PRId64, off); break; case 'S': s = va_arg(ap, char *); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 14:26:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 601AB106564A; Sat, 17 Dec 2011 14:26:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F0308FC0C; Sat, 17 Dec 2011 14:26:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHEQHsl062726; Sat, 17 Dec 2011 14:26:17 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHEQHKr062724; Sat, 17 Dec 2011 14:26:17 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171426.pBHEQHKr062724@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 14:26:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228627 - head/contrib/ee X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 14:26:17 -0000 Author: dim Date: Sat Dec 17 14:26:16 2011 New Revision: 228627 URL: http://svn.freebsd.org/changeset/base/228627 Log: In contrib/ee/ee.c, fix a few warnings about format strings not being literals. Also, change the direction argument to move_rel() from char to int; K&R function definions cause it to be promoted to an int anyway, and this way we avoid clang warning about it. MFC after: 1 week Modified: head/contrib/ee/ee.c Modified: head/contrib/ee/ee.c ============================================================================== --- head/contrib/ee/ee.c Sat Dec 17 13:52:53 2011 (r228626) +++ head/contrib/ee/ee.c Sat Dec 17 14:26:16 2011 (r228627) @@ -307,7 +307,7 @@ void undel_word P_((void)); void del_line P_((void)); void undel_line P_((void)); void adv_word P_((void)); -void move_rel P_((char direction, int lines)); +void move_rel P_((int direction, int lines)); void eol P_((void)); void bol P_((void)); void adv_line P_((void)); @@ -2105,10 +2105,10 @@ char *arguments[]; else if (!strcmp("-?", buff)) { fprintf(stderr, usage0, arguments[0]); - fprintf(stderr, usage1); - fprintf(stderr, usage2); - fprintf(stderr, usage3); - fprintf(stderr, usage4); + fputs(usage1, stderr); + fputs(usage2, stderr); + fputs(usage3, stderr); + fputs(usage4, stderr); exit(1); } else if ((*buff == '+') && (start_at_line == NULL)) @@ -2939,7 +2939,7 @@ while ((position < curr_line->line_lengt void move_rel(direction, lines) /* move relative to current line */ -char direction; +int direction; int lines; { int i; @@ -3242,7 +3242,7 @@ char *string; /* string containing user } if (shell_fork) { - printf(continue_msg); + fputs(continue_msg, stdout); fflush(stdout); while ((in = getchar()) != '\n') ; From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 14:37:42 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66F13106564A; Sat, 17 Dec 2011 14:37:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55DA88FC0A; Sat, 17 Dec 2011 14:37:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHEbgVR063101; Sat, 17 Dec 2011 14:37:42 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHEbgFI063099; Sat, 17 Dec 2011 14:37:42 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171437.pBHEbgFI063099@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 14:37:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228628 - head/usr.bin/gprof X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 14:37:42 -0000 Author: dim Date: Sat Dec 17 14:37:41 2011 New Revision: 228628 URL: http://svn.freebsd.org/changeset/base/228628 Log: In usr.bin/gprof/aout.c, use the correct printf length modifier for a uint32_t. MFC after: 1 week Modified: head/usr.bin/gprof/aout.c Modified: head/usr.bin/gprof/aout.c ============================================================================== --- head/usr.bin/gprof/aout.c Sat Dec 17 14:26:16 2011 (r228627) +++ head/usr.bin/gprof/aout.c Sat Dec 17 14:37:41 2011 (r228628) @@ -175,7 +175,7 @@ gettextspace(FILE *nfile) textspace = (u_char *) malloc( xbuf.a_text ); if ( textspace == 0 ) { - warnx("no room for %lu bytes of text space: can't do -c" , + warnx("no room for %u bytes of text space: can't do -c" , xbuf.a_text ); return; } From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 14:51:25 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95F1D106564A; Sat, 17 Dec 2011 14:51:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A9168FC16; Sat, 17 Dec 2011 14:51:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHEpP06063605; Sat, 17 Dec 2011 14:51:25 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHEpPtM063602; Sat, 17 Dec 2011 14:51:25 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171451.pBHEpPtM063602@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 14:51:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228629 - head/usr.bin/gprof X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 14:51:25 -0000 Author: dim Date: Sat Dec 17 14:51:24 2011 New Revision: 228629 URL: http://svn.freebsd.org/changeset/base/228629 Log: More fixes for correct printf length modifiers usr.bin/gprof. MFC after: 1 week Modified: head/usr.bin/gprof/aout.c head/usr.bin/gprof/arcs.c Modified: head/usr.bin/gprof/aout.c ============================================================================== --- head/usr.bin/gprof/aout.c Sat Dec 17 14:37:41 2011 (r228628) +++ head/usr.bin/gprof/aout.c Sat Dec 17 14:51:24 2011 (r228629) @@ -134,7 +134,7 @@ getsymtab(FILE *nfile, const char *filen askfor = nname + 1; nl = (nltype *) calloc( askfor , sizeof(nltype) ); if (nl == 0) - errx( 1 , "no room for %d bytes of symbol table" , + errx( 1 , "no room for %zu bytes of symbol table" , askfor * sizeof(nltype) ); /* pass2 - read symbols */ Modified: head/usr.bin/gprof/arcs.c ============================================================================== --- head/usr.bin/gprof/arcs.c Sat Dec 17 14:37:41 2011 (r228628) +++ head/usr.bin/gprof/arcs.c Sat Dec 17 14:51:24 2011 (r228629) @@ -378,7 +378,7 @@ cyclelink() */ cyclenl = (nltype *) calloc( ncycle + 1 , sizeof( nltype ) ); if ( cyclenl == 0 ) - errx( 1 , "no room for %d bytes of cycle headers" , + errx( 1 , "no room for %zu bytes of cycle headers" , ( ncycle + 1 ) * sizeof( nltype ) ); /* * now link cycles to true cycleheads, @@ -481,7 +481,7 @@ cycleanalyze() done = FALSE; cyclestack = (arctype **) calloc( size + 1 , sizeof( arctype *) ); if ( cyclestack == 0 ) - errx( 1, "no room for %d bytes of cycle stack" , + errx( 1, "no room for %zu bytes of cycle stack" , ( size + 1 ) * sizeof( arctype * ) ); # ifdef DEBUG if ( debug & BREAKCYCLE ) { @@ -599,7 +599,7 @@ addcycle( stkstart , stkend ) clp = (cltype *) calloc( 1 , sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) ); if ( clp == 0 ) { - warnx( "no room for %d bytes of subcycle storage" , + warnx( "no room for %zu bytes of subcycle storage" , sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) ); return( FALSE ); } From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 14:55:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78106106566B; Sat, 17 Dec 2011 14:55:20 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 667348FC13; Sat, 17 Dec 2011 14:55:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHEtKwW063762; Sat, 17 Dec 2011 14:55:20 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHEtKuw063760; Sat, 17 Dec 2011 14:55:20 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201112171455.pBHEtKuw063760@svn.freebsd.org> From: Michael Tuexen Date: Sat, 17 Dec 2011 14:55:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228630 - head/lib/libc/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 14:55:20 -0000 Author: tuexen Date: Sat Dec 17 14:55:19 2011 New Revision: 228630 URL: http://svn.freebsd.org/changeset/base/228630 Log: Address warnings found by clang. MFC after: 3 months. Modified: head/lib/libc/net/sctp_sys_calls.c Modified: head/lib/libc/net/sctp_sys_calls.c ============================================================================== --- head/lib/libc/net/sctp_sys_calls.c Sat Dec 17 14:51:24 2011 (r228629) +++ head/lib/libc/net/sctp_sys_calls.c Sat Dec 17 14:55:19 2011 (r228630) @@ -245,7 +245,8 @@ sctp_bindx(int sd, struct sockaddr *addr struct sockaddr *sa; struct sockaddr_in *sin; struct sockaddr_in6 *sin6; - int i, sz, argsz; + int i; + size_t argsz; uint16_t sport = 0; /* validate the flags */ @@ -269,7 +270,6 @@ sctp_bindx(int sd, struct sockaddr *addr /* First pre-screen the addresses */ sa = addrs; for (i = 0; i < addrcnt; i++) { - sz = sa->sa_len; if (sa->sa_family == AF_INET) { if (sa->sa_len != sizeof(struct sockaddr_in)) goto out_error; @@ -307,7 +307,7 @@ sctp_bindx(int sd, struct sockaddr *addr goto out_error; } - sa = (struct sockaddr *)((caddr_t)sa + sz); + sa = (struct sockaddr *)((caddr_t)sa + sa->sa_len); } sa = addrs; /* @@ -319,7 +319,6 @@ sctp_bindx(int sd, struct sockaddr *addr sin->sin_port = sport; } for (i = 0; i < addrcnt; i++) { - sz = sa->sa_len; if (sa->sa_family == AF_INET) { if (sa->sa_len != sizeof(struct sockaddr_in)) goto out_error; @@ -335,13 +334,13 @@ sctp_bindx(int sd, struct sockaddr *addr } memset(gaddrs, 0, argsz); gaddrs->sget_assoc_id = 0; - memcpy(gaddrs->addr, sa, sz); + memcpy(gaddrs->addr, sa, sa->sa_len); if (setsockopt(sd, IPPROTO_SCTP, flags, gaddrs, (socklen_t) argsz) != 0) { free(gaddrs); return (-1); } - sa = (struct sockaddr *)((caddr_t)sa + sz); + sa = (struct sockaddr *)((caddr_t)sa + sa->sa_len); } free(gaddrs); return (0); @@ -430,10 +429,9 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, { struct sctp_getaddresses *addrs; struct sockaddr *sa; - struct sockaddr *re; sctp_assoc_t asoc; caddr_t lim; - socklen_t siz; + socklen_t opt_len; int cnt; if (raddrs == NULL) { @@ -441,30 +439,28 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, return (-1); } asoc = id; - siz = sizeof(sctp_assoc_t); + opt_len = (socklen_t) sizeof(sctp_assoc_t); if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_REMOTE_ADDR_SIZE, - &asoc, &siz) != 0) { + &asoc, &opt_len) != 0) { return (-1); } /* size required is returned in 'asoc' */ - siz = (size_t)asoc; - siz += sizeof(struct sctp_getaddresses); - addrs = calloc(1, siz); + opt_len = (socklen_t) ((size_t)asoc + sizeof(struct sctp_getaddresses)); + addrs = calloc(1, (size_t)opt_len); if (addrs == NULL) { return (-1); } addrs->sget_assoc_id = id; /* Now lets get the array of addresses */ if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_PEER_ADDRESSES, - addrs, &siz) != 0) { + addrs, &opt_len) != 0) { free(addrs); return (-1); } - re = (struct sockaddr *)&addrs->addr[0]; - *raddrs = re; + *raddrs = (struct sockaddr *)&addrs->addr[0]; cnt = 0; sa = (struct sockaddr *)&addrs->addr[0]; - lim = (caddr_t)addrs + siz; + lim = (caddr_t)addrs + opt_len; while (((caddr_t)sa < lim) && (sa->sa_len > 0)) { sa = (struct sockaddr *)((caddr_t)sa + sa->sa_len); cnt++; @@ -487,11 +483,10 @@ int sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs) { struct sctp_getaddresses *addrs; - struct sockaddr *re; caddr_t lim; struct sockaddr *sa; - int size_of_addresses; - socklen_t siz; + size_t size_of_addresses; + socklen_t opt_len; int cnt; if (raddrs == NULL) { @@ -499,9 +494,9 @@ sctp_getladdrs(int sd, sctp_assoc_t id, return (-1); } size_of_addresses = 0; - siz = sizeof(int); + opt_len = (socklen_t) sizeof(int); if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_LOCAL_ADDR_SIZE, - &size_of_addresses, &siz) != 0) { + &size_of_addresses, &opt_len) != 0) { errno = ENOMEM; return (-1); } @@ -509,9 +504,10 @@ sctp_getladdrs(int sd, sctp_assoc_t id, errno = ENOTCONN; return (-1); } - siz = size_of_addresses + sizeof(struct sockaddr_storage); - siz += sizeof(struct sctp_getaddresses); - addrs = calloc(1, siz); + opt_len = (socklen_t) (size_of_addresses + + sizeof(struct sockaddr_storage) + + sizeof(struct sctp_getaddresses)); + addrs = calloc(1, (size_t)opt_len); if (addrs == NULL) { errno = ENOMEM; return (-1); @@ -519,16 +515,15 @@ sctp_getladdrs(int sd, sctp_assoc_t id, addrs->sget_assoc_id = id; /* Now lets get the array of addresses */ if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_LOCAL_ADDRESSES, addrs, - &siz) != 0) { + &opt_len) != 0) { free(addrs); errno = ENOMEM; return (-1); } - re = (struct sockaddr *)&addrs->addr[0]; - *raddrs = re; + *raddrs = (struct sockaddr *)&addrs->addr[0]; cnt = 0; sa = (struct sockaddr *)&addrs->addr[0]; - lim = (caddr_t)addrs + siz; + lim = (caddr_t)addrs + opt_len; while (((caddr_t)sa < lim) && (sa->sa_len > 0)) { sa = (struct sockaddr *)((caddr_t)sa + sa->sa_len); cnt++; @@ -735,7 +730,8 @@ sctp_sendx(int sd, const void *msg, size ssize_t ret; int i, cnt, *aa, saved_errno; char *buf; - int add_len, len, no_end_cx = 0; + int no_end_cx = 0; + size_t len, add_len; struct sockaddr *at; if (addrs == NULL) { @@ -785,7 +781,7 @@ sctp_sendx(int sd, const void *msg, size aa = (int *)buf; *aa = cnt; aa++; - memcpy((caddr_t)aa, addrs, (len - sizeof(int))); + memcpy((caddr_t)aa, addrs, (size_t)(len - sizeof(int))); ret = setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X_DELAYED, (void *)buf, (socklen_t) len); @@ -862,7 +858,6 @@ sctp_recvmsg(int s, #else struct sctp_sndrcvinfo *s_info; ssize_t sz; - int sinfo_found = 0; struct msghdr msg; struct iovec iov; char controlVector[SCTP_CONTROL_VEC_SIZE_RCV]; @@ -891,7 +886,6 @@ sctp_recvmsg(int s, return (sz); } s_info = NULL; - len = sz; if (sinfo) { sinfo->sinfo_assoc_id = 0; } @@ -912,7 +906,6 @@ sctp_recvmsg(int s, /* Copy it to the user */ if (sinfo) *sinfo = *s_info; - sinfo_found = 1; break; } else if (cmsg->cmsg_type == SCTP_EXTRCV) { /* @@ -925,7 +918,6 @@ sctp_recvmsg(int s, if (sinfo) { memcpy(sinfo, s_info, sizeof(struct sctp_extrcvinfo)); } - sinfo_found = 1; break; } @@ -1058,7 +1050,7 @@ sctp_sendv(int sd, cmsgbuf = malloc(CMSG_SPACE(sizeof(struct sctp_sndinfo)) + CMSG_SPACE(sizeof(struct sctp_prinfo)) + CMSG_SPACE(sizeof(struct sctp_authinfo)) + - addrcnt * CMSG_SPACE(sizeof(struct in6_addr))); + (size_t)addrcnt * CMSG_SPACE(sizeof(struct in6_addr))); if (cmsgbuf == NULL) { errno = ENOBUFS; return (-1); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:08:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC2F4106566B; Sat, 17 Dec 2011 15:08:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B802D8FC12; Sat, 17 Dec 2011 15:08:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHF8i1O064219; Sat, 17 Dec 2011 15:08:44 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHF8ibC064202; Sat, 17 Dec 2011 15:08:44 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112171508.pBHF8ibC064202@svn.freebsd.org> From: Andriy Gapon Date: Sat, 17 Dec 2011 15:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228631 - in head/sys: dev/cfe dev/dcons dev/ofw dev/sio dev/syscons dev/uart dev/usb/serial dev/xen/console gdb ia64/ia64 kern mips/adm5120 pc98/cbus powerpc/mambo sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:08:44 -0000 Author: avg Date: Sat Dec 17 15:08:43 2011 New Revision: 228631 URL: http://svn.freebsd.org/changeset/base/228631 Log: kern cons: introduce infrastructure for console grabbing by kernel At the moment grab and ungrab methods of all console drivers are no-ops. Current intended meaning of the calls is that the kernel takes control of console input. In the future the semantics may be extended to mean that the calling thread takes full ownership of the console (e.g. console output from other threads could be suspended). Inspired by: bde MFC after: 2 months Modified: head/sys/dev/cfe/cfe_console.c head/sys/dev/dcons/dcons_os.c head/sys/dev/ofw/ofw_console.c head/sys/dev/sio/sio.c head/sys/dev/syscons/syscons.c head/sys/dev/uart/uart_tty.c head/sys/dev/usb/serial/usb_serial.c head/sys/dev/xen/console/console.c head/sys/gdb/gdb_cons.c head/sys/ia64/ia64/ssc.c head/sys/kern/kern_cons.c head/sys/mips/adm5120/console.c head/sys/pc98/cbus/sio.c head/sys/powerpc/mambo/mambo_console.c head/sys/sys/cons.h Modified: head/sys/dev/cfe/cfe_console.c ============================================================================== --- head/sys/dev/cfe/cfe_console.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/dev/cfe/cfe_console.c Sat Dec 17 15:08:43 2011 (r228631) @@ -76,6 +76,8 @@ static cn_init_t cfe_cninit; static cn_term_t cfe_cnterm; static cn_getc_t cfe_cngetc; static cn_putc_t cfe_cnputc; +static cn_grab_t cfe_cngrab; +static cn_ungrab_t cfe_cnungrab; CONSOLE_DRIVER(cfe); @@ -183,6 +185,18 @@ cfe_cnterm(struct consdev *cp) } +static void +cfe_cngrab(struct consdev *cp) +{ + +} + +static void +cfe_cnungrab(struct consdev *cp) +{ + +} + static int cfe_cngetc(struct consdev *cp) { Modified: head/sys/dev/dcons/dcons_os.c ============================================================================== --- head/sys/dev/dcons/dcons_os.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/dev/dcons/dcons_os.c Sat Dec 17 15:08:43 2011 (r228631) @@ -109,6 +109,8 @@ static cn_init_t dcons_cninit; static cn_term_t dcons_cnterm; static cn_getc_t dcons_cngetc; static cn_putc_t dcons_cnputc; +static cn_grab_t dcons_cngrab; +static cn_ungrab_t dcons_cnungrab; CONSOLE_DRIVER(dcons); @@ -246,6 +248,16 @@ dcons_cnterm(struct consdev *cp) { } +static void +dcons_cngrab(struct consdev *cp) +{ +} + +static void +dcons_cnungrab(struct consdev *cp) +{ +} + static int dcons_cngetc(struct consdev *cp) { Modified: head/sys/dev/ofw/ofw_console.c ============================================================================== --- head/sys/dev/ofw/ofw_console.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/dev/ofw/ofw_console.c Sat Dec 17 15:08:43 2011 (r228631) @@ -74,6 +74,8 @@ static cn_init_t ofw_cninit; static cn_term_t ofw_cnterm; static cn_getc_t ofw_cngetc; static cn_putc_t ofw_cnputc; +static cn_grab_t ofw_cngrab; +static cn_ungrab_t ofw_cnungrab; CONSOLE_DRIVER(ofw); @@ -192,6 +194,16 @@ ofw_cnterm(struct consdev *cp) { } +static void +ofw_cngrab(struct consdev *cp) +{ +} + +static void +ofw_cnungrab(struct consdev *cp) +{ +} + static int ofw_cngetc(struct consdev *cp) { Modified: head/sys/dev/sio/sio.c ============================================================================== --- head/sys/dev/sio/sio.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/dev/sio/sio.c Sat Dec 17 15:08:43 2011 (r228631) @@ -2293,6 +2293,8 @@ static cn_init_t sio_cninit; static cn_term_t sio_cnterm; static cn_getc_t sio_cngetc; static cn_putc_t sio_cnputc; +static cn_grab_t sio_cngrab; +static cn_ungrab_t sio_cnungrab; CONSOLE_DRIVER(sio); @@ -2512,6 +2514,16 @@ sio_cnterm(cp) comconsole = -1; } +static void +sio_cngrab(struct consdev *cp) +{ +} + +static void +sio_cnungrab(struct consdev *cp) +{ +} + static int sio_cngetc(struct consdev *cd) { Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/dev/syscons/syscons.c Sat Dec 17 15:08:43 2011 (r228631) @@ -229,6 +229,8 @@ static cn_init_t sc_cninit; static cn_term_t sc_cnterm; static cn_getc_t sc_cngetc; static cn_putc_t sc_cnputc; +static cn_grab_t sc_cngrab; +static cn_ungrab_t sc_cnungrab; CONSOLE_DRIVER(sc); @@ -1609,6 +1611,16 @@ sc_cnterm(struct consdev *cp) } static void +sc_cngrab(struct consdev *cp) +{ +} + +static void +sc_cnungrab(struct consdev *cp) +{ +} + +static void sc_cnputc(struct consdev *cd, int c) { u_char buf[1]; Modified: head/sys/dev/uart/uart_tty.c ============================================================================== --- head/sys/dev/uart/uart_tty.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/dev/uart/uart_tty.c Sat Dec 17 15:08:43 2011 (r228631) @@ -54,6 +54,8 @@ static cn_init_t uart_cninit; static cn_term_t uart_cnterm; static cn_getc_t uart_cngetc; static cn_putc_t uart_cnputc; +static cn_grab_t uart_cngrab; +static cn_ungrab_t uart_cnungrab; CONSOLE_DRIVER(uart); @@ -108,6 +110,16 @@ uart_cnterm(struct consdev *cp) } static void +uart_cngrab(struct consdev *cp) +{ +} + +static void +uart_cnungrab(struct consdev *cp) +{ +} + +static void uart_cnputc(struct consdev *cp, int c) { Modified: head/sys/dev/usb/serial/usb_serial.c ============================================================================== --- head/sys/dev/usb/serial/usb_serial.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/dev/usb/serial/usb_serial.c Sat Dec 17 15:08:43 2011 (r228631) @@ -1308,6 +1308,8 @@ static cn_init_t ucom_cninit; static cn_term_t ucom_cnterm; static cn_getc_t ucom_cngetc; static cn_putc_t ucom_cnputc; +static cn_grab_t ucom_cngrab; +static cn_ungrab_t ucom_cnungrab; CONSOLE_DRIVER(ucom); @@ -1332,6 +1334,16 @@ ucom_cnterm(struct consdev *cp) { } +static void +ucom_cngrab(struct consdev *cp) +{ +} + +static void +ucom_cnungrab(struct consdev *cp) +{ +} + static int ucom_cngetc(struct consdev *cd) { Modified: head/sys/dev/xen/console/console.c ============================================================================== --- head/sys/dev/xen/console/console.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/dev/xen/console/console.c Sat Dec 17 15:08:43 2011 (r228631) @@ -50,6 +50,8 @@ static cn_init_t xc_cninit; static cn_term_t xc_cnterm; static cn_getc_t xc_cngetc; static cn_putc_t xc_cnputc; +static cn_grab_t xc_cngrab; +static cn_ungrab_t xc_cnungrab; #define XC_POLLTIME (hz/10) @@ -126,6 +128,16 @@ xc_cnterm(struct consdev *cp) { } +static void +xc_cngrab(struct consdev *cp) +{ +} + +static void +xc_cnungrab(struct consdev *cp) +{ +} + static int xc_cngetc(struct consdev *dev) { Modified: head/sys/gdb/gdb_cons.c ============================================================================== --- head/sys/gdb/gdb_cons.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/gdb/gdb_cons.c Sat Dec 17 15:08:43 2011 (r228631) @@ -87,6 +87,16 @@ gdb_cnterm(struct consdev *cp) { } +static void +gdb_cngrab(struct consdev *cp) +{ +} + +static void +gdb_cnungrab(struct consdev *cp) +{ +} + static int gdb_cngetc(struct consdev *cp) { Modified: head/sys/ia64/ia64/ssc.c ============================================================================== --- head/sys/ia64/ia64/ssc.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/ia64/ia64/ssc.c Sat Dec 17 15:08:43 2011 (r228631) @@ -102,6 +102,16 @@ ssc_cnterm(struct consdev *cp) } static void +ssc_cngrab(struct consdev *cp) +{ +} + +static void +ssc_cnungrab(struct consdev *cp) +{ +} + +static void ssc_cnattach(void *arg) { struct tty *tp; Modified: head/sys/kern/kern_cons.c ============================================================================== --- head/sys/kern/kern_cons.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/kern/kern_cons.c Sat Dec 17 15:08:43 2011 (r228631) @@ -344,6 +344,32 @@ SYSCTL_PROC(_kern, OID_AUTO, consmute, C 0, sizeof(cn_mute), sysctl_kern_consmute, "I", "State of the console muting"); +void +cngrab() +{ + struct cn_device *cnd; + struct consdev *cn; + + STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) { + cn = cnd->cnd_cn; + if (!kdb_active || !(cn->cn_flags & CN_FLAG_NODEBUG)) + cn->cn_ops->cn_grab(cn); + } +} + +void +cnungrab() +{ + struct cn_device *cnd; + struct consdev *cn; + + STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) { + cn = cnd->cnd_cn; + if (!kdb_active || !(cn->cn_flags & CN_FLAG_NODEBUG)) + cn->cn_ops->cn_ungrab(cn); + } +} + /* * Low level console routines. */ Modified: head/sys/mips/adm5120/console.c ============================================================================== --- head/sys/mips/adm5120/console.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/mips/adm5120/console.c Sat Dec 17 15:08:43 2011 (r228631) @@ -49,6 +49,8 @@ static cn_init_t uart_cninit; static cn_term_t uart_cnterm; static cn_getc_t uart_cngetc; static cn_putc_t uart_cnputc; +static cn_grab_t uart_cngrab; +static cn_ungrab_t uart_cnungrab; static void uart_cnprobe(struct consdev *cp) @@ -90,4 +92,16 @@ uart_cnterm(struct consdev * cp) } +static void +uart_cngrab(struct consdev *cp) +{ + +} + +static void +uart_cnungrab(struct consdev *cp) +{ + +} + CONSOLE_DRIVER(uart); Modified: head/sys/pc98/cbus/sio.c ============================================================================== --- head/sys/pc98/cbus/sio.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/pc98/cbus/sio.c Sat Dec 17 15:08:43 2011 (r228631) @@ -3460,6 +3460,8 @@ static cn_init_t sio_cninit; static cn_term_t sio_cnterm; static cn_getc_t sio_cngetc; static cn_putc_t sio_cnputc; +static cn_grab_t sio_cngrab; +static cn_ungrab_t sio_cnungrab; CONSOLE_DRIVER(sio); @@ -3679,6 +3681,16 @@ sio_cnterm(cp) comconsole = -1; } +static void +sio_cngrab(struct consdev *cp) +{ +} + +static void +sio_cnungrab(struct consdev *cp) +{ +} + static int sio_cngetc(struct consdev *cd) { Modified: head/sys/powerpc/mambo/mambo_console.c ============================================================================== --- head/sys/powerpc/mambo/mambo_console.c Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/powerpc/mambo/mambo_console.c Sat Dec 17 15:08:43 2011 (r228631) @@ -69,6 +69,8 @@ static cn_init_t mambo_cninit; static cn_term_t mambo_cnterm; static cn_getc_t mambo_cngetc; static cn_putc_t mambo_cnputc; +static cn_grab_t mambo_cngrab; +static cn_ungrab_t mambo_cnungrab; CONSOLE_DRIVER(mambo); @@ -146,6 +148,16 @@ mambo_cnterm(struct consdev *cp) { } +static void +mambo_cngrab(struct consdev *cp) +{ +} + +static void +mambo_cnungrab(struct consdev *cp) +{ +} + static int mambo_cngetc(struct consdev *cp) { Modified: head/sys/sys/cons.h ============================================================================== --- head/sys/sys/cons.h Sat Dec 17 14:55:19 2011 (r228630) +++ head/sys/sys/cons.h Sat Dec 17 15:08:43 2011 (r228631) @@ -44,6 +44,8 @@ struct tty; typedef void cn_probe_t(struct consdev *); typedef void cn_init_t(struct consdev *); typedef void cn_term_t(struct consdev *); +typedef void cn_grab_t(struct consdev *); +typedef void cn_ungrab_t(struct consdev *); typedef int cn_getc_t(struct consdev *); typedef void cn_putc_t(struct consdev *, int); @@ -58,6 +60,10 @@ struct consdev_ops { /* kernel getchar interface */ cn_putc_t *cn_putc; /* kernel putchar interface */ + cn_grab_t *cn_grab; + /* grab console for exclusive kernel use */ + cn_ungrab_t *cn_ungrab; + /* ungrab console */ }; struct consdev { @@ -99,6 +105,8 @@ extern struct tty *constty; /* Temporary .cn_term = name##_cnterm, \ .cn_getc = name##_cngetc, \ .cn_putc = name##_cnputc, \ + .cn_grab = name##_cngrab, \ + .cn_ungrab = name##_cnungrab, \ }; \ CONSOLE_DEVICE(name##_consdev, name##_consdev_ops, NULL) @@ -109,6 +117,8 @@ int cnadd(struct consdev *); void cnavailable(struct consdev *, int); void cnremove(struct consdev *); void cnselect(struct consdev *); +void cngrab(void); +void cnungrab(void); int cncheckc(void); int cngetc(void); void cnputc(int); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:09:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8C0D1065675; Sat, 17 Dec 2011 15:09:28 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from agogare.doit.wisc.edu (agogare.doit.wisc.edu [144.92.197.211]) by mx1.freebsd.org (Postfix) with ESMTP id 8E9BD8FC08; Sat, 17 Dec 2011 15:09:28 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth2.wiscmail.wisc.edu by smtpauth2.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0LWC00I00SRRW700@smtpauth2.wiscmail.wisc.edu>; Sat, 17 Dec 2011 09:09:27 -0600 (CST) Received: from comporellon.tachypleus.net ([unknown] [76.210.77.223]) by smtpauth2.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0LWC00BZWSRPZ600@smtpauth2.wiscmail.wisc.edu>; Sat, 17 Dec 2011 09:09:26 -0600 (CST) Date: Sat, 17 Dec 2011 09:09:24 -0600 From: Nathan Whitehorn In-reply-to: <201112121103.pBCB3FuT097580@svn.freebsd.org> To: Konstantin Belousov Message-id: <4EECB0A4.504@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=76.210.77.223 X-Spam-PmxInfo: Server=avs-13, Version=5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2011.12.17.145715, SenderIP=76.210.77.223 References: <201112121103.pBCB3FuT097580@svn.freebsd.org> User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111113 Thunderbird/8.0 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, powerpc@freebsd.org Subject: Re: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:09:28 -0000 This broke PowerPC really, really badly. Basically every dynamically-linked executable dies with an illegal instruction trap. -Nathan On 12/12/11 05:03, Konstantin Belousov wrote: > Author: kib > Date: Mon Dec 12 11:03:14 2011 > New Revision: 228435 > URL: http://svn.freebsd.org/changeset/base/228435 > > Log: > Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to > rtld on 386 and amd64. This adds runtime bits neccessary for the use > of the dispatch functions from the dynamically-linked executables and > shared libraries. > > To allow use of external references from the dispatch function, resolution > of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries > for PLT are prepared, and normal resolution of the GOT entries is finished. > Similar to how it is done by GNU, IRELATIVE relocations are resolved in > advance, instead of normal lazy handling for PLT. > > Move the init_pltgot() call before the relocations for the object are > processed. > > MFC after: 3 weeks > > Modified: > head/libexec/rtld-elf/amd64/reloc.c > head/libexec/rtld-elf/arm/reloc.c > head/libexec/rtld-elf/i386/reloc.c > head/libexec/rtld-elf/ia64/reloc.c > head/libexec/rtld-elf/mips/reloc.c > head/libexec/rtld-elf/powerpc/reloc.c > head/libexec/rtld-elf/powerpc64/reloc.c > head/libexec/rtld-elf/rtld.c > head/libexec/rtld-elf/rtld.h > head/libexec/rtld-elf/sparc64/reloc.c > > Modified: head/libexec/rtld-elf/amd64/reloc.c > ============================================================================== > --- head/libexec/rtld-elf/amd64/reloc.c Mon Dec 12 10:10:49 2011 (r228434) > +++ head/libexec/rtld-elf/amd64/reloc.c Mon Dec 12 11:03:14 2011 (r228435) > @@ -344,11 +344,22 @@ reloc_plt(Obj_Entry *obj) > for (rela = obj->pltrela; rela< relalim; rela++) { > Elf_Addr *where; > > - assert(ELF_R_TYPE(rela->r_info) == R_X86_64_JMP_SLOT); > - > - /* Relocate the GOT slot pointing into the PLT. */ > - where = (Elf_Addr *)(obj->relocbase + rela->r_offset); > - *where += (Elf_Addr)obj->relocbase; > + switch(ELF_R_TYPE(rela->r_info)) { > + case R_X86_64_JMP_SLOT: > + /* Relocate the GOT slot pointing into the PLT. */ > + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); > + *where += (Elf_Addr)obj->relocbase; > + break; > + > + case R_X86_64_IRELATIVE: > + obj->irelative = true; > + break; > + > + default: > + _rtld_error("Unknown relocation type %x in PLT", > + (unsigned int)ELF_R_TYPE(rela->r_info)); > + return (-1); > + } > } > return 0; > } > @@ -368,19 +379,91 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS > const Elf_Sym *def; > const Obj_Entry *defobj; > > - assert(ELF_R_TYPE(rela->r_info) == R_X86_64_JMP_SLOT); > - where = (Elf_Addr *)(obj->relocbase + rela->r_offset); > - def = find_symdef(ELF_R_SYM(rela->r_info), obj,&defobj, true, NULL, > - lockstate); > - if (def == NULL) > - return -1; > - target = (Elf_Addr)(defobj->relocbase + def->st_value + rela->r_addend); > - reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); > + switch (ELF_R_TYPE(rela->r_info)) { > + case R_X86_64_JMP_SLOT: > + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); > + def = find_symdef(ELF_R_SYM(rela->r_info), obj,&defobj, true, NULL, > + lockstate); > + if (def == NULL) > + return (-1); > + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { > + obj->gnu_ifunc = true; > + continue; > + } > + target = (Elf_Addr)(defobj->relocbase + def->st_value + rela->r_addend); > + reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); > + break; > + > + case R_X86_64_IRELATIVE: > + break; > + > + default: > + _rtld_error("Unknown relocation type %x in PLT", > + (unsigned int)ELF_R_TYPE(rela->r_info)); > + return (-1); > + } > } > obj->jmpslots_done = true; > return 0; > } > > +int > +reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate) > +{ > + const Elf_Rela *relalim; > + const Elf_Rela *rela; > + > + relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); > + for (rela = obj->pltrela; rela< relalim; rela++) { > + Elf_Addr *where, target, *ptr; > + > + switch (ELF_R_TYPE(rela->r_info)) { > + case R_X86_64_JMP_SLOT: > + break; > + > + case R_X86_64_IRELATIVE: > + ptr = (Elf_Addr *)(obj->relocbase + rela->r_addend); > + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); > + target = ((Elf_Addr (*)(void))ptr)(); > + *where = target; > + break; > + } > + } > + return (0); > +} > + > +int > +reloc_gnu_ifunc(Obj_Entry *obj, RtldLockState *lockstate) > +{ > + const Elf_Rela *relalim; > + const Elf_Rela *rela; > + > + if (!obj->gnu_ifunc) > + return (0); > + relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); > + for (rela = obj->pltrela; rela< relalim; rela++) { > + Elf_Addr *where, target; > + const Elf_Sym *def; > + const Obj_Entry *defobj; > + > + switch (ELF_R_TYPE(rela->r_info)) { > + case R_X86_64_JMP_SLOT: > + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); > + def = find_symdef(ELF_R_SYM(rela->r_info), obj,&defobj, true, NULL, > + lockstate); > + if (def == NULL) > + return (-1); > + if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) > + continue; > + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); > + reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); > + break; > + } > + } > + obj->gnu_ifunc = false; > + return 0; > +} > + > void > allocate_initial_tls(Obj_Entry *objs) > { > > Modified: head/libexec/rtld-elf/arm/reloc.c > ============================================================================== > --- head/libexec/rtld-elf/arm/reloc.c Mon Dec 12 10:10:49 2011 (r228434) > +++ head/libexec/rtld-elf/arm/reloc.c Mon Dec 12 11:03:14 2011 (r228435) > @@ -337,6 +337,22 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS > return (0); > } > > +int > +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) > +{ > + > + /* XXX not implemented */ > + return (0); > +} > + > +int > +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) > +{ > + > + /* XXX not implemented */ > + return (0); > +} > + > Elf_Addr > reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj, > const Obj_Entry *obj, const Elf_Rel *rel) > > Modified: head/libexec/rtld-elf/i386/reloc.c > ============================================================================== > --- head/libexec/rtld-elf/i386/reloc.c Mon Dec 12 10:10:49 2011 (r228434) > +++ head/libexec/rtld-elf/i386/reloc.c Mon Dec 12 11:03:14 2011 (r228435) > @@ -298,13 +298,24 @@ reloc_plt(Obj_Entry *obj) > > rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); > for (rel = obj->pltrel; rel< rellim; rel++) { > - Elf_Addr *where; > + Elf_Addr *where/*, val*/; > > - assert(ELF_R_TYPE(rel->r_info) == R_386_JMP_SLOT); > - > - /* Relocate the GOT slot pointing into the PLT. */ > - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); > - *where += (Elf_Addr)obj->relocbase; > + switch (ELF_R_TYPE(rel->r_info)) { > + case R_386_JMP_SLOT: > + /* Relocate the GOT slot pointing into the PLT. */ > + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); > + *where += (Elf_Addr)obj->relocbase; > + break; > + > + case R_386_IRELATIVE: > + obj->irelative = true; > + break; > + > + default: > + _rtld_error("Unknown relocation type %x in PLT", > + ELF_R_TYPE(rel->r_info)); > + return (-1); > + } > } > return 0; > } > @@ -324,19 +335,88 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS > const Elf_Sym *def; > const Obj_Entry *defobj; > > - assert(ELF_R_TYPE(rel->r_info) == R_386_JMP_SLOT); > - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); > - def = find_symdef(ELF_R_SYM(rel->r_info), obj,&defobj, true, NULL, > - lockstate); > - if (def == NULL) > - return -1; > - target = (Elf_Addr)(defobj->relocbase + def->st_value); > - reloc_jmpslot(where, target, defobj, obj, rel); > + switch (ELF_R_TYPE(rel->r_info)) { > + case R_386_JMP_SLOT: > + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); > + def = find_symdef(ELF_R_SYM(rel->r_info), obj,&defobj, true, NULL, > + lockstate); > + if (def == NULL) > + return (-1); > + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { > + obj->gnu_ifunc = true; > + continue; > + } > + target = (Elf_Addr)(defobj->relocbase + def->st_value); > + reloc_jmpslot(where, target, defobj, obj, rel); > + break; > + > + case R_386_IRELATIVE: > + break; > + > + default: > + _rtld_error("Unknown relocation type %x in PLT", > + ELF_R_TYPE(rel->r_info)); > + return (-1); > + } > } > + > obj->jmpslots_done = true; > return 0; > } > > +int > +reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate) > +{ > + const Elf_Rel *rellim; > + const Elf_Rel *rel; > + Elf_Addr *where, target; > + > + rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); > + for (rel = obj->pltrel; rel< rellim; rel++) { > + switch (ELF_R_TYPE(rel->r_info)) { > + case R_386_IRELATIVE: > + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); > + target = ((Elf_Addr (*)(void))(*where))(); > + *where = target; > + break; > + } > + } > + return (0); > +} > + > +int > +reloc_gnu_ifunc(Obj_Entry *obj, RtldLockState *lockstate) > +{ > + const Elf_Rel *rellim; > + const Elf_Rel *rel; > + > + if (!obj->gnu_ifunc) > + return (0); > + rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); > + for (rel = obj->pltrel; rel< rellim; rel++) { > + Elf_Addr *where, target; > + const Elf_Sym *def; > + const Obj_Entry *defobj; > + > + switch (ELF_R_TYPE(rel->r_info)) { > + case R_386_JMP_SLOT: > + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); > + def = find_symdef(ELF_R_SYM(rel->r_info), obj,&defobj, true, NULL, > + lockstate); > + if (def == NULL) > + return (-1); > + if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) > + continue; > + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); > + reloc_jmpslot(where, target, defobj, obj, rel); > + break; > + } > + } > + > + obj->gnu_ifunc = false; > + return (0); > +} > + > void > allocate_initial_tls(Obj_Entry *objs) > { > > Modified: head/libexec/rtld-elf/ia64/reloc.c > ============================================================================== > --- head/libexec/rtld-elf/ia64/reloc.c Mon Dec 12 10:10:49 2011 (r228434) > +++ head/libexec/rtld-elf/ia64/reloc.c Mon Dec 12 11:03:14 2011 (r228435) > @@ -435,6 +435,22 @@ reloc_plt(Obj_Entry *obj) > return 0; > } > > +int > +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) > +{ > + > + /* XXX not implemented */ > + return (0); > +} > + > +int > +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) > +{ > + > + /* XXX not implemented */ > + return (0); > +} > + > /* Relocate the jump slots in an object. */ > int > reloc_jmpslots(Obj_Entry *obj, RtldLockState *lockstate) > > Modified: head/libexec/rtld-elf/mips/reloc.c > ============================================================================== > --- head/libexec/rtld-elf/mips/reloc.c Mon Dec 12 10:10:49 2011 (r228434) > +++ head/libexec/rtld-elf/mips/reloc.c Mon Dec 12 11:03:14 2011 (r228435) > @@ -498,6 +498,22 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS > return (0); > } > > +int > +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) > +{ > + > + /* XXX not implemented */ > + return (0); > +} > + > +int > +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) > +{ > + > + /* XXX not implemented */ > + return (0); > +} > + > Elf_Addr > reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj, > const Obj_Entry *obj, const Elf_Rel *rel) > > Modified: head/libexec/rtld-elf/powerpc/reloc.c > ============================================================================== > --- head/libexec/rtld-elf/powerpc/reloc.c Mon Dec 12 10:10:49 2011 (r228434) > +++ head/libexec/rtld-elf/powerpc/reloc.c Mon Dec 12 11:03:14 2011 (r228435) > @@ -504,6 +504,21 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr > return (target); > } > > +int > +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) > +{ > + > + /* XXX not implemented */ > + return (0); > +} > + > +int > +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) > +{ > + > + /* XXX not implemented */ > + return (0); > +} > > /* > * Setup the plt glue routines. > > Modified: head/libexec/rtld-elf/powerpc64/reloc.c > ============================================================================== > --- head/libexec/rtld-elf/powerpc64/reloc.c Mon Dec 12 10:10:49 2011 (r228434) > +++ head/libexec/rtld-elf/powerpc64/reloc.c Mon Dec 12 11:03:14 2011 (r228435) > @@ -456,6 +456,22 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr > return (target); > } > > +int > +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) > +{ > + > + /* XXX not implemented */ > + return (0); > +} > + > +int > +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) > +{ > + > + /* XXX not implemented */ > + return (0); > +} > + > void > init_pltgot(Obj_Entry *obj) > { > > Modified: head/libexec/rtld-elf/rtld.c > ============================================================================== > --- head/libexec/rtld-elf/rtld.c Mon Dec 12 10:10:49 2011 (r228434) > +++ head/libexec/rtld-elf/rtld.c Mon Dec 12 11:03:14 2011 (r228435) > @@ -561,6 +561,17 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ > return (func_ptr_type) obj_main->entry; > } > > +void * > +rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def) > +{ > + void *ptr; > + Elf_Addr target; > + > + ptr = (void *)make_function_pointer(def, obj); > + target = ((Elf_Addr (*)(void))ptr)(); > + return ((void *)target); > +} > + > Elf_Addr > _rtld_bind(Obj_Entry *obj, Elf_Size reloff) > { > @@ -584,8 +595,10 @@ _rtld_bind(Obj_Entry *obj, Elf_Size relo > &lockstate); > if (def == NULL) > die(); > - > - target = (Elf_Addr)(defobj->relocbase + def->st_value); > + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) > + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); > + else > + target = (Elf_Addr)(defobj->relocbase + def->st_value); > > dbg("\"%s\" in \"%s\" ==> %p in \"%s\"", > defobj->strtab + def->st_name, basename(obj->path), > @@ -1944,6 +1957,10 @@ relocate_objects(Obj_Entry *first, bool > } > } > > + > + /* Set the special PLT or GOT entries. */ > + init_pltgot(obj); > + > /* Process the PLT relocations. */ > if (reloc_plt(obj) == -1) > return -1; > @@ -1952,7 +1969,6 @@ relocate_objects(Obj_Entry *first, bool > if (reloc_jmpslots(obj, lockstate) == -1) > return -1; > > - > /* > * Set up the magic number and version in the Obj_Entry. These > * were checked in the crt1.o from the original ElfKit, so we > @@ -1960,11 +1976,26 @@ relocate_objects(Obj_Entry *first, bool > */ > obj->magic = RTLD_MAGIC; > obj->version = RTLD_VERSION; > - > - /* Set the special PLT or GOT entries. */ > - init_pltgot(obj); > } > > + /* > + * The handling of R_MACHINE_IRELATIVE relocations and jumpslots > + * referencing STT_GNU_IFUNC symbols is postponed till the other > + * relocations are done. The indirect functions specified as > + * ifunc are allowed to call other symbols, so we need to have > + * objects relocated before asking for resolution from indirects. > + * > + * The R_MACHINE_IRELATIVE slots are resolved in greedy fashion, > + * instead of the usual lazy handling of PLT slots. It is > + * consistent with how GNU does it. > + */ > + for (obj = first; obj != NULL; obj = obj->next) { > + if (obj->irelative&& reloc_iresolve(obj, lockstate) == -1) > + return (-1); > + if ((obj->bind_now || bind_now)&& obj->gnu_ifunc&& > + reloc_gnu_ifunc(obj, lockstate) == -1) > + return (-1); > + } > return 0; > } > > @@ -2376,9 +2407,11 @@ do_dlsym(void *handle, const char *name, > * the relocated value of the symbol. > */ > if (ELF_ST_TYPE(def->st_info) == STT_FUNC) > - return make_function_pointer(def, defobj); > + return (make_function_pointer(def, defobj)); > + else if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) > + return (rtld_resolve_ifunc(defobj, def)); > else > - return defobj->relocbase + def->st_value; > + return (defobj->relocbase + def->st_value); > } > > _rtld_error("Undefined symbol \"%s\"", name); > @@ -2822,6 +2855,8 @@ get_program_var_addr(const char *name, R > if (ELF_ST_TYPE(req.sym_out->st_info) == STT_FUNC) > return ((const void **)make_function_pointer(req.sym_out, > req.defobj_out)); > + else if (ELF_ST_TYPE(req.sym_out->st_info) == STT_GNU_IFUNC) > + return ((const void **)rtld_resolve_ifunc(req.defobj_out, req.sym_out)); > else > return ((const void **)(req.defobj_out->relocbase + > req.sym_out->st_value)); > @@ -3088,6 +3123,7 @@ symlook_obj1(SymLook *req, const Obj_Ent > case STT_FUNC: > case STT_NOTYPE: > case STT_OBJECT: > + case STT_GNU_IFUNC: > if (symp->st_value == 0) > continue; > /* fallthrough */ > > Modified: head/libexec/rtld-elf/rtld.h > ============================================================================== > --- head/libexec/rtld-elf/rtld.h Mon Dec 12 10:10:49 2011 (r228434) > +++ head/libexec/rtld-elf/rtld.h Mon Dec 12 11:03:14 2011 (r228435) > @@ -230,6 +230,8 @@ typedef struct Struct_Obj_Entry { > bool on_fini_list: 1; /* Object is already on fini list. */ > bool dag_inited : 1; /* Object has its DAG initialized. */ > bool filtees_loaded : 1; /* Filtees loaded */ > + bool irelative : 1; /* Object has R_MACHDEP_IRELATIVE relocs */ > + bool gnu_ifunc : 1; /* Object has references to STT_GNU_IFUNC */ > > struct link_map linkmap; /* For GDB and dlinfo() */ > Objlist dldags; /* Object belongs to these dlopened DAGs (%) */ > @@ -317,6 +319,7 @@ void lockdflt_init(void); > void obj_free(Obj_Entry *); > Obj_Entry *obj_new(void); > void _rtld_bind_start(void); > +void *rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def); > void symlook_init(SymLook *, const char *); > int symlook_obj(SymLook *, const Obj_Entry *); > void *tls_get_addr_common(Elf_Addr** dtvp, int index, size_t offset); > @@ -334,6 +337,8 @@ int do_copy_relocations(Obj_Entry *); > int reloc_non_plt(Obj_Entry *, Obj_Entry *, struct Struct_RtldLockState *); > int reloc_plt(Obj_Entry *); > int reloc_jmpslots(Obj_Entry *, struct Struct_RtldLockState *); > +int reloc_iresolve(Obj_Entry *, struct Struct_RtldLockState *); > +int reloc_gnu_ifunc(Obj_Entry *, struct Struct_RtldLockState *); > void allocate_initial_tls(Obj_Entry *); > > #endif /* } */ > > Modified: head/libexec/rtld-elf/sparc64/reloc.c > ============================================================================== > --- head/libexec/rtld-elf/sparc64/reloc.c Mon Dec 12 10:10:49 2011 (r228434) > +++ head/libexec/rtld-elf/sparc64/reloc.c Mon Dec 12 11:03:14 2011 (r228435) > @@ -550,6 +550,22 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS > return (0); > } > > +int > +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) > +{ > + > + /* XXX not implemented */ > + return (0); > +} > + > +int > +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) > +{ > + > + /* XXX not implemented */ > + return (0); > +} > + > Elf_Addr > reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, > const Obj_Entry *refobj, const Elf_Rel *rel) From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:11:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 432A01065673; Sat, 17 Dec 2011 15:11:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 184D78FC1C; Sat, 17 Dec 2011 15:11:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHFBMtK064360; Sat, 17 Dec 2011 15:11:22 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHFBMtH064356; Sat, 17 Dec 2011 15:11:22 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112171511.pBHFBMtH064356@svn.freebsd.org> From: Andriy Gapon Date: Sat, 17 Dec 2011 15:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228632 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:11:23 -0000 Author: avg Date: Sat Dec 17 15:11:22 2011 New Revision: 228632 URL: http://svn.freebsd.org/changeset/base/228632 Log: introduce cngrab/cnungrab stub calls in some places where they make sense MFC after: 2 months Modified: head/sys/kern/kern_cons.c head/sys/kern/kern_shutdown.c head/sys/kern/subr_kdb.c Modified: head/sys/kern/kern_cons.c ============================================================================== --- head/sys/kern/kern_cons.c Sat Dec 17 15:08:43 2011 (r228631) +++ head/sys/kern/kern_cons.c Sat Dec 17 15:11:22 2011 (r228632) @@ -427,8 +427,10 @@ cnputc(int c) if (console_pausing && c == '\n' && !kdb_active) { for (cp = console_pausestr; *cp != '\0'; cp++) cnputc(*cp); + cngrab(); if (cngetc() == '.') console_pausing = 0; + cnungrab(); cnputc('\r'); for (cp = console_pausestr; *cp != '\0'; cp++) cnputc(' '); Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Sat Dec 17 15:08:43 2011 (r228631) +++ head/sys/kern/kern_shutdown.c Sat Dec 17 15:11:22 2011 (r228632) @@ -443,6 +443,8 @@ kern_reboot(int howto) print_uptime(); + cngrab(); + /* * Ok, now do things that assume all filesystem activity has * been completed. @@ -613,6 +615,7 @@ panic(const char *fmt, ...) if (newpanic) { (void)vsnprintf(buf, sizeof(buf), fmt, ap); panicstr = buf; + cngrab(); printf("panic: %s\n", buf); } else { printf("panic: "); Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Sat Dec 17 15:08:43 2011 (r228631) +++ head/sys/kern/subr_kdb.c Sat Dec 17 15:11:22 2011 (r228632) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -622,6 +623,8 @@ kdb_trap(int type, int code, struct trap makectx(tf, &kdb_pcb); kdb_thr_select(curthread); + cngrab(); + for (;;) { handled = be->dbbe_trap(type, code); if (be == kdb_dbbe) @@ -632,6 +635,8 @@ kdb_trap(int type, int code, struct trap printf("Switching to %s back-end\n", be->dbbe_name); } + cnungrab(); + kdb_active--; #ifdef SMP From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:16:55 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D37D106566B; Sat, 17 Dec 2011 15:16:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 31E3D8FC15; Sat, 17 Dec 2011 15:16:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHFGtIZ064567; Sat, 17 Dec 2011 15:16:55 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHFGsjW064564; Sat, 17 Dec 2011 15:16:54 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112171516.pBHFGsjW064564@svn.freebsd.org> From: Andriy Gapon Date: Sat, 17 Dec 2011 15:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228633 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:16:55 -0000 Author: avg Date: Sat Dec 17 15:16:54 2011 New Revision: 228633 URL: http://svn.freebsd.org/changeset/base/228633 Log: introduce cngets, a method for kernel to read a string from console This is intended as a replacement for libkern's gets and mostly borrows its implementation. It uses cngrab/cnungrab to delimit kernel's access to console input. Note: libkern's gets obviously doesn't share any bits of implementation iwth libc's gets. They also have different APIs and the former doesn't have the overflow problems of the latter. Inspired by: bde MFC after: 2 months Modified: head/sys/kern/kern_cons.c head/sys/sys/cons.h Modified: head/sys/kern/kern_cons.c ============================================================================== --- head/sys/kern/kern_cons.c Sat Dec 17 15:11:22 2011 (r228632) +++ head/sys/kern/kern_cons.c Sat Dec 17 15:16:54 2011 (r228633) @@ -408,6 +408,55 @@ cncheckc(void) } void +cngets(char *cp, size_t size, int visible) +{ + char *lp, *end; + int c; + + cngrab(); + + lp = cp; + end = cp + size - 1; + for (;;) { + c = cngetc() & 0177; + switch (c) { + case '\n': + case '\r': + cnputc(c); + *lp = '\0'; + cnungrab(); + return; + case '\b': + case '\177': + if (lp > cp) { + if (visible) { + cnputc(c); + cnputs(" \b"); + } + lp--; + } + continue; + case '\0': + continue; + default: + if (lp < end) { + switch (visible) { + case GETS_NOECHO: + break; + case GETS_ECHOPASS: + cnputc('*'); + break; + default: + cnputc(c); + break; + } + *lp++ = c; + } + } + } +} + +void cnputc(int c) { struct cn_device *cnd; Modified: head/sys/sys/cons.h ============================================================================== --- head/sys/sys/cons.h Sat Dec 17 15:11:22 2011 (r228632) +++ head/sys/sys/cons.h Sat Dec 17 15:16:54 2011 (r228633) @@ -121,6 +121,7 @@ void cngrab(void); void cnungrab(void); int cncheckc(void); int cngetc(void); +void cngets(char *, size_t, int); void cnputc(int); void cnputs(char *); int cnunavailable(void); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:26:35 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AED91065673; Sat, 17 Dec 2011 15:26:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59EB18FC1B; Sat, 17 Dec 2011 15:26:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHFQZls064895; Sat, 17 Dec 2011 15:26:35 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHFQZaR064892; Sat, 17 Dec 2011 15:26:35 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112171526.pBHFQZaR064892@svn.freebsd.org> From: Andriy Gapon Date: Sat, 17 Dec 2011 15:26:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228634 - in head/sys: geom/eli kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:26:35 -0000 Author: avg Date: Sat Dec 17 15:26:34 2011 New Revision: 228634 URL: http://svn.freebsd.org/changeset/base/228634 Log: replace uses of libkern gets with cngets MFC after: 2 months Modified: head/sys/geom/eli/g_eli.c head/sys/kern/vfs_mountroot.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Sat Dec 17 15:16:54 2011 (r228633) +++ head/sys/geom/eli/g_eli.c Sat Dec 17 15:26:34 2011 (r228634) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1085,7 +1086,7 @@ g_eli_taste(struct g_class *mp, struct g /* Ask for the passphrase if defined. */ if (md.md_iterations >= 0) { printf("Enter passphrase for %s: ", pp->name); - gets(passphrase, sizeof(passphrase), + cngets(passphrase, sizeof(passphrase), g_eli_visible_passphrase); } Modified: head/sys/kern/vfs_mountroot.c ============================================================================== --- head/sys/kern/vfs_mountroot.c Sat Dec 17 15:16:54 2011 (r228633) +++ head/sys/kern/vfs_mountroot.c Sat Dec 17 15:26:34 2011 (r228634) @@ -42,10 +42,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include -#include #include #include #include @@ -486,7 +486,7 @@ parse_dir_ask(char **conf) do { error = EINVAL; printf("\nmountroot> "); - gets(name, sizeof(name), GETS_ECHO); + cngets(name, sizeof(name), GETS_ECHO); if (name[0] == '\0') break; if (name[0] == '?' && name[1] == '\0') { From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:27:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BEA0106564A; Sat, 17 Dec 2011 15:27:57 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id 6885F8FC0A; Sat, 17 Dec 2011 15:27:56 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id A24D725D37C7; Sat, 17 Dec 2011 15:27:54 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id BA9B4BD732F; Sat, 17 Dec 2011 15:27:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id 7y2QYu5HKdZG; Sat, 17 Dec 2011 15:27:51 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 99B16BD732E; Sat, 17 Dec 2011 15:27:51 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <20111212130849.GA24560@onelab2.iet.unipi.it> Date: Sat, 17 Dec 2011 15:27:51 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <2C809F6E-4D03-4744-966B-E67E991A18C7@lists.zabbadoz.net> References: <201112111846.pBBIkE65064248@svn.freebsd.org> <20111212130849.GA24560@onelab2.iet.unipi.it> To: Luigi Rizzo X-Mailer: Apple Mail (2.1084) Cc: Jack F Vogel , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228415 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:27:57 -0000 On 12. Dec 2011, at 13:08 , Luigi Rizzo wrote: > On Sun, Dec 11, 2011 at 06:46:14PM +0000, Jack F Vogel wrote: >> Author: jfv >> Date: Sun Dec 11 18:46:14 2011 >> New Revision: 228415 >> URL: http://svn.freebsd.org/changeset/base/228415 >>=20 >> Log: >> Last change still had an issue, one more time... >=20 > Jack, > the previous commit (rev. 228387) removed netmap support from if_igb.c > I believe it was unintentional. Can you put it back, or do you want > me to handle it ? >=20 I am not sure why yet (and it could be someone broke the "clean" parts = of the build system) but I am seeing this and cannot remember reports = the last days: In file included from = /scratch/tmp/bz/head.universe/sys/modules/em/../../dev/e1000/if_em.c:400: @/dev/netmap/if_em_netmap.h: In function 'em_netmap_rxsync': @/dev/netmap/if_em_netmap.h:332: warning: dereferencing 'void *' pointer @/dev/netmap/if_em_netmap.h:332: error: request for member 'dt_mt' in = something not a structure or union for a LINT build on sparc64. > cheers > luigi >=20 >> Modified: >> head/sys/dev/e1000/if_em.c >> head/sys/dev/e1000/if_igb.c >>=20 >> Modified: head/sys/dev/e1000/if_em.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/dev/e1000/if_em.c Sun Dec 11 17:32:37 2011 = (r228414) >> +++ head/sys/dev/e1000/if_em.c Sun Dec 11 18:46:14 2011 = (r228415) >> @@ -1045,8 +1045,8 @@ em_ioctl(struct ifnet *ifp, u_long comma >> struct ifreq *ifr =3D (struct ifreq *)data; >> #if defined(INET) || defined(INET6) >> struct ifaddr *ifa =3D (struct ifaddr *)data; >> - bool avoid_reset =3D FALSE; >> #endif >> + bool avoid_reset =3D FALSE; >> int error =3D 0; >>=20 >> if (adapter->in_detach) >> @@ -1062,7 +1062,6 @@ em_ioctl(struct ifnet *ifp, u_long comma >> if (ifa->ifa_addr->sa_family =3D=3D AF_INET6) >> avoid_reset =3D TRUE; >> #endif >> -#if defined(INET) || defined(INET6) >> /* >> ** Calling init results in link renegotiation, >> ** so we avoid doing it when possible. >> @@ -1071,11 +1070,12 @@ em_ioctl(struct ifnet *ifp, u_long comma >> ifp->if_flags |=3D IFF_UP; >> if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) >> em_init(adapter); >> +#ifdef INET >> if (!(ifp->if_flags & IFF_NOARP)) >> arp_ifinit(ifp, ifa); >> +#endif >> } else >> error =3D ether_ioctl(ifp, command, data); >> -#endif >> break; >> case SIOCSIFMTU: >> { >>=20 >> Modified: head/sys/dev/e1000/if_igb.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/dev/e1000/if_igb.c Sun Dec 11 17:32:37 2011 = (r228414) >> +++ head/sys/dev/e1000/if_igb.c Sun Dec 11 18:46:14 2011 = (r228415) >> @@ -992,8 +992,8 @@ igb_ioctl(struct ifnet *ifp, u_long comm >> struct ifreq *ifr =3D (struct ifreq *)data; >> #if defined(INET) || defined(INET6) >> struct ifaddr *ifa =3D (struct ifaddr *)data; >> - bool avoid_reset =3D FALSE; >> #endif >> + bool avoid_reset =3D FALSE; >> int error =3D 0; >>=20 >> if (adapter->in_detach) >> @@ -1009,7 +1009,6 @@ igb_ioctl(struct ifnet *ifp, u_long comm >> if (ifa->ifa_addr->sa_family =3D=3D AF_INET6) >> avoid_reset =3D TRUE; >> #endif >> -#if defined(INET) || defined(INET6) >> /* >> ** Calling init results in link renegotiation, >> ** so we avoid doing it when possible. >> @@ -1018,11 +1017,12 @@ igb_ioctl(struct ifnet *ifp, u_long comm >> ifp->if_flags |=3D IFF_UP; >> if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) >> igb_init(adapter); >> +#ifdef INET >> if (!(ifp->if_flags & IFF_NOARP)) >> arp_ifinit(ifp, ifa); >> +#endif >> } else >> error =3D ether_ioctl(ifp, command, data); >> -#endif >> break; >> case SIOCSIFMTU: >> { --=20 Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:30:34 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F278A106566B; Sat, 17 Dec 2011 15:30:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id DB0E98FC08; Sat, 17 Dec 2011 15:30:33 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id RAA05786; Sat, 17 Dec 2011 17:30:32 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1RbwDY-0009hL-7R; Sat, 17 Dec 2011 17:30:32 +0200 Message-ID: <4EECB595.8020909@FreeBSD.org> Date: Sat, 17 Dec 2011 17:30:29 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111206 Thunderbird/8.0 MIME-Version: 1.0 To: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201112171508.pBHF8ibC064202@svn.freebsd.org> In-Reply-To: <201112171508.pBHF8ibC064202@svn.freebsd.org> X-Enigmail-Version: undefined Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r228631 - in head/sys: dev/cfe dev/dcons dev/ofw dev/sio dev/syscons dev/uart dev/usb/serial dev/xen/console gdb ia64/ia64 kern mips/adm5120 pc98/cbus powerpc/mambo sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:30:35 -0000 on 17/12/2011 17:08 Andriy Gapon said the following: > +void > +cngrab() > +{ > + struct cn_device *cnd; > + struct consdev *cn; > + > + STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) { > + cn = cnd->cnd_cn; > + if (!kdb_active || !(cn->cn_flags & CN_FLAG_NODEBUG)) > + cn->cn_ops->cn_grab(cn); > + } > +} BTW, it seems that CN_FLAG_NODEBUG is not set for any of the current console drivers. A candidate for removal? -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:31:00 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2FC51065675; Sat, 17 Dec 2011 15:31:00 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B173E8FC1F; Sat, 17 Dec 2011 15:31:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHFV0UA065070; Sat, 17 Dec 2011 15:31:00 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHFV0sT065067; Sat, 17 Dec 2011 15:31:00 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201112171531.pBHFV0sT065067@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 17 Dec 2011 15:31:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228635 - head/libexec/rtld-elf/powerpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:31:00 -0000 Author: nwhitehorn Date: Sat Dec 17 15:31:00 2011 New Revision: 228635 URL: http://svn.freebsd.org/changeset/base/228635 Log: Fix RTLD on PowerPC after r228435. Changing the order of init_pltgot() caused the icache to be invalidated at the wrong time, resulting in an icache full of nonsense in the PLT section. Modified: head/libexec/rtld-elf/powerpc/reloc.c Modified: head/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc/reloc.c Sat Dec 17 15:26:34 2011 (r228634) +++ head/libexec/rtld-elf/powerpc/reloc.c Sat Dec 17 15:31:00 2011 (r228635) @@ -366,7 +366,7 @@ reloc_plt_object(Obj_Entry *obj, const E /* - * The icache will be sync'd in init_pltgot, which is called + * The icache will be sync'd in reloc_plt, which is called * after all the slots have been updated */ @@ -382,6 +382,7 @@ reloc_plt(Obj_Entry *obj) { const Elf_Rela *relalim; const Elf_Rela *rela; + int N = obj->pltrelasize / sizeof(Elf_Rela); if (obj->pltrelasize != 0) { @@ -396,6 +397,13 @@ reloc_plt(Obj_Entry *obj) } } + /* + * Sync the icache for the byte range represented by the + * trampoline routines and call slots. + */ + if (obj->pltgot != NULL) + __syncicache(obj->pltgot, JMPTAB_BASE(N)*4); + return (0); } @@ -595,10 +603,9 @@ init_pltgot(Obj_Entry *obj) pltresolve[4] |= _ppc_la(obj); /* - * Sync the icache for the byte range represented by the - * trampoline routines and call slots. + * The icache will be sync'd in reloc_plt, which is called + * after all the slots have been updated */ - __syncicache(obj->pltgot, JMPTAB_BASE(N)*4); } void From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:33:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57350106566C; Sat, 17 Dec 2011 15:33:05 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from argol.doit.wisc.edu (argol.doit.wisc.edu [144.92.197.212]) by mx1.freebsd.org (Postfix) with ESMTP id 1DB0B8FC14; Sat, 17 Dec 2011 15:33:04 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth3.wiscmail.wisc.edu by smtpauth3.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0LWC00G00TV4E200@smtpauth3.wiscmail.wisc.edu>; Sat, 17 Dec 2011 09:33:04 -0600 (CST) Received: from comporellon.tachypleus.net ([unknown] [76.210.77.223]) by smtpauth3.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0LWC00ENNTV1D500@smtpauth3.wiscmail.wisc.edu>; Sat, 17 Dec 2011 09:33:02 -0600 (CST) Date: Sat, 17 Dec 2011 09:33:01 -0600 From: Nathan Whitehorn In-reply-to: <4EECB0A4.504@freebsd.org> To: Konstantin Belousov Message-id: <4EECB62D.2070608@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=76.210.77.223 X-Spam-PmxInfo: Server=avs-9, Version=5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2011.12.17.152414, SenderIP=76.210.77.223 References: <201112121103.pBCB3FuT097580@svn.freebsd.org> <4EECB0A4.504@freebsd.org> User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111113 Thunderbird/8.0 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, powerpc@freebsd.org Subject: Re: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:33:05 -0000 Fixed in r228635. -Nathan On 12/17/11 09:09, Nathan Whitehorn wrote: > This broke PowerPC really, really badly. Basically every > dynamically-linked executable dies with an illegal instruction trap. > -Nathan > > On 12/12/11 05:03, Konstantin Belousov wrote: >> Author: kib >> Date: Mon Dec 12 11:03:14 2011 >> New Revision: 228435 >> URL: http://svn.freebsd.org/changeset/base/228435 >> >> Log: >> Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU >> extensions to >> rtld on 386 and amd64. This adds runtime bits neccessary for the use >> of the dispatch functions from the dynamically-linked executables and >> shared libraries. >> >> To allow use of external references from the dispatch function, >> resolution >> of the R_MACHINE_IRESOLVE relocations in PLT is postponed until >> GOT entries >> for PLT are prepared, and normal resolution of the GOT entries is >> finished. >> Similar to how it is done by GNU, IRELATIVE relocations are >> resolved in >> advance, instead of normal lazy handling for PLT. >> >> Move the init_pltgot() call before the relocations for the object are >> processed. >> >> MFC after: 3 weeks >> >> Modified: >> head/libexec/rtld-elf/amd64/reloc.c >> head/libexec/rtld-elf/arm/reloc.c >> head/libexec/rtld-elf/i386/reloc.c >> head/libexec/rtld-elf/ia64/reloc.c >> head/libexec/rtld-elf/mips/reloc.c >> head/libexec/rtld-elf/powerpc/reloc.c >> head/libexec/rtld-elf/powerpc64/reloc.c >> head/libexec/rtld-elf/rtld.c >> head/libexec/rtld-elf/rtld.h >> head/libexec/rtld-elf/sparc64/reloc.c >> >> Modified: head/libexec/rtld-elf/amd64/reloc.c >> ============================================================================== >> >> --- head/libexec/rtld-elf/amd64/reloc.c Mon Dec 12 10:10:49 >> 2011 (r228434) >> +++ head/libexec/rtld-elf/amd64/reloc.c Mon Dec 12 11:03:14 >> 2011 (r228435) >> @@ -344,11 +344,22 @@ reloc_plt(Obj_Entry *obj) >> for (rela = obj->pltrela; rela< relalim; rela++) { >> Elf_Addr *where; >> >> - assert(ELF_R_TYPE(rela->r_info) == R_X86_64_JMP_SLOT); >> - >> - /* Relocate the GOT slot pointing into the PLT. */ >> - where = (Elf_Addr *)(obj->relocbase + rela->r_offset); >> - *where += (Elf_Addr)obj->relocbase; >> + switch(ELF_R_TYPE(rela->r_info)) { >> + case R_X86_64_JMP_SLOT: >> + /* Relocate the GOT slot pointing into the PLT. */ >> + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); >> + *where += (Elf_Addr)obj->relocbase; >> + break; >> + >> + case R_X86_64_IRELATIVE: >> + obj->irelative = true; >> + break; >> + >> + default: >> + _rtld_error("Unknown relocation type %x in PLT", >> + (unsigned int)ELF_R_TYPE(rela->r_info)); >> + return (-1); >> + } >> } >> return 0; >> } >> @@ -368,19 +379,91 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS >> const Elf_Sym *def; >> const Obj_Entry *defobj; >> >> - assert(ELF_R_TYPE(rela->r_info) == R_X86_64_JMP_SLOT); >> - where = (Elf_Addr *)(obj->relocbase + rela->r_offset); >> - def = find_symdef(ELF_R_SYM(rela->r_info), obj,&defobj, true, NULL, >> - lockstate); >> - if (def == NULL) >> - return -1; >> - target = (Elf_Addr)(defobj->relocbase + def->st_value + >> rela->r_addend); >> - reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); >> + switch (ELF_R_TYPE(rela->r_info)) { >> + case R_X86_64_JMP_SLOT: >> + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); >> + def = find_symdef(ELF_R_SYM(rela->r_info), obj,&defobj, true, >> NULL, >> + lockstate); >> + if (def == NULL) >> + return (-1); >> + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { >> + obj->gnu_ifunc = true; >> + continue; >> + } >> + target = (Elf_Addr)(defobj->relocbase + def->st_value + >> rela->r_addend); >> + reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); >> + break; >> + >> + case R_X86_64_IRELATIVE: >> + break; >> + >> + default: >> + _rtld_error("Unknown relocation type %x in PLT", >> + (unsigned int)ELF_R_TYPE(rela->r_info)); >> + return (-1); >> + } >> } >> obj->jmpslots_done = true; >> return 0; >> } >> >> +int >> +reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate) >> +{ >> + const Elf_Rela *relalim; >> + const Elf_Rela *rela; >> + >> + relalim = (const Elf_Rela *)((char *)obj->pltrela + >> obj->pltrelasize); >> + for (rela = obj->pltrela; rela< relalim; rela++) { >> + Elf_Addr *where, target, *ptr; >> + >> + switch (ELF_R_TYPE(rela->r_info)) { >> + case R_X86_64_JMP_SLOT: >> + break; >> + >> + case R_X86_64_IRELATIVE: >> + ptr = (Elf_Addr *)(obj->relocbase + rela->r_addend); >> + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); >> + target = ((Elf_Addr (*)(void))ptr)(); >> + *where = target; >> + break; >> + } >> + } >> + return (0); >> +} >> + >> +int >> +reloc_gnu_ifunc(Obj_Entry *obj, RtldLockState *lockstate) >> +{ >> + const Elf_Rela *relalim; >> + const Elf_Rela *rela; >> + >> + if (!obj->gnu_ifunc) >> + return (0); >> + relalim = (const Elf_Rela *)((char *)obj->pltrela + >> obj->pltrelasize); >> + for (rela = obj->pltrela; rela< relalim; rela++) { >> + Elf_Addr *where, target; >> + const Elf_Sym *def; >> + const Obj_Entry *defobj; >> + >> + switch (ELF_R_TYPE(rela->r_info)) { >> + case R_X86_64_JMP_SLOT: >> + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); >> + def = find_symdef(ELF_R_SYM(rela->r_info), obj,&defobj, true, >> NULL, >> + lockstate); >> + if (def == NULL) >> + return (-1); >> + if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) >> + continue; >> + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); >> + reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); >> + break; >> + } >> + } >> + obj->gnu_ifunc = false; >> + return 0; >> +} >> + >> void >> allocate_initial_tls(Obj_Entry *objs) >> { >> >> Modified: head/libexec/rtld-elf/arm/reloc.c >> ============================================================================== >> >> --- head/libexec/rtld-elf/arm/reloc.c Mon Dec 12 10:10:49 2011 >> (r228434) >> +++ head/libexec/rtld-elf/arm/reloc.c Mon Dec 12 11:03:14 2011 >> (r228435) >> @@ -337,6 +337,22 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS >> return (0); >> } >> >> +int >> +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) >> +{ >> + >> + /* XXX not implemented */ >> + return (0); >> +} >> + >> +int >> +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) >> +{ >> + >> + /* XXX not implemented */ >> + return (0); >> +} >> + >> Elf_Addr >> reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry >> *defobj, >> const Obj_Entry *obj, const Elf_Rel *rel) >> >> Modified: head/libexec/rtld-elf/i386/reloc.c >> ============================================================================== >> >> --- head/libexec/rtld-elf/i386/reloc.c Mon Dec 12 10:10:49 2011 >> (r228434) >> +++ head/libexec/rtld-elf/i386/reloc.c Mon Dec 12 11:03:14 2011 >> (r228435) >> @@ -298,13 +298,24 @@ reloc_plt(Obj_Entry *obj) >> >> rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); >> for (rel = obj->pltrel; rel< rellim; rel++) { >> - Elf_Addr *where; >> + Elf_Addr *where/*, val*/; >> >> - assert(ELF_R_TYPE(rel->r_info) == R_386_JMP_SLOT); >> - >> - /* Relocate the GOT slot pointing into the PLT. */ >> - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); >> - *where += (Elf_Addr)obj->relocbase; >> + switch (ELF_R_TYPE(rel->r_info)) { >> + case R_386_JMP_SLOT: >> + /* Relocate the GOT slot pointing into the PLT. */ >> + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); >> + *where += (Elf_Addr)obj->relocbase; >> + break; >> + >> + case R_386_IRELATIVE: >> + obj->irelative = true; >> + break; >> + >> + default: >> + _rtld_error("Unknown relocation type %x in PLT", >> + ELF_R_TYPE(rel->r_info)); >> + return (-1); >> + } >> } >> return 0; >> } >> @@ -324,19 +335,88 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS >> const Elf_Sym *def; >> const Obj_Entry *defobj; >> >> - assert(ELF_R_TYPE(rel->r_info) == R_386_JMP_SLOT); >> - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); >> - def = find_symdef(ELF_R_SYM(rel->r_info), obj,&defobj, true, NULL, >> - lockstate); >> - if (def == NULL) >> - return -1; >> - target = (Elf_Addr)(defobj->relocbase + def->st_value); >> - reloc_jmpslot(where, target, defobj, obj, rel); >> + switch (ELF_R_TYPE(rel->r_info)) { >> + case R_386_JMP_SLOT: >> + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); >> + def = find_symdef(ELF_R_SYM(rel->r_info), obj,&defobj, true, >> NULL, >> + lockstate); >> + if (def == NULL) >> + return (-1); >> + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { >> + obj->gnu_ifunc = true; >> + continue; >> + } >> + target = (Elf_Addr)(defobj->relocbase + def->st_value); >> + reloc_jmpslot(where, target, defobj, obj, rel); >> + break; >> + >> + case R_386_IRELATIVE: >> + break; >> + >> + default: >> + _rtld_error("Unknown relocation type %x in PLT", >> + ELF_R_TYPE(rel->r_info)); >> + return (-1); >> + } >> } >> + >> obj->jmpslots_done = true; >> return 0; >> } >> >> +int >> +reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate) >> +{ >> + const Elf_Rel *rellim; >> + const Elf_Rel *rel; >> + Elf_Addr *where, target; >> + >> + rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); >> + for (rel = obj->pltrel; rel< rellim; rel++) { >> + switch (ELF_R_TYPE(rel->r_info)) { >> + case R_386_IRELATIVE: >> + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); >> + target = ((Elf_Addr (*)(void))(*where))(); >> + *where = target; >> + break; >> + } >> + } >> + return (0); >> +} >> + >> +int >> +reloc_gnu_ifunc(Obj_Entry *obj, RtldLockState *lockstate) >> +{ >> + const Elf_Rel *rellim; >> + const Elf_Rel *rel; >> + >> + if (!obj->gnu_ifunc) >> + return (0); >> + rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); >> + for (rel = obj->pltrel; rel< rellim; rel++) { >> + Elf_Addr *where, target; >> + const Elf_Sym *def; >> + const Obj_Entry *defobj; >> + >> + switch (ELF_R_TYPE(rel->r_info)) { >> + case R_386_JMP_SLOT: >> + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); >> + def = find_symdef(ELF_R_SYM(rel->r_info), obj,&defobj, true, >> NULL, >> + lockstate); >> + if (def == NULL) >> + return (-1); >> + if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) >> + continue; >> + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); >> + reloc_jmpslot(where, target, defobj, obj, rel); >> + break; >> + } >> + } >> + >> + obj->gnu_ifunc = false; >> + return (0); >> +} >> + >> void >> allocate_initial_tls(Obj_Entry *objs) >> { >> >> Modified: head/libexec/rtld-elf/ia64/reloc.c >> ============================================================================== >> >> --- head/libexec/rtld-elf/ia64/reloc.c Mon Dec 12 10:10:49 2011 >> (r228434) >> +++ head/libexec/rtld-elf/ia64/reloc.c Mon Dec 12 11:03:14 2011 >> (r228435) >> @@ -435,6 +435,22 @@ reloc_plt(Obj_Entry *obj) >> return 0; >> } >> >> +int >> +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) >> +{ >> + >> + /* XXX not implemented */ >> + return (0); >> +} >> + >> +int >> +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) >> +{ >> + >> + /* XXX not implemented */ >> + return (0); >> +} >> + >> /* Relocate the jump slots in an object. */ >> int >> reloc_jmpslots(Obj_Entry *obj, RtldLockState *lockstate) >> >> Modified: head/libexec/rtld-elf/mips/reloc.c >> ============================================================================== >> >> --- head/libexec/rtld-elf/mips/reloc.c Mon Dec 12 10:10:49 2011 >> (r228434) >> +++ head/libexec/rtld-elf/mips/reloc.c Mon Dec 12 11:03:14 2011 >> (r228435) >> @@ -498,6 +498,22 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS >> return (0); >> } >> >> +int >> +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) >> +{ >> + >> + /* XXX not implemented */ >> + return (0); >> +} >> + >> +int >> +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) >> +{ >> + >> + /* XXX not implemented */ >> + return (0); >> +} >> + >> Elf_Addr >> reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry >> *defobj, >> const Obj_Entry *obj, const Elf_Rel *rel) >> >> Modified: head/libexec/rtld-elf/powerpc/reloc.c >> ============================================================================== >> >> --- head/libexec/rtld-elf/powerpc/reloc.c Mon Dec 12 10:10:49 >> 2011 (r228434) >> +++ head/libexec/rtld-elf/powerpc/reloc.c Mon Dec 12 11:03:14 >> 2011 (r228435) >> @@ -504,6 +504,21 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr >> return (target); >> } >> >> +int >> +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) >> +{ >> + >> + /* XXX not implemented */ >> + return (0); >> +} >> + >> +int >> +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) >> +{ >> + >> + /* XXX not implemented */ >> + return (0); >> +} >> >> /* >> * Setup the plt glue routines. >> >> Modified: head/libexec/rtld-elf/powerpc64/reloc.c >> ============================================================================== >> >> --- head/libexec/rtld-elf/powerpc64/reloc.c Mon Dec 12 10:10:49 >> 2011 (r228434) >> +++ head/libexec/rtld-elf/powerpc64/reloc.c Mon Dec 12 11:03:14 >> 2011 (r228435) >> @@ -456,6 +456,22 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr >> return (target); >> } >> >> +int >> +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) >> +{ >> + >> + /* XXX not implemented */ >> + return (0); >> +} >> + >> +int >> +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) >> +{ >> + >> + /* XXX not implemented */ >> + return (0); >> +} >> + >> void >> init_pltgot(Obj_Entry *obj) >> { >> >> Modified: head/libexec/rtld-elf/rtld.c >> ============================================================================== >> >> --- head/libexec/rtld-elf/rtld.c Mon Dec 12 10:10:49 2011 >> (r228434) >> +++ head/libexec/rtld-elf/rtld.c Mon Dec 12 11:03:14 2011 >> (r228435) >> @@ -561,6 +561,17 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ >> return (func_ptr_type) obj_main->entry; >> } >> >> +void * >> +rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def) >> +{ >> + void *ptr; >> + Elf_Addr target; >> + >> + ptr = (void *)make_function_pointer(def, obj); >> + target = ((Elf_Addr (*)(void))ptr)(); >> + return ((void *)target); >> +} >> + >> Elf_Addr >> _rtld_bind(Obj_Entry *obj, Elf_Size reloff) >> { >> @@ -584,8 +595,10 @@ _rtld_bind(Obj_Entry *obj, Elf_Size relo >> &lockstate); >> if (def == NULL) >> die(); >> - >> - target = (Elf_Addr)(defobj->relocbase + def->st_value); >> + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) >> + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); >> + else >> + target = (Elf_Addr)(defobj->relocbase + def->st_value); >> >> dbg("\"%s\" in \"%s\" ==> %p in \"%s\"", >> defobj->strtab + def->st_name, basename(obj->path), >> @@ -1944,6 +1957,10 @@ relocate_objects(Obj_Entry *first, bool >> } >> } >> >> + >> + /* Set the special PLT or GOT entries. */ >> + init_pltgot(obj); >> + >> /* Process the PLT relocations. */ >> if (reloc_plt(obj) == -1) >> return -1; >> @@ -1952,7 +1969,6 @@ relocate_objects(Obj_Entry *first, bool >> if (reloc_jmpslots(obj, lockstate) == -1) >> return -1; >> >> - >> /* >> * Set up the magic number and version in the Obj_Entry. These >> * were checked in the crt1.o from the original ElfKit, so we >> @@ -1960,11 +1976,26 @@ relocate_objects(Obj_Entry *first, bool >> */ >> obj->magic = RTLD_MAGIC; >> obj->version = RTLD_VERSION; >> - >> - /* Set the special PLT or GOT entries. */ >> - init_pltgot(obj); >> } >> >> + /* >> + * The handling of R_MACHINE_IRELATIVE relocations and jumpslots >> + * referencing STT_GNU_IFUNC symbols is postponed till the other >> + * relocations are done. The indirect functions specified as >> + * ifunc are allowed to call other symbols, so we need to have >> + * objects relocated before asking for resolution from indirects. >> + * >> + * The R_MACHINE_IRELATIVE slots are resolved in greedy fashion, >> + * instead of the usual lazy handling of PLT slots. It is >> + * consistent with how GNU does it. >> + */ >> + for (obj = first; obj != NULL; obj = obj->next) { >> + if (obj->irelative&& reloc_iresolve(obj, lockstate) == -1) >> + return (-1); >> + if ((obj->bind_now || bind_now)&& obj->gnu_ifunc&& >> + reloc_gnu_ifunc(obj, lockstate) == -1) >> + return (-1); >> + } >> return 0; >> } >> >> @@ -2376,9 +2407,11 @@ do_dlsym(void *handle, const char *name, >> * the relocated value of the symbol. >> */ >> if (ELF_ST_TYPE(def->st_info) == STT_FUNC) >> - return make_function_pointer(def, defobj); >> + return (make_function_pointer(def, defobj)); >> + else if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) >> + return (rtld_resolve_ifunc(defobj, def)); >> else >> - return defobj->relocbase + def->st_value; >> + return (defobj->relocbase + def->st_value); >> } >> >> _rtld_error("Undefined symbol \"%s\"", name); >> @@ -2822,6 +2855,8 @@ get_program_var_addr(const char *name, R >> if (ELF_ST_TYPE(req.sym_out->st_info) == STT_FUNC) >> return ((const void **)make_function_pointer(req.sym_out, >> req.defobj_out)); >> + else if (ELF_ST_TYPE(req.sym_out->st_info) == STT_GNU_IFUNC) >> + return ((const void **)rtld_resolve_ifunc(req.defobj_out, >> req.sym_out)); >> else >> return ((const void **)(req.defobj_out->relocbase + >> req.sym_out->st_value)); >> @@ -3088,6 +3123,7 @@ symlook_obj1(SymLook *req, const Obj_Ent >> case STT_FUNC: >> case STT_NOTYPE: >> case STT_OBJECT: >> + case STT_GNU_IFUNC: >> if (symp->st_value == 0) >> continue; >> /* fallthrough */ >> >> Modified: head/libexec/rtld-elf/rtld.h >> ============================================================================== >> >> --- head/libexec/rtld-elf/rtld.h Mon Dec 12 10:10:49 2011 >> (r228434) >> +++ head/libexec/rtld-elf/rtld.h Mon Dec 12 11:03:14 2011 >> (r228435) >> @@ -230,6 +230,8 @@ typedef struct Struct_Obj_Entry { >> bool on_fini_list: 1; /* Object is already on fini list. */ >> bool dag_inited : 1; /* Object has its DAG initialized. */ >> bool filtees_loaded : 1; /* Filtees loaded */ >> + bool irelative : 1; /* Object has R_MACHDEP_IRELATIVE >> relocs */ >> + bool gnu_ifunc : 1; /* Object has references to >> STT_GNU_IFUNC */ >> >> struct link_map linkmap; /* For GDB and dlinfo() */ >> Objlist dldags; /* Object belongs to these dlopened DAGs >> (%) */ >> @@ -317,6 +319,7 @@ void lockdflt_init(void); >> void obj_free(Obj_Entry *); >> Obj_Entry *obj_new(void); >> void _rtld_bind_start(void); >> +void *rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def); >> void symlook_init(SymLook *, const char *); >> int symlook_obj(SymLook *, const Obj_Entry *); >> void *tls_get_addr_common(Elf_Addr** dtvp, int index, size_t offset); >> @@ -334,6 +337,8 @@ int do_copy_relocations(Obj_Entry *); >> int reloc_non_plt(Obj_Entry *, Obj_Entry *, struct >> Struct_RtldLockState *); >> int reloc_plt(Obj_Entry *); >> int reloc_jmpslots(Obj_Entry *, struct Struct_RtldLockState *); >> +int reloc_iresolve(Obj_Entry *, struct Struct_RtldLockState *); >> +int reloc_gnu_ifunc(Obj_Entry *, struct Struct_RtldLockState *); >> void allocate_initial_tls(Obj_Entry *); >> >> #endif /* } */ >> >> Modified: head/libexec/rtld-elf/sparc64/reloc.c >> ============================================================================== >> >> --- head/libexec/rtld-elf/sparc64/reloc.c Mon Dec 12 10:10:49 >> 2011 (r228434) >> +++ head/libexec/rtld-elf/sparc64/reloc.c Mon Dec 12 11:03:14 >> 2011 (r228435) >> @@ -550,6 +550,22 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS >> return (0); >> } >> >> +int >> +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) >> +{ >> + >> + /* XXX not implemented */ >> + return (0); >> +} >> + >> +int >> +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) >> +{ >> + >> + /* XXX not implemented */ >> + return (0); >> +} >> + >> Elf_Addr >> reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, >> const Obj_Entry *refobj, const Elf_Rel *rel) > From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:33:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15B731065680; Sat, 17 Dec 2011 15:33:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04B118FC08; Sat, 17 Dec 2011 15:33:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHFXQnH065211; Sat, 17 Dec 2011 15:33:26 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHFXQis065209; Sat, 17 Dec 2011 15:33:26 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171533.pBHFXQis065209@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 15:33:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228636 - head/usr.bin/hexdump X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:33:27 -0000 Author: dim Date: Sat Dec 17 15:33:26 2011 New Revision: 228636 URL: http://svn.freebsd.org/changeset/base/228636 Log: Correct a logic error in usr.bin/hexdump/conv.c, found by clang. Whenever the conv_c() function encounters an incomplete multibyte char, it peeks ahead. It also sets p to peekbuf, to indicate it is still processing the incomplete character. However, on the next retry, it compares buf against peekbuf, which always returns false, since both buf and peekbuf are local char arrays, whose addresses are never the same. Fix this by comparing against p instead, which was the intention. Also turn peekbuf into an array of u_char, to prevent conversion warnings. MFC after: 1 week Modified: head/usr.bin/hexdump/conv.c Modified: head/usr.bin/hexdump/conv.c ============================================================================== --- head/usr.bin/hexdump/conv.c Sat Dec 17 15:31:00 2011 (r228635) +++ head/usr.bin/hexdump/conv.c Sat Dec 17 15:33:26 2011 (r228636) @@ -53,7 +53,7 @@ conv_c(PR *pr, u_char *p, size_t bufsize wchar_t wc; size_t clen, oclen; int converr, pad, width; - char peekbuf[MB_LEN_MAX]; + u_char peekbuf[MB_LEN_MAX]; if (pr->mbleft > 0) { str = "**"; @@ -103,7 +103,7 @@ retry: if (clen == 0) clen = 1; else if (clen == (size_t)-1 || (clen == (size_t)-2 && - buf == peekbuf)) { + p == peekbuf)) { memset(&pr->mbstate, 0, sizeof(pr->mbstate)); wc = *p; clen = 1; From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:37:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC879106566B; Sat, 17 Dec 2011 15:37:23 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 56E9B8FC14; Sat, 17 Dec 2011 15:37:23 +0000 (UTC) Received: by ggnp1 with SMTP id p1so5140590ggn.13 for ; Sat, 17 Dec 2011 07:37:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=S6uehKk691no8wpnwmhhbE1pgeD+adKZnLKMPByqT5U=; b=ImVC0Tt5UU6mRA0FhybSbFUm33B26rMndCF7TnTmLa1URmrZbzwSQcJxDCnARjtOqC qLa1huzC+ak1R2zZvhJmyNtuyb/SpEern69N2Ld4PjYe86Kxh8U7f1gTWuul+hSOnQ7v rhvgglJcfJLwLb/Zuo4nvrsuMSEFrsXqmWYj8= MIME-Version: 1.0 Received: by 10.182.225.66 with SMTP id ri2mr6489330obc.26.1324136242771; Sat, 17 Dec 2011 07:37:22 -0800 (PST) Received: by 10.182.62.227 with HTTP; Sat, 17 Dec 2011 07:37:22 -0800 (PST) In-Reply-To: <201112171451.pBHEpPtM063602@svn.freebsd.org> References: <201112171451.pBHEpPtM063602@svn.freebsd.org> Date: Sat, 17 Dec 2011 07:37:22 -0800 Message-ID: From: Garrett Cooper To: Dimitry Andric Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228629 - head/usr.bin/gprof X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:37:23 -0000 On Sat, Dec 17, 2011 at 6:51 AM, Dimitry Andric wrote: > Author: dim > Date: Sat Dec 17 14:51:24 2011 > New Revision: 228629 > URL: http://svn.freebsd.org/changeset/base/228629 > > Log: > =A0More fixes for correct printf length modifiers usr.bin/gprof. These fixes should be contributed upstream. Thanks! -Garrett From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:38:16 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1036106566B; Sat, 17 Dec 2011 15:38:16 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C00FF8FC14; Sat, 17 Dec 2011 15:38:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHFcGoV065406; Sat, 17 Dec 2011 15:38:16 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHFcGh0065403; Sat, 17 Dec 2011 15:38:16 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201112171538.pBHFcGh0065403@svn.freebsd.org> From: Kevin Lo Date: Sat, 17 Dec 2011 15:38:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228637 - in head/sys/dev/usb: . net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:38:16 -0000 Author: kevlo Date: Sat Dec 17 15:38:16 2011 New Revision: 228637 URL: http://svn.freebsd.org/changeset/base/228637 Log: Another axe(4), found in ASUS zenbook. Modified: head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Sat Dec 17 15:33:26 2011 (r228636) +++ head/sys/dev/usb/net/if_axe.c Sat Dec 17 15:38:16 2011 (r228637) @@ -151,6 +151,7 @@ static const STRUCT_USB_HOST_ID axe_devs AXE_DEV(ASIX, AX88772, AXE_FLAG_772), AXE_DEV(ASIX, AX88772A, AXE_FLAG_772A), AXE_DEV(ASIX, AX88772B, AXE_FLAG_772B), + AXE_DEV(ASIX, AX88772B_1, AXE_FLAG_772B), AXE_DEV(ATEN, UC210T, 0), AXE_DEV(BELKIN, F5D5055, AXE_FLAG_178), AXE_DEV(BILLIONTON, USB2AR, 0), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sat Dec 17 15:33:26 2011 (r228636) +++ head/sys/dev/usb/usbdevs Sat Dec 17 15:38:16 2011 (r228637) @@ -1050,6 +1050,7 @@ product ASIX AX88178 0x1780 AX88178 product ASIX AX88772 0x7720 AX88772 product ASIX AX88772A 0x772a AX88772A USB 2.0 10/100 Ethernet product ASIX AX88772B 0x772b AX88772B USB 2.0 10/100 Ethernet +product ASIX AX88772B_1 0x7e2b AX88772B USB 2.0 10/100 Ethernet /* ASUS products */ product ASUS2 USBN11 0x0b05 USB-N11 From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:39:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C8B11065672; Sat, 17 Dec 2011 15:39:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BE438FC14; Sat, 17 Dec 2011 15:39:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHFdFcZ065468; Sat, 17 Dec 2011 15:39:15 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHFdF48065465; Sat, 17 Dec 2011 15:39:15 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112171539.pBHFdF48065465@svn.freebsd.org> From: Andriy Gapon Date: Sat, 17 Dec 2011 15:39:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228638 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:39:15 -0000 Author: avg Date: Sat Dec 17 15:39:14 2011 New Revision: 228638 URL: http://svn.freebsd.org/changeset/base/228638 Log: move GETS_*ECHO* defintions from libkern.h to cons.h MFC after: 2 months Modified: head/sys/sys/cons.h head/sys/sys/libkern.h Modified: head/sys/sys/cons.h ============================================================================== --- head/sys/sys/cons.h Sat Dec 17 15:38:16 2011 (r228637) +++ head/sys/sys/cons.h Sat Dec 17 15:39:14 2011 (r228638) @@ -86,6 +86,11 @@ struct consdev { #define CN_FLAG_NODEBUG 0x00000001 /* Not supported with debugger. */ #define CN_FLAG_NOAVAIL 0x00000002 /* Temporarily not available. */ +/* Visibility of characters in cngets() */ +#define GETS_NOECHO 0 /* Disable echoing of characters. */ +#define GETS_ECHO 1 /* Enable echoing of characters. */ +#define GETS_ECHOPASS 2 /* Print a * for every character. */ + #ifdef _KERNEL extern struct msgbuf consmsgbuf; /* Message buffer for constty. */ Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Sat Dec 17 15:38:16 2011 (r228637) +++ head/sys/sys/libkern.h Sat Dec 17 15:39:14 2011 (r228638) @@ -188,9 +188,4 @@ strrchr(const char *p, int ch) #define FNM_IGNORECASE FNM_CASEFOLD #define FNM_FILE_NAME FNM_PATHNAME -/* Visibility of characters in gets() */ -#define GETS_NOECHO 0 /* Disable echoing of characters. */ -#define GETS_ECHO 1 /* Enable echoing of characters. */ -#define GETS_ECHOPASS 2 /* Print a * for every character. */ - #endif /* !_SYS_LIBKERN_H_ */ From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:41:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06519106564A; Sat, 17 Dec 2011 15:41:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E96CB8FC12; Sat, 17 Dec 2011 15:41:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHFfwwP065596; Sat, 17 Dec 2011 15:41:58 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHFfw1n065594; Sat, 17 Dec 2011 15:41:58 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171541.pBHFfw1n065594@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 15:41:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228639 - head/usr.bin/indent X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:41:59 -0000 Author: dim Date: Sat Dec 17 15:41:58 2011 New Revision: 228639 URL: http://svn.freebsd.org/changeset/base/228639 Log: In usr.bin/indent/io.c, fix a few warnings about format strings not being literals. MFC after: 1 week Modified: head/usr.bin/indent/io.c Modified: head/usr.bin/indent/io.c ============================================================================== --- head/usr.bin/indent/io.c Sat Dec 17 15:39:14 2011 (r228638) +++ head/usr.bin/indent/io.c Sat Dec 17 15:41:58 2011 (r228639) @@ -581,12 +581,12 @@ diag2(int level, const char *msg) found_err = 1; if (output == stdout) { fprintf(stdout, "/**INDENT** %s@%d: ", level == 0 ? "Warning" : "Error", line_no); - fprintf(stdout, msg); + fprintf(stdout, "%s", msg); fprintf(stdout, " */\n"); } else { fprintf(stderr, "%s@%d: ", level == 0 ? "Warning" : "Error", line_no); - fprintf(stderr, msg); + fprintf(stderr, "%s", msg); fprintf(stderr, "\n"); } } From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:42:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BE2A106567E; Sat, 17 Dec 2011 15:42:38 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B17E8FC15; Sat, 17 Dec 2011 15:42:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHFgbpv065650; Sat, 17 Dec 2011 15:42:37 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHFgbn6065648; Sat, 17 Dec 2011 15:42:37 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201112171542.pBHFgbn6065648@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 17 Dec 2011 15:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228640 - head/sys/mips/cavium/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:42:38 -0000 Author: bz Date: Sat Dec 17 15:42:37 2011 New Revision: 228640 URL: http://svn.freebsd.org/changeset/base/228640 Log: Unbreak the OCTEON1 kernel build after r228483 removing the left over declaration. MFC after: 11 days Modified: head/sys/mips/cavium/usb/octusb_octeon.c Modified: head/sys/mips/cavium/usb/octusb_octeon.c ============================================================================== --- head/sys/mips/cavium/usb/octusb_octeon.c Sat Dec 17 15:41:58 2011 (r228639) +++ head/sys/mips/cavium/usb/octusb_octeon.c Sat Dec 17 15:42:37 2011 (r228640) @@ -69,7 +69,6 @@ static device_identify_t octusb_octeon_i static device_probe_t octusb_octeon_probe; static device_attach_t octusb_octeon_attach; static device_detach_t octusb_octeon_detach; -static device_shutdown_t octusb_octeon_shutdown; struct octusb_octeon_softc { struct octusb_softc sc_dci; /* must be first */ From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:44:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC1A6106564A; Sat, 17 Dec 2011 15:44:34 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0D778FC08; Sat, 17 Dec 2011 15:44:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHFiYn8065756; Sat, 17 Dec 2011 15:44:34 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHFiYWu065753; Sat, 17 Dec 2011 15:44:34 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201112171544.pBHFiYWu065753@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 17 Dec 2011 15:44:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228641 - head/sbin/ifconfig X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:44:35 -0000 Author: bz Date: Sat Dec 17 15:44:34 2011 New Revision: 228641 URL: http://svn.freebsd.org/changeset/base/228641 Log: Allow toggling of IFCAP_VLAN_HWCSUM for hardware that supports checksum offloading on vlans and document the new option. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/ifvlan.c Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Sat Dec 17 15:42:37 2011 (r228640) +++ head/sbin/ifconfig/ifconfig.8 Sat Dec 17 15:44:34 2011 (r228641) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd December 16, 2011 +.Dd December 17, 2011 .Dt IFCONFIG 8 .Os .Sh NAME @@ -423,10 +423,10 @@ they support in their capabilities. is a synonym for enabling all available WOL mechanisms. To disable WOL use .Fl wol . -.It Cm vlanmtu , vlanhwtag, vlanhwfilter, vlanhwtso +.It Cm vlanmtu , vlanhwtag, vlanhwfilter, vlanhwcsum, vlanhwtso If the driver offers user-configurable VLAN support, enable reception of extended frames, tag processing in hardware, -frame filtering in hardware, or TSO on VLAN, +frame filtering in hardware, checksum offloading, or TSO on VLAN, respectively. Note that this must be issued on a physical interface associated with .Xr vlan 4 , Modified: head/sbin/ifconfig/ifvlan.c ============================================================================== --- head/sbin/ifconfig/ifvlan.c Sat Dec 17 15:42:37 2011 (r228640) +++ head/sbin/ifconfig/ifvlan.c Sat Dec 17 15:44:34 2011 (r228641) @@ -183,6 +183,8 @@ static struct cmd vlan_cmds[] = { DEF_CMD("-vlanhwfilter", -IFCAP_VLAN_HWFILTER, setifcap), DEF_CMD("-vlanhwtso", -IFCAP_VLAN_HWTSO, setifcap), DEF_CMD("vlanhwtso", IFCAP_VLAN_HWTSO, setifcap), + DEF_CMD("vlanhwcsum", IFCAP_VLAN_HWCSUM, setifcap), + DEF_CMD("-vlanhwcsum", -IFCAP_VLAN_HWCSUM, setifcap), }; static struct afswtch af_vlan = { .af_name = "af_vlan", From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:48:55 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A090E1065672; Sat, 17 Dec 2011 15:48:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F61C8FC08; Sat, 17 Dec 2011 15:48:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHFmtqq065949; Sat, 17 Dec 2011 15:48:55 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHFmtUl065946; Sat, 17 Dec 2011 15:48:55 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112171548.pBHFmtUl065946@svn.freebsd.org> From: Andriy Gapon Date: Sat, 17 Dec 2011 15:48:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228642 - in head/sys: conf libkern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:48:55 -0000 Author: avg Date: Sat Dec 17 15:48:55 2011 New Revision: 228642 URL: http://svn.freebsd.org/changeset/base/228642 Log: retire libkern gets Inspired by: bde MFC after: 2 months X-MFC-Note: if deemed a part of KPI, just call cngets internally Deleted: head/sys/libkern/gets.c Modified: head/sys/conf/files head/sys/sys/libkern.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Dec 17 15:44:34 2011 (r228641) +++ head/sys/conf/files Sat Dec 17 15:48:55 2011 (r228642) @@ -2530,7 +2530,6 @@ libkern/bcd.c standard libkern/bsearch.c standard libkern/crc32.c standard libkern/fnmatch.c standard -libkern/gets.c standard libkern/iconv.c optional libiconv libkern/iconv_converter_if.m optional libiconv libkern/iconv_ucs.c optional libiconv Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Sat Dec 17 15:44:34 2011 (r228641) +++ head/sys/sys/libkern.h Sat Dec 17 15:48:55 2011 (r228642) @@ -90,7 +90,6 @@ int fls(int); int flsl(long); #endif int fnmatch(const char *, const char *, int); -void gets(char *, size_t, int); int locc(int, char *, u_int); void *memchr(const void *s, int c, size_t n); int memcmp(const void *b1, const void *b2, size_t len); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:50:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBFB0106564A; Sat, 17 Dec 2011 15:50:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB6138FC12; Sat, 17 Dec 2011 15:50:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHFojK2066058; Sat, 17 Dec 2011 15:50:45 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHFojZ6066056; Sat, 17 Dec 2011 15:50:45 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112171550.pBHFojZ6066056@svn.freebsd.org> From: Andriy Gapon Date: Sat, 17 Dec 2011 15:50:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228643 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:50:46 -0000 Author: avg Date: Sat Dec 17 15:50:45 2011 New Revision: 228643 URL: http://svn.freebsd.org/changeset/base/228643 Log: belatedly transfer copyrights from libkern/gets.c to kern_cons.c MFC after: 2 months MFC with: r228642 Modified: head/sys/kern/kern_cons.c Modified: head/sys/kern/kern_cons.c ============================================================================== --- head/sys/kern/kern_cons.c Sat Dec 17 15:48:55 2011 (r228642) +++ head/sys/kern/kern_cons.c Sat Dec 17 15:50:45 2011 (r228643) @@ -1,6 +1,9 @@ /*- * Copyright (c) 1988 University of Utah. * Copyright (c) 1991 The Regents of the University of California. + * Copyright (c) 1999 Michael Smith + * Copyright (c) 2005 Pawel Jakub Dawidek + * * All rights reserved. * * This code is derived from software contributed to Berkeley by From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 15:57:40 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E429106564A; Sat, 17 Dec 2011 15:57:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D1D08FC08; Sat, 17 Dec 2011 15:57:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHFvdS4066313; Sat, 17 Dec 2011 15:57:39 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHFvdel066310; Sat, 17 Dec 2011 15:57:39 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112171557.pBHFvdel066310@svn.freebsd.org> From: Andriy Gapon Date: Sat, 17 Dec 2011 15:57:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228644 - head/sys/dev/syscons X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 15:57:41 -0000 Author: avg Date: Sat Dec 17 15:57:39 2011 New Revision: 228644 URL: http://svn.freebsd.org/changeset/base/228644 Log: syscons: provide a first iteration of cngrab/cnungrab implementation - put underlying keyboard(s) into the polling mode for the whole duration of the grab, instead of the previous behavior of going into and out of the polling mode around each polling attempt - ditto for setting K_XLATE mode and enabling a disabled keyboard Inspired by: bde MFC after: 2 months Modified: head/sys/dev/syscons/syscons.c head/sys/dev/syscons/syscons.h Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Sat Dec 17 15:50:45 2011 (r228643) +++ head/sys/dev/syscons/syscons.c Sat Dec 17 15:57:39 2011 (r228644) @@ -1613,11 +1613,46 @@ sc_cnterm(struct consdev *cp) static void sc_cngrab(struct consdev *cp) { + scr_stat *scp; + + scp = sc_console->sc->cur_scp; + if (scp->sc->kbd == NULL) + return; + + if (scp->grabbed++ > 0) + return; + + /* + * Make sure the keyboard is accessible even when the kbd device + * driver is disabled. + */ + kbdd_enable(scp->sc->kbd); + + /* we shall always use the keyboard in the XLATE mode here */ + scp->kbd_prev_mode = scp->kbd_mode; + scp->kbd_mode = K_XLATE; + (void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); + + kbdd_poll(scp->sc->kbd, TRUE); } static void sc_cnungrab(struct consdev *cp) { + scr_stat *scp; + + scp = sc_console->sc->cur_scp; /* XXX */ + if (scp->sc->kbd == NULL) + return; + + if (--scp->grabbed > 0) + return; + + kbdd_poll(scp->sc->kbd, FALSE); + + scp->kbd_mode = scp->kbd_prev_mode; + (void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); + kbdd_disable(scp->sc->kbd); } static void @@ -1675,7 +1710,6 @@ sc_cngetc(struct consdev *cd) static int fkeycp; scr_stat *scp; const u_char *p; - int cur_mode; int s = spltty(); /* block sckbdevent and scrn_timer while we poll */ int c; @@ -1699,25 +1733,7 @@ sc_cngetc(struct consdev *cd) return -1; } - /* - * Make sure the keyboard is accessible even when the kbd device - * driver is disabled. - */ - kbdd_enable(scp->sc->kbd); - - /* we shall always use the keyboard in the XLATE mode here */ - cur_mode = scp->kbd_mode; - scp->kbd_mode = K_XLATE; - (void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); - - kbdd_poll(scp->sc->kbd, TRUE); c = scgetc(scp->sc, SCGETC_CN | SCGETC_NONBLOCK); - kbdd_poll(scp->sc->kbd, FALSE); - - scp->kbd_mode = cur_mode; - (void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); - kbdd_disable(scp->sc->kbd); - splx(s); switch (KEYFLAGS(c)) { case 0: /* normal char */ Modified: head/sys/dev/syscons/syscons.h ============================================================================== --- head/sys/dev/syscons/syscons.h Sat Dec 17 15:50:45 2011 (r228643) +++ head/sys/dev/syscons/syscons.h Sat Dec 17 15:57:39 2011 (r228644) @@ -301,7 +301,9 @@ typedef struct scr_stat { void *ts; int status; /* status (bitfield) */ + int grabbed; int kbd_mode; /* keyboard I/O mode */ + int kbd_prev_mode; /* keyboard I/O mode */ int cursor_pos; /* cursor buffer position */ int cursor_oldpos; /* cursor old buffer position */ From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 16:10:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B1CB106566C; Sat, 17 Dec 2011 16:10:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FD698FC12; Sat, 17 Dec 2011 16:10:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHGAFjQ066768; Sat, 17 Dec 2011 16:10:15 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHGAFN8066765; Sat, 17 Dec 2011 16:10:15 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171610.pBHGAFN8066765@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 16:10:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228645 - head/contrib/less X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 16:10:15 -0000 Author: dim Date: Sat Dec 17 16:10:14 2011 New Revision: 228645 URL: http://svn.freebsd.org/changeset/base/228645 Log: In contrib/less, cast away const a bunch of times, to make it build without conversion warnings. This code desparately needs a good dose of const poison, but fixing all the issues would be rather disruptive. MFC after: 1 week Modified: head/contrib/less/command.c head/contrib/less/prompt.c Modified: head/contrib/less/command.c ============================================================================== --- head/contrib/less/command.c Sat Dec 17 15:57:39 2011 (r228644) +++ head/contrib/less/command.c Sat Dec 17 16:10:14 2011 (r228645) @@ -1461,7 +1461,7 @@ commands() error("Command not available", NULL_PARG); break; } - start_mca(A_EXAMINE, "Examine: ", ml_examine, 0); + start_mca(A_EXAMINE, "Examine: ", (void*)ml_examine, 0); c = getcc(); goto again; #else @@ -1491,7 +1491,7 @@ commands() error("WARNING: This file was viewed via LESSOPEN", NULL_PARG); } - start_mca(A_SHELL, "!", ml_shell, 0); + start_mca(A_SHELL, "!", (void*)ml_shell, 0); /* * Expand the editor prototype string * and pass it to the system to execute. @@ -1655,7 +1655,7 @@ commands() error("Command not available", NULL_PARG); break; } - start_mca(A_SHELL, "!", ml_shell, 0); + start_mca(A_SHELL, "!", (void*)ml_shell, 0); c = getcc(); goto again; #else @@ -1706,7 +1706,7 @@ commands() if (badmark(c)) break; pipec = c; - start_mca(A_PIPE, "!", ml_shell, 0); + start_mca(A_PIPE, "!", (void*)ml_shell, 0); c = getcc(); goto again; #else Modified: head/contrib/less/prompt.c ============================================================================== --- head/contrib/less/prompt.c Sat Dec 17 15:57:39 2011 (r228644) +++ head/contrib/less/prompt.c Sat Dec 17 16:10:14 2011 (r228645) @@ -555,7 +555,7 @@ pr_expand(proto, maxwidth) public char * eq_message() { - return (pr_expand(eqproto, 0)); + return (pr_expand((char*)eqproto, 0)); } /* @@ -572,7 +572,7 @@ pr_string() type = (!less_is_more) ? pr_type : pr_type ? 0 : 1; prompt = pr_expand((ch_getflags() & CH_HELPFILE) ? - hproto : prproto[type], + (char*)hproto : prproto[type], sc_width-so_s_width-so_e_width-2); new_file = 0; return (prompt); @@ -584,5 +584,5 @@ pr_string() public char * wait_message() { - return (pr_expand(wproto, sc_width-so_s_width-so_e_width-2)); + return (pr_expand((char*)wproto, sc_width-so_s_width-so_e_width-2)); } From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 16:17:03 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D9871065672; Sat, 17 Dec 2011 16:17:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 763AE8FC0C; Sat, 17 Dec 2011 16:17:02 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA06369; Sat, 17 Dec 2011 18:17:01 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1RbwwW-0009jm-KS; Sat, 17 Dec 2011 18:17:00 +0200 Message-ID: <4EECC07B.7090709@FreeBSD.org> Date: Sat, 17 Dec 2011 18:16:59 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111206 Thunderbird/8.0 MIME-Version: 1.0 To: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201112171557.pBHFvdel066310@svn.freebsd.org> In-Reply-To: <201112171557.pBHFvdel066310@svn.freebsd.org> X-Enigmail-Version: undefined Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r228644 - head/sys/dev/syscons X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 16:17:03 -0000 on 17/12/2011 17:57 Andriy Gapon said the following: > Author: avg > Date: Sat Dec 17 15:57:39 2011 > New Revision: 228644 > URL: http://svn.freebsd.org/changeset/base/228644 > > Log: > syscons: provide a first iteration of cngrab/cnungrab implementation > > - put underlying keyboard(s) into the polling mode for the whole > duration of the grab, instead of the previous behavior of going into > and out of the polling mode around each polling attempt > - ditto for setting K_XLATE mode and enabling a disabled keyboard > > Inspired by: bde > MFC after: 2 months > > Modified: > head/sys/dev/syscons/syscons.c > head/sys/dev/syscons/syscons.h > > Modified: head/sys/dev/syscons/syscons.c > ============================================================================== > --- head/sys/dev/syscons/syscons.c Sat Dec 17 15:50:45 2011 (r228643) > +++ head/sys/dev/syscons/syscons.c Sat Dec 17 15:57:39 2011 (r228644) > @@ -1613,11 +1613,46 @@ sc_cnterm(struct consdev *cp) > static void > sc_cngrab(struct consdev *cp) > { > + scr_stat *scp; > + > + scp = sc_console->sc->cur_scp; > + if (scp->sc->kbd == NULL) > + return; > + > + if (scp->grabbed++ > 0) > + return; > + > + /* > + * Make sure the keyboard is accessible even when the kbd device > + * driver is disabled. > + */ > + kbdd_enable(scp->sc->kbd); > + > + /* we shall always use the keyboard in the XLATE mode here */ > + scp->kbd_prev_mode = scp->kbd_mode; > + scp->kbd_mode = K_XLATE; > + (void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); > + > + kbdd_poll(scp->sc->kbd, TRUE); > } What people think about adding something like the following best effort attempt to switch to console VTY? Index: sys/dev/syscons/syscons.c =================================================================== --- sys/dev/syscons/syscons.c (revision 228644) +++ sys/dev/syscons/syscons.c (working copy) @@ -1615,7 +1615,14 @@ { scr_stat *scp; + if (!cold && + sc_console->sc->cur_scp->index != sc_console->index && + sc_console->sc->cur_scp->smode.mode == VT_AUTO && + sc_console->smode.mode == VT_AUTO) + sc_switch_scr(sc_console->sc, sc_console->index); + scp = sc_console->sc->cur_scp; + if (scp->sc->kbd == NULL) return; The code is borrowed from scshutdown(). -- Andriy Gapon From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 16:20:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99BBA1065670; Sat, 17 Dec 2011 16:20:27 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 87ED68FC1C; Sat, 17 Dec 2011 16:20:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHGKRs3067111; Sat, 17 Dec 2011 16:20:27 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHGKRiC067108; Sat, 17 Dec 2011 16:20:27 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201112171620.pBHGKRiC067108@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 17 Dec 2011 16:20:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228646 - in head/libexec/rtld-elf: powerpc powerpc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 16:20:27 -0000 Author: nwhitehorn Date: Sat Dec 17 16:20:27 2011 New Revision: 228646 URL: http://svn.freebsd.org/changeset/base/228646 Log: Additional icache paranoia: non-PLT relocations can modify the text segment. It is then important to make sure the icache is synchronized again to prevent (rare) random seg faults and illegal instructions. MFC after: 3 days Modified: head/libexec/rtld-elf/powerpc/reloc.c head/libexec/rtld-elf/powerpc64/reloc.c Modified: head/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc/reloc.c Sat Dec 17 16:10:14 2011 (r228645) +++ head/libexec/rtld-elf/powerpc/reloc.c Sat Dec 17 16:20:27 2011 (r228646) @@ -317,6 +317,10 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry done: if (cache != NULL) free(cache); + + /* Synchronize icache for text seg in case we made any changes */ + __syncicache(obj->mapbase, obj->textsize); + return (r); } Modified: head/libexec/rtld-elf/powerpc64/reloc.c ============================================================================== --- head/libexec/rtld-elf/powerpc64/reloc.c Sat Dec 17 16:10:14 2011 (r228645) +++ head/libexec/rtld-elf/powerpc64/reloc.c Sat Dec 17 16:20:27 2011 (r228646) @@ -313,9 +313,12 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry } r = 0; done: - if (cache) { + if (cache) munmap(cache, bytes); - } + + /* Synchronize icache for text seg in case we made any changes */ + __syncicache(obj->mapbase, obj->textsize); + return (r); } From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 16:30:42 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0181106566C; Sat, 17 Dec 2011 16:30:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F0F98FC0C; Sat, 17 Dec 2011 16:30:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHGUgbP067452; Sat, 17 Dec 2011 16:30:42 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHGUghh067449; Sat, 17 Dec 2011 16:30:42 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171630.pBHGUghh067449@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 16:30:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228647 - head/usr.bin/mail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 16:30:42 -0000 Author: dim Date: Sat Dec 17 16:30:42 2011 New Revision: 228647 URL: http://svn.freebsd.org/changeset/base/228647 Log: In usr.bin/mail/cmd1.c, use the correct printf length modifier for a ptrdiff_t. In usr.bin/mail/main.c, cast a field width to int. MFC after: 1 week Modified: head/usr.bin/mail/cmd1.c head/usr.bin/mail/main.c Modified: head/usr.bin/mail/cmd1.c ============================================================================== --- head/usr.bin/mail/cmd1.c Sat Dec 17 16:20:27 2011 (r228646) +++ head/usr.bin/mail/cmd1.c Sat Dec 17 16:30:42 2011 (r228647) @@ -210,7 +210,7 @@ printhead(int mesg) int pdot(void) { - printf("%d\n", dot - &message[0] + 1); + printf("%td\n", dot - &message[0] + 1); return (0); } Modified: head/usr.bin/mail/main.c ============================================================================== --- head/usr.bin/mail/main.c Sat Dec 17 16:20:27 2011 (r228646) +++ head/usr.bin/mail/main.c Sat Dec 17 16:30:42 2011 (r228647) @@ -206,7 +206,7 @@ Usage: %s [-dEiInv] [-s subject] [-c cc- %*s [-sendmail-option ...]\n\ %s [-dEHiInNv] [-F] -f [name]\n\ %s [-dEHiInNv] [-F] [-u user]\n\ - %s [-d] -e [-f name]\n", __progname, strlen(__progname), "", + %s [-d] -e [-f name]\n", __progname, (int)strlen(__progname), "", __progname, __progname, __progname); exit(1); } From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 16:59:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 356C81065672; Sat, 17 Dec 2011 16:59:23 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 235F98FC1A; Sat, 17 Dec 2011 16:59:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHGxMkM068393; Sat, 17 Dec 2011 16:59:22 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHGxMVB068390; Sat, 17 Dec 2011 16:59:22 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112171659.pBHGxMVB068390@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 17 Dec 2011 16:59:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228648 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 16:59:23 -0000 Author: trociny Date: Sat Dec 17 16:59:22 2011 New Revision: 228648 URL: http://svn.freebsd.org/changeset/base/228648 Log: On start most of sysctl_kern_proc functions use the same pattern: locate a process calling pfind() and do some additional checks like p_candebug(). To reduce this code duplication a new function pget() is introduced and used. As the function may be useful not only in kern_proc.c it is in the kernel name space. Suggested by: kib Reviewed by: kib MFC after: 2 weeks Modified: head/sys/kern/kern_proc.c head/sys/sys/proc.h Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sat Dec 17 16:30:42 2011 (r228647) +++ head/sys/kern/kern_proc.c Sat Dec 17 16:59:22 2011 (r228648) @@ -330,6 +330,55 @@ pgfind(pgid) } /* + * Locate process and do additional manipulations, depending on flags. + */ +int +pget(pid_t pid, int flags, struct proc **pp) +{ + struct proc *p; + int error; + + p = pfind(pid); + if (p == NULL) + return (ESRCH); + if ((flags & PGET_CANSEE) != 0) { + error = p_cansee(curthread, p); + if (error != 0) + goto errout; + } + if ((flags & PGET_CANDEBUG) != 0) { + error = p_candebug(curthread, p); + if (error != 0) + goto errout; + } + if ((flags & PGET_ISCURRENT) != 0 && curproc != p) { + error = EPERM; + goto errout; + } + if ((flags & PGET_NOTWEXIT) != 0 && (p->p_flag & P_WEXIT) != 0) { + error = ESRCH; + goto errout; + } + if ((flags & PGET_NOTINEXEC) != 0 && (p->p_flag & P_INEXEC) != 0) { + /* + * XXXRW: Not clear ESRCH is the right error during proc + * execve(). + */ + error = ESRCH; + goto errout; + } + if ((flags & PGET_HOLD) != 0) { + _PHOLD(p); + PROC_UNLOCK(p); + } + *pp = p; + return (0); +errout: + PROC_UNLOCK(p); + return (error); +} + +/* * Create a new process group. * pgid must be equal to the pid of p. * Begin a new session if required. @@ -1177,13 +1226,9 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) error = sysctl_wire_old_buffer(req, 0); if (error) return (error); - p = pfind((pid_t)name[0]); - if (!p) - return (ESRCH); - if ((error = p_cansee(curthread, p))) { - PROC_UNLOCK(p); + error = pget((pid_t)name[0], PGET_CANSEE, &p); + if (error != 0) return (error); - } error = sysctl_out_proc(p, req, flags); return (error); } @@ -1661,24 +1706,17 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARG struct pargs *newpa, *pa; struct proc *p; struct sbuf sb; - int error = 0, error2; + int flags, error = 0, error2; if (namelen != 1) return (EINVAL); - p = pfind((pid_t)name[0]); - if (!p) - return (ESRCH); - - if ((error = p_cansee(curthread, p)) != 0) { - PROC_UNLOCK(p); + flags = PGET_CANSEE; + if (req->newptr != NULL) + flags |= PGET_ISCURRENT; + error = pget((pid_t)name[0], flags, &p); + if (error) return (error); - } - - if (req->newptr && curproc != p) { - PROC_UNLOCK(p); - return (EPERM); - } pa = p->p_args; if (pa != NULL) { @@ -1733,23 +1771,14 @@ sysctl_kern_proc_env(SYSCTL_HANDLER_ARGS if (namelen != 1) return (EINVAL); - p = pfind((pid_t)name[0]); - if (p == NULL) - return (ESRCH); - if ((p->p_flag & P_WEXIT) != 0) { - PROC_UNLOCK(p); - return (ESRCH); - } - if ((error = p_candebug(curthread, p)) != 0) { - PROC_UNLOCK(p); + error = pget((pid_t)name[0], PGET_WANTREAD, &p); + if (error != 0) return (error); - } if ((p->p_flag & P_SYSTEM) != 0) { - PROC_UNLOCK(p); + PRELE(p); return (0); } - _PHOLD(p); - PROC_UNLOCK(p); + sbuf_new_for_sysctl(&sb, NULL, GET_PS_STRINGS_CHUNK_SZ, req); error = proc_getenvv(curthread, p, &sb, req->oldlen); error2 = sbuf_finish(&sb); @@ -1775,24 +1804,13 @@ sysctl_kern_proc_auxv(SYSCTL_HANDLER_ARG if (namelen != 1) return (EINVAL); - p = pfind((pid_t)name[0]); - if (p == NULL) - return (ESRCH); - if (p->p_flag & P_WEXIT) { - PROC_UNLOCK(p); - return (ESRCH); - } - error = p_candebug(curthread, p); - if (error != 0) { - PROC_UNLOCK(p); + error = pget((pid_t)name[0], PGET_WANTREAD, &p); + if (error != 0) return (error); - } if ((p->p_flag & P_SYSTEM) != 0) { - PROC_UNLOCK(p); + PRELE(p); return (0); } - _PHOLD(p); - PROC_UNLOCK(p); error = get_proc_vector(curthread, p, &auxv, &vsize, PROC_AUX); if (error == 0) { #ifdef COMPAT_FREEBSD32 @@ -1829,13 +1847,9 @@ sysctl_kern_proc_pathname(SYSCTL_HANDLER if (*pidp == -1) { /* -1 means this process */ p = req->td->td_proc; } else { - p = pfind(*pidp); - if (p == NULL) - return (ESRCH); - if ((error = p_cansee(curthread, p)) != 0) { - PROC_UNLOCK(p); + error = pget(*pidp, PGET_CANSEE, &p); + if (error != 0) return (error); - } } vp = p->p_textvp; @@ -1872,12 +1886,9 @@ sysctl_kern_proc_sv_name(SYSCTL_HANDLER_ return (EINVAL); name = (int *)arg1; - if ((p = pfind((pid_t)name[0])) == NULL) - return (ESRCH); - if ((error = p_cansee(curthread, p))) { - PROC_UNLOCK(p); + error = pget((pid_t)name[0], PGET_CANSEE, &p); + if (error != 0) return (error); - } sv_name = p->p_sysent->sv_name; PROC_UNLOCK(p); return (sysctl_handle_string(oidp, sv_name, 0, req)); @@ -1904,18 +1915,9 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A struct vmspace *vm; name = (int *)arg1; - if ((p = pfind((pid_t)name[0])) == NULL) - return (ESRCH); - if (p->p_flag & P_WEXIT) { - PROC_UNLOCK(p); - return (ESRCH); - } - if ((error = p_candebug(curthread, p))) { - PROC_UNLOCK(p); + error = pget((pid_t)name[0], PGET_WANTREAD, &p); + if (error != 0) return (error); - } - _PHOLD(p); - PROC_UNLOCK(p); vm = vmspace_acquire_ref(p); if (vm == NULL) { PRELE(p); @@ -2082,18 +2084,9 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR vm_map_t map; name = (int *)arg1; - if ((p = pfind((pid_t)name[0])) == NULL) - return (ESRCH); - if (p->p_flag & P_WEXIT) { - PROC_UNLOCK(p); - return (ESRCH); - } - if ((error = p_candebug(curthread, p))) { - PROC_UNLOCK(p); + error = pget((pid_t)name[0], PGET_WANTREAD, &p); + if (error != 0) return (error); - } - _PHOLD(p); - PROC_UNLOCK(p); vm = vmspace_acquire_ref(p); if (vm == NULL) { PRELE(p); @@ -2267,19 +2260,9 @@ sysctl_kern_proc_kstack(SYSCTL_HANDLER_A struct proc *p; name = (int *)arg1; - if ((p = pfind((pid_t)name[0])) == NULL) - return (ESRCH); - /* XXXRW: Not clear ESRCH is the right error during proc execve(). */ - if (p->p_flag & P_WEXIT || p->p_flag & P_INEXEC) { - PROC_UNLOCK(p); - return (ESRCH); - } - if ((error = p_candebug(curthread, p))) { - PROC_UNLOCK(p); + error = pget((pid_t)name[0], PGET_NOTINEXEC | PGET_WANTREAD, &p); + if (error != 0) return (error); - } - _PHOLD(p); - PROC_UNLOCK(p); kkstp = malloc(sizeof(*kkstp), M_TEMP, M_WAITOK); st = stack_create(); @@ -2374,13 +2357,9 @@ sysctl_kern_proc_groups(SYSCTL_HANDLER_A if (*pidp == -1) { /* -1 means this process */ p = req->td->td_proc; } else { - p = pfind(*pidp); - if (p == NULL) - return (ESRCH); - if ((error = p_cansee(curthread, p)) != 0) { - PROC_UNLOCK(p); + error = pget(*pidp, PGET_CANSEE, &p); + if (error != 0) return (error); - } } cred = crhold(p->p_ucred); @@ -2409,15 +2388,9 @@ sysctl_kern_proc_rlimit(SYSCTL_HANDLER_A if (namelen != 1) return (EINVAL); - p = pfind((pid_t)name[0]); - if (p == NULL) - return (ESRCH); - - if ((error = p_cansee(curthread, p)) != 0) { - PROC_UNLOCK(p); + error = pget((pid_t)name[0], PGET_CANSEE, &p); + if (error != 0) return (error); - } - /* * Check the request size. We alow sizes smaller rlimit array for * backward binary compatibility: the number of resource limits may @@ -2454,14 +2427,9 @@ sysctl_kern_proc_ps_strings(SYSCTL_HANDL if (namelen != 1) return (EINVAL); - p = pfind((pid_t)name[0]); - if (p == NULL) - return (ESRCH); - error = p_candebug(curthread, p); - if (error != 0) { - PROC_UNLOCK(p); + error = pget((pid_t)name[0], PGET_CANDEBUG, &p); + if (error != 0) return (error); - } #ifdef COMPAT_FREEBSD32 if ((req->flags & SCTL_MASK32) != 0) { /* Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Sat Dec 17 16:30:42 2011 (r228647) +++ head/sys/sys/proc.h Sat Dec 17 16:59:22 2011 (r228648) @@ -818,6 +818,20 @@ struct proc *pfind(pid_t); /* Find proc struct pgrp *pgfind(pid_t); /* Find process group by id. */ struct proc *zpfind(pid_t); /* Find zombie process by id. */ +/* + * pget() flags. + */ +#define PGET_HOLD 0x00001 /* Hold the process. */ +#define PGET_CANSEE 0x00002 /* Check against p_cansee(). */ +#define PGET_CANDEBUG 0x00004 /* Check against p_candebug(). */ +#define PGET_ISCURRENT 0x00008 /* Check that the found process is current. */ +#define PGET_NOTWEXIT 0x00010 /* Check that the process is not in P_WEXIT. */ +#define PGET_NOTINEXEC 0x00020 /* Check that the process is not in P_INEXEC. */ + +#define PGET_WANTREAD (PGET_HOLD | PGET_CANDEBUG | PGET_NOTWEXIT) + +int pget(pid_t pid, int flags, struct proc **pp); + void ast(struct trapframe *framep); struct thread *choosethread(void); int cr_cansignal(struct ucred *cred, struct proc *proc, int signum); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 17:04:30 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDDC21065673; Sat, 17 Dec 2011 17:04:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ACF488FC14; Sat, 17 Dec 2011 17:04:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHH4UEm068606; Sat, 17 Dec 2011 17:04:30 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHH4UHU068604; Sat, 17 Dec 2011 17:04:30 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171704.pBHH4UHU068604@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 17:04:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228649 - head/usr.bin/ncplist X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 17:04:30 -0000 Author: dim Date: Sat Dec 17 17:04:30 2011 New Revision: 228649 URL: http://svn.freebsd.org/changeset/base/228649 Log: Use NO_WCAST_ALIGN for usr.bin/ncplist, as there are many potential alignment issues in it. (Though I doubt anyone still cares about NetWare support...) MFC after: 1 week Modified: head/usr.bin/ncplist/Makefile Modified: head/usr.bin/ncplist/Makefile ============================================================================== --- head/usr.bin/ncplist/Makefile Sat Dec 17 16:59:22 2011 (r228648) +++ head/usr.bin/ncplist/Makefile Sat Dec 17 17:04:30 2011 (r228649) @@ -1,6 +1,7 @@ # $FreeBSD$ PROG= ncplist +NO_WCAST_ALIGN= DPADD= ${LIBNCP} ${LIBIPX} LDADD= -lncp -lipx From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 17:21:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D52F1106566C; Sat, 17 Dec 2011 17:21:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C43998FC0C; Sat, 17 Dec 2011 17:21:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHHLlZR069168; Sat, 17 Dec 2011 17:21:47 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHHLloU069166; Sat, 17 Dec 2011 17:21:47 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171721.pBHHLloU069166@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 17:21:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228650 - head/usr.bin/netstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 17:21:47 -0000 Author: dim Date: Sat Dec 17 17:21:47 2011 New Revision: 228650 URL: http://svn.freebsd.org/changeset/base/228650 Log: In usr.bin/netstat/atalk.c, work around a clang false positive with printf format warnings and conditional operators. MFC after: 1 week Modified: head/usr.bin/netstat/atalk.c Modified: head/usr.bin/netstat/atalk.c ============================================================================== --- head/usr.bin/netstat/atalk.c Sat Dec 17 17:04:30 2011 (r228649) +++ head/usr.bin/netstat/atalk.c Sat Dec 17 17:21:47 2011 (r228650) @@ -81,7 +81,7 @@ static char mybuf[50]; return("*"); } } - sprintf(mybuf,"%hu",ntohs(sat->sat_addr.s_net)); + sprintf(mybuf,"%hu",(short)ntohs(sat->sat_addr.s_net)); return mybuf; } From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 18:18:36 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDCEC1065672; Sat, 17 Dec 2011 18:18:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC85A8FC0A; Sat, 17 Dec 2011 18:18:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHIIa33071209; Sat, 17 Dec 2011 18:18:36 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHIIalf071207; Sat, 17 Dec 2011 18:18:36 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171818.pBHIIalf071207@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 18:18:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228651 - head/contrib/telnet/telnet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 18:18:37 -0000 Author: dim Date: Sat Dec 17 18:18:36 2011 New Revision: 228651 URL: http://svn.freebsd.org/changeset/base/228651 Log: In contrib/telnet/telnet/utilities.c, fix a few warnings about format strings not being literals. MFC after: 1 week Modified: head/contrib/telnet/telnet/utilities.c Modified: head/contrib/telnet/telnet/utilities.c ============================================================================== --- head/contrib/telnet/telnet/utilities.c Sat Dec 17 17:21:47 2011 (r228650) +++ head/contrib/telnet/telnet/utilities.c Sat Dec 17 18:18:36 2011 (r228651) @@ -782,7 +782,7 @@ printsub(char direction, unsigned char * fprintf(NetTrace, "\" VAR " + noquote); } else #endif /* OLD_ENVIRON */ - fprintf(NetTrace, "\" VALUE " + noquote); + fprintf(NetTrace, "%s", "\" VALUE " + noquote); noquote = 2; break; @@ -798,17 +798,17 @@ printsub(char direction, unsigned char * fprintf(NetTrace, "\" VALUE " + noquote); } else #endif /* OLD_ENVIRON */ - fprintf(NetTrace, "\" VAR " + noquote); + fprintf(NetTrace, "%s", "\" VAR " + noquote); noquote = 2; break; case ENV_ESC: - fprintf(NetTrace, "\" ESC " + noquote); + fprintf(NetTrace, "%s", "\" ESC " + noquote); noquote = 2; break; case ENV_USERVAR: - fprintf(NetTrace, "\" USERVAR " + noquote); + fprintf(NetTrace, "%s", "\" USERVAR " + noquote); noquote = 2; break; From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 18:39:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AA44106566C; Sat, 17 Dec 2011 18:39:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 498218FC08; Sat, 17 Dec 2011 18:39:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHId5a1071822; Sat, 17 Dec 2011 18:39:05 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHId5gZ071820; Sat, 17 Dec 2011 18:39:05 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171839.pBHId5gZ071820@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 18:39:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228652 - head/usr.bin/vacation X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 18:39:05 -0000 Author: dim Date: Sat Dec 17 18:39:04 2011 New Revision: 228652 URL: http://svn.freebsd.org/changeset/base/228652 Log: Unfortunately, clang gives warnings about sendmail code that cannot be turned off yet. Since this is contrib code, and we don't really care about the warnings, just turn make them non-fatal for now. MFC after: 1 week Modified: head/usr.bin/vacation/Makefile Modified: head/usr.bin/vacation/Makefile ============================================================================== --- head/usr.bin/vacation/Makefile Sat Dec 17 18:18:36 2011 (r228651) +++ head/usr.bin/vacation/Makefile Sat Dec 17 18:39:04 2011 (r228652) @@ -11,6 +11,13 @@ CFLAGS+=-D_FFR_LISTDB -D_FFR_DEBUG WARNS?= 2 +.if ${CC:T:Mclang} == "clang" +# Unfortunately, clang gives warnings about sendmail code that cannot +# be turned off yet. Since this is contrib code, and we don't really +# care about the warnings, just turn make them non-fatal for now. +NO_WERROR= +.endif + LIBSMDIR= ${.OBJDIR}/../../lib/libsm LIBSM= ${LIBSMDIR}/libsm.a From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 19:21:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8E5C106566C; Sat, 17 Dec 2011 19:21:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5DCA8FC17; Sat, 17 Dec 2011 19:21:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHJLfBV073172; Sat, 17 Dec 2011 19:21:41 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHJLfYc073154; Sat, 17 Dec 2011 19:21:41 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201112171921.pBHJLfYc073154@svn.freebsd.org> From: Michael Tuexen Date: Sat, 17 Dec 2011 19:21:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228653 - in head/sys: netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 19:21:42 -0000 Author: tuexen Date: Sat Dec 17 19:21:40 2011 New Revision: 228653 URL: http://svn.freebsd.org/changeset/base/228653 Log: Fix unused parameter warnings. While there, fix some whitespace issues. MFC after: 3 months. Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_asconf.h head/sys/netinet/sctp_auth.c head/sys/netinet/sctp_auth.h head/sys/netinet/sctp_bsd_addr.c head/sys/netinet/sctp_bsd_addr.h head/sys/netinet/sctp_cc_functions.c head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_crc32.h head/sys/netinet/sctp_dtrace_declare.h head/sys/netinet/sctp_dtrace_define.h head/sys/netinet/sctp_header.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_indata.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_input.h head/sys/netinet/sctp_os.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_peeloff.c head/sys/netinet/sctp_peeloff.h head/sys/netinet/sctp_ss_functions.c head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_timer.h head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctp_var.h head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h head/sys/netinet6/sctp6_usrreq.c head/sys/netinet6/sctp6_var.h Modified: head/sys/netinet/sctp.h ============================================================================== --- head/sys/netinet/sctp.h Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp.h Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived Modified: head/sys/netinet/sctp_asconf.c ============================================================================== --- head/sys/netinet/sctp_asconf.c Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_asconf.c Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived @@ -1261,8 +1261,7 @@ sctp_path_check_and_react(struct sctp_tc * flag: 1=success, 0=failure. */ static void -sctp_asconf_addr_mgmt_ack(struct sctp_tcb *stcb, struct sctp_ifa *addr, - uint16_t type, uint32_t flag) +sctp_asconf_addr_mgmt_ack(struct sctp_tcb *stcb, struct sctp_ifa *addr, uint32_t flag) { /* * do the necessary asoc list work- if we get a failure indication, @@ -1712,7 +1711,7 @@ sctp_asconf_process_param_ack(struct sct case SCTP_ADD_IP_ADDRESS: SCTPDBG(SCTP_DEBUG_ASCONF1, "process_param_ack: added IP address\n"); - sctp_asconf_addr_mgmt_ack(stcb, aparam->ifa, param_type, flag); + sctp_asconf_addr_mgmt_ack(stcb, aparam->ifa, flag); break; case SCTP_DEL_IP_ADDRESS: SCTPDBG(SCTP_DEBUG_ASCONF1, @@ -2102,7 +2101,7 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb * int -sctp_asconf_iterator_ep(struct sctp_inpcb *inp, void *ptr, uint32_t val) +sctp_asconf_iterator_ep(struct sctp_inpcb *inp, void *ptr, uint32_t val SCTP_UNUSED) { struct sctp_asconf_iterator *asc; struct sctp_ifa *ifa; @@ -2150,7 +2149,7 @@ sctp_asconf_iterator_ep(struct sctp_inpc } static int -sctp_asconf_iterator_ep_end(struct sctp_inpcb *inp, void *ptr, uint32_t val) +sctp_asconf_iterator_ep_end(struct sctp_inpcb *inp, void *ptr, uint32_t val SCTP_UNUSED) { struct sctp_ifa *ifa; struct sctp_asconf_iterator *asc; @@ -2182,7 +2181,7 @@ sctp_asconf_iterator_ep_end(struct sctp_ void sctp_asconf_iterator_stcb(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - void *ptr, uint32_t val) + void *ptr, uint32_t val SCTP_UNUSED) { struct sctp_asconf_iterator *asc; struct sctp_ifa *ifa; @@ -2350,7 +2349,7 @@ sctp_asconf_iterator_stcb(struct sctp_in } void -sctp_asconf_iterator_end(void *ptr, uint32_t val) +sctp_asconf_iterator_end(void *ptr, uint32_t val SCTP_UNUSED) { struct sctp_asconf_iterator *asc; struct sctp_ifa *ifa; @@ -3009,8 +3008,7 @@ next_addr: * 1 if found, 0 if not */ static uint32_t -sctp_addr_in_initack(struct sctp_tcb *stcb, struct mbuf *m, uint32_t offset, - uint32_t length, struct sockaddr *sa) +sctp_addr_in_initack(struct mbuf *m, uint32_t offset, uint32_t length, struct sockaddr *sa) { struct sctp_paramhdr tmp_param, *ph; uint16_t plen, ptype; @@ -3155,8 +3153,7 @@ sctp_check_address_list_ep(struct sctp_t continue; } /* check to see if in the init-ack */ - if (!sctp_addr_in_initack(stcb, m, offset, length, - &laddr->ifa->address.sa)) { + if (!sctp_addr_in_initack(m, offset, length, &laddr->ifa->address.sa)) { /* try to add it */ sctp_addr_mgmt_assoc(stcb->sctp_ep, stcb, laddr->ifa, SCTP_ADD_IP_ADDRESS, SCTP_ADDR_NOT_LOCKED); @@ -3179,6 +3176,15 @@ sctp_check_address_list_all(struct sctp_ struct sctp_ifa *sctp_ifa; uint32_t vrf_id; +#ifdef INET + struct sockaddr_in *sin; + +#endif +#ifdef INET6 + struct sockaddr_in6 *sin6; + +#endif + if (stcb) { vrf_id = stcb->asoc.vrf_id; } else { @@ -3202,9 +3208,35 @@ sctp_check_address_list_all(struct sctp_ if (sctp_cmpaddr(&sctp_ifa->address.sa, init_addr)) { continue; } + switch (sctp_ifa->address.sa.sa_family) { +#ifdef INET + case AF_INET: + sin = (struct sockaddr_in *)&sctp_ifa->address.sin; + if ((ipv4_scope == 0) && + (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr))) { + /* private address not in scope */ + continue; + } + break; +#endif +#ifdef INET6 + case AF_INET6: + sin6 = (struct sockaddr_in6 *)&sctp_ifa->address.sin6; + if ((local_scope == 0) && + (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))) { + continue; + } + if ((site_scope == 0) && + (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) { + continue; + } + break; +#endif + default: + break; + } /* check to see if in the init-ack */ - if (!sctp_addr_in_initack(stcb, m, offset, length, - &sctp_ifa->address.sa)) { + if (!sctp_addr_in_initack(m, offset, length, &sctp_ifa->address.sa)) { /* try to add it */ sctp_addr_mgmt_assoc(stcb->sctp_ep, stcb, sctp_ifa, SCTP_ADD_IP_ADDRESS, Modified: head/sys/netinet/sctp_asconf.h ============================================================================== --- head/sys/netinet/sctp_asconf.h Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_asconf.h Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_auth.c Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived @@ -1891,7 +1891,7 @@ sctp_notify_authentication(struct sctp_t /* append to socket */ control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, - 0, 0, 0, 0, 0, 0, m_notify); + 0, 0, stcb->asoc.context, 0, 0, 0, m_notify); if (control == NULL) { /* no memory */ sctp_m_freem(m_notify); Modified: head/sys/netinet/sctp_auth.h ============================================================================== --- head/sys/netinet/sctp_auth.h Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_auth.h Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived Modified: head/sys/netinet/sctp_bsd_addr.c ============================================================================== --- head/sys/netinet/sctp_bsd_addr.c Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_bsd_addr.c Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived @@ -83,11 +83,11 @@ sctp_wakeup_iterator(void) } static void -sctp_iterator_thread(void *v) +sctp_iterator_thread(void *v SCTP_UNUSED) { SCTP_IPI_ITERATOR_WQ_LOCK(); /* In FreeBSD this thread never terminates. */ - while (1) { + for (;;) { msleep(&sctp_it_ctl.iterator_running, &sctp_it_ctl.ipi_iterator_wq_mtx, 0, "waiting_for_work", 0); Modified: head/sys/netinet/sctp_bsd_addr.h ============================================================================== --- head/sys/netinet/sctp_bsd_addr.h Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_bsd_addr.h Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived Modified: head/sys/netinet/sctp_cc_functions.c ============================================================================== --- head/sys/netinet/sctp_cc_functions.c Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_cc_functions.c Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived @@ -508,8 +508,7 @@ out_decision: } static int -cc_bw_increase(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, - uint64_t vtag, uint8_t inst_ind) +cc_bw_increase(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, uint64_t vtag) { uint64_t oth, probepoint; @@ -643,7 +642,7 @@ cc_bw_limit(struct sctp_tcb *stcb, struc } bw_offset = net->cc_mod.rtcc.lbw >> bw_shift; if (nbw > net->cc_mod.rtcc.lbw + bw_offset) { - ret = cc_bw_increase(stcb, net, nbw, vtag, inst_ind); + ret = cc_bw_increase(stcb, net, nbw, vtag); goto out; } rtt_offset = net->cc_mod.rtcc.lbw_rtt >> SCTP_BASE_SYSCTL(sctp_rttvar_rtt); @@ -664,7 +663,7 @@ out: static void sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb, struct sctp_association *asoc, - int accum_moved, int reneged_all, int will_exit, int use_rtcc) + int accum_moved, int reneged_all SCTP_UNUSED, int will_exit, int use_rtcc) { struct sctp_nets *net; int old_cwnd; @@ -1301,7 +1300,7 @@ sctp_cwnd_update_rtcc_tsn_acknowledged(s } static void -sctp_cwnd_prepare_rtcc_net_for_sack(struct sctp_tcb *stcb, +sctp_cwnd_prepare_rtcc_net_for_sack(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net) { if (net->cc_mod.rtcc.tls_needs_set > 0) { @@ -1473,7 +1472,7 @@ sctp_cwnd_rtcc_socket_option(struct sctp } static void -sctp_cwnd_update_rtcc_packet_transmitted(struct sctp_tcb *stcb, +sctp_cwnd_update_rtcc_packet_transmitted(struct sctp_tcb *stcb SCTP_UNUSED, struct sctp_nets *net) { if (net->cc_mod.rtcc.tls_needs_set == 0) { @@ -1492,8 +1491,9 @@ sctp_cwnd_update_rtcc_after_sack(struct } static void -sctp_rtt_rtcc_calculated(struct sctp_tcb *stcb, - struct sctp_nets *net, struct timeval *now) +sctp_rtt_rtcc_calculated(struct sctp_tcb *stcb SCTP_UNUSED, + struct sctp_nets *net, + struct timeval *now SCTP_UNUSED) { net->cc_mod.rtcc.rtt_set_this_sack = 1; } @@ -1731,7 +1731,7 @@ sctp_hs_cwnd_update_after_fr(struct sctp static void sctp_hs_cwnd_update_after_sack(struct sctp_tcb *stcb, struct sctp_association *asoc, - int accum_moved, int reneged_all, int will_exit) + int accum_moved, int reneged_all SCTP_UNUSED, int will_exit) { struct sctp_nets *net; @@ -1879,7 +1879,7 @@ htcp_cwnd_undo(struct sctp_tcb *stcb, st #endif static inline void -measure_rtt(struct sctp_tcb *stcb, struct sctp_nets *net) +measure_rtt(struct sctp_nets *net) { uint32_t srtt = net->lastsa >> SCTP_RTT_SHIFT; @@ -1897,7 +1897,7 @@ measure_rtt(struct sctp_tcb *stcb, struc } static void -measure_achieved_throughput(struct sctp_tcb *stcb, struct sctp_nets *net) +measure_achieved_throughput(struct sctp_nets *net) { uint32_t now = sctp_get_tick_count(); @@ -1997,7 +1997,7 @@ htcp_alpha_update(struct htcp *ca) * were getting just too full now). */ static void -htcp_param_update(struct sctp_tcb *stcb, struct sctp_nets *net) +htcp_param_update(struct sctp_nets *net) { uint32_t minRTT = net->cc_mod.htcp_ca.minRTT; uint32_t maxRTT = net->cc_mod.htcp_ca.maxRTT; @@ -2014,9 +2014,9 @@ htcp_param_update(struct sctp_tcb *stcb, } static uint32_t -htcp_recalc_ssthresh(struct sctp_tcb *stcb, struct sctp_nets *net) +htcp_recalc_ssthresh(struct sctp_nets *net) { - htcp_param_update(stcb, net); + htcp_param_update(net); return max(((net->cwnd / net->mtu * net->cc_mod.htcp_ca.beta) >> 7) * net->mtu, 2U * net->mtu); } @@ -2051,7 +2051,7 @@ htcp_cong_avoid(struct sctp_tcb *stcb, s } } } else { - measure_rtt(stcb, net); + measure_rtt(net); /* * In dangerous area, increase slowly. In theory this is @@ -2093,7 +2093,7 @@ htcp_min_cwnd(struct sctp_tcb *stcb, str #endif static void -htcp_init(struct sctp_tcb *stcb, struct sctp_nets *net) +htcp_init(struct sctp_nets *net) { memset(&net->cc_mod.htcp_ca, 0, sizeof(struct htcp)); net->cc_mod.htcp_ca.alpha = ALPHA_BASE; @@ -2111,7 +2111,7 @@ sctp_htcp_set_initial_cc_param(struct sc */ net->cwnd = min((net->mtu * 4), max((2 * net->mtu), SCTP_INITIAL_CWND)); net->ssthresh = stcb->asoc.peers_rwnd; - htcp_init(stcb, net); + htcp_init(net); if (SCTP_BASE_SYSCTL(sctp_logging_level) & (SCTP_CWND_MONITOR_ENABLE | SCTP_CWND_LOGGING_ENABLE)) { sctp_log_cwnd(stcb, net, 0, SCTP_CWND_INITIALIZATION); @@ -2121,7 +2121,7 @@ sctp_htcp_set_initial_cc_param(struct sc static void sctp_htcp_cwnd_update_after_sack(struct sctp_tcb *stcb, struct sctp_association *asoc, - int accum_moved, int reneged_all, int will_exit) + int accum_moved, int reneged_all SCTP_UNUSED, int will_exit) { struct sctp_nets *net; @@ -2176,7 +2176,7 @@ sctp_htcp_cwnd_update_after_sack(struct if (accum_moved || ((asoc->sctp_cmt_on_off > 0) && net->new_pseudo_cumack)) { htcp_cong_avoid(stcb, net); - measure_achieved_throughput(stcb, net); + measure_achieved_throughput(net); } else { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) { sctp_log_cwnd(stcb, net, net->mtu, @@ -2212,7 +2212,7 @@ sctp_htcp_cwnd_update_after_fr(struct sc /* JRS - reset as if state were changed */ htcp_reset(&net->cc_mod.htcp_ca); - net->ssthresh = htcp_recalc_ssthresh(stcb, net); + net->ssthresh = htcp_recalc_ssthresh(net); net->cwnd = net->ssthresh; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { sctp_log_cwnd(stcb, net, (net->cwnd - old_cwnd), @@ -2266,7 +2266,7 @@ sctp_htcp_cwnd_update_after_timeout(stru /* JRS - reset as if the state were being changed to timeout */ htcp_reset(&net->cc_mod.htcp_ca); - net->ssthresh = htcp_recalc_ssthresh(stcb, net); + net->ssthresh = htcp_recalc_ssthresh(net); net->cwnd = net->mtu; net->partial_bytes_acked = 0; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_MONITOR_ENABLE) { @@ -2276,7 +2276,7 @@ sctp_htcp_cwnd_update_after_timeout(stru static void sctp_htcp_cwnd_update_after_ecn_echo(struct sctp_tcb *stcb, - struct sctp_nets *net, int in_window, int num_pkt_lost) + struct sctp_nets *net, int in_window, int num_pkt_lost SCTP_UNUSED) { int old_cwnd; @@ -2286,7 +2286,7 @@ sctp_htcp_cwnd_update_after_ecn_echo(str if (in_window == 0) { htcp_reset(&net->cc_mod.htcp_ca); SCTP_STAT_INCR(sctps_ecnereducedcwnd); - net->ssthresh = htcp_recalc_ssthresh(stcb, net); + net->ssthresh = htcp_recalc_ssthresh(net); if (net->ssthresh < net->mtu) { net->ssthresh = net->mtu; /* here back off the timer as well, to slow us down */ Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_constants.h Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived @@ -1017,20 +1017,9 @@ __FBSDID("$FreeBSD$"); #if defined(_KERNEL) - -#define SCTP_GETTIME_TIMESPEC(x) (getnanouptime(x)) -#define SCTP_GETTIME_TIMEVAL(x) (getmicrouptime(x)) -#define SCTP_GETPTIME_TIMEVAL(x) (microuptime(x)) +#define SCTP_GETTIME_TIMEVAL(x) (getmicrouptime(x)) +#define SCTP_GETPTIME_TIMEVAL(x) (microuptime(x)) #endif -/*#if defined(__FreeBSD__) || defined(__APPLE__)*/ -/*#define SCTP_GETTIME_TIMEVAL(x) { \*/ -/* (x)->tv_sec = ticks / 1000; \*/ -/* (x)->tv_usec = (ticks % 1000) * 1000; \*/ -/*}*/ - -/*#else*/ -/*#define SCTP_GETTIME_TIMEVAL(x) (microtime(x))*/ -/*#endif __FreeBSD__ */ #if defined(_KERNEL) || defined(__Userspace__) #define sctp_sowwakeup(inp, so) \ Modified: head/sys/netinet/sctp_crc32.h ============================================================================== --- head/sys/netinet/sctp_crc32.h Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_crc32.h Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived Modified: head/sys/netinet/sctp_dtrace_declare.h ============================================================================== --- head/sys/netinet/sctp_dtrace_declare.h Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_dtrace_declare.h Sat Dec 17 19:21:40 2011 (r228653) @@ -6,11 +6,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived Modified: head/sys/netinet/sctp_dtrace_define.h ============================================================================== --- head/sys/netinet/sctp_dtrace_define.h Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_dtrace_define.h Sat Dec 17 19:21:40 2011 (r228653) @@ -6,11 +6,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived Modified: head/sys/netinet/sctp_header.h ============================================================================== --- head/sys/netinet/sctp_header.h Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_header.h Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_indata.c Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived @@ -137,7 +137,7 @@ sctp_build_readq_entry(struct sctp_tcb * read_queue_e->sinfo_ssn = stream_seq; read_queue_e->sinfo_flags = (flags << 8); read_queue_e->sinfo_ppid = ppid; - read_queue_e->sinfo_context = stcb->asoc.context; + read_queue_e->sinfo_context = context; read_queue_e->sinfo_timetolive = 0; read_queue_e->sinfo_tsn = tsn; read_queue_e->sinfo_cumtsn = tsn; @@ -846,7 +846,6 @@ sctp_queue_data_for_reasm(struct sctp_tc { struct mbuf *oper; uint32_t cum_ackp1, last_tsn, prev_tsn, post_tsn; - u_char last_flags; struct sctp_tmit_chunk *at, *prev, *next; prev = next = NULL; @@ -1033,7 +1032,6 @@ sctp_queue_data_for_reasm(struct sctp_tc sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); return; } else { - last_flags = at->rec.data.rcv_flags; last_tsn = at->rec.data.TSN_seq; prev = at; if (TAILQ_NEXT(at, sctp_next) == NULL) { @@ -1455,7 +1453,7 @@ sctp_process_a_data_chunk(struct sctp_tc struct sctp_tmit_chunk *chk; uint32_t tsn, gap; struct mbuf *dmbuf; - int indx, the_len; + int the_len; int need_reasm_check = 0; uint16_t strmno, strmseq; struct mbuf *oper; @@ -1587,7 +1585,6 @@ sctp_process_a_data_chunk(struct sctp_tc } else { SCTP_STAT_INCR(sctps_datadroprwnd); } - indx = *break_flag; *break_flag = 1; return (0); } @@ -2259,7 +2256,6 @@ sctp_slide_mapping_arrays(struct sctp_tc uint32_t old_cumack, old_base, old_highest, highest_tsn; asoc = &stcb->asoc; - at = 0; old_cumack = asoc->cumulative_tsn; old_base = asoc->mapping_array_base_tsn; @@ -2408,7 +2404,7 @@ sctp_slide_mapping_arrays(struct sctp_tc } void -sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap, int *abort_flag) +sctp_sack_check(struct sctp_tcb *stcb, int was_a_gap) { struct sctp_association *asoc; uint32_t highest_tsn; @@ -2824,10 +2820,7 @@ sctp_process_data(struct mbuf **mm, int stcb->asoc.send_sack = 1; } /* Start a sack timer or QUEUE a SACK for sending */ - sctp_sack_check(stcb, was_a_gap, &abort_flag); - if (abort_flag) - return (2); - + sctp_sack_check(stcb, was_a_gap); return (0); } @@ -2837,7 +2830,7 @@ sctp_process_segment_range(struct sctp_t int *num_frs, uint32_t * biggest_newly_acked_tsn, uint32_t * this_sack_lowest_newack, - int *ecn_seg_sums, int *rto_ok) + int *rto_ok) { struct sctp_tmit_chunk *tp1; unsigned int theTSN; @@ -3059,8 +3052,7 @@ static int sctp_handle_segments(struct mbuf *m, int *offset, struct sctp_tcb *stcb, struct sctp_association *asoc, uint32_t last_tsn, uint32_t * biggest_tsn_acked, uint32_t * biggest_newly_acked_tsn, uint32_t * this_sack_lowest_newack, - int num_seg, int num_nr_seg, int *ecn_seg_sums, - int *rto_ok) + int num_seg, int num_nr_seg, int *rto_ok) { struct sctp_gap_ack_block *frag, block; struct sctp_tmit_chunk *tp1; @@ -3106,7 +3098,7 @@ sctp_handle_segments(struct mbuf *m, int } if (sctp_process_segment_range(stcb, &tp1, last_tsn, frag_strt, frag_end, non_revocable, &num_frs, biggest_newly_acked_tsn, - this_sack_lowest_newack, ecn_seg_sums, rto_ok)) { + this_sack_lowest_newack, rto_ok)) { chunk_freed = 1; } prev_frag_end = frag_end; @@ -3761,7 +3753,6 @@ sctp_fs_audit(struct sctp_association *a static void sctp_window_probe_recovery(struct sctp_tcb *stcb, struct sctp_association *asoc, - struct sctp_nets *net, struct sctp_tmit_chunk *tp1) { tp1->window_probe = 0; @@ -4029,7 +4020,7 @@ sctp_express_handle_sack(struct sctp_tcb SOCKBUF_LOCK(&stcb->sctp_socket->so_snd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_WAKE_LOGGING_ENABLE) { /* sa_ignore NO_NULL_CHK */ - sctp_wakeup_log(stcb, cumack, 1, SCTP_WAKESND_FROM_SACK); + sctp_wakeup_log(stcb, 1, SCTP_WAKESND_FROM_SACK); } #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); @@ -4050,7 +4041,7 @@ sctp_express_handle_sack(struct sctp_tcb #endif } else { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_WAKE_LOGGING_ENABLE) { - sctp_wakeup_log(stcb, cumack, 1, SCTP_NOWAKE_FROM_SACK); + sctp_wakeup_log(stcb, 1, SCTP_NOWAKE_FROM_SACK); } } @@ -4136,7 +4127,7 @@ again: TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { if (tp1->window_probe) { /* move back to data send queue */ - sctp_window_probe_recovery(stcb, asoc, net, tp1); + sctp_window_probe_recovery(stcb, asoc, tp1); break; } } @@ -4344,7 +4335,7 @@ again: void sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup, - struct sctp_tcb *stcb, struct sctp_nets *net_from, + struct sctp_tcb *stcb, uint16_t num_seg, uint16_t num_nr_seg, uint16_t num_dup, int *abort_now, uint8_t flags, uint32_t cum_ack, uint32_t rwnd, int ecne_seen) @@ -4352,7 +4343,6 @@ sctp_handle_sack(struct mbuf *m, int off struct sctp_association *asoc; struct sctp_tmit_chunk *tp1, *tp2; uint32_t last_tsn, biggest_tsn_acked, biggest_tsn_newly_acked, this_sack_lowest_newack; - uint32_t sav_cum_ack; uint16_t wake_him = 0; uint32_t send_s = 0; long j; @@ -4362,7 +4352,6 @@ sctp_handle_sack(struct mbuf *m, int off int win_probe_recovery = 0; int win_probe_recovered = 0; struct sctp_nets *net = NULL; - int ecn_seg_sums = 0; int done_once; int rto_ok = 1; uint8_t reneged_all = 0; @@ -4392,7 +4381,6 @@ sctp_handle_sack(struct mbuf *m, int off SCTP_TCB_LOCK_ASSERT(stcb); /* CMT DAC algo */ this_sack_lowest_newack = 0; - j = 0; SCTP_STAT_INCR(sctps_slowpath_sack); last_tsn = cum_ack; cmt_dac_flag = flags & SCTP_SACK_CMT_DAC; @@ -4492,8 +4480,6 @@ sctp_handle_sack(struct mbuf *m, int off /* acking something behind */ return; } - sav_cum_ack = asoc->last_acked_seq; - /* update the Rwnd of the peer */ if (TAILQ_EMPTY(&asoc->sent_queue) && TAILQ_EMPTY(&asoc->send_queue) && @@ -4690,8 +4676,7 @@ sctp_handle_sack(struct mbuf *m, int off */ if (sctp_handle_segments(m, &offset_seg, stcb, asoc, last_tsn, &biggest_tsn_acked, &biggest_tsn_newly_acked, &this_sack_lowest_newack, - num_seg, num_nr_seg, &ecn_seg_sums, - &rto_ok)) { + num_seg, num_nr_seg, &rto_ok)) { wake_him++; } if (SCTP_BASE_SYSCTL(sctp_strict_sacks)) { @@ -4788,7 +4773,7 @@ sctp_handle_sack(struct mbuf *m, int off #endif SOCKBUF_LOCK(&stcb->sctp_socket->so_snd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_WAKE_LOGGING_ENABLE) { - sctp_wakeup_log(stcb, cum_ack, wake_him, SCTP_WAKESND_FROM_SACK); + sctp_wakeup_log(stcb, wake_him, SCTP_WAKESND_FROM_SACK); } #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) so = SCTP_INP_SO(stcb->sctp_ep); @@ -4809,7 +4794,7 @@ sctp_handle_sack(struct mbuf *m, int off #endif } else { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_WAKE_LOGGING_ENABLE) { - sctp_wakeup_log(stcb, cum_ack, wake_him, SCTP_NOWAKE_FROM_SACK); + sctp_wakeup_log(stcb, wake_him, SCTP_NOWAKE_FROM_SACK); } } @@ -5112,7 +5097,7 @@ again: */ TAILQ_FOREACH(tp1, &asoc->sent_queue, sctp_next) { if (tp1->window_probe) { - sctp_window_probe_recovery(stcb, asoc, net, tp1); + sctp_window_probe_recovery(stcb, asoc, tp1); break; } } @@ -5222,8 +5207,7 @@ again: } void -sctp_update_acked(struct sctp_tcb *stcb, struct sctp_shutdown_chunk *cp, - struct sctp_nets *netp, int *abort_flag) +sctp_update_acked(struct sctp_tcb *stcb, struct sctp_shutdown_chunk *cp, int *abort_flag) { /* Copy cum-ack */ uint32_t cum_ack, a_rwnd; @@ -5389,13 +5373,12 @@ sctp_handle_forward_tsn(struct sctp_tcb */ struct sctp_association *asoc; uint32_t new_cum_tsn, gap; - unsigned int i, fwd_sz, cumack_set_flag, m_size; + unsigned int i, fwd_sz, m_size; uint32_t str_seq; struct sctp_stream_in *strm; struct sctp_tmit_chunk *chk, *nchk; struct sctp_queued_to_read *ctl, *sv; - cumack_set_flag = 0; asoc = &stcb->asoc; if ((fwd_sz = ntohs(fwd->ch.chunk_length)) < sizeof(struct sctp_forward_tsn_chunk)) { SCTPDBG(SCTP_DEBUG_INDATA1, Modified: head/sys/netinet/sctp_indata.h ============================================================================== --- head/sys/netinet/sctp_indata.h Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_indata.h Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived @@ -94,7 +94,7 @@ sctp_express_handle_sack(struct sctp_tcb void sctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup, - struct sctp_tcb *stcb, struct sctp_nets *net_from, + struct sctp_tcb *stcb, uint16_t num_seg, uint16_t num_nr_seg, uint16_t num_dup, int *abort_now, uint8_t flags, uint32_t cum_ack, uint32_t rwnd, int ecne_seen); @@ -110,8 +110,7 @@ struct sctp_tmit_chunk * void sctp_service_queues(struct sctp_tcb *, struct sctp_association *); void -sctp_update_acked(struct sctp_tcb *, struct sctp_shutdown_chunk *, - struct sctp_nets *, int *); + sctp_update_acked(struct sctp_tcb *, struct sctp_shutdown_chunk *, int *); int sctp_process_data(struct mbuf **, int, int *, int, struct sctphdr *, @@ -120,7 +119,7 @@ sctp_process_data(struct mbuf **, int, i void sctp_slide_mapping_arrays(struct sctp_tcb *stcb); -void sctp_sack_check(struct sctp_tcb *, int, int *); +void sctp_sack_check(struct sctp_tcb *, int); #endif #endif Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Dec 17 18:39:04 2011 (r228652) +++ head/sys/netinet/sctp_input.c Sat Dec 17 19:21:40 2011 (r228653) @@ -7,11 +7,11 @@ * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * * b) 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. + * the documentation and/or other materials provided with the distribution. * * c) Neither the name of Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived @@ -84,7 +84,7 @@ sctp_stop_all_cookie_timers(struct sctp_ static void sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, struct sctp_init_chunk *cp, struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct sctp_nets *net, int *abort_no_unlock, uint32_t vrf_id, uint16_t port) + int *abort_no_unlock, uint32_t vrf_id, uint16_t port) { struct sctp_init *init; struct mbuf *op_err; @@ -258,8 +258,7 @@ sctp_is_there_unsent_data(struct sctp_tc } static int -sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb, - struct sctp_nets *net) +sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb) { struct sctp_init *init; struct sctp_association *asoc; @@ -433,13 +432,13 @@ sctp_process_init_ack(struct mbuf *m, in asoc = &stcb->asoc; asoc->peer_supports_nat = (uint8_t) nat_friendly; /* process the peer's parameters in the INIT-ACK */ - retval = sctp_process_init((struct sctp_init_chunk *)cp, stcb, net); + retval = sctp_process_init((struct sctp_init_chunk *)cp, stcb); if (retval < 0) { return (retval); } initack_limit = offset + ntohs(cp->ch.chunk_length); /* load all addresses */ - if ((retval = sctp_load_addresses_from_init(stcb, m, iphlen, + if ((retval = sctp_load_addresses_from_init(stcb, m, (offset + sizeof(struct sctp_init_chunk)), initack_limit, sh, NULL))) { /* Huh, we should abort */ @@ -521,7 +520,7 @@ sctp_process_init_ack(struct mbuf *m, in mp->resv = 0; } sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, - sh, op_err, 0, net->port); + sh, op_err, vrf_id, net->port); *abort_no_unlock = 1; } return (retval); @@ -871,7 +870,7 @@ sctp_handle_shutdown(struct sctp_shutdow /* Shutdown NOT the expected size */ return; } else { - sctp_update_acked(stcb, cp, net, abort_flag); + sctp_update_acked(stcb, cp, abort_flag); if (*abort_flag) { return; } @@ -953,7 +952,7 @@ sctp_handle_shutdown(struct sctp_shutdow } static void -sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chunk *cp, +sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chunk *cp SCTP_UNUSED, struct sctp_tcb *stcb, struct sctp_nets *net) { @@ -1410,7 +1409,7 @@ static struct sctp_tcb * sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, struct sctp_state_cookie *cookie, int cookie_len, struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets **netp, - struct sockaddr *init_src, int *notification, sctp_assoc_t * sac_assoc_id, + struct sockaddr *init_src, int *notification, uint32_t vrf_id, int auth_skipped, uint32_t auth_offset, uint32_t auth_len, uint16_t port) { struct sctp_association *asoc; @@ -1526,7 +1525,7 @@ sctp_process_cookie_existing(struct mbuf * the right seq no's. */ /* First we must process the INIT !! */ - retval = sctp_process_init(init_cp, stcb, net); + retval = sctp_process_init(init_cp, stcb); if (retval < 0) { if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 3; @@ -1613,7 +1612,7 @@ sctp_process_cookie_existing(struct mbuf * somehow abort.. but we do have an existing asoc. This * really should not fail. */ - if (sctp_load_addresses_from_init(stcb, m, iphlen, + if (sctp_load_addresses_from_init(stcb, m, init_offset + sizeof(struct sctp_init_chunk), initack_offset, sh, init_src)) { if (how_indx < sizeof(asoc->cookie_how)) @@ -1749,13 +1748,13 @@ sctp_process_cookie_existing(struct mbuf } /* process the INIT info (peer's info) */ - retval = sctp_process_init(init_cp, stcb, net); + retval = sctp_process_init(init_cp, stcb); if (retval < 0) { if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 9; return (NULL); } - if (sctp_load_addresses_from_init(stcb, m, iphlen, + if (sctp_load_addresses_from_init(stcb, m, init_offset + sizeof(struct sctp_init_chunk), initack_offset, sh, init_src)) { if (how_indx < sizeof(asoc->cookie_how)) @@ -1852,7 +1851,6 @@ sctp_process_cookie_existing(struct mbuf sctp_timer_stop(SCTP_TIMER_TYPE_INIT, inp, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_15); sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_16); - *sac_assoc_id = sctp_get_associd(stcb); /* notify upper layer */ *notification = SCTP_NOTIFY_ASSOC_RESTART; atomic_add_int(&stcb->asoc.refcnt, 1); @@ -1928,7 +1926,7 @@ sctp_process_cookie_existing(struct mbuf SCTP_INP_WUNLOCK(stcb->sctp_ep); SCTP_INP_INFO_WUNLOCK(); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 19:22:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4D311065672; Sat, 17 Dec 2011 19:22:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9941B8FC15; Sat, 17 Dec 2011 19:22:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHJMOB7073244; Sat, 17 Dec 2011 19:22:24 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHJMOq8073242; Sat, 17 Dec 2011 19:22:24 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171922.pBHJMOq8073242@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 19:22:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228654 - head/usr.bin/vmstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 19:22:24 -0000 Author: dim Date: Sat Dec 17 19:22:24 2011 New Revision: 228654 URL: http://svn.freebsd.org/changeset/base/228654 Log: In usr.bin/vmstat/vmstat.c, cast several printf field widths to int, and use printf format specifiers from inttypes.h for uint64_t's. MFC after: 1 week Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Sat Dec 17 19:21:40 2011 (r228653) +++ head/usr.bin/vmstat/vmstat.c Sat Dec 17 19:22:24 2011 (r228654) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1185,18 +1186,18 @@ dointr(void) istrnamlen = clen; tintrname += clen + 1; } - (void)printf("%-*s %20s %10s\n", istrnamlen, "interrupt", "total", + (void)printf("%-*s %20s %10s\n", (int)istrnamlen, "interrupt", "total", "rate"); inttotal = 0; for (i = 0; i < nintr; i++) { if (intrname[0] != '\0' && (*intrcnt != 0 || aflag)) - (void)printf("%-*s %20lu %10lu\n", istrnamlen, intrname, - *intrcnt, *intrcnt / uptime); + (void)printf("%-*s %20lu %10lu\n", (int)istrnamlen, + intrname, *intrcnt, *intrcnt / uptime); intrname += strlen(intrname) + 1; inttotal += *intrcnt++; } - (void)printf("%-*s %20llu %10llu\n", istrnamlen, "Total", - (long long)inttotal, (long long)(inttotal / uptime)); + (void)printf("%-*s %20" PRIu64 " %10" PRIu64 "\n", (int)istrnamlen, + "Total", inttotal, inttotal / uptime); } static void @@ -1235,9 +1236,9 @@ domemstat_malloc(void) if (memstat_get_numallocs(mtp) == 0 && memstat_get_count(mtp) == 0) continue; - printf("%13s %5lld %5lldK %7s %8lld ", + printf("%13s %5" PRIu64 " %5" PRIu64 "K %7s %8" PRIu64 " ", memstat_get_name(mtp), memstat_get_count(mtp), - ((int64_t)memstat_get_bytes(mtp) + 1023) / 1024, "-", + (memstat_get_bytes(mtp) + 1023) / 1024, "-", memstat_get_numallocs(mtp)); first = 1; for (i = 0; i < 32; i++) { @@ -1289,7 +1290,8 @@ domemstat_zone(void) mtp = memstat_mtl_next(mtp)) { strlcpy(name, memstat_get_name(mtp), MEMTYPE_MAXNAME); strcat(name, ":"); - printf("%-20s %6llu, %6llu,%8llu,%8llu,%8llu,%4llu,%4llu\n",name, + printf("%-20s %6" PRIu64 ", %6" PRIu64 ",%8" PRIu64 ",%8" PRIu64 + ",%8" PRIu64 ",%4" PRIu64 ",%4" PRIu64 "\n", name, memstat_get_size(mtp), memstat_get_countlimit(mtp), memstat_get_count(mtp), memstat_get_free(mtp), memstat_get_numallocs(mtp), memstat_get_failures(mtp), From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 19:26:04 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 545681065670; Sat, 17 Dec 2011 19:26:04 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 433ED8FC17; Sat, 17 Dec 2011 19:26:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHJQ4PE073393; Sat, 17 Dec 2011 19:26:04 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHJQ4NG073391; Sat, 17 Dec 2011 19:26:04 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171926.pBHJQ4NG073391@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 19:26:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228655 - head/usr.sbin/bluetooth/sdpd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 19:26:04 -0000 Author: dim Date: Sat Dec 17 19:26:03 2011 New Revision: 228655 URL: http://svn.freebsd.org/changeset/base/228655 Log: In usr.sbin/bluetooth/sdpd/server.c, don't use the size of a pointer as the length argument to memset, but the size of the object pointed to. MFC after: 1 week Modified: head/usr.sbin/bluetooth/sdpd/server.c Modified: head/usr.sbin/bluetooth/sdpd/server.c ============================================================================== --- head/usr.sbin/bluetooth/sdpd/server.c Sat Dec 17 19:22:24 2011 (r228654) +++ head/usr.sbin/bluetooth/sdpd/server.c Sat Dec 17 19:26:03 2011 (r228655) @@ -73,7 +73,7 @@ server_init(server_p srv, char const *co assert(srv != NULL); assert(control != NULL); - memset(srv, 0, sizeof(srv)); + memset(srv, 0, sizeof(*srv)); /* Open control socket */ if (unlink(control) < 0 && errno != ENOENT) { From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 19:33:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69B351065675; Sat, 17 Dec 2011 19:33:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58BED8FC16; Sat, 17 Dec 2011 19:33:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHJXRri073653; Sat, 17 Dec 2011 19:33:27 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHJXRPL073651; Sat, 17 Dec 2011 19:33:27 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171933.pBHJXRPL073651@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 19:33:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228656 - head/usr.sbin/boot0cfg X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 19:33:27 -0000 Author: dim Date: Sat Dec 17 19:33:26 2011 New Revision: 228656 URL: http://svn.freebsd.org/changeset/base/228656 Log: Use NO_WCAST_ALIGN for usr.sbin/boot0cfg; because this is only built for x86, any alignment warnings can be safely ignored. MFC after: 1 week Modified: head/usr.sbin/boot0cfg/Makefile Modified: head/usr.sbin/boot0cfg/Makefile ============================================================================== --- head/usr.sbin/boot0cfg/Makefile Sat Dec 17 19:26:03 2011 (r228655) +++ head/usr.sbin/boot0cfg/Makefile Sat Dec 17 19:33:26 2011 (r228656) @@ -6,4 +6,6 @@ MAN= boot0cfg.8 DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} LDADD= -lgeom -lbsdxml -lsbuf +NO_WCAST_ALIGN= + .include From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 19:53:08 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D93B2106564A; Sat, 17 Dec 2011 19:53:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C805F8FC0C; Sat, 17 Dec 2011 19:53:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHJr8Bw074266; Sat, 17 Dec 2011 19:53:08 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHJr8En074264; Sat, 17 Dec 2011 19:53:08 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171953.pBHJr8En074264@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 19:53:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228657 - head/usr.sbin/bsnmpd/modules/snmp_wlan X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 19:53:08 -0000 Author: dim Date: Sat Dec 17 19:53:08 2011 New Revision: 228657 URL: http://svn.freebsd.org/changeset/base/228657 Log: In usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h, use the correct enumeration types for the mesh_peering and mesh_forwarding members of struct wlan_iface, to fix enum conversion warnings. MFC after: 1 week Modified: head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h Modified: head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h Sat Dec 17 19:33:26 2011 (r228656) +++ head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h Sat Dec 17 19:53:08 2011 (r228657) @@ -175,8 +175,8 @@ struct wlan_iface { struct wlan_maclist mac_maclist; uint32_t mesh_ttl; - enum TruthValue mesh_peering; - enum TruthValue mesh_forwarding; + enum wlanMeshPeeringEnabled mesh_peering; + enum wlanMeshForwardingEnabled mesh_forwarding; enum wlanMeshMetric mesh_metric; enum wlanMeshPath mesh_path; enum wlanHWMPRootMode hwmp_root_mode; From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 19:58:49 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0260F106566B; Sat, 17 Dec 2011 19:58:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E57B18FC0C; Sat, 17 Dec 2011 19:58:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHJwmK2074476; Sat, 17 Dec 2011 19:58:48 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHJwm1Z074474; Sat, 17 Dec 2011 19:58:48 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112171958.pBHJwm1Z074474@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 19:58:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228658 - head/usr.sbin/cpucontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 19:58:49 -0000 Author: dim Date: Sat Dec 17 19:58:48 2011 New Revision: 228658 URL: http://svn.freebsd.org/changeset/base/228658 Log: Use NO_WCAST_ALIGN for usr.sbin/cpucontrol; because this is only built for x86, any alignment warnings can be safely ignored. MFC after: 1 week Modified: head/usr.sbin/cpucontrol/Makefile Modified: head/usr.sbin/cpucontrol/Makefile ============================================================================== --- head/usr.sbin/cpucontrol/Makefile Sat Dec 17 19:53:08 2011 (r228657) +++ head/usr.sbin/cpucontrol/Makefile Sat Dec 17 19:58:48 2011 (r228658) @@ -4,4 +4,6 @@ PROG= cpucontrol MAN= cpucontrol.8 SRCS= cpucontrol.c intel.c amd.c via.c +NO_WCAST_ALIGN= + .include From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 20:07:42 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E90E91065670; Sat, 17 Dec 2011 20:07:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D7D8C8FC0C; Sat, 17 Dec 2011 20:07:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHK7gB4074788; Sat, 17 Dec 2011 20:07:42 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHK7gOH074786; Sat, 17 Dec 2011 20:07:42 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112172007.pBHK7gOH074786@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 20:07:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228659 - head/usr.sbin/ctm/ctm_dequeue X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 20:07:43 -0000 Author: dim Date: Sat Dec 17 20:07:42 2011 New Revision: 228659 URL: http://svn.freebsd.org/changeset/base/228659 Log: In usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c, cast a printf field width parameter to int. MFC after: 1 week Modified: head/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c Modified: head/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c ============================================================================== --- head/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c Sat Dec 17 19:58:48 2011 (r228658) +++ head/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c Sat Dec 17 20:07:42 2011 (r228659) @@ -143,7 +143,7 @@ main(int argc, char **argv) */ npieces = atoi(&ftsent->fts_name[ftsent->fts_namelen-3]); piece = atoi(&ftsent->fts_name[ftsent->fts_namelen-7]); - err("%.*s %d/%d sent", ftsent->fts_namelen-8, ftsent->fts_name, + err("%.*s %d/%d sent", (int)(ftsent->fts_namelen-8), ftsent->fts_name, piece, npieces); if (chunk++ == num_to_send) From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 20:12:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B9CC106564A; Sat, 17 Dec 2011 20:12:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A9CC8FC17; Sat, 17 Dec 2011 20:12:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHKCHC4074965; Sat, 17 Dec 2011 20:12:17 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHKCHIW074963; Sat, 17 Dec 2011 20:12:17 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112172012.pBHKCHIW074963@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 20:12:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228660 - head/usr.sbin/i2c X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 20:12:18 -0000 Author: dim Date: Sat Dec 17 20:12:17 2011 New Revision: 228660 URL: http://svn.freebsd.org/changeset/base/228660 Log: In usr.sbin/i2c/i2c.c, fix a few warnings about format strings not being literals. MFC after: 1 week Modified: head/usr.sbin/i2c/i2c.c Modified: head/usr.sbin/i2c/i2c.c ============================================================================== --- head/usr.sbin/i2c/i2c.c Sat Dec 17 20:07:42 2011 (r228659) +++ head/usr.sbin/i2c/i2c.c Sat Dec 17 20:12:17 2011 (r228660) @@ -360,7 +360,7 @@ err1: fprintf(stderr, "error sending stop condtion\n"); err2: if (err_msg) - fprintf(stderr, err_msg); + fprintf(stderr, "%s", err_msg); close(fd); return (1); @@ -453,7 +453,7 @@ err1: fprintf(stderr, "error sending stop condtion\n"); err2: if (err_msg) - fprintf(stderr, err_msg); + fprintf(stderr, "%s", err_msg); close(fd); return (1); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 20:25:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F867106564A; Sat, 17 Dec 2011 20:25:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E81808FC08; Sat, 17 Dec 2011 20:25:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHKPN4Q075386; Sat, 17 Dec 2011 20:25:23 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHKPNP8075384; Sat, 17 Dec 2011 20:25:23 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112172025.pBHKPNP8075384@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 20:25:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228661 - head/usr.sbin/iostat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 20:25:24 -0000 Author: dim Date: Sat Dec 17 20:25:23 2011 New Revision: 228661 URL: http://svn.freebsd.org/changeset/base/228661 Log: In usr.sbin/iostat/iostat.c, use printf format specifiers from inttypes.h for u_int64_t's. While here, sort #include directives. MFC after: 1 week Modified: head/usr.sbin/iostat/iostat.c Modified: head/usr.sbin/iostat/iostat.c ============================================================================== --- head/usr.sbin/iostat/iostat.c Sat Dec 17 20:12:17 2011 (r228660) +++ head/usr.sbin/iostat/iostat.c Sat Dec 17 20:25:23 2011 (r228661) @@ -101,19 +101,20 @@ #include #include -#include #include +#include +#include #include +#include #include +#include +#include #include #include #include #include #include #include -#include -#include -#include struct nlist namelist[] = { #define X_TK_NIN 0 @@ -818,7 +819,7 @@ devstats(int perf_select, long double et mb_per_second_write > ((long double).0005)/1024 || busy_pct > 0.5) { if (Iflag == 0) - printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4qu %5.1Lf %3.0Lf ", + printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4" PRIu64 " %5.1Lf %3.0Lf ", devname, transfers_per_second_read, transfers_per_second_write, mb_per_second_read * 1024, @@ -826,7 +827,7 @@ devstats(int perf_select, long double et queue_len, ms_per_transaction, busy_pct); else - printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4qu %5.1Lf %3.0Lf ", + printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4" PRIu64 " %5.1Lf %3.0Lf ", devname, (long double)total_transfers_read, (long double)total_transfers_write, @@ -863,7 +864,7 @@ devstats(int perf_select, long double et msdig, ms_per_transaction); else - printf("%4.1qu%4.1qu%5.*Lf ", + printf("%4.1" PRIu64 "%4.1" PRIu64 "%5.*Lf ", total_blocks, total_transfers, msdig, @@ -878,7 +879,7 @@ devstats(int perf_select, long double et total_mb = total_bytes; total_mb /= 1024 * 1024; - printf(" %5.2Lf %3.1qu %5.2Lf ", + printf(" %5.2Lf %3.1" PRIu64 " %5.2Lf ", kb_per_transfer, total_transfers, total_mb); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 20:53:06 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81D12106564A; Sat, 17 Dec 2011 20:53:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 668BA8FC19; Sat, 17 Dec 2011 20:53:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHKr6wK076294; Sat, 17 Dec 2011 20:53:06 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHKr6wr076291; Sat, 17 Dec 2011 20:53:06 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112172053.pBHKr6wr076291@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 20:53:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228662 - head/usr.sbin/keyserv X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 20:53:06 -0000 Author: dim Date: Sat Dec 17 20:53:06 2011 New Revision: 228662 URL: http://svn.freebsd.org/changeset/base/228662 Log: In usr.sbin/keyserv, fix some implicit enum conversions, and use the correct printf length modifiers for uid_t. MFC after: 1 week Modified: head/usr.sbin/keyserv/crypt_server.c head/usr.sbin/keyserv/keyserv.c Modified: head/usr.sbin/keyserv/crypt_server.c ============================================================================== --- head/usr.sbin/keyserv/crypt_server.c Sat Dec 17 20:25:23 2011 (r228661) +++ head/usr.sbin/keyserv/crypt_server.c Sat Dec 17 20:53:06 2011 (r228662) @@ -223,8 +223,8 @@ des_crypt_1_svc(desargs *argp, struct sv bcopy(argp->des_key, dparm.des_key, 8); bcopy(argp->des_ivec, dparm.des_ivec, 8); - dparm.des_mode = argp->des_mode; - dparm.des_dir = argp->des_dir; + dparm.des_mode = (argp->des_mode == CBC_DES) ? CBC : ECB; + dparm.des_dir = (argp->des_dir == ENCRYPT_DES) ? ENCRYPT : DECRYPT; #ifdef BROKEN_DES dparm.UDES.UDES_buf = argp->desbuf.desbuf_val; #endif Modified: head/usr.sbin/keyserv/keyserv.c ============================================================================== --- head/usr.sbin/keyserv/keyserv.c Sat Dec 17 20:25:23 2011 (r228661) +++ head/usr.sbin/keyserv/keyserv.c Sat Dec 17 20:53:06 2011 (r228662) @@ -361,7 +361,7 @@ key_set_1_svc_prog(uid, key) static keystatus status; if (debugging) { - (void) fprintf(stderr, "set(%ld, %.*s) = ", uid, + (void) fprintf(stderr, "set(%u, %.*s) = ", uid, (int) sizeof (keybuf), key); } status = pk_setkey(uid, key); @@ -380,7 +380,7 @@ key_encrypt_pk_2_svc_prog(uid, arg) static cryptkeyres res; if (debugging) { - (void) fprintf(stderr, "encrypt(%ld, %s, %08x%08x) = ", uid, + (void) fprintf(stderr, "encrypt(%u, %s, %08x%08x) = ", uid, arg->remotename, arg->deskey.key.high, arg->deskey.key.low); } @@ -408,7 +408,7 @@ key_decrypt_pk_2_svc_prog(uid, arg) static cryptkeyres res; if (debugging) { - (void) fprintf(stderr, "decrypt(%ld, %s, %08x%08x) = ", uid, + (void) fprintf(stderr, "decrypt(%u, %s, %08x%08x) = ", uid, arg->remotename, arg->deskey.key.high, arg->deskey.key.low); } @@ -460,7 +460,7 @@ key_net_get_2_svc_prog(uid, arg) static key_netstres keynetname; if (debugging) - (void) fprintf(stderr, "net_get(%ld) = ", uid); + (void) fprintf(stderr, "net_get(%u) = ", uid); keynetname.status = pk_netget(uid, &keynetname.key_netstres_u.knet); if (debugging) { @@ -489,8 +489,8 @@ key_get_conv_2_svc_prog(uid, arg) static cryptkeyres res; if (debugging) - (void) fprintf(stderr, "get_conv(%ld, %.*s) = ", uid, - (int)sizeof (arg), arg); + (void) fprintf(stderr, "get_conv(%u, %.*s) = ", uid, + (int)sizeof (keybuf), arg); res.status = pk_get_conv_key(uid, arg, &res); @@ -517,7 +517,7 @@ key_encrypt_1_svc_prog(uid, arg) static cryptkeyres res; if (debugging) { - (void) fprintf(stderr, "encrypt(%ld, %s, %08x%08x) = ", uid, + (void) fprintf(stderr, "encrypt(%u, %s, %08x%08x) = ", uid, arg->remotename, arg->deskey.key.high, arg->deskey.key.low); } @@ -545,7 +545,7 @@ key_decrypt_1_svc_prog(uid, arg) static cryptkeyres res; if (debugging) { - (void) fprintf(stderr, "decrypt(%ld, %s, %08x%08x) = ", uid, + (void) fprintf(stderr, "decrypt(%u, %s, %08x%08x) = ", uid, arg->remotename, arg->deskey.key.high, arg->deskey.key.low); } @@ -789,7 +789,7 @@ root_auth(trans, rqstp) } if (debugging) - fprintf(stderr, "local_uid %ld\n", uid); + fprintf(stderr, "local_uid %u\n", uid); if (uid == 0) return (1); if (rqstp->rq_cred.oa_flavor == AUTH_SYS) { @@ -800,7 +800,7 @@ root_auth(trans, rqstp) } else { if (debugging) fprintf(stderr, - "local_uid %ld mismatches auth %ld\n", uid, + "local_uid %u mismatches auth %u\n", uid, ((uid_t) ((struct authunix_parms *)rqstp->rq_clntcred)->aup_uid)); return (0); } From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 21:33:00 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBD90106566B; Sat, 17 Dec 2011 21:33:00 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id B4CD18FC0C; Sat, 17 Dec 2011 21:33:00 +0000 (UTC) Received: by dakp5 with SMTP id p5so4247903dak.13 for ; Sat, 17 Dec 2011 13:33:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=wNvPpwpvlEQ0ZrZGsu8wbX0uGdq5tj9yKTRJgnfzWpw=; b=aiyVyZdcthjNCaCy9OxZLv+ZceRpfbYay4xt3lD28vjStF9ay9D9i1Oc/VdHLgfKMf B76qXfVnkk+XEUrsrg7CRvNJL2wnWbZ5NZXyUnEuINlgpUiPMkXaSPD5i/JgI8AgdspL mhHUrzXizLCgujTHp88R0VDuhJj2D3dUoH8V8= MIME-Version: 1.0 Received: by 10.68.191.70 with SMTP id gw6mr26801227pbc.85.1324157579914; Sat, 17 Dec 2011 13:32:59 -0800 (PST) Sender: mdf356@gmail.com Received: by 10.68.197.198 with HTTP; Sat, 17 Dec 2011 13:32:59 -0800 (PST) In-Reply-To: <201112171314.pBHDEjtQ060509@svn.freebsd.org> References: <201112171314.pBHDEjtQ060509@svn.freebsd.org> Date: Sat, 17 Dec 2011 13:32:59 -0800 X-Google-Sender-Auth: FNBZnnZxpaZONmFpAPdBAhx-dRM Message-ID: From: mdf@FreeBSD.org To: Dimitry Andric Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228625 - head/usr.bin/csup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 21:33:01 -0000 On Sat, Dec 17, 2011 at 5:14 AM, Dimitry Andric wrote: > Author: dim > Date: Sat Dec 17 13:14:44 2011 > New Revision: 228625 > URL: http://svn.freebsd.org/changeset/base/228625 > > Log: > =A0In usr.bin/csup/auth.c, use the correct number of bytes for zeroing th= e > =A0shared secret, and use long long format to snprintf a time_t. If casting is necessary, style prefers intmax_t or uintmax_t, since those are always wide enough. Thanks, matthew > =A0MFC after: =A0 =A01 week > > Modified: > =A0head/usr.bin/csup/auth.c > > Modified: head/usr.bin/csup/auth.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.bin/csup/auth.c =A0 =A0Sat Dec 17 12:52:58 2011 =A0 =A0 =A0 = =A0(r228624) > +++ head/usr.bin/csup/auth.c =A0 =A0Sat Dec 17 13:14:44 2011 =A0 =A0 =A0 = =A0(r228625) > @@ -254,7 +254,7 @@ auth_makesecret(struct srvrecord *auth, > =A0 =A0 =A0 =A0MD5_Update(&md5, ":", 1); > =A0 =A0 =A0 =A0MD5_Update(&md5, auth->password, strlen(auth->password)); > =A0 =A0 =A0 =A0MD5_Final(md5sum, &md5); > - =A0 =A0 =A0 memset(secret, 0, sizeof(secret)); > + =A0 =A0 =A0 memset(secret, 0, MD5_CHARS_MAX); > =A0 =A0 =A0 =A0strcpy(secret, md5salt); > =A0 =A0 =A0 =A0auth_readablesum(md5sum, secret + strlen(md5salt)); > =A0} > @@ -302,8 +302,9 @@ auth_makechallenge(struct config *config > =A0 =A0 =A0 =A0} > =A0 =A0 =A0 =A0gettimeofday(&tv, NULL); > =A0 =A0 =A0 =A0MD5_Init(&md5); > - =A0 =A0 =A0 snprintf(buf, sizeof(buf), "%s:%ld:%ld:%ld:%d:%d", > - =A0 =A0 =A0 =A0 =A0 inet_ntoa(laddr.sin_addr), tv.tv_sec, tv.tv_usec, r= andom(), pid, ppid); > + =A0 =A0 =A0 snprintf(buf, sizeof(buf), "%s:%lld:%ld:%ld:%d:%d", > + =A0 =A0 =A0 =A0 =A0 inet_ntoa(laddr.sin_addr), (long long)tv.tv_sec, tv= .tv_usec, > + =A0 =A0 =A0 =A0 =A0 random(), pid, ppid); > =A0 =A0 =A0 =A0MD5_Update(&md5, buf, strlen(buf)); > =A0 =A0 =A0 =A0MD5_Final(md5sum, &md5); > =A0 =A0 =A0 =A0auth_readablesum(md5sum, challenge); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 21:37:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 525BD106566B; Sat, 17 Dec 2011 21:37:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4111A8FC0A; Sat, 17 Dec 2011 21:37:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHLbMrG077676; Sat, 17 Dec 2011 21:37:22 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHLbMAo077674; Sat, 17 Dec 2011 21:37:22 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112172137.pBHLbMAo077674@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 21:37:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228663 - head/usr.sbin/lpr/filters X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 21:37:22 -0000 Author: dim Date: Sat Dec 17 21:37:21 2011 New Revision: 228663 URL: http://svn.freebsd.org/changeset/base/228663 Log: In usr.sbin/lpr/filters/lpf.c, use a less obtuse way of clearing the buffer, that also avoids warnings. MFC after: 1 week Modified: head/usr.sbin/lpr/filters/lpf.c Modified: head/usr.sbin/lpr/filters/lpf.c ============================================================================== --- head/usr.sbin/lpr/filters/lpf.c Sat Dec 17 20:53:06 2011 (r228662) +++ head/usr.sbin/lpr/filters/lpf.c Sat Dec 17 21:37:21 2011 (r228663) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define MAXWIDTH 132 #define MAXREP 10 @@ -115,7 +116,7 @@ main(int argc, char *argv[]) acctfile = cp; } - for (cp = buf[0], limit = buf[MAXREP]; cp < limit; *cp++ = ' '); + memset(buf, ' ', sizeof(buf)); done = 0; while (!done) { From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 21:44:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1D87106566B; Sat, 17 Dec 2011 21:44:45 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 5861B8FC0A; Sat, 17 Dec 2011 21:44:44 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pBHLie8E080635 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 17 Dec 2011 23:44:40 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pBHLiec1061578; Sat, 17 Dec 2011 23:44:40 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pBHLieRG061577; Sat, 17 Dec 2011 23:44:40 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 17 Dec 2011 23:44:40 +0200 From: Kostik Belousov To: Dimitry Andric Message-ID: <20111217214440.GB50300@deviant.kiev.zoral.com.ua> References: <201112172137.pBHLbMAo077674@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hjFJOZjrGMhmIgO+" Content-Disposition: inline In-Reply-To: <201112172137.pBHLbMAo077674@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228663 - head/usr.sbin/lpr/filters X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 21:44:46 -0000 --hjFJOZjrGMhmIgO+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 17, 2011 at 09:37:22PM +0000, Dimitry Andric wrote: > Author: dim > Date: Sat Dec 17 21:37:21 2011 > New Revision: 228663 > URL: http://svn.freebsd.org/changeset/base/228663 >=20 > Log: > In usr.sbin/lpr/filters/lpf.c, use a less obtuse way of clearing the > buffer, that also avoids warnings. > =20 > MFC after: 1 week >=20 > Modified: > head/usr.sbin/lpr/filters/lpf.c >=20 > Modified: head/usr.sbin/lpr/filters/lpf.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/lpr/filters/lpf.c Sat Dec 17 20:53:06 2011 (r228662) > +++ head/usr.sbin/lpr/filters/lpf.c Sat Dec 17 21:37:21 2011 (r228663) > @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > =20 > #define MAXWIDTH 132 > #define MAXREP 10 > @@ -115,7 +116,7 @@ main(int argc, char *argv[]) > acctfile =3D cp; > } > =20 > - for (cp =3D buf[0], limit =3D buf[MAXREP]; cp < limit; *cp++ =3D ' '); > + memset(buf, ' ', sizeof(buf)); > done =3D 0; buf is two-dimensional array. This change looks wrong. > =20 > while (!done) { --hjFJOZjrGMhmIgO+ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7tDUgACgkQC3+MBN1Mb4hDeACfTMLTK2w88UwQVbonsFMGh9up UHkAnAmvsitP7yzHuo7O3opwmADgKf/P =xkOO -----END PGP SIGNATURE----- --hjFJOZjrGMhmIgO+-- From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 21:50:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B9EF106564A; Sat, 17 Dec 2011 21:50:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 0C50E8FC12; Sat, 17 Dec 2011 21:50:59 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:34d8:b0a6:3463:89c2] (unknown [IPv6:2001:7b8:3a7:0:34d8:b0a6:3463:89c2]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 1CB875C37; Sat, 17 Dec 2011 22:50:58 +0100 (CET) Message-ID: <4EED0EC7.90203@FreeBSD.org> Date: Sat, 17 Dec 2011 22:51:03 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111130 Thunderbird/9.0 MIME-Version: 1.0 To: Kostik Belousov References: <201112172137.pBHLbMAo077674@svn.freebsd.org> <20111217214440.GB50300@deviant.kiev.zoral.com.ua> In-Reply-To: <20111217214440.GB50300@deviant.kiev.zoral.com.ua> X-Enigmail-Version: 1.3.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228663 - head/usr.sbin/lpr/filters X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 21:50:59 -0000 On 2011-12-17 22:44, Kostik Belousov wrote: >> #define MAXWIDTH 132 >> #define MAXREP 10 >> @@ -115,7 +116,7 @@ main(int argc, char *argv[]) >> acctfile = cp; >> } >> >> - for (cp = buf[0], limit = buf[MAXREP]; cp < limit; *cp++ = ' '); >> + memset(buf, ' ', sizeof(buf)); >> done = 0; > buf is two-dimensional array. This change looks wrong. The for loop took the address of the left-top corner of the two-dimensional array, and iterated with a char pointer to the address just after the right-bottom corner of the array. It was in effect a memset, just hand-written. From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 21:54:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7CC51065677; Sat, 17 Dec 2011 21:54:01 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id 37CA38FC0C; Sat, 17 Dec 2011 21:54:01 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id EAE1A25D3811; Sat, 17 Dec 2011 21:53:59 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id D594EBD737D; Sat, 17 Dec 2011 21:53:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id GUW0NQFVNLI5; Sat, 17 Dec 2011 21:53:57 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 94858BD737C; Sat, 17 Dec 2011 21:53:57 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <201112171721.pBHHLloU069166@svn.freebsd.org> Date: Sat, 17 Dec 2011 21:53:56 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <4C98B8D8-99F6-4996-A0FB-C128D9384180@lists.zabbadoz.net> References: <201112171721.pBHHLloU069166@svn.freebsd.org> To: Dimitry Andric X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228650 - head/usr.bin/netstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 21:54:01 -0000 On 17. Dec 2011, at 17:21 , Dimitry Andric wrote: > Author: dim > Date: Sat Dec 17 17:21:47 2011 > New Revision: 228650 > URL: http://svn.freebsd.org/changeset/base/228650 >=20 > Log: > In usr.bin/netstat/atalk.c, work around a clang false positive with > printf format warnings and conditional operators. >=20 This does not sound like a good idea. Make clang work. > MFC after: 1 week >=20 > Modified: > head/usr.bin/netstat/atalk.c >=20 > Modified: head/usr.bin/netstat/atalk.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/usr.bin/netstat/atalk.c Sat Dec 17 17:04:30 2011 = (r228649) > +++ head/usr.bin/netstat/atalk.c Sat Dec 17 17:21:47 2011 = (r228650) > @@ -81,7 +81,7 @@ static char mybuf[50]; > return("*"); > } > } > - sprintf(mybuf,"%hu",ntohs(sat->sat_addr.s_net)); > + sprintf(mybuf,"%hu",(short)ntohs(sat->sat_addr.s_net)); > return mybuf; > } >=20 --=20 Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 21:54:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1EC21065672; Sat, 17 Dec 2011 21:54:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 827038FC0A; Sat, 17 Dec 2011 21:54:28 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:34d8:b0a6:3463:89c2] (unknown [IPv6:2001:7b8:3a7:0:34d8:b0a6:3463:89c2]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id D60A45C37; Sat, 17 Dec 2011 22:54:27 +0100 (CET) Message-ID: <4EED0F99.2020306@FreeBSD.org> Date: Sat, 17 Dec 2011 22:54:33 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111130 Thunderbird/9.0 MIME-Version: 1.0 To: mdf@FreeBSD.org References: <201112171314.pBHDEjtQ060509@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 1.3.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228625 - head/usr.bin/csup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 21:54:28 -0000 On 2011-12-17 22:32, mdf@FreeBSD.org wrote: ... >> In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the >> shared secret, and use long long format to snprintf a time_t. > If casting is necessary, style prefers intmax_t or uintmax_t, since > those are always wide enough. I don't see anything about that in style(9), maybe it should be added then? In any case, I only changed the %ld format to %lld, because time_t is int, long or long long depending on arch. Long long is just the widest type required in this case. From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 21:56:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0965106566C; Sat, 17 Dec 2011 21:56:24 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id 7595D8FC14; Sat, 17 Dec 2011 21:56:24 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 8256E25D386E; Sat, 17 Dec 2011 21:56:23 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id A0330BD737C; Sat, 17 Dec 2011 21:56:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id sXkQCeuEWypt; Sat, 17 Dec 2011 21:56:21 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 4F68ABD737E; Sat, 17 Dec 2011 21:56:21 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <4EED0F99.2020306@FreeBSD.org> Date: Sat, 17 Dec 2011 21:56:20 +0000 Content-Transfer-Encoding: 7bit Message-Id: References: <201112171314.pBHDEjtQ060509@svn.freebsd.org> <4EED0F99.2020306@FreeBSD.org> To: Dimitry Andric X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, mdf@FreeBSD.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228625 - head/usr.bin/csup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 21:56:24 -0000 On 17. Dec 2011, at 21:54 , Dimitry Andric wrote: > On 2011-12-17 22:32, mdf@FreeBSD.org wrote: > ... >>> In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the >>> shared secret, and use long long format to snprintf a time_t. >> If casting is necessary, style prefers intmax_t or uintmax_t, since >> those are always wide enough. > > I don't see anything about that in style(9), maybe it should be added > then? In any case, I only changed the %ld format to %lld, because > time_t is int, long or long long depending on arch. Long long is just > the widest type required in this case. time_t is not always int. See sparc64. -- Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 21:58:46 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2497106566B; Sat, 17 Dec 2011 21:58:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 730048FC12; Sat, 17 Dec 2011 21:58:46 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:34d8:b0a6:3463:89c2] (unknown [IPv6:2001:7b8:3a7:0:34d8:b0a6:3463:89c2]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id B80585C37; Sat, 17 Dec 2011 22:58:45 +0100 (CET) Message-ID: <4EED109B.9020104@FreeBSD.org> Date: Sat, 17 Dec 2011 22:58:51 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111130 Thunderbird/9.0 MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <201112171721.pBHHLloU069166@svn.freebsd.org> <4C98B8D8-99F6-4996-A0FB-C128D9384180@lists.zabbadoz.net> In-Reply-To: <4C98B8D8-99F6-4996-A0FB-C128D9384180@lists.zabbadoz.net> X-Enigmail-Version: 1.3.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228650 - head/usr.bin/netstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 21:58:46 -0000 On 2011-12-17 22:53, Bjoern A. Zeeb wrote: > > On 17. Dec 2011, at 17:21 , Dimitry Andric wrote: > >> Author: dim >> Date: Sat Dec 17 17:21:47 2011 >> New Revision: 228650 >> URL: http://svn.freebsd.org/changeset/base/228650 >> >> Log: >> In usr.bin/netstat/atalk.c, work around a clang false positive with >> printf format warnings and conditional operators. >> > > This does not sound like a good idea. Make clang work. It's already being worked on, see: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-November/018464.html and: http://llvm.org/bugs/show_bug.cgi?id=11313 Meanwhile, this is just a temporary workaround. If you think it is too disruptive, I can just add NO_WFORMAT to the Makefile instead. From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 21:59:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 973BA106564A; Sat, 17 Dec 2011 21:59:17 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id 4ADDD8FC12; Sat, 17 Dec 2011 21:59:17 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 6BC4C25D386E; Sat, 17 Dec 2011 21:59:16 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 853EEBD737D; Sat, 17 Dec 2011 21:59:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id wqQWi1N9w2Fi; Sat, 17 Dec 2011 21:59:14 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 28FB8BD737F; Sat, 17 Dec 2011 21:59:14 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: Date: Sat, 17 Dec 2011 21:59:13 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <398125AD-ECC7-42EB-8050-BAEC6F444F1C@lists.zabbadoz.net> References: <201112171314.pBHDEjtQ060509@svn.freebsd.org> <4EED0F99.2020306@FreeBSD.org> To: Dimitry Andric X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, mdf@FreeBSD.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228625 - head/usr.bin/csup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 21:59:17 -0000 On 17. Dec 2011, at 21:56 , Bjoern A. Zeeb wrote: >=20 > On 17. Dec 2011, at 21:54 , Dimitry Andric wrote: >=20 >> On 2011-12-17 22:32, mdf@FreeBSD.org wrote: >> ... >>>> In usr.bin/csup/auth.c, use the correct number of bytes for zeroing = the >>>> shared secret, and use long long format to snprintf a time_t. >>> If casting is necessary, style prefers intmax_t or uintmax_t, since >>> those are always wide enough. >>=20 >> I don't see anything about that in style(9), maybe it should be added >> then? In any case, I only changed the %ld format to %lld, because >> time_t is int, long or long long depending on arch. Long long is = just >> the widest type required in this case. >=20 > time_t is not always int. See sparc64. gnargh, sorry. But yes we prefer a well defined type to a type that is = different per arch. %lld has constantly been a printf problem in the past. /bz --=20 Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 22:00:46 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA5F41065672; Sat, 17 Dec 2011 22:00:46 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id 602BF8FC14; Sat, 17 Dec 2011 22:00:46 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 2E1F025D3811; Sat, 17 Dec 2011 22:00:45 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id A0D31BD737E; Sat, 17 Dec 2011 22:00:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id Kep92r6iOgSW; Sat, 17 Dec 2011 22:00:43 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id F2FB2BD737D; Sat, 17 Dec 2011 22:00:42 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <4EED109B.9020104@FreeBSD.org> Date: Sat, 17 Dec 2011 22:00:42 +0000 Content-Transfer-Encoding: 7bit Message-Id: References: <201112171721.pBHHLloU069166@svn.freebsd.org> <4C98B8D8-99F6-4996-A0FB-C128D9384180@lists.zabbadoz.net> <4EED109B.9020104@FreeBSD.org> To: Dimitry Andric X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228650 - head/usr.bin/netstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 22:00:46 -0000 On 17. Dec 2011, at 21:58 , Dimitry Andric wrote: > On 2011-12-17 22:53, Bjoern A. Zeeb wrote: >> >> On 17. Dec 2011, at 17:21 , Dimitry Andric wrote: >> >>> Author: dim >>> Date: Sat Dec 17 17:21:47 2011 >>> New Revision: 228650 >>> URL: http://svn.freebsd.org/changeset/base/228650 >>> >>> Log: >>> In usr.bin/netstat/atalk.c, work around a clang false positive with >>> printf format warnings and conditional operators. >>> >> >> This does not sound like a good idea. Make clang work. > > It's already being worked on, see: > > http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-November/018464.html > > and: > > http://llvm.org/bugs/show_bug.cgi?id=11313 > > Meanwhile, this is just a temporary workaround. If you think it is too > disruptive, I can just add NO_WFORMAT to the Makefile instead. I'd prefer we do not start mangling source code for things that are not a problem with the code and just a problem with the warning level. Especially if the change will not be required anymore in the future. A Makefile option we can easily identify and grep for, a cast we just forget. /bz -- Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 22:05:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BA3F106564A; Sat, 17 Dec 2011 22:05:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A7618FC13; Sat, 17 Dec 2011 22:05:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHM5T8r078621; Sat, 17 Dec 2011 22:05:29 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHM5TLK078619; Sat, 17 Dec 2011 22:05:29 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112172205.pBHM5TLK078619@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 22:05:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228664 - head/usr.sbin/lpr/lpd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 22:05:29 -0000 Author: dim Date: Sat Dec 17 22:05:28 2011 New Revision: 228664 URL: http://svn.freebsd.org/changeset/base/228664 Log: In usr.sbin/lpr/lpd/printjob.c, use the correct printf length modifiers for off_t (aka int64_t). MFC after: 1 week Modified: head/usr.sbin/lpr/lpd/printjob.c Modified: head/usr.sbin/lpr/lpd/printjob.c ============================================================================== --- head/usr.sbin/lpr/lpd/printjob.c Sat Dec 17 21:37:21 2011 (r228663) +++ head/usr.sbin/lpr/lpd/printjob.c Sat Dec 17 22:05:28 2011 (r228664) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1138,9 +1139,10 @@ sendagain: copycnt++; if (copycnt < 2) - (void) sprintf(buf, "%c%qd %s\n", type, stb.st_size, file); + (void) sprintf(buf, "%c%" PRId64 " %s\n", type, stb.st_size, + file); else - (void) sprintf(buf, "%c%qd %s_c%d\n", type, stb.st_size, + (void) sprintf(buf, "%c%" PRId64 " %s_c%d\n", type, stb.st_size, file, copycnt); amt = strlen(buf); for (i = 0; ; i++) { From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 22:16:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 881B71065672; Sat, 17 Dec 2011 22:16:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7723B8FC15; Sat, 17 Dec 2011 22:16:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHMGRkE078987; Sat, 17 Dec 2011 22:16:27 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHMGRe5078984; Sat, 17 Dec 2011 22:16:27 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112172216.pBHMGRe5078984@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 22:16:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228665 - head/usr.sbin/ndiscvt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 22:16:27 -0000 Author: dim Date: Sat Dec 17 22:16:27 2011 New Revision: 228665 URL: http://svn.freebsd.org/changeset/base/228665 Log: Use NO_WCAST_ALIGN for usr.sbin/ndiscvt; because this is only built for x86, any alignment warnings can be safely ignored. Define YY_NO_INPUT in usr.sbin/ndiscvt/inf-token.l, so no unused lex functions are defined. MFC after: 1 week Modified: head/usr.sbin/ndiscvt/Makefile head/usr.sbin/ndiscvt/inf-token.l Modified: head/usr.sbin/ndiscvt/Makefile ============================================================================== --- head/usr.sbin/ndiscvt/Makefile Sat Dec 17 22:05:28 2011 (r228664) +++ head/usr.sbin/ndiscvt/Makefile Sat Dec 17 22:16:27 2011 (r228665) @@ -11,6 +11,7 @@ MAN= ndiscvt.8 MAN+= ndisgen.8 WARNS?= 4 +NO_WCAST_ALIGN= DPADD= ${LIBL} LDADD= -ll Modified: head/usr.sbin/ndiscvt/inf-token.l ============================================================================== --- head/usr.sbin/ndiscvt/inf-token.l Sat Dec 17 22:05:28 2011 (r228664) +++ head/usr.sbin/ndiscvt/inf-token.l Sat Dec 17 22:16:27 2011 (r228665) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); int lineno = 1; #define YY_NO_UNPUT +#define YY_NO_INPUT int yylex(void); void yyerror(const char *); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 22:18:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57B23106566B; Sat, 17 Dec 2011 22:18:27 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B1568FC08; Sat, 17 Dec 2011 22:18:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHMIR9J079077; Sat, 17 Dec 2011 22:18:27 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHMIRFp079075; Sat, 17 Dec 2011 22:18:27 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112172218.pBHMIRFp079075@svn.freebsd.org> From: Mikolaj Golub Date: Sat, 17 Dec 2011 22:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228666 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 22:18:27 -0000 Author: trociny Date: Sat Dec 17 22:18:26 2011 New Revision: 228666 URL: http://svn.freebsd.org/changeset/base/228666 Log: Fix style and white spaces. MFC after: 1 week Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sat Dec 17 22:16:27 2011 (r228665) +++ head/sys/kern/kern_proc.c Sat Dec 17 22:18:26 2011 (r228666) @@ -1206,7 +1206,7 @@ sysctl_out_proc(struct proc *p, struct s static int sysctl_kern_proc(SYSCTL_HANDLER_ARGS) { - int *name = (int*) arg1; + int *name = (int *)arg1; u_int namelen = arg2; struct proc *p; int flags, doingzomb, oid_number; @@ -1221,11 +1221,11 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) oid_number &= ~KERN_PROC_INC_THREAD; } if (oid_number == KERN_PROC_PID) { - if (namelen != 1) + if (namelen != 1) return (EINVAL); error = sysctl_wire_old_buffer(req, 0); if (error) - return (error); + return (error); error = pget((pid_t)name[0], PGET_CANSEE, &p); if (error != 0) return (error); @@ -1247,7 +1247,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) return (EINVAL); break; } - + if (!req->oldptr) { /* overestimate by 5 procs */ error = SYSCTL_OUT(req, 0, sizeof (struct kinfo_proc) * 5); @@ -1327,7 +1327,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) /* XXX proctree_lock */ SESS_LOCK(p->p_session); if (p->p_session->s_ttyp == NULL || - tty_udev(p->p_session->s_ttyp) != + tty_udev(p->p_session->s_ttyp) != (dev_t)name[0]) { SESS_UNLOCK(p->p_session); PROC_UNLOCK(p); @@ -1701,14 +1701,14 @@ proc_getenvv(struct thread *td, struct p static int sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS) { - int *name = (int*) arg1; + int *name = (int *)arg1; u_int namelen = arg2; struct pargs *newpa, *pa; struct proc *p; struct sbuf sb; int flags, error = 0, error2; - if (namelen != 1) + if (namelen != 1) return (EINVAL); flags = PGET_CANSEE; @@ -1762,7 +1762,7 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARG static int sysctl_kern_proc_env(SYSCTL_HANDLER_ARGS) { - int *name = (int*) arg1; + int *name = (int *)arg1; u_int namelen = arg2; struct proc *p; struct sbuf sb; @@ -1794,7 +1794,7 @@ sysctl_kern_proc_env(SYSCTL_HANDLER_ARGS static int sysctl_kern_proc_auxv(SYSCTL_HANDLER_ARGS) { - int *name = (int*) arg1; + int *name = (int *)arg1; u_int namelen = arg2; struct proc *p; size_t vsize, size; @@ -1882,7 +1882,7 @@ sysctl_kern_proc_sv_name(SYSCTL_HANDLER_ int error; namelen = arg2; - if (namelen != 1) + if (namelen != 1) return (EINVAL); name = (int *)arg1; @@ -2379,7 +2379,7 @@ sysctl_kern_proc_groups(SYSCTL_HANDLER_A static int sysctl_kern_proc_rlimit(SYSCTL_HANDLER_ARGS) { - int *name = (int*) arg1; + int *name = (int *)arg1; u_int namelen = arg2; struct plimit *limp; struct proc *p; @@ -2415,7 +2415,7 @@ sysctl_kern_proc_rlimit(SYSCTL_HANDLER_A static int sysctl_kern_proc_ps_strings(SYSCTL_HANDLER_ARGS) { - int *name = (int*) arg1; + int *name = (int *)arg1; u_int namelen = arg2; struct proc *p; vm_offset_t ps_strings; @@ -2467,10 +2467,10 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC static SYSCTL_NODE(_kern_proc, KERN_PROC_SESSION, sid, CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table"); -static SYSCTL_NODE(_kern_proc, KERN_PROC_TTY, tty, CTLFLAG_RD | CTLFLAG_MPSAFE, +static SYSCTL_NODE(_kern_proc, KERN_PROC_TTY, tty, CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table"); -static SYSCTL_NODE(_kern_proc, KERN_PROC_UID, uid, CTLFLAG_RD | CTLFLAG_MPSAFE, +static SYSCTL_NODE(_kern_proc, KERN_PROC_UID, uid, CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_kern_proc, "Process table"); static SYSCTL_NODE(_kern_proc, KERN_PROC_RUID, ruid, CTLFLAG_RD | CTLFLAG_MPSAFE, From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 22:20:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41886106564A; Sat, 17 Dec 2011 22:20:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 19CEF8FC0C; Sat, 17 Dec 2011 22:20:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHMKkwB079193; Sat, 17 Dec 2011 22:20:46 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHMKkYs079191; Sat, 17 Dec 2011 22:20:46 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112172220.pBHMKkYs079191@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 22:20:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228667 - head/usr.bin/csup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 22:20:47 -0000 Author: dim Date: Sat Dec 17 22:20:46 2011 New Revision: 228667 URL: http://svn.freebsd.org/changeset/base/228667 Log: In usr.bin/csup/auth.c, cast time_t to intmax_t instead, and use the corresponding printf length modifier. Requested by: mdf MFC after: 1 week Modified: head/usr.bin/csup/auth.c Modified: head/usr.bin/csup/auth.c ============================================================================== --- head/usr.bin/csup/auth.c Sat Dec 17 22:18:26 2011 (r228666) +++ head/usr.bin/csup/auth.c Sat Dec 17 22:20:46 2011 (r228667) @@ -302,8 +302,8 @@ auth_makechallenge(struct config *config } gettimeofday(&tv, NULL); MD5_Init(&md5); - snprintf(buf, sizeof(buf), "%s:%lld:%ld:%ld:%d:%d", - inet_ntoa(laddr.sin_addr), (long long)tv.tv_sec, tv.tv_usec, + snprintf(buf, sizeof(buf), "%s:%jd:%ld:%ld:%d:%d", + inet_ntoa(laddr.sin_addr), (intmax_t)tv.tv_sec, tv.tv_usec, random(), pid, ppid); MD5_Update(&md5, buf, strlen(buf)); MD5_Final(md5sum, &md5); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 22:32:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F542106566C; Sat, 17 Dec 2011 22:32:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E3518FC16; Sat, 17 Dec 2011 22:32:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHMW1Mb079558; Sat, 17 Dec 2011 22:32:01 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHMW1Bd079555; Sat, 17 Dec 2011 22:32:01 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112172232.pBHMW1Bd079555@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 22:32:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228668 - head/usr.bin/netstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 22:32:01 -0000 Author: dim Date: Sat Dec 17 22:32:00 2011 New Revision: 228668 URL: http://svn.freebsd.org/changeset/base/228668 Log: Revert r228650, and work around the clang false positive with printf formats in usr.bin/netstat/atalk.c by conditionally adding NO_WFORMAT to the Makefile instead. MFC after: 1 week Modified: head/usr.bin/netstat/Makefile head/usr.bin/netstat/atalk.c Modified: head/usr.bin/netstat/Makefile ============================================================================== --- head/usr.bin/netstat/Makefile Sat Dec 17 22:20:46 2011 (r228667) +++ head/usr.bin/netstat/Makefile Sat Dec 17 22:32:00 2011 (r228668) @@ -8,6 +8,11 @@ SRCS= if.c inet.c main.c mbuf.c mroute.c unix.c atalk.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c WARNS?= 3 +.if ${CC:T:Mclang} == "clang" +# XXX: Work around a clang false positive with format string warnings +# and ntohs macros (see LLVM PR 11313). +NO_WFORMAT= +.endif CFLAGS+=-fno-strict-aliasing CFLAGS+=-DIPSEC Modified: head/usr.bin/netstat/atalk.c ============================================================================== --- head/usr.bin/netstat/atalk.c Sat Dec 17 22:20:46 2011 (r228667) +++ head/usr.bin/netstat/atalk.c Sat Dec 17 22:32:00 2011 (r228668) @@ -81,7 +81,7 @@ static char mybuf[50]; return("*"); } } - sprintf(mybuf,"%hu",(short)ntohs(sat->sat_addr.s_net)); + sprintf(mybuf,"%hu",ntohs(sat->sat_addr.s_net)); return mybuf; } From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 22:33:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C814106566B; Sat, 17 Dec 2011 22:33:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 2F4908FC19; Sat, 17 Dec 2011 22:33:20 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:34d8:b0a6:3463:89c2] (unknown [IPv6:2001:7b8:3a7:0:34d8:b0a6:3463:89c2]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 7C0135C37; Sat, 17 Dec 2011 23:33:19 +0100 (CET) Message-ID: <4EED18B5.8000907@FreeBSD.org> Date: Sat, 17 Dec 2011 23:33:25 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111130 Thunderbird/9.0 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201112172232.pBHMW1Bd079555@svn.freebsd.org> In-Reply-To: <201112172232.pBHMW1Bd079555@svn.freebsd.org> X-Enigmail-Version: 1.3.4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r228668 - head/usr.bin/netstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 22:33:20 -0000 On 2011-12-17 23:32, Dimitry Andric wrote: > Author: dim > Date: Sat Dec 17 22:32:00 2011 > New Revision: 228668 > URL: http://svn.freebsd.org/changeset/base/228668 > > Log: > Revert r228650, and work around the clang false positive with printf > formats in usr.bin/netstat/atalk.c by conditionally adding NO_WFORMAT to > the Makefile instead. > > MFC after: 1 week Requested by: bz From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 23:18:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 881FA106566B; Sat, 17 Dec 2011 23:18:14 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C6768FC12; Sat, 17 Dec 2011 23:18:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHNIEls081038; Sat, 17 Dec 2011 23:18:14 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHNIEkl081035; Sat, 17 Dec 2011 23:18:14 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201112172318.pBHNIEkl081035@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 17 Dec 2011 23:18:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228669 - head/usr.bin/du X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 23:18:14 -0000 Author: jilles Date: Sat Dec 17 23:18:14 2011 New Revision: 228669 URL: http://svn.freebsd.org/changeset/base/228669 Log: du: Allow multiple -HLP options, the last one wins. This matches 4.4BSD tradition and other utilities with these options and is required by POSIX (POSIX does not specify -P, only -HL). MFC after: 2 weeks Modified: head/usr.bin/du/du.1 head/usr.bin/du/du.c Modified: head/usr.bin/du/du.1 ============================================================================== --- head/usr.bin/du/du.1 Sat Dec 17 22:32:00 2011 (r228668) +++ head/usr.bin/du/du.1 Sat Dec 17 23:18:14 2011 (r228669) @@ -28,7 +28,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd December 8, 2011 +.Dd December 17, 2011 .Dt DU 1 .Os .Sh NAME @@ -155,6 +155,13 @@ or .Fl L option is specified, storage used by any symbolic links which are followed is not counted (or displayed). +The +.Fl H , +.Fl L +and +.Fl P +options override each other and the command's actions are determined +by the last one specified. .Pp The .Fl h, k Modified: head/usr.bin/du/du.c ============================================================================== --- head/usr.bin/du/du.c Sat Dec 17 22:32:00 2011 (r228668) +++ head/usr.bin/du/du.c Sat Dec 17 23:18:14 2011 (r228669) @@ -89,18 +89,18 @@ main(int argc, char *argv[]) off_t threshold, threshold_sign; int ftsoptions; int depth; - int Hflag, Lflag, Pflag, aflag, sflag, dflag, cflag; + int Hflag, Lflag, aflag, sflag, dflag, cflag; int hflag, lflag, ch, notused, rval; char **save; static char dot[] = "."; setlocale(LC_ALL, ""); - Hflag = Lflag = Pflag = aflag = sflag = dflag = cflag = hflag = + Hflag = Lflag = aflag = sflag = dflag = cflag = hflag = lflag = Aflag = 0; save = argv; - ftsoptions = 0; + ftsoptions = FTS_PHYSICAL; savednumber = 0; threshold = 0; threshold_sign = 1; @@ -125,19 +125,17 @@ main(int argc, char *argv[]) break; case 'H': Hflag = 1; + Lflag = 0; break; case 'I': ignoreadd(optarg); break; case 'L': - if (Pflag) - usage(); Lflag = 1; + Hflag = 0; break; case 'P': - if (Lflag) - usage(); - Pflag = 1; + Hflag = Lflag = 0; break; case 'a': aflag = 1; @@ -210,20 +208,12 @@ main(int argc, char *argv[]) * the man page, so it's a feature. */ - if (Hflag + Lflag + Pflag > 1) - usage(); - - if (Hflag + Lflag + Pflag == 0) - Pflag = 1; /* -P (physical) is default */ - if (Hflag) ftsoptions |= FTS_COMFOLLOW; - - if (Lflag) + if (Lflag) { + ftsoptions &= ~FTS_PHYSICAL; ftsoptions |= FTS_LOGICAL; - - if (Pflag) - ftsoptions |= FTS_PHYSICAL; + } if (!Aflag && (cblocksize % DEV_BSIZE) != 0) cblocksize = howmany(cblocksize, DEV_BSIZE) * DEV_BSIZE; From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 23:35:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2630E106566B; Sat, 17 Dec 2011 23:35:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 14E8F8FC0C; Sat, 17 Dec 2011 23:35:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHNZkua081609; Sat, 17 Dec 2011 23:35:46 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHNZk04081607; Sat, 17 Dec 2011 23:35:46 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112172335.pBHNZk04081607@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 23:35:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228670 - head/usr.sbin/pkg_install/updating X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 23:35:47 -0000 Author: dim Date: Sat Dec 17 23:35:46 2011 New Revision: 228670 URL: http://svn.freebsd.org/changeset/base/228670 Log: In usr.sbin/pkg_install/updating/main.c, use the size of the destination buffer as size argument to strlcpy(), not the length of the source. MFC after: 1 week Modified: head/usr.sbin/pkg_install/updating/main.c Modified: head/usr.sbin/pkg_install/updating/main.c ============================================================================== --- head/usr.sbin/pkg_install/updating/main.c Sat Dec 17 23:18:14 2011 (r228669) +++ head/usr.sbin/pkg_install/updating/main.c Sat Dec 17 23:35:46 2011 (r228670) @@ -141,7 +141,7 @@ main(int argc, char *argv[]) strcmp(pkgdbdir->d_name, "..") != 0) { /* Create path to +CONTENTS file for each installed port */ - n = strlcpy(tmp_file, pkgdbpath, strlen(pkgdbpath)+1); + n = strlcpy(tmp_file, pkgdbpath, sizeof(tmp_file)); n = strlcpy(tmp_file + n, "/", sizeof(tmp_file) - n); n = strlcat(tmp_file + n, pkgdbdir->d_name, sizeof(tmp_file) - n); @@ -181,7 +181,7 @@ main(int argc, char *argv[]) (void)exit(EXIT_FAILURE); if (pname[strlen(pname) - 1] == '\n') pname[strlen(pname) - 1] = '\0'; - strlcpy (curr->name, pname, strlen(pname)+1); + strlcpy (curr->name, pname, sizeof(curr->name)); curr->next = head; head = curr; } From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 23:39:13 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8472106564A; Sat, 17 Dec 2011 23:39:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C76B88FC14; Sat, 17 Dec 2011 23:39:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHNdDEY081741; Sat, 17 Dec 2011 23:39:13 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHNdD21081739; Sat, 17 Dec 2011 23:39:13 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112172339.pBHNdD21081739@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 23:39:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228671 - head/usr.sbin/pmccontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 23:39:13 -0000 Author: dim Date: Sat Dec 17 23:39:13 2011 New Revision: 228671 URL: http://svn.freebsd.org/changeset/base/228671 Log: In usr.sbin/pmccontrol/pmccontrol.c, fix a few warnings about format strings not being literals. MFC after: 1 week Modified: head/usr.sbin/pmccontrol/pmccontrol.c Modified: head/usr.sbin/pmccontrol/pmccontrol.c ============================================================================== --- head/usr.sbin/pmccontrol/pmccontrol.c Sat Dec 17 23:35:46 2011 (r228670) +++ head/usr.sbin/pmccontrol/pmccontrol.c Sat Dec 17 23:39:13 2011 (r228671) @@ -452,7 +452,7 @@ main(int argc, char **argv) case '?': warnx("Unrecognized option \"-%c\"", optopt); - errx(EX_USAGE, usage_message); + errx(EX_USAGE, "%s", usage_message); break; default: @@ -462,7 +462,7 @@ main(int argc, char **argv) } if (command == PMCC_PRINT_USAGE) - (void) errx(EX_USAGE, usage_message); + (void) errx(EX_USAGE, "%s", usage_message); if (error) exit(EX_USAGE); From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 23:43:40 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2319106566B; Sat, 17 Dec 2011 23:43:40 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E12DE8FC0C; Sat, 17 Dec 2011 23:43:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHNheb2081914; Sat, 17 Dec 2011 23:43:40 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHNheSw081912; Sat, 17 Dec 2011 23:43:40 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112172343.pBHNheSw081912@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 23:43:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228672 - head/contrib/pnpinfo X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 23:43:41 -0000 Author: dim Date: Sat Dec 17 23:43:40 2011 New Revision: 228672 URL: http://svn.freebsd.org/changeset/base/228672 Log: In contrib/pnpinfo/pnpinfo.c, remove an extraneous parameter from the call to isolation_protocol(). MFC after: 1 week Modified: head/contrib/pnpinfo/pnpinfo.c Modified: head/contrib/pnpinfo/pnpinfo.c ============================================================================== --- head/contrib/pnpinfo/pnpinfo.c Sat Dec 17 23:39:13 2011 (r228671) +++ head/contrib/pnpinfo/pnpinfo.c Sat Dec 17 23:43:40 2011 (r228672) @@ -599,7 +599,7 @@ main(int argc, char **argv) /* Try various READ_DATA ports from 0x203-0x3ff */ for (rd_port = 0x80; (rd_port < 0xff); rd_port += 0x10) { DEB(printf("Trying Read_Port at %x...\n", (rd_port << 2) | 0x3) ); - num_pnp_devs = isolation_protocol(rd_port); + num_pnp_devs = isolation_protocol(); if (num_pnp_devs) break; } From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 23:46:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C67CD106566B; Sat, 17 Dec 2011 23:46:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5A008FC08; Sat, 17 Dec 2011 23:46:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHNklZK082072; Sat, 17 Dec 2011 23:46:47 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHNklkF082070; Sat, 17 Dec 2011 23:46:47 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112172346.pBHNklkF082070@svn.freebsd.org> From: Dimitry Andric Date: Sat, 17 Dec 2011 23:46:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228673 - head/usr.sbin/pw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 23:46:47 -0000 Author: dim Date: Sat Dec 17 23:46:47 2011 New Revision: 228673 URL: http://svn.freebsd.org/changeset/base/228673 Log: In usr.sbin/pw/pw_user.c, use the correct printf length modifier for a ptrdiff_t. MFC after: 1 week Modified: head/usr.sbin/pw/pw_user.c Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Sat Dec 17 23:43:40 2011 (r228672) +++ head/usr.sbin/pw/pw_user.c Sat Dec 17 23:46:47 2011 (r228673) @@ -1208,7 +1208,7 @@ pw_checkname(u_char *name, int gecos) if (reject) { snprintf(showch, sizeof(showch), (*ch >= ' ' && *ch < 127) ? "`%c'" : "0x%02x", *ch); - errx(EX_DATAERR, "invalid character %s at position %d in %s", + errx(EX_DATAERR, "invalid character %s at position %td in %s", showch, (ch - name), showtype); } if (!gecos && (ch - name) > LOGNAMESIZE) From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 23:49:51 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9DCE106564A; Sat, 17 Dec 2011 23:49:51 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8BFC48FC17; Sat, 17 Dec 2011 23:49:51 +0000 (UTC) Received: by dakp5 with SMTP id p5so4299447dak.13 for ; Sat, 17 Dec 2011 15:49:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=1qe+w+BrAxa07066MOzZABuzc8eLQ5x8SejwJVt13Rs=; b=KGrPUwPNfYu+3MsRoAnT+y7YBZiZOrTFzMlL+g3AjECNLhslIu1/3AOLXz0SMEzB7a yxbgdJvdmAxT5wuL2rqVyMjYKYka3cIs4EzQ7p8MmQTr9jvfW/dVG3lVDyOWhnLpRoCt pUBm3cxRv3RAuZGumWyQEkVsaewPPNI0DXbgs= MIME-Version: 1.0 Received: by 10.68.211.5 with SMTP id my5mr27953746pbc.17.1324165791016; Sat, 17 Dec 2011 15:49:51 -0800 (PST) Sender: mdf356@gmail.com Received: by 10.68.197.198 with HTTP; Sat, 17 Dec 2011 15:49:50 -0800 (PST) In-Reply-To: <4EED0F99.2020306@FreeBSD.org> References: <201112171314.pBHDEjtQ060509@svn.freebsd.org> <4EED0F99.2020306@FreeBSD.org> Date: Sat, 17 Dec 2011 15:49:50 -0800 X-Google-Sender-Auth: 70uA_7zmevrolVXR0gxDV-spy4w Message-ID: From: mdf@FreeBSD.org To: Dimitry Andric Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228625 - head/usr.bin/csup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 17 Dec 2011 23:49:51 -0000 On Sat, Dec 17, 2011 at 1:54 PM, Dimitry Andric wrote: > On 2011-12-17 22:32, mdf@FreeBSD.org wrote: > ... >>> =A0In usr.bin/csup/auth.c, use the correct number of bytes for zeroing = the >>> =A0shared secret, and use long long format to snprintf a time_t. >> If casting is necessary, style prefers intmax_t or uintmax_t, since >> those are always wide enough. > > I don't see anything about that in style(9), maybe it should be added > then? Probably; Bruce has mentioned it many times in the past, and as bz@ notes, it's a well-defined type with a well-defined conversion specifier. Also, long long is a bit of a hack that came in before C99 standardized on a few wider types, and the PRIu64 macros are really hideous. Thanks, matthew >=A0In any case, I only changed the %ld format to %lld, because > time_t is int, long or long long depending on arch. =A0Long long is just > the widest type required in this case. >