Re: UPDATE: usr.bin/less
The version of less is in base is under a BSD equivalent license, the one you're updating us to is.. GPLv3. Ah, nevermind. It's actually under a dual BSD-alike and GPLv3 license. Hmm. The version in base is actually dual licensed as well, (but GPLv2).
hide kernel threads in ps?
Help! My Nagios checks failed. :) This fixes them by hiding kernel threads from ps output. I'd also like to show the main process ID in the PID column as otherwise there is no way of knowing which threads belong together. Likely struct kinfo_proc would need a change for that... Maybe in another step. comments? Index: bin/ps/ps.1 === RCS file: /cvs/src/bin/ps/ps.1,v retrieving revision 1.76 diff -u -p -r1.76 ps.1 --- bin/ps/ps.1 6 Jul 2011 21:42:11 - 1.76 +++ bin/ps/ps.1 30 Aug 2011 22:58:12 - @@ -39,7 +39,7 @@ .Sh SYNOPSIS .Nm ps .Sm off -.Op Fl aCcehjkLlmrSTuvwx +.Op Fl aCceHhjkLlmrSTuvwx .Sm on .Op Fl M Ar core .Op Fl N Ar system @@ -89,6 +89,10 @@ scripts will show as .Dq sh . .It Fl e Display the environment as well. +.It Fl H +Also display information about kernel visible process threads. +This flag only applies when the `kern.rthreads' sysctl variable is +non-zero and there are processes that use kernel threading. .It Fl h Repeat the information header as often as necessary to guarantee one header per page of information. Index: bin/ps/ps.c === RCS file: /cvs/src/bin/ps/ps.c,v retrieving revision 1.49 diff -u -p -r1.49 ps.c --- bin/ps/ps.c 10 Apr 2011 03:20:58 - 1.49 +++ bin/ps/ps.c 30 Aug 2011 22:03:26 - @@ -99,7 +99,7 @@ main(int argc, char *argv[]) pid_t pid; uid_t uid; int all, ch, flag, i, fmt, lineno, nentries, mib[6]; - int prtheader, wflag, kflag, what, Uflag, xflg; + int prtheader, showthreads, wflag, kflag, what, Uflag, xflg; char *nlistf, *memf, *swapf, errbuf[_POSIX2_LINE_MAX]; size_t size; @@ -114,13 +114,14 @@ main(int argc, char *argv[]) if (argc 1) argv[1] = kludge_oldps_options(argv[1]); - all = fmt = prtheader = wflag = kflag = Uflag = xflg = 0; + all = fmt = prtheader = showthreads = wflag = kflag = Uflag = 0; + xflg = 0; pid = -1; uid = 0; ttydev = NODEV; memf = nlistf = swapf = NULL; while ((ch = getopt(argc, argv, - acCeghjkLlM:mN:O:o:p:rSTt:U:uvW:wx)) != -1) + acCegHhjkLlM:mN:O:o:p:rSTt:U:uvW:wx)) != -1) switch (ch) { case 'a': all = 1; @@ -136,6 +137,9 @@ main(int argc, char *argv[]) break; case 'g': break; /* no-op */ + case 'H': + showthreads = 1; + break; case 'h': prtheader = ws.ws_row 5 ? ws.ws_row : 22; break; @@ -336,6 +340,8 @@ main(int argc, char *argv[]) * for each proc, call each variable output function. */ for (i = lineno = 0; i nentries; i++) { + if (showthreads == 0 (kinfo[i]-p_flag P_THREAD) != 0) + continue; if (xflg == 0 ((int)kinfo[i]-p_tdev == NODEV || (kinfo[i]-p_flag P_CONTROLT ) == 0)) continue;
Re: ksh history corruption
On Wed, Aug 31, 2011 at 11:59:29AM +0200, LEVAI Daniel wrote: On Tue, Aug 30, 2011 at 13:55:57 -0500, Marco Peereboom wrote: On Tue, Aug 30, 2011 at 11:11:46AM -0500, Marco Peereboom wrote: I have had enough of corrupt ksh history so I had a look at the code to try to fix it. The magical code was very magical so I basically deleted most of it and made ksh history into a flat text file. It handles multiple ksh instances writing to the same text file with locks just like the current ksh does. I haven't noticed any differences in behavior running this. If one had set HISTFILE='', the old behaviour was to not write a history file, but the in memory history was still working. With this patch, if I set HISTFILE='' then there will be no command history at all. This is the same with current ksh. I did forget to mention to move your history file out of the way before testing this. Daniel -- LIVAI Daniel PGP key ID = 0x83B63A8F Key fingerprint = DBEC C66B A47A DFA2 792D 650C C69B BE4C 83B6 3A8F
Re: ksh history corruption
On Wed, Aug 31, 2011 at 02:13:19PM +0200, LEVAI Daniel wrote: On Wed, Aug 31, 2011 at 06:57:34 -0500, Marco Peereboom wrote: On Wed, Aug 31, 2011 at 11:59:29AM +0200, LEVAI Daniel wrote: On Tue, Aug 30, 2011 at 13:55:57 -0500, Marco Peereboom wrote: On Tue, Aug 30, 2011 at 11:11:46AM -0500, Marco Peereboom wrote: I have had enough of corrupt ksh history so I had a look at the code to try to fix it. The magical code was very magical so I basically deleted most of it and made ksh history into a flat text file. It handles multiple ksh instances writing to the same text file with locks just like the current ksh does. I haven't noticed any differences in behavior running this. If one had set HISTFILE='', the old behaviour was to not write a history file, but the in memory history was still working. With this patch, if I set HISTFILE='' then there will be no command history at all. This is the same with current ksh. Not for me. Currently if I set HISTFILE to '' then in-memory history works but it doesn't write to history file (which was my intention when I've set HISTFILE=''). Hmmm, I tried again and now I see it. I blame it on not enough coffee. Thanks I'll go figure it out. Daniel -- LIVAI Daniel PGP key ID = 0x83B63A8F Key fingerprint = DBEC C66B A47A DFA2 792D 650C C69B BE4C 83B6 3A8F
Re: passing vlan priority tag through bridge
On 2011-08-28 02:16, Christiano F. Haesbaert wrote: Heya, So here is a crude diff, the shiffting can be improved and if we wan't this in the future we'll need a knob to enable don't touch the vlanprio thingy. Please it would be great if you can give this a spin Peter. I did some basic tests with a re(4) (hw tagging) and a rl(4) (no hw tagging). Thanks, tested and works like a charm: Before patch: em1: 15:13:55.762101 00:04:96:51:71:80 01:04:96:51:71:80 8100 66: 802.1Q vid 500 pri 7 snap 0:e0:2b:0:bb sap aa ui/C len=37 15:13:55.762400 00:04:96:51:71:80 01:04:96:51:71:80 8100 66: 802.1Q vid 500 pri 0 snap 0:e0:2b:0:bb sap aa ui/C len=37 15:13:56.201398 00:1e:0b:2b:eb:ed 88:ae:1d:b5:94:e1 8100 102: 802.1Q vid 500 pri 2 192.168.0.1 192.168.0.2: icmp: echo request (id:21e1 seq:623) (DF) (ttl 64, id 0, len 84) 15:13:56.201553 88:ae:1d:b5:94:e1 00:1e:0b:2b:eb:ed 8100 102: 802.1Q vid 500 pri 0 192.168.0.2 192.168.0.1: icmp: echo reply (id:21e1 seq:623) (ttl 64, id 42697, len 84) em0: 15:13:55.762116 00:04:96:51:71:80 01:04:96:51:71:80 8100 66: 802.1Q vid 1500 pri 0 snap 0:e0:2b:0:bb sap aa ui/C len=37 15:13:55.762388 00:04:96:51:71:80 01:04:96:51:71:80 8100 66: 802.1Q vid 1500 pri 7 snap 0:e0:2b:0:bb sap aa ui/C len=37 15:13:56.201412 00:1e:0b:2b:eb:ed 88:ae:1d:b5:94:e1 8100 102: 802.1Q vid 1500 pri 0 192.168.0.1 192.168.0.2: icmp: echo request (id:21e1 seq:623) (DF) (ttl 64, id 0, len 84) 15:13:56.201547 88:ae:1d:b5:94:e1 00:1e:0b:2b:eb:ed 8100 102: 802.1Q vid 1500 pri 2 192.168.0.2 192.168.0.1: icmp: echo reply (id:21e1 seq:623) (ttl 64, id 42697, len 84) After patch: em1: 15:07:07.277884 00:04:96:51:71:80 01:04:96:51:71:80 8100 66: 802.1Q vid 500 pri 7 snap 0:e0:2b:0:bb sap aa ui/C len=37 15:07:07.278039 00:04:96:51:71:80 01:04:96:51:71:80 8100 66: 802.1Q vid 500 pri 7 snap 0:e0:2b:0:bb sap aa ui/C len=37 15:07:07.576643 00:1e:0b:2b:eb:ed 88:ae:1d:b5:94:e1 8100 102: 802.1Q vid 500 pri 2 192.168.0.1 192.168.0.2: icmp: echo request (id:21e1 seq:214) (DF) (ttl 64, id 0, len 84) 15:07:07.576794 88:ae:1d:b5:94:e1 00:1e:0b:2b:eb:ed 8100 102: 802.1Q vid 500 pri 2 192.168.0.2 192.168.0.1: icmp: echo reply (id:21e1 seq:214) (ttl 64, id 42409, len 84) em0: 15:07:07.277901 00:04:96:51:71:80 01:04:96:51:71:80 8100 66: 802.1Q vid 1500 pri 7 snap 0:e0:2b:0:bb sap aa ui/C len=37 15:07:07.278029 00:04:96:51:71:80 01:04:96:51:71:80 8100 66: 802.1Q vid 1500 pri 7 snap 0:e0:2b:0:bb sap aa ui/C len=37 15:07:07.576658 00:1e:0b:2b:eb:ed 88:ae:1d:b5:94:e1 8100 102: 802.1Q vid 1500 pri 2 192.168.0.1 192.168.0.2: icmp: echo request (id:21e1 seq:214) (DF) (ttl 64, id 0, len 84) 15:07:07.576788 88:ae:1d:b5:94:e1 00:1e:0b:2b:eb:ed 8100 102: 802.1Q vid 1500 pri 2 192.168.0.2 192.168.0.1: icmp: echo reply (id:21e1 seq:214) (ttl 64, id 42409, len 84) This was tested with an extreme networks summit 450 switch with prio tagging on the ports going into the fw on both sides and clients on untagged ports on both sides. Again, many thanks and I hope this could be implemented with or without a knob. //Peter
cwm: WM_TRANSIENT_FOR hint support
This diff moves dialogs, toolbars and such to the group of the main application window. Index: client.c === RCS file: /cvs/xenocara/app/cwm/client.c,v retrieving revision 1.86 diff -u -p -r1.86 client.c --- client.c14 Jul 2011 11:39:53 - 1.86 +++ client.c31 Aug 2011 14:13:41 - @@ -58,9 +58,10 @@ client_find(Window win) struct client_ctx * client_new(Window win, struct screen_ctx *sc, int mapped) { - struct client_ctx *cc; + struct client_ctx *cc, *tc; XWindowAttributeswattr; XWMHints*wmhints; + Window trans; int state; if (win == None) @@ -133,6 +134,10 @@ client_new(Window win, struct screen_ctx if (mapped) group_autogroup(cc); + + if (XGetTransientForHint(X_Dpy, win, trans)) + if ((tc = client_find(trans)) tc-group) + group_movetogroup(cc, tc-group-shortcut - 1); return (cc); } Index: xevents.c === RCS file: /cvs/xenocara/app/cwm/xevents.c,v retrieving revision 1.55 diff -u -p -r1.55 xevents.c --- xevents.c 22 Aug 2011 16:34:34 - 1.55 +++ xevents.c 31 Aug 2011 14:13:41 - @@ -181,7 +181,8 @@ xev_handle_propertynotify(XEvent *ee) { XPropertyEvent *e = ee-xproperty; struct screen_ctx *sc; - struct client_ctx *cc; + struct client_ctx *cc, *tc; + Window trans; if ((cc = client_find(e-window)) != NULL) { switch (e-atom) { @@ -191,6 +192,10 @@ xev_handle_propertynotify(XEvent *ee) case XA_WM_NAME: client_setname(cc); break; + case XA_WM_TRANSIENT_FOR: + if (XGetTransientForHint(X_Dpy, e-window, trans)) + if ((tc = client_find(trans)) tc-group) + group_movetogroup(cc, tc-group-shortcut - 1); default: /* do nothing */ break; -- Alexander Polakov | plhk.ru
Re: pflog shows 0.0.0.0.0 0.0.0.0.0
* Alexander Bluhm alexander.bl...@gmx.net [2011-08-30 20:59]: When pf_test_rule() is called for fragments that have not been reassembled, the address copy is not done anymore. good catch, new diff below. I think pf_setup_pdesc() should not call pf_test_rule() at all and just fill the pd struct. indeed, the test_rule call in the fragment case is a bit weird. But that is more work so I would suggest to copy the PF_ACPY() to the handle fragments that aren't reassembled by normalization. yup :) Index: pf.c === RCS file: /cvs/src/sys/net/pf.c,v retrieving revision 1.771 diff -u -p -r1.771 pf.c --- pf.c30 Aug 2011 00:40:47 - 1.771 +++ pf.c31 Aug 2011 15:01:06 - @@ -2762,9 +2762,6 @@ pf_test_rule(struct pf_rule **rm, struct u_int16_tvirtual_type, virtual_id; u_int8_t icmptype = 0, icmpcode = 0; - PF_ACPY(pd-nsaddr, pd-src, pd-af); - PF_ACPY(pd-ndaddr, pd-dst, pd-af); - bzero(act, sizeof(act)); act.prio[0] = act.prio[1] = PF_PRIO_NOTSET; bzero(sns, sizeof(sns)); @@ -2782,14 +2779,6 @@ pf_test_rule(struct pf_rule **rm, struct } switch (pd-virtual_proto) { - case IPPROTO_TCP: - pd-nsport = th-th_sport; - pd-ndport = th-th_dport; - break; - case IPPROTO_UDP: - pd-nsport = pd-hdr.udp-uh_sport; - pd-ndport = pd-hdr.udp-uh_dport; - break; #ifdef INET case IPPROTO_ICMP: icmptype = pd-hdr.icmp-icmp_type; @@ -2820,9 +2809,6 @@ pf_test_rule(struct pf_rule **rm, struct } break; #endif /* INET6 */ - default: - pd-nsport = pd-ndport = 0; - break; } pd-osport = pd-nsport; @@ -5679,6 +5665,13 @@ pf_setup_pdesc(sa_family_t af, int dir, m, *off, pd, a, ruleset, *hdrlen); if (*action != PF_PASS) REASON_SET(reason, PFRES_FRAG); + + PF_ACPY(pd-nsaddr, pd-src, pd-af); + PF_ACPY(pd-ndaddr, pd-dst, pd-af); + if (pd-sport) + pd-nsport = *pd-sport; + if (pd-dport) + pd-ndport = *pd-dport; return (-1); } break; @@ -5849,6 +5842,14 @@ pf_setup_pdesc(sa_family_t af, int dir, } #endif /* INET6 */ } + + PF_ACPY(pd-nsaddr, pd-src, pd-af); + PF_ACPY(pd-ndaddr, pd-dst, pd-af); + if (pd-sport) + pd-nsport = *pd-sport; + if (pd-dport) + pd-ndport = *pd-dport; + return (0); }
Re: pflog shows 0.0.0.0.0 0.0.0.0.0
On Wed, Aug 31, 2011 at 05:02:01PM +0200, Henning Brauer wrote: @@ -5679,6 +5665,13 @@ pf_setup_pdesc(sa_family_t af, int dir, m, *off, pd, a, ruleset, *hdrlen); if (*action != PF_PASS) REASON_SET(reason, PFRES_FRAG); + + PF_ACPY(pd-nsaddr, pd-src, pd-af); + PF_ACPY(pd-ndaddr, pd-dst, pd-af); You should set this a few lines above before calling pf_test_rule(). + if (pd-sport) + pd-nsport = *pd-sport; + if (pd-dport) + pd-ndport = *pd-dport; They are always NULL here. return (-1); } break; You have forgotten IPv6. What do you think about deduplicating this code? bluhm Index: net/pf.c === RCS file: /data/mirror/openbsd/cvs/src/sys/net/pf.c,v retrieving revision 1.771 diff -u -p -r1.771 pf.c --- net/pf.c30 Aug 2011 00:40:47 - 1.771 +++ net/pf.c31 Aug 2011 18:55:13 - @@ -5666,21 +5697,9 @@ pf_setup_pdesc(sa_family_t af, int dir, if (h-ip_hl 5) /* has options */ pd-badopts++; - if (h-ip_off htons(IP_MF | IP_OFFMASK)) { - /* -* handle fragments that aren't reassembled by -* normalization -*/ + if (h-ip_off htons(IP_MF | IP_OFFMASK)) pd-virtual_proto = PF_VPROTO_FRAGMENT; - if (kif == NULL || r == NULL) /* pflog */ - *action = PF_DROP; - else - *action = pf_test_rule(r, s, dir, kif, - m, *off, pd, a, ruleset, *hdrlen); - if (*action != PF_PASS) - REASON_SET(reason, PFRES_FRAG); - return (-1); - } + break; } #endif @@ -5763,21 +5782,9 @@ pf_setup_pdesc(sa_family_t af, int dir, pd-tot_len = ntohs(h-ip6_plen) + sizeof(struct ip6_hdr); pd-virtual_proto = pd-proto = nxt; - if (fragoff != 0) { - /* -* handle fragments that aren't reassembled by -* normalization -*/ + if (fragoff != 0) pd-virtual_proto = PF_VPROTO_FRAGMENT; - if (kif == NULL || r == NULL) /* pflog */ - *action = PF_DROP; - else - *action = pf_test_rule(r, s, dir, kif, - m, *off, pd, a, ruleset, *hdrlen); - if (*action != PF_PASS) - REASON_SET(reason, PFRES_FRAG); - return (-1); - } + break; } #endif @@ -5786,7 +5793,20 @@ pf_setup_pdesc(sa_family_t af, int dir, } - switch (pd-proto) { + switch (pd-virtual_proto) { + case PF_VPROTO_FRAGMENT: + /* +* handle fragments that aren't reassembled by +* normalization +*/ + if (kif == NULL || r == NULL) /* pflog */ + *action = PF_DROP; + else + *action = pf_test_rule(r, s, dir, kif, + m, *off, pd, a, ruleset, *hdrlen); + if (*action != PF_PASS) + REASON_SET(reason, PFRES_FRAG); + return (-1); case IPPROTO_TCP: { struct tcphdr *th = pd-hdr.tcp;
Re: CVS: cvs.openbsd.org: src
On Wed, Aug 31, 2011 at 12:56:30PM -0600, Gilles Chehade wrote: Log message: add support for per-line DATA callbacks, this allows filters to take their decisions *while* the message is being received by the client. Until filters are enabled, this should not impact anyone ... however it is in the execution path of *all* incoming messages (both network and enqueue). It's been tested for days and should work just fine for everyone. If you run into an issue, please let me know *asap* before I stack more code on top of it ;-) -- Gilles Chehade http://www.poolp.org/http://u.poolp.org/~gilles/
Re: ksh history corruption
On Wed, Aug 31, 2011 at 07:20:42AM -0500, Marco Peereboom wrote: On Wed, Aug 31, 2011 at 02:13:19PM +0200, LEVAI Daniel wrote: On Wed, Aug 31, 2011 at 06:57:34 -0500, Marco Peereboom wrote: On Wed, Aug 31, 2011 at 11:59:29AM +0200, LEVAI Daniel wrote: On Tue, Aug 30, 2011 at 13:55:57 -0500, Marco Peereboom wrote: On Tue, Aug 30, 2011 at 11:11:46AM -0500, Marco Peereboom wrote: I have had enough of corrupt ksh history so I had a look at the code to try to fix it. The magical code was very magical so I basically deleted most of it and made ksh history into a flat text file. It handles multiple ksh instances writing to the same text file with locks just like the current ksh does. I haven't noticed any differences in behavior running this. If one had set HISTFILE='', the old behaviour was to not write a history file, but the in memory history was still working. With this patch, if I set HISTFILE='' then there will be no command history at all. This is the same with current ksh. Not for me. Currently if I set HISTFILE to '' then in-memory history works but it doesn't write to history file (which was my intention when I've set HISTFILE=''). Hmmm, I tried again and now I see it. I blame it on not enough coffee. Thanks I'll go figure it out. Version 4 fixes all reported bugs. Some folks have expressed doubt about the simplistic way of updating the history file. Specifically the rewriting of all entries. I am sensitive to that and know a couple of optimizations that can easily be applied. However before I go there I'd like to get a thumbs up or down on this approach. It trashes the binary history file format and replaces it with flat text. Is this something we want? Index: alloc.c === RCS file: /cvs/src/bin/ksh/alloc.c,v retrieving revision 1.8 diff -u -p -r1.8 alloc.c --- alloc.c 21 Jul 2008 17:30:08 - 1.8 +++ alloc.c 30 Aug 2011 18:05:47 - @@ -62,7 +62,7 @@ alloc(size_t size, Area *ap) { struct link *l; - l = malloc(sizeof(struct link) + size); + l = calloc(1, sizeof(struct link) + size); if (l == NULL) internal_errorf(1, unable to allocate memory); l-next = ap-freelist; Index: history.c === RCS file: /cvs/src/bin/ksh/history.c,v retrieving revision 1.39 diff -u -p -r1.39 history.c --- history.c 19 May 2010 17:36:08 - 1.39 +++ history.c 31 Aug 2011 19:33:24 - @@ -11,8 +11,7 @@ * a) the original in-memory history mechanism * b) a more complicated mechanism done by p...@hillside.co.uk * that more closely follows the real ksh way of doing - * things. You need to have the mmap system call for this - * to work on your system + * things. */ #include sh.h @@ -22,19 +21,10 @@ # include sys/file.h # include sys/mman.h -/* - * variables for handling the data file - */ -static int histfd; -static int hsize; - -static int hist_count_lines(unsigned char *, int); -static int hist_shrink(unsigned char *, int); -static unsigned char *hist_skip_back(unsigned char *,int *,int); -static void histload(Source *, unsigned char *, int); -static void histinsert(Source *, int, unsigned char *); -static void writehistfile(int, char *); -static int sprinkle(int); +static voidwritehistfile(FILE *); +static FILE*history_open(int *); +static int history_load(FILE *, Source *); +static voidhistory_close(FILE *); static int hist_execute(char *); static int hist_replace(char **, const char *, const char *, int); @@ -45,8 +35,8 @@ static void histbackup(void); static char **current; /* current position in history[] */ static char*hname; /* current name of history file */ static int hstarted; /* set after hist_init() called */ -static Source *hist_source; - +static Source *hist_source; +static struct stat last_sb; int c_fc(char **wp) @@ -529,15 +519,10 @@ sethistfile(const char *name) /* if the name is the same as the name we have */ if (hname strcmp(hname, name) == 0) return; - /* * its a new name - possibly */ - if (histfd) { - /* yes the file is open */ - (void) close(histfd); - histfd = 0; - hsize = 0; + if (hname) { afree(hname, APERM); hname = NULL; /* let's reset the history */ @@ -577,18 +562,26 @@ init_histvec(void) void histsave(int lno, const char *cmd, int dowrite) { - char **hp; - char *c, *cp; + char**hp; + char*c, *cp; + int changed; + FILE*f = NULL; + + if (dowrite) { +
Re: hide kernel threads in ps?
On Wed, Aug 31, 2011, Uwe Stuehler wrote: Help! My Nagios checks failed. :) This fixes them by hiding kernel threads from ps output. I'd also like to show the main process ID in the PID column as otherwise there is no way of knowing which threads belong together. Likely struct kinfo_proc would need a change for that... Maybe in another step. comments? Is H the best letter? maybe t?
Re: ksh history corruption
On 08/31/2011 03:42 PM, Marco Peereboom wrote: Version 4 fixes all reported bugs. Some folks have expressed doubt about the simplistic way of updating the history file. Specifically the rewriting of all entries. I am sensitive to that and know a couple of optimizations that can easily be applied. However before I go there I'd like to get a thumbs up or down on this approach. It trashes the binary history file format and replaces it with flat text. Is this something we want? IMnsHO, external non-text files have serious maintenance problems including version dependency. Does the external binary file have any significant advantages over flat text? If not, my experience is that flat text is 99+% a better choice for maintainability, interchangeability, and general obviousness. If an internal binary format has significant advantages, is the cost of conversion significant (coding time and execution time?) If not, go with an external text format for the above reasons. Pure appends have a stylistic appeal as well. Anecdotally, almost no-one has been able to show me real-world efficiency gains from binary files for applications where a text file works, especially for ones read once and/or written once per program invocation. geoff steckel gwes at oat mumble com
Re: hide kernel threads in ps?
Date: Wed, 31 Aug 2011 16:38:41 -0400 From: Ted Unangst t...@tedunangst.com On Wed, Aug 31, 2011, Uwe Stuehler wrote: Help! My Nagios checks failed. :) This fixes them by hiding kernel threads from ps output. I'd also like to show the main process ID in the PID column as otherwise there is no way of knowing which threads belong together. Likely struct kinfo_proc would need a change for that... Maybe in another step. comments? Is H the best letter? maybe t? It's what FreeBSD uses. And t and T are already taken.
Re: ksh history corruption
On Wed, Aug 31, 2011 at 04:41:07PM -0400, Geoff Steckel wrote: On 08/31/2011 03:42 PM, Marco Peereboom wrote: Version 4 fixes all reported bugs. Some folks have expressed doubt about the simplistic way of updating the history file. Specifically the rewriting of all entries. I am sensitive to that and know a couple of optimizations that can easily be applied. However before I go there I'd like to get a thumbs up or down on this approach. It trashes the binary history file format and replaces it with flat text. Is this something we want? IMnsHO, external non-text files have serious maintenance problems including version dependency. Does the external binary file have any significant advantages over flat text? If not, my experience is that flat text is 99+% a better choice for maintainability, interchangeability, and general obviousness. If an internal binary format has significant advantages, is the cost of conversion significant (coding time and execution time?) If not, go with an external text format for the above reasons. It has one benefit in the ksh case. It retains the line number; the flat text file obviously can't do that without introducing side effects. Now I don't know why having persistent line numbers is useful but that aside. Oh, and it gets corrupted from time to time and one does not have a chance of (without writing some code) of recovering some or any of it. I tend to lose a history file every month or so. Pure appends have a stylistic appeal as well. Anecdotally, almost no-one has been able to show me real-world efficiency gains from binary files for applications where a text file works, especially for ones read once and/or written once per program invocation. geoff steckel gwes at oat mumble com
Re: hide kernel threads in ps?
On Wed, Aug 31, 2011 at 11:50 PM, Philip Guenther guent...@gmail.com wrote: As is -L, which is used for threads (LWPs) by Solaris and FreeBSD. B sigh Part of me would be tempted to reuse -k, changing it from unsuppressing P_SYSTEM procs to unsuppressing P_THREAD procs. B Then process 0 would show up by default too... Hmm. I agree that it may not be necessary to control the display of P_SYSTEM procs separately, but as mnemonic, -k sounds like kernel, kthread, and there's no k in tHread. :) If -k would become free for other uses, just for consideration: - in FreeBSD and Solaris, -k is unused - in NetBSD, -k specifies the sort order - in Linux' procps, k specifies the sort order As for -H: - in FreeBSD, -H shows kernel visible threads (and ps -Hx shows threads of kernel threads as well, whereas ps -x shows just the main thread/proc) - in NetBSD, -H is unused - in Linux, -H switches to a tree display - in Solaris, -H enables the locality group column (LGRP) (I've done just a quick cross-check. Maybe I missed something.)
Re: hide kernel threads in ps?
On 1 September 2011 10:21, Uwe Stuehler u...@openbsd.org wrote: If -k would become free for other uses, just for consideration: - in FreeBSD and Solaris, -k is unused - in NetBSD, -k specifies the sort order - in Linux' procps, k specifies the sort order -k in AIX /usr/bin/ps is documented as Lists kernel processes in the manpage. This ps implementation has a split personality like Linux procps, in that SysVish and BSDish syntax both work. AIX /usr/sysv/ps doesn't have a -k option. Tru64 4.0 doesn't seem to support -k at all. AIX is the only commercial UNIX I'm seeing in job listings these days, for what that's worth. Solaris seems to be a corpse, and the flies are swarming. I guess people really don't need DTrace and ZFS after all ;-) John
Re: systrace(1,4) support for *at(2)
On Wed, Aug 31, 2011 at 06:26:58PM -0700, Matthew Dempsky wrote: Diff below adds support to systrace(1) for the new *at(2) system calls. (I'll send a followup diff for the ports tree.) And the promised ports systrace.filter diff: Index: infrastructure/db/systrace.filter === RCS file: /home/mdempsky/anoncvs/cvs/ports/infrastructure/db/systrace.filter,v retrieving revision 1.29 diff -u -p -r1.29 systrace.filter --- infrastructure/db/systrace.filter 20 Jul 2011 18:11:06 - 1.29 +++ infrastructure/db/systrace.filter 26 Aug 2011 05:45:06 - @@ -47,7 +47,17 @@ native-fchdir: permit native-fchflags: permit native-fchmod: permit + native-fchmodat: filename match /tmp then permit + native-fchmodat: filename match /var/tmp then permit + native-fchmodat: filename match ${TMPDIR} then permit + native-fchmodat: filename match ${WRKDIR} then permit + native-fchmodat: filename match /non-existent filename: * then deny[enoent] native-fchown: permit + native-fchownat: filename match /tmp then permit + native-fchownat: filename match /var/tmp then permit + native-fchownat: filename match ${TMPDIR} then permit + native-fchownat: filename match ${WRKDIR} then permit + native-fchownat: filename match /non-existent filename: * then deny[enoent] native-fcntl: permit native-flock: permit native-fork: permit @@ -108,6 +118,11 @@ native-link: filename match ${TMPDIR} and filename[1] match ${TMPDIR} then permit native-link: filename match ${WRKDIR} and filename[1] match ${WRKDIR} then permit native-link: filename match /non-existent filename: * then deny[enoent] + native-linkat: filename match /tmp and filename[1] match /tmp then permit + native-linkat: filename match /var/tmp and filename[1] match /var/tmp then permit + native-linkat: filename match ${TMPDIR} and filename[1] match ${TMPDIR} then permit + native-linkat: filename match ${WRKDIR} and filename[1] match ${WRKDIR} then permit + native-linkat: filename match /non-existent filename: * then deny[enoent] native-listen: permit native-lseek: permit native-madvise: permit @@ -115,6 +130,10 @@ native-mknod: filename match /var/tmp then permit native-mknod: filename match ${TMPDIR} then permit native-mknod: filename match ${WRKDIR} then permit + native-mknodat: filename match /tmp then permit + native-mknodat: filename match /var/tmp then permit + native-mknodat: filename match ${TMPDIR} then permit + native-mknodat: filename match ${WRKDIR} then permit native-mincore: permit native-mlock: permit native-mlockall: permit @@ -145,6 +164,15 @@ native-rename: filename match ${TMPDIR} and filename[1] match ${WRKDIR} then permit native-rename: filename match ${WRKDIR} and filename[1] match ${WRKDIR} then permit native-rename: filename match /non-existent filename: * then deny[enoent] + native-renameat: filename match /tmp and filename[1] match /tmp then permit + native-renameat: filename match /tmp and filename[1] match /var/tmp then permit + native-renameat: filename match /tmp and filename[1] match ${WRKDIR} then permit + native-renameat: filename match /var/tmp and filename[1] match /var/tmp then permit + native-renameat: filename match /var/tmp and filename[1] match ${WRKDIR} then permit + native-renameat: filename match ${TMPDIR} and filename[1] match ${TMPDIR} then permit + native-renameat: filename match ${TMPDIR} and filename[1] match ${WRKDIR} then permit + native-renameat: filename match ${WRKDIR} and filename[1] match ${WRKDIR} then permit + native-renameat: filename match /non-existent filename: * then deny[enoent] native-rfork: permit native-select: permit native-semctl: permit @@ -189,6 +217,12 @@ native-symlink: filename match ${WRKDIR} then permit native-symlink: filename match /non-existent filename: * then deny[enoent] native-symlink: string eq and filename eq then deny[enoent] + native-symlinkat: filename match /tmp then permit + native-symlinkat: filename match /var/tmp then permit + native-symlinkat: filename match ${TMPDIR} then permit + native-symlinkat: filename match ${WRKDIR} then permit + native-symlinkat: filename match /non-existent filename: * then deny[enoent] + native-symlinkat: string eq and filename eq then deny[enoent] native-sync: permit native-umask: permit native-utimensat: permit