Re: svn commit: r233052 - head/share/mk

2012-03-19 Thread Doug Barton
On 3/19/2012 12:37 PM, Dimitry Andric wrote:
 It would be much nicer to be able to write:
 
 .if defined(FOO)
   .if defined(BAR)
 CFLAGS+=  -DFOO_BAR
   .endif
 .endif

Take a look at /usr/ports/Mk/bsd.port.mk for how this can be done.

-- 

This .signature sanitized for your protection
___
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: r233208 - head/sys/amd64/acpica

2012-03-19 Thread Jung-uk Kim
Author: jkim
Date: Mon Mar 19 21:47:50 2012
New Revision: 233208
URL: http://svn.freebsd.org/changeset/base/233208

Log:
  Fix a witness panic introduced in r231797.
  
  Reported by:  bschmidt
  Reviewed by:  jhb
  Pointy hat to:jkim
  MFC after:3 days

Modified:
  head/sys/amd64/acpica/acpi_wakeup.c

Modified: head/sys/amd64/acpica/acpi_wakeup.c
==
--- head/sys/amd64/acpica/acpi_wakeup.c Mon Mar 19 21:34:11 2012
(r233207)
+++ head/sys/amd64/acpica/acpi_wakeup.c Mon Mar 19 21:47:50 2012
(r233208)
@@ -241,8 +241,8 @@ acpi_sleep_machdep(struct acpi_softc *sc
 
AcpiSetFirmwareWakingVector(WAKECODE_PADDR(sc));
 
-   spinlock_enter();
intr_suspend();
+   spinlock_enter();
 
if (savectx(susppcbs[0])) {
ctx_fpusave(suspfpusave[0]);
@@ -299,8 +299,8 @@ out:
 #endif
 
mca_resume();
-   intr_resume();
spinlock_exit();
+   intr_resume();
 
AcpiSetFirmwareWakingVector(0);
 
___
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: r233209 - in head/sys: amd64/include i386/include pc98/include x86/include

2012-03-19 Thread Tijl Coosemans
Author: tijl
Date: Mon Mar 19 21:57:31 2012
New Revision: 233209
URL: http://svn.freebsd.org/changeset/base/233209

Log:
  Copy amd64 sysarch.h to x86 and merge with i386 sysarch.h. Replace
  amd64/i386/pc98 sysarch.h with stubs.

Added:
  head/sys/x86/include/sysarch.h
 - copied, changed from r233203, head/sys/amd64/include/sysarch.h
Modified:
  head/sys/amd64/include/sysarch.h
  head/sys/i386/include/sysarch.h
  head/sys/pc98/include/sysarch.h

Modified: head/sys/amd64/include/sysarch.h
==
--- head/sys/amd64/include/sysarch.hMon Mar 19 21:47:50 2012
(r233208)
+++ head/sys/amd64/include/sysarch.hMon Mar 19 21:57:31 2012
(r233209)
@@ -1,103 +1,6 @@
 /*-
- * Copyright (c) 1993 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD$ */
 
-/*
- * Architecture specific syscalls (AMD64)
- */
-#ifndef _MACHINE_SYSARCH_H_
-#define _MACHINE_SYSARCH_H_
-
-#include sys/cdefs.h
-
-#define I386_GET_LDT   0
-#define I386_SET_LDT   1
-#defineLDT_AUTO_ALLOC  0x
-   /* I386_IOPL */
-#define I386_GET_IOPERM3
-#define I386_SET_IOPERM4
-
-/* XXX Not implementable #define I386_VM86 6 */
-
-#defineI386_GET_FSBASE 7
-#defineI386_SET_FSBASE 8
-#defineI386_GET_GSBASE 9
-#defineI386_SET_GSBASE 10
-#defineI386_GET_XFPUSTATE  11
-
-/* Leave space for 0-127 for to avoid translating syscalls */
-#defineAMD64_GET_FSBASE128
-#defineAMD64_SET_FSBASE129
-#defineAMD64_GET_GSBASE130
-#defineAMD64_SET_GSBASE131
-#defineAMD64_GET_XFPUSTATE 132
-
-struct i386_ldt_args {
-   unsigned int start;
-   struct user_segment_descriptor *descs __packed;
-   unsigned int num;
-};
-
-struct i386_ioperm_args {
-   unsigned int start;
-   unsigned int length;
-   int enable;
-};
-
-struct i386_get_xfpustate {
-   unsigned int addr;
-   int len;
-};
-
-struct amd64_get_xfpustate {
-   void *addr;
-   int len;
-};
-
-#ifndef _KERNEL
-__BEGIN_DECLS
-int amd64_get_fsbase(void **);
-int amd64_get_gsbase(void **);
-int amd64_set_fsbase(void *);
-int amd64_set_gsbase(void *);
-int sysarch(int, void *);
-__END_DECLS
-#else
-struct thread;
-union descriptor;
-
-int amd64_get_ldt(struct thread *, struct i386_ldt_args *);
-int amd64_set_ldt(struct thread *, struct i386_ldt_args *,
-struct user_segment_descriptor *);
-int amd64_get_ioperm(struct thread *, struct i386_ioperm_args *);
-int amd64_set_ioperm(struct thread *, struct i386_ioperm_args *);
-#endif
-
-#endif /* !_MACHINE_SYSARCH_H_ */
+#include x86/sysarch.h

Modified: head/sys/i386/include/sysarch.h
==
--- head/sys/i386/include/sysarch.h Mon Mar 19 21:47:50 2012
(r233208)
+++ head/sys/i386/include/sysarch.h Mon Mar 19 21:57:31 2012
(r233209)
@@ -1,104 +1,6 @@
 /*-
- * Copyright (c) 1993 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above 

Re: svn commit: r233136 - in head/secure: usr.bin/ssh usr.sbin/sshd

2012-03-19 Thread Eitan Adler
2012/3/19 Dag-Erling Smørgrav d...@des.no:
 John Baldwin j...@freebsd.org writes:

Looking at the original contents of the two files

sshd:
-.if defined(X11BASE) || defined(LOCALBASE)

ssh:
-.if defined(X11BASE)

which I think was the cause of my original confusion. The change *was*
a no-op for ssh but resulted in behavior change when LOCALBASE was
defined in sshd.

What do you think of the following patch which uses the same .defined
version as the original restores LOCALBASE support in sshd and and
adds support to ssh? Is there a reason for the difference between the
two? [ build tested only ]

commit 3b4f7b77abc6a0fadb3a15ebd7e8e8d475047842
Author: Eitan Adler li...@eitanadler.com
Date:   Mon Mar 19 19:07:35 2012 -0400

Restore the ability to use a non-standard LOCALBASE to sshd
Add the ability to use a non-standard LOCALBASE to ssh

Submitted by:   jhb
Reviewed by:des
Approved by:cperciva
MFC after:  0 days (with r233136)

diff --git a/secure/usr.bin/ssh/Makefile b/secure/usr.bin/ssh/Makefile
index 619c44a..9304fd55 100644
--- a/secure/usr.bin/ssh/Makefile
+++ b/secure/usr.bin/ssh/Makefile
@@ -28,6 +28,10 @@ LDADD+=   -lgssapi
 DPADD+=${LIBCRYPT} ${LIBCRYPTO}
 LDADD+=-lcrypt -lcrypto

+.if defined(LOCALBASE)
+CFLAGS+= -DXAUTH_PATH=\${LOCALBASE}/bin/xauth\
+.endif
+
 .include bsd.prog.mk

 .PATH: ${SSHDIR}
diff --git a/secure/usr.sbin/sshd/Makefile b/secure/usr.sbin/sshd/Makefile
index 0120771..cc914c4 100644
--- a/secure/usr.sbin/sshd/Makefile
+++ b/secure/usr.sbin/sshd/Makefile
@@ -43,6 +43,10 @@ LDADD+=   -lgssapi_krb5 -lgssapi -lkrb5 -lasn1
 DPADD+=${LIBCRYPTO} ${LIBCRYPT}
 LDADD+=-lcrypto -lcrypt

+.if defined(LOCALBASE)
+CFLAGS+= -DXAUTH_PATH=\${LOCALBASE}/bin/xauth\
+.endif
+
 .include bsd.prog.mk

 .PATH: ${SSHDIR}



-- 
Eitan Adler
Source  Ports committer
X11, Bugbusting teams
___
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


Re: svn commit: r233103 - head/lib/libthr/thread

2012-03-19 Thread David Xu

On 2012/3/20 1:50, John Baldwin wrote:

http://pubs.opengroup.org/onlinepubs/007904975/functions/pthread_cond_destroy.html
This is quite different as assuming a broadcast marks all the threads as 
runnable
and removes them from the cv's queue, none of the threads will have references 
to
the cv so it will be safe to destroy.  It would not be safe to destroy the mutex
in that case though (and the example does not destroy the mutex, only the cv).

Also an implementation based on sequence number to detect broadcast will 
suffer
from the problem because it needs to recheck the sequence number after 
unblocking
to make sure it is not a spurious wakeup or a signal sent to the thread 
which

makes it return to user mode.


___
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: r233227 - head/sys/dev/ath

2012-03-19 Thread Adrian Chadd
Author: adrian
Date: Tue Mar 20 04:50:25 2012
New Revision: 233227
URL: http://svn.freebsd.org/changeset/base/233227

Log:
  Delay sequence number allocation for A-MPDU until just before the frame
  is queued to the hardware.
  
  Because multiple concurrent paths can execute ath_start(), multiple
  concurrent paths can push frames into the software/hardware TX queue
  and since preemption/interrupting can occur, there's the possibility
  that a gap in time will occur between allocating the sequence number
  and queuing it to the hardware.
  
  Because of this, it's possible that a thread will have allocated a
  sequence number and then be preempted by another thread doing the same.
  If the second thread sneaks the frame into the BAW, the (earlier) sequence
  number of the first frame will be now outside the BAW and will result
  in the frame being constantly re-added to the tail of the queue.
  There it will live until the sequence numbers cycle around again.
  
  This also creates a hole in the RX BAW tracking which can also cause
  issues.
  
  This patch delays the sequence number allocation to occur only just before
  the frame is going to be added to the BAW.  I've been wanting to do this
  anyway as part of a general code tidyup but I've not gotten around to it.
  This fixes the PR.
  
  However, it still makes it quite difficult to try and ensure in-order
  queuing and dequeuing of frames. Since multiple copies of ath_start()
  can be run at the same time (eg one TXing process thread, one TX completion
  task/one RX task) the driver may end up having frames dequeued and pushed
  into the hardware slightly/occasionally out of order.
  
  And, to make matters more annoying, net80211 may have the same behaviour -
  in the non-aggregation case, the TX code allocates sequence numbers
  before it's thrown to the driver.  I'll open another PR to investigate
  this and potentially introduce some kind of final-pass TX serialisation
  before frames are thrown to the hardware.  It's also very likely worthwhile
  adding some debugging code into ath(4) and net80211 to catch when/if this
  does occur.
  
  PR:   kern/166190

Modified:
  head/sys/dev/ath/if_ath_debug.c
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_ath_tx.h
  head/sys/dev/ath/if_ath_tx_ht.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath_debug.c
==
--- head/sys/dev/ath/if_ath_debug.c Mon Mar 19 23:28:13 2012
(r233226)
+++ head/sys/dev/ath/if_ath_debug.c Tue Mar 20 04:50:25 2012
(r233227)
@@ -135,19 +135,23 @@ ath_printtxbuf(struct ath_softc *sc, con
printf(Q%u[%3u], qnum, ix);
while (bf != NULL) {
for (i = 0, ds = bf-bf_desc; i  bf-bf_nseg; i++, ds++) {
-   printf( (DS.V:%p DS.P:%p) L:%08x D:%08x F:%04x%s\n
-  TXF: %04x Seq: %d swtry: %d ADDBAW?: %d 
DOBAW?: %d\n
-  %08x %08x %08x %08x %08x %08x\n,
+   printf( (DS.V:%p DS.P:%p) L:%08x D:%08x F:%04x%s\n,
ds, (const struct ath_desc *)bf-bf_daddr + i,
ds-ds_link, ds-ds_data, bf-bf_txflags,
-   !done ?  : (ts-ts_status == 0) ?  * :  !,
+   !done ?  : (ts-ts_status == 0) ?  * :  !);
+   printf(TXF: %04x Seq: %d swtry: %d ADDBAW?: %d 
DOBAW?: %d\n,
bf-bf_state.bfs_flags,
bf-bf_state.bfs_seqno,
bf-bf_state.bfs_retries,
bf-bf_state.bfs_addedbaw,
-   bf-bf_state.bfs_dobaw,
+   bf-bf_state.bfs_dobaw);
+   printf(SEQNO_ASSIGNED: %d, NEED_SEQNO: %d\n,
+   bf-bf_state.bfs_seqno_assigned,
+   bf-bf_state.bfs_need_seqno);
+   printf(%08x %08x %08x %08x %08x %08x\n,
ds-ds_ctl0, ds-ds_ctl1,
-   ds-ds_hw[0], ds-ds_hw[1], ds-ds_hw[2], 
ds-ds_hw[3]);
+   ds-ds_hw[0], ds-ds_hw[1],
+   ds-ds_hw[2], ds-ds_hw[3]);
if (ah-ah_magic == 0x20065416) {
printf(%08x %08x %08x %08x %08x %08x 
%08x %08x\n,
ds-ds_hw[4], ds-ds_hw[5], ds-ds_hw[6],

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cMon Mar 19 23:28:13 2012
(r233226)
+++ head/sys/dev/ath/if_ath_tx.cTue Mar 20 04:50:25 2012
(r233227)
@@ -109,10 +109,10 @@ static int ath_tx_ampdu_pending(struct a
 int tid);
 static int ath_tx_ampdu_running(struct ath_softc *sc, struct ath_node 

Re: svn commit: r233052 - head/share/mk

2012-03-19 Thread Chris Rees
On 17 Mar 2012 05:40, Bruce Evans b...@optusnet.com.au wrote:

 On Fri, 16 Mar 2012, Dimitry Andric wrote:

 Log:
  Change the style of share/mk/bsd.sys.mk to that of the other bsd.*.mk
  files, and style.Makefile(5), where applicable.  While here, update the
  link to the gcc warning documentation.


 Thanks.  I rather liked the ^.* foo style for making ifdefs less
 unreadable, but it didn't look like it was written here, and it is
 a sign of other problems that so many nested ifdefs are used.  It
 only used a single space of each level of indentation, so the
 indentation was still hard too see.

 The other bsd.*.mk files don't include bsd.cpu.mk.  This still uses
 the ^. *foo style (and is now the only *.mk file one that does this).
 For assignments, it mostly uses a different unusual style -- just the
 normal C style of a single space before and after '=' (or '+=').  Weird
 formattings of assignments are harder to grep for than weird formattings
 of .foo, so I didn't try looking for them all.


Indented .ifs etc are used (inconsistently) in bsd.port.mk et al, and can
make a huge difference to readability; make is such a messy language that
multiple levels are often needed.

Perhaps we should try to agree a standard on them, perhaps two spaces?
It's a shame to be stripping them out.

Chris
___
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


Re: svn commit: r232209 - in head: lib/libthr/thread sys/kern

2012-03-19 Thread Pawel Jakub Dawidek
On Sun, Mar 18, 2012 at 05:56:02PM -0700, Julian Elischer wrote:
 On 3/18/12 11:50 AM, Pawel Jakub Dawidek wrote:
  On Mon, Feb 27, 2012 at 01:38:52PM +, David Xu wrote:
  Author: davidxu
  Date: Mon Feb 27 13:38:52 2012
  New Revision: 232209
  URL: http://svn.freebsd.org/changeset/base/232209
 
  Log:
 Follow changes made in revision 232144, pass absolute timeout to kernel,
 this eliminates a clock_gettime() syscall.
  This or some other change has broken CLOCK_MONOTONIC usage with
  condition variables.
 
  You should be able to reproduce this by something like this:
 
  pthread_cond_t cv;
  pthread_condattr_t attr;
  pthread_mutex_t lock;
  struct timespec ts;
   int error;
 
  (void)pthread_mutex_init(lock, NULL);
 
  (void)pthread_condattr_init(attr);
  (void)pthread_condattr_setclock(attr, CLOCK_MONOTONIC);
 
  (void)pthread_cond_init(cv,attr);
  (void)pthread_condattr_destroy(attr);
 
  (void)clock_gettime(CLOCK_MONOTONIC,ts);
  ts.tv_sec += 10;
  (void)pthread_mutex_lock(lock);
  (void)pthread_cond_timedwait(cv,lock,ts);
  (void)pthread_mutex_unlock(lock);
 
  This should timeout after 10 seconds, but pthread_cond_timedwait(3)
  returns immediately with ETIMEDOUT. CLOCK_REALTIME works properly.
  Bascially pthread_condattr_setclock(attr, CLOCK_MONOTONIC) is no-op.
  If you change CLOCK_MONOTONIC to CLOCK_REALTIME in clock_gettime(2)
  call, it will timeout after 10 seconds.
 
 this has been broken for  a while for  me in fact fixing this was, I 
 thought,
 one of the reasons for this work..  glad I'm not the omnly person 
 seeing it though.
 
 for me it broke sysutils/fio  from ports

For me it breaks sbin/hastd and openbsm/auditdistd, but my feeling is
that it is was broken recently. This stuff use to work not so long ago.

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://tupytaj.pl


pgpOKwkORW0RY.pgp
Description: PGP signature


Re: svn commit: r232209 - in head: lib/libthr/thread sys/kern

2012-03-19 Thread David Xu

On 2012/3/19 15:33, Pawel Jakub Dawidek wrote:

On Sun, Mar 18, 2012 at 05:56:02PM -0700, Julian Elischer wrote:

On 3/18/12 11:50 AM, Pawel Jakub Dawidek wrote:

On Mon, Feb 27, 2012 at 01:38:52PM +, David Xu wrote:

Author: davidxu
Date: Mon Feb 27 13:38:52 2012
New Revision: 232209
URL: http://svn.freebsd.org/changeset/base/232209

Log:
Follow changes made in revision 232144, pass absolute timeout to kernel,
this eliminates a clock_gettime() syscall.

This or some other change has broken CLOCK_MONOTONIC usage with
condition variables.

You should be able to reproduce this by something like this:

pthread_cond_t cv;
pthread_condattr_t attr;
pthread_mutex_t lock;
struct timespec ts;
  int error;

(void)pthread_mutex_init(lock, NULL);

(void)pthread_condattr_init(attr);
(void)pthread_condattr_setclock(attr, CLOCK_MONOTONIC);

(void)pthread_cond_init(cv,attr);
(void)pthread_condattr_destroy(attr);

(void)clock_gettime(CLOCK_MONOTONIC,ts);
ts.tv_sec += 10;
(void)pthread_mutex_lock(lock);
(void)pthread_cond_timedwait(cv,lock,ts);
(void)pthread_mutex_unlock(lock);

This should timeout after 10 seconds, but pthread_cond_timedwait(3)
returns immediately with ETIMEDOUT. CLOCK_REALTIME works properly.
Bascially pthread_condattr_setclock(attr, CLOCK_MONOTONIC) is no-op.
If you change CLOCK_MONOTONIC to CLOCK_REALTIME in clock_gettime(2)
call, it will timeout after 10 seconds.

this has been broken for  a while for  me in fact fixing this was, I
thought,
one of the reasons for this work..  glad I'm not the omnly person
seeing it though.

for me it broke sysutils/fio  from ports

For me it breaks sbin/hastd and openbsm/auditdistd, but my feeling is
that it is was broken recently. This stuff use to work not so long ago.

Hi,

Revision 233134 should have fixed the problem.

http://svn.freebsd.org/changeset/base/233134


___
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


Re: svn commit: r233048 - head/etc/defaults

2012-03-19 Thread Alexander Leidinger
Quoting Martin Matuska m...@freebsd.org (from Sun, 18 Mar 2012  
22:50:13 +0100):



On 18.3.2012 22:29, Martin Matuska wrote:

On 17.3.2012 16:35, Alexander Leidinger wrote:

On Fri, 16 Mar 2012 21:30:26 + (UTC) Martin Matuska
m...@freebsd.org wrote:


Author: mm
Date: Fri Mar 16 21:30:26 2012
New Revision: 233048
URL: http://svn.freebsd.org/changeset/base/233048

Log:
  Unhide /dev/zfs in devfsrules_jail.

  The /dev/zfs device is required for managing jailed ZFS datasets.

This may give more info to a jail (ZFS is in use on this machine) than
what someone may want to provide. I have separate rulesets for jails
without and with ZFS (actually the one without is the default one and
the one with is a new one):
---snip---
...

[devfsrules_unhide_zfs=12]
add path zfs unhide

...

[devfsrules_jail_withzfs=16]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add include $devfsrules_unhide_zfs
---snip---

Anyone with arguments why this may be overly paranoid? If not, I would
suggest that we go this way instead.

Bye,
Alexander.


The only disclosed information I know of is whether the zfs module is
loaded on your system.
Other alternative I was thinking of would be using a new ruleset (e.g.
devfsrules_jail_zfs=5).
The disadvantage here is that users that already have defined a ruleset
with this number should be informed somehow.


Well... we always have this issue. If the rulsets in defaults changes,  
the user has to change his own rulesets. I have a lot of rules on my  
system and there was at least one occasion where I had to handle a  
change because of this. I don't remember if there was an entry in  
UPDATING or not, but I don't think we should make a decission about it  
based upon if an user has to renumber his rulesets or not. As the  
rulesets do not need to be continous, we may want to add an advise to  
the man-page(s) to start at a specifc value for the ruleset-numbers  
and reserve everything below for the system. I didn't do this myself,  
and I have a lot of rulesets, for me this falls within 'nice to have  
but easy to handle'.



Btw. jail has access to sysctl(8) and this discloses a *LOT* of
information, including if ZFS is loaded or not (existence of vfs.zfs)
and all its settings and statistics, hardware devices, geom devices,
network card counters and many more. Compared to this is /dev/zfs really
a minor issue :-)


I agree.


Until we limit the output of sysctl() we don't hide this information
just by hiding /dev/zfs.


What about not imported pools. Can I see them in jails or are they  
hidden (I don't have one around to test ATM)?


Bye,
Alexander.

--
Don't drink when you drive -- you might hit a bump and spill it.

http://www.Leidinger.netAlexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org   netchild @ FreeBSD.org  : PGP ID = 72077137

___
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


Re: svn commit: r233048 - head/etc/defaults

2012-03-19 Thread Martin Matuska
On 19. 3. 2012 9:42, Alexander Leidinger wrote:
 The only disclosed information I know of is whether the zfs module is
 loaded on your system.
 Other alternative I was thinking of would be using a new ruleset (e.g.
 devfsrules_jail_zfs=5).
 The disadvantage here is that users that already have defined a ruleset
 with this number should be informed somehow.

 Well... we always have this issue. If the rulsets in defaults changes,
 the user has to change his own rulesets. I have a lot of rules on my
 system and there was at least one occasion where I had to handle a
 change because of this. I don't remember if there was an entry in
 UPDATING or not, but I don't think we should make a decission about it
 based upon if an user has to renumber his rulesets or not. As the
 rulesets do not need to be continous, we may want to add an advise to
 the man-page(s) to start at a specifc value for the ruleset-numbers
 and reserve everything below for the system. I didn't do this myself,
 and I have a lot of rulesets, for me this falls within 'nice to have
 but easy to handle'.

 Btw. jail has access to sysctl(8) and this discloses a *LOT* of
 information, including if ZFS is loaded or not (existence of vfs.zfs)
 and all its settings and statistics, hardware devices, geom devices,
 network card counters and many more. Compared to this is /dev/zfs really
 a minor issue :-)

 I agree.

 Until we limit the output of sysctl() we don't hide this information
 just by hiding /dev/zfs.

 What about not imported pools. Can I see them in jails or are they
 hidden (I don't have one around to test ATM)? 
Until you delegate a zfs dataset to a jail, the jail does not see any
pools or datasets.

If you delegate a dataset to a jail, the jail sees information about the
delegated dataset, the dataset's pool, the parent datasets of this
delegated dataset (=the path from pool up to the delegated dataset) and
the descendant datasets, if any.

We might want to continue this discussion outside of the svn-src mailing
lists.

-- 
Martin Matuska
FreeBSD committer
http://blog.vx.sk

___
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: r233167 - head/etc

2012-03-19 Thread Gleb Smirnoff
Author: glebius
Date: Mon Mar 19 09:30:40 2012
New Revision: 233167
URL: http://svn.freebsd.org/changeset/base/233167

Log:
  Rotate auth.log and messages at the beginning of a year. Otherwise,
  daily security checks 800.loginfail and 900.tcpwrap may produce
  false positive alerts.

Modified:
  head/etc/newsyslog.conf

Modified: head/etc/newsyslog.conf
==
--- head/etc/newsyslog.conf Mon Mar 19 08:10:23 2012(r233166)
+++ head/etc/newsyslog.conf Mon Mar 19 09:30:40 2012(r233167)
@@ -19,7 +19,7 @@
 # logfilename  [owner:group]mode count size when  flags 
[/pid_file] [sig_num]
 /var/log/all.log   600  7 *@T00  J
 /var/log/amd.log   644  7 100  * J
-/var/log/auth.log  600  7 100  * JC
+/var/log/auth.log  600  7 100  @0101T JC
 /var/log/console.log   600  5 100  * J
 /var/log/cron  600  3 100  * JC
 /var/log/daily.log 640  7 *@T00  JN
@@ -28,7 +28,7 @@
 /var/log/kerberos.log  600  7 100  * J
 /var/log/lpd-errs  644  7 100  * JC
 /var/log/maillog   640  7 *@T00  JC
-/var/log/messages  644  5 100  * JC
+/var/log/messages  644  5 100  @0101T JC
 /var/log/monthly.log   640  12*$M1D0 JN
 /var/log/pflog 600  3 100  * JB
/var/run/pflogd.pid
 /var/log/ppp.log   root:network640  3 100  * JC
___
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: r233168 - in head/sys: amd64/amd64 i386/i386

2012-03-19 Thread Konstantin Belousov
Author: kib
Date: Mon Mar 19 09:34:22 2012
New Revision: 233168
URL: http://svn.freebsd.org/changeset/base/233168

Log:
  If we ever allow for managed fictitious pages, the pages shall be
  excluded from superpage promotions.  At least one of the reason is
  that pv_table is sized for non-fictitious pages only.
  
  Consistently check for the page to be non-fictitious before accesing
  superpage pv list.
  
  Sponsored by: The FreeBSD Foundation
  Reviewed by:  alc
  MFC after:2 weeks

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Mar 19 09:30:40 2012(r233167)
+++ head/sys/amd64/amd64/pmap.c Mon Mar 19 09:34:22 2012(r233168)
@@ -2386,7 +2386,7 @@ pmap_remove_entry(pmap_t pmap, vm_page_t
 
mtx_assert(vm_page_queue_mtx, MA_OWNED);
pmap_pvh_free(m-md, pmap, va);
-   if (TAILQ_EMPTY(m-md.pv_list)) {
+   if (TAILQ_EMPTY(m-md.pv_list)  (m-flags  PG_FICTITIOUS) == 0) {
pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
if (TAILQ_EMPTY(pvh-pv_list))
vm_page_aflag_clear(m, PGA_WRITEABLE);
@@ -2849,6 +2849,8 @@ pmap_remove_all(vm_page_t m)
(pmap_remove_all: page %p is not managed, m));
free = NULL;
vm_page_lock_queues();
+   if ((m-flags  PG_FICTITIOUS) != 0)
+   goto small_mappings;
pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
while ((pv = TAILQ_FIRST(pvh-pv_list)) != NULL) {
pmap = PV_PMAP(pv);
@@ -2858,6 +2860,7 @@ pmap_remove_all(vm_page_t m)
(void)pmap_demote_pde(pmap, pde, va);
PMAP_UNLOCK(pmap);
}
+small_mappings:
while ((pv = TAILQ_FIRST(m-md.pv_list)) != NULL) {
pmap = PV_PMAP(pv);
PMAP_LOCK(pmap);
@@ -2939,7 +2942,8 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
pdp_entry_t *pdpe;
pd_entry_t ptpaddr, *pde;
pt_entry_t *pte;
-   boolean_t anychanged, pv_lists_locked;
+   int anychanged;
+   boolean_t pv_lists_locked;
 
if ((prot  VM_PROT_READ) == VM_PROT_NONE) {
pmap_remove(pmap, sva, eva);
@@ -2952,7 +2956,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
 
pv_lists_locked = FALSE;
 resume:
-   anychanged = FALSE;
+   anychanged = 0;
 
PMAP_LOCK(pmap);
for (; sva  eva; sva = va_next) {
@@ -3000,7 +3004,7 @@ resume:
 * invalidated by pmap_protect_pde().
 */
if (pmap_protect_pde(pmap, pde, sva, prot))
-   anychanged = TRUE;
+   anychanged = 1;
continue;
} else {
if (!pv_lists_locked) {
@@ -3054,7 +3058,7 @@ retry:
if (obits  PG_G)
pmap_invalidate_page(pmap, sva);
else
-   anychanged = TRUE;
+   anychanged = 1;
}
}
}
@@ -3354,7 +3358,8 @@ validate:
}
if ((origpte  PG_MANAGED) != 0 
TAILQ_EMPTY(om-md.pv_list) 
-   TAILQ_EMPTY(pa_to_pvh(opa)-pv_list))
+   ((om-flags  PG_FICTITIOUS) != 0 ||
+   TAILQ_EMPTY(pa_to_pvh(opa)-pv_list)))
vm_page_aflag_clear(om, PGA_WRITEABLE);
if (invlva)
pmap_invalidate_page(pmap, va);
@@ -3367,7 +3372,8 @@ validate:
 * populated, then attempt promotion.
 */
if ((mpte == NULL || mpte-wire_count == NPTEPG) 
-   pg_ps_enabled  vm_reserv_level_iffullpop(m) == 0)
+   pg_ps_enabled  (m-flags  PG_FICTITIOUS) == 0 
+   vm_reserv_level_iffullpop(m) == 0)
pmap_promote_pde(pmap, pde, va);
 
vm_page_unlock_queues();
@@ -3987,7 +3993,7 @@ pmap_page_exists_quick(pmap_t pmap, vm_p
if (loops = 16)
break;
}
-   if (!rv  loops  16) {
+   if (!rv  loops  16  (m-flags  PG_FICTITIOUS) == 0) {
pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
TAILQ_FOREACH(pv, pvh-pv_list, pv_list) {
if (PV_PMAP(pv) == pmap) {
@@ -4019,7 +4025,10 @@ pmap_page_wired_mappings(vm_page_t m)
return (count);
vm_page_lock_queues();
count = pmap_pvh_wired_mappings(m-md, count);
-   count = pmap_pvh_wired_mappings(pa_to_pvh(VM_PAGE_TO_PHYS(m)), count);
+   if ((m-flags  PG_FICTITIOUS) == 0) {
+   count = 

Re: svn commit: r233167 - head/etc

2012-03-19 Thread Joel Dahl
On 19-03-2012  9:30, Gleb Smirnoff wrote:
 Author: glebius
 Date: Mon Mar 19 09:30:40 2012
 New Revision: 233167
 URL: http://svn.freebsd.org/changeset/base/233167
 
 Log:
   Rotate auth.log and messages at the beginning of a year. Otherwise,
   daily security checks 800.loginfail and 900.tcpwrap may produce
   false positive alerts.

Thank you!

-- 
Joel
___
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: r233173 - head/lib/libc/locale

2012-03-19 Thread David Chisnall
Author: theraven
Date: Mon Mar 19 11:47:37 2012
New Revision: 233173
URL: http://svn.freebsd.org/changeset/base/233173

Log:
  Make __get_locale() static inline, not just inline, so when compiling libc in
  debug mode (without optimisations) it doesn't generate a linker failure.
  
  Approved by:  dim (mentor)

Modified:
  head/lib/libc/locale/xlocale_private.h

Modified: head/lib/libc/locale/xlocale_private.h
==
--- head/lib/libc/locale/xlocale_private.h  Mon Mar 19 11:32:42 2012
(r233172)
+++ head/lib/libc/locale/xlocale_private.h  Mon Mar 19 11:47:37 2012
(r233173)
@@ -191,7 +191,7 @@ extern _Thread_local locale_t __thread_l
  * this call is not guaranteed to remain valid after the locale changes.  As
  * such, this should only be called within libc functions.
  */
-inline locale_t __get_locale(void)
+static inline locale_t __get_locale(void)
 {
 
if (!__has_thread_locale) {
___
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: r233174 - head/lib/libcxxrt

2012-03-19 Thread David Chisnall
Author: theraven
Date: Mon Mar 19 11:53:33 2012
New Revision: 233174
URL: http://svn.freebsd.org/changeset/base/233174

Log:
  Add symbol versioning to libcxxrt.
  
  Approved by:  dim (mentor)

Added:
  head/lib/libcxxrt/Version.map   (contents, props changed)
Modified:
  head/lib/libcxxrt/Makefile

Modified: head/lib/libcxxrt/Makefile
==
--- head/lib/libcxxrt/Makefile  Mon Mar 19 11:47:37 2012(r233173)
+++ head/lib/libcxxrt/Makefile  Mon Mar 19 11:53:33 2012(r233174)
@@ -21,5 +21,6 @@ SRCS+=libelftc_dem_gnu3.c\
 
 WARNS=0
 CFLAGS+=  -I${SRCDIR}
+VERSION_MAP=  ${.CURDIR}/Version.map
 
 .include bsd.lib.mk

Added: head/lib/libcxxrt/Version.map
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libcxxrt/Version.map   Mon Mar 19 11:53:33 2012
(r233174)
@@ -0,0 +1,318 @@
+# $FreeBSD$
+# Define the same version as the libsupc++ from gcc 4.2.1 so that we can use
+# libcxxrt as a drop-in replacement.
+
+CXXABI_1.3 {
+
+  global:
+
+# ABI functions with C linkage
+__cxa_allocate_exception;
+__cxa_bad_cast;
+__cxa_bad_typeid;
+__cxa_begin_catch;
+__cxa_begin_cleanup;
+__cxa_call_unexpected;
+__cxa_current_exception_type;
+__cxa_demangle;
+__cxa_end_catch;
+__cxa_end_cleanup;
+__cxa_free_exception;
+__cxa_get_globals;
+__cxa_get_globals_fast;
+__cxa_guard_abort;
+__cxa_guard_acquire;
+__cxa_guard_release;
+__cxa_pure_virtual;
+__cxa_rethrow;
+__cxa_throw;
+__cxa_type_match;
+__cxa_vec_cctor;
+__cxa_vec_cleanup;
+__cxa_vec_ctor;
+__cxa_vec_delete2;
+__cxa_vec_delete3;
+__cxa_vec_delete;
+__cxa_vec_dtor;
+__cxa_vec_new2;
+__cxa_vec_new3;
+__cxa_vec_new;
+__dynamic_cast;
+__gxx_personality_sj0;
+__gxx_personality_v0;
+
+extern C++ {
+# Type info classes and their destructors
+__cxxabiv1::__array_type_info;
+__cxxabiv1::__array_type_info::~__array_type_info();
+__cxxabiv1::__class_type_info;
+__cxxabiv1::__class_type_info::~__class_type_info();
+__cxxabiv1::__enum_type_info;
+__cxxabiv1::__enum_type_info::~__enum_type_info();
+__cxxabiv1::__function_type_info::;
+__cxxabiv1::__function_type_info::~__function_type_info();
+__cxxabiv1::__fundamental_type_info;
+__cxxabiv1::__fundamental_type_info::~__fundamental_type_info();
+__cxxabiv1::__pbase_type_info;
+__cxxabiv1::__pbase_type_info::~__pbase_type_info();
+__cxxabiv1::__pointer_to_member_type_info;
+
__cxxabiv1::__pointer_to_member_type_info::~__pointer_to_member_type_info();
+__cxxabiv1::__pointer_type_info;
+__cxxabiv1::__pointer_type_info::~__pointer_type_info();
+__cxxabiv1::__si_class_type_info;
+__cxxabiv1::__si_class_type_info::~__si_class_type_info();
+__cxxabiv1::__vmi_class_type_info;
+__cxxabiv1::__vmi_class_type_info::~__vmi_class_type_info();
+
+# vtables typeinfo classes.
+vtable for __cxxabiv1::__array_type_info;
+vtable for __cxxabiv1::__class_type_info;
+vtable for __cxxabiv1::__enum_type_info;
+vtable for __cxxabiv1::__function_type_info;
+vtable for __cxxabiv1::__fundamental_type_info;
+vtable for __cxxabiv1::__pbase_type_info;
+vtable for __cxxabiv1::__pointer_to_member_type_info;
+vtable for __cxxabiv1::__pointer_type_info;
+vtable for __cxxabiv1::__si_class_type_info;
+vtable for __cxxabiv1::__vmi_class_type_info;
+
+# Type info for built-in types
+typeinfo for bool const*;
+typeinfo for bool;
+typeinfo for char const*;
+typeinfo for char;
+typeinfo for double const*;
+typeinfo for double;
+typeinfo for float const*;
+typeinfo for float;
+typeinfo for int const*;
+typeinfo for int;
+typeinfo for long const*;
+typeinfo for long double const*;
+typeinfo for long double;
+typeinfo for long long const*;
+typeinfo for long long;
+typeinfo for long;
+typeinfo for short const*;
+typeinfo for short;
+typeinfo for signed char const*;
+typeinfo for signed char;
+typeinfo for unsigned char const*;
+typeinfo for unsigned char;
+typeinfo for unsigned int const*;
+typeinfo for unsigned int;
+typeinfo for unsigned long const*;
+typeinfo for unsigned long long const*;
+typeinfo for unsigned long long;
+typeinfo for unsigned long;
+typeinfo for unsigned short const*;
+typeinfo for unsigned short;
+typeinfo for void const*;
+typeinfo for void;
+typeinfo for wchar_t const*;
+

svn commit: r233175 - head/sys/geom/part

2012-03-19 Thread Andrey V. Elsukov
Author: ae
Date: Mon Mar 19 12:57:52 2012
New Revision: 233175
URL: http://svn.freebsd.org/changeset/base/233175

Log:
  Make kern.geom.part node not static. Also add CTLFLAG_TUN to the
  check_integrity sysctl.
  
  MFC after:1 month

Modified:
  head/sys/geom/part/g_part.c

Modified: head/sys/geom/part/g_part.c
==
--- head/sys/geom/part/g_part.c Mon Mar 19 11:53:33 2012(r233174)
+++ head/sys/geom/part/g_part.c Mon Mar 19 12:57:52 2012(r233175)
@@ -106,12 +106,13 @@ struct g_part_alias_list {
 };
 
 SYSCTL_DECL(_kern_geom);
-static SYSCTL_NODE(_kern_geom, OID_AUTO, part, CTLFLAG_RW, 0,
+SYSCTL_NODE(_kern_geom, OID_AUTO, part, CTLFLAG_RW, 0,
 GEOM_PART stuff);
 static u_int check_integrity = 1;
 TUNABLE_INT(kern.geom.part.check_integrity, check_integrity);
-SYSCTL_UINT(_kern_geom_part, OID_AUTO, check_integrity, CTLFLAG_RW,
-check_integrity, 1, Enable integrity checking);
+SYSCTL_UINT(_kern_geom_part, OID_AUTO, check_integrity,
+CTLFLAG_RW | CTLFLAG_TUN, check_integrity, 1,
+Enable integrity checking);
 
 /*
  * The GEOM partitioning class.
___
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: r233176 - head/sys/geom/part

2012-03-19 Thread Andrey V. Elsukov
Author: ae
Date: Mon Mar 19 13:14:44 2012
New Revision: 233176
URL: http://svn.freebsd.org/changeset/base/233176

Log:
  Add new GEOM_PART_LDM module that implements the Logical Disk Manager
  scheme. The LDM is a logical volume manager for MS Windows NT and it
  is also known as dynamic volumes. It supports about 2000 partitions
  and also provides the capability for software RAID implementations.
  
  This version implements only partitioning scheme capability and based
  on the linux-ntfs project documentation and several publications across
  the Web. NOTE: JBOD, RAID0 and RAID5 volumes aren't supported.
  
  An access to the LDM metadata is read-only. When LDM is on the disk
  partitioned with MBR we can also destroy metadata. For the GPT
  partitioned disks destroy action is not supported.
  
  Reviewed by:  ivoras (previous version)
  MFC after:1 month

Added:
  head/sys/geom/part/g_part_ldm.c   (contents, props changed)

Added: head/sys/geom/part/g_part_ldm.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/geom/part/g_part_ldm.c Mon Mar 19 13:14:44 2012
(r233176)
@@ -0,0 +1,1504 @@
+/*-
+ * Copyright (c) 2012 Andrey V. Elsukov a...@freebsd.org
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/param.h
+#include sys/bio.h
+#include sys/diskmbr.h
+#include sys/endian.h
+#include sys/gpt.h
+#include sys/kernel.h
+#include sys/kobj.h
+#include sys/limits.h
+#include sys/lock.h
+#include sys/malloc.h
+#include sys/mutex.h
+#include sys/queue.h
+#include sys/sbuf.h
+#include sys/systm.h
+#include sys/sysctl.h
+#include sys/uuid.h
+#include geom/geom.h
+#include geom/part/g_part.h
+
+#include g_part_if.h
+
+FEATURE(geom_part_ldm, GEOM partitioning class for LDM support);
+
+SYSCTL_DECL(_kern_geom_part);
+static SYSCTL_NODE(_kern_geom_part, OID_AUTO, ldm, CTLFLAG_RW, 0,
+GEOM_PART_LDM Logical Disk Manager);
+
+static u_int ldm_debug = 0;
+TUNABLE_INT(kern.geom.part.ldm.debug, ldm_debug);
+SYSCTL_UINT(_kern_geom_part_ldm, OID_AUTO, debug, CTLFLAG_RW,
+ldm_debug, 0, Debug level);
+
+/*
+ * This allows access to mirrored LDM volumes. Since we do not
+ * doing mirroring here, it is not enabled by default.
+ */
+static u_int show_mirrors = 0;
+TUNABLE_INT(kern.geom.part.ldm.show_mirrors, show_mirrors);
+SYSCTL_UINT(_kern_geom_part_ldm, OID_AUTO, show_mirrors, CTLFLAG_RW,
+show_mirrors, 0, Show mirrored volumes);
+
+#defineLDM_DEBUG(lvl, fmt, ...)do {
\
+   if (ldm_debug = (lvl)) {   \
+   printf(GEOM_PART:  fmt \n, __VA_ARGS__);\
+   }   \
+} while (0)
+#defineLDM_DUMP(buf, size) do {
\
+   if (ldm_debug  1) {\
+   hexdump(buf, size, NULL, 0);\
+   }   \
+} while (0)
+
+/*
+ * There are internal representations of LDM structures.
+ *
+ * We do not keep all fields of on-disk structures, only most useful.
+ * All numbers in an on-disk structures are in big-endian format.
+ */
+
+/*
+ * Private header is 512 bytes long. There are three copies on each disk.
+ * Offset and sizes are in sectors. Location of each copy:
+ * - the first offset is relative to the disk start;
+ * - the second and third offset are relative to the LDM database start.
+ *
+ * On a disk partitioned with GPT, the LDM has not first private header.
+ 

svn commit: r233177 - in head/sys/modules/geom/geom_part: . geom_part_ldm

2012-03-19 Thread Andrey V. Elsukov
Author: ae
Date: Mon Mar 19 13:15:48 2012
New Revision: 233177
URL: http://svn.freebsd.org/changeset/base/233177

Log:
  Connect geom_part_ldm module to the build.
  
  MFC after:1 month

Added:
  head/sys/modules/geom/geom_part/geom_part_ldm/
  head/sys/modules/geom/geom_part/geom_part_ldm/Makefile   (contents, props 
changed)
Modified:
  head/sys/modules/geom/geom_part/Makefile

Modified: head/sys/modules/geom/geom_part/Makefile
==
--- head/sys/modules/geom/geom_part/MakefileMon Mar 19 13:14:44 2012
(r233176)
+++ head/sys/modules/geom/geom_part/MakefileMon Mar 19 13:15:48 2012
(r233177)
@@ -4,6 +4,7 @@ SUBDIR= geom_part_apm \
geom_part_bsd \
geom_part_ebr \
geom_part_gpt \
+   geom_part_ldm \
geom_part_mbr \
geom_part_pc98 \
geom_part_vtoc8

Added: head/sys/modules/geom/geom_part/geom_part_ldm/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/geom/geom_part/geom_part_ldm/Makefile  Mon Mar 19 
13:15:48 2012(r233177)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../../../geom/part
+
+KMOD=  geom_part_ldm
+SRCS=  g_part_ldm.c
+
+SRCS+= bus_if.h device_if.h g_part_if.h
+
+MFILES=kern/bus_if.m kern/device_if.m geom/part/g_part_if.m
+
+.include bsd.kmod.mk
___
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: r233178 - head/sys/conf

2012-03-19 Thread Andrey V. Elsukov
Author: ae
Date: Mon Mar 19 13:16:46 2012
New Revision: 233178
URL: http://svn.freebsd.org/changeset/base/233178

Log:
  Connect geom_part_ldm to the kernel build.
  
  MFC after:1 month

Modified:
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/options

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Mon Mar 19 13:15:48 2012(r233177)
+++ head/sys/conf/NOTES Mon Mar 19 13:16:46 2012(r233178)
@@ -159,6 +159,7 @@ options GEOM_PART_BSD   # BSD disklabel
 optionsGEOM_PART_EBR   # Extended Boot Records
 optionsGEOM_PART_EBR_COMPAT# Backward compatible partition names
 optionsGEOM_PART_GPT   # GPT partitioning
+optionsGEOM_PART_LDM   # Logical Disk Manager
 optionsGEOM_PART_MBR   # MBR partitioning
 optionsGEOM_PART_PC98  # PC-9800 disk partitioning
 optionsGEOM_PART_VTOC8 # SMI VTOC8 disk label

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Mar 19 13:15:48 2012(r233177)
+++ head/sys/conf/files Mon Mar 19 13:16:46 2012(r233178)
@@ -2256,6 +2256,7 @@ geom/part/g_part_apm.coptional geom_pa
 geom/part/g_part_bsd.c optional geom_part_bsd
 geom/part/g_part_ebr.c optional geom_part_ebr
 geom/part/g_part_gpt.c optional geom_part_gpt
+geom/part/g_part_ldm.c optional geom_part_ldm
 geom/part/g_part_mbr.c optional geom_part_mbr
 geom/part/g_part_pc98.coptional geom_part_pc98
 geom/part/g_part_vtoc8.c   optional geom_part_vtoc8

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Mon Mar 19 13:15:48 2012(r233177)
+++ head/sys/conf/options   Mon Mar 19 13:16:46 2012(r233178)
@@ -103,6 +103,7 @@ GEOM_PART_BSD   opt_geom.h
 GEOM_PART_EBR  opt_geom.h
 GEOM_PART_EBR_COMPAT   opt_geom.h
 GEOM_PART_GPT  opt_geom.h
+GEOM_PART_LDM  opt_geom.h
 GEOM_PART_MBR  opt_geom.h
 GEOM_PART_PC98 opt_geom.h
 GEOM_PART_VTOC8opt_geom.h
___
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: r233179 - head/sbin/geom/class/part

2012-03-19 Thread Andrey V. Elsukov
Author: ae
Date: Mon Mar 19 13:17:47 2012
New Revision: 233179
URL: http://svn.freebsd.org/changeset/base/233179

Log:
  Document GEOM_PART_LDM scheme and partition types.
  
  MFC after:1 month

Modified:
  head/sbin/geom/class/part/gpart.8

Modified: head/sbin/geom/class/part/gpart.8
==
--- head/sbin/geom/class/part/gpart.8   Mon Mar 19 13:16:46 2012
(r233178)
+++ head/sbin/geom/class/part/gpart.8   Mon Mar 19 13:17:47 2012
(r233179)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd January 8, 2012
+.Dd March 19, 2012
 .Dt GPART 8
 .Os
 .Sh NAME
@@ -38,6 +38,7 @@ lines in the kernel configuration file:
 .Cd options GEOM_PART_APM
 .Cd options GEOM_PART_BSD
 .Cd options GEOM_PART_GPT
+.Cd options GEOM_PART_LDM
 .Cd options GEOM_PART_MBR
 .Cd options GEOM_PART_EBR
 .Cd options GEOM_PART_EBR_COMPAT
@@ -511,6 +512,12 @@ called
 Requires the
 .Cm GEOM_PART_BSD
 kernel option.
+.It Cm LDM
+The Logical Disk Manager is an implementation of volume manager for
+Microsoft Windows NT.
+Requires the
+.Cd GEOM_PART_LDM
+kernel option.
 .It Cm GPT
 GUID Partition Table is used on Intel-based Macintosh computers and
 gradually replacing MBR on most PCs and other systems.
@@ -559,7 +566,7 @@ The
 utility also allows the user to specify scheme-specific partition types
 for partition types that do not have symbolic names.
 Symbolic names currently understood are:
-.Bl -tag -width .Cm freebsd-vinum
+.Bl -tag -width .Cm ms-ldm-metadata
 .It Cm bios-boot
 The system partition dedicated to second stage of the boot loader program.
 Usually it is used by the GRUB 2 loader for GPT partitioning schemes.
@@ -634,6 +641,18 @@ A partition that is sub-partitioned by a
 This type is known as
 .Qq Li !024dee41-33e7-11d3-9d69-0008c781f39f
 by GPT.
+.It Cm ms-ldm-data
+A partition that contains Logical Disk Manager (LDM) volumes.
+The scheme-specific types are
+.Qq Li !66
+for MBR,
+.Qq Li !af9b60a0-1431-4f62-bc68-3311714a69ad
+for GPT.
+.It Cm ms-ldm-metadata
+A partition that contains Logical Disk Manager (LDM) database.
+The scheme-specifig type is
+.Qq Li !5808c8aa-7e8f-42e0-85d2-e1e90434cfb3
+for GPT.
 .El
 .Sh ATTRIBUTES
 The scheme-specific attributes for EBR:
@@ -938,6 +957,23 @@ disk metadata.
 If some inconsistency is detected, the partition table will be
 rejected with a diagnostic message:
 .Sy GEOM_PART: Integrity check failed (provider, scheme) .
+.It Va kern.geom.part.ldm.debug : No 0
+Debug level of the Logical Disk Manager (LDM) module.
+This can be set to a number between 0 and 2 inclusive.
+If set to 0 minimal debug information is printed,
+and if set to 2 the maximum amount of debug information is printed.
+.It Va kern.geom.part.ldm.show_mirrors : No 0
+This variable controls how the Logical Disk Manager (LDM) module handles
+mirrored volumes.
+By default mirrored volumes are shown as partitions with type
+.Cm ms-ldm-data
+(see the
+.Sx PARTITION TYPES
+section).
+If this variable set to 1 each component of the mirrored volume will be
+present as independet partition.
+.Em NOTE :
+This may break a mirrored volume and lead to data damage.
 .El
 .Sh EXIT STATUS
 Exit status is 0 on success, and 1 if the command fails.
___
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: r233181 - head/sys/geom/part

2012-03-19 Thread Andrey V. Elsukov
Author: ae
Date: Mon Mar 19 13:21:10 2012
New Revision: 233181
URL: http://svn.freebsd.org/changeset/base/233181

Log:
  Add CTLFLAG_TUN to sysctls.
  
  MFC after:1 month

Modified:
  head/sys/geom/part/g_part_ldm.c

Modified: head/sys/geom/part/g_part_ldm.c
==
--- head/sys/geom/part/g_part_ldm.c Mon Mar 19 13:19:02 2012
(r233180)
+++ head/sys/geom/part/g_part_ldm.c Mon Mar 19 13:21:10 2012
(r233181)
@@ -56,8 +56,8 @@ static SYSCTL_NODE(_kern_geom_part, OID_
 
 static u_int ldm_debug = 0;
 TUNABLE_INT(kern.geom.part.ldm.debug, ldm_debug);
-SYSCTL_UINT(_kern_geom_part_ldm, OID_AUTO, debug, CTLFLAG_RW,
-ldm_debug, 0, Debug level);
+SYSCTL_UINT(_kern_geom_part_ldm, OID_AUTO, debug,
+CTLFLAG_RW | CTLFLAG_TUN, ldm_debug, 0, Debug level);
 
 /*
  * This allows access to mirrored LDM volumes. Since we do not
@@ -65,8 +65,8 @@ SYSCTL_UINT(_kern_geom_part_ldm, OID_AUT
  */
 static u_int show_mirrors = 0;
 TUNABLE_INT(kern.geom.part.ldm.show_mirrors, show_mirrors);
-SYSCTL_UINT(_kern_geom_part_ldm, OID_AUTO, show_mirrors, CTLFLAG_RW,
-show_mirrors, 0, Show mirrored volumes);
+SYSCTL_UINT(_kern_geom_part_ldm, OID_AUTO, show_mirrors,
+CTLFLAG_RW | CTLFLAG_TUN, show_mirrors, 0, Show mirrored volumes);
 
 #defineLDM_DEBUG(lvl, fmt, ...)do {
\
if (ldm_debug = (lvl)) {   \
___
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


Re: svn commit: r233167 - head/etc

2012-03-19 Thread Dmitry Morozovsky
On Mon, 19 Mar 2012, Gleb Smirnoff wrote:

 Author: glebius
 Date: Mon Mar 19 09:30:40 2012
 New Revision: 233167
 URL: http://svn.freebsd.org/changeset/base/233167
 
 Log:
   Rotate auth.log and messages at the beginning of a year. Otherwise,
   daily security checks 800.loginfail and 900.tcpwrap may produce
   false positive alerts.

[snip]

 -/var/log/auth.log600  7 100  * JC
 +/var/log/auth.log600  7 100  @0101T JC

Did I miss newsyslog behaviour change? 

IIRC size limit is totally ignored if timed rotation is selected, and some time 
ago I even proposed to change this, but it was rejected, as one can use two 
lines, one with size limit, and other with timed rotation


-- 
Sincerely,
D.Marck [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer: ma...@freebsd.org ]

*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- ma...@rinet.ru ***

___
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: r233184 - head/sys/dev/wtap

2012-03-19 Thread Adrian Chadd
Author: adrian
Date: Mon Mar 19 13:54:15 2012
New Revision: 233184
URL: http://svn.freebsd.org/changeset/base/233184

Log:
  Remove this - it's not needed as it's defined in ieee80211_freebsd.h.

Modified:
  head/sys/dev/wtap/if_wtap.c

Modified: head/sys/dev/wtap/if_wtap.c
==
--- head/sys/dev/wtap/if_wtap.c Mon Mar 19 13:51:38 2012(r233183)
+++ head/sys/dev/wtap/if_wtap.c Mon Mar 19 13:54:15 2012(r233184)
@@ -305,9 +305,6 @@ wtap_bmiss(struct ieee80211vap *vap)
avp-av_bmiss(vap);
 }
 
-/* XXX */
-#definemsecs_to_ticks(ms)  (((ms) * hz) / 1000)
-
 static struct ieee80211vap *
 wtap_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
 int unit, enum ieee80211_opmode opmode, int flags,
@@ -349,7 +346,6 @@ wtap_vap_create(struct ieee80211com *ic,
vap-iv_bss-ni_txrate = 130;
return vap;
 }
-#undef msecs_to_ticks
 
 static void
 wtap_vap_delete(struct ieee80211vap *vap)
___
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


Re: svn commit: r233168 - in head/sys: amd64/amd64 i386/i386

2012-03-19 Thread John Baldwin
On Monday, March 19, 2012 5:34:22 am Konstantin Belousov wrote:
 Author: kib
 Date: Mon Mar 19 09:34:22 2012
 New Revision: 233168
 URL: http://svn.freebsd.org/changeset/base/233168
 
 Log:
   If we ever allow for managed fictitious pages, the pages shall be
   excluded from superpage promotions.  At least one of the reason is
   that pv_table is sized for non-fictitious pages only.
   
   Consistently check for the page to be non-fictitious before accesing
   superpage pv list.
   
   Sponsored by:   The FreeBSD Foundation
   Reviewed by:alc
   MFC after:  2 weeks

Hmm, I think you accidentally reverted 223122?

 Modified: head/sys/amd64/amd64/pmap.c
 
==
 --- head/sys/amd64/amd64/pmap.c   Mon Mar 19 09:30:40 2012
 (r233167)
 +++ head/sys/amd64/amd64/pmap.c   Mon Mar 19 09:34:22 2012
 (r233168)
 @@ -2939,7 +2942,8 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
   pdp_entry_t *pdpe;
   pd_entry_t ptpaddr, *pde;
   pt_entry_t *pte;
 - boolean_t anychanged, pv_lists_locked;
 + int anychanged;
 + boolean_t pv_lists_locked;
  
   if ((prot  VM_PROT_READ) == VM_PROT_NONE) {
   pmap_remove(pmap, sva, eva);
 @@ -2952,7 +2956,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
  
   pv_lists_locked = FALSE;
  resume:
 - anychanged = FALSE;
 + anychanged = 0;
  
   PMAP_LOCK(pmap);
   for (; sva  eva; sva = va_next) {
 @@ -3000,7 +3004,7 @@ resume:
* invalidated by pmap_protect_pde().
*/
   if (pmap_protect_pde(pmap, pde, sva, prot))
 - anychanged = TRUE;
 + anychanged = 1;
   continue;
   } else {
   if (!pv_lists_locked) {
 @@ -3054,7 +3058,7 @@ retry:
   if (obits  PG_G)
   pmap_invalidate_page(pmap, sva);
   else
 - anychanged = TRUE;
 + anychanged = 1;
   }
   }
   }

-- 
John Baldwin
___
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


Re: svn commit: r233103 - head/lib/libthr/thread

2012-03-19 Thread John Baldwin
On Saturday, March 17, 2012 8:22:29 pm David Xu wrote:
 Author: davidxu
 Date: Sun Mar 18 00:22:29 2012
 New Revision: 233103
 URL: http://svn.freebsd.org/changeset/base/233103
 
 Log:
   Some software think a mutex can be destroyed after it owned it, for
   example, it uses a serialization point like following:
   pthread_mutex_lock(mutex);
   pthread_mutex_unlock(mutex);
   pthread_mutex_destroy(muetx);
   They think a previous lock holder should have already left the mutex and
   is no longer referencing it, so they destroy it. To be maximum compatible
   with such code, we use IA64 version to unlock the mutex in kernel, remove
   the two steps unlocking code.

But this means they destroy the lock while another thread holds it?  That 
seems wrong.  It's one thing if they know that no other thread has a reference 
to the lock (e.g. it's in a refcounted object and the current thread just 
dropped the reference count to zero).  However, in that case no other thread 
can unlock it after this thread destroys it.  Code that does this seems very 
buggy, since if the address can be unmapped it can also be remapped and 
assigned to another lock, etc., so you could have a thread try to unlock a 
lock it doesn't hold.

Also, being able to safely inline the common case for pthread locks is a very 
useful optimization and one we should pursue IMO.

-- 
John Baldwin
___
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


Re: svn commit: r233136 - in head/secure: usr.bin/ssh usr.sbin/sshd

2012-03-19 Thread John Baldwin
On Sunday, March 18, 2012 8:41:40 pm Eitan Adler wrote:
 Author: eadler
 Date: Mon Mar 19 00:41:40 2012
 New Revision: 233136
 URL: http://svn.freebsd.org/changeset/base/233136
 
 Log:
   X11BASE is not used any more and has been killed by the x11 team.
   
   Reviewed by:???
   Approved by:???
   MFC after:  3 days
 
 Modified:
   head/secure/usr.bin/ssh/Makefile
   head/secure/usr.sbin/sshd/Makefile

This looks wrong.  While X11BASE is certainly dead, LOCALBASE is not, so the 
existing code should have been changed, but not removed.  Something like this:

.if defined(LOCALBASE)
CFLAGS+= -DXAUTH_PATH=\${LOCALBASE}/bin/xauth\
.endif

-- 
John Baldwin
___
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


Re: svn commit: r233167 - head/etc

2012-03-19 Thread Ian Lepore
On Mon, 2012-03-19 at 09:30 +, Gleb Smirnoff wrote:
 Author: glebius
 Date: Mon Mar 19 09:30:40 2012
 New Revision: 233167
 URL: http://svn.freebsd.org/changeset/base/233167
 
 Log:
   Rotate auth.log and messages at the beginning of a year. Otherwise,
   daily security checks 800.loginfail and 900.tcpwrap may produce
   false positive alerts.
 
 Modified:
   head/etc/newsyslog.conf
 
 Modified: head/etc/newsyslog.conf
 ==
 --- head/etc/newsyslog.conf   Mon Mar 19 08:10:23 2012(r233166)
 +++ head/etc/newsyslog.conf   Mon Mar 19 09:30:40 2012(r233167)
 @@ -19,7 +19,7 @@
  # logfilename  [owner:group]mode count size when  flags 
 [/pid_file] [sig_num]
  /var/log/all.log 600  7 *@T00  J
  /var/log/amd.log 644  7 100  * J
 -/var/log/auth.log600  7 100  * JC
 +/var/log/auth.log600  7 100  @0101T JC
  /var/log/console.log 600  5 100  * J
  /var/log/cron600  3 100  * JC
  /var/log/daily.log   640  7 *@T00  JN
 @@ -28,7 +28,7 @@
  /var/log/kerberos.log600  7 100  * J
  /var/log/lpd-errs644  7 100  * JC
  /var/log/maillog 640  7 *@T00  JC
 -/var/log/messages644  5 100  * JC
 +/var/log/messages644  5 100  @0101T JC
  /var/log/monthly.log 640  12*$M1D0 JN
  /var/log/pflog   600  3 100  * JB
 /var/run/pflogd.pid
  /var/log/ppp.log root:network640  3 100  * JC


This change may not behave exactly as you expect unless the patch in PR
kern/160432 or something equivelent is commited.  (It should have been
bin/ not kern/, my bad.)

 http://www.freebsd.org/cgi/query-pr.cgi?pr=160432

To summarize, if both 'size' and 'when' are specified, the size is
ignored and only the time is used.  The patch in that PR fixes it.
We've been running our embedded products with the patch for years
because rotating based on size is important when /var/log is a ramdisk.

-- Ian


___
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


Re: svn commit: r233103 - head/lib/libthr/thread

2012-03-19 Thread David Xu

On 2012/3/19 20:33, John Baldwin wrote:

On Saturday, March 17, 2012 8:22:29 pm David Xu wrote:

Author: davidxu
Date: Sun Mar 18 00:22:29 2012
New Revision: 233103
URL: http://svn.freebsd.org/changeset/base/233103

Log:
   Some software think a mutex can be destroyed after it owned it, for
   example, it uses a serialization point like following:
pthread_mutex_lock(mutex);
pthread_mutex_unlock(mutex);
pthread_mutex_destroy(muetx);
   They think a previous lock holder should have already left the mutex and
   is no longer referencing it, so they destroy it. To be maximum compatible
   with such code, we use IA64 version to unlock the mutex in kernel, remove
   the two steps unlocking code.

But this means they destroy the lock while another thread holds it?  That
seems wrong.  It's one thing if they know that no other thread has a reference
to the lock (e.g. it's in a refcounted object and the current thread just
dropped the reference count to zero).  However, in that case no other thread
can unlock it after this thread destroys it.  Code that does this seems very
buggy, since if the address can be unmapped it can also be remapped and
assigned to another lock, etc., so you could have a thread try to unlock a
lock it doesn't hold.


They have handshake code to indicate that the mutex is no longer used by 
previous

holder. e.g:

thread 1:
pthread_mutex_lock(mutex);
done = 1;
pthread_mutex_unlock(mutex);
thread 2:
pthread_mutex_lock(mutex);
temp = done;
pthread_mutex_unlock(mutex);
if (temp == 1)
pthread_mutex_destroy(mutex);

I guess one crash of Python is also caused by the logic, though they use 
semaphore

instead of mutex + condition variable to mimic lock.
POSIX even explicitly requires a condition variable to be destroyable 
after broadcast,

once you have correct teardown code. Please read its example section:
http://pubs.opengroup.org/onlinepubs/007904975/functions/pthread_cond_destroy.html



Also, being able to safely inline the common case for pthread locks is a very
useful optimization and one we should pursue IMO.


Yes.
___
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


Re: svn commit: r233136 - in head/secure: usr.bin/ssh usr.sbin/sshd

2012-03-19 Thread Eitan Adler
On Mon, Mar 19, 2012 at 8:35 AM, John Baldwin j...@freebsd.org wrote:
 On Sunday, March 18, 2012 8:41:40 pm Eitan Adler wrote:
 Author: eadler
 Date: Mon Mar 19 00:41:40 2012
 New Revision: 233136
 URL: http://svn.freebsd.org/changeset/base/233136

 Log:
   X11BASE is not used any more and has been killed by the x11 team.

   Reviewed by:        ???
   Approved by:        ???
   MFC after:  3 days

 Modified:
   head/secure/usr.bin/ssh/Makefile
   head/secure/usr.sbin/sshd/Makefile

 This looks wrong.  While X11BASE is certainly dead, LOCALBASE is not, so the
 existing code should have been changed, but not removed.  Something like this:

 .if defined(LOCALBASE)
 CFLAGS+= -DXAUTH_PATH=\${LOCALBASE}/bin/xauth\
 .endif

I think I missed X11BASE?=${LOCALBASE}  in the original code making
me believe this change was a no-op. I'll have a patch to fix this
soon.



-- 
Eitan Adler
Source  Ports committer
X11, Bugbusting teams
___
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: r233185 - head/sys/amd64/amd64

2012-03-19 Thread Konstantin Belousov
Author: kib
Date: Mon Mar 19 15:50:14 2012
New Revision: 233185
URL: http://svn.freebsd.org/changeset/base/233185

Log:
  Re-apply r233122 erronously reverted in r233168.
  
  Submitted by:  jhb
  Pointy hat to: kib
  MFC after: 2 weeks

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Mar 19 13:54:15 2012(r233184)
+++ head/sys/amd64/amd64/pmap.c Mon Mar 19 15:50:14 2012(r233185)
@@ -2942,8 +2942,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
pdp_entry_t *pdpe;
pd_entry_t ptpaddr, *pde;
pt_entry_t *pte;
-   int anychanged;
-   boolean_t pv_lists_locked;
+   boolean_t anychanged, pv_lists_locked;
 
if ((prot  VM_PROT_READ) == VM_PROT_NONE) {
pmap_remove(pmap, sva, eva);
@@ -2956,7 +2955,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
 
pv_lists_locked = FALSE;
 resume:
-   anychanged = 0;
+   anychanged = FALSE;
 
PMAP_LOCK(pmap);
for (; sva  eva; sva = va_next) {
@@ -3004,7 +3003,7 @@ resume:
 * invalidated by pmap_protect_pde().
 */
if (pmap_protect_pde(pmap, pde, sva, prot))
-   anychanged = 1;
+   anychanged = TRUE;
continue;
} else {
if (!pv_lists_locked) {
@@ -3058,7 +3057,7 @@ retry:
if (obits  PG_G)
pmap_invalidate_page(pmap, sva);
else
-   anychanged = 1;
+   anychanged = TRUE;
}
}
}
___
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


Re: svn commit: r233168 - in head/sys: amd64/amd64 i386/i386

2012-03-19 Thread Konstantin Belousov
On Mon, Mar 19, 2012 at 08:28:35AM -0400, John Baldwin wrote:
 On Monday, March 19, 2012 5:34:22 am Konstantin Belousov wrote:
  Author: kib
  Date: Mon Mar 19 09:34:22 2012
  New Revision: 233168
  URL: http://svn.freebsd.org/changeset/base/233168
  
  Log:
If we ever allow for managed fictitious pages, the pages shall be
excluded from superpage promotions.  At least one of the reason is
that pv_table is sized for non-fictitious pages only.

Consistently check for the page to be non-fictitious before accesing
superpage pv list.

Sponsored by: The FreeBSD Foundation
Reviewed by:  alc
MFC after:2 weeks
 
 Hmm, I think you accidentally reverted 223122?
Oops, yes, r233122 is reverted.  I committed the fix, thank you for noting.

Apparently I did not pulled the master branch on the machine were
I did the commit, against which the topic branch was diffed :(.
 
  Modified: head/sys/amd64/amd64/pmap.c
  
 ==
  --- head/sys/amd64/amd64/pmap.c Mon Mar 19 09:30:40 2012
  (r233167)
  +++ head/sys/amd64/amd64/pmap.c Mon Mar 19 09:34:22 2012
  (r233168)
  @@ -2939,7 +2942,8 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
  pdp_entry_t *pdpe;
  pd_entry_t ptpaddr, *pde;
  pt_entry_t *pte;
  -   boolean_t anychanged, pv_lists_locked;
  +   int anychanged;
  +   boolean_t pv_lists_locked;
   
  if ((prot  VM_PROT_READ) == VM_PROT_NONE) {
  pmap_remove(pmap, sva, eva);
  @@ -2952,7 +2956,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
   
  pv_lists_locked = FALSE;
   resume:
  -   anychanged = FALSE;
  +   anychanged = 0;
   
  PMAP_LOCK(pmap);
  for (; sva  eva; sva = va_next) {
  @@ -3000,7 +3004,7 @@ resume:
   * invalidated by pmap_protect_pde().
   */
  if (pmap_protect_pde(pmap, pde, sva, prot))
  -   anychanged = TRUE;
  +   anychanged = 1;
  continue;
  } else {
  if (!pv_lists_locked) {
  @@ -3054,7 +3058,7 @@ retry:
  if (obits  PG_G)
  pmap_invalidate_page(pmap, sva);
  else
  -   anychanged = TRUE;
  +   anychanged = 1;
  }
  }
  }
 
 -- 
 John Baldwin


pgpiKGzmOb1qb.pgp
Description: PGP signature


Re: svn commit: r233136 - in head/secure: usr.bin/ssh usr.sbin/sshd

2012-03-19 Thread Eitan Adler
 This looks wrong.  While X11BASE is certainly dead, LOCALBASE is not, so the
 existing code should have been changed, but not removed.

Does this look good?
Build tested only.

commit 271b766fdbd907be040767f2387b4d5fbb6425f7
Author: Eitan Adler li...@eitanadler.com
Date:   Mon Mar 19 11:52:31 2012 -0400

Restore the ability to use a non-standard LOCALBASE

Submitted by:   jhb
Approved by:cperciva
MFC after:  0 days (with r233136)

diff --git a/secure/usr.sbin/sshd/Makefile b/secure/usr.sbin/sshd/Makefile
index 0120771..6426ff3 100644
--- a/secure/usr.sbin/sshd/Makefile
+++ b/secure/usr.sbin/sshd/Makefile
@@ -40,6 +40,9 @@ DPADD+=${LIBGSSAPI_KRB5} ${LIBGSSAPI} ${LIBKRB5} 
${LIBASN1}
 LDADD+= -lgssapi_krb5 -lgssapi -lkrb5 -lasn1
 .endif

+LOCALBASE?= /usr/local
+CFLAGS+= -DXAUTH_PATH=\${LOCALBASE}/bin/xauth\
+
 DPADD+=${LIBCRYPTO} ${LIBCRYPT}
 LDADD+=-lcrypto -lcrypt



-- 
Eitan Adler
Source  Ports committer
X11, Bugbusting teams
___
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


Re: svn commit: r233103 - head/lib/libthr/thread

2012-03-19 Thread David Xu

On 2012/3/19 23:41, David Xu wrote:

On 2012/3/19 20:33, John Baldwin wrote:

On Saturday, March 17, 2012 8:22:29 pm David Xu wrote:

Author: davidxu
Date: Sun Mar 18 00:22:29 2012
New Revision: 233103
URL: http://svn.freebsd.org/changeset/base/233103

Log:
   Some software think a mutex can be destroyed after it owned it, for
   example, it uses a serialization point like following:
   pthread_mutex_lock(mutex);
   pthread_mutex_unlock(mutex);
   pthread_mutex_destroy(muetx);
   They think a previous lock holder should have already left the 
mutex and
   is no longer referencing it, so they destroy it. To be maximum 
compatible
   with such code, we use IA64 version to unlock the mutex in 
kernel, remove

   the two steps unlocking code.
But this means they destroy the lock while another thread holds it?  
That
seems wrong.  It's one thing if they know that no other thread has a 
reference
to the lock (e.g. it's in a refcounted object and the current thread 
just
dropped the reference count to zero).  However, in that case no other 
thread
can unlock it after this thread destroys it.  Code that does this 
seems very

buggy, since if the address can be unmapped it can also be remapped and
assigned to another lock, etc., so you could have a thread try to 
unlock a

lock it doesn't hold.


They have handshake code to indicate that the mutex is no longer used 
by previous

holder. e.g:

thread 1:
pthread_mutex_lock(mutex);
done = 1;
pthread_mutex_unlock(mutex);
thread 2:
pthread_mutex_lock(mutex);
temp = done;
pthread_mutex_unlock(mutex);
if (temp == 1)
pthread_mutex_destroy(mutex);

I guess one crash of Python is also caused by the logic, though they 
use semaphore

instead of mutex + condition variable to mimic lock.
POSIX even explicitly requires a condition variable to be destroyable 
after broadcast,

once you have correct teardown code. Please read its example section:
http://pubs.opengroup.org/onlinepubs/007904975/functions/pthread_cond_destroy.html 




Also, being able to safely inline the common case for pthread locks 
is a very

useful optimization and one we should pursue IMO.


Yes.


Following topics are interesting:
http://sourceware.org/bugzilla/show_bug.cgi?id=12674
http://sourceware.org/bugzilla/show_bug.cgi?id=13690
http://sourceware.org/bugzilla/show_bug.cgi?id=13065
http://sourceware.org/bugzilla/show_bug.cgi?id=12683
http://sourceware.org/bugzilla/show_bug.cgi?id=13165
http://sourceware.org/bugzilla/show_bug.cgi?id=13165

___
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: r233186 - head/usr.sbin/pc-sysinstall/backend-query

2012-03-19 Thread Josh Paetzel
Author: jpaetzel
Date: Mon Mar 19 16:13:14 2012
New Revision: 233186
URL: http://svn.freebsd.org/changeset/base/233186

Log:
  An intel RAID can have any arbitrary name.

Modified:
  head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh

Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
==
--- head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Mon Mar 19 
15:50:14 2012(r233185)
+++ head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh  Mon Mar 19 
16:13:14 2012(r233186)
@@ -63,10 +63,7 @@ if [ -d /dev/raid ] ; then
   cd /dev/raid
   for i in `ls`
   do
-case ${i} in
-  r0|r1|r2|r3|r4|r5) SYSDISK=${SYSDISK} ${i} ;;
-  *) ;;
-esac
+  SYSDISK=${SYSDISK} ${i}
   done
 fi
 
___
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: r233187 - head/sys/dev/fb

2012-03-19 Thread Jung-uk Kim
Author: jkim
Date: Mon Mar 19 17:14:12 2012
New Revision: 233187
URL: http://svn.freebsd.org/changeset/base/233187

Log:
  Do not reuse the previous address when restoring linear frame buffer.

Modified:
  head/sys/dev/fb/vesa.c

Modified: head/sys/dev/fb/vesa.c
==
--- head/sys/dev/fb/vesa.c  Mon Mar 19 16:13:14 2012(r233186)
+++ head/sys/dev/fb/vesa.c  Mon Mar 19 17:14:12 2012(r233187)
@@ -1478,7 +1478,8 @@ vesa_save_state(video_adapter_t *adp, vo
vesa_vmem_buf = malloc(bsize, M_DEVBUF, M_NOWAIT);
if (vesa_vmem_buf != NULL)
bcopy((void *)buf, vesa_vmem_buf, bsize);
-   }
+   } else
+   vesa_vmem_buf = NULL;
((adp_state_t *)p)-sig = V_STATE_SIG;
bzero(((adp_state_t *)p)-regs, vesa_state_buf_size);
return (vesa_bios_save_restore(STATE_SAVE, ((adp_state_t *)p)-regs));
@@ -1496,7 +1497,6 @@ vesa_load_state(video_adapter_t *adp, vo
 
/* Try BIOS POST to restore a sane state. */
(void)vesa_bios_post();
-   buf = adp-va_buffer;
bsize = adp-va_buffer_size;
mode = adp-va_mode;
(void)vesa_set_mode(adp, adp-va_initial_mode);
@@ -1505,8 +1505,10 @@ vesa_load_state(video_adapter_t *adp, vo
 
if (((adp_state_t *)p)-sig != V_STATE_SIG)
return ((*prevvidsw-load_state)(adp, p));
-   if (buf != 0  vesa_vmem_buf != NULL) {
-   bcopy(vesa_vmem_buf, (void *)buf, bsize);
+   if (vesa_vmem_buf != NULL) {
+   buf = adp-va_buffer;
+   if (buf != 0)
+   bcopy(vesa_vmem_buf, (void *)buf, bsize);
free(vesa_vmem_buf, M_DEVBUF);
}
return (vesa_bios_save_restore(STATE_LOAD, ((adp_state_t *)p)-regs));
___
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: r233188 - head/sys/powerpc/powermac

2012-03-19 Thread Andreas Tobler
Author: andreast
Date: Mon Mar 19 18:03:20 2012
New Revision: 233188
URL: http://svn.freebsd.org/changeset/base/233188

Log:
  Provide a fix for certain PowerMacs where the U3 i2c lacks the interrupt
  info.
  
  Tested by:Robert Hish
  MFC after:1 week

Modified:
  head/sys/powerpc/powermac/uninorth.c

Modified: head/sys/powerpc/powermac/uninorth.c
==
--- head/sys/powerpc/powermac/uninorth.cMon Mar 19 17:14:12 2012
(r233187)
+++ head/sys/powerpc/powermac/uninorth.cMon Mar 19 18:03:20 2012
(r233188)
@@ -262,9 +262,11 @@ unin_chip_attach(device_t dev)
struct unin_chip_devinfo *dinfo;
phandle_t  root;
phandle_t  child;
+   phandle_t  iparent;
device_t   cdev;
char compat[32];
-   u_int reg[3];
+   char name[32];
+   u_int irq, reg[3];
int error, i = 0;
 
sc = device_get_softc(dev);
@@ -315,6 +317,33 @@ unin_chip_attach(device_t dev)
dinfo-udi_ninterrupts = 0;
unin_chip_add_intr(child, dinfo);
 
+   /*
+* Some Apple machines do have a bug in OF, they miss
+* the interrupt entries on the U3 I2C node. That means they
+* do not have an entry with number of interrupts nor the
+* entry of the interrupt parent handle.
+* We define an interrupt and hardwire it to the /u3/mpic
+* handle.
+*/
+
+   if (OF_getprop(child, name, name, sizeof(name)) = 0)
+   device_printf(dev, device has no name!\n);
+   if (dinfo-udi_ninterrupts == 0 
+   (strcmp(name, i2c-bus) == 0 ||
+strcmp(name, i2c)  == 0)) {
+   if (OF_getprop(child, interrupt-parent, iparent,
+  sizeof(iparent)) = 0) {
+   iparent = OF_finddevice(/u3/mpic);
+   device_printf(dev, Set /u3/mpic as 
iparent!\n);
+   }
+   /* Add an interrupt number 0 to the parent. */
+   irq = MAP_IRQ(iparent, 0);
+   resource_list_add(dinfo-udi_resources, SYS_RES_IRQ,
+ dinfo-udi_ninterrupts, irq, irq, 1);
+   dinfo-udi_interrupts[dinfo-udi_ninterrupts] = irq;
+   dinfo-udi_ninterrupts++;
+   }
+
unin_chip_add_reg(child, dinfo);
 
cdev = device_add_child(dev, NULL, -1);
___
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


Re: svn commit: r232209 - in head: lib/libthr/thread sys/kern

2012-03-19 Thread Pawel Jakub Dawidek
On Mon, Mar 19, 2012 at 04:16:58PM +0800, David Xu wrote:
 Revision 233134 should have fixed the problem.
 
 http://svn.freebsd.org/changeset/base/233134

Works now, thanks for the quick fix.

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://tupytaj.pl


pgpYEhdhNTPFI.pgp
Description: PGP signature


svn commit: r233194 - head/sys/vm

2012-03-19 Thread John Baldwin
Author: jhb
Date: Mon Mar 19 19:06:40 2012
New Revision: 233194
URL: http://svn.freebsd.org/changeset/base/233194

Log:
  Bah, just revert my earlier change entirely.  (Missed alc's request to do
  this earlier.)
  
  Requested by: alc

Modified:
  head/sys/vm/vm_phys.c

Modified: head/sys/vm/vm_phys.c
==
--- head/sys/vm/vm_phys.c   Mon Mar 19 19:01:34 2012(r233193)
+++ head/sys/vm/vm_phys.c   Mon Mar 19 19:06:40 2012(r233194)
@@ -223,7 +223,7 @@ _vm_phys_create_seg(vm_paddr_t start, vm
 {
struct vm_phys_seg *seg;
 #ifdef VM_PHYSSEG_SPARSE
-   vm_size_t pages;
+   long pages;
int segind;
 
pages = 0;
___
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: r233195 - head/usr.sbin/dconschat

2012-03-19 Thread Dimitry Andric
Author: dim
Date: Mon Mar 19 19:17:55 2012
New Revision: 233195
URL: http://svn.freebsd.org/changeset/base/233195

Log:
  Fix the following warning from clang trunk:
  
  usr.sbin/dconschat/dconschat.c:163:65: error: format specifies type 'size_t' 
(aka 'unsigned int') but the argument has type 'off_t' (aka 'long long') 
[-Werror,-Wformat]
  snprintf(buf, PAGE_SIZE, \r\n[dconschat reset 
target(addr=0x%zx)...]\r\n, dc-reset);
   ~~^  
  ~
   %llx
  
  Silence this by casting dc-reset to intmax_t, and using the appropriate
  length modifier.  While here, wrap the line to a 80 character margin.
  
  MFC after:3 days

Modified:
  head/usr.sbin/dconschat/dconschat.c

Modified: head/usr.sbin/dconschat/dconschat.c
==
--- head/usr.sbin/dconschat/dconschat.c Mon Mar 19 19:06:40 2012
(r233194)
+++ head/usr.sbin/dconschat/dconschat.c Mon Mar 19 19:17:55 2012
(r233195)
@@ -42,6 +42,7 @@
 #include unistd.h
 #include fcntl.h
 #include signal.h
+#include stdint.h
 #include stdio.h
 #include stdlib.h
 #include termios.h
@@ -160,7 +161,9 @@ dconschat_reset_target(struct dcons_stat
if (dc-reset == 0)
return;
 
-   snprintf(buf, PAGE_SIZE, \r\n[dconschat reset 
target(addr=0x%zx)...]\r\n, dc-reset);
+   snprintf(buf, PAGE_SIZE,
+   \r\n[dconschat reset target(addr=0x%jx)...]\r\n,
+   (intmax_t)dc-reset);
write(p-outfd, buf, strlen(buf));
bzero(buf[0], PAGE_SIZE);
dwrite(dc, (void *)buf, PAGE_SIZE, dc-reset);
___
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: r233196 - head/share/man/man4

2012-03-19 Thread Maxim Konovalov
Author: maxim
Date: Mon Mar 19 19:25:22 2012
New Revision: 233196
URL: http://svn.freebsd.org/changeset/base/233196

Log:
  o Trim EoL whitespaces.

Modified:
  head/share/man/man4/tcp.4

Modified: head/share/man/man4/tcp.4
==
--- head/share/man/man4/tcp.4   Mon Mar 19 19:17:55 2012(r233195)
+++ head/share/man/man4/tcp.4   Mon Mar 19 19:25:22 2012(r233196)
@@ -147,7 +147,7 @@ See
 .Xr mod_cc 4
 for details.
 .It Dv TCP_KEEPINIT
-This write-only 
+This write-only
 .Xr setsockopt 2
 option accepts a per-socket timeout argument of
 .Vt u_int
@@ -160,7 +160,7 @@ in the
 .Sx MIB Variables
 section further down.
 .It Dv TCP_KEEPIDLE
-This write-only 
+This write-only
 .Xr setsockopt 2
 option accepts an argument of
 .Vt u_int
@@ -176,7 +176,7 @@ in the
 .Sx MIB Variables
 section further down.
 .It Dv TCP_KEEPINTVL
-This write-only 
+This write-only
 .Xr setsockopt 2
 option accepts an argument of
 .Vt u_int
@@ -191,7 +191,7 @@ in the
 .Sx MIB Variables
 section further down.
 .It Dv TCP_KEEPCNT
-This write-only 
+This write-only
 .Xr setsockopt 2
 option accepts an argument of
 .Vt u_int
___
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


Re: svn commit: r233052 - head/share/mk

2012-03-19 Thread Dimitry Andric
On 2012-03-19 08:21, Chris Rees wrote:
 On 17 Mar 2012 05:40, Bruce Evans b...@optusnet.com.au 
 mailto:b...@optusnet.com.au wrote:

 On Fri, 16 Mar 2012, Dimitry Andric wrote:

 Log:
  Change the style of share/mk/bsd.sys.mk http://bsd.sys.mk to that of the 
 other bsd.*.mk
  files, and style.Makefile(5), where applicable.  While here, update the
  link to the gcc warning documentation.


 Thanks.  I rather liked the ^.* foo style for making ifdefs less
 unreadable, but it didn't look like it was written here, and it is
 a sign of other problems that so many nested ifdefs are used.  It
 only used a single space of each level of indentation, so the
 indentation was still hard too see.

 The other bsd.*.mk files don't include bsd.cpu.mk http://bsd.cpu.mk.  
 This still uses
 the ^. *foo style (and is now the only *.mk file one that does this).
 For assignments, it mostly uses a different unusual style -- just the
 normal C style of a single space before and after '=' (or '+=').  Weird
 formattings of assignments are harder to grep for than weird formattings
 of .foo, so I didn't try looking for them all.
 
 Indented .ifs etc are used (inconsistently) in bsd.port.mk 
 http://bsd.port.mk et al, and can make a huge difference to readability; 
 make is such a messy language that multiple levels are often needed.

Well, the issue with Makefiles is that you cannot indent the actual
statements.  So even if you sort-of-indent the directives, by adding
spaces between the initial dot and the directive name, you still have a
very messy left margin. :)

It would be much nicer to be able to write:

.if defined(FOO)
  .if defined(BAR)
CFLAGS+=-DFOO_BAR
  .endif
.endif

But I guess that would require some overhaul in make.  It doesn't grok
such indentations now.


 Perhaps we should try to agree a standard on them, perhaps two spaces?  It's 
 a shame to be stripping them out.

Two spaces sounds reasonable enough.  Though indent size is probably the
ultimate bikeshed... ;)
___
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


Re: svn commit: r233045 - in head/sys: conf kern

2012-03-19 Thread Gleb Smirnoff
  Davide,

On Fri, Mar 16, 2012 at 08:32:11PM +, Davide Italiano wrote:
D Author: davide
D Date: Fri Mar 16 20:32:11 2012
D New Revision: 233045
D URL: http://svn.freebsd.org/changeset/base/233045
D 
D Log:
D   Add rudimentary profiling of the hash table used in the in the umtx code to
D   hold active lock queues.
D   
D   Reviewed by:   attilio
D   Approved by:   davidxu, gnn (mentor)
D   MFC after: 3 weeks
D 
D Modified:
D   head/sys/conf/NOTES
D   head/sys/conf/options
D   head/sys/kern/kern_umtx.c

...

D  static void
D  umtxq_sysinit(void *arg __unused)
D  {
D @@ -232,8 +265,15 @@ umtxq_sysinit(void *arg __unused)
D  TAILQ_INIT(umtxq_chains[i][j].uc_pi_list);
D  umtxq_chains[i][j].uc_busy = 0;
D  umtxq_chains[i][j].uc_waiters = 0;
D +#ifdef UMTX_PROFILING
D +umtxq_chains[i][j].length = 0;
D +umtxq_chains[i][j].max_length = 0;  
D +#endif
D  }
D  }
D +#ifdef UMTX_PROFILING
D +umtx_init_profiling();
D +#endif
D  mtx_init(umtx_lock, umtx lock, NULL, MTX_SPIN);
D  EVENTHANDLER_REGISTER(process_exec, umtx_exec_hook, NULL,
D  EVENTHANDLER_PRI_ANY);
D @@ -384,6 +424,14 @@ umtxq_insert_queue(struct umtx_q *uq, in
D  
D  TAILQ_INSERT_TAIL(uh-head, uq, uq_link);
D  uh-length++;
D +#ifdef UMTX_PROFILING
D +uc-length++;
D +if (uc-length  uc-max_length) {
D +uc-max_length = uc-length;
D +if (uc-max_length  max_length)
D +max_length = uc-max_length;
D +}
D +#endif
D  uq-uq_flags |= UQF_UMTXQ;
D  uq-uq_cur_queue = uh;
D  return;
D @@ -401,6 +449,9 @@ umtxq_remove_queue(struct umtx_q *uq, in
D  uh = uq-uq_cur_queue;
D  TAILQ_REMOVE(uh-head, uq, uq_link);
D  uh-length--;
D +#ifdef UMTX_PROFILING
D +uc-length--;
D +#endif
D  uq-uq_flags = ~UQF_UMTXQ;
D  if (TAILQ_EMPTY(uh-head)) {
D  KASSERT(uh-length == 0,

These indented ifdefs look like a major violation of style used throughout
the FreeBSD kernel code. Can you please keep with common style?

-- 
Totus tuus, Glebius.
___
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: r233198 - in head/sys/ofed/drivers/infiniband: core ulp/sdp

2012-03-19 Thread John Baldwin
Author: jhb
Date: Mon Mar 19 19:53:53 2012
New Revision: 233198
URL: http://svn.freebsd.org/changeset/base/233198

Log:
  Fix build of OFED bits with debugging options enabled.

Modified:
  head/sys/ofed/drivers/infiniband/core/fmr_pool.c
  head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c

Modified: head/sys/ofed/drivers/infiniband/core/fmr_pool.c
==
--- head/sys/ofed/drivers/infiniband/core/fmr_pool.cMon Mar 19 19:27:43 
2012(r233197)
+++ head/sys/ofed/drivers/infiniband/core/fmr_pool.cMon Mar 19 19:53:53 
2012(r233198)
@@ -150,7 +150,7 @@ static void ib_fmr_batch_release(struct 
 
 #ifdef DEBUG
if (fmr-ref_count !=0) {
-   printk(KERN_WARNING PFX Unmapping FMR 0x%08x with ref 
count %d\n,
+   printk(KERN_WARNING PFX Unmapping FMR %p with ref 
count %d\n,
   fmr, fmr-ref_count);
}
 #endif

Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
==
--- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Mon Mar 19 19:27:43 
2012(r233197)
+++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Mon Mar 19 19:53:53 
2012(r233198)
@@ -855,7 +855,7 @@ sdp_append(struct sdp_sock *ssk, struct 
int ncnt;
 
SOCKBUF_LOCK_ASSERT(sb);
-   SBLASTRECORDCHK(sb)
+   SBLASTRECORDCHK(sb);
KASSERT(mb-m_flags  M_PKTHDR,
(sdp_append: %p Missing packet header.\n, mb));
n = sb-sb_lastrecord;
___
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


Re: svn commit: r233045 - in head/sys: conf kern

2012-03-19 Thread Davide Italiano
2012/3/19 Gleb Smirnoff gleb...@freebsd.org:
  Davide,

 On Fri, Mar 16, 2012 at 08:32:11PM +, Davide Italiano wrote:
 D Author: davide
 D Date: Fri Mar 16 20:32:11 2012
 D New Revision: 233045
 D URL: http://svn.freebsd.org/changeset/base/233045
 D
 D Log:
 D   Add rudimentary profiling of the hash table used in the in the umtx code 
 to
 D   hold active lock queues.
 D
 D   Reviewed by:       attilio
 D   Approved by:       davidxu, gnn (mentor)
 D   MFC after: 3 weeks
 D
 D Modified:
 D   head/sys/conf/NOTES
 D   head/sys/conf/options
 D   head/sys/kern/kern_umtx.c

 ...

 D  static void
 D  umtxq_sysinit(void *arg __unused)
 D  {
 D @@ -232,8 +265,15 @@ umtxq_sysinit(void *arg __unused)
 D                      TAILQ_INIT(umtxq_chains[i][j].uc_pi_list);
 D                      umtxq_chains[i][j].uc_busy = 0;
 D                      umtxq_chains[i][j].uc_waiters = 0;
 D +                    #ifdef UMTX_PROFILING
 D +                    umtxq_chains[i][j].length = 0;
 D +                    umtxq_chains[i][j].max_length = 0;
 D +                    #endif
 D              }
 D      }
 D +    #ifdef UMTX_PROFILING
 D +    umtx_init_profiling();
 D +    #endif
 D      mtx_init(umtx_lock, umtx lock, NULL, MTX_SPIN);
 D      EVENTHANDLER_REGISTER(process_exec, umtx_exec_hook, NULL,
 D          EVENTHANDLER_PRI_ANY);
 D @@ -384,6 +424,14 @@ umtxq_insert_queue(struct umtx_q *uq, in
 D
 D      TAILQ_INSERT_TAIL(uh-head, uq, uq_link);
 D      uh-length++;
 D +    #ifdef UMTX_PROFILING
 D +    uc-length++;
 D +    if (uc-length  uc-max_length) {
 D +            uc-max_length = uc-length;
 D +            if (uc-max_length  max_length)
 D +                    max_length = uc-max_length;
 D +    }
 D +    #endif
 D      uq-uq_flags |= UQF_UMTXQ;
 D      uq-uq_cur_queue = uh;
 D      return;
 D @@ -401,6 +449,9 @@ umtxq_remove_queue(struct umtx_q *uq, in
 D              uh = uq-uq_cur_queue;
 D              TAILQ_REMOVE(uh-head, uq, uq_link);
 D              uh-length--;
 D +            #ifdef UMTX_PROFILING
 D +            uc-length--;
 D +            #endif
 D              uq-uq_flags = ~UQF_UMTXQ;
 D              if (TAILQ_EMPTY(uh-head)) {
 D                      KASSERT(uh-length == 0,

 These indented ifdefs look like a major violation of style used throughout
 the FreeBSD kernel code. Can you please keep with common style?

 --
 Totus tuus, Glebius.

Heh,
sorry, also Juli Mallet noticed this, I'm writing a fix for this and
after I'll have approval from my mentor I'll commit.

Davide
___
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


Re: svn commit: r233045 - in head/sys: conf kern

2012-03-19 Thread Davide Italiano
On Mon, Mar 19, 2012 at 8:54 PM, Davide Italiano
davide.itali...@gmail.com wrote:
 2012/3/19 Gleb Smirnoff gleb...@freebsd.org:
  Davide,

 On Fri, Mar 16, 2012 at 08:32:11PM +, Davide Italiano wrote:
 D Author: davide
 D Date: Fri Mar 16 20:32:11 2012
 D New Revision: 233045
 D URL: http://svn.freebsd.org/changeset/base/233045
 D
 D Log:
 D   Add rudimentary profiling of the hash table used in the in the umtx 
 code to
 D   hold active lock queues.
 D
 D   Reviewed by:       attilio
 D   Approved by:       davidxu, gnn (mentor)
 D   MFC after: 3 weeks
 D
 D Modified:
 D   head/sys/conf/NOTES
 D   head/sys/conf/options
 D   head/sys/kern/kern_umtx.c

 ...

 D  static void
 D  umtxq_sysinit(void *arg __unused)
 D  {
 D @@ -232,8 +265,15 @@ umtxq_sysinit(void *arg __unused)
 D                      TAILQ_INIT(umtxq_chains[i][j].uc_pi_list);
 D                      umtxq_chains[i][j].uc_busy = 0;
 D                      umtxq_chains[i][j].uc_waiters = 0;
 D +                    #ifdef UMTX_PROFILING
 D +                    umtxq_chains[i][j].length = 0;
 D +                    umtxq_chains[i][j].max_length = 0;
 D +                    #endif
 D              }
 D      }
 D +    #ifdef UMTX_PROFILING
 D +    umtx_init_profiling();
 D +    #endif
 D      mtx_init(umtx_lock, umtx lock, NULL, MTX_SPIN);
 D      EVENTHANDLER_REGISTER(process_exec, umtx_exec_hook, NULL,
 D          EVENTHANDLER_PRI_ANY);
 D @@ -384,6 +424,14 @@ umtxq_insert_queue(struct umtx_q *uq, in
 D
 D      TAILQ_INSERT_TAIL(uh-head, uq, uq_link);
 D      uh-length++;
 D +    #ifdef UMTX_PROFILING
 D +    uc-length++;
 D +    if (uc-length  uc-max_length) {
 D +            uc-max_length = uc-length;
 D +            if (uc-max_length  max_length)
 D +                    max_length = uc-max_length;
 D +    }
 D +    #endif
 D      uq-uq_flags |= UQF_UMTXQ;
 D      uq-uq_cur_queue = uh;
 D      return;
 D @@ -401,6 +449,9 @@ umtxq_remove_queue(struct umtx_q *uq, in
 D              uh = uq-uq_cur_queue;
 D              TAILQ_REMOVE(uh-head, uq, uq_link);
 D              uh-length--;
 D +            #ifdef UMTX_PROFILING
 D +            uc-length--;
 D +            #endif
 D              uq-uq_flags = ~UQF_UMTXQ;
 D              if (TAILQ_EMPTY(uh-head)) {
 D                      KASSERT(uh-length == 0,

 These indented ifdefs look like a major violation of style used throughout
 the FreeBSD kernel code. Can you please keep with common style?

 --
 Totus tuus, Glebius.

 Heh,
 sorry, also Juli Mallet noticed this, I'm writing a fix for this and
 after I'll have approval from my mentor I'll commit.

 Davide

This should fix:
http://people.freebsd.org/~davide/umtx_stylefix.diff
Can you plase give it a closer look?
George, if everythin' is ok, can I have also your approval?
___
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


Re: svn commit: r233136 - in head/secure: usr.bin/ssh usr.sbin/sshd

2012-03-19 Thread John Baldwin
On Monday, March 19, 2012 11:55:12 am Eitan Adler wrote:
  This looks wrong.  While X11BASE is certainly dead, LOCALBASE is not, so 
the
  existing code should have been changed, but not removed.
 
 Does this look good?
 Build tested only.

Hmm, I will defer to Des.  Previously the make glue did not hardcode
/usr/local as the default LOCALBASE, instead it only modfied CFLAGS if
LOCALBASE was defined.  (And presumably the openssh code has its own
hardcoded copy of XAUTH_PATH as /usr/local/bin/xauth.)  It's not clear if it 
is better in the case that LOCALBASE is not defined to rely on openssh's 
hardcoded default or to hardcode the default in our bmake glue.  I would lean 
towards the former since it matches the previous behavior, or in shorter form:

.ifdef LOCALBASE
CFLAGS+= /* blah bblah */
.endif

And not do anything if LOCALBASE is not set.  Also, the original commit 
touched two Makefiles, this patch only fixes one of them.

 commit 271b766fdbd907be040767f2387b4d5fbb6425f7
 Author: Eitan Adler li...@eitanadler.com
 Date:   Mon Mar 19 11:52:31 2012 -0400
 
 Restore the ability to use a non-standard LOCALBASE
 
 Submitted by: jhb
 Approved by:  cperciva
 MFC after:0 days (with r233136)
 
 diff --git a/secure/usr.sbin/sshd/Makefile b/secure/usr.sbin/sshd/Makefile
 index 0120771..6426ff3 100644
 --- a/secure/usr.sbin/sshd/Makefile
 +++ b/secure/usr.sbin/sshd/Makefile
 @@ -40,6 +40,9 @@ DPADD+=  ${LIBGSSAPI_KRB5} ${LIBGSSAPI} ${LIBKRB5} 
${LIBASN1}
  LDADD+=   -lgssapi_krb5 -lgssapi -lkrb5 -lasn1
  .endif
 
 +LOCALBASE?= /usr/local
 +CFLAGS+= -DXAUTH_PATH=\${LOCALBASE}/bin/xauth\
 +
  DPADD+=  ${LIBCRYPTO} ${LIBCRYPT}
  LDADD+=  -lcrypto -lcrypt
 
 
 
 -- 
 Eitan Adler
 Source  Ports committer
 X11, Bugbusting teams
 

-- 
John Baldwin
___
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


Re: svn commit: r233103 - head/lib/libthr/thread

2012-03-19 Thread John Baldwin
On Monday, March 19, 2012 11:41:53 am David Xu wrote:
 On 2012/3/19 20:33, John Baldwin wrote:
  On Saturday, March 17, 2012 8:22:29 pm David Xu wrote:
  Author: davidxu
  Date: Sun Mar 18 00:22:29 2012
  New Revision: 233103
  URL: http://svn.freebsd.org/changeset/base/233103
 
  Log:
 Some software think a mutex can be destroyed after it owned it, for
 example, it uses a serialization point like following:
 pthread_mutex_lock(mutex);
 pthread_mutex_unlock(mutex);
 pthread_mutex_destroy(muetx);
 They think a previous lock holder should have already left the mutex and
 is no longer referencing it, so they destroy it. To be maximum 
  compatible
 with such code, we use IA64 version to unlock the mutex in kernel, 
  remove
 the two steps unlocking code.
  But this means they destroy the lock while another thread holds it?  That
  seems wrong.  It's one thing if they know that no other thread has a 
  reference
  to the lock (e.g. it's in a refcounted object and the current thread just
  dropped the reference count to zero).  However, in that case no other thread
  can unlock it after this thread destroys it.  Code that does this seems very
  buggy, since if the address can be unmapped it can also be remapped and
  assigned to another lock, etc., so you could have a thread try to unlock a
  lock it doesn't hold.
 
 They have handshake code to indicate that the mutex is no longer used by 
 previous
 holder. e.g:
 
 thread 1:
  pthread_mutex_lock(mutex);
  done = 1;
  pthread_mutex_unlock(mutex);
 thread 2:
  pthread_mutex_lock(mutex);
  temp = done;
  pthread_mutex_unlock(mutex);
  if (temp == 1)
  pthread_mutex_destroy(mutex);

Hmm, so how does this result in the crash you fixed?  That is, thread 1 has
to fully finish pthread_mutex_unlock() before thread2's pthread_mutex_lock()
can succeed, so I don't see how thread 1 could still be in
pthread_mutex_unlock() when thread 2 calls pthread_mutex_destroy().

 I guess one crash of Python is also caused by the logic, though they use 
 semaphore
 instead of mutex + condition variable to mimic lock.
 POSIX even explicitly requires a condition variable to be destroyable 
 after broadcast,
 once you have correct teardown code. Please read its example section:
 http://pubs.opengroup.org/onlinepubs/007904975/functions/pthread_cond_destroy.html

This is quite different as assuming a broadcast marks all the threads as 
runnable
and removes them from the cv's queue, none of the threads will have references 
to
the cv so it will be safe to destroy.  It would not be safe to destroy the mutex
in that case though (and the example does not destroy the mutex, only the cv).

-- 
John Baldwin
___
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


Re: svn commit: r233136 - in head/secure: usr.bin/ssh usr.sbin/sshd

2012-03-19 Thread Dag-Erling Smørgrav
John Baldwin j...@freebsd.org writes:
 .ifdef LOCALBASE
 CFLAGS+= /* blah bblah */
 .endif

Agreed.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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


Re: svn commit: r233052 - head/share/mk

2012-03-19 Thread Chris Rees
On 19 March 2012 19:37, Dimitry Andric d...@freebsd.org wrote:
 On 2012-03-19 08:21, Chris Rees wrote:
 On 17 Mar 2012 05:40, Bruce Evans b...@optusnet.com.au 
 mailto:b...@optusnet.com.au wrote:

 On Fri, 16 Mar 2012, Dimitry Andric wrote:

 Log:
  Change the style of share/mk/bsd.sys.mk http://bsd.sys.mk to that of 
 the other bsd.*.mk
  files, and style.Makefile(5), where applicable.  While here, update the
  link to the gcc warning documentation.


 Thanks.  I rather liked the ^.* foo style for making ifdefs less
 unreadable, but it didn't look like it was written here, and it is
 a sign of other problems that so many nested ifdefs are used.  It
 only used a single space of each level of indentation, so the
 indentation was still hard too see.

 The other bsd.*.mk files don't include bsd.cpu.mk http://bsd.cpu.mk.  
 This still uses
 the ^. *foo style (and is now the only *.mk file one that does this).
 For assignments, it mostly uses a different unusual style -- just the
 normal C style of a single space before and after '=' (or '+=').  Weird
 formattings of assignments are harder to grep for than weird formattings
 of .foo, so I didn't try looking for them all.

 Indented .ifs etc are used (inconsistently) in bsd.port.mk 
 http://bsd.port.mk et al, and can make a huge difference to readability; 
 make is such a messy language that multiple levels are often needed.

 Well, the issue with Makefiles is that you cannot indent the actual
 statements.  So even if you sort-of-indent the directives, by adding
 spaces between the initial dot and the directive name, you still have a
 very messy left margin. :)

 It would be much nicer to be able to write:

 .if defined(FOO)
  .if defined(BAR)
    CFLAGS+=    -DFOO_BAR
  .endif
 .endif

 But I guess that would require some overhaul in make.  It doesn't grok
 such indentations now.

That's right, lines starting with whitespace *must* be shell
commands-- it'll be some overhaul that changes that...


 Perhaps we should try to agree a standard on them, perhaps two spaces?  It's 
 a shame to be stripping them out.

 Two spaces sounds reasonable enough.  Though indent size is probably the
 ultimate bikeshed... ;)

True-- also whitespace-only changes are probably a bad idea for
merges.  I'm not suggesting changing anything existing, but I'd sure
like to keep the whitespace while it's already there ;)

Chris
___
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: r233202 - head/sys/net

2012-03-19 Thread John Baldwin
Author: jhb
Date: Mon Mar 19 21:09:12 2012
New Revision: 233202
URL: http://svn.freebsd.org/changeset/base/233202

Log:
  Retire the IF_ADDR_LOCK() and IF_ADDR_UNLOCK() compat macros from HEAD.
  The new [RW]LOCK macros are merged back to 8.x so should be suitable for
  new code in HEAD even if it is to be MFC'd.

Modified:
  head/sys/net/if_var.h

Modified: head/sys/net/if_var.h
==
--- head/sys/net/if_var.h   Mon Mar 19 20:49:42 2012(r233201)
+++ head/sys/net/if_var.h   Mon Mar 19 21:09:12 2012(r233202)
@@ -253,9 +253,6 @@ typedef void if_init_f_t(void *);
 #defineIF_ADDR_RUNLOCK(if) rw_runlock((if)-if_addr_lock)
 #defineIF_ADDR_LOCK_ASSERT(if) rw_assert((if)-if_addr_lock, 
RA_LOCKED)
 #defineIF_ADDR_WLOCK_ASSERT(if) rw_assert((if)-if_addr_lock, 
RA_WLOCKED)
-/* XXX: Compat. */
-#defineIF_ADDR_LOCK(if)IF_ADDR_WLOCK(if)
-#defineIF_ADDR_UNLOCK(if)  IF_ADDR_WUNLOCK(if)
 
 /*
  * Function variations on locking macros intended to be used by loadable
___
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: r233203 - in head/sys: amd64/include i386/include ia64/ia32 x86/include

2012-03-19 Thread Tijl Coosemans
Author: tijl
Date: Mon Mar 19 21:24:50 2012
New Revision: 233203
URL: http://svn.freebsd.org/changeset/base/233203

Log:
  Move userland bits (and some common kernel bits) from amd64 and i386
  segments.h to a new x86 segments.h.
  
  Add __packed attribute to some structs (just to be sure).
  Also make it clear that i386 GDT and LDT entries are used in ia64 code.

Added:
  head/sys/x86/include/segments.h   (contents, props changed)
Modified:
  head/sys/amd64/include/segments.h
  head/sys/i386/include/segments.h
  head/sys/ia64/ia32/ia32_signal.c

Modified: head/sys/amd64/include/segments.h
==
--- head/sys/amd64/include/segments.h   Mon Mar 19 21:09:12 2012
(r233202)
+++ head/sys/amd64/include/segments.h   Mon Mar 19 21:24:50 2012
(r233203)
@@ -41,45 +41,7 @@
  * AMD64 Segmentation Data Structures and definitions
  */
 
-/*
- * Selectors
- */
-
-#defineSEL_RPL_MASK3   /* requester priv level */
-#defineISPL(s) ((s)3) /* what is the priority level of a 
selector */
-#defineSEL_KPL 0   /* kernel priority level */
-#defineSEL_UPL 3   /* user priority level */
-#defineISLDT(s)((s)SEL_LDT)   /* is it local or global */
-#defineSEL_LDT 4   /* local descriptor table */
-#defineIDXSEL(s)   (((s)3)  0x1fff) /* index of 
selector */
-#defineLSEL(s,r)   (((s)3) | SEL_LDT | r)/* a local 
selector */
-#defineGSEL(s,r)   (((s)3) | r)  /* a global 
selector */
-
-/*
- * User segment descriptors (%cs, %ds etc for compatability apps. 64 bit wide)
- * For long-mode apps, %cs only has the conforming bit in sd_type, the sd_dpl,
- * sd_p, sd_l and sd_def32 which must be zero).  %ds only has sd_p.
- */
-struct user_segment_descriptor {
-   u_int64_t sd_lolimit:16;/* segment extent (lsb) */
-   u_int64_t sd_lobase:24; /* segment base address (lsb) */
-   u_int64_t sd_type:5;/* segment type */
-   u_int64_t sd_dpl:2; /* segment descriptor priority level */
-   u_int64_t sd_p:1;   /* segment descriptor present */
-   u_int64_t sd_hilimit:4; /* segment extent (msb) */
-   u_int64_t sd_xx:1;  /* unused */
-   u_int64_t sd_long:1;/* long mode (cs only) */
-   u_int64_t sd_def32:1;   /* default 32 vs 16 bit size */
-   u_int64_t sd_gran:1;/* limit granularity (byte/page units)*/
-   u_int64_t sd_hibase:8;  /* segment base address  (msb) */
-} __packed;
-
-#defineUSD_GETBASE(sd) (((sd)-sd_lobase) | (sd)-sd_hibase  
24) 
-#defineUSD_SETBASE(sd, b)  (sd)-sd_lobase = (b);  \
-   (sd)-sd_hibase = ((b)  24);
-#defineUSD_GETLIMIT(sd)(((sd)-sd_lolimit) | (sd)-sd_hilimit 
 16)
-#defineUSD_SETLIMIT(sd, l) (sd)-sd_lolimit = (l); \
-   (sd)-sd_hilimit = ((l)  16);
+#include x86/segments.h
 
 /*
  * System segment descriptors (128 bit wide)
@@ -100,66 +62,6 @@ struct  system_segment_descriptor {
 } __packed;
 
 /*
- * Gate descriptors (e.g. indirect descriptors, trap, interrupt etc. 128 bit)
- * Only interrupt and trap gates have gd_ist.
- */
-struct gate_descriptor {
-   u_int64_t gd_looffset:16;   /* gate offset (lsb) */
-   u_int64_t gd_selector:16;   /* gate segment selector */
-   u_int64_t gd_ist:3; /* IST table index */
-   u_int64_t gd_xx:5;  /* unused */
-   u_int64_t gd_type:5;/* segment type */
-   u_int64_t gd_dpl:2; /* segment descriptor priority level */
-   u_int64_t gd_p:1;   /* segment descriptor present */
-   u_int64_t gd_hioffset:48 __packed;  /* gate offset (msb) */
-   u_int64_t sd_xx1:32;
-} __packed;
-
-/*
- * Generic descriptor
- */
-union  descriptor  {
-   struct  user_segment_descriptor sd;
-   struct  gate_descriptor gd;
-};
-
-   /* system segments and gate types */
-#defineSDT_SYSNULL  0  /* system null */
-#defineSDT_SYS286TSS1  /* system 286 TSS available */
-#defineSDT_SYSLDT   2  /* system 64 bit local descriptor table 
*/
-#defineSDT_SYS286BSY3  /* system 286 TSS busy */
-#defineSDT_SYS286CGT4  /* system 286 call gate */
-#defineSDT_SYSTASKGT5  /* system task gate */
-#defineSDT_SYS286IGT6  /* system 286 interrupt gate */
-#defineSDT_SYS286TGT7  /* system 286 trap gate */
-#defineSDT_SYSNULL2 8  /* system null again */
-#defineSDT_SYSTSS   9  /* system available 64 bit TSS */
-#defineSDT_SYSNULL310  /* system null again */
-#defineSDT_SYSBSY  11  /* system busy 64 bit 

svn commit: r233204 - in head/sys: amd64/include i386/include ia64/ia32 pc98/include x86/include

2012-03-19 Thread Tijl Coosemans
Author: tijl
Date: Mon Mar 19 21:29:57 2012
New Revision: 233204
URL: http://svn.freebsd.org/changeset/base/233204

Log:
  Copy i386 psl.h to x86 and replace amd64/i386/pc98 psl.h with stubs.

Added:
  head/sys/x86/include/psl.h
 - copied unchanged from r233203, head/sys/i386/include/psl.h
Modified:
  head/sys/amd64/include/psl.h
  head/sys/i386/include/psl.h
  head/sys/ia64/ia32/ia32_signal.c
  head/sys/ia64/ia32/ia32_trap.c
  head/sys/pc98/include/psl.h

Modified: head/sys/amd64/include/psl.h
==
--- head/sys/amd64/include/psl.hMon Mar 19 21:24:50 2012
(r233203)
+++ head/sys/amd64/include/psl.hMon Mar 19 21:29:57 2012
(r233204)
@@ -1,84 +1,6 @@
 /*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)psl.h 5.2 (Berkeley) 1/18/91
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD$ */
 
-#ifndef _MACHINE_PSL_H_
-#define_MACHINE_PSL_H_
-
-/*
- * 386 processor status longword.
- */
-#definePSL_C   0x0001  /* carry bit */
-#definePSL_PF  0x0004  /* parity bit */
-#definePSL_AF  0x0010  /* bcd carry bit */
-#definePSL_Z   0x0040  /* zero bit */
-#definePSL_N   0x0080  /* negative bit */
-#definePSL_T   0x0100  /* trace enable bit */
-#definePSL_I   0x0200  /* interrupt enable bit */
-#definePSL_D   0x0400  /* string instruction direction 
bit */
-#definePSL_V   0x0800  /* overflow bit */
-#definePSL_IOPL0x3000  /* i/o privilege level */
-#definePSL_NT  0x4000  /* nested task bit */
-#definePSL_RF  0x0001  /* resume flag bit */
-/* #define PSL_VM  0x0002 */   /* virtual 8086 mode bit */
-#definePSL_AC  0x0004  /* alignment checking */
-/* #define PSL_VIF 0x0008 */   /* virtual interrupt enable */
-/* #define PSL_VIP 0x0010 */   /* virtual interrupt pending */
-#definePSL_ID  0x0020  /* identification bit */
-
-/*
- * The i486 manual says that we are not supposed to change reserved flags,
- * but this is too much trouble since the reserved flags depend on the cpu
- * and setting them to their historical values works in practice.
- */
-#definePSL_RESERVED_DEFAULT0x0002
-
-/*
- * Initial flags for kernel and user mode.  The kernel later inherits
- * PSL_I and some other flags from user mode.
- */
-#definePSL_KERNEL  PSL_RESERVED_DEFAULT
-#definePSL_USER(PSL_RESERVED_DEFAULT | PSL_I)
-
-/*
- * Bits that can be changed in user mode on 486's.  We allow these bits
- * to be changed using ptrace(), sigreturn() and procfs.  Setting PS_NT
- * is undesirable but it may as well be allowed since users can inflict
- * it on the kernel directly.  Changes to PSL_AC are silently ignored on
- * 386's.
- */
-#definePSL_USERCHANGE (PSL_C | PSL_PF | PSL_AF | PSL_Z | PSL_N | PSL_T 
\
-   | PSL_D | PSL_V | PSL_NT | PSL_AC | PSL_ID)
-
-#endif /* !_MACHINE_PSL_H_ */
+#include x86/psl.h

Modified: head/sys/i386/include/psl.h

svn commit: r233207 - in head/sys: amd64/include i386/include ia64/ia32 pc98/include x86/include

2012-03-19 Thread Tijl Coosemans
Author: tijl
Date: Mon Mar 19 21:34:11 2012
New Revision: 233207
URL: http://svn.freebsd.org/changeset/base/233207

Log:
  Copy i386 specialreg.h to x86 and merge with amd64 specialreg.h. Replace
  amd64/i386/pc98 specialreg.h with stubs.

Added:
  head/sys/x86/include/specialreg.h
 - copied, changed from r233203, head/sys/i386/include/specialreg.h
Modified:
  head/sys/amd64/include/specialreg.h
  head/sys/i386/include/specialreg.h
  head/sys/ia64/ia32/ia32_signal.c
  head/sys/pc98/include/specialreg.h

Modified: head/sys/amd64/include/specialreg.h
==
--- head/sys/amd64/include/specialreg.h Mon Mar 19 21:33:35 2012
(r233206)
+++ head/sys/amd64/include/specialreg.h Mon Mar 19 21:34:11 2012
(r233207)
@@ -1,597 +1,6 @@
 /*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: @(#)specialreg.h  7.1 (Berkeley) 5/9/91
- * $FreeBSD$
+ * This file is in the public domain.
  */
+/* $FreeBSD$ */
 
-#ifndef _MACHINE_SPECIALREG_H_
-#define_MACHINE_SPECIALREG_H_
-
-/*
- * Bits in 386 special registers:
- */
-#defineCR0_PE  0x0001  /* Protected mode Enable */
-#defineCR0_MP  0x0002  /* Math (fpu) Present */
-#defineCR0_EM  0x0004  /* EMulate FPU instructions. (trap ESC 
only) */
-#defineCR0_TS  0x0008  /* Task Switched (if MP, trap ESC and 
WAIT) */
-#defineCR0_PG  0x8000  /* PaGing enable */
-
-/*
- * Bits in 486 special registers:
- */
-#defineCR0_NE  0x0020  /* Numeric Error enable (EX16 vs IRQ13) 
*/
-#defineCR0_WP  0x0001  /* Write Protect (honor page protect in
-  all modes) */
-#defineCR0_AM  0x0004  /* Alignment Mask (set to enable AC 
flag) */
-#defineCR0_NW  0x2000  /* Not Write-through */
-#defineCR0_CD  0x4000  /* Cache Disable */
-
-/*
- * Bits in PPro special registers
- */
-#defineCR4_VME 0x0001  /* Virtual 8086 mode extensions */
-#defineCR4_PVI 0x0002  /* Protected-mode virtual interrupts */
-#defineCR4_TSD 0x0004  /* Time stamp disable */
-#defineCR4_DE  0x0008  /* Debugging extensions */
-#defineCR4_PSE 0x0010  /* Page size extensions */
-#defineCR4_PAE 0x0020  /* Physical address extension */
-#defineCR4_MCE 0x0040  /* Machine check enable */
-#defineCR4_PGE 0x0080  /* Page global enable */
-#defineCR4_PCE 0x0100  /* Performance monitoring counter 
enable */
-#defineCR4_FXSR 0x0200 /* Fast FPU save/restore used by OS */
-#defineCR4_XMM 0x0400  /* enable SIMD/MMX2 to use except 16 */
-#defineCR4_XSAVE 0x0004/* XSETBV/XGETBV */
-
-/*
- * Bits in AMD64 special registers.  EFER is 64 bits wide.
- */
-#defineEFER_SCE 0x1/* System Call Extensions (R/W) */
-#defineEFER_LME 0x00100/* Long mode enable (R/W) */
-#defineEFER_LMA 0x00400/* Long mode active (R) */
-#defineEFER_NXE 0x00800/* PTE No-Execute bit enable (R/W) */
-
-/*
- * Intel Extended Features registers
- */
-#defineXCR00   /* XFEATURE_ENABLED_MASK register */
-
-#defineXFEATURE_ENABLED_X870x0001