From owner-svn-src-stable-7@FreeBSD.ORG Sun Aug 8 13:45:47 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A0F01065672; Sun, 8 Aug 2010 13:45:47 +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 58A818FC1E; Sun, 8 Aug 2010 13:45:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78Djleo081548; Sun, 8 Aug 2010 13:45:47 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78Djl5s081546; Sun, 8 Aug 2010 13:45:47 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201008081345.o78Djl5s081546@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 8 Aug 2010 13:45:47 +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: r211070 - stable/7/etc/rc.d X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2010 13:45:47 -0000 Author: jilles Date: Sun Aug 8 13:45:47 2010 New Revision: 211070 URL: http://svn.freebsd.org/changeset/base/211070 Log: MFC r210734: Allow starting ipmon if ipnat is enabled but ipfilter is not (in /etc/rc.conf). This fixes an apparent confusion between test(1) and sh(1) syntax for AND/OR. PR: conf/149036 Submitted by: pluknet Modified: stable/7/etc/rc.d/ipmon Directory Properties: stable/7/etc/ (props changed) Modified: stable/7/etc/rc.d/ipmon ============================================================================== --- stable/7/etc/rc.d/ipmon Sun Aug 8 13:43:20 2010 (r211069) +++ stable/7/etc/rc.d/ipmon Sun Aug 8 13:45:47 2010 (r211070) @@ -20,7 +20,7 @@ ipmon_precmd() # Continue only if ipfilter or ipnat is enabled and the # ipfilter module is loaded. # - if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then + if ! checkyesno ipfilter_enable && ! checkyesno ipnat_enable ; then err 1 "${name} requires either ipfilter or ipnat enabled" fi if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then From owner-svn-src-stable-7@FreeBSD.ORG Sun Aug 8 19:08:00 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67748106566B; Sun, 8 Aug 2010 19:08:00 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5611D8FC16; Sun, 8 Aug 2010 19:08:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o78J80av052651; Sun, 8 Aug 2010 19:08:00 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o78J80QE052650; Sun, 8 Aug 2010 19:08:00 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201008081908.o78J80QE052650@svn.freebsd.org> From: Gavin Atkinson Date: Sun, 8 Aug 2010 19:08:00 +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: r211081 - stable/7/sys/dev/usb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Aug 2010 19:08:00 -0000 Author: gavin Date: Sun Aug 8 19:07:59 2010 New Revision: 211081 URL: http://svn.freebsd.org/changeset/base/211081 Log: Fix mismerge in r211035. Pointy hat: me Modified: stable/7/sys/dev/usb/u3g.c Modified: stable/7/sys/dev/usb/u3g.c ============================================================================== --- stable/7/sys/dev/usb/u3g.c Sun Aug 8 17:03:23 2010 (r211080) +++ stable/7/sys/dev/usb/u3g.c Sun Aug 8 19:07:59 2010 (r211081) @@ -194,7 +194,7 @@ static const struct u3g_dev_type_s u3g_d {{ USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CGU628 }, U3GSP_HSDPA, U3GINIT_CMOTECH }, {{ USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_DISK }, U3GSP_HSDPA, U3GINIT_NONE }, /* OEM: Longcheer */ - { USB_VENDOR_LONGCHEER, USB_PRODUCT_LONGCHEER_WM66 }, U3GSP_HSDPA, U3GINIT_HUAWEI }, + {{ USB_VENDOR_LONGCHEER, USB_PRODUCT_LONGCHEER_WM66 }, U3GSP_HSDPA, U3GINIT_HUAWEI }, }; #define u3g_lookup(v, p) ((const struct u3g_dev_type_s *)usb_lookup(u3g_devs, v, p)) From owner-svn-src-stable-7@FreeBSD.ORG Mon Aug 9 14:26:52 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7A261065670; Mon, 9 Aug 2010 14:26: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 B5EBC8FC14; Mon, 9 Aug 2010 14:26:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79EQq3a015438; Mon, 9 Aug 2010 14:26:52 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79EQqQp015436; Mon, 9 Aug 2010 14:26:52 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201008091426.o79EQqQp015436@svn.freebsd.org> From: Fabien Thomas Date: Mon, 9 Aug 2010 14:26:52 +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: r211097 - stable/7/usr.sbin/pmcstat X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2010 14:26:52 -0000 Author: fabient Date: Mon Aug 9 14:26:52 2010 New Revision: 211097 URL: http://svn.freebsd.org/changeset/base/211097 Log: MFC r210766: Fix the calltree top view that incorrectly filter out some nodes. Modified: stable/7/usr.sbin/pmcstat/pmcpl_calltree.c Directory Properties: stable/7/usr.sbin/pmcstat/ (props changed) Modified: stable/7/usr.sbin/pmcstat/pmcpl_calltree.c ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcpl_calltree.c Mon Aug 9 14:25:58 2010 (r211096) +++ stable/7/usr.sbin/pmcstat/pmcpl_calltree.c Mon Aug 9 14:26:52 2010 (r211097) @@ -354,6 +354,7 @@ pmcpl_ct_node_dumptop(int pmcin, struct struct pmcpl_ct_sample *rsamples, int x, int *y) { int i, terminal; + struct pmcpl_ct_arc *arc; if (ct->pct_flags & PMCPL_PCT_TAG) return 0; @@ -372,12 +373,17 @@ pmcpl_ct_node_dumptop(int pmcin, struct * for at least one arc for that PMC. */ terminal = 1; - for (i = 0; i < ct->pct_narc; i++) + for (i = 0; i < ct->pct_narc; i++) { + arc = &ct->pct_arc[i]; if (PMCPL_CT_SAMPLE(pmcin, - &ct->pct_arc[i].pcta_samples) != 0) { + &arc->pcta_samples) != 0 && + PMCPL_CT_SAMPLEP(pmcin, + &arc->pcta_samples) > pmcstat_threshold && + (arc->pcta_child->pct_flags & PMCPL_PCT_TAG) == 0) { terminal = 0; break; } + } if (ct->pct_narc == 0 || terminal) { pmcpl_ct_topscreen[x+1][*y] = NULL; From owner-svn-src-stable-7@FreeBSD.ORG Mon Aug 9 14:30:45 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7646106567D; Mon, 9 Aug 2010 14:30:45 +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 A46668FC14; Mon, 9 Aug 2010 14:30:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79EUjLP016410; Mon, 9 Aug 2010 14:30:45 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79EUjuq016407; Mon, 9 Aug 2010 14:30:45 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201008091430.o79EUjuq016407@svn.freebsd.org> From: Fabien Thomas Date: Mon, 9 Aug 2010 14:30:45 +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: r211099 - stable/7/usr.sbin/pmcstat X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2010 14:30:45 -0000 Author: fabient Date: Mon Aug 9 14:30:45 2010 New Revision: 211099 URL: http://svn.freebsd.org/changeset/base/211099 Log: MFC r210794: Allow file as a top source, it works with socket now. This will allow top monitoring using socket/ssh tunnelling of system without local symbols. client: pmcstat -R : -T -r monitored device: pmcstat -Sinstructions -O : - Move the file read in the event loop - Initialize and clean log in all cases - Preserve global stats value during top refresh - Fix the rtld/line resolver that ignore '-r' prefix - Support socket for '-R' (server mode) - Display the statistics when exiting top mode Modified: stable/7/usr.sbin/pmcstat/pmcstat.c stable/7/usr.sbin/pmcstat/pmcstat_log.c Directory Properties: stable/7/usr.sbin/pmcstat/ (props changed) Modified: stable/7/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcstat.c Mon Aug 9 14:29:23 2010 (r211098) +++ stable/7/usr.sbin/pmcstat/pmcstat.c Mon Aug 9 14:30:45 2010 (r211099) @@ -169,8 +169,7 @@ pmcstat_cleanup(void) args.pa_logparser = NULL; } - if (args.pa_flags & (FLAG_HAS_PIPE | FLAG_HAS_OUTPUT_LOGFILE)) - pmcstat_shutdown_logging(); + pmcstat_shutdown_logging(); } void @@ -559,7 +558,7 @@ main(int argc, char **argv) int do_print; size_t dummy; int graphdepth; - int pipefd[2]; + int pipefd[2], rfd; int use_cumulative_counts; short cf, cb; uint32_t cpumask; @@ -1001,11 +1000,6 @@ main(int argc, char **argv) (args.pa_flags & FLAG_READ_LOGFILE) == 0) errx(EX_USAGE, "ERROR: option -M is only used with -g/-R."); - /* -T is incompatible with -R (replay logfile is a TODO) */ - if ((args.pa_flags & FLAG_DO_TOP) && - (args.pa_flags & FLAG_READ_LOGFILE)) - errx(EX_USAGE, "ERROR: option -T is incompatible with -R."); - /* * Disallow textual output of sampling PMCs if counting PMCs * have also been asked for, mostly because the combined output @@ -1066,7 +1060,22 @@ main(int argc, char **argv) graphfilename); } - /* if we've been asked to process a log file, do that and exit */ + /* if we've been asked to process a log file, skip init */ + if ((args.pa_flags & FLAG_READ_LOGFILE) == 0) { + if (pmc_init() < 0) + err(EX_UNAVAILABLE, + "ERROR: Initialization of the pmc(3) library failed"); + + if ((npmc = pmc_npmc(0)) < 0) /* assume all CPUs are identical */ + err(EX_OSERR, "ERROR: Cannot determine the number of PMCs " + "on CPU %d", 0); + } + + /* Allocate a kqueue */ + if ((pmcstat_kq = kqueue()) < 0) + err(EX_OSERR, "ERROR: Cannot allocate kqueue"); + + /* Setup the logfile as the source. */ if (args.pa_flags & FLAG_READ_LOGFILE) { /* * Print the log in textual form if we haven't been @@ -1076,28 +1085,17 @@ main(int argc, char **argv) args.pa_flags |= FLAG_DO_PRINT; pmcstat_initialize_logging(); - args.pa_logfd = pmcstat_open_log(args.pa_inputpath, + rfd = pmcstat_open_log(args.pa_inputpath, PMCSTAT_OPEN_FOR_READ); - if ((args.pa_logparser = pmclog_open(args.pa_logfd)) == NULL) + if ((args.pa_logparser = pmclog_open(rfd)) == NULL) err(EX_OSERR, "ERROR: Cannot create parser"); - pmcstat_process_log(); - pmcstat_shutdown_logging(); - exit(EX_OK); + if (fcntl(rfd, F_SETFL, O_NONBLOCK) < 0) + err(EX_OSERR, "ERROR: fcntl(2) failed"); + EV_SET(&kev, rfd, EVFILT_READ, EV_ADD, + 0, 0, NULL); + if (kevent(pmcstat_kq, &kev, 1, NULL, 0, NULL) < 0) + err(EX_OSERR, "ERROR: Cannot register kevent"); } - - /* otherwise, we've been asked to collect data */ - if (pmc_init() < 0) - err(EX_UNAVAILABLE, - "ERROR: Initialization of the pmc(3) library failed"); - - if ((npmc = pmc_npmc(0)) < 0) /* assume all CPUs are identical */ - err(EX_OSERR, "ERROR: Cannot determine the number of PMCs " - "on CPU %d", 0); - - /* Allocate a kqueue */ - if ((pmcstat_kq = kqueue()) < 0) - err(EX_OSERR, "ERROR: Cannot allocate kqueue"); - /* * Configure the specified log file or setup a default log * consumer via a pipe. @@ -1140,6 +1138,7 @@ main(int argc, char **argv) (args.pa_flags & FLAG_HAS_OUTPUT_LOGFILE); /* + if (args.pa_flags & FLAG_READ_LOGFILE) { * Allocate PMCs. */ @@ -1272,10 +1271,8 @@ main(int argc, char **argv) if (args.pa_flags & FLAG_HAS_COMMANDLINE) pmcstat_start_process(); - /* initialize logging if printing the configured log */ - if ((args.pa_flags & (FLAG_DO_PRINT | FLAG_DO_TOP)) && - (args.pa_flags & (FLAG_HAS_PIPE | FLAG_HAS_OUTPUT_LOGFILE))) - pmcstat_initialize_logging(); + /* initialize logging */ + pmcstat_initialize_logging(); /* Handle SIGINT using the kqueue loop */ sa.sa_handler = SIG_IGN; @@ -1338,16 +1335,13 @@ main(int argc, char **argv) switch (kev.filter) { case EVFILT_PROC: /* target has exited */ - if (args.pa_flags & (FLAG_HAS_OUTPUT_LOGFILE | - FLAG_HAS_PIPE)) - runstate = pmcstat_close_log(); - else - runstate = PMCSTAT_FINISHED; + runstate = pmcstat_close_log(); do_print = 1; break; case EVFILT_READ: /* log file data is present */ - if (kev.ident == (unsigned)fileno(stdin)) { + if (kev.ident == (unsigned)fileno(stdin) && + (args.pa_flags & FLAG_DO_TOP)) { if (pmcstat_keypress_log()) runstate = pmcstat_close_log(); } else @@ -1370,15 +1364,8 @@ main(int argc, char **argv) * of its targets, or if logfile * writes encounter an error. */ - if (args.pa_flags & (FLAG_HAS_OUTPUT_LOGFILE | - FLAG_HAS_PIPE)) { - runstate = pmcstat_close_log(); - if (args.pa_flags & - (FLAG_DO_PRINT|FLAG_DO_ANALYSIS)) - pmcstat_process_log(); - } + runstate = pmcstat_close_log(); do_print = 1; /* print PMCs at exit */ - runstate = PMCSTAT_FINISHED; } else if (kev.ident == SIGINT) { /* Kill the child process if we started it */ if (args.pa_flags & FLAG_HAS_COMMANDLINE) @@ -1386,7 +1373,7 @@ main(int argc, char **argv) /* Close the pipe to self, if present. */ if (args.pa_flags & FLAG_HAS_PIPE) (void) close(pipefd[READPIPEFD]); - runstate = PMCSTAT_FINISHED; + runstate = pmcstat_close_log(); } else if (kev.ident == SIGWINCH) { if (ioctl(fileno(args.pa_printfile), TIOCGWINSZ, &ws) < 0) Modified: stable/7/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcstat_log.c Mon Aug 9 14:29:23 2010 (r211098) +++ stable/7/usr.sbin/pmcstat/pmcstat_log.c Mon Aug 9 14:30:45 2010 (r211099) @@ -141,6 +141,7 @@ struct pmcstat_image_hash_list pmcstat_i struct pmcstat_process_hash_list pmcstat_process_hash[PMCSTAT_NHASH]; struct pmcstat_stats pmcstat_stats; /* statistics */ +int ps_samples_period; /* samples count between top refresh. */ struct pmcstat_process *pmcstat_kernproc; /* kernel 'process' */ @@ -247,7 +248,7 @@ static int pmcstat_string_compute_hash(c static void pmcstat_string_initialize(void); static int pmcstat_string_lookup_hash(pmcstat_interned_string _is); static void pmcstat_string_shutdown(void); -static void pmcstat_stats_reset(void); +static void pmcstat_stats_reset(int _reset_global); /* * A simple implementation of interned strings. Each interned string @@ -276,7 +277,7 @@ int pmcstat_npmcs; int pmcstat_pause; static void -pmcstat_stats_reset(void) +pmcstat_stats_reset(int reset_global) { struct pmcstat_pmcrecord *pr; @@ -285,9 +286,11 @@ pmcstat_stats_reset(void) pr->pr_samples = 0; pr->pr_dubious_frames = 0; } + ps_samples_period = 0; /* Flush global stats. */ - bzero(&pmcstat_stats, sizeof(struct pmcstat_stats)); + if (reset_global) + bzero(&pmcstat_stats, sizeof(struct pmcstat_stats)); } /* @@ -606,7 +609,7 @@ pmcstat_image_get_elf_params(struct pmcs GElf_Phdr ph; GElf_Shdr sh; enum pmcstat_image_type image_type; - char buffer[PATH_MAX]; + char buffer[PATH_MAX], rtldpath[PATH_MAX]; assert(image->pi_type == PMCSTAT_IMAGE_UNKNOWN); @@ -686,9 +689,10 @@ pmcstat_image_get_elf_params(struct pmcs buffer, elf_errmsg(-1)); goto done; } + snprintf(rtldpath, sizeof(rtldpath), "%s%s", + args.pa_fsroot, elfbase + ph.p_offset); image->pi_dynlinkerpath = - pmcstat_string_intern(elfbase + - ph.p_offset); + pmcstat_string_intern(rtldpath); break; case PT_LOAD: if (ph.p_offset == 0) @@ -944,11 +948,13 @@ pmcstat_image_addr2line(struct pmcstat_i int fd; if (image->pi_addr2line == NULL) { - snprintf(imagepath, sizeof(imagepath), "%s.symbols", + snprintf(imagepath, sizeof(imagepath), "%s%s.symbols", + args.pa_fsroot, pmcstat_string_unintern(image->pi_fullpath)); fd = open(imagepath, O_RDONLY); if (fd < 0) { - snprintf(imagepath, sizeof(imagepath), "%s", + snprintf(imagepath, sizeof(imagepath), "%s%s", + args.pa_fsroot, pmcstat_string_unintern(image->pi_fullpath)); } else close(fd); @@ -1399,6 +1405,7 @@ pmcstat_analyze_log(void) * bin inside this. */ pmcstat_stats.ps_samples_total++; + ps_samples_period++; pc = ev.pl_u.pl_s.pl_pc; pp = pmcstat_process_lookup(ev.pl_u.pl_s.pl_pid, @@ -1425,6 +1432,7 @@ pmcstat_analyze_log(void) case PMCLOG_TYPE_CALLCHAIN: pmcstat_stats.ps_samples_total++; + ps_samples_period++; cpuflags = ev.pl_u.pl_cc.pl_cpuflags; cpu = PMC_CALLCHAIN_CPUFLAGS_TO_CPU(cpuflags); @@ -1691,8 +1699,15 @@ pmcstat_print_log(void) int pmcstat_close_log(void) { - if (pmc_flush_logfile() < 0) - err(EX_OSERR, "ERROR: logging failed"); + /* If a local logfile is configured ask the kernel to stop + * and flush data. Kernel will close the file when data is flushed + * so keep the status to EXITING. + */ + if (args.pa_logfd != -1) { + if (pmc_flush_logfile() < 0) + err(EX_OSERR, "ERROR: logging failed"); + } + return (args.pa_flags & FLAG_HAS_PIPE ? PMCSTAT_EXITING : PMCSTAT_FINISHED); } @@ -1709,7 +1724,7 @@ pmcstat_close_log(void) int pmcstat_open_log(const char *path, int mode) { - int error, fd; + int error, fd, cfd; size_t hlen; const char *p, *errstr; struct addrinfo hints, *res, *res0; @@ -1730,7 +1745,7 @@ pmcstat_open_log(const char *path, int m */ if (path[0] == '-' && path[1] == '\0') fd = (mode == PMCSTAT_OPEN_FOR_READ) ? 0 : 1; - else if (mode == PMCSTAT_OPEN_FOR_WRITE && path[0] != '/' && + else if (path[0] != '/' && path[0] != '.' && strchr(path, ':') != NULL) { p = strrchr(path, ':'); @@ -1759,11 +1774,29 @@ pmcstat_open_log(const char *path, int m errstr = strerror(errno); continue; } - if (connect(fd, res->ai_addr, res->ai_addrlen) < 0) { - errstr = strerror(errno); + if (mode == PMCSTAT_OPEN_FOR_READ) { + if (bind(fd, res->ai_addr, res->ai_addrlen) < 0) { + errstr = strerror(errno); + (void) close(fd); + fd = -1; + continue; + } + listen(fd, 1); + cfd = accept(fd, NULL, NULL); (void) close(fd); - fd = -1; - continue; + if (cfd < 0) { + errstr = strerror(errno); + fd = -1; + break; + } + fd = cfd; + } else { + if (connect(fd, res->ai_addr, res->ai_addrlen) < 0) { + errstr = strerror(errno); + (void) close(fd); + fd = -1; + continue; + } } errstr = NULL; break; @@ -1833,9 +1866,8 @@ pmcstat_refresh_top(void) pmcstat_pmcinfilter); /* Format samples count. */ - if (pmcstat_stats.ps_samples_total > 0) - v = (pmcpr->pr_samples * 100.0) / - pmcstat_stats.ps_samples_total; + if (ps_samples_period > 0) + v = (pmcpr->pr_samples * 100.0) / ps_samples_period; else v = 0.; v_attrs = PMCSTAT_ATTRPERCENT(v); @@ -1872,7 +1904,7 @@ pmcstat_changefilter(void) do { pmcr = pmcstat_pmcindex_to_pmcr(pmcstat_pmcinfilter); - if (pmcr == pmcr->pr_merge) + if (pmcr == NULL || pmcr == pmcr->pr_merge) break; pmcstat_pmcinfilter++; @@ -1915,7 +1947,7 @@ pmcstat_keypress_log(void) */ if (plugins[args.pa_plugin].pl_shutdown != NULL) plugins[args.pa_plugin].pl_shutdown(NULL); - pmcstat_stats_reset(); + pmcstat_stats_reset(0); if (plugins[args.pa_plugin].pl_init != NULL) plugins[args.pa_plugin].pl_init(); @@ -1936,7 +1968,7 @@ pmcstat_keypress_log(void) } while (plugins[args.pa_plugin].pl_topdisplay == NULL); /* Open new plugin. */ - pmcstat_stats_reset(); + pmcstat_stats_reset(0); if (plugins[args.pa_plugin].pl_init != NULL) plugins[args.pa_plugin].pl_init(); wprintw(w, "switching to plugin %s", @@ -1986,7 +2018,7 @@ pmcstat_display_log(void) if (args.pa_topmode == PMCSTAT_TOP_DELTA) { if (plugins[args.pa_plugin].pl_shutdown != NULL) plugins[args.pa_plugin].pl_shutdown(NULL); - pmcstat_stats_reset(); + pmcstat_stats_reset(0); if (plugins[args.pa_plugin].pl_init != NULL) plugins[args.pa_plugin].pl_init(); } @@ -2130,8 +2162,7 @@ pmcstat_shutdown_logging(void) N, pmcstat_stats.ps_##V); \ } while (0) - if (args.pa_verbosity >= 1 && (args.pa_flags & FLAG_DO_ANALYSIS) && - (args.pa_flags & FLAG_DO_TOP) == 0) { + if (args.pa_verbosity >= 1 && (args.pa_flags & FLAG_DO_ANALYSIS)) { (void) fprintf(args.pa_printfile, "CONVERSION STATISTICS:\n"); PRINT("#exec/a.out", exec_aout); PRINT("#exec/elf", exec_elf); From owner-svn-src-stable-7@FreeBSD.ORG Mon Aug 9 14:33:25 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85F801065679; Mon, 9 Aug 2010 14:33:25 +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 5A0618FC1B; Mon, 9 Aug 2010 14:33:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o79EXP3A017116; Mon, 9 Aug 2010 14:33:25 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o79EXPD5017112; Mon, 9 Aug 2010 14:33:25 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201008091433.o79EXPD5017112@svn.freebsd.org> From: Fabien Thomas Date: Mon, 9 Aug 2010 14:33:25 +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: r211101 - stable/7/usr.sbin/pmcstat X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Aug 2010 14:33:25 -0000 Author: fabient Date: Mon Aug 9 14:33:25 2010 New Revision: 211101 URL: http://svn.freebsd.org/changeset/base/211101 Log: MFC r210797: - Do not use the runtime mask when logfile is specified. - Revert the fix on rtld path that is not necessary. Modified: stable/7/usr.sbin/pmcstat/pmcstat.c stable/7/usr.sbin/pmcstat/pmcstat.h stable/7/usr.sbin/pmcstat/pmcstat_log.c Directory Properties: stable/7/usr.sbin/pmcstat/ (props changed) Modified: stable/7/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcstat.c Mon Aug 9 14:32:45 2010 (r211100) +++ stable/7/usr.sbin/pmcstat/pmcstat.c Mon Aug 9 14:33:25 2010 (r211101) @@ -641,6 +641,7 @@ main(int argc, char **argv) else cpumask = pmcstat_get_cpumask(optarg); + args.pa_flags |= FLAGS_HAS_CPUMASK; args.pa_required |= FLAG_HAS_SYSTEM_PMCS; break; @@ -884,6 +885,13 @@ main(int argc, char **argv) args.pa_argc = (argc -= optind); args.pa_argv = (argv += optind); + /* If we read from logfile and no specified CPU mask use + * the maximum CPU count. + */ + if ((args.pa_flags & FLAG_READ_LOGFILE) && + (args.pa_flags & FLAGS_HAS_CPUMASK) == 0) + cpumask = 0xffffffff; + args.pa_cpumask = cpumask; /* For selecting CPUs using -R. */ if (argc) /* command line present */ Modified: stable/7/usr.sbin/pmcstat/pmcstat.h ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcstat.h Mon Aug 9 14:32:45 2010 (r211100) +++ stable/7/usr.sbin/pmcstat/pmcstat.h Mon Aug 9 14:33:25 2010 (r211101) @@ -51,6 +51,7 @@ #define FLAG_DO_ANNOTATE 0x00008000 /* -m */ #define FLAG_DO_TOP 0x00010000 /* -T */ #define FLAG_DO_ANALYSIS 0x00020000 /* -g or -G or -m or -T */ +#define FLAGS_HAS_CPUMASK 0x00040000 /* -c */ #define DEFAULT_SAMPLE_COUNT 65536 #define DEFAULT_WAIT_INTERVAL 5.0 Modified: stable/7/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcstat_log.c Mon Aug 9 14:32:45 2010 (r211100) +++ stable/7/usr.sbin/pmcstat/pmcstat_log.c Mon Aug 9 14:33:25 2010 (r211101) @@ -609,7 +609,7 @@ pmcstat_image_get_elf_params(struct pmcs GElf_Phdr ph; GElf_Shdr sh; enum pmcstat_image_type image_type; - char buffer[PATH_MAX], rtldpath[PATH_MAX]; + char buffer[PATH_MAX]; assert(image->pi_type == PMCSTAT_IMAGE_UNKNOWN); @@ -689,10 +689,9 @@ pmcstat_image_get_elf_params(struct pmcs buffer, elf_errmsg(-1)); goto done; } - snprintf(rtldpath, sizeof(rtldpath), "%s%s", - args.pa_fsroot, elfbase + ph.p_offset); image->pi_dynlinkerpath = - pmcstat_string_intern(rtldpath); + pmcstat_string_intern(elfbase + + ph.p_offset); break; case PT_LOAD: if (ph.p_offset == 0) From owner-svn-src-stable-7@FreeBSD.ORG Sat Aug 14 13:47:34 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B04DA106566B; Sat, 14 Aug 2010 13:47: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 853F38FC13; Sat, 14 Aug 2010 13:47:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EDlY9Q029082; Sat, 14 Aug 2010 13:47:34 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EDlYoH029080; Sat, 14 Aug 2010 13:47:34 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201008141347.o7EDlYoH029080@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 14 Aug 2010 13:47:34 +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: r211297 - stable/7/sys/netinet X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Aug 2010 13:47:34 -0000 Author: bz Date: Sat Aug 14 13:47:34 2010 New Revision: 211297 URL: http://svn.freebsd.org/changeset/base/211297 Log: MFC r210686: MFp4 @181628: Free the rtentry after we diconnected it from the FIB and are counting it as rttrash. There might still be a chance we leak it from a different code path but there is nothing we can do about this here. Modified: stable/7/sys/netinet/in_rmx.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/in_rmx.c ============================================================================== --- stable/7/sys/netinet/in_rmx.c Sat Aug 14 13:44:24 2010 (r211296) +++ stable/7/sys/netinet/in_rmx.c Sat Aug 14 13:47:34 2010 (r211297) @@ -402,15 +402,35 @@ in_ifadownkill(struct radix_node *rn, vo if (rt->rt_ifa == ap->ifa && (ap->del || !(rt->rt_flags & RTF_STATIC))) { /* + * Aquire a reference so that it can later be freed + * as the refcount would be 0 here in case of at least + * ap->del. + */ + RT_ADDREF(rt); + /* * We need to disable the automatic prune that happens * in this case in rtrequest() because it will blow * away the pointers that rn_walktree() needs in order * continue our descent. We will end up deleting all * the routes that rtrequest() would have in any case, * so that behavior is not needed there. + * Disconnect it from the tree and permit protocols + * to cleanup. */ rt->rt_flags &= ~RTF_CLONING; rtexpunge(rt); + /* + * At this point it is an rttrash node, and in case + * the above is the only reference we must free it. + * If we do not noone will have a pointer and the + * rtentry will be leaked forever. + * In case someone else holds a reference, we are + * fine as we only decrement the refcount. In that + * case if the other entity calls RT_REMREF, we + * will still be leaking but at least we tried. + */ + RTFREE_LOCKED(rt); + return (0); } RT_UNLOCK(rt); return 0; From owner-svn-src-stable-7@FreeBSD.ORG Sat Aug 14 20:03:33 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8999810656A3; Sat, 14 Aug 2010 20:03:33 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 780F18FC12; Sat, 14 Aug 2010 20:03:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7EK3X8w037450; Sat, 14 Aug 2010 20:03:33 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7EK3XW0037448; Sat, 14 Aug 2010 20:03:33 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201008142003.o7EK3XW0037448@svn.freebsd.org> From: Andre Oppermann Date: Sat, 14 Aug 2010 20:03:33 +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: r211313 - stable/7/sys/netinet X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Aug 2010 20:03:33 -0000 Author: andre Date: Sat Aug 14 20:03:32 2010 New Revision: 211313 URL: http://svn.freebsd.org/changeset/base/211313 Log: MFC r210666: Fix a bug in syncache where the initial CWND for new incoming connections was limited to one segment under the faulty assumption of a retransmit. Due to this the opportunity to initialize the increased congestion window according to RFC3390 was missed. Modified: stable/7/sys/netinet/tcp_syncache.c Modified: stable/7/sys/netinet/tcp_syncache.c ============================================================================== --- stable/7/sys/netinet/tcp_syncache.c Sat Aug 14 19:36:48 2010 (r211312) +++ stable/7/sys/netinet/tcp_syncache.c Sat Aug 14 20:03:32 2010 (r211313) @@ -821,8 +821,9 @@ syncache_socket(struct syncache *sc, str /* * If the SYN,ACK was retransmitted, reset cwnd to 1 segment. + * NB: sc_rxmits counts all SYN,ACK transmits, not just retransmits. */ - if (sc->sc_rxmits) + if (sc->sc_rxmits > 1) tp->snd_cwnd = tp->t_maxseg; tcp_timer_activate(tp, TT_KEEP, tcp_keepinit);