Re: svn commit: r239382 - in head/etc: defaults rc.d

2012-10-02 Thread Lawrence Stewart

Hi Jun,

On 08/19/12 18:15, Jun Kuriyama wrote:

Author: kuriyama
Date: Sun Aug 19 08:15:32 2012
New Revision: 239382
URL: http://svn.freebsd.org/changeset/base/239382

Log:
   - Allow to pass extra parameters for each jails.
   - To achieve above, convert jail(8) invocation to use new style
 command line -c flag.

   Reviewed at: freebsd-jail@

Modified:
   head/etc/defaults/rc.conf
   head/etc/rc.d/jail


Can this change be MFCed without raising any POLA issues (I suspect it 
can)? If yes, would you be willing to MFC it to stable/8 and stable/9?


Cheers,
Lawrence
___
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: r241123 - in head/sys/mips: include mips

2012-10-02 Thread Alan Cox
Author: alc
Date: Tue Oct  2 07:14:22 2012
New Revision: 241123
URL: http://svn.freebsd.org/changeset/base/241123

Log:
  Introduce a new TLB invalidation function for efficiently invalidating
  address ranges, and use this function in pmap_remove().
  
  Tested by:jchandra

Modified:
  head/sys/mips/include/tlb.h
  head/sys/mips/mips/pmap.c
  head/sys/mips/mips/tlb.c

Modified: head/sys/mips/include/tlb.h
==
--- head/sys/mips/include/tlb.h Tue Oct  2 06:37:46 2012(r241122)
+++ head/sys/mips/include/tlb.h Tue Oct  2 07:14:22 2012(r241123)
@@ -53,6 +53,7 @@ void tlb_insert_wired(unsigned, vm_offse
 void tlb_invalidate_address(struct pmap *, vm_offset_t);
 void tlb_invalidate_all(void);
 void tlb_invalidate_all_user(struct pmap *);
+void tlb_invalidate_range(struct pmap *, vm_offset_t, vm_offset_t);
 void tlb_save(void);
 void tlb_update(struct pmap *, vm_offset_t, pt_entry_t);
 

Modified: head/sys/mips/mips/pmap.c
==
--- head/sys/mips/mips/pmap.c   Tue Oct  2 06:37:46 2012(r241122)
+++ head/sys/mips/mips/pmap.c   Tue Oct  2 07:14:22 2012(r241123)
@@ -190,10 +190,9 @@ static vm_page_t _pmap_allocpte(pmap_t p
 static int pmap_unuse_pt(pmap_t, vm_offset_t, pd_entry_t);
 static pt_entry_t init_pte_prot(vm_page_t m, vm_prot_t access, vm_prot_t prot);
 
-#ifdef SMP
 static void pmap_invalidate_page_action(void *arg);
+static void pmap_invalidate_range_action(void *arg);
 static void pmap_update_page_action(void *arg);
-#endif
 
 #ifndef __mips_n64
 /*
@@ -711,6 +710,31 @@ pmap_invalidate_page(pmap_t pmap, vm_off
pmap_call_on_active_cpus(pmap, pmap_invalidate_page_action, arg);
 }
 
+struct pmap_invalidate_range_arg {
+   pmap_t pmap;
+   vm_offset_t sva;
+   vm_offset_t eva;
+};
+
+static void
+pmap_invalidate_range_action(void *arg)
+{
+   struct pmap_invalidate_range_arg *p = arg;
+
+   tlb_invalidate_range(p-pmap, p-sva, p-eva);
+}
+
+static void
+pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
+{
+   struct pmap_invalidate_range_arg arg;
+
+   arg.pmap = pmap;
+   arg.sva = sva;
+   arg.eva = eva;
+   pmap_call_on_active_cpus(pmap, pmap_invalidate_range_action, arg);
+}
+
 struct pmap_update_page_arg {
pmap_t pmap;
vm_offset_t va;
@@ -1737,12 +1761,15 @@ pmap_remove_page(struct pmap *pmap, vm_o
  * rounded to the page size.
  */
 void
-pmap_remove(struct pmap *pmap, vm_offset_t sva, vm_offset_t eva)
+pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
 {
-   vm_offset_t va_next;
pd_entry_t *pde, *pdpe;
pt_entry_t *pte;
+   vm_offset_t va, va_next;
 
+   /*
+* Perform an unsynchronized read.  This is, however, safe.
+*/
if (pmap-pm_stats.resident_count == 0)
return;
 
@@ -1772,17 +1799,36 @@ pmap_remove(struct pmap *pmap, vm_offset
va_next = eva;
 
pde = pmap_pdpe_to_pde(pdpe, sva);
-   if (*pde == 0)
+   if (*pde == NULL)
continue;
+
+   /*
+* Limit our scan to either the end of the va represented
+* by the current page table page, or to the end of the
+* range being removed.
+*/
if (va_next  eva)
va_next = eva;
+
+   va = va_next;
for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++,
sva += PAGE_SIZE) {
-   if (!pte_test(pte, PTE_V))
+   if (!pte_test(pte, PTE_V)) {
+   if (va != va_next) {
+   pmap_invalidate_range(pmap, va, sva);
+   va = va_next;
+   }
continue;
-   pmap_remove_pte(pmap, pte, sva, *pde);
-   pmap_invalidate_page(pmap, sva);
+   }
+   if (va == va_next)
+   va = sva;
+   if (pmap_remove_pte(pmap, pte, sva, *pde)) {
+   sva += PAGE_SIZE;
+   break;
+   }
}
+   if (va != va_next)
+   pmap_invalidate_range(pmap, va, sva);
}
 out:
rw_wunlock(pvh_global_lock);

Modified: head/sys/mips/mips/tlb.c
==
--- head/sys/mips/mips/tlb.cTue Oct  2 06:37:46 2012(r241122)
+++ head/sys/mips/mips/tlb.cTue Oct  2 07:14:22 2012(r241123)
@@ -35,7 +35,7 @@
 #include sys/smp.h
 
 #include vm/vm.h
-#include vm/vm_page.h
+#include vm/pmap.h
 
 #include 

svn commit: r241124 - head/usr.sbin/cron/cron

2012-10-02 Thread Sergey Kandaurov
Author: pluknet
Date: Tue Oct  2 09:19:28 2012
New Revision: 241124
URL: http://svn.freebsd.org/changeset/base/241124

Log:
  Fix build with DEBUGGING disabled.

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

Modified: head/usr.sbin/cron/cron/cron.c
==
--- head/usr.sbin/cron/cron/cron.c  Tue Oct  2 07:14:22 2012
(r241123)
+++ head/usr.sbin/cron/cron/cron.c  Tue Oct  2 09:19:28 2012
(r241124)
@@ -51,16 +51,20 @@ struct pidfh *pfh;
 
 static void
 usage() {
+#if DEBUGGING
 char **dflags;
+#endif
 
fprintf(stderr, usage: cron [-j jitter] [-J rootjitter] 
[-m mailto] [-s] [-o] [-x debugflag[,...]]\n);
+#if DEBUGGING
fprintf(stderr, \ndebugflags: );
 
 for(dflags = DebugFlagNames; *dflags; dflags++) {
fprintf(stderr, %s , *dflags);
}
 fprintf(stderr, \n);
+#endif
 
exit(ERROR_EXIT);
 }
___
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: r241125 - head/usr.sbin/cron/lib

2012-10-02 Thread Sergey Kandaurov
Author: pluknet
Date: Tue Oct  2 09:23:16 2012
New Revision: 241125
URL: http://svn.freebsd.org/changeset/base/241125

Log:
  Fix build with LOG_FILE undefined and DEBUGGING disabled.

Modified:
  head/usr.sbin/cron/lib/misc.c

Modified: head/usr.sbin/cron/lib/misc.c
==
--- head/usr.sbin/cron/lib/misc.c   Tue Oct  2 09:19:28 2012
(r241124)
+++ head/usr.sbin/cron/lib/misc.c   Tue Oct  2 09:23:16 2012
(r241125)
@@ -391,7 +391,9 @@ log_it(username, xpid, event, detail)
char*event;
char*detail;
 {
+#if defined(LOG_FILE) || DEBUGGING
PID_T   pid = xpid;
+#endif
 #if defined(LOG_FILE)
char*msg;
TIME_T  now = time((TIME_T) 0);
___
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: r241126 - head/usr.sbin/fifolog/fifolog_create

2012-10-02 Thread Sergey Kandaurov
Author: pluknet
Date: Tue Oct  2 09:53:50 2012
New Revision: 241126
URL: http://svn.freebsd.org/changeset/base/241126

Log:
  mdoc: point to an existing cross reference.

Modified:
  head/usr.sbin/fifolog/fifolog_create/fifolog.1

Modified: head/usr.sbin/fifolog/fifolog_create/fifolog.1
==
--- head/usr.sbin/fifolog/fifolog_create/fifolog.1  Tue Oct  2 09:23:16 
2012(r241125)
+++ head/usr.sbin/fifolog/fifolog_create/fifolog.1  Tue Oct  2 09:53:50 
2012(r241126)
@@ -203,7 +203,7 @@ One particular useful use of
 is with
 .Xr syslogd 8
 using a line such as this in
-.Xr /etc/syslog.conf 5 :
+.Xr syslog.conf 5 :
 .Pp
 .Dl *.* |fifolog_writer /var/log/syslog_fifolog
 .Sh HISTORY
___
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: r241127 - head/sys/dev/usb

2012-10-02 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Oct  2 10:05:39 2012
New Revision: 241127
URL: http://svn.freebsd.org/changeset/base/241127

Log:
  Remove unused field.
  
  MFC after:1 week

Modified:
  head/sys/dev/usb/usb_hub.c

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Tue Oct  2 09:53:50 2012(r241126)
+++ head/sys/dev/usb/usb_hub.c  Tue Oct  2 10:05:39 2012(r241127)
@@ -103,7 +103,6 @@ struct uhub_softc {
struct usb_xfer *sc_xfer[UHUB_N_TRANSFER];  /* interrupt xfer */
uint8_t sc_flags;
 #defineUHUB_FLAG_DID_EXPLORE 0x01
-   charsc_name[32];
 };
 
 #defineUHUB_PROTO(sc) ((sc)-sc_udev-ddesc.bDeviceProtocol)
@@ -927,9 +926,6 @@ uhub_attach(device_t dev)
 
mtx_init(sc-sc_mtx, USB HUB mutex, NULL, MTX_DEF);
 
-   snprintf(sc-sc_name, sizeof(sc-sc_name), %s,
-   device_get_nameunit(dev));
-
device_set_usb_desc(dev);
 
DPRINTFN(2, depth=%d selfpowered=%d, parent=%p, 
___
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: r241128 - head/sys/dev/usb

2012-10-02 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Oct  2 10:09:23 2012
New Revision: 241128
URL: http://svn.freebsd.org/changeset/base/241128

Log:
  Style.
  
  MFC after:1 week

Modified:
  head/sys/dev/usb/usb_hub.c

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Tue Oct  2 10:05:39 2012(r241127)
+++ head/sys/dev/usb/usb_hub.c  Tue Oct  2 10:09:23 2012(r241128)
@@ -160,7 +160,7 @@ static device_method_t uhub_methods[] = 
DEVMETHOD(bus_child_location_str, uhub_child_location_string),
DEVMETHOD(bus_child_pnpinfo_str, uhub_child_pnpinfo_string),
DEVMETHOD(bus_driver_added, uhub_driver_added),
-   {0, 0}
+   DEVMETHOD_END
 };
 
 static driver_t uhub_driver = {
___
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: r241129 - head/sys/netinet

2012-10-02 Thread Gleb Smirnoff
Author: glebius
Date: Tue Oct  2 12:03:02 2012
New Revision: 241129
URL: http://svn.freebsd.org/changeset/base/241129

Log:
   There is a complex race in in_pcblookup_hash() and in_pcblookup_group().
  Both functions need to obtain lock on the found PCB, and they can't do
  classic inter-lock with the PCB hash lock, due to lock order reversal.
  To keep the PCB stable, these functions put a reference on it and after PCB
  lock is acquired drop it. If the reference was the last one, this means
  we've raced with in_pcbfree() and the PCB is no longer valid.
  
This approach works okay only if we are acquiring writer-lock on the PCB.
  In case of reader-lock, the following scenario can happen:
  
- 2 threads locate pcb, and do in_pcbref() on it.
- These 2 threads drop the inp hash lock.
- Another thread comes to delete pcb via in_pcbfree(), it obtains hash lock,
  does in_pcbremlists(), drops hash lock, and runs in_pcbrele_wlocked(), 
which
  doesn't free the pcb due to two references on it. Then it unlocks the pcb.
- 2 aforementioned threads acquire reader lock on the pcb and run
  in_pcbrele_rlocked(). One gets 1 from in_pcbrele_rlocked() and continues,
  second gets 0 and considers pcb freed, returns.
- The thread that got 1 continutes working with detached pcb, which later
  leads to panic in the underlying protocol level.
  
To plumb that problem an additional INPCB flag introduced - INP_FREED. We
  check for that flag in the in_pcbrele_rlocked() and if it is set, we pretend
  that that was the last reference.
  
  Discussed with:   rwatson, jhb
  Reported by:  Vladimir Medvedkin medved rambler-co.ru

Modified:
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h

Modified: head/sys/netinet/in_pcb.c
==
--- head/sys/netinet/in_pcb.c   Tue Oct  2 10:09:23 2012(r241128)
+++ head/sys/netinet/in_pcb.c   Tue Oct  2 12:03:02 2012(r241129)
@@ -1105,8 +1105,17 @@ in_pcbrele_rlocked(struct inpcb *inp)
 
INP_RLOCK_ASSERT(inp);
 
-   if (refcount_release(inp-inp_refcount) == 0)
+   if (refcount_release(inp-inp_refcount) == 0) {
+   /*
+* If the inpcb has been freed, let the caller know, even if
+* this isn't the last reference.
+*/
+   if (inp-inp_flags2  INP_FREED) {
+   INP_RUNLOCK(inp);
+   return (1);
+   }
return (0);
+   }
 
KASSERT(inp-inp_socket == NULL, (%s: inp_socket != NULL, __func__));
 
@@ -1186,6 +1195,7 @@ in_pcbfree(struct inpcb *inp)
inp_freemoptions(inp-inp_moptions);
 #endif
inp-inp_vflag = 0;
+   inp-inp_flags2 |= INP_FREED;
crfree(inp-inp_cred);
 #ifdef MAC
mac_inpcb_destroy(inp);

Modified: head/sys/netinet/in_pcb.h
==
--- head/sys/netinet/in_pcb.h   Tue Oct  2 10:09:23 2012(r241128)
+++ head/sys/netinet/in_pcb.h   Tue Oct  2 12:03:02 2012(r241129)
@@ -542,6 +542,7 @@ voidinp_4tuple_get(struct inpcb *inp, 
 #defineINP_RT_VALID0x0002 /* cached rtentry is valid */
 #defineINP_PCBGROUPWILD0x0004 /* in pcbgroup wildcard list 
*/
 #defineINP_REUSEPORT   0x0008 /* SO_REUSEPORT option is 
set */
+#defineINP_FREED   0x0010 /* inp itself is not valid */
 
 /*
  * Flags passed to in_pcblookup*() functions.
___
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: r241130 - head/sys/net

2012-10-02 Thread John Baldwin
Author: jhb
Date: Tue Oct  2 12:25:30 2012
New Revision: 241130
URL: http://svn.freebsd.org/changeset/base/241130

Log:
  Rename the module for 'device enc' to if_enc to avoid conflicting with
  the CAM enc peripheral (part of ses(4)).  Previously the two modules
  used the same name, so only one was included in a linked kernel causing
  enc0 to not be created if you added IPSEC to GENERIC.  The new module
  name follows the pattern of other network interfaces (e.g. if_loop).
  
  MFC after:1 week

Modified:
  head/sys/net/if_enc.c

Modified: head/sys/net/if_enc.c
==
--- head/sys/net/if_enc.c   Tue Oct  2 12:03:02 2012(r241129)
+++ head/sys/net/if_enc.c   Tue Oct  2 12:25:30 2012(r241130)
@@ -179,12 +179,12 @@ enc_modevent(module_t mod, int type, voi
 }
 
 static moduledata_t enc_mod = {
-   enc,
+   if_enc,
enc_modevent,
0
 };
 
-DECLARE_MODULE(enc, enc_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY);
+DECLARE_MODULE(if_enc, enc_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY);
 
 static int
 enc_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
___
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: r241131 - head/sys/netpfil/pf

2012-10-02 Thread Gleb Smirnoff
Author: glebius
Date: Tue Oct  2 12:44:46 2012
New Revision: 241131
URL: http://svn.freebsd.org/changeset/base/241131

Log:
  To reduce volume of pfsync traffic:
  - Scan request update queue to prevent doubles.
  - Do not push undersized daragram in pfsync_update_request().

Modified:
  head/sys/netpfil/pf/if_pfsync.c

Modified: head/sys/netpfil/pf/if_pfsync.c
==
--- head/sys/netpfil/pf/if_pfsync.c Tue Oct  2 12:25:30 2012
(r241130)
+++ head/sys/netpfil/pf/if_pfsync.c Tue Oct  2 12:44:46 2012
(r241131)
@@ -1832,9 +1832,15 @@ pfsync_request_update(u_int32_t creatori
PFSYNC_LOCK_ASSERT(sc);
 
/*
-* This code does nothing to prevent multiple update requests for the
-* same state being generated.
+* This code does a bit to prevent multiple update requests for the
+* same state being generated. It searches current subheader queue,
+* but it doesn't lookup into queue of already packed datagrams.
 */
+   TAILQ_FOREACH(item, sc-sc_upd_req_list, ur_entry)
+   if (item-ur_msg.id == id 
+   item-ur_msg.creatorid == creatorid)
+   return;
+
item = malloc(sizeof(*item), M_PFSYNC, M_NOWAIT);
if (item == NULL)
return; /* XXX stats */
@@ -1854,8 +1860,6 @@ pfsync_request_update(u_int32_t creatori
 
TAILQ_INSERT_TAIL(sc-sc_upd_req_list, item, ur_entry);
sc-sc_len += nlen;
-
-   pfsync_push(sc);
 }
 
 static void
___
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: r241132 - stable/9/sys/netinet

2012-10-02 Thread Gleb Smirnoff
Author: glebius
Date: Tue Oct  2 12:57:47 2012
New Revision: 241132
URL: http://svn.freebsd.org/changeset/base/241132

Log:
  Merge r240985 from head:
Fix bug in TCP_KEEPCNT setting, which slipped in in the last round
of reviewing of r231025.
  
Unlike other options from this family TCP_KEEPCNT doesn't specify
time interval, but a count, thus parameter supplied doesn't need
to be multiplied by hz.
  
Reported  tested by:   amdmi3

Modified:
  stable/9/sys/netinet/tcp_usrreq.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/tcp_usrreq.c
==
--- stable/9/sys/netinet/tcp_usrreq.c   Tue Oct  2 12:44:46 2012
(r241131)
+++ stable/9/sys/netinet/tcp_usrreq.c   Tue Oct  2 12:57:47 2012
(r241132)
@@ -1443,7 +1443,6 @@ tcp_ctloutput(struct socket *so, struct 
 
case TCP_KEEPIDLE:
case TCP_KEEPINTVL:
-   case TCP_KEEPCNT:
case TCP_KEEPINIT:
INP_WUNLOCK(inp);
error = sooptcopyin(sopt, ui, sizeof(ui), sizeof(ui));
@@ -1476,13 +1475,6 @@ tcp_ctloutput(struct socket *so, struct 
tcp_timer_activate(tp, TT_2MSL,
TP_MAXIDLE(tp));
break;
-   case TCP_KEEPCNT:
-   tp-t_keepcnt = ui;
-   if ((tp-t_state == TCPS_FIN_WAIT_2) 
-   (TP_MAXIDLE(tp)  0))
-   tcp_timer_activate(tp, TT_2MSL,
-   TP_MAXIDLE(tp));
-   break;
case TCP_KEEPINIT:
tp-t_keepinit = ui;
if (tp-t_state == TCPS_SYN_RECEIVED ||
@@ -1494,6 +1486,21 @@ tcp_ctloutput(struct socket *so, struct 
INP_WUNLOCK(inp);
break;
 
+   case TCP_KEEPCNT:
+   INP_WUNLOCK(inp);
+   error = sooptcopyin(sopt, ui, sizeof(ui), sizeof(ui));
+   if (error)
+   return (error);
+
+   INP_WLOCK_RECHECK(inp);
+   tp-t_keepcnt = ui;
+   if ((tp-t_state == TCPS_FIN_WAIT_2) 
+   (TP_MAXIDLE(tp)  0))
+   tcp_timer_activate(tp, TT_2MSL,
+   TP_MAXIDLE(tp));
+   INP_WUNLOCK(inp);
+   break;
+
default:
INP_WUNLOCK(inp);
error = ENOPROTOOPT;
___
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: r241133 - releng/9.1/sys/netinet

2012-10-02 Thread Gleb Smirnoff
Author: glebius
Date: Tue Oct  2 13:03:11 2012
New Revision: 241133
URL: http://svn.freebsd.org/changeset/base/241133

Log:
  Merge r240985 from head:
Fix bug in TCP_KEEPCNT setting, which slipped in in the last round
of reviewing of r231025.
  
Unlike other options from this family TCP_KEEPCNT doesn't specify
time interval, but a count, thus parameter supplied doesn't need
to be multiplied by hz.
  
Reported  tested by:   amdmi3
  
  Approved by:  re (kib)

Modified:
  releng/9.1/sys/netinet/tcp_usrreq.c
Directory Properties:
  releng/9.1/sys/   (props changed)

Modified: releng/9.1/sys/netinet/tcp_usrreq.c
==
--- releng/9.1/sys/netinet/tcp_usrreq.c Tue Oct  2 12:57:47 2012
(r241132)
+++ releng/9.1/sys/netinet/tcp_usrreq.c Tue Oct  2 13:03:11 2012
(r241133)
@@ -1443,7 +1443,6 @@ tcp_ctloutput(struct socket *so, struct 
 
case TCP_KEEPIDLE:
case TCP_KEEPINTVL:
-   case TCP_KEEPCNT:
case TCP_KEEPINIT:
INP_WUNLOCK(inp);
error = sooptcopyin(sopt, ui, sizeof(ui), sizeof(ui));
@@ -1476,13 +1475,6 @@ tcp_ctloutput(struct socket *so, struct 
tcp_timer_activate(tp, TT_2MSL,
TP_MAXIDLE(tp));
break;
-   case TCP_KEEPCNT:
-   tp-t_keepcnt = ui;
-   if ((tp-t_state == TCPS_FIN_WAIT_2) 
-   (TP_MAXIDLE(tp)  0))
-   tcp_timer_activate(tp, TT_2MSL,
-   TP_MAXIDLE(tp));
-   break;
case TCP_KEEPINIT:
tp-t_keepinit = ui;
if (tp-t_state == TCPS_SYN_RECEIVED ||
@@ -1494,6 +1486,21 @@ tcp_ctloutput(struct socket *so, struct 
INP_WUNLOCK(inp);
break;
 
+   case TCP_KEEPCNT:
+   INP_WUNLOCK(inp);
+   error = sooptcopyin(sopt, ui, sizeof(ui), sizeof(ui));
+   if (error)
+   return (error);
+
+   INP_WLOCK_RECHECK(inp);
+   tp-t_keepcnt = ui;
+   if ((tp-t_state == TCPS_FIN_WAIT_2) 
+   (TP_MAXIDLE(tp)  0))
+   tcp_timer_activate(tp, TT_2MSL,
+   TP_MAXIDLE(tp));
+   INP_WUNLOCK(inp);
+   break;
+
default:
INP_WUNLOCK(inp);
error = ENOPROTOOPT;
___
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: r241134 - head/usr.sbin/ip6addrctl

2012-10-02 Thread Eitan Adler
Author: eadler
Date: Tue Oct  2 14:48:03 2012
New Revision: 241134
URL: http://svn.freebsd.org/changeset/base/241134

Log:
  Fix alignment related warnings reported by gcc
  Switch from old style arguments to modern C
  remove WARNS as a result
  
  tested with make universe
  
  Approved by:  cperciva
  MFC after:1 week

Modified:
  head/usr.sbin/ip6addrctl/Makefile
  head/usr.sbin/ip6addrctl/ip6addrctl.c

Modified: head/usr.sbin/ip6addrctl/Makefile
==
--- head/usr.sbin/ip6addrctl/Makefile   Tue Oct  2 13:03:11 2012
(r241133)
+++ head/usr.sbin/ip6addrctl/Makefile   Tue Oct  2 14:48:03 2012
(r241134)
@@ -3,6 +3,4 @@
 PROG=  ip6addrctl
 MAN=   ip6addrctl.8
 
-WARNS?=2
-
 .include bsd.prog.mk

Modified: head/usr.sbin/ip6addrctl/ip6addrctl.c
==
--- head/usr.sbin/ip6addrctl/ip6addrctl.c   Tue Oct  2 13:03:11 2012
(r241133)
+++ head/usr.sbin/ip6addrctl/ip6addrctl.c   Tue Oct  2 14:48:03 2012
(r241134)
@@ -71,12 +71,10 @@ static void plen2mask(struct sockaddr_in
 static void set_policy(void);
 static void add_policy(char *, char *, char *);
 static void delete_policy(char *);
-static void flush_policy();
+static void flush_policy(void);
 
 int
-main(argc, argv)
-   int argc;
-   char *argv[];
+main(int argc, char *argv[])
 {
TAILQ_INIT(policyhead);
 
@@ -107,11 +105,11 @@ main(argc, argv)
 }
 
 static void
-get_policy()
+get_policy(void)
 {
int mib[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_ADDRCTLPOLICY };
size_t l;
-   char *buf;
+   struct in6_addrpolicy *buf;
struct in6_addrpolicy *pol, *ep;
 
if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), NULL, l, NULL, 0)  0) {
@@ -131,8 +129,8 @@ get_policy()
/* NOTREACHED */
}
 
-   ep = (struct in6_addrpolicy *)(buf + l);
-   for (pol = (struct in6_addrpolicy *)buf; pol + 1 = ep; pol++) {
+   ep = buf + l/sizeof(*buf);
+   for (pol = buf; pol + 1 = ep; pol++) {
struct policyqueue *new;
 
if ((new = malloc(sizeof(*new))) == NULL)
@@ -145,7 +143,7 @@ get_policy()
 }
 
 static void
-dump_policy()
+dump_policy(void)
 {
size_t addrlen;
char addrbuf[NI_MAXHOST];
@@ -201,8 +199,7 @@ dump_policy()
} while (0);
 
 static void
-make_policy_fromfile(conf)
-   char *conf;
+make_policy_fromfile(char *conf)
 {
char line[_POSIX2_LINE_MAX], *cp;
char *addrstr;
@@ -257,9 +254,7 @@ make_policy_fromfile(conf)
 }
 
 static int
-parse_prefix(prefix0, pol)
-   const char *prefix0;
-   struct in6_addrpolicy *pol;
+parse_prefix(const char *prefix0, struct in6_addrpolicy *pol)
 {
int e = 0, plen;
char *prefix, *plenstr;
@@ -299,11 +294,9 @@ parse_prefix(prefix0, pol)
 }
 
 static void
-plen2mask(mask, plen)
-   struct sockaddr_in6 *mask;
-   int plen;
+plen2mask(struct sockaddr_in6 *mask, int plen)
 {
-   u_char *cp = (char *)mask-sin6_addr;
+   u_char *cp = (unsigned char *)mask-sin6_addr;
 
memset(mask, 0, sizeof(*mask));
mask-sin6_family = AF_INET6; /* just in case */
@@ -316,7 +309,7 @@ plen2mask(mask, plen)
 }
 
 static void
-set_policy()
+set_policy(void)
 {
struct policyqueue *ent;
int s;
@@ -334,8 +327,7 @@ set_policy()
 }
 
 static int
-mask2plen(mask)
-   struct sockaddr_in6 *mask;
+mask2plen(struct sockaddr_in6 *mask)
 {
int masklen, final = 0;
u_char *p, *lim;
@@ -394,8 +386,7 @@ mask2plen(mask)
 }
 
 static void
-add_policy(prefix, prec, label)
-   char *prefix, *prec, *label;
+add_policy(char *prefix, char *prec, char *label)
 {
struct in6_addrpolicy p;
int s;
@@ -416,8 +407,7 @@ add_policy(prefix, prec, label)
 }
 
 static void
-delete_policy(prefix)
-   char *prefix;
+delete_policy(char *prefix)
 {
struct in6_addrpolicy p;
int s;
@@ -436,7 +426,7 @@ delete_policy(prefix)
 }
 
 static void
-flush_policy()
+flush_policy(void)
 {
struct policyqueue *ent;
int s;
@@ -454,7 +444,7 @@ flush_policy()
 }
 
 static void
-usage()
+usage(void)
 {
fprintf(stderr, usage: ip6addrctl [show]\n);
fprintf(stderr,ip6addrctl add 
___
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: r241136 - in stable/8/usr.sbin/pkg_install: add create info lib version

2012-10-02 Thread Baptiste Daroussin
Author: bapt
Date: Tue Oct  2 17:05:20 2012
New Revision: 241136
URL: http://svn.freebsd.org/changeset/base/241136

Log:
  MFC r240682
  
  if a file in plist starts with / then do not prefix it with prefix [1]
  pkg info -g returns 1 if a file mismatch [2]
  flush stdout in pkg info -g [3]
  clean up quiet mode (-q | --quiet) output of pkg_version(1) [4]
  fix missing error call in uname check added to pkg_version(1) [5]
  fix pkg_add(1) fails to install with -C from bad path [6]
  only resolve path from pkg_add(1) -p if the given prefix do not start with a 
'/' [7]
  
  PR:   bin/13128 [1]
bin/139015 [2]
bin/113702 [3]
bin/142570 [4]
bin/146857 [5]
bin/157543 [6]
  Submitted by: cy [1]
Anton Yuzhaninov cit...@citrin.ru [2]
Ighighi ighi...@gmail.com [3]
N.J. Mann n...@njm.me.uk [4]
gcooper [5]
David Naylor naylor.b.da...@gmail.com [6]
netchild [7]

Modified:
  stable/8/usr.sbin/pkg_install/add/main.c
  stable/8/usr.sbin/pkg_install/create/perform.c
  stable/8/usr.sbin/pkg_install/info/info.h
  stable/8/usr.sbin/pkg_install/info/perform.c
  stable/8/usr.sbin/pkg_install/info/show.c
  stable/8/usr.sbin/pkg_install/lib/lib.h
  stable/8/usr.sbin/pkg_install/lib/plist.c
  stable/8/usr.sbin/pkg_install/version/perform.c
Directory Properties:
  stable/8/usr.sbin/pkg_install/   (props changed)
  stable/8/usr.sbin/pkg_install/add/   (props changed)
  stable/8/usr.sbin/pkg_install/info/   (props changed)

Modified: stable/8/usr.sbin/pkg_install/add/main.c
==
--- stable/8/usr.sbin/pkg_install/add/main.cTue Oct  2 17:04:53 2012
(r241135)
+++ stable/8/usr.sbin/pkg_install/add/main.cTue Oct  2 17:05:20 2012
(r241136)
@@ -288,7 +288,9 @@ main(int argc, char **argv)
 }
 /* Perform chroot if requested */
 if (Chroot != NULL) {
-   if (chroot(Chroot))
+   if (chdir(Chroot))
+   errx(1, chdir to %s failed, Chroot);
+   if (chroot(.))
errx(1, chroot to %s failed, Chroot);
 }
 /* Make sure the sub-execs we invoke get found */

Modified: stable/8/usr.sbin/pkg_install/create/perform.c
==
--- stable/8/usr.sbin/pkg_install/create/perform.c  Tue Oct  2 17:04:53 
2012(r241135)
+++ stable/8/usr.sbin/pkg_install/create/perform.c  Tue Oct  2 17:05:20 
2012(r241136)
@@ -215,10 +215,14 @@ pkg_perform(char **pkgs)
 
 /* Prefix should add an @cwd to the packing list */
 if (Prefix) {
-char resolved_prefix[PATH_MAX];
-if (realpath(Prefix, resolved_prefix) == NULL)
-   err(EXIT_FAILURE, couldn't resolve path for prefix: %s, Prefix);
-   add_plist_top(plist, PLIST_CWD, resolved_prefix);
+   if (Prefix[0] != '/') {
+   char resolved_prefix[PATH_MAX];
+   if (realpath(Prefix, resolved_prefix) == NULL)
+   err(EXIT_FAILURE, couldn't resolve path for prefix: %s, 
Prefix);
+   add_plist_top(plist, PLIST_CWD, resolved_prefix);
+   } else {
+   add_plist_top(plist, PLIST_CWD, Prefix);
+   }
 }
 
 /* Add the origin if asked, at the top */

Modified: stable/8/usr.sbin/pkg_install/info/info.h
==
--- stable/8/usr.sbin/pkg_install/info/info.h   Tue Oct  2 17:04:53 2012
(r241135)
+++ stable/8/usr.sbin/pkg_install/info/info.h   Tue Oct  2 17:05:20 2012
(r241136)
@@ -77,7 +77,7 @@ extern void   show_plist(const char *, Pac
 extern voidshow_files(const char *, Package *);
 extern voidshow_index(const char *, const char *);
 extern voidshow_size(const char *, Package *);
-extern voidshow_cksum(const char *, Package *);
+extern int show_cksum(const char *, Package *);
 extern voidshow_origin(const char *, Package *);
 extern voidshow_fmtrev(const char *, Package *);
 

Modified: stable/8/usr.sbin/pkg_install/info/perform.c
==
--- stable/8/usr.sbin/pkg_install/info/perform.cTue Oct  2 17:04:53 
2012(r241135)
+++ stable/8/usr.sbin/pkg_install/info/perform.cTue Oct  2 17:05:20 
2012(r241136)
@@ -221,7 +221,7 @@ pkg_do(char *pkg)
if ((Flags  SHOW_SIZE)  installed)
show_size(Package Size:\n, plist);
if ((Flags  SHOW_CKSUM)  installed)
-   show_cksum(Mismatched Checksums:\n, plist);
+   code += show_cksum(Mismatched Checksums:\n, plist);
if (Flags  SHOW_ORIGIN)
show_origin(Origin:\n, plist);
if (Flags  SHOW_FMTREV)
@@ -234,7 +234,7 @@ pkg_do(char *pkg)
 leave_playpen();
 if (isTMP)
unlink(fname);
-return 

svn commit: r241135 - in stable/9/usr.sbin/pkg_install: add create info lib version

2012-10-02 Thread Baptiste Daroussin
Author: bapt
Date: Tue Oct  2 17:04:53 2012
New Revision: 241135
URL: http://svn.freebsd.org/changeset/base/241135

Log:
  MFC r240682
  
  if a file in plist starts with / then do not prefix it with prefix [1]
  pkg info -g returns 1 if a file mismatch [2]
  flush stdout in pkg info -g [3]
  clean up quiet mode (-q | --quiet) output of pkg_version(1) [4]
  fix missing error call in uname check added to pkg_version(1) [5]
  fix pkg_add(1) fails to install with -C from bad path [6]
  only resolve path from pkg_add(1) -p if the given prefix do not start with a 
'/' [7]
  
  PR:   bin/13128 [1]
bin/139015 [2]
bin/113702 [3]
bin/142570 [4]
bin/146857 [5]
bin/157543 [6]
  Submitted by: cy [1]
Anton Yuzhaninov cit...@citrin.ru [2]
Ighighi ighi...@gmail.com [3]
N.J. Mann n...@njm.me.uk [4]
gcooper [5]
David Naylor naylor.b.da...@gmail.com [6]
netchild [7]

Modified:
  stable/9/usr.sbin/pkg_install/add/main.c
  stable/9/usr.sbin/pkg_install/create/perform.c
  stable/9/usr.sbin/pkg_install/info/info.h
  stable/9/usr.sbin/pkg_install/info/perform.c
  stable/9/usr.sbin/pkg_install/info/show.c
  stable/9/usr.sbin/pkg_install/lib/lib.h
  stable/9/usr.sbin/pkg_install/lib/plist.c
  stable/9/usr.sbin/pkg_install/version/perform.c
Directory Properties:
  stable/9/usr.sbin/pkg_install/   (props changed)
  stable/9/usr.sbin/pkg_install/add/   (props changed)
  stable/9/usr.sbin/pkg_install/info/   (props changed)

Modified: stable/9/usr.sbin/pkg_install/add/main.c
==
--- stable/9/usr.sbin/pkg_install/add/main.cTue Oct  2 14:48:03 2012
(r241134)
+++ stable/9/usr.sbin/pkg_install/add/main.cTue Oct  2 17:04:53 2012
(r241135)
@@ -288,7 +288,9 @@ main(int argc, char **argv)
 }
 /* Perform chroot if requested */
 if (Chroot != NULL) {
-   if (chroot(Chroot))
+   if (chdir(Chroot))
+   errx(1, chdir to %s failed, Chroot);
+   if (chroot(.))
errx(1, chroot to %s failed, Chroot);
 }
 /* Make sure the sub-execs we invoke get found */

Modified: stable/9/usr.sbin/pkg_install/create/perform.c
==
--- stable/9/usr.sbin/pkg_install/create/perform.c  Tue Oct  2 14:48:03 
2012(r241134)
+++ stable/9/usr.sbin/pkg_install/create/perform.c  Tue Oct  2 17:04:53 
2012(r241135)
@@ -215,10 +215,14 @@ pkg_perform(char **pkgs)
 
 /* Prefix should add an @cwd to the packing list */
 if (Prefix) {
-char resolved_prefix[PATH_MAX];
-if (realpath(Prefix, resolved_prefix) == NULL)
-   err(EXIT_FAILURE, couldn't resolve path for prefix: %s, Prefix);
-   add_plist_top(plist, PLIST_CWD, resolved_prefix);
+   if (Prefix[0] != '/') {
+   char resolved_prefix[PATH_MAX];
+   if (realpath(Prefix, resolved_prefix) == NULL)
+   err(EXIT_FAILURE, couldn't resolve path for prefix: %s, 
Prefix);
+   add_plist_top(plist, PLIST_CWD, resolved_prefix);
+   } else {
+   add_plist_top(plist, PLIST_CWD, Prefix);
+   }
 }
 
 /* Add the origin if asked, at the top */

Modified: stable/9/usr.sbin/pkg_install/info/info.h
==
--- stable/9/usr.sbin/pkg_install/info/info.h   Tue Oct  2 14:48:03 2012
(r241134)
+++ stable/9/usr.sbin/pkg_install/info/info.h   Tue Oct  2 17:04:53 2012
(r241135)
@@ -77,7 +77,7 @@ extern void   show_plist(const char *, Pac
 extern voidshow_files(const char *, Package *);
 extern voidshow_index(const char *, const char *);
 extern voidshow_size(const char *, Package *);
-extern voidshow_cksum(const char *, Package *);
+extern int show_cksum(const char *, Package *);
 extern voidshow_origin(const char *, Package *);
 extern voidshow_fmtrev(const char *, Package *);
 

Modified: stable/9/usr.sbin/pkg_install/info/perform.c
==
--- stable/9/usr.sbin/pkg_install/info/perform.cTue Oct  2 14:48:03 
2012(r241134)
+++ stable/9/usr.sbin/pkg_install/info/perform.cTue Oct  2 17:04:53 
2012(r241135)
@@ -221,7 +221,7 @@ pkg_do(char *pkg)
if ((Flags  SHOW_SIZE)  installed)
show_size(Package Size:\n, plist);
if ((Flags  SHOW_CKSUM)  installed)
-   show_cksum(Mismatched Checksums:\n, plist);
+   code += show_cksum(Mismatched Checksums:\n, plist);
if (Flags  SHOW_ORIGIN)
show_origin(Origin:\n, plist);
if (Flags  SHOW_FMTREV)
@@ -234,7 +234,7 @@ pkg_do(char *pkg)
 leave_playpen();
 if (isTMP)
unlink(fname);
-return 

svn commit: r241137 - head/lib/libc/stdlib

2012-10-02 Thread Andrey A. Chernov
Author: ache
Date: Tue Oct  2 17:44:08 2012
New Revision: 241137
URL: http://svn.freebsd.org/changeset/base/241137

Log:
  Using putenv() and later direct pointer contents modification it is possibe
  to craft environment variables with similar names like that:
  a=1
  a=2
  ...
  unsetenv(a) should remove them all to make later getenv(a) impossible.
  Fix it to do so (this is GNU autoconf test #3 failure too).
  
  PR: 172273
  MFC after:  1 week

Modified:
  head/lib/libc/stdlib/getenv.c

Modified: head/lib/libc/stdlib/getenv.c
==
--- head/lib/libc/stdlib/getenv.c   Tue Oct  2 17:05:20 2012
(r241136)
+++ head/lib/libc/stdlib/getenv.c   Tue Oct  2 17:44:08 2012
(r241137)
@@ -675,11 +675,13 @@ unsetenv(const char *name)
 
/* Deactivate specified variable. */
envNdx = envVarsTotal - 1;
-   if (__findenv(name, nameLen, envNdx, true) != NULL) {
+   /* Remove all occurrences. */
+   while (__findenv(name, nameLen, envNdx, true) != NULL) {
envVars[envNdx].active = false;
if (envVars[envNdx].putenv)
__remove_putenv(envNdx);
__rebuild_environ(envActive - 1);
+   envNdx = envVarsTotal - 1;
}
 
return (0);
___
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: r241138 - head/sys/net80211

2012-10-02 Thread Adrian Chadd
Author: adrian
Date: Tue Oct  2 17:45:19 2012
New Revision: 241138
URL: http://svn.freebsd.org/changeset/base/241138

Log:
  Migrate the power-save functions to be overridable VAP methods.
  
  This turns ieee80211_node_pwrsave(), ieee80211_sta_pwrsave() and
  ieee80211_recv_pspoll() into methods.
  
  The intent is to let drivers override these and tie into the power save
  management pathway.
  
  For ath(4), this is the beginning of forcing a node software queue to
  stop and start as needed, as well as supporting leaking single frames
  from the software queue to the hardware.
  
  Right now, ieee80211_recv_pspoll() will attempt to transmit a single frame
  to the hardware (whether it be a data frame on the power-save queue or
  a NULL data frame) but the driver may have hardware/software queued frames
  queued up.  This initial work is an attempt at providing the hooks required
  to implement correct behaviour.
  
  Allowing ieee80211_node_pwrsave() to be overridden allows the ath(4)
  driver to pause and unpause the entire software queue for a given node.
  It doesn't make sense to transmit anything whilst the node is asleep.
  
  Please note that there are other corner cases to correctly handle -
  specifically, setting the MORE data bit correctly on frames to a station,
  as well as keeping the TIM updated.  Those particular issues can be
  addressed later.

Modified:
  head/sys/net80211/ieee80211_adhoc.c
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_hostap.h
  head/sys/net80211/ieee80211_power.c
  head/sys/net80211/ieee80211_power.h
  head/sys/net80211/ieee80211_scan.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Tue Oct  2 17:44:08 2012
(r241137)
+++ head/sys/net80211/ieee80211_adhoc.c Tue Oct  2 17:45:19 2012
(r241138)
@@ -242,7 +242,7 @@ adhoc_newstate(struct ieee80211vap *vap,
ic-ic_newassoc(ni, ostate != IEEE80211_S_RUN);
break;
case IEEE80211_S_SLEEP:
-   ieee80211_sta_pwrsave(vap, 0);
+   vap-iv_sta_ps(vap, 0);
break;
default:
invalid:

Modified: head/sys/net80211/ieee80211_hostap.c
==
--- head/sys/net80211/ieee80211_hostap.cTue Oct  2 17:44:08 2012
(r241137)
+++ head/sys/net80211/ieee80211_hostap.cTue Oct  2 17:45:19 2012
(r241138)
@@ -73,7 +73,6 @@ static void hostap_deliver_data(struct i
 static void hostap_recv_mgmt(struct ieee80211_node *, struct mbuf *,
int subtype, int rssi, int nf);
 static void hostap_recv_ctl(struct ieee80211_node *, struct mbuf *, int);
-static void hostap_recv_pspoll(struct ieee80211_node *, struct mbuf *);
 
 void
 ieee80211_hostap_attach(struct ieee80211com *ic)
@@ -100,6 +99,7 @@ hostap_vattach(struct ieee80211vap *vap)
vap-iv_recv_ctl = hostap_recv_ctl;
vap-iv_opdetach = hostap_vdetach;
vap-iv_deliver_data = hostap_deliver_data;
+   vap-iv_recv_pspoll = ieee80211_recv_pspoll;
 }
 
 static void
@@ -645,7 +645,7 @@ hostap_input(struct ieee80211_node *ni, 
 */
if (((wh-i_fc[1]  IEEE80211_FC1_PWR_MGT) ^
(ni-ni_flags  IEEE80211_NODE_PWR_MGT)))
-   ieee80211_node_pwrsave(ni,
+   vap-iv_node_ps(ni,
wh-i_fc[1]  IEEE80211_FC1_PWR_MGT);
/*
 * For 4-address packets handle WDS discovery
@@ -2240,7 +2240,7 @@ hostap_recv_ctl(struct ieee80211_node *n
 {
switch (subtype) {
case IEEE80211_FC0_SUBTYPE_PS_POLL:
-   hostap_recv_pspoll(ni, m);
+   ni-ni_vap-iv_recv_pspoll(ni, m);
break;
case IEEE80211_FC0_SUBTYPE_BAR:
ieee80211_recv_bar(ni, m);
@@ -2251,8 +2251,8 @@ hostap_recv_ctl(struct ieee80211_node *n
 /*
  * Process a received ps-poll frame.
  */
-static void
-hostap_recv_pspoll(struct ieee80211_node *ni, struct mbuf *m0)
+void
+ieee80211_recv_pspoll(struct ieee80211_node *ni, struct mbuf *m0)
 {
struct ieee80211vap *vap = ni-ni_vap;
struct ieee80211_frame_min *wh;

Modified: head/sys/net80211/ieee80211_hostap.h
==
--- head/sys/net80211/ieee80211_hostap.hTue Oct  2 17:44:08 2012
(r241137)
+++ head/sys/net80211/ieee80211_hostap.hTue Oct  2 17:45:19 2012
(r241138)
@@ -32,4 +32,10 @@
  */
 void   ieee80211_hostap_attach(struct ieee80211com *);
 void   ieee80211_hostap_detach(struct ieee80211com *);
+
+/*
+ * This method can be overridden
+ */
+void ieee80211_recv_pspoll(struct ieee80211_node *, struct mbuf *);
+
 #endif /* 

svn commit: r241139 - head

2012-10-02 Thread Adrian Chadd
Author: adrian
Date: Tue Oct  2 17:46:32 2012
New Revision: 241139
URL: http://svn.freebsd.org/changeset/base/241139

Log:
  Update UPDATING with the ABI change for net80211.

Modified:
  head/UPDATING

Modified: head/UPDATING
==
--- head/UPDATING   Tue Oct  2 17:45:19 2012(r241138)
+++ head/UPDATING   Tue Oct  2 17:46:32 2012(r241139)
@@ -24,6 +24,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
disable the most expensive debugging functionality run
ln -s 'abort:false,junk:false' /etc/malloc.conf.)
 
+20121001:
+   The net80211(4) ABI has been changed to allow for improved driver
+   PS-POLL and power-save support.  All wireless drivers need to be
+   recompiled to work with the new kernel.
+
 20120913:
The random(4) support for the VIA hardware random number
generator (`PADLOCK') is no longer enabled unconditionally.
___
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: r241140 - head/sys/kern

2012-10-02 Thread Garrett Wollman
Author: wollman
Date: Tue Oct  2 18:38:05 2012
New Revision: 241140
URL: http://svn.freebsd.org/changeset/base/241140

Log:
  Fix spelling of the function name in two assertion messages.

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Tue Oct  2 17:46:32 2012(r241139)
+++ head/sys/kern/uipc_socket.c Tue Oct  2 18:38:05 2012(r241140)
@@ -995,9 +995,9 @@ sosend_dgram(struct socket *so, struct s
int atomic = sosendallatonce(so) || top;
 #endif
 
-   KASSERT(so-so_type == SOCK_DGRAM, (sodgram_send: !SOCK_DGRAM));
+   KASSERT(so-so_type == SOCK_DGRAM, (sosend_dgram: !SOCK_DGRAM));
KASSERT(so-so_proto-pr_flags  PR_ATOMIC,
-   (sodgram_send: !PR_ATOMIC));
+   (sosend_dgram: !PR_ATOMIC));
 
if (uio != NULL)
resid = uio-uio_resid;
___
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: r241141 - in head: include/rpc lib/libc/rpc sys/rpc

2012-10-02 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Oct  2 19:00:56 2012
New Revision: 241141
URL: http://svn.freebsd.org/changeset/base/241141

Log:
  RPC: Convert all uid and gid variables of the type uid_t and gid_t.
  
  This matches what upstream (OpenSolaris) does.
  
  Tested by:David Wolfskill
  Obtained from:Bull GNU/Linux NFSv4 project (libtirpc)
  MFC after:3 days

Modified:
  head/include/rpc/auth.h
  head/include/rpc/auth_unix.h
  head/lib/libc/rpc/auth_unix.c
  head/lib/libc/rpc/authunix_prot.c
  head/lib/libc/rpc/rpc_soc.3
  head/lib/libc/rpc/svc_auth_unix.c
  head/sys/rpc/auth.h

Modified: head/include/rpc/auth.h
==
--- head/include/rpc/auth.h Tue Oct  2 18:38:05 2012(r241140)
+++ head/include/rpc/auth.h Tue Oct  2 19:00:56 2012(r241141)
@@ -243,14 +243,13 @@ __END_DECLS
  * System style authentication
  * AUTH *authunix_create(machname, uid, gid, len, aup_gids)
  * char *machname;
- * int uid;
- * int gid;
+ * uid_t uid;
+ * gid_t gid;
  * int len;
- * int *aup_gids;
+ * gid_t *aup_gids;
  */
 __BEGIN_DECLS
-extern AUTH *authunix_create(char *, int, int, int,
-int *);
+extern AUTH *authunix_create(char *, uid_t, gid_t, int, gid_t *);
 extern AUTH *authunix_create_default(void);/* takes no parameters */
 extern AUTH *authnone_create(void);/* takes no parameters */
 __END_DECLS

Modified: head/include/rpc/auth_unix.h
==
--- head/include/rpc/auth_unix.hTue Oct  2 18:38:05 2012
(r241140)
+++ head/include/rpc/auth_unix.hTue Oct  2 19:00:56 2012
(r241141)
@@ -60,10 +60,10 @@
 struct authunix_parms {
u_long   aup_time;
char*aup_machname;
-   int  aup_uid;
-   int  aup_gid;
+   uid_taup_uid;
+   gid_taup_gid;
u_intaup_len;
-   int *aup_gids;
+   gid_t   *aup_gids;
 };
 
 #define authsys_parms authunix_parms

Modified: head/lib/libc/rpc/auth_unix.c
==
--- head/lib/libc/rpc/auth_unix.c   Tue Oct  2 18:38:05 2012
(r241140)
+++ head/lib/libc/rpc/auth_unix.c   Tue Oct  2 19:00:56 2012
(r241141)
@@ -94,10 +94,10 @@ struct audata {
 AUTH *
 authunix_create(machname, uid, gid, len, aup_gids)
char *machname;
-   int uid;
-   int gid;
+   uid_t uid;
+   gid_t gid;
int len;
-   int *aup_gids;
+   gid_t *aup_gids;
 {
struct authunix_parms aup;
char mymem[MAX_AUTH_BYTES];
@@ -207,9 +207,7 @@ authunix_create_default()
abort();
if (ngids  NGRPS)
ngids = NGRPS;
-   /* XXX: interface problem; those should all have been unsigned */
-   auth = authunix_create(machname, (int)uid, (int)gid, ngids,
-   (int *)gids);
+   auth = authunix_create(machname, uid, gid, ngids, gids);
free(gids);
return (auth);
 }

Modified: head/lib/libc/rpc/authunix_prot.c
==
--- head/lib/libc/rpc/authunix_prot.c   Tue Oct  2 18:38:05 2012
(r241140)
+++ head/lib/libc/rpc/authunix_prot.c   Tue Oct  2 19:00:56 2012
(r241141)
@@ -60,7 +60,7 @@ xdr_authunix_parms(xdrs, p)
XDR *xdrs;
struct authunix_parms *p;
 {
-   int **paup_gids;
+   gid_t **paup_gids;
 
assert(xdrs != NULL);
assert(p != NULL);
@@ -69,8 +69,8 @@ xdr_authunix_parms(xdrs, p)
 
if (xdr_u_long(xdrs, (p-aup_time))
 xdr_string(xdrs, (p-aup_machname), MAX_MACHINE_NAME)
-xdr_int(xdrs, (p-aup_uid))
-xdr_int(xdrs, (p-aup_gid))
+xdr_u_int(xdrs, (p-aup_uid))
+xdr_u_int(xdrs, (p-aup_gid))
 xdr_array(xdrs, (char **) paup_gids,
(p-aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int) ) {
return (TRUE);

Modified: head/lib/libc/rpc/rpc_soc.3
==
--- head/lib/libc/rpc/rpc_soc.3 Tue Oct  2 18:38:05 2012(r241140)
+++ head/lib/libc/rpc/rpc_soc.3 Tue Oct  2 19:00:56 2012(r241141)
@@ -148,7 +148,7 @@ default authentication used by
 .Ft AUTH *
 .Xc
 .It Xo
-.Fn authunix_create char *host int uid int gid int len int *aup_gids
+.Fn authunix_create char *host uid_t uid gid_t gid int len gid_t 
*aup_gids
 .Xc
 .Pp
 Create and return an

Modified: head/lib/libc/rpc/svc_auth_unix.c
==
--- head/lib/libc/rpc/svc_auth_unix.c   Tue Oct  2 18:38:05 2012
(r241140)
+++ head/lib/libc/rpc/svc_auth_unix.c   Tue Oct  2 19:00:56 2012
(r241141)
@@ -68,7 +68,7 @@ _svcauth_unix(rqst, msg)
struct area {
struct authunix_parms area_aup;
 

svn commit: r241142 - head/lib/libc/rpc

2012-10-02 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Oct  2 19:03:21 2012
New Revision: 241142
URL: http://svn.freebsd.org/changeset/base/241142

Log:
  Fix __rpc_getconfip
  
  __rpc_getconfip is supposed to return the first netconf
  entry supporting tcp or udp, respectively. The code will
  currently return the *last* entry, plus it will leak
  memory when there is more than one such entry.
  
  This change matches the reference (OpenSolaris)
  implementation.
  
  Tested by:David Wolfskill
  Obtained from:Bull GNU/linux NFSv4 Project (libtirpc)
  MFC after:1 week

Modified:
  head/lib/libc/rpc/rpc_generic.c

Modified: head/lib/libc/rpc/rpc_generic.c
==
--- head/lib/libc/rpc/rpc_generic.c Tue Oct  2 19:00:56 2012
(r241141)
+++ head/lib/libc/rpc/rpc_generic.c Tue Oct  2 19:03:21 2012
(r241142)
@@ -269,7 +269,8 @@ __rpc_getconfip(nettype)
}
while ((nconf = getnetconfig(confighandle)) != NULL) {
if (strcmp(nconf-nc_protofmly, NC_INET) == 0) {
-   if (strcmp(nconf-nc_proto, NC_TCP) == 0) {
+   if (strcmp(nconf-nc_proto, NC_TCP) == 0 
+   netid_tcp == NULL) {
netid_tcp = strdup(nconf-nc_netid);
if (main_thread)
netid_tcp_main = netid_tcp;
@@ -277,7 +278,8 @@ __rpc_getconfip(nettype)
thr_setspecific(tcp_key,
(void *) netid_tcp);
} else
-   if (strcmp(nconf-nc_proto, NC_UDP) == 0) {
+   if (strcmp(nconf-nc_proto, NC_UDP) == 0 
+   netid_udp == NULL) {
netid_udp = strdup(nconf-nc_netid);
if (main_thread)
netid_udp_main = netid_udp;
___
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: r241143 - in head: lib/libc/rpc sys/rpc

2012-10-02 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Oct  2 19:10:19 2012
New Revision: 241143
URL: http://svn.freebsd.org/changeset/base/241143

Log:
  libtirpc: be sure to free cl_netid and cl_tp
  
  When creating a client with clnt_tli_create, it uses strdup to copy
  strings for these fields if nconf is passed in. clnt_dg_destroy frees
  these strings already. Make sure clnt_vc_destroy frees them in the same
  way.
  
  This change matches the reference (OpenSolaris) implementation.
  
  Tested by:David Wolfskill
  Obtained from:Bull GNU/Linux NFSv4 Project (libtirpc)
  MFC after:2 weeks

Modified:
  head/lib/libc/rpc/clnt_vc.c
  head/sys/rpc/clnt_vc.c

Modified: head/lib/libc/rpc/clnt_vc.c
==
--- head/lib/libc/rpc/clnt_vc.c Tue Oct  2 19:03:21 2012(r241142)
+++ head/lib/libc/rpc/clnt_vc.c Tue Oct  2 19:10:19 2012(r241143)
@@ -672,6 +672,10 @@ clnt_vc_destroy(cl)
if (ct-ct_addr.buf)
free(ct-ct_addr.buf);
mem_free(ct, sizeof(struct ct_data));
+   if (cl-cl_netid  cl-cl_netid[0])
+   mem_free(cl-cl_netid, strlen(cl-cl_netid) +1);
+   if (cl-cl_tp  cl-cl_tp[0])
+   mem_free(cl-cl_tp, strlen(cl-cl_tp) +1);
mem_free(cl, sizeof(CLIENT));
mutex_unlock(clnt_fd_lock);
thr_sigsetmask(SIG_SETMASK, (mask), NULL);

Modified: head/sys/rpc/clnt_vc.c
==
--- head/sys/rpc/clnt_vc.c  Tue Oct  2 19:03:21 2012(r241142)
+++ head/sys/rpc/clnt_vc.c  Tue Oct  2 19:10:19 2012(r241143)
@@ -836,6 +836,10 @@ clnt_vc_destroy(CLIENT *cl)
soclose(so);
}
mem_free(ct, sizeof(struct ct_data));
+   if (cl-cl_netid  cl-cl_netid[0])
+   mem_free(cl-cl_netid, strlen(cl-cl_netid) +1);
+   if (cl-cl_tp  cl-cl_tp[0])
+   mem_free(cl-cl_tp, strlen(cl-cl_tp) +1);
mem_free(cl, sizeof(CLIENT));
 }
 
___
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: r241140 - head/sys/kern

2012-10-02 Thread Gleb Smirnoff
On Tue, Oct 02, 2012 at 06:38:05PM +, Garrett Wollman wrote:
G Author: wollman
G Date: Tue Oct  2 18:38:05 2012
G New Revision: 241140
G URL: http://svn.freebsd.org/changeset/base/241140
G 
G Log:
G   Fix spelling of the function name in two assertion messages.
G 
G Modified:
G   head/sys/kern/uipc_socket.c
G 
G Modified: head/sys/kern/uipc_socket.c
G 
==
G --- head/sys/kern/uipc_socket.c  Tue Oct  2 17:46:32 2012
(r241139)
G +++ head/sys/kern/uipc_socket.c  Tue Oct  2 18:38:05 2012
(r241140)
G @@ -995,9 +995,9 @@ sosend_dgram(struct socket *so, struct s
G  int atomic = sosendallatonce(so) || top;
G  #endif
G  
G -KASSERT(so-so_type == SOCK_DGRAM, (sodgram_send: !SOCK_DGRAM));
G +KASSERT(so-so_type == SOCK_DGRAM, (sosend_dgram: !SOCK_DGRAM));
G  KASSERT(so-so_proto-pr_flags  PR_ATOMIC,
G -(sodgram_send: !PR_ATOMIC));
G +(sosend_dgram: !PR_ATOMIC));
G  
G  if (uio != NULL)
G  resid = uio-uio_resid;

Why not to use just __func__ here?

-- 
Totus tuus, Glebius.
___
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: r241140 - head/sys/kern

2012-10-02 Thread Garrett Cooper
On Tue, Oct 2, 2012 at 12:38 PM, Gleb Smirnoff gleb...@freebsd.org wrote:
 On Tue, Oct 02, 2012 at 06:38:05PM +, Garrett Wollman wrote:
 G Author: wollman
 G Date: Tue Oct  2 18:38:05 2012
 G New Revision: 241140
 G URL: http://svn.freebsd.org/changeset/base/241140
 G
 G Log:
 G   Fix spelling of the function name in two assertion messages.
 G
 G Modified:
 G   head/sys/kern/uipc_socket.c
 G
 G Modified: head/sys/kern/uipc_socket.c
 G 
 ==
 G --- head/sys/kern/uipc_socket.c  Tue Oct  2 17:46:32 2012
 (r241139)
 G +++ head/sys/kern/uipc_socket.c  Tue Oct  2 18:38:05 2012
 (r241140)
 G @@ -995,9 +995,9 @@ sosend_dgram(struct socket *so, struct s
 G  int atomic = sosendallatonce(so) || top;
 G  #endif
 G
 G -KASSERT(so-so_type == SOCK_DGRAM, (sodgram_send: !SOCK_DGRAM));
 G +KASSERT(so-so_type == SOCK_DGRAM, (sosend_dgram: !SOCK_DGRAM));
 G  KASSERT(so-so_proto-pr_flags  PR_ATOMIC,
 G -(sodgram_send: !PR_ATOMIC));
 G +(sosend_dgram: !PR_ATOMIC));
 G
 G  if (uio != NULL)
 G  resid = uio-uio_resid;

 Why not to use just __func__ here?

Just reiterating the argument that was posed before: it's harder
to grep that way (even though, technically one could do better with
__func__ and __LINE__, etc if they were truly looking for
readability).
Thanks,
-Garrett
___
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: r241144 - in head: share/man/man4 sys/dev/ata

2012-10-02 Thread Alexander Motin
Author: mav
Date: Tue Oct  2 22:03:21 2012
New Revision: 241144
URL: http://svn.freebsd.org/changeset/base/241144

Log:
  Implement SATA revision (speed) control for legacy SATA controller for
  both boot (via loader tunables) and run-time (via `camcontrol negotiate`).
  Tested to work at least on NVIDIA MCP55 chipset.
  
  H/w provided by:  glebius

Modified:
  head/share/man/man4/ata.4
  head/sys/dev/ata/ata-all.c
  head/sys/dev/ata/ata-all.h
  head/sys/dev/ata/ata-sata.c

Modified: head/share/man/man4/ata.4
==
--- head/share/man/man4/ata.4   Tue Oct  2 19:10:19 2012(r241143)
+++ head/share/man/man4/ata.4   Tue Oct  2 22:03:21 2012(r241144)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd June 18, 2012
+.Dd October 3, 2012
 .Dt ATA 4
 .Os
 .Sh NAME
@@ -99,7 +99,7 @@ set to 0 to disable the 80pin cable chec
 set to 1 to allow Message Signalled Interrupts (MSI) to be used by the
 specified PCI ATA controller, if supported.
 .It Va hint.ata.X.devX.mode
-limits the initial ATA mode for the specified device on specified the channel.
+limits the initial ATA mode for the specified device on the specified channel.
 .It Va hint.ata.X.mode
 limits the initial ATA mode for every device on the specified channel.
 .It Va hint.ata.X.pm_level
@@ -120,6 +120,12 @@ host initiates SLUMBER PM state transiti
 .El
 .Pp
 Modes 2 and 3 are only supported for AHCI.
+.It Va hint.ata. Ns Ar X Ns Va .dev Ns Ar X Ns Va .sata_rev
+limits the initial SATA revision (speed) for the specified device
+on the specified channel.
+Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps.
+.It Va hint.ata. Ns Ar X Ns Va .sata_rev
+Same, but for every device on the specified channel.
 .El
 .Sh DESCRIPTION
 The

Modified: head/sys/dev/ata/ata-all.c
==
--- head/sys/dev/ata/ata-all.c  Tue Oct  2 19:10:19 2012(r241143)
+++ head/sys/dev/ata/ata-all.c  Tue Oct  2 22:03:21 2012(r241144)
@@ -172,6 +172,15 @@ ata_attach(device_t dev)
 TASK_INIT(ch-conntask, 0, ata_conn_event, dev);
 #ifdef ATA_CAM
for (i = 0; i  16; i++) {
+   ch-user[i].revision = 0;
+   snprintf(buf, sizeof(buf), dev%d.sata_rev, i);
+   if (resource_int_value(device_get_name(dev),
+   device_get_unit(dev), buf, mode) != 0 
+   resource_int_value(device_get_name(dev),
+   device_get_unit(dev), sata_rev, mode) != 0)
+   mode = -1;
+   if (mode = 0)
+   ch-user[i].revision = mode;
ch-user[i].mode = 0;
snprintf(buf, sizeof(buf), dev%d.mode, i);
if (resource_string_value(device_get_name(dev),

Modified: head/sys/dev/ata/ata-all.h
==
--- head/sys/dev/ata/ata-all.h  Tue Oct  2 19:10:19 2012(r241143)
+++ head/sys/dev/ata/ata-all.h  Tue Oct  2 22:03:21 2012(r241144)
@@ -142,6 +142,7 @@
 #define ATA_SC_SPD_NO_SPEED 0x
 #define ATA_SC_SPD_SPEED_GEN1   0x0010
 #define ATA_SC_SPD_SPEED_GEN2   0x0020
+#define ATA_SC_SPD_SPEED_GEN3   0x0040
 
 #define ATA_SC_IPM_MASK 0x0f00
 #define ATA_SC_IPM_NONE 0x

Modified: head/sys/dev/ata/ata-sata.c
==
--- head/sys/dev/ata/ata-sata.c Tue Oct  2 19:10:19 2012(r241143)
+++ head/sys/dev/ata/ata-sata.c Tue Oct  2 22:03:21 2012(r241144)
@@ -152,8 +152,12 @@ int
 ata_sata_phy_reset(device_t dev, int port, int quick)
 {
 struct ata_channel *ch = device_get_softc(dev);
-int loop, retry;
-uint32_t val;
+int loop, retry, sata_rev;
+uint32_t val, val1;
+
+sata_rev = ch-user[port  0 ? 0 : port].revision;
+if (sata_rev  0)
+   quick = 0;
 
 if (quick) {
if (ata_sata_scr_read(ch, port, ATA_SCONTROL, val))
@@ -173,9 +177,18 @@ ata_sata_phy_reset(device_t dev, int por
device_printf(dev, p%d: hard reset ...\n, port);
}
 }
+if (sata_rev == 1)
+   val1 = ATA_SC_SPD_SPEED_GEN1;
+else if (sata_rev == 2)
+   val1 = ATA_SC_SPD_SPEED_GEN2;
+else if (sata_rev == 3)
+   val1 = ATA_SC_SPD_SPEED_GEN3;
+else
+   val1 = 0;
 for (retry = 0; retry  10; retry++) {
for (loop = 0; loop  10; loop++) {
-   if (ata_sata_scr_write(ch, port, ATA_SCONTROL, ATA_SC_DET_RESET))
+   if (ata_sata_scr_write(ch, port, ATA_SCONTROL, ATA_SC_DET_RESET |
+   val1 | ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER))
goto fail;
ata_udelay(100);
if (ata_sata_scr_read(ch, port, ATA_SCONTROL, val))
@@ -186,7 +199,7 @@ ata_sata_phy_reset(device_t dev, int por
ata_udelay(5000);
   

Re: svn commit: r241141 - in head: include/rpc lib/libc/rpc sys/rpc

2012-10-02 Thread Bruce Evans

On Tue, 2 Oct 2012, Pedro F. Giffuni wrote:


Log:
 RPC: Convert all uid and gid variables of the type uid_t and gid_t.

 This matches what upstream (OpenSolaris) does.

 Tested by: David Wolfskill
 Obtained from: Bull GNU/Linux NFSv4 project (libtirpc)
 MFC after: 3 days


This still assumes that uid_t and gid_t are precisely u_int, in stronger
ways than before.


Modified: head/lib/libc/rpc/authunix_prot.c
==
--- head/lib/libc/rpc/authunix_prot.c   Tue Oct  2 18:38:05 2012
(r241140)
+++ head/lib/libc/rpc/authunix_prot.c   Tue Oct  2 19:00:56 2012
(r241141)
@@ -60,7 +60,7 @@ xdr_authunix_parms(xdrs, p)
XDR *xdrs;
struct authunix_parms *p;
{
-   int **paup_gids;
+   gid_t **paup_gids;

assert(xdrs != NULL);
assert(p != NULL);
@@ -69,8 +69,8 @@ xdr_authunix_parms(xdrs, p)

if (xdr_u_long(xdrs, (p-aup_time))
 xdr_string(xdrs, (p-aup_machname), MAX_MACHINE_NAME)
-xdr_int(xdrs, (p-aup_uid))
-xdr_int(xdrs, (p-aup_gid))
+xdr_u_int(xdrs, (p-aup_uid))
+xdr_u_int(xdrs, (p-aup_gid))
 xdr_array(xdrs, (char **) paup_gids,
(p-aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int) ) {
return (TRUE);



xdr doesn't support arbitrary types.  Here the very name of xdr_u_int()
indicates that it only works on u_int's.  Its second arg must be a
pointer to u_int (misspelled unsigned in the man page, so it doesn't
match the function name in a different, harmless way).  The arg used
to be a pointer to an int, and the call to xdr_int() used to match that.
The arg is now a pointer to a uid_t or gid_t, and the call to xdr_u_int()
only matches that accidentally.  (The types happen to be uint32_t, which
happens to be u_int.)

More careful code would select an xdr translation function based on
sizeof(uid_t) etc.

The above xdr_array() call takes a element size arg that is necessary
for stepping through the array, but isn't careful to use sizeof() on
the correct type.  It uses sizeof() on a hard-coded type, and you just
changed the element type without changing the hard-coded type.  It used
to match (int == int), but now doesn't (int != gid_t).  sizeof() should
be applied to objects and not types to get the object size right without
hard-coding its type.

The first type of type error should be detected at compile time.  The
second one (the hard-coded sizeof(int)) probably cannot be.  And there
is yet another new type error in the xdr_array() call.  It takes a
pointer to a translation function.  The function used to match the elemennt
type, but now doesn't (int != gid_t, and also int != underlying type
of gid_t == u_int).  The API requires casting the pointer to a generic
one using an obfuscated typedef, so the compiler cannot detect this
type mismatch at compile time (without breaking the API generally).

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


svn commit: r241145 - head/sys/dev/mps

2012-10-02 Thread Kenneth D. Merry
Author: ken
Date: Tue Oct  2 23:04:12 2012
New Revision: 241145
URL: http://svn.freebsd.org/changeset/base/241145

Log:
  Add casts to unbreak the i386 PAE build for the mps(4) driver.
  
  MFC after:3 days
  Prompted by:  Garrett Cooper

Modified:
  head/sys/dev/mps/mps_sas.c

Modified: head/sys/dev/mps/mps_sas.c
==
--- head/sys/dev/mps/mps_sas.c  Tue Oct  2 22:03:21 2012(r241144)
+++ head/sys/dev/mps/mps_sas.c  Tue Oct  2 23:04:12 2012(r241145)
@@ -2730,7 +2730,7 @@ mpssas_send_smpcmd(struct mpssas_softc *
bus_dma_segment_t *req_sg;
 
req_sg = (bus_dma_segment_t *)ccb-smpio.smp_request;
-   request = (uint8_t *)req_sg[0].ds_addr;
+   request = (uint8_t *)(uintptr_t)req_sg[0].ds_addr;
} else
request = ccb-smpio.smp_request;
 
@@ -2738,7 +2738,7 @@ mpssas_send_smpcmd(struct mpssas_softc *
bus_dma_segment_t *rsp_sg;
 
rsp_sg = (bus_dma_segment_t *)ccb-smpio.smp_response;
-   response = (uint8_t *)rsp_sg[0].ds_addr;
+   response = (uint8_t *)(uintptr_t)rsp_sg[0].ds_addr;
} else
response = ccb-smpio.smp_response;
} else {
___
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: r241146 - head/contrib/bmake

2012-10-02 Thread Marcel Moolenaar
Author: marcel
Date: Wed Oct  3 00:41:46 2012
New Revision: 241146
URL: http://svn.freebsd.org/changeset/base/241146

Log:
  Merge bmake-20120831 from vendor/NetBSD/bmake/dist.
  
  Provenance: ftp://ftp.netbsd.org/pub/NetBSD/misc/sjg

Added:
  head/contrib/bmake/
 - copied from r241077, vendor/NetBSD/bmake/dist/
___
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: r241141 - in head: include/rpc lib/libc/rpc sys/rpc

2012-10-02 Thread Pedro Giffuni

Thank you Bruce;


On 10/02/2012 17:19, Bruce Evans wrote:

On Tue, 2 Oct 2012, Pedro F. Giffuni wrote:


Log:
 RPC: Convert all uid and gid variables of the type uid_t and gid_t.

 This matches what upstream (OpenSolaris) does.

 Tested by:David Wolfskill
 Obtained from:Bull GNU/Linux NFSv4 project (libtirpc)
 MFC after:3 days


This still assumes that uid_t and gid_t are precisely u_int, in stronger
ways than before.


Modified: head/lib/libc/rpc/authunix_prot.c
== 

--- head/lib/libc/rpc/authunix_prot.cTue Oct  2 18:38:05 2012
(r241140)
+++ head/lib/libc/rpc/authunix_prot.cTue Oct  2 19:00:56 2012
(r241141)

@@ -60,7 +60,7 @@ xdr_authunix_parms(xdrs, p)
XDR *xdrs;
struct authunix_parms *p;
{
-int **paup_gids;
+gid_t **paup_gids;

assert(xdrs != NULL);
assert(p != NULL);
@@ -69,8 +69,8 @@ xdr_authunix_parms(xdrs, p)

if (xdr_u_long(xdrs, (p-aup_time))
 xdr_string(xdrs, (p-aup_machname), MAX_MACHINE_NAME)
- xdr_int(xdrs, (p-aup_uid))
- xdr_int(xdrs, (p-aup_gid))
+ xdr_u_int(xdrs, (p-aup_uid))
+ xdr_u_int(xdrs, (p-aup_gid))
 xdr_array(xdrs, (char **) paup_gids,
(p-aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int) ) {
return (TRUE);



xdr doesn't support arbitrary types.  Here the very name of xdr_u_int()
indicates that it only works on u_int's.  Its second arg must be a
pointer to u_int (misspelled unsigned in the man page, so it doesn't
match the function name in a different, harmless way).  The arg used
to be a pointer to an int, and the call to xdr_int() used to match that.
The arg is now a pointer to a uid_t or gid_t, and the call to xdr_u_int()
only matches that accidentally.  (The types happen to be uint32_t, which
happens to be u_int.)



OK, to solve this I was thinking of adding a cast to uint32_t, but this is
ugly and doesn't really do nothing. Looking at OpenSolaris they do a
cast but more than a cosmetical fix it is a requirement because they
still use xdr_int there. This sounds like a better approach for us too.



More careful code would select an xdr translation function based on
sizeof(uid_t) etc.

The above xdr_array() call takes a element size arg that is necessary
for stepping through the array, but isn't careful to use sizeof() on
the correct type.  It uses sizeof() on a hard-coded type, and you just
changed the element type without changing the hard-coded type.  It used
to match (int == int), but now doesn't (int != gid_t).  sizeof() should
be applied to objects and not types to get the object size right without
hard-coding its type.



Nice catch, that is certainly wrong, and libtirpc still has it. This isn't
necessary when adopting the solution above though.



The first type of type error should be detected at compile time.  The
second one (the hard-coded sizeof(int)) probably cannot be.  And there
is yet another new type error in the xdr_array() call.  It takes a
pointer to a translation function.  The function used to match the 
elemennt

type, but now doesn't (int != gid_t, and also int != underlying type
of gid_t == u_int).  The API requires casting the pointer to a generic
one using an obfuscated typedef, so the compiler cannot detect this
type mismatch at compile time (without breaking the API generally).



I only changed authunix_create and its parameters, any other underlying
issue is preexistent :).

Pedro.



___
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: r241149 - in head/usr.sbin: . bsdconfig/share sysrc

2012-10-02 Thread Devin Teske
Author: dteske
Date: Wed Oct  3 02:32:47 2012
New Revision: 241149
URL: http://svn.freebsd.org/changeset/base/241149

Log:
  Import sysutils/sysrc from the ports tree (current version 5.1). Importing
  disconnected under the WITH_BSDCONFIG flag (a good idea since this version of
  sysrc(8) indeed requires the `sysrc.subr' module installed by bsdconfig(8)).
  
  Multiple reasons sysrc should not simply continue to live in ports. The most
  important being that it is tightly coupled with the base.
  
  Approved by:  adrian (co-mentor)

Added:
  head/usr.sbin/sysrc/
  head/usr.sbin/sysrc/Makefile   (contents, props changed)
  head/usr.sbin/sysrc/sysrc   (contents, props changed)
  head/usr.sbin/sysrc/sysrc.8   (contents, props changed)
Modified:
  head/usr.sbin/Makefile
  head/usr.sbin/bsdconfig/share/sysrc.subr

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Wed Oct  3 01:18:51 2012(r241148)
+++ head/usr.sbin/Makefile  Wed Oct  3 02:32:47 2012(r241149)
@@ -147,6 +147,7 @@ SUBDIR+=bluetooth
 
 .if ${MK_BSDCONFIG} != no
 SUBDIR+=   bsdconfig
+SUBDIR+=   sysrc
 .endif
 
 .if ${MK_BSNMP} != no

Modified: head/usr.sbin/bsdconfig/share/sysrc.subr
==
--- head/usr.sbin/bsdconfig/share/sysrc.subrWed Oct  3 01:18:51 2012
(r241148)
+++ head/usr.sbin/bsdconfig/share/sysrc.subrWed Oct  3 02:32:47 2012
(r241149)
@@ -29,10 +29,10 @@ if [ ! $_SYSRC_SUBR ]; then _SYSRC_SUB
  INCLUDES
 
 BSDCFG_SHARE=/usr/share/bsdconfig
-. $BSDCFG_SHARE/common.subr || exit 1
+[ $_COMMON_SUBR ] || . $BSDCFG_SHARE/common.subr || exit 1
 
 BSDCFG_LIBE=/usr/libexec/bsdconfig
-f_include_lang $BSDCFG_LIBE/include/messages.subr
+[ ! $_SYSRC_JAILED ]  f_include_lang $BSDCFG_LIBE/include/messages.subr
 
  CONFIGURATION
 

Added: head/usr.sbin/sysrc/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/sysrc/MakefileWed Oct  3 02:32:47 2012
(r241149)
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+NO_OBJ=
+
+SCRIPTS= sysrc
+
+MAN= sysrc.8
+
+beforeinstall:
+   mkdir -p ${DESTDIR}${SCRIPTSDIR}
+   mkdir -p ${DESTDIR}${MANDIR}8
+
+.include bsd.prog.mk

Added: head/usr.sbin/sysrc/sysrc
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/sysrc/sysrc   Wed Oct  3 02:32:47 2012(r241149)
@@ -0,0 +1,618 @@
+#!/bin/sh
+#-
+# Copyright (c) 2010-2012 Devin Teske
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+ INCLUDES
+
+BSDCFG_SHARE=/usr/share/bsdconfig
+[ $_COMMON_SUBR ] || . $BSDCFG_SHARE/common.subr || exit 1
+[ $_SYSRC_SUBR  ] || f_include $BSDCFG_SHARE/sysrc.subr
+
+ CONFIGURATION
+
+#
+# Default verbosity.
+#
+: ${SYSRC_VERBOSE:=}
+
+ GLOBALS
+
+#
+# Options
+#
+DELETE=
+DESCRIBE=
+IGNORE_UNKNOWNS=
+JAIL=
+QUIET=
+ROOTDIR=
+SHOW_ALL=
+SHOW_EQUALS=
+SHOW_FILE=
+SHOW_NAME=1
+SHOW_VALUE=1
+
+ FUNCTIONS
+
+# die [ $fmt [ $opts ... ]]
+#
+# Optionally print a message to stderr before exiting with failure status.
+#
+die()
+{
+   local fmt=$1
+   [ $# -gt 0 ]  shift 1
+ 

Re: svn commit: r232059 - in head: sys/fs/devfs sys/fs/nullfs sys/kern sys/sys usr.sbin/jail

2012-10-02 Thread Lawrence Stewart

Hi Martin,

On 02/24/12 05:51, Martin Matuska wrote:

Author: mm
Date: Thu Feb 23 18:51:24 2012
New Revision: 232059
URL: http://svn.freebsd.org/changeset/base/232059

Log:
   To improve control over the use of mount(8) inside a jail(8), introduce
   a new jail parameter node with the following parameters:

   allow.mount.devfs:
allow mounting the devfs filesystem inside a jail

   allow.mount.nullfs:
allow mounting the nullfs filesystem inside a jail

   Both parameters are disabled by default (equals the behavior before
   devfs and nullfs in jails). Administrators have to explicitly allow
   mounting devfs and nullfs for each jail. The value -1 of the
   devfs_ruleset parameter is removed in favor of the new allow setting.

   Reviewed by: jamie
   Suggested by:pjd
   MFC after:   2 weeks


Is there any reason this and the other related commits (e.g. r232186, 
232247,232278,232291,230129 and maybe others I missed) haven't been 
MFCed to stable/8?


I'm seeing an interesting bug on an 8.3-STABLE (built mid August) 
machine whereby a zfs dataset with jailed=on can be managed and mounted 
inside the jail with enable_statfs=1, but shows up in the primary host's 
mount list instead of the jail's. I then can't zfs unmount the 
filesystem from within the jail or the primary host.


The same set up works fine on 9.1-RC1.

Would you mind MFCing all relevant jail-related ZFS commits to stable/8 
which are currently only in 9 and head?


Cheers,
Lawrence
___
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: r241152 - head/lib/libc/rpc

2012-10-02 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Oct  3 03:44:23 2012
New Revision: 241152
URL: http://svn.freebsd.org/changeset/base/241152

Log:
  rpc: convert all uid and gid variables of the type uid_t and gid_t.
  
  As part of the previous commit, uses of xdr_int() were replaced
  with xdr_u_int(). This has undesired effects as the second
  argument doesn't match exactly uid_t or gid_t. It also breaks
  assumptions in the size of the provided types.
  
  To work around those issues we revert back to the use of xdr_int()
  but provide proper casting so the behaviour doesn't change.
  
  While here fix a style issue in the affected lines.
  
  Reported by:  bde

Modified:
  head/lib/libc/rpc/authunix_prot.c

Modified: head/lib/libc/rpc/authunix_prot.c
==
--- head/lib/libc/rpc/authunix_prot.c   Wed Oct  3 03:00:37 2012
(r241151)
+++ head/lib/libc/rpc/authunix_prot.c   Wed Oct  3 03:44:23 2012
(r241152)
@@ -67,11 +67,11 @@ xdr_authunix_parms(xdrs, p)
 
paup_gids = p-aup_gids;
 
-   if (xdr_u_long(xdrs, (p-aup_time))
-xdr_string(xdrs, (p-aup_machname), MAX_MACHINE_NAME)
-xdr_u_int(xdrs, (p-aup_uid))
-xdr_u_int(xdrs, (p-aup_gid))
-xdr_array(xdrs, (char **) paup_gids,
+   if (xdr_u_long(xdrs, (p-aup_time)) 
+   xdr_string(xdrs, (p-aup_machname), MAX_MACHINE_NAME) 
+   xdr_int(xdrs, (int *) (p-aup_uid)) 
+   xdr_int(xdrs, (int *) (p-aup_gid)) 
+   xdr_array(xdrs, (char **) paup_gids,
(p-aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int) ) {
return (TRUE);
}
___
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: r241154 - head/lib/libc/stdlib

2012-10-02 Thread Andrey A. Chernov
Author: ache
Date: Wed Oct  3 04:46:58 2012
New Revision: 241154
URL: http://svn.freebsd.org/changeset/base/241154

Log:
  Optimize prev. commit for speed.
  1) Don't iterate the loop from the environment array beginning each time,
  iterate it under the last place we deactivate instead.
  2) Call __rebuild_environ() not on each iteration but once, only at the end
  of whole loop (of course, only in case if something is changed).
  
  MFC after:  1 week

Modified:
  head/lib/libc/stdlib/getenv.c

Modified: head/lib/libc/stdlib/getenv.c
==
--- head/lib/libc/stdlib/getenv.c   Wed Oct  3 04:22:39 2012
(r241153)
+++ head/lib/libc/stdlib/getenv.c   Wed Oct  3 04:46:58 2012
(r241154)
@@ -662,6 +662,7 @@ unsetenv(const char *name)
 {
int envNdx;
size_t nameLen;
+   int newEnvActive;
 
/* Check for malformed name. */
if (name == NULL || (nameLen = __strleneq(name)) == 0) {
@@ -674,15 +675,18 @@ unsetenv(const char *name)
return (-1);
 
/* Deactivate specified variable. */
-   envNdx = envVarsTotal - 1;
/* Remove all occurrences. */
+   envNdx = envVarsTotal - 1;
+   newEnvActive = envActive;
while (__findenv(name, nameLen, envNdx, true) != NULL) {
envVars[envNdx].active = false;
if (envVars[envNdx].putenv)
__remove_putenv(envNdx);
-   __rebuild_environ(envActive - 1);
-   envNdx = envVarsTotal - 1;
+   envNdx--;
+   newEnvActive--;
}
+   if (newEnvActive != envActive)
+   __rebuild_environ(newEnvActive);
 
return (0);
 }
___
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: r241155 - head/sys/vm

2012-10-02 Thread Alan Cox
Author: alc
Date: Wed Oct  3 05:06:45 2012
New Revision: 241155
URL: http://svn.freebsd.org/changeset/base/241155

Log:
  Tidy up a bit:
  
  Update some of the comments.  In particular, use sleep in preference to
  block where appropriate.
  
  Eliminate some unnecessary casts.
  
  Make a few whitespace changes for consistency.
  
  Reviewed by:  kib
  MFC after:3 days

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Wed Oct  3 04:46:58 2012(r241154)
+++ head/sys/vm/vm_page.c   Wed Oct  3 05:06:45 2012(r241155)
@@ -851,11 +851,10 @@ vm_page_splay(vm_pindex_t pindex, vm_pag
  *
  * The pagetables are not updated but will presumably fault the page
  * in if necessary, or if a kernel page the caller will at some point
- * enter the page into the kernel's pmap.  We are not allowed to block
+ * enter the page into the kernel's pmap.  We are not allowed to sleep
  * here so we *can't* do this anyway.
  *
- * The object and page must be locked.
- * This routine may not block.
+ * The object must be locked.
  */
 void
 vm_page_insert(vm_page_t m, vm_object_t object, vm_pindex_t pindex)
@@ -899,14 +898,15 @@ vm_page_insert(vm_page_t m, vm_object_t 
object-root = m;
 
/*
-* show that the object has one more resident page.
+* Show that the object has one more resident page.
 */
object-resident_page_count++;
+
/*
 * Hold the vnode until the last page is released.
 */
if (object-resident_page_count == 1  object-type == OBJT_VNODE)
-   vhold((struct vnode *)object-handle);
+   vhold(object-handle);
 
/*
 * Since we are inserting a new and possibly dirty page,
@@ -918,15 +918,14 @@ vm_page_insert(vm_page_t m, vm_object_t 
 
 /*
  * vm_page_remove:
- * NOTE: used by device pager as well -wfj
  *
  * Removes the given mem entry from the object/offset-page
  * table and the object page list, but do not invalidate/terminate
  * the backing store.
  *
- * The object and page must be locked.
  * The underlying pmap entry (if any) is NOT removed here.
- * This routine may not block.
+ *
+ * The object must be locked.  The page must be locked if it is managed.
  */
 void
 vm_page_remove(vm_page_t m)
@@ -989,11 +988,12 @@ vm_page_remove(vm_page_t m)
 * And show that the object has one fewer resident page.
 */
object-resident_page_count--;
+
/*
 * The vnode may now be recycled.
 */
if (object-resident_page_count == 0  object-type == OBJT_VNODE)
-   vdrop((struct vnode *)object-handle);
+   vdrop(object-handle);
 
m-object = NULL;
 }
@@ -1005,8 +1005,6 @@ vm_page_remove(vm_page_t m)
  * pair specified; if none is found, NULL is returned.
  *
  * The object must be locked.
- * This routine may not block.
- * This is a critical path routine
  */
 vm_page_t
 vm_page_lookup(vm_object_t object, vm_pindex_t pindex)
@@ -1029,7 +1027,6 @@ vm_page_lookup(vm_object_t object, vm_pi
  * greater than or equal to the parameter pindex, or NULL.
  *
  * The object must be locked.
- * The routine may not block.
  */
 vm_page_t
 vm_page_find_least(vm_object_t object, vm_pindex_t pindex)
@@ -1089,9 +1086,6 @@ vm_page_prev(vm_page_t m)
  * Move the given memory entry from its
  * current object to the specified target object/offset.
  *
- * The object must be locked.
- * This routine may not block.
- *
  * Note: swap associated with the page must be invalidated by the move.  We
  *   have to do this for several reasons:  (1) we aren't freeing the
  *   page, (2) we are dirtying the page, (3) the VM system is probably
@@ -1103,6 +1097,8 @@ vm_page_prev(vm_page_t m)
  *   swap.  If the page is on the cache, we have to deactivate it
  *   or vm_page_dirty() will panic.  Dirty pages are not allowed
  *   on the cache.
+ *
+ * The objects must be locked.  The page must be locked if it is managed.
  */
 void
 vm_page_rename(vm_page_t m, vm_object_t new_object, vm_pindex_t new_pindex)
@@ -1828,7 +1824,7 @@ vm_page_alloc_freelist(int flind, int re
 /*
  * vm_wait:(also see VM_WAIT macro)
  *
- * Block until free pages are available for allocation
+ * Sleep until free pages are available for allocation.
  * - Called in various places before memory allocations.
  */
 void
@@ -1853,7 +1849,7 @@ vm_wait(void)
 /*
  * vm_waitpfault:  (also see VM_WAITPFAULT macro)
  *
- * Block until free pages are available for allocation
+ * Sleep until free pages are available for allocation.
  * - Called only in vm_fault so that processes page faulting
  *   can be easily tracked.
  * - 

svn commit: r241156 - head/sys/mips/mips

2012-10-02 Thread Alan Cox
Author: alc
Date: Wed Oct  3 05:42:15 2012
New Revision: 241156
URL: http://svn.freebsd.org/changeset/base/241156

Log:
  Reimplement pmap_qremove() using the new TLB invalidation function for
  efficiently invalidating address ranges.

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

Modified: head/sys/mips/mips/pmap.c
==
--- head/sys/mips/mips/pmap.c   Wed Oct  3 05:06:45 2012(r241155)
+++ head/sys/mips/mips/pmap.c   Wed Oct  3 05:42:15 2012(r241156)
@@ -930,15 +930,19 @@ pmap_qenter(vm_offset_t va, vm_page_t *m
 void
 pmap_qremove(vm_offset_t va, int count)
 {
-   /*
-* No need to wb/inv caches here, 
-*   pmap_kremove will do it for us
-*/
+   pt_entry_t *pte;
+   vm_offset_t origva;
 
-   while (count--  0) {
-   pmap_kremove(va);
+   if (count  1)
+   return;
+   mips_dcache_wbinv_range_index(va, PAGE_SIZE * count);
+   origva = va;
+   do {
+   pte = pmap_pte(kernel_pmap, va);
+   *pte = PTE_G;
va += PAGE_SIZE;
-   }
+   } while (--count  0);
+   pmap_invalidate_range(kernel_pmap, origva, va);
 }
 
 /***
___
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