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

2012-02-01 Thread Andrey V. Elsukov
Author: ae
Date: Wed Feb  1 09:28:16 2012
New Revision: 230861
URL: http://svn.freebsd.org/changeset/base/230861

Log:
  The scheme code may not know about some inconsistency in the metadata.
  So, add an integrity check after recovery attempt.
  
  MFC after:1 week

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

Modified: head/sys/geom/part/g_part.c
==
--- head/sys/geom/part/g_part.c Wed Feb  1 03:49:56 2012(r230860)
+++ head/sys/geom/part/g_part.c Wed Feb  1 09:28:16 2012(r230861)
@@ -1216,6 +1216,9 @@ g_part_ctl_recover(struct gctl_req *req,
 
if (table->gpt_corrupt) {
error = G_PART_RECOVER(table);
+   if (error == 0)
+   error = g_part_check_integrity(table,
+   LIST_FIRST(&gp->consumer));
if (error) {
gctl_error(req, "%d recovering '%s' failed",
error, gp->name);
___
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: r230863 - head/sys/netinet

2012-02-01 Thread Gleb Smirnoff
Author: glebius
Date: Wed Feb  1 11:07:41 2012
New Revision: 230863
URL: http://svn.freebsd.org/changeset/base/230863

Log:
  o Provide functions carp_ifa_addroute()/carp_ifa_delroute()
to cleanup routes from a single ifa.
  o Implement carp_addroute()/carp_delroute() via above functions.
  o Call carp_ifa_delroute() in the carp_detach() to avoid
junk routes left in routing table, in case if user
removes an address in a MASTER state. [1]
  
  Reported by:  az [1]

Modified:
  head/sys/netinet/ip_carp.c

Modified: head/sys/netinet/ip_carp.c
==
--- head/sys/netinet/ip_carp.c  Wed Feb  1 10:59:19 2012(r230862)
+++ head/sys/netinet/ip_carp.c  Wed Feb  1 11:07:41 2012(r230863)
@@ -269,7 +269,9 @@ static void carp_master_down_locked(stru
 static voidcarp_send_ad(void *);
 static voidcarp_send_ad_locked(struct carp_softc *);
 static voidcarp_addroute(struct carp_softc *);
+static voidcarp_ifa_addroute(struct ifaddr *);
 static voidcarp_delroute(struct carp_softc *);
+static voidcarp_ifa_delroute(struct ifaddr *);
 static voidcarp_send_ad_all(void *, int);
 static voidcarp_demote_adj(int, char *);
 
@@ -907,22 +909,29 @@ carp_addroute(struct carp_softc *sc)
struct ifaddr *ifa;
 
CARP_FOREACH_IFA(sc, ifa)
-   switch (ifa->ifa_addr->sa_family) {
+   carp_ifa_addroute(ifa);
+}
+
+static void
+carp_ifa_addroute(struct ifaddr *ifa)
+{
+
+   switch (ifa->ifa_addr->sa_family) {
 #ifdef INET
-   case AF_INET:
-   in_addprefix(ifatoia(ifa), RTF_UP);
-   ifa_add_loopback_route(ifa,
-   (struct sockaddr *)&ifatoia(ifa)->ia_addr);
-   break;
+   case AF_INET:
+   in_addprefix(ifatoia(ifa), RTF_UP);
+   ifa_add_loopback_route(ifa,
+   (struct sockaddr *)&ifatoia(ifa)->ia_addr);
+   break;
 #endif
 #ifdef INET6
-   case AF_INET6:
-   ifa_add_loopback_route(ifa,
-   (struct sockaddr *)&ifatoia6(ifa)->ia_addr);
-   in6_ifaddloop(ifa);
-   break;
+   case AF_INET6:
+   ifa_add_loopback_route(ifa,
+   (struct sockaddr *)&ifatoia6(ifa)->ia_addr);
+   in6_ifaddloop(ifa);
+   break;
 #endif
-   }
+   }
 }
 
 static void
@@ -931,22 +940,29 @@ carp_delroute(struct carp_softc *sc)
struct ifaddr *ifa;
 
CARP_FOREACH_IFA(sc, ifa)
-   switch (ifa->ifa_addr->sa_family) {
+   carp_ifa_delroute(ifa);
+}
+
+static void
+carp_ifa_delroute(struct ifaddr *ifa)
+{
+
+   switch (ifa->ifa_addr->sa_family) {
 #ifdef INET
-   case AF_INET:
-   ifa_del_loopback_route(ifa,
-   (struct sockaddr *)&ifatoia(ifa)->ia_addr);
-   in_scrubprefix(ifatoia(ifa), LLE_STATIC);
-   break;
+   case AF_INET:
+   ifa_del_loopback_route(ifa,
+   (struct sockaddr *)&ifatoia(ifa)->ia_addr);
+   in_scrubprefix(ifatoia(ifa), LLE_STATIC);
+   break;
 #endif
 #ifdef INET6
-   case AF_INET6:
-   ifa_del_loopback_route(ifa,
-   (struct sockaddr *)&ifatoia6(ifa)->ia_addr);
-   in6_ifremloop(ifa);
-   break;
+   case AF_INET6:
+   ifa_del_loopback_route(ifa,
+   (struct sockaddr *)&ifatoia6(ifa)->ia_addr);
+   in6_ifremloop(ifa);
+   break;
 #endif
-   }
+   }
 }
 
 #ifdef INET
@@ -1856,6 +1872,7 @@ carp_detach(struct ifaddr *ifa)
 #endif
}
 
+   carp_ifa_delroute(ifa);
carp_multicast_cleanup(sc, ifa->ifa_addr->sa_family);
 
ifa->ifa_carp = NULL;
___
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: r230864 - in head: lib/libc/amd64/gen lib/libc/arm/gen lib/libc/i386/gen lib/libc/ia64/gen lib/libc/mips/gen lib/libc/powerpc/gen lib/libc/powerpc64/gen lib/libc/sparc64/gen sys/sys

2012-02-01 Thread Konstantin Belousov
Author: kib
Date: Wed Feb  1 13:33:53 2012
New Revision: 230864
URL: http://svn.freebsd.org/changeset/base/230864

Log:
  Make the sys/ucontext.h self-contained by changing the return type
  of __getcontextx_size(3) from size_t to int.
  
  PR:   ports/164654
  MFC after:1 month

Modified:
  head/lib/libc/amd64/gen/getcontextx.c
  head/lib/libc/arm/gen/getcontextx.c
  head/lib/libc/i386/gen/getcontextx.c
  head/lib/libc/ia64/gen/getcontextx.c
  head/lib/libc/mips/gen/getcontextx.c
  head/lib/libc/powerpc/gen/getcontextx.c
  head/lib/libc/powerpc64/gen/getcontextx.c
  head/lib/libc/sparc64/gen/getcontextx.c
  head/sys/sys/ucontext.h

Modified: head/lib/libc/amd64/gen/getcontextx.c
==
--- head/lib/libc/amd64/gen/getcontextx.c   Wed Feb  1 11:07:41 2012
(r230863)
+++ head/lib/libc/amd64/gen/getcontextx.c   Wed Feb  1 13:33:53 2012
(r230864)
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
 
 static int xstate_sz = -1;
 
-size_t
+int
 __getcontextx_size(void)
 {
u_int p[4];

Modified: head/lib/libc/arm/gen/getcontextx.c
==
--- head/lib/libc/arm/gen/getcontextx.c Wed Feb  1 11:07:41 2012
(r230863)
+++ head/lib/libc/arm/gen/getcontextx.c Wed Feb  1 13:33:53 2012
(r230864)
@@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-size_t
+int
 __getcontextx_size(void)
 {
 

Modified: head/lib/libc/i386/gen/getcontextx.c
==
--- head/lib/libc/i386/gen/getcontextx.cWed Feb  1 11:07:41 2012
(r230863)
+++ head/lib/libc/i386/gen/getcontextx.cWed Feb  1 13:33:53 2012
(r230864)
@@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
 
 static int xstate_sz = -1;
 
-size_t
+int
 __getcontextx_size(void)
 {
u_int p[4];

Modified: head/lib/libc/ia64/gen/getcontextx.c
==
--- head/lib/libc/ia64/gen/getcontextx.cWed Feb  1 11:07:41 2012
(r230863)
+++ head/lib/libc/ia64/gen/getcontextx.cWed Feb  1 13:33:53 2012
(r230864)
@@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-size_t
+int
 __getcontextx_size(void)
 {
 

Modified: head/lib/libc/mips/gen/getcontextx.c
==
--- head/lib/libc/mips/gen/getcontextx.cWed Feb  1 11:07:41 2012
(r230863)
+++ head/lib/libc/mips/gen/getcontextx.cWed Feb  1 13:33:53 2012
(r230864)
@@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-size_t
+int
 __getcontextx_size(void)
 {
 

Modified: head/lib/libc/powerpc/gen/getcontextx.c
==
--- head/lib/libc/powerpc/gen/getcontextx.c Wed Feb  1 11:07:41 2012
(r230863)
+++ head/lib/libc/powerpc/gen/getcontextx.c Wed Feb  1 13:33:53 2012
(r230864)
@@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-size_t
+int
 __getcontextx_size(void)
 {
 

Modified: head/lib/libc/powerpc64/gen/getcontextx.c
==
--- head/lib/libc/powerpc64/gen/getcontextx.c   Wed Feb  1 11:07:41 2012
(r230863)
+++ head/lib/libc/powerpc64/gen/getcontextx.c   Wed Feb  1 13:33:53 2012
(r230864)
@@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-size_t
+int
 __getcontextx_size(void)
 {
 

Modified: head/lib/libc/sparc64/gen/getcontextx.c
==
--- head/lib/libc/sparc64/gen/getcontextx.c Wed Feb  1 11:07:41 2012
(r230863)
+++ head/lib/libc/sparc64/gen/getcontextx.c Wed Feb  1 13:33:53 2012
(r230864)
@@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-size_t
+int
 __getcontextx_size(void)
 {
 

Modified: head/sys/sys/ucontext.h
==
--- head/sys/sys/ucontext.h Wed Feb  1 11:07:41 2012(r230863)
+++ head/sys/sys/ucontext.h Wed Feb  1 13:33:53 2012(r230864)
@@ -79,7 +79,7 @@ int   signalcontext(ucontext_t *, int, __s
 intswapcontext(ucontext_t *, const ucontext_t *);
 
 #if __BSD_VISIBLE
-size_t __getcontextx_size(void);
+int __getcontextx_size(void);
 int __fillcontextx(char *ctx);
 #endif
 
___
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: r230865 - head/sys/dev/mvs

2012-02-01 Thread Rafal Jaworowski
Author: raj
Date: Wed Feb  1 13:39:52 2012
New Revision: 230865
URL: http://svn.freebsd.org/changeset/base/230865

Log:
  Adjust mvs(4) to handle interrupt cause reg depending on the actual number of
  channels available
  
  - current code treats bits 4:7 in 'SATAHC interrupt mask' and 'SATAHC
interrupt cause' as flags for SATA channels 2 and 3
  
  - for embedded SATA controllers (SoC) these bits have been marked as reserved
in datasheets so far, but for some new and upcoming chips they are used for
purposes other than SATA
  
  Submitted by: Lukasz Plachno
  Reviewed by:  mav
  Obtained from:Semihalf
  MFC after:2 weeks

Modified:
  head/sys/dev/mvs/mvs.h
  head/sys/dev/mvs/mvs_soc.c

Modified: head/sys/dev/mvs/mvs.h
==
--- head/sys/dev/mvs/mvs.h  Wed Feb  1 13:33:53 2012(r230864)
+++ head/sys/dev/mvs/mvs.h  Wed Feb  1 13:39:52 2012(r230865)
@@ -61,6 +61,9 @@
 
 #define CHIP_SOC_LED   0x2C/* SoC LED Configuration */
 
+/* Additional mask for SoC devices with less than 4 channels */
+#define CHIP_SOC_HC0_MASK(num) (0xff >> ((4 - (num)) * 2))
+
 /* Chip CCC registers */
 #define CHIP_ICC   0x18008
 #define CHIP_ICC_ALL_PORTS  (1 << 4)   /* all ports irq event */

Modified: head/sys/dev/mvs/mvs_soc.c
==
--- head/sys/dev/mvs/mvs_soc.c  Wed Feb  1 13:33:53 2012(r230864)
+++ head/sys/dev/mvs/mvs_soc.c  Wed Feb  1 13:39:52 2012(r230865)
@@ -216,7 +216,9 @@ mvs_ctlr_setup(device_t dev)
if (ccc)
ccim |= IC_HC0_COAL_DONE;
/* Enable chip interrupts */
-   ctlr->gmim = (ccc ? IC_HC0_COAL_DONE : IC_DONE_HC0) | IC_ERR_HC0;
+   ctlr->gmim = ((ccc ? IC_HC0_COAL_DONE :
+   (IC_DONE_HC0 & CHIP_SOC_HC0_MASK(ctlr->channels))) |
+   (IC_ERR_HC0 & CHIP_SOC_HC0_MASK(ctlr->channels)));
ATA_OUTL(ctlr->r_mem, CHIP_SOC_MIM, ctlr->gmim | ctlr->pmim);
return (0);
 }
@@ -291,25 +293,26 @@ mvs_intr(void *data)
struct mvs_controller *ctlr = data;
struct mvs_intr_arg arg;
void (*function)(void *);
-   int p;
+   int p, chan_num;
u_int32_t ic, aic;
 
ic = ATA_INL(ctlr->r_mem, CHIP_SOC_MIC);
if ((ic & IC_HC0) == 0)
return;
+
/* Acknowledge interrupts of this HC. */
aic = 0;
-   if (ic & (IC_DONE_IRQ << 0))
-   aic |= HC_IC_DONE(0) | HC_IC_DEV(0);
-   if (ic & (IC_DONE_IRQ << 2))
-   aic |= HC_IC_DONE(1) | HC_IC_DEV(1);
-   if (ic & (IC_DONE_IRQ << 4))
-   aic |= HC_IC_DONE(2) | HC_IC_DEV(2);
-   if (ic & (IC_DONE_IRQ << 6))
-   aic |= HC_IC_DONE(3) | HC_IC_DEV(3);
+
+   /* Processing interrupts from each initialized channel */
+   for (chan_num = 0; chan_num < ctlr->channels; chan_num++) {
+   if (ic & (IC_DONE_IRQ << (chan_num * 2)))
+   aic |= HC_IC_DONE(chan_num) | HC_IC_DEV(chan_num);
+   }
+
if (ic & IC_HC0_COAL_DONE)
aic |= HC_IC_COAL;
ATA_OUTL(ctlr->r_mem, HC_IC, ~aic);
+
/* Call per-port interrupt handler. */
for (p = 0; p < ctlr->channels; p++) {
arg.cause = ic & (IC_ERR_IRQ|IC_DONE_IRQ);
___
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: r230866 - head/sys/kern

2012-02-01 Thread Konstantin Belousov
Author: kib
Date: Wed Feb  1 14:34:52 2012
New Revision: 230866
URL: http://svn.freebsd.org/changeset/base/230866

Log:
  Add kqueue support to /dev/klog.
  
  Submitted by: Mateusz Guzik 
  PR: kern/156423
  MFC after:1 weeks

Modified:
  head/sys/kern/subr_log.c

Modified: head/sys/kern/subr_log.c
==
--- head/sys/kern/subr_log.cWed Feb  1 13:39:52 2012(r230865)
+++ head/sys/kern/subr_log.cWed Feb  1 14:34:52 2012(r230866)
@@ -59,6 +59,7 @@ staticd_close_t   logclose;
 static d_read_tlogread;
 static d_ioctl_t   logioctl;
 static d_poll_tlogpoll;
+static d_kqfilter_tlogkqfilter;
 
 static void logtimeout(void *arg);
 
@@ -69,9 +70,20 @@ static struct cdevsw log_cdevsw = {
.d_read =   logread,
.d_ioctl =  logioctl,
.d_poll =   logpoll,
+   .d_kqfilter =   logkqfilter,
.d_name =   "log",
 };
 
+static int logkqread(struct knote *note, long hint);
+static voidlogkqdetach(struct knote *note);
+
+static struct filterops log_read_filterops = {
+   .f_isfd =   1,
+   .f_attach = NULL,
+   .f_detach = logkqdetach,
+   .f_event =  logkqread,
+};
+
 static struct logsoftc {
int sc_state;   /* see above for possibilities */
struct  selinfo sc_selp;/* process waiting on select call */
@@ -181,6 +193,40 @@ logpoll(struct cdev *dev, int events, st
return (revents);
 }
 
+static int
+logkqfilter(struct cdev *dev, struct knote *kn)
+{
+
+   if (kn->kn_filter != EVFILT_READ)
+   return (EINVAL);
+
+   kn->kn_fop = &log_read_filterops;
+   kn->kn_hook = NULL;
+
+   mtx_lock(&msgbuf_lock);
+   knlist_add(&logsoftc.sc_selp.si_note, kn, 1);
+   mtx_unlock(&msgbuf_lock);
+   return (0);
+}
+
+static int
+logkqread(struct knote *kn, long hint)
+{
+
+   mtx_assert(&msgbuf_lock, MA_OWNED);
+   kn->kn_data = msgbuf_getcount(msgbufp);
+   return (kn->kn_data != 0);
+}
+
+static void
+logkqdetach(struct knote *kn)
+{
+
+   mtx_lock(&msgbuf_lock);
+   knlist_remove(&logsoftc.sc_selp.si_note, kn, 1);
+   mtx_unlock(&msgbuf_lock);
+}
+
 static void
 logtimeout(void *arg)
 {
@@ -198,6 +244,7 @@ logtimeout(void *arg)
}
msgbuftrigger = 0;
selwakeuppri(&logsoftc.sc_selp, LOG_RDPRI);
+   KNOTE_LOCKED(&logsoftc.sc_selp.si_note, 0);
if ((logsoftc.sc_state & LOG_ASYNC) && logsoftc.sc_sigio != NULL)
pgsigio(&logsoftc.sc_sigio, SIGIO, 0);
cv_broadcastpri(&log_wakeup, LOG_RDPRI);
@@ -256,6 +303,7 @@ log_drvinit(void *unused)
 
cv_init(&log_wakeup, "klog");
callout_init_mtx(&logsoftc.sc_callout, &msgbuf_lock, 0);
+   knlist_init_mtx(&logsoftc.sc_selp.si_note, &msgbuf_lock);
make_dev_credf(MAKEDEV_ETERNAL, &log_cdevsw, 0, NULL, UID_ROOT,
GID_WHEEL, 0600, "klog");
 }
___
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: r230869 - head/usr.sbin/daemon

2012-02-01 Thread Guy Helmer
Author: ghelmer
Date: Wed Feb  1 16:40:59 2012
New Revision: 230869
URL: http://svn.freebsd.org/changeset/base/230869

Log:
  Change the notes about the pidfile to include Doug's preference
  for pre-creating the pidfile with appropriate owner and permissions.
  
  Requested by dougb

Modified:
  head/usr.sbin/daemon/daemon.8

Modified: head/usr.sbin/daemon/daemon.8
==
--- head/usr.sbin/daemon/daemon.8   Wed Feb  1 15:57:49 2012
(r230868)
+++ head/usr.sbin/daemon/daemon.8   Wed Feb  1 16:40:59 2012
(r230869)
@@ -61,8 +61,9 @@ using the
 functionality.
 If the
 .Fl u
-option is used, the directory to contain the pidfile must be writable
-by the specified user.
+option is used, either the pidfile needs to have been pre-created
+with appropriate ownership and permissions, or the directory to contain
+the pidfile must be writable by the specified user.
 Note, that the file will be created shortly before the process is
 actually executed, and will remain after the process exits (although
 it will be removed if the execution fails).
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r230873 - head/lib/libkvm

2012-02-01 Thread Mikolaj Golub
Author: trociny
Date: Wed Feb  1 18:02:13 2012
New Revision: 230873
URL: http://svn.freebsd.org/changeset/base/230873

Log:
  Try to avoid ambiguity when sysctl returns ENOMEM additionally
  checking the returned oldlen: when ENOMEM is due to the supplied
  buffer being too short the return oldlen is equal to buffer size.
  
  Without this additional check kvm_getprocs() gets stuck in loop if the
  returned ENOMEM was due the exceeded memorylocked limit. This is
  easily can be observed running `limits -l 1k top'.
  
  Submitted by: Andrey Zonov 
  MFC after:1 week

Modified:
  head/lib/libkvm/kvm_proc.c

Modified: head/lib/libkvm/kvm_proc.c
==
--- head/lib/libkvm/kvm_proc.c  Wed Feb  1 17:56:38 2012(r230872)
+++ head/lib/libkvm/kvm_proc.c  Wed Feb  1 18:02:13 2012(r230873)
@@ -474,7 +474,7 @@ struct kinfo_proc *
 kvm_getprocs(kvm_t *kd, int op, int arg, int *cnt)
 {
int mib[4], st, nprocs;
-   size_t size;
+   size_t size, osize;
int temp_op;
 
if (kd->procbase != 0) {
@@ -524,10 +524,11 @@ kvm_getprocs(kvm_t *kd, int op, int arg,
_kvm_realloc(kd, kd->procbase, size);
if (kd->procbase == 0)
return (0);
+   osize = size;
st = sysctl(mib, temp_op == KERN_PROC_ALL ||
temp_op == KERN_PROC_PROC ? 3 : 4,
kd->procbase, &size, NULL, 0);
-   } while (st == -1 && errno == ENOMEM);
+   } while (st == -1 && errno == ENOMEM && size == osize);
if (st == -1) {
_kvm_syserr(kd, kd->program, "kvm_getprocs");
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"


svn commit: r230874 - head/usr.bin/sockstat

2012-02-01 Thread Mikolaj Golub
Author: trociny
Date: Wed Feb  1 18:03:21 2012
New Revision: 230874
URL: http://svn.freebsd.org/changeset/base/230874

Log:
  Try to avoid ambiguity when sysctl returns ENOMEM additionally
  checking the returned oldlen: when ENOMEM is due to the supplied
  buffer being too short the return oldlen is equal to buffer size.
  
  Without this additional check sockstat gets stuck in loop leaking the
  memory if the returned ENOMEM was due the exceeded memorylocked
  limit. This is easily can be observed running `limits -l 1k sockstat'.
  
  Submitted by: Andrey Zonov 
  MFC after:1 week

Modified:
  head/usr.bin/sockstat/sockstat.c

Modified: head/usr.bin/sockstat/sockstat.c
==
--- head/usr.bin/sockstat/sockstat.cWed Feb  1 18:02:13 2012
(r230873)
+++ head/usr.bin/sockstat/sockstat.cWed Feb  1 18:03:21 2012
(r230874)
@@ -296,7 +296,7 @@ gather_inet(int proto)
break;
if (errno == ENOENT)
goto out;
-   if (errno != ENOMEM)
+   if (errno != ENOMEM || len != bufsize)
err(1, "sysctlbyname()");
bufsize *= 2;
}
@@ -424,7 +424,7 @@ gather_unix(int proto)
len = bufsize;
if (sysctlbyname(varname, buf, &len, NULL, 0) == 0)
break;
-   if (errno != ENOMEM)
+   if (errno != ENOMEM || len != bufsize)
err(1, "sysctlbyname()");
bufsize *= 2;
}
@@ -476,14 +476,15 @@ out:
 static void
 getfiles(void)
 {
-   size_t len;
+   size_t len, olen;
 
-   if ((xfiles = malloc(len = sizeof *xfiles)) == NULL)
+   olen = len = sizeof *xfiles;
+   if ((xfiles = malloc(len)) == NULL)
err(1, "malloc()");
while (sysctlbyname("kern.file", xfiles, &len, 0, 0) == -1) {
-   if (errno != ENOMEM)
+   if (errno != ENOMEM || len != olen)
err(1, "sysctlbyname()");
-   len *= 2;
+   olen = len *= 2;
if ((xfiles = realloc(xfiles, len)) == NULL)
err(1, "realloc()");
}
___
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: r230876 - in head: share/misc usr.bin/calendar/calendars

2012-02-01 Thread Davide Italiano
Author: davide
Date: Wed Feb  1 19:46:12 2012
New Revision: 230876
URL: http://svn.freebsd.org/changeset/base/230876

Log:
  Add myself to the relevant docs.
  
  Approved by: alc, gnn (mentors)

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

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Wed Feb  1 18:05:54 2012
(r230875)
+++ head/share/misc/committers-src.dot  Wed Feb  1 19:46:12 2012
(r230876)
@@ -118,6 +118,7 @@ cokane [label="Coleman Kane\ncokane@Free
 cperciva [label="Colin Percival\ncperc...@freebsd.org\n2004/01/20"]
 csjp [label="Christian S.J. Peron\nc...@freebsd.org\n2004/05/04"]
 das [label="David Schultz\n...@freebsd.org\n2003/02/21"]
+davide [label="Davide Italiano\ndav...@freebsd.org\n2012/01/27"]
 davidxu [label="David Xu\ndavi...@freebsd.org\n2002/09/02"]
 dchagin [label="Dmitry Chagin\ndcha...@freebsd.org\n2009/02/28"]
 delphij [label="Xin Li\ndelp...@freebsd.org\n2004/09/14"]
@@ -284,6 +285,8 @@ adrian -> rmh
 
 ae -> melifaro
 
+alc -> davide
+
 andre -> qingli
 
 anholt -> jkim
@@ -376,6 +379,7 @@ gnn -> ivoras
 gnn -> vanhu
 gnn -> lstewart
 gnn -> np
+gnn -> davide
 
 grog -> edwin
 grog -> le

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdWed Feb  1 18:05:54 
2012(r230875)
+++ head/usr.bin/calendar/calendars/calendar.freebsdWed Feb  1 19:46:12 
2012(r230876)
@@ -217,6 +217,7 @@
 07/11  Jesus R. Camou  born in Hermosillo, Sonora, Mexico, 
1983
 07/15  Gary Jennejohn  born in Rochester, New York, United 
States, 1950
 07/16  Suleiman Souhlal  born in Roma, Italy, 1983
+07/16   Davide Italiano  born in Milazzo, Italy, 1989
 07/17  Michael Chin-Yuan Wu  born in Taipei, Taiwan, 
Republic of China, 1980
 07/19  Masafumi NAKANE  born in Okazaki, Aichi, Japan, 1972
 07/19  Simon L. Nielsen  born in Copenhagen, Denmark, 1980
___
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: r230877 - head/sys/vm

2012-02-01 Thread Alexander Motin
Author: mav
Date: Wed Feb  1 20:12:44 2012
New Revision: 230877
URL: http://svn.freebsd.org/changeset/base/230877

Log:
  Fix NULL dereference panic on attempt to turn off (on system shutdown)
  disconnected swap device.
  
  This is quick and imperfect solution, as swap device will still be opened
  and GEOM will not be able to destroy it. Proper solution would be to
  automatically turn off and close disconnected swap device, but with existing
  code it will cause panic if there is at least one page on device, even if
  it is unimportant page of the user-level process. It needs some work.
  
  Reviewed by:  kib@
  MFC after:1 week

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cWed Feb  1 19:46:12 2012(r230876)
+++ head/sys/vm/swap_pager.cWed Feb  1 20:12:44 2012(r230877)
@@ -2521,7 +2521,7 @@ swapgeom_orphan(struct g_consumer *cp)
mtx_lock(&sw_dev_mtx);
TAILQ_FOREACH(sp, &swtailq, sw_list)
if (sp->sw_id == cp)
-   sp->sw_id = NULL;
+   sp->sw_flags |= SW_CLOSING;
mtx_unlock(&sw_dev_mtx);
 }
 
___
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: r230878 - head/sys/conf

2012-02-01 Thread Kenneth D. Merry
Author: ken
Date: Wed Feb  1 20:18:57 2012
New Revision: 230878
URL: http://svn.freebsd.org/changeset/base/230878

Log:
  Add the netback driver to the build.
  
  MFC after:3 days

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Feb  1 20:12:44 2012(r230877)
+++ head/sys/conf/files Wed Feb  1 20:18:57 2012(r230878)
@@ -3532,6 +3532,7 @@ dev/xen/blkback/blkback.c optional xen |
 dev/xen/console/console.c  optional xen
 dev/xen/console/xencons_ring.c optional xen
 dev/xen/control/control.c  optional xen | xenhvm
+dev/xen/netback/netback.c  optional xen | xenhvm
 dev/xen/netfront/netfront.coptional xen | xenhvm
 dev/xen/xenpci/xenpci.coptional xenpci
 dev/xen/xenpci/evtchn.c optional xenpci
___
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: r230879 - head/sys/xen/interface/io

2012-02-01 Thread Kenneth D. Merry
Author: ken
Date: Wed Feb  1 20:19:33 2012
New Revision: 230879
URL: http://svn.freebsd.org/changeset/base/230879

Log:
  Add the GSO prefix descriptor define.
  
  MFC after:3 days

Modified:
  head/sys/xen/interface/io/netif.h

Modified: head/sys/xen/interface/io/netif.h
==
--- head/sys/xen/interface/io/netif.h   Wed Feb  1 20:18:57 2012
(r230878)
+++ head/sys/xen/interface/io/netif.h   Wed Feb  1 20:19:33 2012
(r230879)
@@ -173,6 +173,10 @@ typedef struct netif_rx_request netif_rx
 #define _NETRXF_extra_info (3)
 #define  NETRXF_extra_info (1U<<_NETRXF_extra_info)
 
+/* GSO Prefix descriptor. */
+#define _NETRXF_gso_prefix (4)
+#define  NETRXF_gso_prefix (1U<<_NETRXF_gso_prefix)
+
 struct netif_rx_response {
 uint16_t id;
 uint16_t offset;   /* Offset in page of start of received packet  */
___
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: r230869 - head/usr.sbin/daemon

2012-02-01 Thread Doug Barton
Thanks!  Sorry I didn't get a chance to reply to your last message,
totally buried lately.


Doug


On 02/01/2012 08:41, Guy Helmer wrote:
> Author: ghelmer
> Date: Wed Feb  1 16:40:59 2012
> New Revision: 230869
> URL: http://svn.freebsd.org/changeset/base/230869
> 
> Log:
>   Change the notes about the pidfile to include Doug's preference
>   for pre-creating the pidfile with appropriate owner and permissions.
>   
>   Requested by dougb
> 
> Modified:
>   head/usr.sbin/daemon/daemon.8
> 
> Modified: head/usr.sbin/daemon/daemon.8
> ==
> --- head/usr.sbin/daemon/daemon.8 Wed Feb  1 15:57:49 2012
> (r230868)
> +++ head/usr.sbin/daemon/daemon.8 Wed Feb  1 16:40:59 2012
> (r230869)
> @@ -61,8 +61,9 @@ using the
>  functionality.
>  If the
>  .Fl u
> -option is used, the directory to contain the pidfile must be writable
> -by the specified user.
> +option is used, either the pidfile needs to have been pre-created
> +with appropriate ownership and permissions, or the directory to contain
> +the pidfile must be writable by the specified user.
>  Note, that the file will be created shortly before the process is
>  actually executed, and will remain after the process exits (although
>  it will be removed if the execution fails).
> 



-- 

It's always a long day; 86400 doesn't fit into a short.

Breadth of IT experience, and depth of knowledge in the DNS.
Yours for the right price.  :)  http://SupersetSolutions.com/

___
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: r230897 - in head/sys: conf dev/sound/pci gnu/dev

2012-02-01 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Feb  1 21:38:01 2012
New Revision: 230897
URL: http://svn.freebsd.org/changeset/base/230897

Log:
  Use new OSS-based BSD-licensed header for cs sound driver.
  
  The cs driver requires a table with firmware values. An
  alternative firmware is available in a similar Open Sound
  System driver. This is actually a partial revert of
  Revision 77504.
  
  Special thanks to joel@ for patiently testing several
  replacement attempts.
  
  The csa driver and the complete sound system are now free
  of the GPL.
  
  Tested by:joel
  Approved by:  jhb (mentor)
  MFC after:3 weeks

Added:
  head/sys/dev/sound/pci/cs461x_dsp.h   (contents, props changed)
Deleted:
  head/sys/gnu/dev/
Modified:
  head/sys/conf/files
  head/sys/dev/sound/pci/csa.c
  head/sys/dev/sound/pci/csareg.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Feb  1 21:31:46 2012(r230896)
+++ head/sys/conf/files Wed Feb  1 21:38:01 2012(r230897)
@@ -1732,8 +1732,7 @@ dev/sound/pci/als4000.c   optional snd_al
 dev/sound/pci/atiixp.c optional snd_atiixp pci
 dev/sound/pci/cmi.coptional snd_cmi pci
 dev/sound/pci/cs4281.c optional snd_cs4281 pci
-dev/sound/pci/csa.coptional snd_csa pci \
-   warning "kernel contains GPL contaminated csaimg.h header"
+dev/sound/pci/csa.coptional snd_csa pci
 dev/sound/pci/csapcm.c optional snd_csa pci
 dev/sound/pci/ds1.coptional snd_ds1 pci
 dev/sound/pci/emu10k1.coptional snd_emu10k1 pci

Added: head/sys/dev/sound/pci/cs461x_dsp.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/sound/pci/cs461x_dsp.h Wed Feb  1 21:38:01 2012
(r230897)
@@ -0,0 +1,3497 @@
+/* $FreeBSD$ */
+/*-
+ * Copyright (C) 1996-2008, 4Front Technologies
+ * 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, WHETHERIN 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.
+ *
+ */
+/*
+ * This file is based on cs461x_dsp.h from the Open Sound System.
+ * Purpose: Firmware for cs461x/cs461x cards.
+ */
+
+#ifndef _DEV_SOUND_PCI_CS461X_DSP_H
+#define _DEV_SOUND_PCI_CS461X_DSP_H
+
+struct cs461x_firmware_struct cs461x_firmware = {
+  {{0x, 0x3000}, {0x0001, 0x3800},
+   {0x0002, 0x7000}},
+  {0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x,
+   0x, 0x, 0x0163, 0x,
+   0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x,
+   0x, 0x00200040, 0x8010, 0x,
+   0x, 0x8001, 0x0001, 0x0006,
+   0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x,
+   0x, 0x00900080, 0x0173, 0x,
+   0x, 0x0010, 0x0080, 0x0090,
+   0xf2cf, 0x0200, 0x, 0x00010600,
+   0x, 0x, 0x, 0x,
+   0x, 0x, 0x0163, 0x330300c2,
+   0x0600, 0x, 0x80008000, 0x80008000,
+   0x3fcf, 0x0301, 0x00010400, 0x,
+   0x, 0x, 0x, 0x,
+   0x, 0x00b0, 0x00d0806d, 0x330480c3,
+   0x0480, 0x0001, 0x0081, 0x,
+   0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x,
+   0x, 0x

svn commit: r230898 - in head/sys/modules/sound/driver: emu10k1 emu10kx maestro3

2012-02-01 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Feb  2 00:10:20 2012
New Revision: 230898
URL: http://svn.freebsd.org/changeset/base/230898

Log:
  Cleanup some sound headers that don't need to be in the modules makefiles.
  
  Approved by:  jhb (mentor)
  MFC after:1 week

Modified:
  head/sys/modules/sound/driver/emu10k1/Makefile
  head/sys/modules/sound/driver/emu10kx/Makefile
  head/sys/modules/sound/driver/maestro3/Makefile

Modified: head/sys/modules/sound/driver/emu10k1/Makefile
==
--- head/sys/modules/sound/driver/emu10k1/Makefile  Wed Feb  1 21:38:01 
2012(r230897)
+++ head/sys/modules/sound/driver/emu10k1/Makefile  Thu Feb  2 00:10:20 
2012(r230898)
@@ -4,7 +4,7 @@
${.CURDIR}/../../../../gnu/dev/sound/pci
 
 KMOD=  snd_emu10k1
-SRCS=  device_if.h bus_if.h emuxkireg.h pci_if.h
+SRCS=  device_if.h bus_if.h pci_if.h
 SRCS+= mpufoi_if.h
 SRCS+= emu10k1.c
 

Modified: head/sys/modules/sound/driver/emu10kx/Makefile
==
--- head/sys/modules/sound/driver/emu10kx/Makefile  Wed Feb  1 21:38:01 
2012(r230897)
+++ head/sys/modules/sound/driver/emu10kx/Makefile  Thu Feb  2 00:10:20 
2012(r230898)
@@ -11,6 +11,5 @@ SRCS+=vnode_if.h
 SRCS+= emu10kx.c
 SRCS+= emu10kx-pcm.c
 SRCS+= emu10kx-midi.c
-SRCS+= emuxkireg.h
 
 .include 

Modified: head/sys/modules/sound/driver/maestro3/Makefile
==
--- head/sys/modules/sound/driver/maestro3/Makefile Wed Feb  1 21:38:01 
2012(r230897)
+++ head/sys/modules/sound/driver/maestro3/Makefile Thu Feb  2 00:10:20 
2012(r230898)
@@ -4,7 +4,6 @@
 
 KMOD=  snd_maestro3
 SRCS=  device_if.h bus_if.h pci_if.h
-SRCS+= allegro_code.h allegro_reg.h
 SRCS+= maestro3.c
 
 CFLAGS+= -Wall -DM3_DEBUG_LEVEL=-1
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r230484 - head/release

2012-02-01 Thread Bjoern A. Zeeb

On 23. Jan 2012, at 16:17 , Nathan Whitehorn wrote:

> Author: nwhitehorn
> Date: Mon Jan 23 16:17:54 2012
> New Revision: 230484
> URL: http://svn.freebsd.org/changeset/base/230484
> 
> Log:
>  Part of r230482 didn't actually work. Revert it for now. This means PR
>  161047 isn't actually fixed.
> 

It also seems that this currently leaves the VTY0 in tail saying:
"Starting local daemons:"

^T says tail, ^C and ^Z obviously don't work and the boot seems to hang
unless you get what's going on.   Took me a couple minutes:(

We really need a big message there...  saying "please go to vtyX" at least.

See also attached screenshot.


>  PR:  bin/161047
> 
> Modified:
>  head/release/rc.local
> 
> Modified: head/release/rc.local
> ==
> --- head/release/rc.local Mon Jan 23 15:50:16 2012(r230483)
> +++ head/release/rc.local Mon Jan 23 16:17:54 2012(r230484)
> @@ -14,14 +14,12 @@ if [ $? -eq 0 ]; then
>   TERM=xterm
> 
>   if [ -z "$EXTERNAL_VTY_STARTED" ]; then
> - vidcontrol -s 2 # Switch to a VTY with no kernel messages
>   # Init will clean these processes up if/when the system
>   # goes multiuser
>   touch /tmp/bsdinstall_log
>   tail -f /tmp/bsdinstall_log > /dev/ttyv2 &
>   /usr/libexec/getty autologin ttyv3
>   EXTERNAL_VTY_STARTED=1
> - trap "vidcontrol -s 1" EXIT
>   fi
> else
>   # Serial or other console


-- 
Bjoern A. Zeeb You have to have visions!
   It does not matter how good you are. It matters what good you do!

___
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: r230878 - head/sys/conf

2012-02-01 Thread Bjoern A. Zeeb
On 1. Feb 2012, at 20:18 , Kenneth D. Merry wrote:

> Author: ken
> Date: Wed Feb  1 20:18:57 2012
> New Revision: 230878
> URL: http://svn.freebsd.org/changeset/base/230878
> 
> Log:
>  Add the netback driver to the build.

I guess only tested on amd64...

===> i386 XENHVM failed (_.i386.XENHVM):
>>> Kernel build for XENHVM started on Thu Feb  2 02:29:12 UTC 2012
/scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c: In function 
'xnb_txpkt2gnttab':

===> i386 XEN failed (_.i386.XEN):
>>> Kernel build for XEN started on Thu Feb  2 02:29:11 UTC 2012

/scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c: In function 
'xnb_free_communication_mem':
/scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c:622: error: 'kernel_map' 
undeclared (first use in this function)
/scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c:622: error: (Each 
undeclared identifier is reported only once
/scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c:622: error: for each 
function it appears in.)
/scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c: In function 
'xnb_alloc_communication_mem':
/scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c:812: error: 'kernel_map' 
undeclared (first use in this function)


>  MFC after:   3 days
> 
> Modified:
>  head/sys/conf/files
> 
> Modified: head/sys/conf/files
> ==
> --- head/sys/conf/files   Wed Feb  1 20:12:44 2012(r230877)
> +++ head/sys/conf/files   Wed Feb  1 20:18:57 2012(r230878)
> @@ -3532,6 +3532,7 @@ dev/xen/blkback/blkback.c   optional xen |
> dev/xen/console/console.c optional xen
> dev/xen/console/xencons_ring.coptional xen
> dev/xen/control/control.c optional xen | xenhvm
> +dev/xen/netback/netback.coptional xen | xenhvm
> dev/xen/netfront/netfront.c   optional xen | xenhvm
> dev/xen/xenpci/xenpci.c   optional xenpci
> dev/xen/xenpci/evtchn.c optional xenpci

-- 
Bjoern A. Zeeb You have to have visions!
   It does not matter how good you are. It matters what good you do!

___
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: r230583 - head/sys/kern

2012-02-01 Thread Konstantin Belousov
On Tue, Jan 31, 2012 at 12:48:49PM -0500, David Schultz wrote:
> On Tue, Jan 31, 2012, Konstantin Belousov wrote:
> > On Mon, Jan 30, 2012 at 02:07:03PM -0500, David Schultz wrote:
> > > On Mon, Jan 30, 2012, Kostik Belousov wrote:
> > > > On Sun, Jan 29, 2012 at 05:39:04PM -0500, David Schultz wrote:
> > > > > On Sun, Jan 29, 2012, Kostik Belousov wrote:
> > > > > > On Sat, Jan 28, 2012 at 07:12:25PM -0500, David Schultz wrote:
> > > > > > > On Sat, Jan 28, 2012, Kostik Belousov wrote:
> > > > > > > > On Fri, Jan 27, 2012 at 02:42:21PM -0500, David Schultz wrote:
> > > > > > > > > The correct limit on the maximum size of a single read/write 
> > > > > > > > > is
> > > > > > > > > SSIZE_MAX, but FreeBSD uses INT_MAX.  It's not safe to raise 
> > > > > > > > > the
> > > > > > > > > limit yet, though, because of bugs in several filesystems.  
> > > > > > > > > For
> > > > > > > > > example, FFS copies uio_resid into a local variable of type 
> > > > > > > > > int.
> > > > > > > > > I have some old patches that fix some of these issues for FFS 
> > > > > > > > > and
> > > > > > > > > cd9660, but surely there are more places I didn't notice.
> > > > > > > > > 
> > > > > > > > Absolutely agree.
> > > > > > > > 
> > > > > > > > http://people.freebsd.org/~kib/misc/uio_resid.5.patch
> > > > > > > 
> > > > > > > Nice.  You found a lot more than I've got in my tree, and you even
> > > > > > > fixed the return values.  There are at least a few more places to
> > > > > > > fix.  For instance, cd9660 and the NFS client pass uio_resid or
> > > > > > > iov_len to min(), which operates on ints.  (Incidentally, C11
> > > > > > > generics ought to make it possible to write type-generic min()
> > > > > > > and max() functions.)
> > > > > > 
> > > > > > Thank you, http://people.freebsd.org/~kib/misc/uio_resid.6.patch
> > > > > > changed them to MIN().
> > > > > 
> > > > > This looks good to me.  I tried to think of other places that you
> > > > > might have missed, and the only one that occurred to me is the
> > > > Might ? I think this is a blatant understate.
> > > > 
> > > > > pipe code.  sys_pipe.c has an `int orig_resid' and lots of bogus
> > > > > casts of iov_len and uio_resid to type u_int.  Some look harmless,
> > > > > although it appears that writing a multiple of 2^32 bytes might
> > > > > result in pipe_build_write_buffer() allocating a 0-length buffer.
> > > > > 
> > > > > My only reservation is that raising the limit could unmask a
> > > > > kernel buffer overflow if we missed something, but I guess we have
> > > > > to cross that bridge some day anyway.
> > > > Yes, and it is an obvious reason why I am chicken to commit this for
> > > > so long time. One more place, if this is reasonable to count as 'one'
> > > > place, are the cdevsw methods. devfs passes uio down to the drivers.
> > > 
> > > That's why I'm glad I'm not committing it. :)  A more conservative
> > > change (also known as "kicking the can down the road") would be to
> > > add a VFS flag, e.g., VFCF_LONGIO, and only set it on file systems
> > > that have been thoroughly reviewed.  The VFS layer could cap the size
> > > at INT_MAX for file systems without the flag.
> > At least I will get more mail after the commit, I hope.
> > 
> > I disagree with the VFCF_LONGIO approach. It will cause much head-scratching
> > for unsuspecting user who would try to use > 4GB transfers.
> > 
> > What I can do, is to commit all changes except removals of the checks
> > for INT_MAX. After type changes settle, I can try to gather enough
> > bravery to flip the checks in HEAD, possibly with temporary sysctl
> > to return to old behaviour for emergency (AKA hole).
> 
> That sounds like a good plan to me.
> 
> As an aside, I wonder if we could convince the clang folks to add
> a warning similar to `lint -a', which complains about every long->int
> narrowing conversion that doesn't have an explicit cast.  Modern
> languages such as Java and C# require casts for narrowing
> conversions, and I'd be a lot more confident about this change if
> we did the same for the FreeBSD kernel.
> 
> > > > diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
> > > > index 9edcb74..332ec37 100644
> > > > --- a/sys/kern/sys_pipe.c
> > > > +++ b/sys/kern/sys_pipe.c
> > > [...]
> > > > @@ -757,14 +757,14 @@ pipe_build_write_buffer(wpipe, uio)
> > > >struct pipe *wpipe;
> > > >struct uio *uio;
> > > >  {
> > > > -   u_int size;
> > > > +   size_t size;
> > > > int i;
> > > >  
> > > > PIPE_LOCK_ASSERT(wpipe, MA_NOTOWNED);
> > > > KASSERT(wpipe->pipe_state & PIPE_DIRECTW,
> > > >   ("Clone attempt on non-direct write 
> > > > pipe!"));
> > > >  
> > > > -   size = (u_int) uio->uio_iov->iov_len;
> > > > +   size = uio->uio_iov->iov_len;
> > > > if (size > wpipe->pipe_buffer.size)
> > > >size = wpipe->pipe_buffer.size;
> > > 
> > > The transfer can't be bigger than the max pipe buffer size (64k

svn commit: r230902 - head/sys/conf

2012-02-01 Thread Kenneth D. Merry
Author: ken
Date: Thu Feb  2 07:38:40 2012
New Revision: 230902
URL: http://svn.freebsd.org/changeset/base/230902

Log:
  Unbreak the i386 full PV (XEN kernel) build by reverting rev 230878 and
  taking the netback driver out of the build temporarily.

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Feb  2 06:39:33 2012(r230901)
+++ head/sys/conf/files Thu Feb  2 07:38:40 2012(r230902)
@@ -3531,7 +3531,6 @@ dev/xen/blkback/blkback.c optional xen |
 dev/xen/console/console.c  optional xen
 dev/xen/console/xencons_ring.c optional xen
 dev/xen/control/control.c  optional xen | xenhvm
-dev/xen/netback/netback.c  optional xen | xenhvm
 dev/xen/netfront/netfront.coptional xen | xenhvm
 dev/xen/xenpci/xenpci.coptional xenpci
 dev/xen/xenpci/evtchn.c optional xenpci
___
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: r230878 - head/sys/conf

2012-02-01 Thread Kenneth D. Merry
On Thu, Feb 02, 2012 at 03:56:03 +, Bjoern A. Zeeb wrote:
> On 1. Feb 2012, at 20:18 , Kenneth D. Merry wrote:
> 
> > Author: ken
> > Date: Wed Feb  1 20:18:57 2012
> > New Revision: 230878
> > URL: http://svn.freebsd.org/changeset/base/230878
> > 
> > Log:
> >  Add the netback driver to the build.
> 
> I guess only tested on amd64...
> 
> ===> i386 XENHVM failed (_.i386.XENHVM):
> >>> Kernel build for XENHVM started on Thu Feb  2 02:29:12 UTC 2012
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c: In function 
> 'xnb_txpkt2gnttab':
> 
> ===> i386 XEN failed (_.i386.XEN):
> >>> Kernel build for XEN started on Thu Feb  2 02:29:11 UTC 2012
> 
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c: In function 
> 'xnb_free_communication_mem':
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c:622: error: 
> 'kernel_map' undeclared (first use in this function)
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c:622: error: (Each 
> undeclared identifier is reported only once
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c:622: error: for each 
> function it appears in.)
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c: In function 
> 'xnb_alloc_communication_mem':
> /scratch/tmp/bz/head.svn/sys/dev/xen/netback/netback.c:812: error: 
> 'kernel_map' undeclared (first use in this function)

Whoops!  Sorry about that.

I backed it out until I can figure out the right way to fix it.  My build
machine is bogged down with nightly backups at the moment, so figuring out
the fix isn't going to happen tonight.

Thanks,

Ken
-- 
Kenneth Merry
k...@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"