Re: How to have more than 15 pflog interfaces?

2012-04-12 Thread Henning Brauer
* patrick keshishian pkesh...@gmail.com [2012-04-12 00:52]:
 On Wed, Apr 11, 2012 at 3:14 PM, Henning Brauer
 lists-openbsdt...@bsws.de wrote:
  * patrick keshishian sids...@boxsoft.com [2012-04-11 14:55]:
  On Wed, Apr 11, 2012 at 12:20:30PM +0200, Henning Brauer wrote:
  don't you need two different index vars for this next
  section?
  no, why?
 I put the caveat that I am not familiar with the code (and its use).
 So apologies if I'm making grave assumptions on the use case (more
 below).
 
   +   for (i = 0; i  n; i++)
   +   if (i  npflogifs)
   +   p[i] = pflogifs[i];
   +   else
   +   p[i] = NULL;
 
  i think that is pretty clear: each slot in the newly allocated p gets
  the same value as it had in the old pflogifs, once we're at the end of
  pflogifs we set the remaining slots to NULL. unused slots were NULL
  before so just inheriting the NULL is safe.
 
 Unless pflog_clone_destroy() takes out one in the middle of the list.

what is the problem then? the slot is NULL in pflogofs then and we
copy that NULL. all good.

 Now, if it is the case that pflog_clone_destroy() won't ever take out
 an entry in the middle of pflogifs, then ignore my comments.

take out? a slot can be nulled. the index is the interface index, so
if just pflog25 exists that array has 26 entries.

 OK. So the _destroy() code will always take out entries from the end
 of the pflogifs array.

no, but your might be confused about the take out, see above.
pflogifs[25] is always pflog25, no matter how many pflog interfaces
exist.

-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services, http://bsws.de, Full-Service ISP
Secure Hosting, Mail and DNS Services. Dedicated Servers, Root to Fully Managed
Henning Brauer Consulting, http://henningbrauer.com/



Re: getline missing in stdio(3)

2012-04-12 Thread Jason McIntyre
On Tue, Apr 10, 2012 at 03:33:44PM +0200, Jan Stary wrote:
 Recently, getdelim() and getline() were commited to stdio.
 Shouldn't they also be mentioned in stdio(3)?
 
 (While at it, fixed a grammar glitch.)
 
   Jan
 

fix-ed. thanks!
jmc

 
 Index: stdio.3
 ===
 RCS file: /cvs/src/lib/libc/stdio/stdio.3,v
 retrieving revision 1.22
 diff -u -p -u -p -r1.22 stdio.3
 --- stdio.3   3 Sep 2011 23:24:51 -   1.22
 +++ stdio.3   10 Apr 2012 13:30:11 -
 @@ -95,7 +95,7 @@ files.
  Neither does an exit due to a signal.
  Buffers are flushed by
  .Xr abort 3
 -as required by POSIX, although previous implementations did not.
 +as required by POSIX, although in previous implementations they were not.
  .Pp
  This implementation needs and makes
  no distinction between
 @@ -237,6 +237,8 @@ definitions are explicitly removed.
  .It fwrite Ta binary stream input/output
  .It getc Ta get next character or word from input stream
  .It getchar Ta get next character or word from input stream
 +.It getdelim Ta read a delimited record from a stream
 +.It getline Ta read a delimited record from a stream
  .It gets Ta get a line from a stream
  .It getw Ta get next character or word from input stream
  .It mkstemp Ta create unique temporary file



Re: How to have more than 15 pflog interfaces?

2012-04-12 Thread Henning Brauer
* Henning Brauer lists-openbsdt...@bsws.de [2012-04-12 10:11]:
 take out? a slot can be nulled. the index is the interface index, so
 if just pflog25 exists that array has 26 entries.

s/interface index/unit number/

-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services, http://bsws.de, Full-Service ISP
Secure Hosting, Mail and DNS Services. Dedicated Servers, Root to Fully Managed
Henning Brauer Consulting, http://henningbrauer.com/



Re: move accounting flags from the proc to the process

2012-04-12 Thread Mike Belopuhov
On Wed, Apr 11, 2012 at 19:30 +0200, Mike Belopuhov wrote:
 This moves the accounting flag to struct process where it belongs.
 The main rationale is that accounting flags are being collected on
 the program exit.  Ok?
 

don't set AFORK when forking threads pointed out by guenther;
missed suser bits.

Index: kern/kern_acct.c
===
RCS file: /cvs/src/sys/kern/kern_acct.c,v
retrieving revision 1.24
diff -u -p -r1.24 kern_acct.c
--- kern/kern_acct.c23 Mar 2012 15:51:26 -  1.24
+++ kern/kern_acct.c12 Apr 2012 10:00:08 -
@@ -224,7 +224,7 @@ acct_process(struct proc *p)
acct.ac_tty = NODEV;
 
/* (8) The boolean flags that tell how the process terminated, etc. */
-   acct.ac_flag = p-p_acflag;
+   acct.ac_flag = pr-ps_acflag;
 
/*
 * Now, just write the accounting information to the file.
Index: kern/kern_exec.c
===
RCS file: /cvs/src/sys/kern/kern_exec.c,v
retrieving revision 1.127
diff -u -p -r1.127 kern_exec.c
--- kern/kern_exec.c26 Mar 2012 04:19:55 -  1.127
+++ kern/kern_exec.c12 Apr 2012 10:00:08 -
@@ -475,7 +475,7 @@ sys_execve(struct proc *p, void *v, regi
bzero(p-p_comm, sizeof(p-p_comm));
len = min(nid.ni_cnd.cn_namelen, MAXCOMLEN);
bcopy(nid.ni_cnd.cn_nameptr, p-p_comm, len);
-   p-p_acflag = ~AFORK;
+   pr-ps_acflag = ~AFORK;
 
/* record proc's vnode, for use by procfs and others */
if (p-p_textvp)
Index: kern/kern_fork.c
===
RCS file: /cvs/src/sys/kern/kern_fork.c,v
retrieving revision 1.136
diff -u -p -r1.136 kern_fork.c
--- kern/kern_fork.c10 Apr 2012 15:50:52 -  1.136
+++ kern/kern_fork.c12 Apr 2012 10:00:09 -
@@ -501,7 +501,8 @@ fork1(struct proc *curp, int exitsig, in
 */
SCHED_LOCK(s);
getmicrotime(pr-ps_start);
-   p-p_acflag = AFORK;
+   if ((flags  FORK_THREAD) == 0)
+   pr-ps_acflag = AFORK;
p-p_stat = SRUN;
p-p_cpu = sched_choosecpu_fork(curp, flags);
setrunqueue(p);
Index: kern/kern_prot.c
===
RCS file: /cvs/src/sys/kern/kern_prot.c,v
retrieving revision 1.53
diff -u -p -r1.53 kern_prot.c
--- kern/kern_prot.c10 Apr 2012 15:50:52 -  1.53
+++ kern/kern_prot.c12 Apr 2012 10:00:09 -
@@ -763,7 +763,7 @@ suser(struct proc *p, u_int flags)
 
if (cred-cr_uid == 0) {
if (!(flags  SUSER_NOACCT))
-   p-p_acflag |= ASU;
+   p-p_p-ps_acflag |= ASU;
return (0);
}
return (EPERM);
Index: kern/kern_sig.c
===
RCS file: /cvs/src/sys/kern/kern_sig.c,v
retrieving revision 1.139
diff -u -p -r1.139 kern_sig.c
--- kern/kern_sig.c 11 Apr 2012 15:28:50 -  1.139
+++ kern/kern_sig.c 12 Apr 2012 10:00:09 -
@@ -1345,7 +1345,7 @@ sigexit(struct proc *p, int signum)
/* Mark process as going away */
atomic_setbits_int(p-p_flag, P_WEXIT);
 
-   p-p_acflag |= AXSIG;
+   p-p_p-ps_acflag |= AXSIG;
if (sigprop[signum]  SA_CORE) {
p-p_sisig = signum;
 
@@ -1444,7 +1444,7 @@ coredump(struct proc *p)
VATTR_NULL(vattr);
vattr.va_size = 0;
VOP_SETATTR(vp, vattr, cred, p);
-   p-p_acflag |= ACORE;
+   p-p_p-ps_acflag |= ACORE;
 
io.io_proc = p;
io.io_vp = vp;
Index: sys/proc.h
===
RCS file: /cvs/src/sys/sys/proc.h,v
retrieving revision 1.155
diff -u -p -r1.155 proc.h
--- sys/proc.h  11 Apr 2012 15:28:50 -  1.155
+++ sys/proc.h  12 Apr 2012 10:00:09 -
@@ -202,6 +202,8 @@ struct process {
u_int   pr_scale;   /* pc scaling */
} ps_prof;
 
+   u_short ps_acflag;  /* Accounting flags. */
+
 /* End area that is copied on creation. */
 #define ps_endcopy ps_refcnt
 
@@ -344,7 +346,6 @@ struct proc {
u_long  p_prof_ticks;   /* temp storage for profiling ticks util AST */
 
u_short p_xstat;/* Exit status for wait; also stop signal. */
-   u_short p_acflag;   /* Accounting flags. */
 };
 
 /* Status values. */
Index: sys/sysctl.h
===
RCS file: /cvs/src/sys/sys/sysctl.h,v
retrieving revision 1.122
diff -u -p -r1.122 sysctl.h
--- sys/sysctl.h10 Apr 2012 15:50:52 -  1.122
+++ sys/sysctl.h12 Apr 2012 10:00:09 -
@@ -519,7 +519,7 @@ do {
\
(kp)-p_nice = (pr)-ps_nice;   \

diff: IUTF8 support

2012-04-12 Thread Matthew Dempsky
While reading the mosh research paper[1], I noticed we don't have
IUTF8, which is necessary for backspace to work correctly in canonical
mode (ICANON) with UTF-8 characters.

[1] http://mosh.mit.edu/mosh-paper-draft.pdf

I took a quick stab at implementing it, and it didn't seem too bad.
See kernel diff below along with a corresponding fix to xterm(1) to
actually make use of it on OpenBSD.

I've only played with it for a little while, but I haven't noticed any
issues with various mixes of backspace, ^W, and tabs.  I'm going to
try to write some regress tests for it now, so I'm very interested if
anyone notices any issues or differences in behavior from Linux.

I suspect Unicode combining characters behave oddly, but Linux doesn't
worry about those either as far as I can tell.


Index: src/sys/sys/termios.h
===
RCS file: /cvs/src/sys/sys/termios.h,v
retrieving revision 1.11
diff -u -p -r1.11 termios.h
--- src/sys/sys/termios.h   26 Dec 2009 09:46:17 -  1.11
+++ src/sys/sys/termios.h   12 Apr 2012 12:33:04 -
@@ -101,7 +101,8 @@
 #if __BSD_VISIBLE
 #defineIXANY   0x0800  /* any char will restart after 
stop */
 #defineIUCLC   0x1000  /* translate upper to lower 
case */
-#define IMAXBEL0x2000  /* ring bell on input queue 
full */
+#defineIMAXBEL 0x2000  /* ring bell on input queue 
full */
+#defineIUTF8   0x4000  /* input stream is UTF-8 
encoded */
 #endif /* __BSD_VISIBLE */
 
 /*
Index: src/sys/kern/tty.c
===
RCS file: /cvs/src/sys/kern/tty.c,v
retrieving revision 1.94
diff -u -p -r1.94 tty.c
--- src/sys/kern/tty.c  23 Mar 2012 15:51:26 -  1.94
+++ src/sys/kern/tty.c  12 Apr 2012 12:33:04 -
@@ -163,6 +163,8 @@ u_char const char_type[] = {
 #definetolower(c)  ((c) - 'A' + 'a')
 #definetoupper(c)  ((c) - 'a' + 'A')
 
+#define iscont(tp, c)  (((tp)-t_iflag  IUTF8)  (c) = 0x80  (c)  0xc0)
+
 struct ttylist_head ttylist;   /* TAILQ_HEAD */
 int tty_count;
 
@@ -441,8 +443,12 @@ parmrk:(void)putc(0377 | 
TTY_QUOTE, 
 * erase (^H / ^?)
 */
if (CCEQ(cc[VERASE], c)) {
-   if (tp-t_rawq.c_cc)
-   ttyrub(unputc(tp-t_rawq), tp);
+   do {
+   c = unputc(tp-t_rawq);
+   if (c == -1)
+   break;
+   ttyrub(c, tp);
+   } while (iscont(tp, c));
goto endcase;
}
/*
@@ -698,7 +704,8 @@ ttyoutput(int c, struct tty *tp)
col = 0;
break;
case ORDINARY:
-   ++col;
+   if (!iscont(tp, c))
+   ++col;
break;
case TAB:
col = (col + 8)  ~7;
@@ -1874,6 +1881,8 @@ ttyrub(int c, struct tty *tp)
int tabc, s;
 
if (!ISSET(tp-t_lflag, ECHO) || ISSET(tp-t_lflag, EXTPROC))
+   return;
+   if (iscont(tp, c))
return;
CLR(tp-t_lflag, FLUSHO);
if (ISSET(tp-t_lflag, ECHOE)) {
Index: xenocara/app/xterm/main.c
===
RCS file: /cvs/xenocara/app/xterm/main.c,v
retrieving revision 1.22
diff -u -p -r1.22 main.c
--- xenocara/app/xterm/main.c   16 Nov 2011 21:14:25 -  1.22
+++ xenocara/app/xterm/main.c   12 Apr 2012 12:33:04 -
@@ -3836,7 +3836,7 @@ spawnXTerm(XtermWidget xw)
/* input: nl-nl, don't ignore cr, cr-nl */
UIntClr(tio.c_iflag, (INLCR | IGNCR));
tio.c_iflag |= ICRNL;
-#if OPT_WIDE_CHARS  defined(linux)  defined(IUTF8)
+#if OPT_WIDE_CHARS  defined(IUTF8)
 #if OPT_LUIT_PROG
if (command_to_exec_with_luit == 0)
 #endif



Waiting!

2012-04-12 Thread cliff
Got a proposition for you,reply for futher details.



Re: ps axH per-thread usage times

2012-04-12 Thread Paul Irofti
Now with libkvm bits as well. Okay?


Index: sys/sys/sysctl.h
===
RCS file: /cvs/src/sys/sys/sysctl.h,v
retrieving revision 1.122
diff -u -p -r1.122 sysctl.h
--- sys/sys/sysctl.h10 Apr 2012 15:50:52 -  1.122
+++ sys/sys/sysctl.h12 Apr 2012 14:03:34 -
@@ -466,7 +466,7 @@ struct kinfo_proc {
 
 #define PTRTOINT64(_x) ((u_int64_t)(u_long)(_x))
 
-#define FILL_KPROC(kp, copy_str, p, pr, pc, uc, pg, paddr, praddr, sess, vm, 
lim, sa) \
+#define FILL_KPROC(kp, copy_str, p, pr, pc, uc, pg, paddr, praddr, sess, vm, 
lim, sa, isthread) \
 do {   \
memset((kp), 0, sizeof(*(kp))); \
\
@@ -498,15 +498,24 @@ do {  
\
(kp)-p_jobc = (pg)-pg_jobc;   \
\
(kp)-p_estcpu = (p)-p_estcpu; \
-   (kp)-p_rtime_sec = (pr)-ps_tu.tu_runtime.tv_sec;  \
-   (kp)-p_rtime_usec = (pr)-ps_tu.tu_runtime.tv_usec;\
+   if (isthread) { \
+   (kp)-p_rtime_sec = (p)-p_tu.tu_runtime.tv_sec;\
+   (kp)-p_rtime_usec = (p)-p_tu.tu_runtime.tv_usec;  \
+   (kp)-p_tid = (p)-p_pid + THREAD_PID_OFFSET;   \
+   (kp)-p_uticks = (p)-p_tu.tu_uticks;   \
+   (kp)-p_sticks = (p)-p_tu.tu_sticks;   \
+   (kp)-p_iticks = (p)-p_tu.tu_iticks;   \
+   } else {\
+   (kp)-p_rtime_sec = (pr)-ps_tu.tu_runtime.tv_sec;  \
+   (kp)-p_rtime_usec = (pr)-ps_tu.tu_runtime.tv_usec;\
+   (kp)-p_tid = -1;   \
+   (kp)-p_uticks = (pr)-ps_tu.tu_uticks; \
+   (kp)-p_sticks = (pr)-ps_tu.tu_sticks; \
+   (kp)-p_iticks = (pr)-ps_tu.tu_iticks; \
+   }   \
(kp)-p_cpticks = (p)-p_cpticks;   \
(kp)-p_pctcpu = (p)-p_pctcpu; \
\
-   (kp)-p_uticks = (p)-p_uticks; \
-   (kp)-p_sticks = (p)-p_sticks; \
-   (kp)-p_iticks = (p)-p_iticks; \
-   \
(kp)-p_tracep = PTRTOINT64((pr)-ps_tracevp);  \
(kp)-p_traceflag = (pr)-ps_traceflag; \
\
@@ -587,7 +596,6 @@ do {
\
}   \
\
(kp)-p_cpuid = KI_NOCPU;   \
-   (kp)-p_tid = (p)-p_pid + THREAD_PID_OFFSET;   \
(kp)-p_rtableid = (pr)-ps_rtableid;   \
 } while (0)
 
@@ -933,7 +941,7 @@ int sysctl_dopool(int *, u_int, char *, 
 void fill_file2(struct kinfo_file2 *, struct file *, struct filedesc *,
 int, struct vnode *, struct proc *, struct proc *);
 
-void fill_kproc(struct proc *, struct kinfo_proc *);
+void fill_kproc(struct proc *, struct kinfo_proc *, int);
 
 int kern_sysctl(int *, u_int, void *, size_t *, void *, size_t,
 struct proc *);
Index: sys/kern/kern_sysctl.c
===
RCS file: /cvs/src/sys/kern/kern_sysctl.c,v
retrieving revision 1.219
diff -u -p -r1.219 kern_sysctl.c
--- sys/kern/kern_sysctl.c  10 Apr 2012 15:50:52 -  1.219
+++ sys/kern/kern_sysctl.c  12 Apr 2012 14:03:34 -
@@ -1458,8 +1458,20 @@ again:
goto err;
}
 
+   if ((p-p_flag  P_THREAD) == 0) {
+   if (buflen = elem_size  elem_count  0) {
+   fill_kproc(p, kproc, 0);
+   error = copyout(kproc, dp, elem_size);
+   if (error)
+   goto err;
+   dp += elem_size;
+   buflen -= elem_size;
+   elem_count--;
+   }
+   needed += elem_size;
+   }
 

Re: diff: IUTF8 support

2012-04-12 Thread Christian Weisgerber
Matthew Dempsky matt...@dempsky.org wrote:

 While reading the mosh research paper[1], I noticed we don't have
 IUTF8, which is necessary for backspace to work correctly in canonical
 mode (ICANON) with UTF-8 characters.

Here's a quick diff for stty(1).

Index: modes.c
===
RCS file: /cvs/src/bin/stty/modes.c,v
retrieving revision 1.10
diff -u -p -r1.10 modes.c
--- modes.c 27 Oct 2009 23:59:22 -  1.10
+++ modes.c 12 Apr 2012 13:45:33 -
@@ -115,6 +115,8 @@ const struct modes imodes[] = {
{ -decctlq,   IXANY, 0 },
{ imaxbel,IMAXBEL, 0 },
{ -imaxbel,   0, IMAXBEL },
+   { iutf8,  IUTF8, 0 },
+   { -iutf8, 0, IUTF8 },
{ NULL },
 };
 
Index: print.c
===
RCS file: /cvs/src/bin/stty/print.c,v
retrieving revision 1.13
diff -u -p -r1.13 print.c
--- print.c 27 Oct 2009 23:59:22 -  1.13
+++ print.c 12 Apr 2012 13:54:25 -
@@ -130,6 +130,7 @@ print(struct termios *tp, struct winsize
put(-ixoff, IXOFF, 0);
put(-ixany, IXANY, 1);
put(-imaxbel, IMAXBEL, 1);
+   put(-iutf8, IUTF8, 0);
put(-ignbrk, IGNBRK, 0);
put(-brkint, BRKINT, 1);
put(-inpck, INPCK, 0);
Index: stty.1
===
RCS file: /cvs/src/bin/stty/stty.1,v
retrieving revision 1.38
diff -u -p -r1.38 stty.1
--- stty.1  3 Sep 2011 22:59:08 -   1.38
+++ stty.1  12 Apr 2012 14:10:59 -
@@ -233,6 +233,8 @@ Otherwise, if
 .Cm imaxbel
 is unset and the input queue is full, the next input character causes
 the entire input and output queues to be discarded.
+.It Cm iutf8 Pq Fl iutf8
+Enable (disable) UTF-8 processing in canonical mode.
 .El
 .Ss Output modes
 This corresponds to the
@@ -267,7 +269,7 @@ Local mode flags (lflags) affect various
 processing.
 Historically the term local pertained to new job control features
 implemented by Jim Kulp on a
-.Tn Pdp 11/70
+.Tn PDP 11/70
 at
 .Tn IIASA .
 Later the driver ran on the first

-- 
Christian naddy Weisgerber  na...@mips.inka.de



diff: fix waiting problem on AMD Hudson's AHCI (Re: AMD APU report)

2012-04-12 Thread SASANO Takayoshi
Hello,

 I have a system with an asrock a75m-itx motherboard and an amd a6-3500 
 processor.  I notice there is a 40 second delay after the 'ahci0 at pci0
  dev 17 
 ...' line. 

I have IBM's ThinkPad Edge E525, AMD A8-3500M based machine.
And I checked this diff fix that problem.

ok or comment?


Index: ahci.c
===
RCS file: /cvs/src/sys/dev/pci/ahci.c,v
retrieving revision 1.186
diff -u -p -r1.186 ahci.c
--- ahci.c  4 Feb 2012 21:44:54 -   1.186
+++ ahci.c  12 Apr 2012 13:30:27 -
@@ -462,6 +462,8 @@ int ahci_intel_attach(struct ahci_soft
 static const struct ahci_device ahci_devices[] = {
{ PCI_VENDOR_AMD,   PCI_PRODUCT_AMD_HUDSON2_SATA,
NULL,   ahci_amd_hudson2_attach },
+   { PCI_VENDOR_AMD,   PCI_PRODUCT_AMD_HUDSON_AHCI_1,
+   NULL,   ahci_ati_sb700_attach },
 
{ PCI_VENDOR_ATI,   PCI_PRODUCT_ATI_SB600_SATA,
NULL,   ahci_ati_sb600_attach },


SASANO Takayoshi u...@mx5.nisiq.net, sas...@cvs.openbsd.org



Re: diff: fix waiting problem on AMD Hudson's AHCI (Re: AMD APU report)

2012-04-12 Thread Mike Belopuhov
On Thu, Apr 12, 2012 at 22:40 +0900, SASANO Takayoshi wrote:
 Hello,
 
  I have a system with an asrock a75m-itx motherboard and an amd a6-3500 
  processor.  I notice there is a 40 second delay after the 'ahci0 at pci0
   dev 17 
  ...' line. 
 
 I have IBM's ThinkPad Edge E525, AMD A8-3500M based machine.
 And I checked this diff fix that problem.
 
 ok or comment?
 

makes sense to me, ok mikeb

 
 Index: ahci.c
 ===
 RCS file: /cvs/src/sys/dev/pci/ahci.c,v
 retrieving revision 1.186
 diff -u -p -r1.186 ahci.c
 --- ahci.c4 Feb 2012 21:44:54 -   1.186
 +++ ahci.c12 Apr 2012 13:30:27 -
 @@ -462,6 +462,8 @@ int   ahci_intel_attach(struct 
 ahci_soft
  static const struct ahci_device ahci_devices[] = {
   { PCI_VENDOR_AMD,   PCI_PRODUCT_AMD_HUDSON2_SATA,
   NULL,   ahci_amd_hudson2_attach },
 + { PCI_VENDOR_AMD,   PCI_PRODUCT_AMD_HUDSON_AHCI_1,
 + NULL,   ahci_ati_sb700_attach },
  
   { PCI_VENDOR_ATI,   PCI_PRODUCT_ATI_SB600_SATA,
   NULL,   ahci_ati_sb600_attach },
 
 
 SASANO Takayoshi u...@mx5.nisiq.net, sas...@cvs.openbsd.org



Re: diff: IUTF8 support

2012-04-12 Thread Christian Weisgerber
Matthew Dempsky matt...@dempsky.org wrote:

 While reading the mosh research paper[1], I noticed we don't have
 IUTF8, which is necessary for backspace to work correctly in canonical
 mode (ICANON) with UTF-8 characters.

In principle, IUTF8 should also be added to ssh(1).

I see that the Debian people already made some noise about that back in
2005
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=337041
but were told that it was too late to standardize it in what became
RFC4250.

Index: ttymodes.h
===
RCS file: /cvs/src/usr.bin/ssh/ttymodes.h,v
retrieving revision 1.14
diff -u -p -r1.14 ttymodes.h
--- ttymodes.h  25 Mar 2006 22:22:43 -  1.14
+++ ttymodes.h  12 Apr 2012 14:38:26 -
@@ -127,6 +127,9 @@ TTYMODE(IXOFF,  c_iflag, 40)
 #ifdef IMAXBEL
 TTYMODE(IMAXBEL,c_iflag, 41)
 #endif /* IMAXBEL */
+#ifdef IUTF8
+TTYMODE(IUTF8, c_iflag, 42)
+#endif
 
 TTYMODE(ISIG,  c_lflag, 50)
 TTYMODE(ICANON,c_lflag, 51)
-- 
Christian naddy Weisgerber  na...@mips.inka.de



move systrace to the process struct

2012-04-12 Thread Paul Irofti
Requested by guenther, okay?

Index: dev/systrace.c
===
RCS file: /cvs/src/sys/dev/systrace.c,v
retrieving revision 1.62
diff -u -p -r1.62 systrace.c
--- dev/systrace.c  20 Feb 2012 22:23:39 -  1.62
+++ dev/systrace.c  12 Apr 2012 16:19:16 -
@@ -579,7 +579,7 @@ systrace_exit(struct proc *proc)
struct fsystrace *fst;
 
systrace_lock();
-   strp = proc-p_systrace;
+   strp = proc-p_p-p_systrace;
if (strp != NULL) {
fst = strp-parent;
rw_enter_write(fst-lock);
@@ -589,7 +589,7 @@ systrace_exit(struct proc *proc)
systrace_msg_child(fst, strp, -1);
 
systrace_detach(strp);
-   proc-p_systrace = NULL;
+   proc-p_p-p_systrace = NULL;
rw_exit_write(fst-lock);
} else
systrace_unlock();
@@ -621,7 +621,7 @@ systrace_fork(struct proc *oldproc, stru
struct fsystrace *fst;
 
systrace_lock();
-   oldstrp = oldproc-p_systrace;
+   oldstrp = oldproc-p_p-p_systrace;
if (oldstrp == NULL) {
systrace_unlock();
systrace_freeproc(newstrp);
@@ -647,7 +647,7 @@ systrace_fork(struct proc *oldproc, stru
 
 #define REACQUIRE_LOCK do { \
systrace_lock(); \
-   strp = p-p_systrace; \
+   strp = p-p_p-p_systrace; \
if (strp == NULL) { \
systrace_unlock(); \
return (error); \
@@ -671,7 +671,7 @@ systrace_redirect(int code, struct proc 
int policy, error = 0, report = 0, maycontrol = 0, issuser = 0;
 
systrace_lock();
-   strp = p-p_systrace;
+   strp = p-p_p-p_systrace;
if (strp == NULL) {
systrace_unlock();
return (EINVAL);
@@ -758,7 +758,7 @@ systrace_redirect(int code, struct proc 
 
/* We might have detached by now for some reason */
systrace_lock();
-   if ((strp = p-p_systrace) == NULL) {
+   if ((strp = p-p_p-p_systrace) == NULL) {
systrace_unlock();
return (error);
}
@@ -805,7 +805,7 @@ systrace_redirect(int code, struct proc 
 
/* Return to old privileges */
systrace_lock();
-   if ((strp = p-p_systrace) == NULL) {
+   if ((strp = p-p_p-p_systrace) == NULL) {
systrace_unlock();
return (error);
}
@@ -1278,7 +1278,7 @@ systrace_execve0(struct proc *p)
struct str_process *strp;
 
systrace_lock();
-   strp = p-p_systrace;
+   strp = p-p_p-p_systrace;
strp-isscript = 0;
systrace_unlock();
 }
@@ -1292,7 +1292,7 @@ systrace_execve1(char *path, struct proc
 
do { 
systrace_lock();
-   strp = p-p_systrace;
+   strp = p-p_p-p_systrace;
if (strp == NULL) {
systrace_unlock();
return;
@@ -1462,7 +1462,7 @@ systrace_scriptname(struct proc *p, char
int error = 0;
 
systrace_lock();  
-   strp = p-p_systrace;
+   strp = p-p_p-p_systrace;
fst = strp-parent;
 
rw_enter_write(fst-lock);
@@ -1503,7 +1503,7 @@ systrace_namei(struct nameidata *ndp)
int hamper = 0;
 
systrace_lock();
-   strp = cnp-cn_proc-p_systrace;
+   strp = cnp-cn_proc-p_p-p_systrace;
if (strp != NULL) {
fst = strp-parent;
rw_enter_write(fst-lock);
@@ -1560,7 +1560,7 @@ systrace_detach(struct str_process *strp
 
if ((proc = systrace_find(strp)) != NULL) {
atomic_clearbits_int(proc-p_flag, P_SYSTRACE);
-   proc-p_systrace = NULL;
+   proc-p_p-p_systrace = NULL;
} else
error = ESRCH;
 
@@ -1613,7 +1613,7 @@ systrace_insert_process(struct fsystrace
TAILQ_INSERT_TAIL(fst-processes, strp, next);
fst-nprocesses++;
 
-   proc-p_systrace = strp;
+   proc-p_p-p_systrace = strp;
atomic_setbits_int(proc-p_flag, P_SYSTRACE);
 }
 
@@ -1757,7 +1757,7 @@ systrace_make_msg(struct str_process *st
if (st != 0)
return (ERESTART);
/* If we detach, then everything is permitted */
-   if ((strp = curproc-p_systrace) == NULL)
+   if ((strp = curproc-p_p-p_systrace) == NULL)
return (0);
if (!ISSET(strp-flags, STR_PROC_WAITANSWER))
break;
Index: sys/proc.h
===
RCS file: /cvs/src/sys/sys/proc.h,v
retrieving revision 1.157
diff -u -p -r1.157 proc.h
--- sys/proc.h  12 Apr 2012 12:33:03 -  1.157
+++ sys/proc.h  12 Apr 2012 16:19:16 -
@@ -175,6 +175,8 @@ struct process {
struct  vnode *ps_tracevp;  /* Trace to vnode. */
struct  ucred *ps_tracecred;/* Creds for writing 

Re: move systrace to the process struct

2012-04-12 Thread Ted Unangst
On Thu, Apr 12, 2012, Paul Irofti wrote:
 Requested by guenther, okay?

It's harder than that.  With this change, the first thread to exit
will un-systrace the entire process.  



Re: diff: fix waiting problem on AMD Hudson's AHCI (Re: AMD APU report)

2012-04-12 Thread RD Thrush

On 04/12/12 09:40, SASANO Takayoshi wrote:

Hello,


I have a system with an asrock a75m-itx motherboard and an amd a6-3500
processor.  I notice there is a 40 second delay after the 'ahci0 at pci0
  dev 17
...' line.


I have IBM's ThinkPad Edge E525, AMD A8-3500M based machine.
And I checked this diff fix that problem.

ok or comment?


Thanks, your patch eliminates the 40 second delay.



Re: move systrace to the process struct

2012-04-12 Thread Paul Irofti
On Thu, Apr 12, 2012 at 12:44:55PM -0400, Ted Unangst wrote:
 On Thu, Apr 12, 2012, Paul Irofti wrote:
  Requested by guenther, okay?
 
 It's harder than that.  With this change, the first thread to exit
 will un-systrace the entire process.  

Right... I guess the entire device has to be reworked.

Looking at systrace_exit(), the message parsing and detaching is
kind of hard to modify w/o making the entire driver per process and
implementing a per thread mechanism based on that.

Any thoughts on the best way to go about this?



Re: move systrace to the process struct

2012-04-12 Thread Ted Unangst
On Thu, Apr 12, 2012, Paul Irofti wrote:
 On Thu, Apr 12, 2012 at 12:44:55PM -0400, Ted Unangst wrote:
 On Thu, Apr 12, 2012, Paul Irofti wrote:
  Requested by guenther, okay?

 It's harder than that.  With this change, the first thread to exit
 will un-systrace the entire process.
 
 Right... I guess the entire device has to be reworked.
 
 Looking at systrace_exit(), the message parsing and detaching is
 kind of hard to modify w/o making the entire driver per process and
 implementing a per thread mechanism based on that.
 
 Any thoughts on the best way to go about this?

I don't think we need it to be per thread.  Just refcount it.
Actually, move the hooks around a little.  They should be called when
a struct process is created or destroyed.  That should be simple
enough.  

The insanity of per thread systrace policies is not necessary, so
there's no need to notify the monitor of fork or threxit.  It will
still see the syscalls (and can deny tfork if that's the flavor of the
week), but it doesn't need to follow the children.