Re: svn commit: r196460 - head/sys/kern

2009-08-26 Thread Bruce Evans

On Tue, 25 Aug 2009, Jilles Tjoelker wrote:


On Tue, Aug 25, 2009 at 04:07:11AM +1000, Bruce Evans wrote:

On Sun, 23 Aug 2009, Jilles Tjoelker wrote:



I think poll on fifos should instead be fixed by closing the
half-connection corresponding to writing from fi_readsock to
fi_writesock. I have tried this out, see attached patch. With the patch,
pipepoll only gives expected POLLHUP; got POLLIN | POLLHUP errors and
an error in fifo case 6b caused by our distinction between new and old
readers.



This sort of worked for me, but has several problems:



% Index: sys/fs/fifofs/fifo_vnops.c
% ===
% --- sys/fs/fifofs/fifo_vnops.c(revision 196459)
% +++ sys/fs/fifofs/fifo_vnops.c(working copy)
% @@ -193,6 +193,10 @@
%   goto fail2;
%   fip-fi_writesock = wso;
%   error = soconnect2(wso, rso);
% + if (error == 0)
% + error = soshutdown(rso, SHUT_WR);
% + if (error == 0)
% + error = soshutdown(wso, SHUT_RD);
%   if (error) {
%   (void)soclose(wso);
%  fail2:



The second soshutdown() is only harmful.  I see the following state changes
- the first soshutdown() sets SBS_CANTRCVMORE on rso like you would expect,
   and also sets SBS_CANTSENDMORE on wso.  This gives the desired state.
- the second soshutdown() then clears SBS_CANTRCVMORE on rso (without
   the first soshutdown() it leaves both flags clear in both directions).
   This clobbers the desired state.  The failure shows in just one of my
   uncommitted regression tests (when there is a writer and there was
   a reader, poll() returns POLLOUT for the writer, but should return
   POLLHUP; the missing SBS_CANTRCVMORE on rso prevents it ever returning
   POLLHUP for writers).



After removing the second soshutdown() and fixing a spurious POLLIN (see
below), all my tests pass.


I have removed the second shutdown, it is not necessary.


The second shutdown became harmless for me when I fixed the clobbering of
sb_state.  Does it have any effect?


% Index: sys/kern/uipc_socket.c
% ===
% --- sys/kern/uipc_socket.c(revision 196469)
% +++ sys/kern/uipc_socket.c(working copy)
% @@ -2898,11 +2898,13 @@
%   if (so-so_oobmark || (so-so_rcv.sb_state  SBS_RCVATMARK))
%   revents |= events  (POLLPRI | POLLRDBAND);
%
% - if ((events  POLLINIGNEOF) == 0)
% - if (so-so_rcv.sb_state  SBS_CANTRCVMORE)
% - revents |= POLLHUP;
% - if (so-so_snd.sb_state  SBS_CANTSENDMORE)
% - revents |= POLLHUP;
% + if ((events  POLLINIGNEOF) == 0) {



Old problems become larger:



I don't like POLLINIGNEOF (for input) affecting POLLHUP for output.  This
seems to cause no problems for fifos, at least when the kernel sets
POLLINIGNEOF, but it is hard to understand even why it doesn't cause
problems, and kib@ wants POLLINIGNEOF to remain user-settable, so the
complications might remain exported to userland for for fifos and
sockets, where they are harder to document and understand.


I do not like userland POLLINIGNEOF either. I think programs can do fine
with the standard functionality (closing and reopening a fifo to reset
the POLLHUP state).


% + revents |= events  (POLLIN | POLLRDNORM);



This gives spurious POLLINs when POLLHUP is also returned, and thus defeats
the point of soreadable_data() being different from soreadable().  Tests
6a-6d show the spurious POLLIN.  I don't understand how tests 6a and 6c-6d
passed for you.


Same problem here. I think kib@ wants to keep this in 8.x for the sake
of buggy programs that do not check for POLLHUP. I suppose we can do it
properly in 9.x.


But it may break non-buggy programs, and doesn't help for buggy programs
like gdb.  (gdb exits immediately when it sees POLLHUP, despite POLLIN
also being set and input being queued.  gdb used to work before it was
converted to use poll().  Then it saw a ready input fd and had to read()
it to detect EOF.)

I now have better tests for POLLOUT, and have tested the buggy case
for select some more (test 9, and 6b (?) in current): if POLLINIGNEOF
is not applied for select(), then test 9 passes as expected.  Test 9
only covers a fifo in initial state with a reader and no writers.  This
is EOF for read() and input-ready for select(), but neither POLLIN nor
POLLHUP for poll().  Test 6b is for essentially the initial state for
read() and select(), but for poll() the state is too-sticky hangup
(POSIX) or back to the initial state (Linux-2.6.10/FreeBSD-current).

Bruce
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r196550 - in head: etc/defaults etc/rc.d share/man/man5

2009-08-26 Thread Pawel Jakub Dawidek
On Tue, Aug 25, 2009 at 10:42:58PM +0300, Gleb Kurtsou wrote:
 On (25/08/2009 19:07), Xin LI wrote:
  Author: delphij
  Date: Tue Aug 25 19:07:26 2009
  New Revision: 196550
  URL: http://svn.freebsd.org/changeset/base/196550
  
  Log:
Add a new rc.d script, static_arp, which enables the administrator to
statically bind IPv4 - MAC address at boot time.

In order to use this, the administrator needs to configure the following
rc.conf(5) variable:

 - static_arp_pairs: A list of names for static bind pairs, and,
 - a series of static_arp_(name): the arguments that is being passed to
   ``arp -S'' operation.

Example:
  static_arp_pairs=gw
  static_arp_gw=192.168.1.1 00:01:02:03:04:05

See the rc.conf(5) manual page for more details.
 Thanks for it!
 
 Would you please add support for reading pairs from file, that should be
 trivial. I've been using my own rc script for reading static arp entries
 from file but can't find it right now.

I put '/usr/sbin/arp -f /etc/arp.conf' into /etc/rc.local on almost all
of my servers, which is very handy, indeed. And with your patch proposed
in another e-mail to be able to remove entries defined in a file seems
to be a complete solution. I'd also like to see support for it.

-- 
Pawel Jakub Dawidek   http://www.wheel.pl
p...@freebsd.org   http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!


pgpZmKaVitYOG.pgp
Description: PGP signature


svn commit: r196559 - head/sys/net

2009-08-26 Thread Robert Watson
Author: rwatson
Date: Wed Aug 26 11:13:10 2009
New Revision: 196559
URL: http://svn.freebsd.org/changeset/base/196559

Log:
  Add IFNET_HOLD reserved pointer value for the ifindex ifnet array,
  which allows an index to be reserved for an ifnet without making
  the ifnet available for management operations.  Use this in if_alloc()
  while the ifnet lock is released between initial index allocation and
  completion of ifnet initialization.
  
  Add ifindex_free() to centralize the implementation of releasing an
  ifindex value.  Use in if_free() and if_vmove(), as well as when
  releasing a held index in if_alloc().
  
  Reviewed by:  bz
  MFC after:3 days

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Wed Aug 26 03:30:06 2009(r196558)
+++ head/sys/net/if.c   Wed Aug 26 11:13:10 2009(r196559)
@@ -175,6 +175,13 @@ intifqmaxlen = IFQ_MAXLEN;
 struct rwlock ifnet_rwlock;
 struct sx ifnet_sxlock;
 
+/*
+ * The allocation of network interfaces is a rather non-atomic affair; we
+ * need to select an index before we are ready to expose the interface for
+ * use, so will use this pointer value to indicate reservation.
+ */
+#defineIFNET_HOLD  (void *)(uintptr_t)(-1)
+
 static if_com_alloc_t *if_com_alloc[256];
 static if_com_free_t *if_com_free[256];
 
@@ -193,6 +200,8 @@ ifnet_byindex_locked(u_short idx)
 
if (idx  V_if_index)
return (NULL);
+   if (V_ifindex_table[idx].ife_ifnet == IFNET_HOLD)
+   return (NULL);
return (V_ifindex_table[idx].ife_ifnet);
 }
 
@@ -228,18 +237,18 @@ ifnet_byindex_ref(u_short idx)
  * failure.
  */
 static int
-ifindex_alloc(u_short *idxp)
+ifindex_alloc_locked(u_short *idxp)
 {
u_short idx;
 
IFNET_WLOCK_ASSERT();
 
/*
-* Try to find an empty slot below if_index.  If we fail, take the
+* Try to find an empty slot below V_if_index.  If we fail, take the
 * next slot.
 */
for (idx = 1; idx = V_if_index; idx++) {
-   if (ifnet_byindex_locked(idx) == NULL)
+   if (V_ifindex_table[idx].ife_ifnet == NULL)
break;
}
 
@@ -255,6 +264,27 @@ ifindex_alloc(u_short *idxp)
 }
 
 static void
+ifindex_free_locked(u_short idx)
+{
+
+   IFNET_WLOCK_ASSERT();
+
+   V_ifindex_table[idx].ife_ifnet = NULL;
+   while (V_if_index  0 
+   V_ifindex_table[V_if_index].ife_ifnet == NULL)
+   V_if_index--;
+}
+
+static void
+ifindex_free(u_short idx)
+{
+
+   IFNET_WLOCK();
+   ifindex_free_locked(idx);
+   IFNET_WUNLOCK();
+}
+
+static void
 ifnet_setbyindex_locked(u_short idx, struct ifnet *ifp)
 {
 
@@ -370,11 +400,12 @@ if_alloc(u_char type)
 
ifp = malloc(sizeof(struct ifnet), M_IFNET, M_WAITOK|M_ZERO);
IFNET_WLOCK();
-   if (ifindex_alloc(idx) != 0) {
+   if (ifindex_alloc_locked(idx) != 0) {
IFNET_WUNLOCK();
free(ifp, M_IFNET);
return (NULL);
}
+   ifnet_setbyindex_locked(idx, IFNET_HOLD);
IFNET_WUNLOCK();
ifp-if_index = idx;
ifp-if_type = type;
@@ -383,6 +414,7 @@ if_alloc(u_char type)
ifp-if_l2com = if_com_alloc[type](type, ifp);
if (ifp-if_l2com == NULL) {
free(ifp, M_IFNET);
+   ifindex_free(idx);
return (NULL);
}
}
@@ -421,9 +453,7 @@ if_free_internal(struct ifnet *ifp)
KASSERT(ifp == ifnet_byindex_locked(ifp-if_index),
(%s: freeing unallocated ifnet, ifp-if_xname));
 
-   ifnet_setbyindex_locked(ifp-if_index, NULL);
-   while (V_if_index  0  ifnet_byindex_locked(V_if_index) == NULL)
-   V_if_index--;
+   ifindex_free_locked(ifp-if_index);
IFNET_WUNLOCK();
 
if (if_com_free[ifp-if_alloctype] != NULL)
@@ -916,18 +946,14 @@ if_vmove(struct ifnet *ifp, struct vnet 
 * or we'd lock on one vnet and unlock on another.
 */
IFNET_WLOCK();
-   ifnet_setbyindex_locked(ifp-if_index, NULL);
-   while (V_if_index  0  ifnet_byindex_locked(V_if_index) == NULL)
-   V_if_index--;
-   IFNET_WUNLOCK();
+   ifindex_free_locked(ifp-if_index);
 
/*
 * Switch to the context of the target vnet.
 */
CURVNET_SET_QUIET(new_vnet);
 
-   IFNET_WLOCK();
-   if (ifindex_alloc(idx) != 0) {
+   if (ifindex_alloc_locked(idx) != 0) {
IFNET_WUNLOCK();
panic(if_index overflow);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r196550 - in head: etc/defaults etc/rc.d share/man/man5

2009-08-26 Thread Bruce Simpson

Xin LI wrote:

Log:
  Add a new rc.d script, static_arp, which enables the administrator to
  statically bind IPv4 - MAC address at boot time.
  


Thanks for doing this -- users will love this!

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r196558 - head/usr.bin/look

2009-08-26 Thread John Baldwin
On Tuesday 25 August 2009 11:30:06 pm Colin Percival wrote:
 Author: cperciva
 Date: Wed Aug 26 03:30:06 2009
 New Revision: 196558
 URL: http://svn.freebsd.org/changeset/base/196558
 
 Log:
   Don't try to mmap the contents of empty files.  This behaviour was harmless
   prior to r195693, since historical behaviour of mmap(2) was to silently
   ignore length-zero mmap requests; but mmap now returns EINVAL, which caused
   look(1) to emit an error message and fail.

FWIW, it did not silently ignore the request.  Instead it rounded the size up
to a page and mapped a page of data.  However, if you then passed that pointer
with a length of 0 to munmap() munmap() would fail.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196560 - head/sys/kern

2009-08-26 Thread Konstantin Belousov
Author: kib
Date: Wed Aug 26 14:32:37 2009
New Revision: 196560
URL: http://svn.freebsd.org/changeset/base/196560

Log:
  Honor the vfs.timestamp_precision sysctl settings for utimes(path, NULL)
  and similar calls.
  
  Obtained from:Petr Salinger, Debian GNU/kFreeBSD, Debian bug #489894
  MFC after:3 days

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==
--- head/sys/kern/vfs_syscalls.cWed Aug 26 11:13:10 2009
(r196559)
+++ head/sys/kern/vfs_syscalls.cWed Aug 26 14:32:37 2009
(r196560)
@@ -3134,8 +3134,7 @@ getutimes(usrtvp, tvpseg, tsp)
int error;
 
if (usrtvp == NULL) {
-   microtime(tv[0]);
-   TIMEVAL_TO_TIMESPEC(tv[0], tsp[0]);
+   vfs_timestamp(tsp[0]);
tsp[1] = tsp[0];
} else {
if (tvpseg == UIO_SYSSPACE) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r196382 - head/contrib/top

2009-08-26 Thread Roman Divacky
On Wed, Aug 19, 2009 at 03:17:13PM +, John Baldwin wrote:
 Author: jhb
 Date: Wed Aug 19 15:17:13 2009
 New Revision: 196382
 URL: http://svn.freebsd.org/changeset/base/196382
 
 Log:
   Explicitly line up the CPU state labels with the calculated starting column
   that takes into account the width of the largest CPU ID.  On systems with
10 CPUs the labels for the first 10 CPUs were not lined up properly
   otherwise.

what happened to the import of newer top?
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r196454 - head/sys/kern

2009-08-26 Thread Roman Divacky
On Sun, Aug 23, 2009 at 09:55:06AM +, Rui Paulo wrote:
 Author: rpaulo
 Date: Sun Aug 23 09:55:06 2009
 New Revision: 196454
 URL: http://svn.freebsd.org/changeset/base/196454
 
 Log:
   Constify prime numbers.
 
 Modified:
   head/sys/kern/kern_subr.c
 
 Modified: head/sys/kern/kern_subr.c
 ==
 --- head/sys/kern/kern_subr.c Sun Aug 23 08:49:32 2009(r196453)
 +++ head/sys/kern/kern_subr.c Sun Aug 23 09:55:06 2009(r196454)
 @@ -419,9 +419,9 @@ hashdestroy(void *vhashtbl, struct mallo
   free(hashtbl, type);
  }
  
 -static int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, 2039,
 - 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143, 6653,
 - 7159, 7673, 8191, 12281, 16381, 24571, 32749 };
 +static const int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531,
 + 2039, 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143,
 + 6653, 7159, 7673, 8191, 12281, 16381, 24571, 32749 };
  #define NPRIMES (sizeof(primes) / sizeof(primes[0]))
  
  /*

btw... this is currently unused as we dont use the prime hash. maybe we
can remove this completely?
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r196550 - in head: etc/defaults etc/rc.d share/man/man5

2009-08-26 Thread Doug Barton
Pawel Jakub Dawidek wrote:

 I put '/usr/sbin/arp -f /etc/arp.conf' into /etc/rc.local on almost all
 of my servers, which is very handy, indeed. And with your patch proposed
 in another e-mail to be able to remove entries defined in a file seems
 to be a complete solution. I'd also like to see support for it.

What would the relative value be of adding support for files vs. using
the method that Xin already created? I understand that you will have a
one-time cost of migrating your conf file to Xin's format 


Doug

-- 

This .signature sanitized for your protection

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196561 - stable/7/sys/netinet

2009-08-26 Thread Peter Wemm
Author: peter
Date: Wed Aug 26 19:45:17 2009
New Revision: 196561
URL: http://svn.freebsd.org/changeset/base/196561

Log:
  MFC r194304: Fix ticks overflow in the handling of t_badtrxtwin.

Modified:
  stable/7/sys/netinet/tcp_input.c

Modified: stable/7/sys/netinet/tcp_input.c
==
--- stable/7/sys/netinet/tcp_input.cWed Aug 26 14:32:37 2009
(r196560)
+++ stable/7/sys/netinet/tcp_input.cWed Aug 26 19:45:17 2009
(r196561)
@@ -1030,7 +1030,7 @@ tcp_do_segment(struct mbuf *m, struct tc
 * bad retransmit recovery.
 */
if (tp-t_rxtshift == 1 
-   ticks  tp-t_badrxtwin) {
+   (int)(ticks - tp-t_badrxtwin)  0) {
++tcpstat.tcps_sndrexmitbad;
tp-snd_cwnd = tp-snd_cwnd_prev;
tp-snd_ssthresh =
@@ -1961,7 +1961,7 @@ process_ACK:
 * original cwnd and ssthresh, and proceed to transmit where
 * we left off.
 */
-   if (tp-t_rxtshift == 1  ticks  tp-t_badrxtwin) {
+   if (tp-t_rxtshift == 1  (int)(ticks - tp-t_badrxtwin)  0) {
++tcpstat.tcps_sndrexmitbad;
tp-snd_cwnd = tp-snd_cwnd_prev;
tp-snd_ssthresh = tp-snd_ssthresh_prev;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196562 - stable/6/sys/netinet

2009-08-26 Thread Peter Wemm
Author: peter
Date: Wed Aug 26 19:50:27 2009
New Revision: 196562
URL: http://svn.freebsd.org/changeset/base/196562

Log:
  MFC: r196410: fix timewait expiration code when ticks goes negative after
  24 days of uptime.

Modified:
  stable/6/sys/netinet/tcp_timer.c

Modified: stable/6/sys/netinet/tcp_timer.c
==
--- stable/6/sys/netinet/tcp_timer.cWed Aug 26 19:45:17 2009
(r196561)
+++ stable/6/sys/netinet/tcp_timer.cWed Aug 26 19:50:27 2009
(r196562)
@@ -247,7 +247,7 @@ tcp_timer_2msl_tw(int reuse)
INP_INFO_WLOCK_ASSERT(tcbinfo);
for (;;) {
tw = TAILQ_FIRST(twq_2msl);
-   if (tw == NULL || (!reuse  tw-tw_time  ticks))
+   if (tw == NULL || (!reuse  (int)(tw-tw_time - ticks)  0))
break;
INP_LOCK(tw-tw_inpcb);
tcp_twclose(tw, reuse);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r196550 - in head: etc/defaults etc/rc.d share/man/man5

2009-08-26 Thread Gleb Kurtsou
On (26/08/2009 12:42), Doug Barton wrote:
 Pawel Jakub Dawidek wrote:
 
  I put '/usr/sbin/arp -f /etc/arp.conf' into /etc/rc.local on almost all
  of my servers, which is very handy, indeed. And with your patch proposed
  in another e-mail to be able to remove entries defined in a file seems
  to be a complete solution. I'd also like to see support for it.
 
 What would the relative value be of adding support for files vs. using
 the method that Xin already created? I understand that you will have a
 one-time cost of migrating your conf file to Xin's format 
Unless there are too many arp entries to convert and these files are
also used by other utilities. Adding support for reading it from file
is negligible comparing to the effort one should take to convert plain
'arp -f' entires into rc.conf style and keep them in sync.

Thanks,
Gleb

 
 
 Doug
 
 -- 
 
 This .signature sanitized for your protection
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196563 - stable/6/sys/netinet

2009-08-26 Thread Peter Wemm
Author: peter
Date: Wed Aug 26 19:51:54 2009
New Revision: 196563
URL: http://svn.freebsd.org/changeset/base/196563

Log:
  MFC r194304: Fix ticks overflow in the handling of t_badtrxtwin.

Modified:
  stable/6/sys/netinet/tcp_input.c

Modified: stable/6/sys/netinet/tcp_input.c
==
--- stable/6/sys/netinet/tcp_input.cWed Aug 26 19:50:27 2009
(r196562)
+++ stable/6/sys/netinet/tcp_input.cWed Aug 26 19:51:54 2009
(r196563)
@@ -1182,7 +1182,7 @@ after_listen:
 * bad retransmit recovery
 */
if (tp-t_rxtshift == 1 
-   ticks  tp-t_badrxtwin) {
+   (int)(ticks - tp-t_badrxtwin)  0) {
++tcpstat.tcps_sndrexmitbad;
tp-snd_cwnd = tp-snd_cwnd_prev;
tp-snd_ssthresh =
@@ -2070,7 +2070,7 @@ process_ACK:
 * original cwnd and ssthresh, and proceed to transmit where
 * we left off.
 */
-   if (tp-t_rxtshift == 1  ticks  tp-t_badrxtwin) {
+   if (tp-t_rxtshift == 1  (int)(ticks - tp-t_badrxtwin)  0) {
++tcpstat.tcps_sndrexmitbad;
tp-snd_cwnd = tp-snd_cwnd_prev;
tp-snd_ssthresh = tp-snd_ssthresh_prev;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196564 - in stable/8/release: . doc scripts

2009-08-26 Thread Doug Barton
Author: dougb
Date: Wed Aug 26 20:57:21 2009
New Revision: 196564
URL: http://svn.freebsd.org/changeset/base/196564

Log:
  MFC 196434:
  
  Add a script to create the /var/db/mergemaster.mtree file for new
  releases so that when users subsequently update their source trees
  they can make use of mergemaster's -U option.
  
  Approved by:  re (kib)

Added:
  stable/8/release/scripts/mm-mtree.sh
 - copied unchanged from r196434, head/release/scripts/mm-mtree.sh
Modified:
  stable/8/release/   (props changed)
  stable/8/release/doc/   (props changed)

Copied: stable/8/release/scripts/mm-mtree.sh (from r196434, 
head/release/scripts/mm-mtree.sh)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/8/release/scripts/mm-mtree.shWed Aug 26 20:57:21 2009
(r196564, copy of r196434, head/release/scripts/mm-mtree.sh)
@@ -0,0 +1,155 @@
+#!/bin/sh
+
+# mergemaster mtree database generator
+
+# This script is intended to be used as part of the release building
+# process to generate the /var/db/mergemaster.mtree file relevant to
+# the source tree used to create the release so that users can make
+# use of mergemaster's -U option to update their files after csup'ing
+# to -stable.
+
+# Copyright 2009 Douglas Barton
+# do...@freebsd.org
+
+# $FreeBSD$
+
+PATH=/bin:/usr/bin:/usr/sbin
+
+display_usage () {
+  VERSION_NUMBER=`grep [$]FreeBSD: $0 | cut -d ' ' -f 4`
+  echo ${0##*/} version ${VERSION_NUMBER}
+  echo Usage: ${0##*/} [-m /path] [-t /path] [-A arch] [-F make args] [-D 
/path]
+  echo Options:
+  echo   -m /path/directory  Specify location of source to do the make in
+  echo   -t /path/directory  Specify temp root directory
+  echo   -A architecture  Alternative architecture name to pass to make
+  echo   -F arguments for make Specify what to put on the make command line
+  echo '  -D /path/directory  Specify the destination directory to install 
files to'
+  echo ''
+}
+
+# Set the default path for the temporary root environment
+#
+TEMPROOT='/var/tmp/temproot'
+
+# Assign the location of the mtree database
+#
+MTREEDB=${MTREEDB:-/var/db}
+MTREEFILE=${MTREEDB}/mergemaster.mtree
+
+# Check the command line options
+#
+while getopts m:t:A:F:D:h COMMAND_LINE_ARGUMENT ; do
+  case ${COMMAND_LINE_ARGUMENT} in
+  m)
+SOURCEDIR=${OPTARG}
+;;
+  t)
+TEMPROOT=${OPTARG}
+;;
+  A)
+ARCHSTRING='TARGET_ARCH='${OPTARG}
+;;
+  F)
+MM_MAKE_ARGS=${OPTARG}
+;;
+  D)
+DESTDIR=${OPTARG}
+;;
+  h)
+display_usage
+exit 0
+;;
+  *)
+echo ''
+display_usage
+exit 1
+;;
+  esac
+done
+
+# Assign the source directory
+#
+SOURCEDIR=${SOURCEDIR:-/usr/src}
+if [ ! -f ${SOURCEDIR}/Makefile.inc1 -a \
+   -f ${SOURCEDIR}/../Makefile.inc1 ]; then
+  echo  *** The source directory you specified (${SOURCEDIR})
+  echo  will be reset to ${SOURCEDIR}/..
+  echo ''
+  sleep 3
+  SOURCEDIR=${SOURCEDIR}/..
+fi
+
+# Setup make to use system files from SOURCEDIR
+MM_MAKE=make ${ARCHSTRING} ${MM_MAKE_ARGS} -m ${SOURCEDIR}/share/mk
+
+delete_temproot () {
+  rm -rf ${TEMPROOT} 2/dev/null
+  chflags -R 0 ${TEMPROOT} 2/dev/null
+  rm -rf ${TEMPROOT} || exit 1
+}
+
+[ -d ${TEMPROOT} ]  delete_temproot
+
+echo *** Creating the temporary root environment in ${TEMPROOT}
+
+if mkdir -p ${TEMPROOT}; then
+  echo  *** ${TEMPROOT} ready for use
+fi
+
+if [ ! -d ${TEMPROOT} ]; then
+  echo ''
+  echo   *** FATAL ERROR: Cannot create ${TEMPROOT}
+  echo ''
+  exit 1
+fi
+
+echo  *** Creating and populating directory structure in ${TEMPROOT}
+echo ''
+
+{ cd ${SOURCEDIR} || { echo *** Cannot cd to ${SOURCEDIR} ; exit 1;}
+  case ${DESTDIR} in
+  '') ;;
+  *)
+${MM_MAKE} DESTDIR=${DESTDIR} distrib-dirs
+;;
+  esac
+  od=${TEMPROOT}/usr/obj
+  ${MM_MAKE} DESTDIR=${TEMPROOT} distrib-dirs 
+  MAKEOBJDIRPREFIX=$od ${MM_MAKE} _obj SUBDIR_OVERRIDE=etc 
+  MAKEOBJDIRPREFIX=$od ${MM_MAKE} everything SUBDIR_OVERRIDE=etc 
+  MAKEOBJDIRPREFIX=$od ${MM_MAKE} DESTDIR=${TEMPROOT} distribution;} ||
+  { echo '';
+echo   *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to;
+echo   the temproot environment;
+echo '';
+exit 1;}
+
+# We really don't want to have to deal with files like login.conf.db, pwd.db,
+# or spwd.db.  Instead, we want to compare the text versions, and run *_mkdb.
+# Prompt the user to do so below, as needed.
+#
+rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd
+
+# We only need to compare things like freebsd.cf once
+find ${TEMPROOT}/usr/obj -type f -delete 2/dev/null
+
+# Delete stuff we do not need to keep the mtree database small,
+# and to make the actual comparison faster.
+find ${TEMPROOT}/usr -type l -delete 2/dev/null
+find ${TEMPROOT} -type f -size 0 -delete 2/dev/null
+find -d ${TEMPROOT} -type d -empty -delete 2/dev/null
+
+# Build the mtree database in a temporary location.
+MTREENEW=`mktemp -t mergemaster.mtree`

svn commit: r196565 - in stable/7/release: . scripts

2009-08-26 Thread Doug Barton
Author: dougb
Date: Wed Aug 26 21:05:17 2009
New Revision: 196565
URL: http://svn.freebsd.org/changeset/base/196565

Log:
  MFC 196434:
  
  Add a script to create the /var/db/mergemaster.mtree file for new
  releases so that when users subsequently update their source trees
  they can make use of mergemaster's -U option.

Added:
  stable/7/release/scripts/mm-mtree.sh
 - copied unchanged from r196434, head/release/scripts/mm-mtree.sh
Modified:
  stable/7/release/   (props changed)
  stable/7/release/scripts/src-install.sh   (props changed)

Copied: stable/7/release/scripts/mm-mtree.sh (from r196434, 
head/release/scripts/mm-mtree.sh)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/7/release/scripts/mm-mtree.shWed Aug 26 21:05:17 2009
(r196565, copy of r196434, head/release/scripts/mm-mtree.sh)
@@ -0,0 +1,155 @@
+#!/bin/sh
+
+# mergemaster mtree database generator
+
+# This script is intended to be used as part of the release building
+# process to generate the /var/db/mergemaster.mtree file relevant to
+# the source tree used to create the release so that users can make
+# use of mergemaster's -U option to update their files after csup'ing
+# to -stable.
+
+# Copyright 2009 Douglas Barton
+# do...@freebsd.org
+
+# $FreeBSD$
+
+PATH=/bin:/usr/bin:/usr/sbin
+
+display_usage () {
+  VERSION_NUMBER=`grep [$]FreeBSD: $0 | cut -d ' ' -f 4`
+  echo ${0##*/} version ${VERSION_NUMBER}
+  echo Usage: ${0##*/} [-m /path] [-t /path] [-A arch] [-F make args] [-D 
/path]
+  echo Options:
+  echo   -m /path/directory  Specify location of source to do the make in
+  echo   -t /path/directory  Specify temp root directory
+  echo   -A architecture  Alternative architecture name to pass to make
+  echo   -F arguments for make Specify what to put on the make command line
+  echo '  -D /path/directory  Specify the destination directory to install 
files to'
+  echo ''
+}
+
+# Set the default path for the temporary root environment
+#
+TEMPROOT='/var/tmp/temproot'
+
+# Assign the location of the mtree database
+#
+MTREEDB=${MTREEDB:-/var/db}
+MTREEFILE=${MTREEDB}/mergemaster.mtree
+
+# Check the command line options
+#
+while getopts m:t:A:F:D:h COMMAND_LINE_ARGUMENT ; do
+  case ${COMMAND_LINE_ARGUMENT} in
+  m)
+SOURCEDIR=${OPTARG}
+;;
+  t)
+TEMPROOT=${OPTARG}
+;;
+  A)
+ARCHSTRING='TARGET_ARCH='${OPTARG}
+;;
+  F)
+MM_MAKE_ARGS=${OPTARG}
+;;
+  D)
+DESTDIR=${OPTARG}
+;;
+  h)
+display_usage
+exit 0
+;;
+  *)
+echo ''
+display_usage
+exit 1
+;;
+  esac
+done
+
+# Assign the source directory
+#
+SOURCEDIR=${SOURCEDIR:-/usr/src}
+if [ ! -f ${SOURCEDIR}/Makefile.inc1 -a \
+   -f ${SOURCEDIR}/../Makefile.inc1 ]; then
+  echo  *** The source directory you specified (${SOURCEDIR})
+  echo  will be reset to ${SOURCEDIR}/..
+  echo ''
+  sleep 3
+  SOURCEDIR=${SOURCEDIR}/..
+fi
+
+# Setup make to use system files from SOURCEDIR
+MM_MAKE=make ${ARCHSTRING} ${MM_MAKE_ARGS} -m ${SOURCEDIR}/share/mk
+
+delete_temproot () {
+  rm -rf ${TEMPROOT} 2/dev/null
+  chflags -R 0 ${TEMPROOT} 2/dev/null
+  rm -rf ${TEMPROOT} || exit 1
+}
+
+[ -d ${TEMPROOT} ]  delete_temproot
+
+echo *** Creating the temporary root environment in ${TEMPROOT}
+
+if mkdir -p ${TEMPROOT}; then
+  echo  *** ${TEMPROOT} ready for use
+fi
+
+if [ ! -d ${TEMPROOT} ]; then
+  echo ''
+  echo   *** FATAL ERROR: Cannot create ${TEMPROOT}
+  echo ''
+  exit 1
+fi
+
+echo  *** Creating and populating directory structure in ${TEMPROOT}
+echo ''
+
+{ cd ${SOURCEDIR} || { echo *** Cannot cd to ${SOURCEDIR} ; exit 1;}
+  case ${DESTDIR} in
+  '') ;;
+  *)
+${MM_MAKE} DESTDIR=${DESTDIR} distrib-dirs
+;;
+  esac
+  od=${TEMPROOT}/usr/obj
+  ${MM_MAKE} DESTDIR=${TEMPROOT} distrib-dirs 
+  MAKEOBJDIRPREFIX=$od ${MM_MAKE} _obj SUBDIR_OVERRIDE=etc 
+  MAKEOBJDIRPREFIX=$od ${MM_MAKE} everything SUBDIR_OVERRIDE=etc 
+  MAKEOBJDIRPREFIX=$od ${MM_MAKE} DESTDIR=${TEMPROOT} distribution;} ||
+  { echo '';
+echo   *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to;
+echo   the temproot environment;
+echo '';
+exit 1;}
+
+# We really don't want to have to deal with files like login.conf.db, pwd.db,
+# or spwd.db.  Instead, we want to compare the text versions, and run *_mkdb.
+# Prompt the user to do so below, as needed.
+#
+rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd
+
+# We only need to compare things like freebsd.cf once
+find ${TEMPROOT}/usr/obj -type f -delete 2/dev/null
+
+# Delete stuff we do not need to keep the mtree database small,
+# and to make the actual comparison faster.
+find ${TEMPROOT}/usr -type l -delete 2/dev/null
+find ${TEMPROOT} -type f -size 0 -delete 2/dev/null
+find -d ${TEMPROOT} -type d -empty -delete 2/dev/null
+
+# Build the mtree database in a temporary location.
+MTREENEW=`mktemp -t mergemaster.mtree`
+mtree -ci 

svn commit: r196566 - in stable/8/etc: . rc.d

2009-08-26 Thread Doug Barton
Author: dougb
Date: Wed Aug 26 21:08:41 2009
New Revision: 196566
URL: http://svn.freebsd.org/changeset/base/196566

Log:
  MFC 196436;
  
  Move is_wired_interface() from rc.d/wpa_supplicant into network.subr,
  simplify it a bit, and make use of that method to determine if an
  interface is a candidate for IPv6 rtsol rather than listing all of the
  possible wireless interfaces that should _not_ get rtsol'ed.
  
  This change is only relevant for 8.0+ unless the wlan mandatory code
  gets ported back to RELENG_7.
  
  Approved by:  re (kib)

Modified:
  stable/8/etc/   (props changed)
  stable/8/etc/network.subr
  stable/8/etc/rc.d/wpa_supplicant

Modified: stable/8/etc/network.subr
==
--- stable/8/etc/network.subr   Wed Aug 26 21:05:17 2009(r196565)
+++ stable/8/etc/network.subr   Wed Aug 26 21:08:41 2009(r196566)
@@ -816,6 +816,17 @@ hexprint()
echo ${str}
 }
 
+is_wired_interface()
+{
+   local media
+
+   case `ifconfig $1 2/dev/null` in
+   *media:?Ethernet*) media=Ethernet ;;
+   esac
+
+   test $media = Ethernet
+}
+
 # Setup the interfaces for IPv6
 network6_interface_setup()
 {
@@ -858,14 +869,19 @@ network6_interface_setup()
ifconfig $i inet6 ${ipv6_ifconfig} alias
fi
 
+   # Wireless NIC cards are virtualized through the wlan interface
+   if ! is_wired_interface ${i}; then
+   case ${i} in
+   wlan*)  rtsol_available=yes ;;
+   *)  rtsol_available=no ;;
+   esac
+   fi
+
if [ ${rtsol_available} = yes -a ${rtsol_interface} = yes ]
then
case ${i} in

lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*|pflog[0-9]*|pfsync[0-9]*)
;;
-   # Wireless NIC cards are virtualized through the wlan 
interface
-   
an[0-9]*|ath[0-9]*|ipw[0-9]*|iwi[0-9]*|iwn[0-9]*|ral[0-9]*|wi[0-9]*|wl[0-9]*|wpi[0-9]*)
-   ;;
*)
rtsol_interfaces=${rtsol_interfaces} ${i}
;;

Modified: stable/8/etc/rc.d/wpa_supplicant
==
--- stable/8/etc/rc.d/wpa_supplicantWed Aug 26 21:05:17 2009
(r196565)
+++ stable/8/etc/rc.d/wpa_supplicantWed Aug 26 21:08:41 2009
(r196566)
@@ -18,18 +18,6 @@ if [ -z $ifn ]; then
return 1
 fi
 
-is_wired_interface()
-{
-   media=`ifconfig $1 2/dev/null | while read line; do
-   case $line in
-   *media:?Ethernet*)
-   echo Ethernet
-   ;;
-   esac
-   done`
-   test $media = Ethernet
-}
-
 is_ndis_interface()
 {
case `sysctl -n net.wlan.${1#wlan}.%parent 2/dev/null` in
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196567 - head/sys/kern

2009-08-26 Thread Marius Strobl
Author: marius
Date: Wed Aug 26 21:10:47 2009
New Revision: 196567
URL: http://svn.freebsd.org/changeset/base/196567

Log:
  Add a temporary workaround which just lets init die instead of
  causing a panic if it is killed due to a unsolved stack overflow
  seen very late during shutdown on sparc64 when the gmirror worker
  process exists, which is a regression introduced in 8.0.
  
  Reviewed by:  kib
  MFC after:3 days

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Wed Aug 26 21:08:41 2009(r196566)
+++ head/sys/kern/kern_exit.c   Wed Aug 26 21:10:47 2009(r196567)
@@ -131,7 +131,12 @@ exit1(struct thread *td, int rv)
mtx_assert(Giant, MA_NOTOWNED);
 
p = td-td_proc;
-   if (p == initproc) {
+   /*
+* XXX in case we're rebooting we just let init die in order to
+* work around an unsolved stack overflow seen very late during
+* shutdown on sparc64 when the gmirror worker process exists.
+*/ 
+   if (p == initproc  rebooting == 0) {
printf(init died (signal %d, exit %d)\n,
WTERMSIG(rv), WEXITSTATUS(rv));
panic(Going nowhere without my init!);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196568 - head/sys/cam/scsi

2009-08-26 Thread Stanislav Sedov
Author: stas
Date: Wed Aug 26 21:14:28 2009
New Revision: 196568
URL: http://svn.freebsd.org/changeset/base/196568

Log:
  - Add quirk for Sony DSC digital cameras.  This umass devices fail
to attach without these quirks applied.
  
  PR:   usb/137035
  URL:  
http://lists.freebsd.org/pipermail/freebsd-current/2009-August/010852.html
  Reported by:  Henri Hennebert h...@restart.be, Andrey V. Elsukov 
bu7c...@yandex.ru
  MFC after:1 week

Modified:
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Wed Aug 26 21:10:47 2009(r196567)
+++ head/sys/cam/scsi/scsi_da.c Wed Aug 26 21:14:28 2009(r196568)
@@ -554,6 +554,14 @@ static struct da_quirk_entry da_quirk_ta
{
{T_DIRECT, SIP_MEDIA_REMOVABLE, Netac, OnlyDisk*,
 2000}, /*quirks*/ DA_Q_NO_SYNC_CACHE
+   },
+   {
+   /*
+* Sony Cyber-Shot DSC cameras
+* PR: usb/137035
+*/
+   {T_DIRECT, SIP_MEDIA_REMOVABLE, Sony, Sony DSC, *},
+   /*quirks*/ DA_Q_NO_SYNC_CACHE | DA_Q_NO_PREVENT
}
 };
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196569 - head/sys/netinet6

2009-08-26 Thread Qing Li
Author: qingli
Date: Wed Aug 26 21:32:50 2009
New Revision: 196569
URL: http://svn.freebsd.org/changeset/base/196569

Log:
  When multiple interfaces exist in the system, with each interface having
  an IPv6 address assigned to it, and if an incoming packet received on
  one interface has a packet destination address that belongs to another
  interface, the routing table is consulted to determine how to reach this
  packet destination. Since the packet destination is an interface address,
  the route table will return a host route with the loopback interface as
  rt_ifp. The input code must recognize this fact, instead of using the
  loopback interface, the input code performs a search to find the right
  interface that owns the given IPv6 address.
  
  Reviewed by:  bz, gnn, kmacy
  MFC after:immediately

Modified:
  head/sys/netinet6/ip6_input.c

Modified: head/sys/netinet6/ip6_input.c
==
--- head/sys/netinet6/ip6_input.c   Wed Aug 26 21:14:28 2009
(r196568)
+++ head/sys/netinet6/ip6_input.c   Wed Aug 26 21:32:50 2009
(r196569)
@@ -628,8 +628,27 @@ passin:
rt6_key(rin6.ro_rt)-sin6_addr)
 #endif
rin6.ro_rt-rt_ifp-if_type == IFT_LOOP) {
-   struct in6_ifaddr *ia6 =
-   (struct in6_ifaddr *)rin6.ro_rt-rt_ifa;
+   int free_ia6 = 0;
+   struct in6_ifaddr *ia6;
+
+   /*
+* found the loopback route to the interface address
+*/
+   if (rin6.ro_rt-rt_gateway-sa_family == AF_LINK) {
+   struct sockaddr_in6 dest6;
+
+   bzero(dest6, sizeof(dest6));
+   dest6.sin6_family = AF_INET6;
+   dest6.sin6_len = sizeof(dest6);
+   dest6.sin6_addr = ip6-ip6_dst;
+   ia6 = (struct in6_ifaddr *)
+   ifa_ifwithaddr((struct sockaddr *)dest6);
+   if (ia6 == NULL)
+   goto bad;
+   free_ia6 = 1;
+   }
+   else
+   ia6 = (struct in6_ifaddr *)rin6.ro_rt-rt_ifa;
 
/*
 * record address information into m_tag.
@@ -647,6 +666,8 @@ passin:
/* Count the packet in the ip address stats */
ia6-ia_ifa.if_ipackets++;
ia6-ia_ifa.if_ibytes += m-m_pkthdr.len;
+   if (ia6 != NULL  free_ia6 != 0)
+   ifa_free(ia6-ia_ifa);
goto hbhcheck;
} else {
char ip6bufs[INET6_ADDRSTRLEN];
@@ -657,6 +678,8 @@ passin:
ip6_sprintf(ip6bufs, ip6-ip6_src),
ip6_sprintf(ip6bufd, ip6-ip6_dst)));
 
+   if (ia6 != NULL  free_ia6 != 0)
+   ifa_free(ia6-ia_ifa);
goto bad;
}
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r196567 - head/sys/kern

2009-08-26 Thread John Baldwin
On Wednesday 26 August 2009 5:10:47 pm Marius Strobl wrote:
 Author: marius
 Date: Wed Aug 26 21:10:47 2009
 New Revision: 196567
 URL: http://svn.freebsd.org/changeset/base/196567
 
 Log:
   Add a temporary workaround which just lets init die instead of
   causing a panic if it is killed due to a unsolved stack overflow
   seen very late during shutdown on sparc64 when the gmirror worker
   process exists, which is a regression introduced in 8.0.

Maybe still whine about it and just not panic() so that there is a reminder to 
fix this and remove the workaround?

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196571 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris conf contrib/dev/acpica contrib/pf dev/xen/xenpci

2009-08-26 Thread Doug Barton
Author: dougb
Date: Wed Aug 26 22:32:14 2009
New Revision: 196571
URL: http://svn.freebsd.org/changeset/base/196571

Log:
  MFC r196435:
  
  The svnversion string is only relevant when newvers.sh is called
  during the kernel build process, the other places that call the
  script do not make use of that information. So restrict execution
  of the svnversion-related code to the kernel build context.
  
  Approved by:  re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/conf/newvers.sh
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/conf/newvers.sh
==
--- stable/8/sys/conf/newvers.shWed Aug 26 21:42:16 2009
(r196570)
+++ stable/8/sys/conf/newvers.shWed Aug 26 22:32:14 2009
(r196571)
@@ -87,29 +87,25 @@ touch version
 v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
 i=`${MAKE:-make} -V KERN_IDENT`
 
-for dir in /bin /usr/bin /usr/local/bin; do
-   if [ -x ${dir}/svnversion ]; then
-   svnversion=${dir}/svnversion
-   SRCDIR=${d##*obj}
-   if [ -n $MACHINE ]; then
-   SRCDIR=${SRCDIR##/$MACHINE}
+case $d in
+*/sys/*)
+   for dir in /bin /usr/bin /usr/local/bin; do
+   if [ -x ${dir}/svnversion ]; then
+   svnversion=${dir}/svnversion
+   SRCDIR=${d##*obj}
+   if [ -n $MACHINE ]; then
+   SRCDIR=${SRCDIR##/$MACHINE}
+   fi
+   SRCDIR=${SRCDIR%%/sys/*}
+   break
fi
-   SRCDIR=${SRCDIR%%/sys/*}
-   break
-   fi
-done
+   done
 
-if [ -n $svnversion -a -d ${SRCDIR}/.svn ] ; then
-   # If we are called from the kernel build, limit
-   # the scope of svnversion to sys/ .
-   if [ -e ${SRCDIR}/sys/conf/newvers.sh ] ; then
-   svn= r`cd $SRCDIR/sys  $svnversion`
-   else
-   svn= r`cd $SRCDIR  $svnversion`
+   if [ -n $svnversion -a -d ${SRCDIR}/sys/.svn ] ; then
+   svn= r`cd ${SRCDIR}/sys  $svnversion`
fi
-else
-   svn=
-fi
+   ;;
+esac
 
 cat  EOF  vers.c
 $COPYRIGHT
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r196567 - head/sys/kern

2009-08-26 Thread Marius Strobl
On Wed, Aug 26, 2009 at 05:33:37PM -0400, John Baldwin wrote:
 On Wednesday 26 August 2009 5:10:47 pm Marius Strobl wrote:
  Author: marius
  Date: Wed Aug 26 21:10:47 2009
  New Revision: 196567
  URL: http://svn.freebsd.org/changeset/base/196567
  
  Log:
Add a temporary workaround which just lets init die instead of
causing a panic if it is killed due to a unsolved stack overflow
seen very late during shutdown on sparc64 when the gmirror worker
process exists, which is a regression introduced in 8.0.
 
 Maybe still whine about it and just not panic() so that there is a reminder 
 to 
 fix this and remove the workaround?
 

Well, with a default configuration one still gets the usual
pid 1 (init), uid 0: exited on signal 4 on the console,
which I thought would be sufficient whining.

Marius

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r196460 - head/sys/kern

2009-08-26 Thread Jilles Tjoelker
On Wed, Aug 26, 2009 at 05:08:57PM +1000, Bruce Evans wrote:
 On Tue, 25 Aug 2009, Jilles Tjoelker wrote:
  On Tue, Aug 25, 2009 at 04:07:11AM +1000, Bruce Evans wrote:
  On Sun, 23 Aug 2009, Jilles Tjoelker wrote:
  % Index: sys/fs/fifofs/fifo_vnops.c
  % ===
  % --- sys/fs/fifofs/fifo_vnops.c   (revision 196459)
  % +++ sys/fs/fifofs/fifo_vnops.c   (working copy)
  % @@ -193,6 +193,10 @@
  %  goto fail2;
  %  fip-fi_writesock = wso;
  %  error = soconnect2(wso, rso);
  % +if (error == 0)
  % +error = soshutdown(rso, SHUT_WR);
  % +if (error == 0)
  % +error = soshutdown(wso, SHUT_RD);
  %  if (error) {
  %  (void)soclose(wso);
  %  fail2:

 The second shutdown became harmless for me when I fixed the clobbering of
 sb_state.  Does it have any effect?

It seems not. shutdown(SHUT_RD) basically calls the pru_flush protocol
function (which uipc_usrreq.c does not provide), calls socantrecvmore
(which uipc_usrreq.c had already done synchronously with the first
shutdown) and clears the receive socket buffer (which is already empty).

Regarding the direct access to SBS_CANTRCVMORE and SBS_CANTSENDMORE,
this seems related to the special property of fifos that they can
disconnect and reconnect a stream using the same object. The socket
layer normally does not allow clearing SBS_CANTRCVMORE and
SBS_CANTSENDMORE. The only case where fifo_vnops.c touches these flags
directly where a so* function call could be used is the setting of
SBS_CANTRCVMORE on the read side at initial creation (possibly because a
wakeup is not necessary there).

I suppose the new fifo implementation will avoid abusing sockets this
way.

-- 
Jilles Tjoelker
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196572 - in stable/7/sys: . conf

2009-08-26 Thread Doug Barton
Author: dougb
Date: Wed Aug 26 22:50:14 2009
New Revision: 196572
URL: http://svn.freebsd.org/changeset/base/196572

Log:
  MFC r196435:
  
  The svnversion string is only relevant when newvers.sh is called
  during the kernel build process, the other places that call the
  script do not make use of that information. So restrict execution
  of the svnversion-related code to the kernel build context.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/conf/   (props changed)
  stable/7/sys/conf/newvers.sh

Modified: stable/7/sys/conf/newvers.sh
==
--- stable/7/sys/conf/newvers.shWed Aug 26 22:32:14 2009
(r196571)
+++ stable/7/sys/conf/newvers.shWed Aug 26 22:50:14 2009
(r196572)
@@ -87,29 +87,25 @@ touch version
 v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
 i=`${MAKE:-make} -V KERN_IDENT`
 
-for dir in /bin /usr/bin /usr/local/bin; do
-   if [ -x ${dir}/svnversion ]; then
-   svnversion=${dir}/svnversion
-   SRCDIR=${d##*obj}
-   if [ -n $MACHINE ]; then
-   SRCDIR=${SRCDIR##/$MACHINE}
+case $d in
+*/sys/*)
+   for dir in /bin /usr/bin /usr/local/bin; do
+   if [ -x ${dir}/svnversion ]; then
+   svnversion=${dir}/svnversion
+   SRCDIR=${d##*obj}
+   if [ -n $MACHINE ]; then
+   SRCDIR=${SRCDIR##/$MACHINE}
+   fi
+   SRCDIR=${SRCDIR%%/sys/*}
+   break
fi
-   SRCDIR=${SRCDIR%%/sys/*}
-   break
-   fi
-done
+   done
 
-if [ -n $svnversion -a -d ${SRCDIR}/.svn ] ; then
-   # If we are called from the kernel build, limit
-   # the scope of svnversion to sys/ .
-   if [ -e ${SRCDIR}/sys/conf/newvers.sh ] ; then
-   svn= r`cd $SRCDIR/sys  $svnversion`
-   else
-   svn= r`cd $SRCDIR  $svnversion`
+   if [ -n $svnversion -a -d ${SRCDIR}/sys/.svn ] ; then
+   svn= r`cd ${SRCDIR}/sys  $svnversion`
fi
-else
-   svn=
-fi
+   ;;
+esac
 
 cat  EOF  vers.c
 $COPYRIGHT
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196573 - in stable/6/sys: . conf

2009-08-26 Thread Doug Barton
Author: dougb
Date: Wed Aug 26 22:51:14 2009
New Revision: 196573
URL: http://svn.freebsd.org/changeset/base/196573

Log:
  MFC r196435:
  
  The svnversion string is only relevant when newvers.sh is called
  during the kernel build process, the other places that call the
  script do not make use of that information. So restrict execution
  of the svnversion-related code to the kernel build context.

Modified:
  stable/6/sys/   (props changed)
  stable/6/sys/conf/   (props changed)
  stable/6/sys/conf/newvers.sh

Modified: stable/6/sys/conf/newvers.sh
==
--- stable/6/sys/conf/newvers.shWed Aug 26 22:50:14 2009
(r196572)
+++ stable/6/sys/conf/newvers.shWed Aug 26 22:51:14 2009
(r196573)
@@ -87,20 +87,22 @@ touch version
 v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date`
 i=`${MAKE:-make} -V KERN_IDENT`
 
-for dir in /bin /usr/bin /usr/local/bin; do
-   if [ -x ${dir}/svnversion ]; then
-   svnversion=${dir}/svnversion
-   SRCDIR=${d##*obj}
-   SRCDIR=${SRCDIR%%/sys/*}
-   break
-   fi
-done
+case $d in
+*/sys/*)
+   for dir in /bin /usr/bin /usr/local/bin; do
+   if [ -x ${dir}/svnversion ]; then
+   svnversion=${dir}/svnversion
+   SRCDIR=${d##*obj}
+   SRCDIR=${SRCDIR%%/sys/*}
+   break
+   fi
+   done
 
-if [ -n $svnversion -a -d ${SRCDIR}/.svn ] ; then
-   svn= r`cd $SRCDIR  $svnversion`
-else
-   svn=
-fi
+   if [ -n $svnversion -a -d ${SRCDIR}/sys/.svn ] ; then
+   svn= r`cd ${SRCDIR}/sys  $svnversion`
+   fi
+   ;;
+esac
 
 cat  EOF  vers.c
 $COPYRIGHT
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r196574 - stable/7/sys/kern

2009-08-26 Thread Attilio Rao
Author: attilio
Date: Thu Aug 27 00:45:00 2009
New Revision: 196574
URL: http://svn.freebsd.org/changeset/base/196574

Log:
  Fix a problem introduced when MFCing the rw_try_wlock() operation from
  HEAD:
  __rw_wunlock() relies on the cookie state to not be cleanly 'tid' when
  some conditions needing of special care happens, and lock recursion is
  among those.  Dirty the cookie by adding the RW_LOCK_RECURSE flag in the
  case of a successfull try lock operation.
  
  This is not a problem on -CURRENT and STABLE_8 where the unlocking
  algorithm works differently.
  
  Submitted by: Andrew Brampton brampton plus freebsd at gmail dot com

Modified:
  stable/7/sys/kern/kern_rwlock.c

Modified: stable/7/sys/kern/kern_rwlock.c
==
--- stable/7/sys/kern/kern_rwlock.c Wed Aug 26 22:51:14 2009
(r196573)
+++ stable/7/sys/kern/kern_rwlock.c Thu Aug 27 00:45:00 2009
(r196574)
@@ -204,6 +204,7 @@ _rw_try_wlock(struct rwlock *rw, const c
 
if (rw_wlocked(rw)  (rw-lock_object.lo_flags  RW_RECURSE) != 0) {
rw-rw_recurse++;
+   atomic_set_ptr(rw-rw_lock, RW_LOCK_RECURSED);
rval = 1;
} else
rval = atomic_cmpset_acq_ptr(rw-rw_lock, RW_UNLOCKED,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org