Re: svn commit: r227956 - head/usr.bin/procstat
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: JBPID COMMRLIMIT SOFT HARD JB 48798 zsh cputime 10 secs infinity secs JB 48798 zsh filesize infinity kbinfinity 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 cputime1 sec infinity 11949 zsh filesizeinfinity infinity 11949 zsh datasize 524288 kB524288 kB 11949 zsh stacksize 65536 kB 65536 kB 11949 zsh coredumpsize 190734 MB190734 MB 11949 zsh memoryuse infinity infinity 11949 zsh memorylockedinfinity infinity 11949 zsh maxprocesses5547 5547 11949 zsh openfiles 1109511095 11949 zsh sbsize infinity infinity 11949 zsh vmemoryuse infinity infinity 11949 zsh pseudo-terminalsinfinity infinity 11949 zsh swapuse infinity infinity -- Mikolaj Golub Index: usr.bin/procstat/procstat_rlimit.c === --- usr.bin/procstat/procstat_rlimit.c (revision 228285) +++ usr.bin/procstat/procstat_rlimit.c (working copy) @@ -28,7 +28,6 @@ #include sys/param.h #include sys/time.h -#define _RLIMIT_IDENT #include sys/resourcevar.h #include sys/sysctl.h #include sys/user.h @@ -36,6 +35,7 @@ #include err.h #include errno.h #include libprocstat.h +#include libutil.h #include limits.h #include stdio.h #include stdlib.h @@ -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; @@
svn commit: r228391 - head/sys/netinet
Author: tuexen Date: Sat Dec 10 10:52:54 2011 New Revision: 228391 URL: http://svn.freebsd.org/changeset/base/228391 Log: Fix a bug reported by Irene Ruengeler which resulted in not sending out HEARTBEATs when requested by the user. The HEARTBEATs were only queued, but not actually sent out. MFC after: 2 months. Modified: head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_constants.h == --- head/sys/netinet/sctp_constants.h Sat Dec 10 09:34:39 2011 (r228390) +++ head/sys/netinet/sctp_constants.h Sat Dec 10 10:52:54 2011 (r228391) @@ -391,6 +391,8 @@ __FBSDID($FreeBSD$); #define SCTP_OUTPUT_FROM_COOKIE_ACK 14 #define SCTP_OUTPUT_FROM_DRAIN 15 #define SCTP_OUTPUT_FROM_CLOSING16 +#define SCTP_OUTPUT_FROM_SOCKOPT17 + /* SCTP chunk types are moved sctp.h for application (NAT, FW) use */ /* align to 32-bit sizes */ Modified: head/sys/netinet/sctp_usrreq.c == --- head/sys/netinet/sctp_usrreq.c Sat Dec 10 09:34:39 2011 (r228390) +++ head/sys/netinet/sctp_usrreq.c Sat Dec 10 10:52:54 2011 (r228391) @@ -4727,6 +4727,7 @@ sctp_setopt(struct socket *so, int optna if (paddrp-spp_flags SPP_HB_DEMAND) { /* on demand HB */ sctp_send_hb(stcb, net, SCTP_SO_LOCKED); + sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED); sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net); } if ((paddrp-spp_flags SPP_PMTUD_DISABLE) (paddrp-spp_pathmtu = SCTP_SMALLEST_PMTU)) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228392 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: pjd Date: Sat Dec 10 13:02:52 2011 New Revision: 228392 URL: http://svn.freebsd.org/changeset/base/228392 Log: Move ru_inblock increment into arc_read_nolock() so we don't account for cached reads. Discussed with: gibbs No objections from: avg Tested by:Marcus Reid mar...@blazingdot.com MFC after:1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Dec 10 10:52:54 2011(r228391) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Dec 10 13:02:52 2011(r228392) @@ -3105,6 +3105,9 @@ top: ARCSTAT_CONDSTAT(!(hdr-b_flags ARC_PREFETCH), demand, prefetch, hdr-b_type != ARC_BUFC_METADATA, data, metadata, misses); +#ifdef _KERNEL + curthread-td_ru.ru_inblock++; +#endif if (vd != NULL l2arc_ndev != 0 !(l2arc_norw devw)) { /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Dec 10 10:52:54 2011(r228391) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Dec 10 13:02:52 2011(r228392) @@ -627,10 +627,6 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio } else if (db-db_state == DB_UNCACHED) { spa_t *spa = dn-dn_objset-os_spa; -#ifdef _KERNEL - curthread-td_ru.ru_inblock++; -#endif - if (zio == NULL) zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); dbuf_read_impl(db, zio, flags); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228393 - head/sys/dev/e1000
Author: jfv Date: Sat Dec 10 18:00:53 2011 New Revision: 228393 URL: http://svn.freebsd.org/changeset/base/228393 Log: Fix NETMAP code problem in the build. Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Sat Dec 10 13:02:52 2011(r228392) +++ head/sys/dev/e1000/if_em.c Sat Dec 10 18:00:53 2011(r228393) @@ -4100,7 +4100,7 @@ em_setup_receive_ring(struct rx_ring *rx if (sj 0) sj += adapter-num_rx_desc; - for (j = 0; j != adapter-num_rx_desc; j++, sj++) { + for (int j = 0; j != adapter-num_rx_desc; j++, sj++) { void *addr; int sz; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228394 - in head: usr.bin/find usr.bin/lex usr.sbin/mount_portalfs
Author: ed Date: Sat Dec 10 18:11:06 2011 New Revision: 228394 URL: http://svn.freebsd.org/changeset/base/228394 Log: Replace char copyright[] by static const char copyright[]. It seems the latter is used throughout the tree. Modified: head/usr.bin/find/main.c head/usr.bin/lex/main.c head/usr.sbin/mount_portalfs/mount_portalfs.c Modified: head/usr.bin/find/main.c == --- head/usr.bin/find/main.cSat Dec 10 18:00:53 2011(r228393) +++ head/usr.bin/find/main.cSat Dec 10 18:11:06 2011(r228394) @@ -31,7 +31,7 @@ */ #ifndef lint -char copyright[] = +static const char copyright[] = @(#) Copyright (c) 1990, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n; #endif /* not lint */ Modified: head/usr.bin/lex/main.c == --- head/usr.bin/lex/main.c Sat Dec 10 18:00:53 2011(r228393) +++ head/usr.bin/lex/main.c Sat Dec 10 18:11:06 2011(r228394) @@ -27,7 +27,7 @@ */ #ifndef lint -char copyright[] = +static const char copyright[] = @(#) Copyright (c) 1990 The Regents of the University of California.\n\ All rights reserved.\n; #endif /* not lint */ Modified: head/usr.sbin/mount_portalfs/mount_portalfs.c == --- head/usr.sbin/mount_portalfs/mount_portalfs.c Sat Dec 10 18:00:53 2011(r228393) +++ head/usr.sbin/mount_portalfs/mount_portalfs.c Sat Dec 10 18:11:06 2011(r228394) @@ -31,7 +31,7 @@ */ #ifndef lint -char copyright[] = +static const char copyright[] = @(#) Copyright (c) 1992, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n; #endif /* not lint */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228395 - head/usr.bin/grep
Author: ed Date: Sat Dec 10 18:21:03 2011 New Revision: 228395 URL: http://svn.freebsd.org/changeset/base/228395 Log: Add missing static const to long options table. This table is only used in this C file and passed to getopt_long(), so we can safely add static and const to it. Modified: head/usr.bin/grep/grep.c Modified: head/usr.bin/grep/grep.c == --- head/usr.bin/grep/grep.cSat Dec 10 18:11:06 2011(r228394) +++ head/usr.bin/grep/grep.cSat Dec 10 18:21:03 2011(r228395) @@ -166,7 +166,7 @@ usage(void) static const char *optstr = 0123456789A:B:C:D:EFGHIJMLOPSRUVZabcd:e:f:hilm:nopqrsuvwxXy; -struct option long_options[] = +static const struct option long_options[] = { {binary-files,required_argument, NULL, BIN_OPT}, {help,no_argument,NULL, HELP_OPT}, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228396 - head/usr.bin/truss
Author: ed Date: Sat Dec 10 18:27:55 2011 New Revision: 228396 URL: http://svn.freebsd.org/changeset/base/228396 Log: Add more static keywords to truss(1) source code. There are some tables in the source code that are only used by the individual source files themselves. Therefore there is no need to export them. Modified: head/usr.bin/truss/amd64-linux32.c head/usr.bin/truss/i386-linux.c head/usr.bin/truss/main.c head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/amd64-linux32.c == --- head/usr.bin/truss/amd64-linux32.c Sat Dec 10 18:21:03 2011 (r228395) +++ head/usr.bin/truss/amd64-linux32.c Sat Dec 10 18:27:55 2011 (r228396) @@ -228,7 +228,7 @@ amd64_linux32_syscall_entry(struct truss /* * Linux syscalls return negative errno's, we do positive and map them */ -const int bsd_to_linux_errno[] = { +static const int bsd_to_linux_errno[] = { -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -35, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, Modified: head/usr.bin/truss/i386-linux.c == --- head/usr.bin/truss/i386-linux.c Sat Dec 10 18:21:03 2011 (r228395) +++ head/usr.bin/truss/i386-linux.c Sat Dec 10 18:27:55 2011 (r228396) @@ -228,7 +228,7 @@ i386_linux_syscall_entry(struct trussinf /* * Linux syscalls return negative errno's, we do positive and map them */ -const int bsd_to_linux_errno[] = { +static const int bsd_to_linux_errno[] = { -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -35, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, Modified: head/usr.bin/truss/main.c == --- head/usr.bin/truss/main.c Sat Dec 10 18:21:03 2011(r228395) +++ head/usr.bin/truss/main.c Sat Dec 10 18:27:55 2011(r228396) @@ -74,7 +74,7 @@ usage(void) * WARNING! FreeBSD a.out must be first, or set_etype will not * work correctly. */ -struct ex_types { +static struct ex_types { const char *type; void (*enter_syscall)(struct trussinfo *, int); long (*exit_syscall)(struct trussinfo *, int); Modified: head/usr.bin/truss/syscalls.c == --- head/usr.bin/truss/syscalls.c Sat Dec 10 18:21:03 2011 (r228395) +++ head/usr.bin/truss/syscalls.c Sat Dec 10 18:27:55 2011 (r228396) @@ -89,7 +89,7 @@ static const char rcsid[] = /* * This should probably be in its own file, sorted alphabetically. */ -struct syscall syscalls[] = { +static struct syscall syscalls[] = { { .name = fcntl, .ret_type = 1, .nargs = 3, .args = { { Int, 0 } , { Fcntl, 1 }, { Fcntlflag | OUT, 2 } } }, { .name = fork, .ret_type = 1, .nargs = 0 }, @@ -283,7 +283,7 @@ static struct xlat kevent_flags[] = { X(EV_CLEAR) X(EV_FLAG1) X(EV_ERROR) X(EV_EOF) XEND }; -struct xlat poll_flags[] = { +static struct xlat poll_flags[] = { X(POLLSTANDARD) X(POLLIN) X(POLLPRI) X(POLLOUT) X(POLLERR) X(POLLHUP) X(POLLNVAL) X(POLLRDNORM) X(POLLRDBAND) X(POLLWRBAND) X(POLLINIGNEOF) XEND ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228397 - head/libexec/comsat
Author: ed Date: Sat Dec 10 18:35:26 2011 New Revision: 228397 URL: http://svn.freebsd.org/changeset/base/228397 Log: Make comsat(8) approximately 15% smaller. This program only consists of a single C file, so simply mark everything except main() static. Modified: head/libexec/comsat/comsat.c Modified: head/libexec/comsat/comsat.c == --- head/libexec/comsat/comsat.cSat Dec 10 18:27:55 2011 (r228396) +++ head/libexec/comsat/comsat.cSat Dec 10 18:35:26 2011 (r228397) @@ -68,17 +68,17 @@ static const char rcsid[] = #include unistd.h #include utmpx.h -intdebug = 0; +static int debug = 0; #definedsyslog if (debug) syslog #define MAXIDLE120 -char hostname[MAXHOSTNAMELEN]; +static charhostname[MAXHOSTNAMELEN]; -void jkfprintf(FILE *, char[], char[], off_t); -void mailfor(char *); -void notify(struct utmpx *, char[], off_t, int); -void reapchildren(int); +static voidjkfprintf(FILE *, char[], char[], off_t); +static voidmailfor(char *); +static voidnotify(struct utmpx *, char[], off_t, int); +static voidreapchildren(int); int main(int argc __unused, char *argv[] __unused) @@ -115,13 +115,13 @@ main(int argc __unused, char *argv[] __u } } -void +static void reapchildren(int signo __unused) { while (wait3(NULL, WNOHANG, NULL) 0); } -void +static void mailfor(char *name) { struct utmpx *utp; @@ -157,7 +157,7 @@ mailfor(char *name) static const char *cr; -void +static void notify(struct utmpx *utp, char file[], off_t offset, int folder) { FILE *tp; @@ -219,7 +219,7 @@ notify(struct utmpx *utp, char file[], o _exit(0); } -void +static void jkfprintf(FILE *tp, char user[], char file[], off_t offset) { unsigned char *cp, ch; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228398 - head/sys/i386/include
Author: alc Date: Sat Dec 10 18:42:00 2011 New Revision: 228398 URL: http://svn.freebsd.org/changeset/base/228398 Log: Avoid the possibility of integer overflow in the calculation of VM_KMEM_SIZE_MAX. Specifically, if the user/kernel address space split was changed such that the kernel address space was greater than or equal to 2 GB, then overflow would occur. PR: 161721 MFC after:3 weeks Modified: head/sys/i386/include/vmparam.h Modified: head/sys/i386/include/vmparam.h == --- head/sys/i386/include/vmparam.h Sat Dec 10 18:35:26 2011 (r228397) +++ head/sys/i386/include/vmparam.h Sat Dec 10 18:42:00 2011 (r228398) @@ -186,11 +186,12 @@ #endif /* - * Ceiling on amount of kmem_map kva space. + * Ceiling on the amount of kmem_map KVA space: 40% of the entire KVA space + * rounded to the nearest multiple of the superpage size. */ #ifndef VM_KMEM_SIZE_MAX -#defineVM_KMEM_SIZE_MAX((VM_MAX_KERNEL_ADDRESS - \ -VM_MIN_KERNEL_ADDRESS) * 2 / 5) +#defineVM_KMEM_SIZE_MAX(VM_MAX_KERNEL_ADDRESS - \ +VM_MIN_KERNEL_ADDRESS) (PDRSHIFT - 2)) + 5) / 10) PDRSHIFT) #endif /* initial pagein size of beginning of executable file */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228399 - head/sys/dev/bwn
Author: eadler (ports committer) Date: Sat Dec 10 21:05:06 2011 New Revision: 228399 URL: http://svn.freebsd.org/changeset/base/228399 Log: - fix typo Approved by: kib@ Modified: head/sys/dev/bwn/if_bwnvar.h Modified: head/sys/dev/bwn/if_bwnvar.h == --- head/sys/dev/bwn/if_bwnvar.hSat Dec 10 18:42:00 2011 (r228398) +++ head/sys/dev/bwn/if_bwnvar.hSat Dec 10 21:05:06 2011 (r228399) @@ -714,7 +714,7 @@ struct bwn_txhdr { uint16_ttx_status; struct bwn_plcp6rts_plcp; uint8_t rts_frame[16]; - uint8_t pad1[2];; + uint8_t pad1[2]; struct bwn_plcp6plcp; } __packed old; /* format r410 */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org