svn commit: r226338 - head/sys/netinet6

2011-10-13 Thread Gleb Smirnoff
Author: glebius
Date: Thu Oct 13 13:05:36 2011
New Revision: 226338
URL: http://svn.freebsd.org/changeset/base/226338

Log:
  Restore functions in6_ifaddloop() and in6_ifremloop() that were
  inlined by Qing Li in his big new-ARP commit. I am going to utilize
  them in my newcarp work, and also these functions left declared
  in in6_var.h for all the time they were absent.
  
  Reviewed by:  bz

Modified:
  head/sys/netinet6/in6.c

Modified: head/sys/netinet6/in6.c
==
--- head/sys/netinet6/in6.c Thu Oct 13 09:21:49 2011(r226337)
+++ head/sys/netinet6/in6.c Thu Oct 13 13:05:36 2011(r226338)
@@ -136,7 +136,89 @@ static void in6_unlink_ifa(struct in6_if
 
 int(*faithprefix_p)(struct in6_addr *);
 
+#define ifa2ia6(ifa)   ((struct in6_ifaddr *)(ifa))
+#define ia62ifa(ia6)   (((ia6)-ia_ifa))
+
+void
+in6_ifaddloop(struct ifaddr *ifa)
+{
+   struct sockaddr_dl gateway;
+   struct sockaddr_in6 mask, addr;
+   struct rtentry rt;
+   struct in6_ifaddr *ia;
+   struct ifnet *ifp;
+   struct llentry *ln;
+
+   ia = ifa2ia6(ifa);
+   ifp = ifa-ifa_ifp;
+   IF_AFDATA_LOCK(ifp);
+   ifa-ifa_rtrequest = NULL;
+
+   /* XXX QL
+* we need to report rt_newaddrmsg
+*/
+   ln = lla_lookup(LLTABLE6(ifp), (LLE_CREATE | LLE_IFADDR |
+   LLE_EXCLUSIVE), (struct sockaddr *)ia-ia_addr);
+   IF_AFDATA_UNLOCK(ifp);
+   if (ln != NULL) {
+   ln-la_expire = 0;  /* for IPv6 this means permanent */
+   ln-ln_state = ND6_LLINFO_REACHABLE;
+   /*
+* initialize for rtmsg generation
+*/
+   bzero(gateway, sizeof(gateway));
+   gateway.sdl_len = sizeof(gateway);
+   gateway.sdl_family = AF_LINK;
+   gateway.sdl_nlen = 0;
+   gateway.sdl_alen = 6;
+   memcpy(gateway.sdl_data, ln-ll_addr.mac_aligned,
+   sizeof(ln-ll_addr));
+   LLE_WUNLOCK(ln);
+   }
+
+   bzero(rt, sizeof(rt));
+   rt.rt_gateway = (struct sockaddr *)gateway;
+   memcpy(mask, ia-ia_prefixmask, sizeof(ia-ia_prefixmask));
+   memcpy(addr, ia-ia_addr, sizeof(ia-ia_addr));
+   rt_mask(rt) = (struct sockaddr *)mask;
+   rt_key(rt) = (struct sockaddr *)addr;
+   rt.rt_flags = RTF_UP | RTF_HOST | RTF_STATIC;
+   rt_newaddrmsg(RTM_ADD, ifa, 0, rt);
+}
+
+void
+in6_ifremloop(struct ifaddr *ifa)
+{
+   struct sockaddr_dl gateway;
+   struct sockaddr_in6 mask, addr;
+   struct rtentry rt0;
+   struct in6_ifaddr *ia;
+   struct ifnet *ifp;
 
+   ia = ifa2ia6(ifa);
+   ifp = ifa-ifa_ifp;
+   IF_AFDATA_LOCK(ifp);
+   lla_lookup(LLTABLE6(ifp), (LLE_DELETE | LLE_IFADDR),
+   (struct sockaddr *)ia-ia_addr);
+   IF_AFDATA_UNLOCK(ifp);
+
+   /*
+* initialize for rtmsg generation
+*/
+   bzero(gateway, sizeof(gateway));
+   gateway.sdl_len = sizeof(gateway);
+   gateway.sdl_family = AF_LINK;
+   gateway.sdl_nlen = 0;
+   gateway.sdl_alen = ifp-if_addrlen;
+   bzero(rt0, sizeof(rt0));
+   rt0.rt_gateway = (struct sockaddr *)gateway;
+   memcpy(mask, ia-ia_prefixmask, sizeof(ia-ia_prefixmask));
+   memcpy(addr, ia-ia_addr, sizeof(ia-ia_addr));
+   rt_mask(rt0) = (struct sockaddr *)mask;
+   rt_key(rt0) = (struct sockaddr *)addr;
+   rt0.rt_flags = RTF_HOST | RTF_STATIC;
+   rt_newaddrmsg(RTM_DELETE, ifa, 0, rt0);
+}
 
 int
 in6_mask2len(struct in6_addr *mask, u_char *lim0)
@@ -174,9 +256,6 @@ in6_mask2len(struct in6_addr *mask, u_ch
return x * 8 + y;
 }
 
-#define ifa2ia6(ifa)   ((struct in6_ifaddr *)(ifa))
-#define ia62ifa(ia6)   (((ia6)-ia_ifa))
-
 #ifdef COMPAT_FREEBSD32
 struct in6_ndifreq32 {
 char ifname[IFNAMSIZ];
@@ -1218,9 +1297,6 @@ in6_purgeaddr(struct ifaddr *ifa)
struct in6_ifaddr *ia = (struct in6_ifaddr *) ifa;
struct in6_multi_mship *imm;
struct sockaddr_in6 mltaddr, mltmask;
-   struct rtentry rt0;
-   struct sockaddr_dl gateway;
-   struct sockaddr_in6 mask, addr;
int plen, error;
struct rtentry *rt;
struct ifaddr *ifa0, *nifa;
@@ -1259,28 +1335,7 @@ in6_purgeaddr(struct ifaddr *ifa)
/* stop DAD processing */
nd6_dad_stop(ifa);
 
-   IF_AFDATA_LOCK(ifp);
-   lla_lookup(LLTABLE6(ifp), (LLE_DELETE | LLE_IFADDR),
-   (struct sockaddr *)ia-ia_addr);
-   IF_AFDATA_UNLOCK(ifp);
-
-   /*
-* initialize for rtmsg generation
-*/
-   bzero(gateway, sizeof(gateway));
-   gateway.sdl_len = sizeof(gateway);
-   gateway.sdl_family = AF_LINK;
-   gateway.sdl_nlen = 0;
-   gateway.sdl_alen = ifp-if_addrlen;
-   /* */
-   bzero(rt0, sizeof(rt0));
-   rt0.rt_gateway = (struct sockaddr *)gateway;
-   memcpy(mask, ia-ia_prefixmask, 

Re: svn commit: r226329 - head/usr.bin/kdump

2011-10-13 Thread TAKAHASHI Yoshihiro
In article 201110122145.p9cljccm085...@svn.freebsd.org
Dag-Erling Smorgrav d...@freebsd.org writes:

 Author: des
 Date: Wed Oct 12 21:45:12 2011
 New Revision: 226329
 URL: http://svn.freebsd.org/changeset/base/226329
 
 Log:
   Make kdump compile cleanly at WARNS level 6, with one exception: the
   ipfilter headers contain a duplicated function declaration.  Turn off
   -Werror to allow kdump to compile in spite of this.
   
   It would be neat to be able to turn off -Werror on a file-by-file basis...

 Modified: head/usr.bin/kdump/mkioctls
 ==
 --- head/usr.bin/kdump/mkioctls   Wed Oct 12 21:38:48 2011
 (r226328)
 +++ head/usr.bin/kdump/mkioctls   Wed Oct 12 21:45:12 2011
 (r226329)
 @@ -15,12 +15,21 @@ LC_ALL=C; export LC_ALL
  # XXX should we use an ANSI cpp?
  ioctl_includes=`
   cd $1
 - find -H -s * -name '*.h' |
 + find -H -s * -name '*.h' | grep -v '.*disk.*\.h' | \
   xargs egrep -l \
  '^#[ ]*define[   ]+[A-Za-z_][A-Za-z0-9_]*[   
 ]+_IO[^a-z0-9_]' |
   awk '{printf(#include %sn, $1)}'
  `
  
 +case `uname -m` in
 +*pc98*)
 + ioctl_includes=$ioctl_includes#include sys/diskpc98.h\\n
 + ;;
 +*)
 + ioctl_includes=$ioctl_includes#include sys/diskmbr.h\\n
 + ;;
 +esac
 +
  awk -v x=$ioctl_includes 'BEGIN {print x}' |
   gcc -E -I$1 -dM -DCOMPAT_43TTY - |
   awk -v ioctl_includes=$ioctl_includes '
 

This change breaks cross building.

---
TAKAHASHI Yoshihiro n...@freebsd.org
___
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: r226339 - head/sys/netinet

2011-10-13 Thread Gleb Smirnoff
Author: glebius
Date: Thu Oct 13 13:30:41 2011
New Revision: 226339
URL: http://svn.freebsd.org/changeset/base/226339

Log:
  De-spl(9).

Modified:
  head/sys/netinet/in.c

Modified: head/sys/netinet/in.c
==
--- head/sys/netinet/in.c   Thu Oct 13 13:05:36 2011(r226338)
+++ head/sys/netinet/in.c   Thu Oct 13 13:30:41 2011(r226339)
@@ -845,7 +845,7 @@ in_ifinit(struct ifnet *ifp, struct in_i
 {
register u_long i = ntohl(sin-sin_addr.s_addr);
struct sockaddr_in oldaddr;
-   int s = splimp(), flags = RTF_UP, error = 0;
+   int flags = RTF_UP, error = 0;
 
oldaddr = ia-ia_addr;
if (oldaddr.sin_family == AF_INET)
@@ -865,7 +865,6 @@ in_ifinit(struct ifnet *ifp, struct in_i
if (ifp-if_ioctl != NULL) {
error = (*ifp-if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia);
if (error) {
-   splx(s);
/* LIST_REMOVE(ia, ia_hash) is done in in_control */
ia-ia_addr = oldaddr;
IN_IFADDR_WLOCK();
@@ -884,7 +883,6 @@ in_ifinit(struct ifnet *ifp, struct in_i
return (error);
}
}
-   splx(s);
if (scrub) {
ia-ia_ifa.ifa_addr = (struct sockaddr *)oldaddr;
in_ifscrub(ifp, ia, LLE_STATIC);
___
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: r226340 - head/sys/netinet6

2011-10-13 Thread Gleb Smirnoff
Author: glebius
Date: Thu Oct 13 13:33:23 2011
New Revision: 226340
URL: http://svn.freebsd.org/changeset/base/226340

Log:
  Use TAILQ_FOREACH() in the nd6_dad_find() instead of hand-rolled 
implementation.

Modified:
  head/sys/netinet6/nd6_nbr.c

Modified: head/sys/netinet6/nd6_nbr.c
==
--- head/sys/netinet6/nd6_nbr.c Thu Oct 13 13:30:41 2011(r226339)
+++ head/sys/netinet6/nd6_nbr.c Thu Oct 13 13:33:23 2011(r226340)
@@ -1167,11 +1167,11 @@ nd6_dad_find(struct ifaddr *ifa)
 {
struct dadq *dp;
 
-   for (dp = V_dadq.tqh_first; dp; dp = dp-dad_list.tqe_next) {
+   TAILQ_FOREACH(dp, V_dadq, dad_list)
if (dp-dad_ifa == ifa)
-   return dp;
-   }
-   return NULL;
+   return (dp);
+
+   return (NULL);
 }
 
 static void
___
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: r226329 - head/usr.bin/kdump

2011-10-13 Thread Dag-Erling Smørgrav
TAKAHASHI Yoshihiro n...@freebsd.org writes:
 This change breaks cross building.

Damn, you're right.  Will this work?

Index: usr.bin/kdump/mkioctls
===
--- usr.bin/kdump/mkioctls  (revision 226329)
+++ usr.bin/kdump/mkioctls  (working copy)
@@ -13,15 +13,16 @@
 
 # Build a list of headers that have ioctls in them.
 # XXX should we use an ANSI cpp?
-ioctl_includes=`
+ioctl_includes=$(
cd $1
find -H -s * -name '*.h' | grep -v '.*disk.*\.h' | \
xargs egrep -l \
 '^#[   ]*define[   ]+[A-Za-z_][A-Za-z0-9_]*[   ]+_IO[^a-z0-9_]' |
-   awk '{printf(#include %sn, $1)}'
-`
+   awk '{printf(#include %s\\n, $1)}'
+)
 
-case `uname -m` in
+: ${MACHINE=$(uname -m)}
+case ${MACHINE} in
 *pc98*)
ioctl_includes=$ioctl_includes#include sys/diskpc98.h\\n
;;
Index: usr.bin/kdump/Makefile
===
--- usr.bin/kdump/Makefile  (revision 226329)
+++ usr.bin/kdump/Makefile  (working copy)
@@ -21,7 +21,8 @@
 CLEANFILES=ioctl.c kdump_subr.c kdump_subr.h linux_syscalls.c
 
 ioctl.c: mkioctls
-   sh ${.CURDIR}/mkioctls ${DESTDIR}/usr/include  ${.TARGET}
+   env MACHINE=${TARGET} \
+   sh ${.CURDIR}/mkioctls ${DESTDIR}/usr/include  ${.TARGET}
 
 kdump_subr.h: mksubr
sh ${.CURDIR}/mksubr ${DESTDIR}/usr/include | \


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


svn commit: r226341 - head/sys/teken/demo

2011-10-13 Thread Ed Schouten
Author: ed
Date: Thu Oct 13 14:20:27 2011
New Revision: 226341
URL: http://svn.freebsd.org/changeset/base/226341

Log:
  Link the demo application against ncursesw to make Unicode work.

Modified:
  head/sys/teken/demo/Makefile

Modified: head/sys/teken/demo/Makefile
==
--- head/sys/teken/demo/MakefileThu Oct 13 13:33:23 2011
(r226340)
+++ head/sys/teken/demo/MakefileThu Oct 13 14:20:27 2011
(r226341)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PROG=  teken_demo
-LDADD= -lncurses -lteken -lutil
+LDADD= -lncursesw -lteken -lutil
 MAN=
 
 WARNS?=6
___
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: r226329 - head/usr.bin/kdump

2011-10-13 Thread TAKAHASHI Yoshihiro
In article 86r52h9f5g@ds4.des.no
Dag-Erling Smørgrav d...@des.no writes:

 TAKAHASHI Yoshihiro n...@freebsd.org writes:
 This change breaks cross building.
 
 Damn, you're right.  Will this work?
 
 Index: usr.bin/kdump/Makefile
 ===
 --- usr.bin/kdump/Makefile(revision 226329)
 +++ usr.bin/kdump/Makefile(working copy)
 @@ -21,7 +21,8 @@
  CLEANFILES=  ioctl.c kdump_subr.c kdump_subr.h linux_syscalls.c
  
  ioctl.c: mkioctls
 - sh ${.CURDIR}/mkioctls ${DESTDIR}/usr/include  ${.TARGET}
 + env MACHINE=${TARGET} \
 + sh ${.CURDIR}/mkioctls ${DESTDIR}/usr/include  ${.TARGET}
  
  kdump_subr.h: mksubr
   sh ${.CURDIR}/mksubr ${DESTDIR}/usr/include | \

The above ${TARGET} should be ${MACHINE}.  The others are fine.

Thanks.

---
TAKAHASHI Yoshihiro n...@freebsd.org
___
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: r226342 - head/sys/kern

2011-10-13 Thread Marcel Moolenaar
Author: marcel
Date: Thu Oct 13 16:16:46 2011
New Revision: 226342
URL: http://svn.freebsd.org/changeset/base/226342

Log:
  In elf32_trans_prot() and when compiling for amd64 or ia64, add
  PROT_EXECUTE when PROT_READ is needed. By default i386 allows
  execution when reading is allowed and JDK 1.4.x depends on that.

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Thu Oct 13 14:20:27 2011(r226341)
+++ head/sys/kern/imgact_elf.c  Thu Oct 13 16:16:46 2011(r226342)
@@ -1664,6 +1664,12 @@ __elfN(trans_prot)(Elf_Word flags)
prot |= VM_PROT_WRITE;
if (flags  PF_R)
prot |= VM_PROT_READ;
+#if __ELF_WORD_SIZE == 32
+#if defined(__amd64__) || defined(__ia64__)
+   if (flags  PF_R)
+   prot |= VM_PROT_EXECUTE;
+#endif
+#endif
return (prot);
 }
 
___
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: r226343 - head/sys/vm

2011-10-13 Thread Marcel Moolenaar
Author: marcel
Date: Thu Oct 13 16:20:10 2011
New Revision: 226343
URL: http://svn.freebsd.org/changeset/base/226343

Log:
  In sys_obreak() and when compiling for amd64 or ia64, when the process
  is ILP32 (i.e. i386) grant execute permissions by default. The JDK 1.4.x
  depends on being able to execute from the heap on i386.

Modified:
  head/sys/vm/vm_unix.c

Modified: head/sys/vm/vm_unix.c
==
--- head/sys/vm/vm_unix.c   Thu Oct 13 16:16:46 2011(r226342)
+++ head/sys/vm/vm_unix.c   Thu Oct 13 16:20:10 2011(r226343)
@@ -36,6 +36,8 @@
  * @(#)vm_unix.c   8.1 (Berkeley) 6/11/93
  */
 
+#include opt_compat.h
+
 /*
  * Traditional sbrk/grow interface to VM
  */
@@ -49,6 +51,7 @@ __FBSDID($FreeBSD$);
 #include sys/proc.h
 #include sys/racct.h
 #include sys/resourcevar.h
+#include sys/sysent.h
 #include sys/sysproto.h
 #include sys/systm.h
 
@@ -75,7 +78,7 @@ sys_obreak(td, uap)
struct vmspace *vm = td-td_proc-p_vmspace;
vm_offset_t new, old, base;
rlim_t datalim, vmemlim;
-   int rv;
+   int prot, rv;
int error = 0;
boolean_t do_map_wirefuture;
 
@@ -135,8 +138,15 @@ sys_obreak(td, uap)
}
PROC_UNLOCK(td-td_proc);
 #endif
+   prot = VM_PROT_RW;
+#ifdef COMPAT_FREEBSD32
+#if defined(__amd64__) || defined(__ia64__)
+   if (SV_PROC_FLAG(td-td_proc, SV_ILP32))
+   prot |= VM_PROT_EXECUTE;
+#endif
+#endif
rv = vm_map_insert(vm-vm_map, NULL, 0, old, new,
-   VM_PROT_RW, VM_PROT_ALL, 0);
+   prot, VM_PROT_ALL, 0);
if (rv != KERN_SUCCESS) {
 #ifdef RACCT
PROC_LOCK(td-td_proc);
___
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: r226344 - head/usr.bin/kdump

2011-10-13 Thread Dag-Erling Smorgrav
Author: des
Date: Thu Oct 13 16:29:24 2011
New Revision: 226344
URL: http://svn.freebsd.org/changeset/base/226344

Log:
  Clean up mkioctls a bit, and fix cross-building by checking ${MACHINE}
  instead of $(uname -m).
  
  Pointed out by:   nyan@

Modified:
  head/usr.bin/kdump/Makefile
  head/usr.bin/kdump/mkioctls

Modified: head/usr.bin/kdump/Makefile
==
--- head/usr.bin/kdump/Makefile Thu Oct 13 16:20:10 2011(r226343)
+++ head/usr.bin/kdump/Makefile Thu Oct 13 16:29:24 2011(r226344)
@@ -21,7 +21,8 @@ NO_WERROR?=   YES
 CLEANFILES=ioctl.c kdump_subr.c kdump_subr.h linux_syscalls.c
 
 ioctl.c: mkioctls
-   sh ${.CURDIR}/mkioctls ${DESTDIR}/usr/include  ${.TARGET}
+   env MACHINE=${MACHINE} \
+   sh ${.CURDIR}/mkioctls ${DESTDIR}/usr/include  ${.TARGET}
 
 kdump_subr.h: mksubr
sh ${.CURDIR}/mksubr ${DESTDIR}/usr/include | \

Modified: head/usr.bin/kdump/mkioctls
==
--- head/usr.bin/kdump/mkioctls Thu Oct 13 16:20:10 2011(r226343)
+++ head/usr.bin/kdump/mkioctls Thu Oct 13 16:29:24 2011(r226344)
@@ -13,15 +13,16 @@ LC_ALL=C; export LC_ALL
 
 # Build a list of headers that have ioctls in them.
 # XXX should we use an ANSI cpp?
-ioctl_includes=`
+ioctl_includes=$(
cd $1
find -H -s * -name '*.h' | grep -v '.*disk.*\.h' | \
xargs egrep -l \
 '^#[   ]*define[   ]+[A-Za-z_][A-Za-z0-9_]*[   ]+_IO[^a-z0-9_]' |
-   awk '{printf(#include %sn, $1)}'
-`
+   awk '{printf(#include %s\\n, $1)}'
+)
 
-case `uname -m` in
+: ${MACHINE=$(uname -m)}
+case ${MACHINE} in
 *pc98*)
ioctl_includes=$ioctl_includes#include sys/diskpc98.h\\n
;;
___
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: r226345 - in head: etc/rc.d sbin/dhclient

2011-10-13 Thread Dag-Erling Smorgrav
Author: des
Date: Thu Oct 13 17:20:45 2011
New Revision: 226345
URL: http://svn.freebsd.org/changeset/base/226345

Log:
  Make dhclient use a pid file.  Modify the rc script accordingly; while
  there, clean it up and add some error checks.
  
  Glanced at by:brooks@
  MFC after:3 weeks

Modified:
  head/etc/rc.d/dhclient
  head/sbin/dhclient/Makefile
  head/sbin/dhclient/dhclient.8
  head/sbin/dhclient/dhclient.c
  head/sbin/dhclient/dhcpd.h
  head/sbin/dhclient/errwarn.c

Modified: head/etc/rc.d/dhclient
==
--- head/etc/rc.d/dhclient  Thu Oct 13 16:29:24 2011(r226344)
+++ head/etc/rc.d/dhclient  Thu Oct 13 17:20:45 2011(r226345)
@@ -9,55 +9,39 @@
 . /etc/rc.subr
 . /etc/network.subr
 
+ifn=$2
+
 name=dhclient
 rcvar=
-start_cmd=dhclient_start
-stop_cmd=dhclient_stop
+pidfile=/var/run/${name}.${ifn}.pid
+start_precmd=dhclient_prestart
 
-dhclient_start()
+dhclient_prestart()
 {
-   # prevent unnecessary restarts
-   # XXX: dhclient had better create a pidfile
-   if [ -x /bin/pgrep ]; then
-   pids=`/bin/pgrep -f dhclient: $ifn(\$| .*)`
-   if [ -n $pids ]; then
-   sleep 1
-   pids=`/bin/pgrep -f dhclient: $ifn(\$| .*)`
-   if [ -n $pids ]; then
-   exit 0
-   fi
-   elif [ -e /var/run/dhclient.pid ]; then
-   if [ -n `pgrep -F /var/run/dhclient.pid` ]; then
-   exit 0
-   fi
-   fi
-   fi
-
-   # Override for $ifn specific flags (see rc.subr for $flags setting)
-   specific=`get_if_var $ifn dhclient_flags_IF`
+   # Interface-specific flags (see rc.subr for $flags setting)
+   specific=$(get_if_var $ifn dhclient_flags_IF)
if [ -z $flags -a -n $specific ]; then
rc_flags=$specific
fi
 
-   background_dhclient=`get_if_var $ifn background_dhclient_IF 
$background_dhclient`
+   background_dhclient=$(get_if_var $ifn background_dhclient_IF 
$background_dhclient)
if checkyesno background_dhclient; then
rc_flags=${rc_flags} -b
fi
 
-   ${dhclient_program} ${rc_flags} $ifn
-}
-
-dhclient_stop()
-{
-   ifconfig $ifn down  # cause dhclient to die
+   rc_flags=${rc_flags} ${ifn}
 }
 
-ifn=$2
-
 load_rc_config $name
 load_rc_config network
 
-if ! dhcpif $ifn; then
+if [ -z $ifn ] ; then
+   # only complain if a command was specified but no interface
+   if [ -n $1 ] ; then
+   echo 12 $0: no interface specified
+   return 1
+   fi
+elif [ -n ${rc_force} ]  ! dhcpif $ifn; then
return 1
 fi
 

Modified: head/sbin/dhclient/Makefile
==
--- head/sbin/dhclient/Makefile Thu Oct 13 16:29:24 2011(r226344)
+++ head/sbin/dhclient/Makefile Thu Oct 13 17:20:45 2011(r226345)
@@ -39,6 +39,8 @@ PROG= dhclient
 SCRIPTS=dhclient-script
 MAN=   dhclient.8 dhclient.conf.5 dhclient.leases.5 dhcp-options.5 \
dhclient-script.8
+DPADD= ${LIBUTIL}
+LDADD= -lutil
 
 WARNS?=2
 

Modified: head/sbin/dhclient/dhclient.8
==
--- head/sbin/dhclient/dhclient.8   Thu Oct 13 16:29:24 2011
(r226344)
+++ head/sbin/dhclient/dhclient.8   Thu Oct 13 17:20:45 2011
(r226345)
@@ -38,7 +38,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd August 13, 2007
+.Dd October 13, 2011
 .Dt DHCLIENT 8
 .Os
 .Sh NAME
@@ -49,6 +49,7 @@
 .Op Fl bdqu
 .Op Fl c Ar file
 .Op Fl l Ar file
+.Op Fl p Ar file
 .Ar interface
 .Sh DESCRIPTION
 The
@@ -83,6 +84,10 @@ will revert to running in the background
 Specify an alternate location,
 .Ar file ,
 for the leases file.
+.It Fl p Ar file
+Specify an alternate location for the PID file.
+The default is
+.Pa /var/run/dhclient. Ns Ar interface Ns Pa .pid .
 .It Fl q
 Forces
 .Nm

Modified: head/sbin/dhclient/dhclient.c
==
--- head/sbin/dhclient/dhclient.c   Thu Oct 13 16:29:24 2011
(r226344)
+++ head/sbin/dhclient/dhclient.c   Thu Oct 13 17:20:45 2011
(r226345)
@@ -95,6 +95,9 @@ struct iaddr iaddr_broadcast = { 4, { 25
 struct in_addr inaddr_any;
 struct sockaddr_in sockaddr_broadcast;
 
+char *path_dhclient_pidfile;
+struct pidfh *pidfile;
+
 /*
  * ASSERT_STATE() does nothing now; it used to be
  * assert (state_is == state_shouldbe).
@@ -316,6 +319,8 @@ die:
if (ifi-client-alias)
script_write_params(alias_, ifi-client-alias);
script_go();
+   if (pidfile != NULL)
+   pidfile_remove(pidfile);
exit(1);
 }
 
@@ -327,12 +332,13 @@ main(int argc, char *argv[])
int  pipe_fd[2];
 

svn commit: r226346 - head/sys/dev/iwn

2011-10-13 Thread Bernhard Schmidt
Author: bschmidt
Date: Thu Oct 13 18:17:03 2011
New Revision: 226346
URL: http://svn.freebsd.org/changeset/base/226346

Log:
  Fix bmiss notifications, events should be sent when NOT scanning.
  
  MFC after:3 days

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Thu Oct 13 17:20:45 2011(r226345)
+++ head/sys/dev/iwn/if_iwn.c   Thu Oct 13 18:17:03 2011(r226346)
@@ -2929,7 +2929,7 @@ iwn_notif_intr(struct iwn_softc *sc)
 * reinitialize the sensitivity state machine.
 */
if (vap-iv_state == IEEE80211_S_RUN 
-   (ic-ic_flags  IEEE80211_F_SCAN) != 0) {
+   (ic-ic_flags  IEEE80211_F_SCAN) == 0) {
if (misses  5)
(void)iwn_init_sensitivity(sc);
if (misses = vap-iv_bmissthreshold) {
___
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: r226347 - head/sys/compat/freebsd32

2011-10-13 Thread Marcel Moolenaar
Author: marcel
Date: Thu Oct 13 18:18:42 2011
New Revision: 226347
URL: http://svn.freebsd.org/changeset/base/226347

Log:
  In freebsd32_mmap() and when compiling for amd64 or ia64, also
  ask for execute permissions when read permissions are wanted.
  This is needed for JDK 1.4.x on i386.

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Thu Oct 13 18:17:03 2011
(r226346)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Thu Oct 13 18:18:42 2011
(r226347)
@@ -520,6 +520,11 @@ freebsd32_mmap(struct thread *td, struct
}
 #endif
 
+#if defined(__amd64__) || defined(__ia64__)
+   if (prot  PROT_READ)
+   prot |= PROT_EXEC;
+#endif
+
ap.addr = (void *) addr;
ap.len = len;
ap.prot = prot;
___
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: r226343 - head/sys/vm

2011-10-13 Thread Kostik Belousov
On Thu, Oct 13, 2011 at 04:20:10PM +, Marcel Moolenaar wrote:
 Author: marcel
 Date: Thu Oct 13 16:20:10 2011
 New Revision: 226343
 URL: http://svn.freebsd.org/changeset/base/226343
 
 Log:
   In sys_obreak() and when compiling for amd64 or ia64, when the process
   is ILP32 (i.e. i386) grant execute permissions by default. The JDK 1.4.x
   depends on being able to execute from the heap on i386.
 
 Modified:
   head/sys/vm/vm_unix.c
 
 Modified: head/sys/vm/vm_unix.c
 ==
 --- head/sys/vm/vm_unix.c Thu Oct 13 16:16:46 2011(r226342)
 +++ head/sys/vm/vm_unix.c Thu Oct 13 16:20:10 2011(r226343)
 @@ -36,6 +36,8 @@
   *   @(#)vm_unix.c   8.1 (Berkeley) 6/11/93
   */
  
 +#include opt_compat.h
 +
  /*
   * Traditional sbrk/grow interface to VM
   */
 @@ -49,6 +51,7 @@ __FBSDID($FreeBSD$);
  #include sys/proc.h
  #include sys/racct.h
  #include sys/resourcevar.h
 +#include sys/sysent.h
  #include sys/sysproto.h
  #include sys/systm.h
  
 @@ -75,7 +78,7 @@ sys_obreak(td, uap)
   struct vmspace *vm = td-td_proc-p_vmspace;
   vm_offset_t new, old, base;
   rlim_t datalim, vmemlim;
 - int rv;
 + int prot, rv;
   int error = 0;
   boolean_t do_map_wirefuture;
  
 @@ -135,8 +138,15 @@ sys_obreak(td, uap)
   }
   PROC_UNLOCK(td-td_proc);
  #endif
 + prot = VM_PROT_RW;
 +#ifdef COMPAT_FREEBSD32
 +#if defined(__amd64__) || defined(__ia64__)
 + if (SV_PROC_FLAG(td-td_proc, SV_ILP32))
 + prot |= VM_PROT_EXECUTE;
 +#endif
 +#endif
   rv = vm_map_insert(vm-vm_map, NULL, 0, old, new,
 - VM_PROT_RW, VM_PROT_ALL, 0);
 + prot, VM_PROT_ALL, 0);
   if (rv != KERN_SUCCESS) {
  #ifdef RACCT
   PROC_LOCK(td-td_proc);
The two commits removed NX support for .data/.bss for 32bit binaries on amd64.
This is too unfortunate. Can we claim that only old binaries need this hack ?

If yes, could you, please, conditionalize the hack on curproc-p_osrel
being, say, 4.x ?


pgpJQZj87yPZz.pgp
Description: PGP signature


svn commit: r226348 - head/sys/compat/freebsd32

2011-10-13 Thread Marcel Moolenaar
Author: marcel
Date: Thu Oct 13 18:21:11 2011
New Revision: 226348
URL: http://svn.freebsd.org/changeset/base/226348

Log:
  Wrap mprotect(2)

Modified:
  head/sys/compat/freebsd32/syscalls.master

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Thu Oct 13 18:18:42 2011
(r226347)
+++ head/sys/compat/freebsd32/syscalls.master   Thu Oct 13 18:21:11 2011
(r226348)
@@ -172,7 +172,7 @@
 72 AUE_O_VADVISE   NOPROTO { int ovadvise(int anom); } vadvise \
ovadvise_args int
 73 AUE_MUNMAP  NOPROTO { int munmap(void *addr, size_t len); }
-74 AUE_MPROTECTNOPROTO { int mprotect(const void *addr, \
+74 AUE_MPROTECTSTD { int freebsd32_mprotect(const void *addr, \
size_t len, int prot); }
 75 AUE_MADVISE NOPROTO { int madvise(void *addr, size_t len, \
int behav); }
___
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: r226349 - head/sys/compat/freebsd32

2011-10-13 Thread Marcel Moolenaar
Author: marcel
Date: Thu Oct 13 18:25:10 2011
New Revision: 226349
URL: http://svn.freebsd.org/changeset/base/226349

Log:
  Wrap mprotect(2) so that we can add execute permissions when read
  permissions are requested. This is needed on amd64 and ia64 for
  JDK 1.4.x

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/freebsd32/freebsd32_proto.h
  head/sys/compat/freebsd32/freebsd32_syscall.h
  head/sys/compat/freebsd32/freebsd32_syscalls.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/compat/freebsd32/freebsd32_systrace_args.c

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Thu Oct 13 18:21:11 2011
(r226348)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Thu Oct 13 18:25:10 2011
(r226349)
@@ -437,6 +437,21 @@ freebsd32_mmap_partial(struct thread *td
 #endif
 
 int
+freebsd32_mprotect(struct thread *td, struct freebsd32_mprotect_args *uap)
+{
+   struct mprotect_args ap;
+
+   ap.addr = (void *)(uintptr_t)uap-addr;
+   ap.len = uap-len;
+   ap.prot = uap-prot;
+#if defined(__amd64__) || defined(__ia64__)
+   if (ap.prot  PROT_READ)
+   ap.prot |= PROT_EXEC;
+#endif
+   return (sys_mprotect(td, ap));
+}
+
+int
 freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap)
 {
struct mmap_args ap;

Modified: head/sys/compat/freebsd32/freebsd32_proto.h
==
--- head/sys/compat/freebsd32/freebsd32_proto.h Thu Oct 13 18:21:11 2011
(r226348)
+++ head/sys/compat/freebsd32/freebsd32_proto.h Thu Oct 13 18:25:10 2011
(r226349)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 224066 
2011-07-15 18:26:19Z jonathan 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226348 
2011-10-13 18:21:11Z marcel 
  */
 
 #ifndef _FREEBSD32_SYSPROTO_H_
@@ -76,6 +76,11 @@ struct freebsd32_execve_args {
char argv_l_[PADL_(u_int32_t *)]; u_int32_t * argv; char 
argv_r_[PADR_(u_int32_t *)];
char envv_l_[PADL_(u_int32_t *)]; u_int32_t * envv; char 
envv_r_[PADR_(u_int32_t *)];
 };
+struct freebsd32_mprotect_args {
+   char addr_l_[PADL_(const void *)]; const void * addr; char 
addr_r_[PADR_(const void *)];
+   char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];
+   char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];
+};
 struct freebsd32_setitimer_args {
char which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)];
char itv_l_[PADL_(struct itimerval32 *)]; struct itimerval32 * itv; 
char itv_r_[PADR_(struct itimerval32 *)];
@@ -585,6 +590,7 @@ int freebsd32_recvfrom(struct thread *, 
 intfreebsd32_sigaltstack(struct thread *, struct 
freebsd32_sigaltstack_args *);
 intfreebsd32_ioctl(struct thread *, struct freebsd32_ioctl_args *);
 intfreebsd32_execve(struct thread *, struct freebsd32_execve_args *);
+intfreebsd32_mprotect(struct thread *, struct freebsd32_mprotect_args *);
 intfreebsd32_setitimer(struct thread *, struct freebsd32_setitimer_args *);
 intfreebsd32_getitimer(struct thread *, struct freebsd32_getitimer_args *);
 intfreebsd32_select(struct thread *, struct freebsd32_select_args *);
@@ -943,6 +949,7 @@ int freebsd7_freebsd32_shmctl(struct thr
 #defineFREEBSD32_SYS_AUE_freebsd32_execve  AUE_EXECVE
 #defineFREEBSD32_SYS_AUE_ofreebsd32_fstat  AUE_FSTAT
 #defineFREEBSD32_SYS_AUE_ofreebsd32_getpagesizeAUE_NULL
+#defineFREEBSD32_SYS_AUE_freebsd32_mprotectAUE_MPROTECT
 #defineFREEBSD32_SYS_AUE_freebsd32_setitimer   AUE_SETITIMER
 #defineFREEBSD32_SYS_AUE_freebsd32_getitimer   AUE_GETITIMER
 #defineFREEBSD32_SYS_AUE_freebsd32_select  AUE_SELECT

Modified: head/sys/compat/freebsd32/freebsd32_syscall.h
==
--- head/sys/compat/freebsd32/freebsd32_syscall.h   Thu Oct 13 18:21:11 
2011(r226348)
+++ head/sys/compat/freebsd32/freebsd32_syscall.h   Thu Oct 13 18:25:10 
2011(r226349)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 224066 
2011-07-15 18:26:19Z jonathan 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 226348 
2011-10-13 18:21:11Z marcel 
  */
 
 #defineFREEBSD32_SYS_syscall   0
@@ -80,7 +80,7 @@
/* 71 is obsolete ommap */
 #defineFREEBSD32_SYS_vadvise   72
 #defineFREEBSD32_SYS_munmap73
-#defineFREEBSD32_SYS_mprotect  74
+#defineFREEBSD32_SYS_freebsd32_mprotect74
 #define

Re: svn commit: r226343 - head/sys/vm

2011-10-13 Thread Marcel Moolenaar

On Oct 13, 2011, at 11:20 AM, Kostik Belousov wrote:

 The two commits removed NX support for .data/.bss for 32bit binaries on amd64.
 This is too unfortunate. Can we claim that only old binaries need this hack ?

I don't know. When did our ABI for i386 change to have NX by default?

-- 
Marcel Moolenaar
mar...@xcllnt.net


___
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: r226343 - head/sys/vm

2011-10-13 Thread Kostik Belousov
On Thu, Oct 13, 2011 at 11:30:12AM -0700, Marcel Moolenaar wrote:

 On Oct 13, 2011, at 11:20 AM, Kostik Belousov wrote:

  The two commits removed NX support for .data/.bss for 32bit binaries
  Thon amd64. is is too unfortunate. Can we claim that only old
  Thbinaries need this hack ?

 I don't know. When did our ABI for i386 change to have NX by default?
I think it changed de-facto when NX appears to be supported by hardware.
In other words, PF_R-PF_X was always considered a coincident, and not
a promise.

I think we can claim that the moment FreeBSD gained PAE support, it happen.

I would suggest to add a sysctl, say kern.elf32.readable_nx, with
the values:
0 - strictly follow segment permissions
1 - PF_R implies PF_X if p_osrel  60
2 - PF_R always implied PF_X
for 32bit binaries.


pgpsygOha8gqW.pgp
Description: PGP signature


Re: svn commit: r226349 - head/sys/compat/freebsd32

2011-10-13 Thread John Baldwin
On Thursday, October 13, 2011 2:25:10 pm Marcel Moolenaar wrote:
 Author: marcel
 Date: Thu Oct 13 18:25:10 2011
 New Revision: 226349
 URL: http://svn.freebsd.org/changeset/base/226349
 
 Log:
   Wrap mprotect(2) so that we can add execute permissions when read
   permissions are requested. This is needed on amd64 and ia64 for
   JDK 1.4.x
 
 Modified:
   head/sys/compat/freebsd32/freebsd32_misc.c
   head/sys/compat/freebsd32/freebsd32_proto.h
   head/sys/compat/freebsd32/freebsd32_syscall.h
   head/sys/compat/freebsd32/freebsd32_syscalls.c
   head/sys/compat/freebsd32/freebsd32_sysent.c
   head/sys/compat/freebsd32/freebsd32_systrace_args.c
 
 Modified: head/sys/compat/freebsd32/freebsd32_misc.c
 ==
 --- head/sys/compat/freebsd32/freebsd32_misc.cThu Oct 13 18:21:11 
 2011(r226348)
 +++ head/sys/compat/freebsd32/freebsd32_misc.cThu Oct 13 18:25:10 
 2011(r226349)
 @@ -437,6 +437,21 @@ freebsd32_mmap_partial(struct thread *td
  #endif
  
  int
 +freebsd32_mprotect(struct thread *td, struct freebsd32_mprotect_args *uap)
 +{
 + struct mprotect_args ap;
 +
 + ap.addr = (void *)(uintptr_t)uap-addr;

Maybe use PTRIN() here?

 + ap.len = uap-len;
 + ap.prot = uap-prot;
 +#if defined(__amd64__) || defined(__ia64__)
 + if (ap.prot  PROT_READ)
 + ap.prot |= PROT_EXEC;
 +#endif
 + return (sys_mprotect(td, ap));
 +}
 +
 +int

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


svn commit: r226350 - in head/sys/dev: aac asr hptiop mfi

2011-10-13 Thread Marius Strobl
Author: marius
Date: Thu Oct 13 20:06:19 2011
New Revision: 226350
URL: http://svn.freebsd.org/changeset/base/226350

Log:
  Merge from r225950:
  
  Set the sense residual properly.
  
  Reviewed by:  ken

Modified:
  head/sys/dev/aac/aac_cam.c
  head/sys/dev/asr/asr.c
  head/sys/dev/hptiop/hptiop.c
  head/sys/dev/mfi/mfi_cam.c

Modified: head/sys/dev/aac/aac_cam.c
==
--- head/sys/dev/aac/aac_cam.c  Thu Oct 13 18:25:10 2011(r226349)
+++ head/sys/dev/aac/aac_cam.c  Thu Oct 13 20:06:19 2011(r226350)
@@ -532,6 +532,7 @@ aac_cam_complete(struct aac_command *cm)
union   ccb *ccb;
struct  aac_srb_response *srbr;
struct  aac_softc *sc;
+   int sense_returned;
 
sc = cm-cm_sc;
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, );
@@ -556,16 +557,17 @@ aac_cam_complete(struct aac_command *cm)
 
/* Take care of autosense */
if (srbr-sense_len) {
-   int sense_len, scsi_sense_len;
-
-   scsi_sense_len = sizeof(struct scsi_sense_data);
-   bzero(ccb-csio.sense_data, scsi_sense_len);
-   sense_len = (srbr-sense_len 
-   scsi_sense_len) ? scsi_sense_len :
-   srbr-sense_len;
+   sense_returned = srbr-sense_len;
+   if (sense_returned  ccb-csio.sense_len)
+   ccb-csio.sense_resid =
+  ccb-csio.sense_len -
+  sense_returned;
+   else
+   ccb-csio.sense_resid = 0;
+   bzero(ccb-csio.sense_data,
+   sizeof(struct scsi_sense_data));
bcopy(srbr-sense[0], ccb-csio.sense_data,
-   srbr-sense_len);
-   ccb-csio.sense_len = sense_len;
+   min(ccb-csio.sense_len, sense_returned));
ccb-ccb_h.status |= CAM_AUTOSNS_VALID;
// scsi_sense_print(ccb-csio);
}

Modified: head/sys/dev/asr/asr.c
==
--- head/sys/dev/asr/asr.c  Thu Oct 13 18:25:10 2011(r226349)
+++ head/sys/dev/asr/asr.c  Thu Oct 13 20:06:19 2011(r226350)
@@ -3071,6 +3071,14 @@ asr_intr(Asr_softc_t *sc)
  (size  ccb-csio.sense_len)) {
size = ccb-csio.sense_len;
}
+   if (size  ccb-csio.sense_len) {
+   ccb-csio.sense_resid =
+   ccb-csio.sense_len - size;
+   } else {
+   ccb-csio.sense_resid = 0;
+   }
+   bzero((ccb-csio.sense_data),
+   sizeof(ccb-csio.sense_data));
bcopy(Reply-SenseData,
  (ccb-csio.sense_data), size);
}
@@ -3566,6 +3574,12 @@ ASR_queue_i(Asr_softc_t  *sc, PI2O_MESSAG
if (size  sizeof(ccb-csio.sense_data)) {
size = sizeof(ccb-csio.sense_data);
}
+   if (size  ccb-csio.sense_len) {
+   ccb-csio.sense_resid = ccb-csio.sense_len - size;
+   } else {
+   ccb-csio.sense_resid = 0;
+   }
+   bzero((ccb-csio.sense_data), sizeof(ccb-csio.sense_data));
bcopy((ccb-csio.sense_data), Reply_Ptr-SenseData, size);
I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME_setAutoSenseTransferCount(
Reply_Ptr, size);

Modified: head/sys/dev/hptiop/hptiop.c
==
--- head/sys/dev/hptiop/hptiop.cThu Oct 13 18:25:10 2011
(r226349)
+++ head/sys/dev/hptiop/hptiop.cThu Oct 13 20:06:19 2011
(r226350)
@@ -424,6 +424,13 @@ srb_complete:
ccb-ccb_h.status = CAM_BUSY;
break;
case IOP_RESULT_CHECK_CONDITION:
+   memset(ccb-csio.sense_data, 0,
+   sizeof(ccb-csio.sense_data));
+   if (dxfer  ccb-csio.sense_len)
+   ccb-csio.sense_resid = ccb-csio.sense_len -
+   dxfer;
+   else
+

Re: svn commit: r226343 - head/sys/vm

2011-10-13 Thread Marcel Moolenaar

On Oct 13, 2011, at 12:09 PM, Kostik Belousov wrote:

 On Thu, Oct 13, 2011 at 11:30:12AM -0700, Marcel Moolenaar wrote:
 
 On Oct 13, 2011, at 11:20 AM, Kostik Belousov wrote:
 
 The two commits removed NX support for .data/.bss for 32bit binaries
 Thon amd64. is is too unfortunate. Can we claim that only old
 Thbinaries need this hack ?
 
 I don't know. When did our ABI for i386 change to have NX by default?
 I think it changed de-facto when NX appears to be supported by hardware.
 In other words, PF_R-PF_X was always considered a coincident, and not
 a promise.

That's really besides the point. ABI changes are made deliberately
and ABIs must be well-documented for anyone to adhere to it. You
can't post hoc wave your hand and say that at some unspecified time
in the past the ABI changed: at what precise time does supported
by hardware mean and how does that tie to a major FreeBSD version?

Point in case: the JDK 1.4.x still works on FreeBSD 9.x (i386), so
the ABI really hasn't changed at all in that respect.

 I think we can claim that the moment FreeBSD gained PAE support, it happen.

We cannot make that claim at at.

 I would suggest to add a sysctl, say kern.elf32.readable_nx, with
 the values:
 0 - strictly follow segment permissions
 1 - PF_R implies PF_X if p_osrel  60
 2 - PF_R always implied PF_X
 for 32bit binaries.

A sysctl is a good idea, but I would just give it a 0/1 value.
Adding a p_osrel  60 case is entirely without grounds.

-- 
Marcel Moolenaar
mar...@xcllnt.net


___
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: r226351 - in head: share/misc usr.bin/calendar/calendars

2011-10-13 Thread Raphael Kubo da Costa
Author: rakuco (ports committer)
Date: Thu Oct 13 20:36:43 2011
New Revision: 226351
URL: http://svn.freebsd.org/changeset/base/226351

Log:
  Add myself to committers-ports.dot and calendar.freebsd.
  
  Approved by:  avilla (mentor)

Modified:
  head/share/misc/committers-ports.dot
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotThu Oct 13 20:06:19 2011
(r226350)
+++ head/share/misc/committers-ports.dotThu Oct 13 20:36:43 2011
(r226351)
@@ -154,6 +154,7 @@ pgj [label=Gabor Pali\n...@freebsd.org\
 philip [label=Philip Paeps\nphi...@freebsd.org\n2005/10/19]
 pgollucci [label=Philip M. Gollucci\npgollu...@freebsd.org\n2008/07/21]
 rafan [label=Rong-En Fan\nra...@freebsd.org\n2006/06/23]
+rakuco [label=Raphael Kubo da Costa\nrak...@freebsd.org\n2011/08/22]
 rene [label=Rene Ladan\nr...@freebsd.org\n2010/04/11]
 rnoland [label=Robert Noland\nrnol...@freebsd.org\n2008/07/21]
 romain [label=Romain Tartiere\nrom...@freebsd.org\n2010/01/24]
@@ -210,6 +211,8 @@ arved - stefan
 
 asami - obrien
 
+avilla - rakuco
+
 bapt - eadler
 bapt - jlaffaye
 
@@ -327,6 +330,7 @@ marcus - eik
 marcus - jmallett
 
 makc - bf
+makc - rakuco
 
 mat - thierry
 

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdThu Oct 13 20:06:19 
2011(r226350)
+++ head/usr.bin/calendar/calendars/calendar.freebsdThu Oct 13 20:36:43 
2011(r226351)
@@ -22,6 +22,7 @@
 01/16  Ariff Abdullah ar...@freebsd.org born in Kuala Lumpur, Malaysia, 1978
 01/16  Dmitry Sivachenko de...@freebsd.org born in Moscow, USSR, 1978
 01/16  Vanilla I. Shu vani...@freebsd.org born in Taipei, Taiwan, Republic 
of China, 1978
+01/17  Raphael Kubo da Costa rak...@freebsd.org born in Sao Paulo, Sao 
Paulo, Brazil, 1989
 01/18  Dejan Lesjak l...@freebsd.org born in Ljubljana, Slovenia, 
Yugoslavia, 1977
 01/19  Marshall Kirk McKusick mckus...@freebsd.org born in Wilmington, 
Delaware, United States, 1954
 01/19  Ruslan Ermilov r...@freebsd.org born in Simferopol, USSR, 1974
___
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: r226343 - head/sys/vm

2011-10-13 Thread John Baldwin
On Thursday, October 13, 2011 4:13:10 pm Marcel Moolenaar wrote:
 
 On Oct 13, 2011, at 12:09 PM, Kostik Belousov wrote:
 
  On Thu, Oct 13, 2011 at 11:30:12AM -0700, Marcel Moolenaar wrote:
  
  On Oct 13, 2011, at 11:20 AM, Kostik Belousov wrote:
  
  The two commits removed NX support for .data/.bss for 32bit binaries
  Thon amd64. is is too unfortunate. Can we claim that only old
  Thbinaries need this hack ?
  
  I don't know. When did our ABI for i386 change to have NX by default?
  I think it changed de-facto when NX appears to be supported by hardware.
  In other words, PF_R-PF_X was always considered a coincident, and not
  a promise.
 
 That's really besides the point. ABI changes are made deliberately
 and ABIs must be well-documented for anyone to adhere to it. You
 can't post hoc wave your hand and say that at some unspecified time
 in the past the ABI changed: at what precise time does supported
 by hardware mean and how does that tie to a major FreeBSD version?
 
 Point in case: the JDK 1.4.x still works on FreeBSD 9.x (i386), so
 the ABI really hasn't changed at all in that respect.

I think if you booted a FreeBSD 9.x i386 PAE kernel you'd find that the
jdk did not work.  That will be true for any i386 PAE kernel back to
when PG_NX support was introduced.

-- 
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: r226343 - head/sys/vm

2011-10-13 Thread Marcel Moolenaar

On Oct 13, 2011, at 2:07 PM, John Baldwin wrote:
 
 That's really besides the point. ABI changes are made deliberately
 and ABIs must be well-documented for anyone to adhere to it. You
 can't post hoc wave your hand and say that at some unspecified time
 in the past the ABI changed: at what precise time does supported
 by hardware mean and how does that tie to a major FreeBSD version?
 
 Point in case: the JDK 1.4.x still works on FreeBSD 9.x (i386), so
 the ABI really hasn't changed at all in that respect.
 
 I think if you booted a FreeBSD 9.x i386 PAE kernel you'd find that the
 jdk did not work.  That will be true for any i386 PAE kernel back to
 when PG_NX support was introduced.

That's bad.

-- 
Marcel Moolenaar
mar...@xcllnt.net


___
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: r226353 - head/sys/compat/freebsd32

2011-10-13 Thread Marcel Moolenaar
Author: marcel
Date: Thu Oct 13 22:33:03 2011
New Revision: 226353
URL: http://svn.freebsd.org/changeset/base/226353

Log:
  Use PTRIN().

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Thu Oct 13 21:41:54 2011
(r226352)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Thu Oct 13 22:33:03 2011
(r226353)
@@ -441,7 +441,7 @@ freebsd32_mprotect(struct thread *td, st
 {
struct mprotect_args ap;
 
-   ap.addr = (void *)(uintptr_t)uap-addr;
+   ap.addr = PTRIN(uap-addr);
ap.len = uap-len;
ap.prot = uap-prot;
 #if defined(__amd64__) || defined(__ia64__)
___
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: r226343 - head/sys/vm

2011-10-13 Thread David Schultz
On Thu, Oct 13, 2011, Marcel Moolenaar wrote:
 
 On Oct 13, 2011, at 2:07 PM, John Baldwin wrote:
  
  That's really besides the point. ABI changes are made deliberately
  and ABIs must be well-documented for anyone to adhere to it. You
  can't post hoc wave your hand and say that at some unspecified time
  in the past the ABI changed: at what precise time does supported
  by hardware mean and how does that tie to a major FreeBSD version?
  
  Point in case: the JDK 1.4.x still works on FreeBSD 9.x (i386), so
  the ABI really hasn't changed at all in that respect.
  
  I think if you booted a FreeBSD 9.x i386 PAE kernel you'd find that the
  jdk did not work.  That will be true for any i386 PAE kernel back to
  when PG_NX support was introduced.
 
 That's bad.

Recent binutils support a PT_GNU_HEAP flag in the ELF header that
controls whether heap allocations are executable by default.  In
Linux, the flag can be set using an ld option or the execstack(8)
command.  That seems like a better way to go than breaking old
JVMs or disabling the security feature.
___
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: r226354 - head/share/misc

2011-10-13 Thread Warren Block
Author: wblock (doc committer)
Date: Fri Oct 14 00:34:45 2011
New Revision: 226354
URL: http://svn.freebsd.org/changeset/base/226354

Log:
  Add mentors and myself to committers-doc.dot.
  
  Approved by:  gjb (mentor)

Modified:
  head/share/misc/committers-doc.dot

Modified: head/share/misc/committers-doc.dot
==
--- head/share/misc/committers-doc.dot  Thu Oct 13 22:33:03 2011
(r226353)
+++ head/share/misc/committers-doc.dot  Fri Oct 14 00:34:45 2011
(r226354)
@@ -79,12 +79,14 @@ ryusuke [label=Ryusuke Suzuki\nryusuke@
 simon [label=Simon L. Nielsen\nsi...@freebsd.org\n2003/07/20]
 taras [label=Taras Korenko\nta...@freebsd.org\n2010/06/25]
 trhodes [label=Tom Rhodes\ntrho...@freebsd.org\n2002/03/25]
+wblock [label=Warren Block\nwbl...@freebsd.org\n2011/09/12]
 
 # Here are the mentor/mentee relationships.
 # Group together all the mentees for a particular mentor.
 # Keep the list sorted by mentor login.
 
 bcr - gavin
+bcr - wblock
 
 blackend - ale
 
@@ -105,6 +107,8 @@ gabor - pgj
 gabor - manolis
 gabor - taras
 
+gjb - wblock
+
 hrs - ryusuke
 
 jesusr - jcamou
___
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: r226355 - head/sys/dev/ath

2011-10-13 Thread Adrian Chadd
Author: adrian
Date: Fri Oct 14 03:24:35 2011
New Revision: 226355
URL: http://svn.freebsd.org/changeset/base/226355

Log:
  ath_pci PCI setup fixes.
  
  * Break out the PCI setup override code into a new function.
  * Re-apply the PCI overrides on powersave resume. The retry timeout
register isn't currently being saved/resumed by the PCI driver/bus
code.

Modified:
  head/sys/dev/ath/if_ath_pci.c

Modified: head/sys/dev/ath/if_ath_pci.c
==
--- head/sys/dev/ath/if_ath_pci.c   Fri Oct 14 00:34:45 2011
(r226354)
+++ head/sys/dev/ath/if_ath_pci.c   Fri Oct 14 03:24:35 2011
(r226355)
@@ -74,6 +74,16 @@ struct ath_pci_softc {
 #defineBS_BAR  0x10
 #definePCIR_RETRY_TIMEOUT  0x41
 
+static void
+ath_pci_setup(device_t dev)
+{
+   /*
+* Disable retry timeout to keep PCI Tx retries from
+* interfering with C3 CPU state.
+*/
+   pci_write_config(dev, PCIR_RETRY_TIMEOUT, 0, 1);
+}
+
 static int
 ath_pci_probe(device_t dev)
 {
@@ -103,10 +113,9 @@ ath_pci_attach(device_t dev)
pci_enable_busmaster(dev);
 
/*
-* Disable retry timeout to keep PCI Tx retries from
-* interfering with C3 CPU state.
+* Setup other PCI bus configuration parameters.
 */
-   pci_write_config(dev, PCIR_RETRY_TIMEOUT, 0, 1);
+   ath_pci_setup(dev);
 
/* 
 * Setup memory-mapping of PCI registers.
@@ -228,6 +237,11 @@ ath_pci_resume(device_t dev)
 {
struct ath_pci_softc *psc = device_get_softc(dev);
 
+   /*
+* Suspend/resume resets the PCI configuration space.
+*/
+   ath_pci_setup(dev);
+
ath_resume(psc-sc_sc);
 
return (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