Uwe Stuehler | 1 Sep 02:21 2011
Picon

Re: hide kernel threads in ps?

On Wed, Aug 31, 2011 at 11:50 PM, Philip Guenther <guenther <at> 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.)

john slee | 1 Sep 03:12 2011

Re: hide kernel threads in ps?

On 1 September 2011 10:21, Uwe Stuehler <uwe <at> 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

Matthew Dempsky | 1 Sep 03:26 2011

systrace(1,4) support for *at(2)

Diff below adds support to systrace(1) for the new *at(2) system
calls.  (I'll send a followup diff for the ports tree.)

It's received some light testing from jasper <at>  and myself, so it could
now use some wider testing as well as an extra set of eyes to review
the code.

Index: sys/dev/systrace.h
===================================================================
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/systrace.h,v
retrieving revision 1.22
diff -u -p -r1.22 systrace.h
--- sys/dev/systrace.h	22 Jun 2011 01:32:16 -0000	1.22
+++ sys/dev/systrace.h	26 Aug 2011 01:30:05 -0000
 <at>  <at>  -167,6 +167,11  <at>  <at>  struct systrace_inject {
 	pid_t   stri_pid;
 };

+struct systrace_getcwd {
+	pid_t	strgd_pid;
+	int	strgd_atfd;
+};
+
 #define STRIOCCLONE		_IOR('s', 100, int)
 #define SYSTR_CLONE		STRIOCCLONE
 #define STRIOCATTACH		_IOW('s', 101, pid_t)
 <at>  <at>  -174,7 +179,7  <at>  <at>  struct systrace_inject {
 #define STRIOCANSWER		_IOW('s', 103, struct systrace_answer)
 #define STRIOCIO		_IOWR('s', 104, struct systrace_io)
 #define STRIOCPOLICY		_IOWR('s', 105, struct systrace_policy)
(Continue reading)

Matthew Dempsky | 1 Sep 03:28 2011

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 -0000	1.29
+++ infrastructure/db/systrace.filter	26 Aug 2011 05:45:06 -0000
 <at>  <at>  -47,7 +47,17  <at>  <at> 
 	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
(Continue reading)

LEVAI Daniel | 1 Sep 08:18 2011
Picon

Re: ksh history corruption

On Wed, Aug 31, 2011 at 14:42:26 -0500, 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?

Great, thanks, works with and without a HISTFILE.

Although, I've never used a history file, if this fixes something then
definitely yes, *but* please reconsider merging the various great
improvements too, that Alexander has created [1] in the past months.
(my favorites are the completion improvements and #8 :) ).

They are stable; I have been testing them since he had posted the diffs
on tech <at> .

Daniel

[1] http://plhk.ru/trash/ksh/

--

-- 
LIVAI Daniel
PGP key ID = 0x83B63A8F
Key fingerprint = DBEC C66B A47A DFA2 792D  650C C69B BE4C 83B6 3A8F

(Continue reading)

Alexander Bluhm | 1 Sep 10:21 2011
Picon
Picon

relayd session timeout

Hi,

The relayd used the CHECK_TIMEOUT for connect and ssl handshake.
This is 200 milliseconds and too short.  Instead use the 600 seconds
session timeout that is used for accepted sessions everywhere else.

While there, make flag handling in relay_ssl_transaction() consistent
to the other functions.

ok?

bluhm

Index: usr.sbin/relayd/relay.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/relayd/relay.c,v
retrieving revision 1.138
diff -u -p -r1.138 relay.c
--- usr.sbin/relayd/relay.c	20 May 2011 09:43:53 -0000	1.138
+++ usr.sbin/relayd/relay.c	1 Sep 2011 07:58:40 -0000
 <at>  <at>  -2279,7 +2279,8  <at>  <at>  relay_connect(struct rsession *con)

 	if (errno == EINPROGRESS)
 		event_again(&con->se_ev, con->se_out.s, EV_WRITE|EV_TIMEOUT,
-		    relay_connected, &con->se_tv_start, &env->sc_timeout, con);
+		    relay_connected, &con->se_tv_start, &rlay->rl_conf.timeout, 
+		    con);
 	else
 		relay_connected(con->se_out.s, EV_WRITE, con);

(Continue reading)

Marco Peereboom | 1 Sep 16:37 2011
Picon

Re: ksh history corruption

todd had his panties in a wad about backwards compatibility so I lifted
the ksh history load code out of ksh to dump it in a text file.  Compile
like:
"cc kshconv.c -o kshconv"

then run it like:
"./kshconv -i ~/.hist -o texthist"

Conversion code:
=================================== 8< ===================================
#include <stdio.h>
#include <stdlib.h>
#include <err.h>
#include <sys/types.h>
#include <sys/mman.h>

#define HMAGIC1		0xab
#define HMAGIC2		0xcd
#define COMMAND		0xff

extern char		*__progname;

typedef enum state {
	shdr,		/* expecting a header */
	sline,		/* looking for a null byte to end the line */
	sn1,		/* bytes 1 to 4 of a line no */
	sn2, sn3, sn4
} State;

void
(Continue reading)

Alexander Bluhm | 1 Sep 17:23 2011
Picon
Picon

relayd close before connect

Hi,

Especially with SSL and short data transfers, it could happen that
the client closed before the connection to the server has been
established.  Then the relay closed immediately before transferring
any data.  The solution is to delay the close until the other side
has an event buffer.

ok?

bluhm

Index: usr.sbin/relayd/relay.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/relayd/relay.c,v
retrieving revision 1.138
diff -u -p -r1.138 relay.c
--- usr.sbin/relayd/relay.c	20 May 2011 09:43:53 -0000	1.138
+++ usr.sbin/relayd/relay.c	1 Sep 2011 12:14:05 -0000
 <at>  <at>  -1892,7 +1895,8  <at>  <at>  relay_error(struct bufferevent *bev, sho
 			dst = EVBUFFER_OUTPUT(cre->dst->bev);
 			if (EVBUFFER_LENGTH(dst))
 				return;
-		}
+		} else
+			return;

 		relay_close(con, "done");
 		return;

(Continue reading)

Stuart Henderson | 1 Sep 17:24 2011

cpuid; intel cpu RDRAND

Is it worth adding this to the list of cpu flags printed yet?

http://software.intel.com/en-us/articles/download-the-latest-bull-mountain-software-implementation-guide/

Index: arch/amd64/include/specialreg.h
===================================================================
RCS file: /cvs/src/sys/arch/amd64/include/specialreg.h,v
retrieving revision 1.19
diff -u -p -r1.19 specialreg.h
--- arch/amd64/include/specialreg.h	29 Apr 2010 17:00:48 -0000	1.19
+++ arch/amd64/include/specialreg.h	1 Sep 2011 15:19:59 -0000
 <at>  <at>  -146,6 +146,7  <at>  <at> 
 #define CPUIDECX_XSAVE	0x04000000	/* XSAVE/XSTOR States */
 #define CPUIDECX_OSXSAVE	0x08000000	/* OSXSAVE */
 #define CPUIDECX_AVX	0x10000000	/* Advanced Vector Extensions */
+#define CPUIDECX_RDRAND	0x40000000	/* Bull Mountain (digital RNG) */

 /*
  * AMD/VIA processor specific flags.
Index: arch/i386/include/specialreg.h
===================================================================
RCS file: /cvs/src/sys/arch/i386/include/specialreg.h,v
retrieving revision 1.39
diff -u -p -r1.39 specialreg.h
--- arch/i386/include/specialreg.h	29 Apr 2010 17:00:48 -0000	1.39
+++ arch/i386/include/specialreg.h	1 Sep 2011 15:19:59 -0000
 <at>  <at>  -155,6 +155,7  <at>  <at> 
 #define CPUIDECX_XSAVE	0x04000000	/* XSAVE/XSTOR States */
 #define CPUIDECX_OSXSAVE	0x08000000	/* OSXSAVE */
 #define CPUIDECX_AVX	0x10000000	/* Advanced Vector Extensions */
(Continue reading)

Marco Peereboom | 1 Sep 22:22 2011
Picon

Re: ksh history corruption

Alright this diff keeps the file open and appends lines to HISTFILE.  It
only rewrites HISTFILE at 125% of HISTSIZE.  Does fancy locking and
deals with signals too.  So unless someone finds some bugs I'll consider
this version final.

Yes, no on moving ksh history to text?

Other comments?

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 -0000	1.8
+++ alloc.c	30 Aug 2011 18:05:47 -0000
 <at>  <at>  -62,7 +62,7  <at>  <at>  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
(Continue reading)


Gmane