Re: lib/libc/gen/getpwent.c diff

2011-09-04 Thread Philip Guenther
On Thu, Aug 18, 2011 at 3:36 PM, Tim van der Molen  wrote:
> When run without root privileges, getpwent(), getpwnam() and friends
> always set errno, even if they succeed. Because of this, it is
> impossible to distinguish between true errors (for which errno should be
> set) and conditions like "end of database" and "no such user" (for which
> errno should not be set).
>
> The problem is caused by __initdb() in lib/libc/gen/getpwent.c. It first
> tries to open /etc/spwd.db. If that fails, it tries /etc/pwd.db. Opening
> /etc/spwd.db always fails for non-root users and this causes errno to be
> set.
>
> The simplest solution is to save the original errno value before
> attempting to open the password databases and then restore it when
> either database has been opened successfully.

Committed (though I changed the temp variable name to "saved_errno" as
that's used in other parts of the get*ent.c code).  Thanks!


Philip Guenther



ksh hang

2011-09-04 Thread Marco Peereboom
While working on djm's wishlist I ran across a hang.

To reproduce the hang go like: "^[16000l" which would insert 16000
letter l'.  As far as I know going over the line limit makes no sense so
limit it's repetition and prevent the hang in the process.

ok?

Index: emacs.c
===
RCS file: /cvs/src/bin/ksh/emacs.c,v
retrieving revision 1.43
diff -u -p -u -p -r1.43 emacs.c
--- emacs.c 14 Mar 2011 21:20:01 -  1.43
+++ emacs.c 4 Sep 2011 20:40:25 -
@@ -1787,8 +1787,13 @@ x_set_arg(int c)
int first = 1;
 
c &= CHARMASK;  /* strip command prefix */
-   for (; c >= 0 && isdigit(c); c = x_e_getc(), first = 0)
+   for (; c >= 0 && isdigit(c); c = x_e_getc(), first = 0) {
n = n * 10 + (c - '0');
+   if (n < 0 || n > LINE) {
+   c = -1;
+   break;
+   }
+   }
if (c < 0 || first) {
x_e_putc(BEL);
x_arg = 1;



Support for ALPS touchpads

2011-09-04 Thread Martin Pieuchot
The diff below adds support for ALPS touchpads to the pms(4) driver.

I'm looking for testers with or without ALPS hardware, especially if you
have a touchpad, to be sure it doesn't break anything.

Currently, ALPS DualPoint are untested and support for special buttons
(back, forward, etc) is missing because I don't have such hardware.

I use the following synaptics(4) configuration for edge scrolling and
simple left tapping:

xinput set-prop /dev/wsmouse0 "Synaptics Finger" 25 30 60
xinput set-int-prop /dev/wsmouse0 "Synaptics Tap Action" 8 0 0 2 3 1 0 0
xinput set-int-prop /dev/wsmouse0 "Synaptics Click Action" 8 1 0 0
xinput set-int-prop /dev/wsmouse0 "Synaptics Edge Scrolling" 8 1 0 0


Compared to the previous version, I left the Y-axis translation because
it's also needed for the COMPAT mode.

Comments?

Martin


Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.21
diff -u -p -r1.21 pms.c
--- pms.c   24 Aug 2011 15:34:25 -  1.21
+++ pms.c   4 Sep 2011 18:11:32 -
@@ -39,6 +39,14 @@
 #include 
 #include 
 
+#define DEBUG
+
+#ifdef DEBUG
+#define DPRINTF(x...)  do { printf(x); } while (0);
+#else
+#define DPRINTF(x...)
+#endif
+
 #define DEVNAME(sc)((sc)->sc_dev.dv_xname)
 
 #define WSMOUSE_BUTTON(x)  (1 << ((x) - 1))
@@ -50,6 +58,7 @@ struct pms_protocol {
 #define PMS_STANDARD   0
 #define PMS_INTELLI1
 #define PMS_SYNAPTICS  2
+#define PMS_ALPS   3
u_int packetsize;
int (*enable)(struct pms_softc *);
int (*ioctl)(struct pms_softc *, u_long, caddr_t, int, struct proc *);
@@ -78,6 +87,22 @@ struct synaptics_softc {
 #define SYNAPTICS_PRESSURE 30
 };
 
+struct alps_softc {
+   int model;
+#define ALPS_PASSTHROUGH   (1 << 1)
+
+
+   int min_x, min_y;
+   int max_x, max_y;
+   int old_fin;
+
+   /* Compat mode */
+   int wsmode;
+   int old_x, old_y;
+   u_int old_buttons;
+#define ALPS_PRESSURE  40
+};
+
 struct pms_softc { /* driver status information */
struct device sc_dev;
 
@@ -98,6 +123,7 @@ struct pms_softc {   /* driver status inf
 
const struct pms_protocol *protocol;
struct synaptics_softc *synaptics;
+   struct alps_softc *alps;
 
u_char packet[8];
 
@@ -116,6 +142,19 @@ static const u_int butmap[8] = {
WSMOUSE_BUTTON(1) | WSMOUSE_BUTTON(2) | WSMOUSE_BUTTON(3)
 };
 
+static const struct alps_quirk {
+   int version;
+   int model;
+} alps_quirks[] = {
+   { 0x2021, ALPS_PASSTHROUGH },
+   { 0x2221, ALPS_PASSTHROUGH },
+   { 0x, ALPS_PASSTHROUGH },
+   { 0x3222, ALPS_PASSTHROUGH },
+   { 0x5212, ALPS_PASSTHROUGH },
+   { 0x6222, ALPS_PASSTHROUGH },
+   { 0x633b, ALPS_PASSTHROUGH },
+};
+
 intpmsprobe(struct device *, void *, void *);
 void   pmsattach(struct device *, struct device *, void *);
 intpmsactivate(struct device *, int);
@@ -150,6 +189,11 @@ intpms_sync_synaptics(struct pms_softc 
 void   pms_proc_synaptics(struct pms_softc *);
 void   pms_disable_synaptics(struct pms_softc *);
 
+intpms_enable_alps(struct pms_softc *);
+intpms_ioctl_alps(struct pms_softc *, u_long, caddr_t, int, struct proc *);
+intpms_sync_alps(struct pms_softc *, int);
+void   pms_proc_alps(struct pms_softc *);
+
 intsynaptics_set_mode(struct pms_softc *, int);
 intsynaptics_query(struct pms_softc *, int, int *);
 intsynaptics_get_hwinfo(struct pms_softc *);
@@ -160,6 +204,8 @@ int synaptics_pt_ioctl(void *, u_long, c
 intsynaptics_pt_enable(void *);
 void   synaptics_pt_disable(void *);
 
+intalps_get_hwinfo(struct pms_softc *);
+
 struct cfattach pms_ca = {
sizeof(struct pms_softc), pmsprobe, pmsattach, NULL,
pmsactivate
@@ -208,7 +254,16 @@ const struct pms_protocol pms_protocols[
pms_sync_synaptics,
pms_proc_synaptics,
pms_disable_synaptics
-   }
+   },
+   /* ALPS touchpad */
+   {
+   PMS_ALPS, 6,
+   pms_enable_alps,
+   pms_ioctl_alps,
+   pms_sync_alps,
+   pms_proc_alps,
+   NULL
+   },
 };
 
 int
@@ -965,4 +1020,226 @@ pms_disable_synaptics(struct pms_softc *
if (syn->capabilities & SYNAPTICS_CAP_SLEEP)
synaptics_set_mode(sc, SYNAPTICS_SLEEP_MODE |
SYNAPTICS_DISABLE_GESTURE);
+}
+
+int
+alps_get_hwinfo(struct pms_softc *sc)
+{
+   struct alps_softc *alps = sc->alps;
+   u_char resp[3];
+   int version, i;
+
+   if (pms_set_resolution(sc, 0) ||
+   pms_set_scaling(sc, 2) ||
+   pms_set_scaling(sc, 2) ||
+   pms_set_scaling(sc, 2) ||
+   pms_get_status(sc, resp)) {
+   DPRINTF("%s: alps: model query error\n", DEVNAME(sc));
+   return (-1);
+   }
+
+   version = (resp[0] << 8) | (resp

Re: lib/libc/gen/getpwent.c diff

2011-09-04 Thread Tim van der Molen
Resending.

On Fri, 19 Aug 2011 00:36:51 +0200, Tim van der Molen wrote:
> When run without root privileges, getpwent(), getpwnam() and friends
> always set errno, even if they succeed. Because of this, it is
> impossible to distinguish between true errors (for which errno should be
> set) and conditions like "end of database" and "no such user" (for which
> errno should not be set).
> 
> The problem is caused by __initdb() in lib/libc/gen/getpwent.c. It first
> tries to open /etc/spwd.db. If that fails, it tries /etc/pwd.db. Opening
> /etc/spwd.db always fails for non-root users and this causes errno to be
> set.
> 
> The simplest solution is to save the original errno value before
> attempting to open the password databases and then restore it when
> either database has been opened successfully.
> 
> Regards,
> Tim
> 
> Index: getpwent.c
> ===
> RCS file: /cvs/src/lib/libc/gen/getpwent.c,v
> retrieving revision 1.42
> diff -p -u -r1.42 getpwent.c
> --- getpwent.c21 Nov 2009 10:24:59 -  1.42
> +++ getpwent.c12 Aug 2011 23:30:07 -
> @@ -844,14 +844,18 @@ static int
>  __initdb(void)
>  {
>   static int warned;
> + int oerrno;
>  
>  #ifdef YP
>   __ypmode = YPMODE_NONE;
>   __getpwent_has_yppw = -1;
>  #endif
> + oerrno = errno;
>   if ((_pw_db = dbopen(_PATH_SMP_DB, O_RDONLY, 0, DB_HASH, NULL)) ||
> - (_pw_db = dbopen(_PATH_MP_DB, O_RDONLY, 0, DB_HASH, NULL)))
> + (_pw_db = dbopen(_PATH_MP_DB, O_RDONLY, 0, DB_HASH, NULL))) {
> + errno = oerrno;
>   return (1);
> + }
>   if (!warned)
>   syslog(LOG_ERR, "%s: %m", _PATH_MP_DB);
>   warned = 1;



Re: New udav(4) vendor diff

2011-09-04 Thread Jonathan Gray
The vendor part should be sorted by number, I fixed that part
up and committed, thanks.

On Sat, Sep 03, 2011 at 03:41:57AM -0400, Loganaden Velvindron wrote:
> I added it to the usbdevs file, and
> modified the device probe code in if_udav.c
> 
> Index: usbdevs
> ===
> RCS file: /cvs/src/sys/dev/usb/usbdevs,v
> retrieving revision 1.553
> diff -u -p -r1.553 usbdevs
> --- usbdevs   29 Aug 2011 10:51:18 -  1.553
> +++ usbdevs   3 Sep 2011 07:26:16 -
> @@ -431,6 +431,7 @@ vendor CONCEPTRONIC   0x0d8e  Conceptronic
>  vendor MSI   0x0db0  Micro Star International
>  vendor ELCON 0x0db7  ELCON Systemtechnik
>  vendor UNKNOWN5  0x0dcd  Unknown Vendor
> +vendor UNKNOWN6  0x01e1  Unknown Vendor
>  vendor SITECOMEU 0x0df6  Sitecom Europe
>  vendor MOBILEACTION  0x0df7  Mobile Action
>  vendor AMIGO 0x0e0b  Amigo Technology
> @@ -3787,6 +3788,9 @@ product UNKNOWN4 DM9601 0x8101 DM9601
>  
>  /* Unknown vendor 5 */
>  product UNKNOWN5 NF_RIC  0x0001  NF RIC
> +
> +/* Unknown vendor 6 */
> +product UNKNOWN6 DM9601  0x9601 DM9601
>  
>  /* U.S. Robotics products */
>  product USR USR1120  0x00eb  USR1120 WLAN
> Index: if_udav.c
> ===
> RCS file: /cvs/src/sys/dev/usb/if_udav.c,v
> retrieving revision 1.57
> diff -u -p -r1.57 if_udav.c
> --- if_udav.c 3 Jul 2011 15:47:17 -   1.57
> +++ if_udav.c 3 Sep 2011 07:26:16 -
> @@ -167,7 +167,8 @@ static const struct udav_type {
>   {{ USB_VENDOR_SHANTOU, USB_PRODUCT_SHANTOU_ST268 }, 0 },
>   {{ USB_VENDOR_SHANTOU, USB_PRODUCT_SHANTOU_ZT6688 }, 0 },
>   {{ USB_VENDOR_SHANTOU, USB_PRODUCT_SHANTOU_ADM8515 }, 0 },
> - {{ USB_VENDOR_UNKNOWN4, USB_PRODUCT_UNKNOWN4_DM9601 }, 0 }
> + {{ USB_VENDOR_UNKNOWN4, USB_PRODUCT_UNKNOWN4_DM9601 }, 0 },
> + {{ USB_VENDOR_UNKNOWN6, USB_PRODUCT_UNKNOWN6_DM9601 }, 0 }
>  };
>  #define udav_lookup(v, p) ((struct udav_type *)usb_lookup(udav_devs, v, p))



Re: device IDs from Gigabyte H61 board

2011-09-04 Thread Jonathan Gray
On Sun, Sep 04, 2011 at 02:56:48PM +0200, Martin Pelikan wrote:
> On Sun, Sep 04, 2011 at 09:50:26PM +1000, Jonathan Gray wrote:
> > The H61 LPC correction is fine but do you actually have
> > this 0x1c51 device?  It doesn't appear in the Intel 6 series
> > datasheets, perhaps just stick with the correction.
> 
> No, I don't have that one. I didn't know Intel releases this stuff
> officially, so thanks for the info.

http://www.intel.com/products/notebook/chipsets/6series/technicaldocuments.htm

The numbers for the lpc devices are listed in the "specification update".

> 
> 
> On Sun, Sep 04, 2011 at 02:05:42PM +0200, Mark Kettenis wrote:
> > >  product INTEL2 RMH   0x0020  Rate Matching Hub
> > > +product INTEL2 RMH_SANDYBRIDGE   0x0024  Rate Matching Hub
> > 
> > The hub is part of the PCH rather than the CPU, so the "Sandybridge"
> > codename doesn't apply.  I'll see if I can come up with a better
> > naming scheme.
> 
> What I meant was 'the one found on chipset made for Sandy Bridges'.
> RMH_1 and RMH_2 as suggested by jsg is probably better idea, as I don't
> know their existence on chipsets for sure.

committed it this way.



Re: New udav(4) vendor diff

2011-09-04 Thread Loganaden Velvindron
I forgot about the dmesg:
udav0 at uhub3 port 2 "DM9601 USB NIC DM9601 USB NIC" rev 1.10/1.01 addr 2
amphy0 at udav0 phy 0: DM9601 10/100 PHY, rev. 0

usbdevs -v

 port 2 addr 2: full speed, power 144 mA, config 1, DM9601 USB NIC(0x9601), 
DM9601 USB NIC(0x01e1), rev 1.01, iSerialNumber 9601



Re: device IDs from Gigabyte H61 board

2011-09-04 Thread Martin Pelikan
On Sun, Sep 04, 2011 at 09:50:26PM +1000, Jonathan Gray wrote:
> The H61 LPC correction is fine but do you actually have
> this 0x1c51 device?  It doesn't appear in the Intel 6 series
> datasheets, perhaps just stick with the correction.

No, I don't have that one. I didn't know Intel releases this stuff
officially, so thanks for the info.


On Sun, Sep 04, 2011 at 02:05:42PM +0200, Mark Kettenis wrote:
> >  product INTEL2 RMH 0x0020  Rate Matching Hub
> > +product INTEL2 RMH_SANDYBRIDGE 0x0024  Rate Matching Hub
> 
> The hub is part of the PCH rather than the CPU, so the "Sandybridge"
> codename doesn't apply.  I'll see if I can come up with a better
> naming scheme.

What I meant was 'the one found on chipset made for Sandy Bridges'.
RMH_1 and RMH_2 as suggested by jsg is probably better idea, as I don't
know their existence on chipsets for sure.
--
Martin Pelikan


Index: dev/usb/usbdevs
===
RCS file: /cvs/src/sys/dev/usb/usbdevs,v
retrieving revision 1.553
diff -u -p -r1.553 usbdevs
--- dev/usb/usbdevs 29 Aug 2011 10:51:18 -  1.553
+++ dev/usb/usbdevs 4 Sep 2011 12:55:38 -
@@ -2049,7 +2049,8 @@ product INSYSTEM USBCABLE 0x081a  USB cab
 product INSYSTEM ADAPTERV2 0x5701  USB Storage Adapter V2
 
 /* Intel products */
-product INTEL2 RMH 0x0020  Rate Matching Hub
+product INTEL2 RMH_1   0x0020  Rate Matching Hub
+product INTEL2 RMH_2   0x0024  Rate Matching Hub
 product INTEL EASYPC_CAMERA0x0110  EasyPC
 product INTEL AP3100x0200  AP310 AnyPoint II
 product INTEL I2011B   0x  Wireless 2011B



Re: device IDs from Gigabyte H61 board

2011-09-04 Thread Mark Kettenis
> Hi!
> 
> I'm working with Gigabyte H61M-S2V-B3 right now. Graphics built in CPU
> supports at most 800x600 in X.org, but the rest of the machine seems
> fine. Dmesg at dmesg@ and at NYCBUG database.
> 
> 
> Index: dev/pci/pcidevs
> ===
> RCS file: /cvs/src/sys/dev/pci/pcidevs,v
> retrieving revision 1.1618
> diff -u -p -r1.1618 pcidevs
> --- dev/pci/pcidevs   30 Aug 2011 15:57:10 -  1.1618
> +++ dev/pci/pcidevs   3 Sep 2011 23:04:45 -
> @@ -2603,10 +2603,11 @@ product INTEL QS67_LPC0x1c4d  QS67 LPC
>  product INTEL Q67_LPC0x1c4e  Q67 LPC
>  product INTEL QM67_LPC   0x1c4f  QM67 LPC
>  product INTEL B65_LPC0x1c50  B65 LPC
> -product INTEL H61_LPC0x1c51  H61 LPC
> +product INTEL 6SERIES_LPC0x1c51  6 Series LPC
>  product INTEL C202_LPC   0x1c52  C202 LPC
>  product INTEL C204_LPC   0x1c54  C204 LPC
>  product INTEL C206_LPC   0x1c56  C206 LPC
> +product INTEL H61_LPC0x1c5c  H61 LPC
>  product INTEL 82801AA_LPC0x2410  82801AA LPC
>  product INTEL 82801AA_IDE0x2411  82801AA IDE
>  product INTEL 82801AA_USB0x2412  82801AA USB

The authoritive source for these is the Intel specification update for
the chipset.  The "old" H61 entry isn't mentioned there, so I removed
it instead of renaming it.

> Index: dev/usb/usbdevs
> ===
> RCS file: /cvs/src/sys/dev/usb/usbdevs,v
> retrieving revision 1.553
> diff -u -p -r1.553 usbdevs
> --- dev/usb/usbdevs   29 Aug 2011 10:51:18 -  1.553
> +++ dev/usb/usbdevs   3 Sep 2011 23:04:46 -
> @@ -2050,6 +2050,7 @@ product INSYSTEM ADAPTERV2  0x5701  USB St
>  
>  /* Intel products */
>  product INTEL2 RMH   0x0020  Rate Matching Hub
> +product INTEL2 RMH_SANDYBRIDGE   0x0024  Rate Matching Hub

The hub is part of the PCH rather than the CPU, so the "Sandybridge"
codename doesn't apply.  I'll see if I can come up with a better
naming scheme.

Thanks,

Mark



Re: device IDs from Gigabyte H61 board

2011-09-04 Thread Jonathan Gray
On Sun, Sep 04, 2011 at 01:41:26AM +0200, Martin Pelikan wrote:
> Hi!
> 
> I'm working with Gigabyte H61M-S2V-B3 right now. Graphics built in CPU
> supports at most 800x600 in X.org, but the rest of the machine seems
> fine. Dmesg at dmesg@ and at NYCBUG database.
> 
> However, these are missing (fixed with the aid of UCW's database).
> 
> --
> Martin Pelikan
> 
> 
> Index: dev/pci/pcidevs
> ===
> RCS file: /cvs/src/sys/dev/pci/pcidevs,v
> retrieving revision 1.1618
> diff -u -p -r1.1618 pcidevs
> --- dev/pci/pcidevs   30 Aug 2011 15:57:10 -  1.1618
> +++ dev/pci/pcidevs   3 Sep 2011 23:04:45 -
> @@ -2603,10 +2603,11 @@ product INTEL QS67_LPC0x1c4d  QS67 LPC
>  product INTEL Q67_LPC0x1c4e  Q67 LPC
>  product INTEL QM67_LPC   0x1c4f  QM67 LPC
>  product INTEL B65_LPC0x1c50  B65 LPC
> -product INTEL H61_LPC0x1c51  H61 LPC
> +product INTEL 6SERIES_LPC0x1c51  6 Series LPC

The H61 LPC correction is fine but do you actually have
this 0x1c51 device?  It doesn't appear in the Intel 6 series
datasheets, perhaps just stick with the correction.

>  product INTEL C202_LPC   0x1c52  C202 LPC
>  product INTEL C204_LPC   0x1c54  C204 LPC
>  product INTEL C206_LPC   0x1c56  C206 LPC
> +product INTEL H61_LPC0x1c5c  H61 LPC
>  product INTEL 82801AA_LPC0x2410  82801AA LPC
>  product INTEL 82801AA_IDE0x2411  82801AA IDE
>  product INTEL 82801AA_USB0x2412  82801AA USB
> Index: dev/usb/usbdevs
> ===
> RCS file: /cvs/src/sys/dev/usb/usbdevs,v
> retrieving revision 1.553
> diff -u -p -r1.553 usbdevs
> --- dev/usb/usbdevs   29 Aug 2011 10:51:18 -  1.553
> +++ dev/usb/usbdevs   3 Sep 2011 23:04:46 -
> @@ -2050,6 +2050,7 @@ product INSYSTEM ADAPTERV2  0x5701  USB St
>  
>  /* Intel products */
>  product INTEL2 RMH   0x0020  Rate Matching Hub
> +product INTEL2 RMH_SANDYBRIDGE   0x0024  Rate Matching Hub

This isn't part of the processor so the name is misleading
I had them as RMH_1 and RHM_2 in my local tree.



Re: relayd socket splicing timeout

2011-09-04 Thread Alexander Bluhm
On Sat, Sep 03, 2011 at 02:25:37AM +0200, Alexander Bluhm wrote:
> During socket splicing the relayd session timeouts could not be
> measured exactly in user land.  Use the new idle timeout for socket
> splicing in the kernel to make it correct.

I think, I got the flag handling wrong.  Make sure that the error
flag is set.

-+  if (error & (EVBUFFER_READ|EVBUFFER_ERROR) && errno == ETIMEDOUT) {
++  if (error & EVBUFFER_ERROR && errno == ETIMEDOUT) {

Updated diff below.

bluhm


Index: usr.sbin/relayd/parse.y
===
RCS file: /cvs/src/usr.sbin/relayd/parse.y,v
retrieving revision 1.158
diff -u -p -r1.158 parse.y
--- usr.sbin/relayd/parse.y 26 May 2011 14:48:20 -  1.158
+++ usr.sbin/relayd/parse.y 4 Sep 2011 11:22:59 -
@@ -833,13 +833,6 @@ proto  : relay_proto PROTO STRING  {
p->type = $1;
p->cache = RELAY_CACHESIZE;
p->tcpflags = TCPFLAG_DEFAULT;
-   if (p->type != RELAY_PROTO_TCP) {
-   /*
-* Splicing is currently only supported
-* for plain TCP relays.
-*/
-   p->tcpflags |= TCPFLAG_NSPLICE;
-   }
p->sslflags = SSLFLAG_DEFAULT;
p->tcpbacklog = RELAY_BACKLOG;
(void)strlcpy(p->sslciphers, SSLCIPHERS_DEFAULT,
Index: usr.sbin/relayd/relay.c
===
RCS file: /cvs/src/usr.sbin/relayd/relay.c,v
retrieving revision 1.140
diff -u -p -r1.140 relay.c
--- usr.sbin/relayd/relay.c 4 Sep 2011 10:42:47 -   1.140
+++ usr.sbin/relayd/relay.c 4 Sep 2011 11:23:03 -
@@ -77,10 +77,12 @@ u_int32_trelay_hash_addr(struct sockad
 
 voidrelay_write(struct bufferevent *, void *);
 voidrelay_read(struct bufferevent *, void *);
-int relay_splicelen(struct ctl_relay_event *);
 voidrelay_error(struct bufferevent *, short, void *);
 voidrelay_dump(struct ctl_relay_event *, const void *, size_t);
 
+int relay_splice(struct ctl_relay_event *);
+int relay_splicelen(struct ctl_relay_event *);
+
 int relay_resolve(struct ctl_relay_event *,
struct protonode *, struct protonode *);
 int relay_handle_http(struct ctl_relay_event *,
@@ -675,26 +677,10 @@ relay_connected(int fd, short sig, void 
}
break;
case RELAY_PROTO_TCP:
-   if ((proto->tcpflags & TCPFLAG_NSPLICE) ||
-   (rlay->rl_conf.flags & (F_SSL|F_SSLCLIENT)))
-   break;
-   if (setsockopt(con->se_in.s, SOL_SOCKET, SO_SPLICE,
-   &con->se_out.s, sizeof(int)) == -1) {
-   log_debug("%s: session %d: splice forward failed: %s",
-   __func__, con->se_id, strerror(errno));
-   return;
-   }
-   con->se_in.splicelen = 0;
-   if (setsockopt(con->se_out.s, SOL_SOCKET, SO_SPLICE,
-   &con->se_in.s, sizeof(int)) == -1) {
-   log_debug("%s: session %d: splice backward failed: %s",
-   __func__, con->se_id, strerror(errno));
-   return;
-   }
-   con->se_out.splicelen = 0;
+   /* Use defaults */
break;
default:
-   fatalx("relay_input: unknown protocol");
+   fatalx("relay_connected: unknown protocol");
}
 
/*
@@ -719,6 +705,9 @@ relay_connected(int fd, short sig, void 
bufferevent_settimeout(bev,
rlay->rl_conf.timeout.tv_sec, rlay->rl_conf.timeout.tv_sec);
bufferevent_enable(bev, EV_READ|EV_WRITE);
+
+   if (relay_splice(&con->se_out) == -1)
+   relay_close(con, strerror(errno));
 }
 
 void
@@ -766,6 +755,9 @@ relay_input(struct rsession *con)
bufferevent_settimeout(con->se_in.bev,
rlay->rl_conf.timeout.tv_sec, rlay->rl_conf.timeout.tv_sec);
bufferevent_enable(con->se_in.bev, EV_READ|EV_WRITE);
+
+   if (relay_splice(&con->se_in) == -1)
+   relay_close(con, strerror(errno));
 }
 
 void
@@ -1842,16 +1834,46 @@ relay_close_http(struct rsession *con, u
 }
 
 int
+relay_splice(struct ctl_relay_event *cre)
+{
+   struct rsession *con = cre->con;
+   struct relay*rlay = (struct relay *)con->se_relay;
+   struct protocol *proto = rlay->rl_proto;
+   struct splicesp;
+
+   if ((rlay->rl_conf.flags & (F_SSL|F_SSLCLIENT)) ||
+   (proto->tcpflags & TCPFLAG_NSPLICE))
+   return (0);
+
+   if (cre->bev->readcb !

Re: problem in manual page for ip(4)

2011-09-04 Thread Jason McIntyre
On Fri, Sep 02, 2011 at 01:01:37PM -0700, Matthew Dempsky wrote:
> Our sys/socket.h and netinet/in.h headers do require sys/types.h, so
> it seems consistent to at least document that.  ok matthew@
> 
> (POSIX requires headers to be self-sufficient, but we're a ways off from
> that.)
> 

there was no diff attached, so i've no idea what the fix is. can you
sort this as you see best, please?

thanks,
jmc

> On Thu, Sep 1, 2011 at 11:42 PM, Jason McIntyre  wrote:
> > can a developer weigh in on this, please?
> > jmc
> >
> > On Thu, Aug 25, 2011 at 02:44:21PM +0200, Thomas de Grivel wrote:
> >> Hi,
> >>
> >> From ip(4) :
> >>
> >> SYNOPSIS
> >>  #include 
> >>  #include 
> >>
> >> However this fails :
> >>
> >> $ cat > ip.c
> >> #include 
> >> #include 
> >>
> >> int main() {
> >>   return 0;
> >> }
> >> ^D
> >> $ gcc ip.c
> >> In file included from ip.c:1:
> >> /usr//include/sys/socket.h:105: error: expected specifier-qualifier-list
> >> before 'off_t'
> >> /usr//include/sys/socket.h:162: error: expected specifier-qualifier-list
> >> before 'u_int8_t'
> >> /usr//include/sys/socket.h:180: error: expected specifier-qualifier-list
> >> before 'u_int8_t'
> >> /usr//include/sys/socket.h:249: error: expected specifier-qualifier-list
> >> before 'uid_t'
> >> /usr//include/sys/socket.h:394: error: expected specifier-qualifier-list
> >> before 'socklen_t'
> >> /usr//include/sys/socket.h:420: error: expected specifier-qualifier-list
> >> before 'socklen_t'
> >> /usr//include/sys/socket.h:476: error: expected specifier-qualifier-list
> >> before 'caddr_t'
> >> In file included from ip.c:1:
> >> /usr//include/sys/socket.h:491: error: expected declaration specifiers
> >> or '...' before 'socklen_t'
> >> /usr//include/sys/socket.h:492: error: expected declaration specifiers
> >> or '...' before 'socklen_t'
> >> /usr//include/sys/socket.h:493: error: expected declaration specifiers
> >> or '...' before 'socklen_t'
> >> /usr//include/sys/socket.h:494: error: expected declaration specifiers
> >> or '...' before 'uid_t'
> >> /usr//include/sys/socket.h:494: error: expected declaration specifiers
> >> or '...' before 'gid_t'
> >> /usr//include/sys/socket.h:495: error: expected declaration specifiers
> >> or '...' before 'socklen_t'
> >> /usr//include/sys/socket.h:496: error: expected declaration specifiers
> >> or '...' before 'socklen_t'
> >> /usr//include/sys/socket.h:497: error: expected declaration specifiers
> >> or '...' before 'socklen_t'
> >> /usr//include/sys/socket.h:499: error: expected '=', ',', ';', 'asm' or
> >> '__attribute__' before 'recv'
> >> /usr//include/sys/socket.h:500: error: expected '=', ',', ';', 'asm' or
> >> '__attribute__' before 'recvfrom'
> >> /usr//include/sys/socket.h:501: error: expected '=', ',', ';', 'asm' or
> >> '__attribute__' before 'recvmsg'
> >> /usr//include/sys/socket.h:502: error: expected '=', ',', ';', 'asm' or
> >> '__attribute__' before 'send'
> >> /usr//include/sys/socket.h:503: error: expected '=', ',', ';', 'asm' or
> >> '__attribute__' before 'sendto'
> >> /usr//include/sys/socket.h:505: error: expected '=', ',', ';', 'asm' or
> >> '__attribute__' before 'sendmsg'
> >> /usr//include/sys/socket.h:506: error: expected declaration specifiers
> >> or '...' before 'socklen_t'
> >> In file included from ip.c:2:
> >> /usr//include/netinet/in.h:141: error: expected specifier-qualifier-list
> >> before 'in_addr_t'
> >> /usr//include/netinet/in.h:225: error: expected specifier-qualifier-list
> >> before 'u_int8_t'
> >> /usr//include/netinet/in.h:244: error: expected specifier-qualifier-list
> >> before 'int8_t'
> >> In file included from /usr//include/netinet/in.h:732,
> >>  from ip.c:2:
> >> /usr//include/netinet6/in6.h:118: error: expected
> >> specifier-qualifier-list before 'u_int8_t'
> >> /usr//include/netinet6/in6.h:140: error: expected
> >> specifier-qualifier-list before 'u_int8_t'
> >> /usr//include/netinet6/in6.h:392: error: expected
> >> specifier-qualifier-list before 'u_long'
> >> /usr//include/netinet6/in6.h:515: error: expected
> >> specifier-qualifier-list before 'u_int32_t'
> >> /usr//include/netinet6/in6.h:799: error: expected ';', ',' or ')' before
> >> '*' token
> >> /usr//include/netinet6/in6.h:801: error: expected '=', ',', ';', 'asm'
> >> or '__attribute__' before '*' token
> >> /usr//include/netinet6/in6.h:802: error: expected declaration specifiers
> >> or '...' before 'u_int8_t'
> >> /usr//include/netinet6/in6.h:803: error: expected declaration specifiers
> >> or '...' before 'u_int8_t'
> >> /usr//include/netinet6/in6.h:805: error: expected '=', ',', ';', 'asm'
> >> or '__attribute__' before 'inet6_rthdr_space'
> >> /usr//include/netinet6/in6.h:817: error: expected declaration specifiers
> >> or '...' before 'socklen_t'
> >> /usr//include/netinet6/in6.h:818: error: expected declaration specifiers
> >> or '...' before 'socklen_t'
> >> /usr//include/netinet6/in6.h:818: error: expected declaration specifiers
> >> or '...' before 'u_int8_t'

Re: disklabel(8) typo

2011-09-04 Thread Jason McIntyre
On Sun, Sep 04, 2011 at 01:59:11AM +0200, Martin Pelikan wrote:
> Index: disklabel.8
> ===
> RCS file: /cvs/src/sbin/disklabel/disklabel.8,v
> retrieving revision 1.103
> diff -u -p -r1.103 disklabel.8
> --- disklabel.8   5 Jun 2011 11:57:17 -   1.103
> +++ disklabel.8   3 Sep 2011 23:45:26 -
> @@ -163,7 +163,7 @@ Write entries to
>  in
>  .Xr fstab 5
>  format for any partitions for which mount point information is known.
> -The entries will written using disklabel UIDs.
> +The entries will be written using disklabel UIDs.
>  The
>  .Fl F
>  flag is only valid when used in conjunction with the
> 

fixed, thanks.
jmc